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

Public Member Functions

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

Private Attributes

art::InputTag fPFParticleLabelIn
 
art::InputTag fT0Label
 
art::InputTag fPFParticleLabelOut
 

Detailed Description

Definition at line 30 of file TransferPFParticleT0_module.cc.

Constructor & Destructor Documentation

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

Definition at line 54 of file TransferPFParticleT0_module.cc.

55  : EDProducer{p},
56  fPFParticleLabelIn(p.get<art::InputTag>("PFParticleLabelIn")),
57  fT0Label(p.get<art::InputTag>("T0Label")),
58  fPFParticleLabelOut(p.get<art::InputTag>("PFParticleLabelOut"))
59 {
60  produces<art::Assns<recob::PFParticle, anab::T0>>();
61 }
pdgs p
Definition: selectors.fcl:22
sbn::TransferPFParticleT0::TransferPFParticleT0 ( TransferPFParticleT0 const &  )
delete
sbn::TransferPFParticleT0::TransferPFParticleT0 ( TransferPFParticleT0 &&  )
delete

Member Function Documentation

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

Definition at line 63 of file TransferPFParticleT0_module.cc.

64 {
65  // define output data
66  std::unique_ptr<art::Assns<recob::PFParticle, anab::T0>> assn(new art::Assns<recob::PFParticle, anab::T0>);
67 
68  // Collect input data
69  art::Handle<std::vector<recob::PFParticle>> inpfp_handle;
70  e.getByLabel(fPFParticleLabelIn, inpfp_handle);
71 
72  std::vector<art::Ptr<recob::PFParticle>> inpfps;
73  art::fill_ptr_vector(inpfps, inpfp_handle);
74 
75  art::FindManyP<anab::T0> fmT0s(inpfps, e, fT0Label);
76 
77  art::Handle<std::vector<recob::PFParticle>> outpfp_handle;
78  e.getByLabel(fPFParticleLabelOut, outpfp_handle);
79 
80  std::vector<art::Ptr<recob::PFParticle>> outpfps;
81  art::fill_ptr_vector(outpfps, outpfp_handle);
82 
83  // process input data
84  for (unsigned i_in = 0; i_in < inpfps.size(); i_in++) {
85  const recob::PFParticle &pfp = *inpfps[i_in];
86  const std::vector<art::Ptr<anab::T0>> &t0s = fmT0s.at(i_in);
87  if (!t0s.size()) continue; // ignore pfps without T0's
88 
89  for (unsigned i_out = 0; i_out < outpfps.size(); i_out++) {
90  const recob::PFParticle &out_pfp = *outpfps[i_out];
91  if (pfp.Self() == out_pfp.Self()) { // The pfps match!
92  // Transfer over the T0 association
93  assn->addMany(outpfps.at(i_out), t0s);
94  break; // done with this input pfp
95  }
96  }
97  }
98 
99  e.put(std::move(assn));
100 }
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::TransferPFParticleT0::fPFParticleLabelIn
private

Definition at line 47 of file TransferPFParticleT0_module.cc.

art::InputTag sbn::TransferPFParticleT0::fPFParticleLabelOut
private

Definition at line 50 of file TransferPFParticleT0_module.cc.

art::InputTag sbn::TransferPFParticleT0::fT0Label
private

Definition at line 48 of file TransferPFParticleT0_module.cc.


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