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
shower::TCShower Class Reference
Inheritance diagram for shower::TCShower:

Public Member Functions

 TCShower (fhicl::ParameterSet const &p)
 
 TCShower (TCShower const &)=delete
 
 TCShower (TCShower &&)=delete
 
TCShoweroperator= (TCShower const &)=delete
 
TCShoweroperator= (TCShower &&)=delete
 

Private Member Functions

void produce (art::Event &e) override
 
int getShowersWithSlices (art::Event const &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, art::Ptr< recob::Slice > const &thisslice)
 
int getShowersWithoutSlices (art::Event const &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp)
 

Private Attributes

shower::TCShowerAlg fTCAlg
 
std::string fClusterModuleLabel
 
std::string fTrackModuleLabel
 
std::string fHitModuleLabel
 
std::string fSliceModuleLabel
 
std::string fVertexModuleLabel
 
std::string fCalorimetryModuleLabel
 

Detailed Description

Definition at line 44 of file TCShower_module.cc.

Constructor & Destructor Documentation

shower::TCShower::TCShower ( fhicl::ParameterSet const &  p)
explicit

Definition at line 76 of file TCShower_module.cc.

77  : EDProducer{pset}
78  , fTCAlg(pset.get<fhicl::ParameterSet>("TCAlg"))
79  , fClusterModuleLabel(pset.get<std::string>("ClusterModuleLabel", "trajcluster"))
80  , fTrackModuleLabel(pset.get<std::string>("TrackModuleLabel", "trajclusterKalmanTrack"))
81  , fHitModuleLabel(pset.get<std::string>("HitModuleLabel", "trajcluster"))
82  , fSliceModuleLabel(pset.get<std::string>("SliceModuleLabel", "dbcluster3d"))
83  , fVertexModuleLabel(pset.get<std::string>("VertexModuleLabel", "trajcluster"))
84  , fCalorimetryModuleLabel(pset.get<std::string>("CalorimetryModuleLabel"))
85 {
86  produces<std::vector<recob::Shower>>();
87  produces<art::Assns<recob::Shower, recob::Hit>>();
88  produces<art::Assns<recob::Slice, recob::Shower>>();
89 }
shower::TCShowerAlg fTCAlg
std::string fVertexModuleLabel
std::string fSliceModuleLabel
std::string fTrackModuleLabel
std::string fHitModuleLabel
std::string fClusterModuleLabel
std::string fCalorimetryModuleLabel
shower::TCShower::TCShower ( TCShower const &  )
delete
shower::TCShower::TCShower ( TCShower &&  )
delete

Member Function Documentation

int shower::TCShower::getShowersWithoutSlices ( art::Event const &  evt,
detinfo::DetectorClocksData const &  clockData,
detinfo::DetectorPropertiesData const &  detProp 
)
private

Definition at line 242 of file TCShower_module.cc.

