All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
sbn::TransferTrackT0 Class Reference
Inheritance diagram for sbn::TransferTrackT0:

Public Member Functions

 TransferTrackT0 (fhicl::ParameterSet const &p)
 
 TransferTrackT0 (TransferTrackT0 const &)=delete
 
 TransferTrackT0 (TransferTrackT0 &&)=delete
 
TransferTrackT0operator= (TransferTrackT0 const &)=delete
 
TransferTrackT0operator= (TransferTrackT0 &&)=delete
 
void produce (art::Event &e) override
 

Private Attributes

art::InputTag fTrackLabelIn
 
art::InputTag fT0Label
 
art::InputTag fTrackLabelOut
 

Detailed Description

Definition at line 31 of file TransferTrackT0_module.cc.

Constructor & Destructor Documentation

sbn::TransferTrackT0::TransferTrackT0 ( fhicl::ParameterSet const &  p)
explicit

Definition at line 55 of file TransferTrackT0_module.cc.

56  : EDProducer{p},
57  fTrackLabelIn(p.get<art::InputTag>("TrackLabelIn")),
58  fT0Label(p.get<art::InputTag>("T0Label")),
59  fTrackLabelOut(p.get<art::InputTag>("TrackLabelOut"))
60 {
61  produces<art::Assns<recob::Track, anab::T0>>();
62 }
pdgs p
Definition: selectors.fcl:22
sbn::TransferTrackT0::TransferTrackT0 ( TransferTrackT0 const &  )
delete
sbn::TransferTrackT0::TransferTrackT0 ( TransferTrackT0 &&  )
delete

Member Function Documentation

TransferTrackT0& sbn::TransferTrackT0::operator= ( TransferTrackT0 const &  )
delete
TransferTrackT0& sbn::TransferTrackT0::operator= ( TransferTrackT0 &&  )
delete
void sbn::TransferTrackT0::produce ( art::Event &  e)
override

Definition at line 64 of file TransferTrackT0_module.cc.

65 {
66  // define output data
67  std::unique_ptr<art::Assns<recob::Track, anab::T0>> assn(new art::Assns<recob::Track, anab::T0>);
68 
69  // Collect input data
70  art::Handle<std::vector<recob::Track>> intrack_handle;
71  e.getByLabel(fTrackLabelIn, intrack_handle);
72 
73  std::vector<art::Ptr<recob::Track>> intracks;
74  art::fill_ptr_vector(intracks, intrack_handle);
75 
76  art::FindManyP<anab::T0> fmT0s(intracks, e, fT0Label);
77  art::FindManyP<recob::PFParticle> fmInParticles(intracks, e, fTrackLabelIn);
78 
79  art::Handle<std::vector<recob::Track>> outtrack_handle;
80  e.getByLabel(fTrackLabelOut, outtrack_handle);
81 
82  std::vector<art::Ptr<recob::Track>> outtracks;
83  art::fill_ptr_vector(outtracks, outtrack_handle);
84 
85  art::FindManyP<recob::PFParticle> fmOutParticles(outtracks, e, fTrackLabelOut);
86 
87  // process input data
88  for (unsigned i_in = 0; i_in < intracks.size(); i_in++) {
89  const recob::PFParticle &pfp = *fmInParticles.at(i_in).at(0);
90  const std::vector<art::Ptr<anab::T0>> &t0s = fmT0s.at(i_in);
91  if (!t0s.size()) continue; // ignore tracks without T0's
92 
93  for (unsigned i_out = 0; i_out < outtracks.size(); i_out++) {
94  const recob::PFParticle &out_pfp = *fmOutParticles.at(i_out).at(0);
95  if (pfp.Self() == out_pfp.Self()) { // The tracks match!
96  // Transfer over the T0 association
97  assn->addMany(outtracks.at(i_out), t0s);
98  break; // done with this input track
99  }
100  }
101  }
102 
103  e.put(std::move(assn));
104 }
size_t Self() const
Returns the index of this particle.
Definition: PFParticle.h:92
Hierarchical representation of particle flow.
Definition: PFParticle.h:44
do i e

Member Data Documentation

art::InputTag sbn::TransferTrackT0::fT0Label
private

Definition at line 49 of file TransferTrackT0_module.cc.

art::InputTag sbn::TransferTrackT0::fTrackLabelIn
private

Definition at line 48 of file TransferTrackT0_module.cc.

art::InputTag sbn::TransferTrackT0::fTrackLabelOut
private

Definition at line 51 of file TransferTrackT0_module.cc.


The documentation for this class was generated from the following file: