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

Public Member Functions

 TrackCalorimetry (fhicl::ParameterSet const &p)
 
 TrackCalorimetry (TrackCalorimetry const &)=delete
 
 TrackCalorimetry (TrackCalorimetry &&)=delete
 
TrackCalorimetryoperator= (TrackCalorimetry const &)=delete
 
TrackCalorimetryoperator= (TrackCalorimetry &&)=delete
 

Private Member Functions

void produce (art::Event &e) override
 

Private Attributes

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

Detailed Description

Definition at line 40 of file TrackCalorimetry_module.cc.

Constructor & Destructor Documentation

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

Definition at line 62 of file TrackCalorimetry_module.cc.

63  : EDProducer{p}
64  , fTrackModuleLabel(p.get<std::string>("TrackModuleLabel"))
65  , fHitModuleLabel(p.get<std::string>("HitModuleLabel"))
66  , fTrackCaloAlg(p.get<fhicl::ParameterSet>("TrackCalorimetryAlg"))
67 {
68  fTrackModuleLabel = p.get<std::string>("TrackModuleLabel");
69  fHitModuleLabel = p.get<std::string>("HitModuleLabel");
70 
71  produces<std::vector<anab::Calorimetry>>();
72  produces<art::Assns<recob::Track, anab::Calorimetry>>();
73 }
pdgs p
Definition: selectors.fcl:22
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)
overrideprivate

Definition at line 76 of file TrackCalorimetry_module.cc.

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

Member Data Documentation

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

Definition at line 57 of file TrackCalorimetry_module.cc.

TrackCalorimetryAlg calo::TrackCalorimetry::fTrackCaloAlg
private

Definition at line 59 of file TrackCalorimetry_module.cc.

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

Definition at line 56 of file TrackCalorimetry_module.cc.


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