245 {
246  // pfparticles
247  art::Handle<std::vector<recob::PFParticle>> pfpListHandle;
248  std::vector<art::Ptr<recob::PFParticle>> pfplist;
249  if (evt.getByLabel(fHitModuleLabel, pfpListHandle)) art::fill_ptr_vector(pfplist, pfpListHandle);
250 
251  art::Handle<std::vector<recob::Hit>> hitListHandle;
252  std::vector<art::Ptr<recob::Hit>> hitlist;
253  if (evt.getByLabel(fHitModuleLabel, hitListHandle)) art::fill_ptr_vector(hitlist, hitListHandle);
254 
255  art::Handle<std::vector<recob::Cluster>> clusterListHandle;
256  std::vector<art::Ptr<recob::Cluster>> clusterlist;
257  if (evt.getByLabel(fClusterModuleLabel, clusterListHandle))
258  art::fill_ptr_vector(clusterlist, clusterListHandle);
259 
260  art::Handle<std::vector<recob::Vertex>> vtxListHandle;
261  std::vector<art::Ptr<recob::Vertex>> vertexlist;
262  if (evt.getByLabel(fVertexModuleLabel, vtxListHandle))
263  art::fill_ptr_vector(vertexlist, vtxListHandle);
264 
265  art::Handle<std::vector<recob::Track>> trackListHandle;
266  evt.getByLabel(fTrackModuleLabel, trackListHandle);
267 
268  // get associations
269  art::FindManyP<recob::Cluster> clspfp_fm(pfpListHandle, evt, fHitModuleLabel);
270  art::FindManyP<recob::Vertex> vtxpfp_fm(pfpListHandle, evt, fVertexModuleLabel);
271  art::FindManyP<recob::Hit> cls_fm(clusterListHandle, evt, fClusterModuleLabel);
272  art::FindManyP<recob::PFParticle> hit_fm(hitListHandle, evt, fHitModuleLabel);
273  art::FindManyP<recob::Cluster> hitcls_fm(hitListHandle, evt, fClusterModuleLabel);
274  art::FindManyP<recob::Track> trkpfp_fm(pfpListHandle, evt, fTrackModuleLabel);
275 
276  art::FindManyP<anab::Calorimetry> fmcal(trackListHandle, evt, fCalorimetryModuleLabel);
277 
278  return fTCAlg.makeShowers(clockData,
279  detProp,
280  pfplist,
281  vertexlist,
282  clusterlist,
283  hitlist,
284  cls_fm,
285  clspfp_fm,
286  vtxpfp_fm,
287  hit_fm,
288  hitcls_fm,
289  trkpfp_fm,
290  fmcal);
291 }
shower::TCShowerAlg fTCAlg
std::string fVertexModuleLabel
std::string fTrackModuleLabel
int makeShowers(detinfo::DetectorClocksData const &dataClock, detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< recob::PFParticle >> const &pfplist, std::vector< art::Ptr< recob::Vertex >> const &vertexlist, std::vector< art::Ptr< recob::Cluster >> const &clusterlist, std::vector< art::Ptr< recob::Hit >> const &hitlist, art::FindManyP< recob::Hit > const &cls_fm, art::FindManyP< recob::Cluster > const &clspfp_fm, art::FindManyP< recob::Vertex > const &vtxpfp_fm, art::FindManyP< recob::PFParticle > const &hit_fm, art::FindManyP< recob::Cluster > const &hitcls_fm, art::FindManyP< recob::Track > const &trkpfp_fm, art::FindManyP< anab::Calorimetry > const &fmcal)
Definition: TCShowerAlg.cxx:51
std::string fHitModuleLabel
std::string fClusterModuleLabel
std::string fCalorimetryModuleLabel
TCEvent evt
Definition: DataStructs.cxx:8
auto const detProp
int shower::TCShower::getShowersWithSlices ( art::Event const &  evt,
detinfo::DetectorClocksData const &  clockData,
detinfo::DetectorPropertiesData const &  detProp,
art::Ptr< recob::Slice > const &  thisslice 
)
private

Definition at line 166 of file TCShower_module.cc.

