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

Public Member Functions

 TCShower (fhicl::ParameterSet const &p)
 
 TCShower (TCShower const &)=delete
 
 TCShower (TCShower &&)=delete
 
TCShoweroperator= (TCShower const &)=delete
 
TCShoweroperator= (TCShower &&)=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
 
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
 

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 43 of file TCShower_module.cc.

Constructor & Destructor Documentation

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

Definition at line 75 of file TCShower_module.cc.

76  : EDProducer{pset}
77  , fTCAlg(pset.get<fhicl::ParameterSet>("TCAlg"))
78  , fClusterModuleLabel(pset.get<std::string>("ClusterModuleLabel", "trajcluster"))
79  , fTrackModuleLabel(pset.get<std::string>("TrackModuleLabel", "trajclusterKalmanTrack"))
80  , fHitModuleLabel(pset.get<std::string>("HitModuleLabel", "trajcluster"))
81  , fSliceModuleLabel(pset.get<std::string>("SliceModuleLabel", "dbcluster3d"))
82  , fVertexModuleLabel(pset.get<std::string>("VertexModuleLabel", "trajcluster"))
83  , fCalorimetryModuleLabel(pset.get<std::string>("CalorimetryModuleLabel"))
84 {
85  produces<std::vector<recob::Shower>>();
86  produces<art::Assns<recob::Shower, recob::Hit>>();
87  produces<art::Assns<recob::Slice, recob::Shower>>();
88 }
shower::TCShowerAlg fTCAlg
std::string string
Definition: nybbler.cc:12
std::string fVertexModuleLabel
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
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 241 of file TCShower_module.cc.

244 {
245  // pfparticles
247  std::vector<art::Ptr<recob::PFParticle>> pfplist;
248  if (evt.getByLabel(fHitModuleLabel, pfpListHandle)) art::fill_ptr_vector(pfplist, pfpListHandle);
249 
251  std::vector<art::Ptr<recob::Hit>> hitlist;
252  if (evt.getByLabel(fHitModuleLabel, hitListHandle)) art::fill_ptr_vector(hitlist, hitListHandle);
253 
254  art::Handle<std::vector<recob::Cluster>> clusterListHandle;
255  std::vector<art::Ptr<recob::Cluster>> clusterlist;
256  if (evt.getByLabel(fClusterModuleLabel, clusterListHandle))
257  art::fill_ptr_vector(clusterlist, clusterListHandle);
258 
260  std::vector<art::Ptr<recob::Vertex>> vertexlist;
261  if (evt.getByLabel(fVertexModuleLabel, vtxListHandle))
262  art::fill_ptr_vector(vertexlist, vtxListHandle);
263 
264  art::Handle<std::vector<recob::Track>> trackListHandle;
265  evt.getByLabel(fTrackModuleLabel, trackListHandle);
266 
267  // get associations
268  art::FindManyP<recob::Cluster> clspfp_fm(pfpListHandle, evt, fHitModuleLabel);
269  art::FindManyP<recob::Vertex> vtxpfp_fm(pfpListHandle, evt, fVertexModuleLabel);
270  art::FindManyP<recob::Hit> cls_fm(clusterListHandle, evt, fClusterModuleLabel);
271  art::FindManyP<recob::PFParticle> hit_fm(hitListHandle, evt, fHitModuleLabel);
272  art::FindManyP<recob::Cluster> hitcls_fm(hitListHandle, evt, fClusterModuleLabel);
273  art::FindManyP<recob::Track> trkpfp_fm(pfpListHandle, evt, fTrackModuleLabel);
274 
275  art::FindManyP<anab::Calorimetry> fmcal(trackListHandle, evt, fCalorimetryModuleLabel);
276 
277  return fTCAlg.makeShowers(clockData,
278  detProp,
279  pfplist,
280  vertexlist,
281  clusterlist,
282  hitlist,
283  cls_fm,
284  clspfp_fm,
285  vtxpfp_fm,
286  hit_fm,
287  hitcls_fm,
288  trkpfp_fm,
289  fmcal);
290 }
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:7
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
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 165 of file TCShower_module.cc.

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

Implements art::EDProducer.

Definition at line 93 of file TCShower_module.cc.

94 {
95  auto showers = std::make_unique<std::vector<recob::Shower>>();
96  auto hitShowerAssociations = std::make_unique<art::Assns<recob::Shower, recob::Hit>>();
97  auto sliceShowerAssociations = std::make_unique<art::Assns<recob::Slice, recob::Shower>>();
98 
99  // slices
100  art::Handle<std::vector<recob::Slice>> sliceListHandle;
101  std::vector<art::Ptr<recob::Slice>> slicelist;
102  if (evt.getByLabel(fSliceModuleLabel, sliceListHandle))
103  art::fill_ptr_vector(slicelist, sliceListHandle);
104 
105  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
106  auto const detProp =
108 
109  int foundShower = -1;
110 
111  if (empty(slicelist)) { // no slices
112  foundShower = getShowersWithoutSlices(evt, clockData, detProp);
113 
114  if (foundShower) {
115  showers->emplace_back(fTCAlg.shwDir,
117  fTCAlg.shwvtx,
118  fTCAlg.xyzErr,
121  fTCAlg.dEdx,
122  fTCAlg.dEdxErr,
124  0);
125  showers->back().set_id(showers->size() - 1);
126 
127  util::CreateAssn(evt, *showers, fTCAlg.showerHits, *hitShowerAssociations);
128  }
129  }
130  else { // use slices
131  for (size_t i = 0; i < slicelist.size(); ++i) {
132  std::cout << "---------- slice " << i << " ----------" << std::endl;
133 
134  foundShower = getShowersWithSlices(evt, clockData, detProp, slicelist[i]);
135 
136  if (foundShower) {
137  std::cout << "FOUND SHOWER " << foundShower << std::endl;
138  std::cout << "shower hits " << fTCAlg.showerHits.size() << std::endl;
139 
140  showers->emplace_back(fTCAlg.shwDir,
142  fTCAlg.shwvtx,
143  fTCAlg.xyzErr,
146  fTCAlg.dEdx,
147  fTCAlg.dEdxErr,
149  0);
150  showers->back().set_id(showers->size() - 1);
151 
152  util::CreateAssn(evt, *showers, fTCAlg.showerHits, *hitShowerAssociations);
153  util::CreateAssn(evt, *showers, slicelist[i], *sliceShowerAssociations);
154  }
155  } // loop through slices
156  } // with slices
157 
158  evt.put(std::move(showers));
159  evt.put(std::move(hitShowerAssociations));
160  evt.put(std::move(sliceShowerAssociations));
161 } // produce
shower::TCShowerAlg fTCAlg
std::vector< double > totalEnergyErr
Definition: TCShowerAlg.h:43
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:44
std::string fSliceModuleLabel
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.
std::vector< double > totalEnergy
Definition: TCShowerAlg.h:42
TCEvent evt
Definition: DataStructs.cxx:7
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
std::vector< art::Ptr< recob::Hit > > showerHits
Definition: TCShowerAlg.h:47
std::vector< double > dEdxErr
Definition: TCShowerAlg.h:45
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:97
QTextStream & endl(QTextStream &s)

Member Data Documentation

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

Definition at line 70 of file TCShower_module.cc.

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

Definition at line 65 of file TCShower_module.cc.

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

Definition at line 67 of file TCShower_module.cc.

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

Definition at line 68 of file TCShower_module.cc.

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

Definition at line 63 of file TCShower_module.cc.

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

Definition at line 66 of file TCShower_module.cc.

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

Definition at line 69 of file TCShower_module.cc.


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