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

Public Member Functions

 Chi2ParticleID (fhicl::ParameterSet const &p)
 
virtual void produce (art::Event &e)
 

Private Attributes

std::string fTrackModuleLabel
 
std::string fCalorimetryModuleLabel
 
Chi2PIDAlg fChiAlg
 

Detailed Description

Definition at line 28 of file Chi2ParticleID_module.cc.

Constructor & Destructor Documentation

pid::Chi2ParticleID::Chi2ParticleID ( fhicl::ParameterSet const &  p)
explicit

Definition at line 43 of file Chi2ParticleID_module.cc.

44  : EDProducer{p}
45  , fChiAlg(p.get< fhicl::ParameterSet >("Chi2PIDAlg"))
46 {
47  fTrackModuleLabel = p.get< std::string >("TrackModuleLabel");
48  fCalorimetryModuleLabel = p.get< std::string >("CalorimetryModuleLabel");
49 
50  produces< std::vector<anab::ParticleID> >();
51  produces< art::Assns<recob::Track, anab::ParticleID> >();
52 }
pdgs p
Definition: selectors.fcl:22

Member Function Documentation

void pid::Chi2ParticleID::produce ( art::Event &  e)
virtual

Definition at line 54 of file Chi2ParticleID_module.cc.

55 {
56  art::Handle< std::vector<recob::Track> > trackListHandle;
57  evt.getByLabel(fTrackModuleLabel,trackListHandle);
58 
59  std::vector<art::Ptr<recob::Track> > tracklist;
60  art::fill_ptr_vector(tracklist, trackListHandle);
61 
62  art::FindManyP<anab::Calorimetry> fmcal(trackListHandle, evt, fCalorimetryModuleLabel);
63 
64  //if (!fmcal.isValid()) return;
65 
66  std::unique_ptr< std::vector<anab::ParticleID> > particleidcol(new std::vector<anab::ParticleID>);
67  std::unique_ptr< art::Assns<recob::Track, anab::ParticleID> > assn(new art::Assns<recob::Track, anab::ParticleID>);
68 
69  if (fmcal.isValid()) {
70  std::vector<art::Ptr<anab::Calorimetry>> calovec(1, art::Ptr<anab::Calorimetry>());
71  for (size_t trkIter = 0; trkIter < tracklist.size(); ++trkIter){
72  for (size_t i = 0; i<fmcal.at(trkIter).size(); ++i){
73  calovec[0] = fmcal.at(trkIter)[i];
74  anab::ParticleID pidout = fChiAlg.DoParticleID(calovec);
75  particleidcol->push_back(pidout);
76  util::CreateAssn(*this, evt, *particleidcol, tracklist[trkIter], *assn);
77  }
78  }
79  }
80  evt.put(std::move(particleidcol));
81  evt.put(std::move(assn));
82 
83  return;
84 
85 }
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
anab::ParticleID DoParticleID(const std::vector< art::Ptr< anab::Calorimetry >> &calo)
Definition: Chi2PIDAlg.cxx:61
TCEvent evt
Definition: DataStructs.cxx:8

Member Data Documentation

std::string pid::Chi2ParticleID::fCalorimetryModuleLabel
private

Definition at line 37 of file Chi2ParticleID_module.cc.

Chi2PIDAlg pid::Chi2ParticleID::fChiAlg
private

Definition at line 39 of file Chi2ParticleID_module.cc.

std::string pid::Chi2ParticleID::fTrackModuleLabel
private

Definition at line 36 of file Chi2ParticleID_module.cc.


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