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

Public Member Functions

 TrackCalorimetry (fhicl::ParameterSet const &p)
 
 TrackCalorimetry (TrackCalorimetry const &)=delete
 
 TrackCalorimetry (TrackCalorimetry &&)=delete
 
TrackCalorimetryoperator= (TrackCalorimetry const &)=delete
 
TrackCalorimetryoperator= (TrackCalorimetry &&)=delete
 
- 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 Member Functions

void produce (art::Event &e) override
 

Private Attributes

std::string fTrackModuleLabel
 
std::string fHitModuleLabel
 
TrackCalorimetryAlg fTrackCaloAlg
 

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 39 of file TrackCalorimetry_module.cc.

Constructor & Destructor Documentation

calo::TrackCalorimetry::TrackCalorimetry ( fhicl::ParameterSet const &  p)
explicit

Definition at line 61 of file TrackCalorimetry_module.cc.

62  : EDProducer{p}
63  , fTrackModuleLabel(p.get<std::string>("TrackModuleLabel"))
64  , fHitModuleLabel(p.get<std::string>("HitModuleLabel"))
65  , fTrackCaloAlg(p.get<fhicl::ParameterSet>("TrackCalorimetryAlg"))
66 {
67  fTrackModuleLabel = p.get<std::string>("TrackModuleLabel");
68  fHitModuleLabel = p.get<std::string>("HitModuleLabel");
69 
70  produces<std::vector<anab::Calorimetry>>();
71  produces<art::Assns<recob::Track, anab::Calorimetry>>();
72 }
std::string string
Definition: nybbler.cc:12
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
p
Definition: test.py:223
TrackCalorimetryAlg fTrackCaloAlg
calo::TrackCalorimetry::TrackCalorimetry ( TrackCalorimetry const &  )
delete
calo::TrackCalorimetry::TrackCalorimetry ( TrackCalorimetry &&  )
delete

Member Function Documentation

TrackCalorimetry& calo::TrackCalorimetry::operator= ( TrackCalorimetry const &  )
delete
TrackCalorimetry& calo::TrackCalorimetry::operator= ( TrackCalorimetry &&  )
delete
void calo::TrackCalorimetry::produce ( art::Event e)
overrideprivatevirtual

Implements art::EDProducer.

Definition at line 75 of file TrackCalorimetry_module.cc.

76 {
77 
79  e.getByLabel(fTrackModuleLabel, trackHandle);
80  std::vector<recob::Track> const& trackVector(*trackHandle);
81 
82  // Get Hits from event.
84  e.getByLabel(fHitModuleLabel, hitHandle);
85  std::vector<recob::Hit> const& hitVector(*hitHandle);
86 
87  // Get track<-->hit associations
89  e.getByLabel(fTrackModuleLabel, assnTrackHitHandle);
90  std::vector<std::vector<size_t>> hit_indices_per_track =
91  util::GetAssociatedVectorManyI(assnTrackHitHandle, trackHandle);
92 
93  // Make the container for the calo product to put onto the event.
94  std::unique_ptr<std::vector<anab::Calorimetry>> caloPtr(new std::vector<anab::Calorimetry>);
95  std::vector<anab::Calorimetry>& caloVector(*caloPtr);
96 
97  // Make a container for the track<-->calo associations.
98  // One entry per track, with entry equal to index in calorimetry collection of
99  // associated object.
100  std::vector<size_t> assnTrackCaloVector;
101  std::unique_ptr<art::Assns<recob::Track, anab::Calorimetry>> assnTrackCaloPtr(
103 
104  auto const clock_data = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(e);
105  auto const det_prop =
108  clock_data,
109  det_prop,
110  trackVector,
111  hitVector,
112  hit_indices_per_track,
113  caloVector,
114  assnTrackCaloVector,
115  lar::extractProviders<geo::Geometry, detinfo::LArPropertiesService>());
116 
117  //Make the associations for ART
118  for (size_t calo_iter = 0; calo_iter < assnTrackCaloVector.size(); calo_iter++) {
119  if (assnTrackCaloVector[calo_iter] == std::numeric_limits<size_t>::max()) continue;
120  art::Ptr<recob::Track> trk_ptr(trackHandle, assnTrackCaloVector[calo_iter]);
121  util::CreateAssn(e, caloVector, trk_ptr, *assnTrackCaloPtr, calo_iter);
122  }
123 
124  e.put(std::move(caloPtr));
125  e.put(std::move(assnTrackCaloPtr));
126 }
void ExtractCalorimetry(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, std::vector< recob::Track > const &, std::vector< recob::Hit > const &, std::vector< std::vector< size_t >> const &, std::vector< anab::Calorimetry > &, std::vector< size_t > &, Providers_t providers)
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
def move(depos, offset)
Definition: depos.py:107
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
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.
static int max(int a, int b)
std::vector< std::vector< size_t > > GetAssociatedVectorManyI(art::Handle< art::Assns< T, U > > h, art::Handle< std::vector< T > > index_p)
TrackCalorimetryAlg fTrackCaloAlg

Member Data Documentation

std::string calo::TrackCalorimetry::fHitModuleLabel
private

Definition at line 56 of file TrackCalorimetry_module.cc.

TrackCalorimetryAlg calo::TrackCalorimetry::fTrackCaloAlg
private

Definition at line 58 of file TrackCalorimetry_module.cc.

std::string calo::TrackCalorimetry::fTrackModuleLabel
private

Definition at line 55 of file TrackCalorimetry_module.cc.


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