170 {
171  art::Handle<std::vector<recob::Hit>> hitListHandle;
172  evt.getByLabel(fHitModuleLabel, hitListHandle);
173 
174  art::Handle<std::vector<recob::Cluster>> clusterListHandle;
175  evt.getByLabel(fClusterModuleLabel, clusterListHandle);
176 
177  art::Handle<std::vector<recob::Track>> trackListHandle;
178  evt.getByLabel(fTrackModuleLabel, trackListHandle);
179 
180  art::Handle<std::vector<recob::Slice>> sliceListHandle;
181  evt.getByLabel(fSliceModuleLabel, sliceListHandle);
182 
183  art::Handle<std::vector<recob::Vertex>> vtxListHandle;
184  evt.getByLabel(fVertexModuleLabel, vtxListHandle);
185 
186  art::Handle<std::vector<recob::PFParticle>> pfpListHandle;
187  evt.getByLabel(fHitModuleLabel, pfpListHandle);
188 
189  art::FindManyP<recob::Hit> hitslice_fm(sliceListHandle, evt, fHitModuleLabel);
190  art::FindManyP<recob::PFParticle> pfpslice_fm(sliceListHandle, evt, fHitModuleLabel);
191  art::FindManyP<recob::Cluster> clsslice_fm(sliceListHandle, evt, fHitModuleLabel);
192  art::FindManyP<recob::Cluster> clspfp_fm(pfpListHandle, evt, fHitModuleLabel);
193  art::FindManyP<recob::Vertex> vtxpfp_fm(pfpListHandle, evt, fVertexModuleLabel);
194  // art::FindManyP<recob::EndPoint2D> vx2cls_fm(clusterListHandle, evt, fClusterModuleLabel);
195 
196  std::vector<art::Ptr<recob::Hit>> hitlist;
197  std::vector<art::Ptr<recob::Cluster>> clusterlist;
198  std::vector<art::Ptr<recob::Vertex>> vertexlist;
199  std::vector<art::Ptr<recob::EndPoint2D>> vx2list;
200 
201  // get all hits with hit-slice association
202  hitlist = hitslice_fm.at(thisslice.key());
203 
204  // get all clusters with cluster-slice association
205  clusterlist = clsslice_fm.at(thisslice.key());
206 
207  std::vector<art::Ptr<recob::PFParticle>> pfplist = pfpslice_fm.at(thisslice.key());
208 
209  for (size_t i = 0; i < pfplist.size(); ++i) {
210  std::vector<art::Ptr<recob::Vertex>> thisvtxlist = vtxpfp_fm.at(pfplist[i].key());
211  // get all verticies with slice-pfparticle, pfparticle-vertex
212  for (size_t j = 0; j < thisvtxlist.size(); ++j) {
213  vertexlist.push_back(thisvtxlist[j]);
214  } // loop through tracks
215  } // loop through pfparticles
216 
217  // get associations
218  art::FindManyP<recob::Hit> cls_fm(clusterListHandle, evt, fClusterModuleLabel);
219  art::FindManyP<recob::PFParticle> hit_fm(hitListHandle, evt, fHitModuleLabel);
220  art::FindManyP<recob::Cluster> hitcls_fm(hitListHandle, evt, fClusterModuleLabel);
221  art::FindManyP<recob::Track> trkpfp_fm(pfpListHandle, evt, fTrackModuleLabel);
222 
223  art::FindManyP<anab::Calorimetry> fmcal(trackListHandle, evt, fCalorimetryModuleLabel);
224 
225  return fTCAlg.makeShowers(clockData,
226  detProp,
227  pfplist,
228  vertexlist,
229  clusterlist,
230  hitlist,
231  cls_fm,
232  clspfp_fm,
233  vtxpfp_fm,
234  hit_fm,
235  hitcls_fm,
236  trkpfp_fm,
237  fmcal);
238 }
shower::TCShowerAlg fTCAlg
std::string fVertexModuleLabel
std::string fSliceModuleLabel
std::string fTrackModuleLabel
int makeShowers(detinfo::DetectorClocksData const &dataClock, detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< recob::PFParticle >> const &pfplist, std::vector< art::Ptr< recob::Vertex >> const &vertexlist, std::vector< art::Ptr< recob::Cluster >> const &clusterlist, std::vector< art::Ptr< recob::Hit >> const &hitlist, art::FindManyP< recob::Hit > const &cls_fm, art::FindManyP< recob::Cluster > const &clspfp_fm, art::FindManyP< recob::Vertex > const &vtxpfp_fm, art::FindManyP< recob::PFParticle > const &hit_fm, art::FindManyP< recob::Cluster > const &hitcls_fm, art::FindManyP< recob::Track > const &trkpfp_fm, art::FindManyP< anab::Calorimetry > const &fmcal)
Definition: TCShowerAlg.cxx:51
std::string fHitModuleLabel
std::string fClusterModuleLabel
std::string fCalorimetryModuleLabel
TCEvent evt
Definition: DataStructs.cxx:8
auto const detProp
TCShower& shower::TCShower::operator= ( TCShower const &  )
delete
TCShower& shower::TCShower::operator= ( TCShower &&  )
delete
void shower::TCShower::produce ( art::Event &  e)
overrideprivate

Definition at line 94 of file TCShower_module.cc.

95 {
96  auto showers = std::make_unique<std::vector<recob::Shower>>();
97  auto hitShowerAssociations = std::make_unique<art::Assns<recob::Shower, recob::Hit>>();
98  auto sliceShowerAssociations = std::make_unique<art::Assns<recob::Slice, recob::Shower>>();
99 
100  // slices
101  art::Handle<std::vector<recob::Slice>> sliceListHandle;
102  std::vector<art::Ptr<recob::Slice>> slicelist;
103  if (evt.getByLabel(fSliceModuleLabel, sliceListHandle))
104  art::fill_ptr_vector(slicelist, sliceListHandle);
105 
106  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
107  auto const detProp =
108  art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt, clockData);
109 
110  int foundShower = -1;
111 
112  if (empty(slicelist)) { // no slices
113  foundShower = getShowersWithoutSlices(evt, clockData, detProp);
114 
115  if (foundShower) {
116  showers->emplace_back(fTCAlg.shwDir,
118  fTCAlg.shwvtx,
119  fTCAlg.xyzErr,
122  fTCAlg.dEdx,
123  fTCAlg.dEdxErr,
125  0);
126  showers->back().set_id(showers->size() - 1);
127 
128  util::CreateAssn(evt, *showers, fTCAlg.showerHits, *hitShowerAssociations);
129  }
130  }
131  else { // use slices
132  for (size_t i = 0; i < slicelist.size(); ++i) {
133  std::cout << "---------- slice " << i << " ----------" << std::endl;
134 
135  foundShower = getShowersWithSlices(evt, clockData, detProp, slicelist[i]);
136 
137  if (foundShower) {
138  std::cout << "FOUND SHOWER " << foundShower << std::endl;
139  std::cout << "shower hits " << fTCAlg.showerHits.size() << std::endl;
140 
141  showers->emplace_back(fTCAlg.shwDir,
143  fTCAlg.shwvtx,
144  fTCAlg.xyzErr,
147  fTCAlg.dEdx,
148  fTCAlg.dEdxErr,
150  0);
151  showers->back().set_id(showers->size() - 1);
152 
153  util::CreateAssn(evt, *showers, fTCAlg.showerHits, *hitShowerAssociations);
154  util::CreateAssn(evt, *showers, slicelist[i], *sliceShowerAssociations);
155  }
156  } // loop through slices
157  } // with slices
158 
159  evt.put(std::move(showers));
160  evt.put(std::move(hitShowerAssociations));
161  evt.put(std::move(sliceShowerAssociations));
162 } // produce
shower::TCShowerAlg fTCAlg
std::vector< double > totalEnergyErr
Definition: TCShowerAlg.h:46
int getShowersWithSlices(art::Event const &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, art::Ptr< recob::Slice > const &thisslice)
int getShowersWithoutSlices(art::Event const &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp)
std::vector< double > dEdx
Definition: TCShowerAlg.h:47
std::string fSliceModuleLabel
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< double > totalEnergy
Definition: TCShowerAlg.h:45
TCEvent evt
Definition: DataStructs.cxx:8
std::vector< art::Ptr< recob::Hit > > showerHits
Definition: TCShowerAlg.h:50
bool empty(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:555
std::vector< double > dEdxErr
Definition: TCShowerAlg.h:48
BEGIN_PROLOG could also be cout
auto const detProp

Member Data Documentation

std::string shower::TCShower::fCalorimetryModuleLabel
private

Definition at line 71 of file TCShower_module.cc.

std::string shower::TCShower::fClusterModuleLabel
private

Definition at line 66 of file TCShower_module.cc.

std::string shower::TCShower::fHitModuleLabel
private

Definition at line 68 of file TCShower_module.cc.

std::string shower::TCShower::fSliceModuleLabel
private

Definition at line 69 of file TCShower_module.cc.

shower::TCShowerAlg shower::TCShower::fTCAlg
private

Definition at line 64 of file TCShower_module.cc.

std::string shower::TCShower::fTrackModuleLabel
private

Definition at line 67 of file TCShower_module.cc.

std::string shower::TCShower::fVertexModuleLabel
private

Definition at line 70 of file TCShower_module.cc.


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