Public Member Functions | Private Attributes | List of all members
pid::Chi2ParticleID Class Reference
Inheritance diagram for pid::Chi2ParticleID:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 Chi2ParticleID (fhicl::ParameterSet const &p)
 
virtual void produce (art::Event &e)
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

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 }
std::string string
Definition: nybbler.cc:12
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
p
Definition: test.py:223

Member Function Documentation

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

Implements art::EDProducer.

Definition at line 54 of file Chi2ParticleID_module.cc.

55 {
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 }
def move(depos, offset)
Definition: depos.py:107
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=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:7
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
Definition: fwd.h:31

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: