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

Public Member Functions

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

Private Attributes

art::InputTag fPFParticleLabelIn
 
art::InputTag fFlashLabel
 
art::InputTag fPFParticleLabelOut
 

Detailed Description

Definition at line 31 of file TransferPFParticleFlashMatch_module.cc.

Constructor & Destructor Documentation

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

Definition at line 55 of file TransferPFParticleFlashMatch_module.cc.

56  : EDProducer{p},
57  fPFParticleLabelIn(p.get<art::InputTag>("PFParticleLabelIn")),
58  fFlashLabel(p.get<art::InputTag>("FlashLabel")),
59  fPFParticleLabelOut(p.get<art::InputTag>("PFParticleLabelOut"))
60 {
61  produces<art::Assns<recob::PFParticle, sbn::SimpleFlashMatch>>();
62 }
pdgs p
Definition: selectors.fcl:22
sbn::TransferPFParticleFlashMatch::TransferPFParticleFlashMatch ( TransferPFParticleFlashMatch const &  )
delete
sbn::TransferPFParticleFlashMatch::TransferPFParticleFlashMatch ( TransferPFParticleFlashMatch &&  )
delete

Member Function Documentation

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

Definition at line 64 of file TransferPFParticleFlashMatch_module.cc.

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

Definition at line 49 of file TransferPFParticleFlashMatch_module.cc.

art::InputTag sbn::TransferPFParticleFlashMatch::fPFParticleLabelIn
private

Definition at line 48 of file TransferPFParticleFlashMatch_module.cc.

art::InputTag sbn::TransferPFParticleFlashMatch::fPFParticleLabelOut
private

Definition at line 51 of file TransferPFParticleFlashMatch_module.cc.


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