SliceNavigator_service.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // \file SliceNavigator_service.cc
3 // \brief Look up products dependent on the current slice
4 // \author Christopher Backhouse - bckhouse@caltech.edu
5 ////////////////////////////////////////////////////////////////////////
6 
8 
12 
18 
19 #include "Utilities/AssociationUtil.h"
20 
21 #include "MEFinder/MEClusters.h"
24 #include "Geometry/Geometry.h"
25 #include "MCCheater/BackTracker.h"
26 #include "RecoBase/CellHit.h"
27 #include "RecoBase/Cluster.h"
28 #include "RecoBase/HoughResult.h"
29 #include "RecoBase/Prong.h"
30 #include "RecoBase/Track.h"
31 #include "RecoBase/Vertex.h"
32 #include "RecoBase/FilterList.h"
34 
35 namespace evd
36 {
37  //---------------------------------------------------------------
40  : evdb::Reconfigurable{pset},
41  fAutoPrintCount(0),
42  fRun(0),
43  fFullEvent(true),
44  fCurrentSlice(0),
45  fMaxSliceId(0),
46  fInitialSlice(-1)
47  {
48  reconfigure(pset);
49 
50  evdb::ServiceTable::OverrideCategory("SliceNavigator",
52 
53  reg.sPostProcessEvent.watch(this, &SliceNavigator::postProcessEvent);
54  reg.sPreBeginRun.watch(this, &SliceNavigator::preBeginRun);
55  }
56 
57  //---------------------------------------------------------------
59  {
60  fSlicesToNavigate.clear();
61  }
62 
63  //---------------------------------------------------------------
65  {
66  fSliceLabel = pset.get<std::string>("SliceLabel");
67  fCellHitLabel = pset.get<std::string>("CellHitLabel");
68  fAutoAdvanceInterval = pset.get<int>("AutoAdvanceInterval");
69  fAutoPrintPattern = pset.get<std::string>("AutoPrintPattern");
70  fAutoPrintMax = pset.get<int>("AutoPrintMax");
71  fFilterResults = (pset.get<int>("SliceOpt.val") & 1);
72  fDimHits = (pset.get<int>("SliceOpt.val") & 2);
73  fDimOthers = (pset.get<int>("SliceOpt.val") & 4);
74 
75  fFullEvent = !pset.get<bool>("InitiallyEnabled");
76  fInitialSlice = pset.get<int>("InitialSlice");
77 
79  this->ParseModuleInstanceString(fCellHitLabel, fCellHitInstance);
80 
81  }
82 
83  //---------------------------------------------------------------
85  std::string & inst)
86  {
87  const size_t splitPos = mod.find_first_of('_');
88  if(splitPos == std::string::npos){
89  inst = "";
90  return;
91  }
92  inst = mod.substr(splitPos+1);
93  mod.resize(splitPos);
94  }
95 
96  //---------------------------------------------------------------
98  {
99  fRun = r.run();
100  }
101 
102  //---------------------------------------------------------------
104  {
105  // Clear the slices to navigate vector
106  fSlicesToNavigate.clear();
107 
109 
111 
112  evt.getByLabel( sliceTag, slices);
113 
114  if(slices.failedToGet()){
115  std::cerr << "Couldn't find any slices under label "
116  << fSliceLabel << std::endl;
117  fMaxSliceId = 0;
118  return;
119  }
120 
121  int nSli = slices->size();
122  for( int iSli = 0; iSli < nSli; ++iSli){
123  // if we only want to look at slices that
124  // survived filtering, throw the rest away
125  if(!fFullEvent && fFilterResults && rb::IsFiltered(evt,slices,iSli) )
126  continue;
127  if(!fFullEvent && (*slices)[iSli].IsNoise())
128  continue;
129 
130  fSlicesToNavigate.push_back( iSli );
131  if(iSli == fInitialSlice){
132  fCurrentSlice = fSlicesToNavigate.size()-1;
133  fInitialSlice = -1; // Don't do this again
134  }
135  }
136  if (fSlicesToNavigate.size() > 0) fMaxSliceId = fSlicesToNavigate.back();
137 
138  // Protecting against segfaults: If we've advanced to the next event
139  // with fCurrentSlice set to the max number of slices, and the next event
140  // has fewer slices than the previous, we need to make sure we don't
141  // suffer from an index out of range problem.
142  if( (fCurrentSlice + 1 > int(fSlicesToNavigate.size())) && !fSlicesToNavigate.empty() )
143  fCurrentSlice = fSlicesToNavigate.size() - 1;
144 
145  if(fCurrentSlice == -1){
146  if(!fSlicesToNavigate.empty())
147  // We pressed the prev slice button
148  fCurrentSlice = fSlicesToNavigate.size()-1;
149  else
151  }
152 
153  if(fCurrentSlice == -2 ){
154  if(!fSlicesToNavigate.empty())
155  // We pressed the next button, but there
156  // no more slices left in the previous event
157  fCurrentSlice = 0;
158  else
160  }
161 
163  evt.getByLabel(sliceTag, slicecol);
164  fSlices.clear();
165  for(unsigned int i = 0; i < slicecol->size(); ++i)
166  fSlices.push_back(art::Ptr<rb::Cluster>(slicecol, i));
167 
170  evt.getByLabel(cellTag, hitcol);
171  fAllHits.clear();
172  for(unsigned int i = 0; i < hitcol->size(); ++i)
174 
175  // Auto-printing
176  if (fAutoPrintMax > 0 || fAutoPrintMax == -1){
177  ++fAutoPrintCount;
178  std::map<std::string, evdb::Printable*>& ps = evdb::Printable::GetPrintables();
179  for(std::map<std::string, evdb::Printable*>::iterator it = ps.begin(); it != ps.end(); ++it){
180  evdb::Printable* p = it->second;
181 
182  // std::string filename = fAutoPrintPattern;
183  std::string filename = "evd-slice_r%r_e%e_s%s.gif";
184 
185  // Insert instances of run variable into filename
186  if (filename.find("%r") != std::string::npos)
187  stringReplace(filename, "%r", std::to_string(fRun));
188 
189  // Insert instances of event variable into filename
190  if (filename.find("%e") != std::string::npos)
191  stringReplace(filename, "%e", std::to_string(evt.event()));
192 
193  // Insert instances of slice variable into filename
194  if (filename.find("%s") != std::string::npos)
195  stringReplace(filename, "%s", std::to_string(this->CurrentSlice()));
196 
197  // Print file
198  p->Print(TString(filename));
199  }
200  if (fCurrentSlice >= (fAutoPrintMax - 1) && fAutoPrintMax != -1) exit(0);
201  }
202  }
203 
204  //---------------------------------------------------------------
205  template<class T> size_t SliceNavigator::
207  const std::string& which,
208  const std::string& instance,
209  std::vector<const T*>& prods)
210  {
211  return GetProductsImpl(evt, which, instance, prods);
212  }
213 
214  //---------------------------------------------------------------
215  template<class T> size_t SliceNavigator::
217  const std::string& which,
218  const std::string& instance,
219  std::vector<const T*>& prods)
220  {
221  if(fFullEvent)
222  return GetProductsImplFull(evt, which, instance, prods);
223  else
224  return GetProductsImplPart(evt, which, instance, prods);
225  }
226 
227 
228  //---------------------------------------------------------------
229  // Need a special function for clusts again
230  // because cluster-cluster assns are not allowed.
231  // See generic GetProductsImplFull for the story
232  template<> size_t SliceNavigator::
234  const std::string& which,
235  const std::string& instance,
236  std::vector<const rb::Cluster*>& clusts)
237  {
238  std::vector<const rb::Cluster*> temp(clusts);
239  try{
240  evt.getView(which, instance, temp);
241  temp.swap(clusts);
242  }
243  catch(cet::exception& e){
244  std::cerr << "Failed to get products of type " << typeid(rb::Cluster).name()
245  << " under label \"" << which << "\": "
246  << e << std::endl;
247  }
248  return clusts.size();
249  }
250 
251  //---------------------------------------------------------------
252  template<class T> size_t SliceNavigator::
254  const std::string& which,
255  const std::string& instance,
256  std::vector<const T*>& prods)
257  {
258 
259  art::Handle<std::vector<T> > tempHandle;
260 
261  std::vector<art::Ptr<T> > temp;
262 
263  try{
264  evt.getByLabel(art::InputTag(which, instance), tempHandle);
265  art::fill_ptr_vector( temp,tempHandle);
266  }
267  catch(cet::exception& e){
268  std::cerr << "Failed to get products of type " << typeid(T).name()
269  << " under label \"" << which << "\": "
270  << e << std::endl;
271  }
272 
273  std::vector<art::Ptr<T> > tempcopy;
274  // If fFilterResults is turned on, we don't want to
275  // draw anything from a slice that was filtered out
276  // So each product has to be mapped to its associated
277  // slice cluster and check if the slice was filtered out.
278  if( fFilterResults &&
279  typeid(T) != typeid(rb::CellHit) &&
280  typeid(T) != typeid(simb::MCTruth)){
281 
283  evt.getByLabel( art::InputTag(fSliceLabel, fSliceInstance), slicesHandle);
284  std::vector<art::Ptr<rb::Cluster> > slices;
285  art::fill_ptr_vector( slices, slicesHandle);
286  art::FindOneP<rb::Cluster> fot(temp, evt, which);
287 
288  if(!fot.isValid()){
289  std::cerr << "Nothing of type " << typeid(T).name()
290  << " with label \"" << which << "\" and instance \"" << instance
291  << "\" associated with slices" << std::endl;
292  return 0;
293  }
294 
295  int nT = temp.size();
296  for( int i = 0; i < nT; i++){
297 
298  art::Ptr<rb::Cluster> slice = fot.at( i );
299  std::vector< art::Ptr< rb::Cluster> >::iterator slicePos =
300  std::find(slices.begin(), slices.end(), slice) ;
301  int iSlice = std::distance( slices.begin(), slicePos );
302 
303  if( fFilterResults && rb::IsFiltered(evt,slicesHandle, iSlice ) )
304  continue;
305  tempcopy.push_back( temp[i] );
306 
307  }// end loop over temp
308  }
309  else
310  tempcopy.swap( temp );
311 
312  for( art::Ptr<T> p: tempcopy)
313  prods.push_back( p.get());
314 
315  return prods.size();
316  }
317 
318 
319  //---------------------------------------------------------------
320  template<class T> size_t SliceNavigator::
322  const std::string& which,
323  const std::string& instance,
324  std::vector<const T*>& prods)
325  {
328 
329  if(slices.failedToGet()){
330  std::cerr << "Couldn't find any slices under label "
331  << fSliceLabel << std::endl;
332  return 0;
333  }
334 
335  art::FindManyP<T> fmt(slices, evt, art::InputTag(which, instance));
336  if(!fmt.isValid()){
337  std::cerr << "Nothing of type " << typeid(T).name()
338  << " with label \"" << which << "\" and instance \"" << instance
339  << "\" associated with slices" << std::endl;
340  return 0;
341  }
342 
343  std::vector<art::Ptr<T>> prodPtrs = fmt.at( fSlicesToNavigate[fCurrentSlice] );
344  prods.clear();
345  for(art::Ptr<T> p: prodPtrs) prods.push_back(p.get());
346  return prods.size();
347  }
348 
349  //---------------------------------------------------------------
350  // Special case for Tracks because there's this MichelE trick
351  template<> size_t SliceNavigator::
353  const std::string& whichTrack,
354  const std::string& whichMichel,
355  const std::string& instance,
356  std::vector<const rb::Track*>& tracks)
357  {
358  std::vector<const me::TrkME*> clusts;
359  GetProductsImpl(evt, whichTrack, instance, tracks);
360  GetProductsImpl(evt, whichMichel, instance, clusts);
361 
362  for(const me::TrkME* c: clusts)
363  tracks.push_back(c->ParentTrk().get());
364 
365  return tracks.size();
366  }
367 
368  //---------------------------------------------------------------
369  // Special case clusters because they *are* the slice, not just associated
370  template<> size_t SliceNavigator::
372  const std::string& which,
373  const std::string& instance,
374  std::vector<const rb::Cluster*>& clusts)
375  {
376  // If it's the actual slices, look them up by index.
377  // Otherwise we'll get nothing
378  // (not possible to associate Cluster with Cluster)
379  if(which == fSliceLabel && instance == ""){
381  evt.getByLabel(fSliceLabel, slices);
382  if(slices.failedToGet()){
383  std::cerr << "Couldn't find any slices under label "
384  << fSliceLabel << std::endl;
385  return 0;
386  }
387  if( fFullEvent ){
388  int nSli = slices->size();
389  for( int iSli=0; iSli < nSli; ++iSli){
390  if ( fFilterResults && rb::IsFiltered(evt,slices, iSli ) )
391  continue;
392  clusts.push_back((art::Ptr<rb::Cluster>(slices, iSli).get())) ;
393  }
394  }// if full event
395  else{
397  if( fCurrentSlice >=0 )
398  clusts.push_back( (art::Ptr<rb::Cluster>(slices, idx)).get() );
399  }
400  }
401  else
402  GetProductsImplFull(evt, which, instance, clusts);
403 
404  return clusts.size();
405  }
406 
407  //---------------------------------------------------------------
408  // Special case for MCTruth because we have to go via backtracker
409  template<> size_t SliceNavigator::
411  const std::string& which,
412  const std::string& instance,
413  std::vector<const simb::MCTruth*>& truths)
414  {
415  truths.clear();
416 
417  if(fFullEvent){
418  GetProductsImpl(evt, which, instance, truths);
419  }
420  else{
422 
423  std::vector<cheat::NeutrinoEffPur> eps =
425  fAllHits);
426 
427  if(!eps.empty()) truths = {eps.front().neutrinoInt.get()};
428  }
429 
430  return truths.size();
431  }
432 
433  //---------------------------------------------------------------
435  {
436  return fFullEvent;
437  }
438 
439  //---------------------------------------------------------------
441  {
442  if(mode == fFullEvent) return;
443 
444  fFullEvent = mode;
446  }
447 
448  //---------------------------------------------------------------
450  {
451  --fCurrentSlice;
452 
453  if(fCurrentSlice < 0){
454  fCurrentSlice = -1;
456  fSlicesToNavigate.clear();
457  }
458  else{
459  // Go to the slice requested
461  }
462  }
463 
464  //---------------------------------------------------------------
466  {
467  ++fCurrentSlice;
468 
469  if(fCurrentSlice >= int(fSlicesToNavigate.size())){
470  fCurrentSlice = -2;
471  fSlicesToNavigate.clear();
473  }
474  else{
475  // Go to the slice requested
477  }
478  }
479 
480  //---------------------------------------------------------------
482  {
483  if(fSlicesToNavigate.empty() || fCurrentSlice < 0) return 0;
484 
486  }
487 
488  //---------------------------------------------------------------
490  {
491  return fCurrentSlice;
492  }
493 
494  //---------------------------------------------------------------
496  {
497  auto it = std::find(fSlicesToNavigate.begin(),
498  fSlicesToNavigate.end(),
499  slice);
500  if(it != fSlicesToNavigate.end()){
503  }
504  else{
505  // What else can we do?
506  fCurrentSlice = 0;
508  }
509  }
510 
511  //---------------------------------------------------------------
513  {
514  return fMaxSliceId;
515  }
516 
517  //---------------------------------------------------------------
519  double& xmin, double& xmax,
520  double& ymin, double& ymax,
521  double& zmin, double& zmax,
522  double trimfrac)
523  {
524  // Fallback to the whole detector in case we don't get values below
526  xmin = -geom->DetHalfWidth();
527  xmax = +geom->DetHalfWidth();
528  ymin = -geom->DetHalfHeight();
529  ymax = +geom->DetHalfHeight();
530  zmin = 0;
531  zmax = geom->DetLength();
532 
535 
536  if(slices.failedToGet()){
537  std::cerr << "Couldn't find any slices under label "
538  << fSliceLabel << std::endl;
539  return;
540  }
541 
542  if(fCurrentSlice >= 0 && fCurrentSlice < int(slices->size())){
543  const rb::Cluster& slice = (*slices)[fSlicesToNavigate[fCurrentSlice]];
544 
545  if(trimfrac == 0){
546  const TVector3 r0 = slice.MinXYZ();
547  const TVector3 r1 = slice.MaxXYZ();
548  xmin = r0.X(); xmax = r1.X();
549  ymin = r0.Y(); ymax = r1.Y();
550  zmin = r0.Z(); zmax = r1.Z();
551  return;
552  }
553 
554  std::vector<double> xs, ys, zs;
555 
556  for(unsigned int i = 0; i < slice.NCell(); ++i){
557  const art::Ptr<rb::CellHit>& chit = slice.Cell(i);
558  double xyz[3];
559  geom->Plane(chit->Plane())->Cell(chit->Cell())->GetCenter(xyz);
560  zs.push_back(xyz[2]);
561  if(chit->View() == geo::kX)
562  xs.push_back(xyz[0]);
563  else
564  ys.push_back(xyz[1]);
565  }
566 
567  std::sort(xs.begin(), xs.end());
568  std::sort(ys.begin(), ys.end());
569  std::sort(zs.begin(), zs.end());
570 
571  xmin = xs[xs.size()*trimfrac];
572  ymin = ys[ys.size()*trimfrac];
573  zmin = zs[zs.size()*trimfrac];
574 
575  // For small events we want to pick up the last hit, not the N-1th hit
576  xmax = xs[(xs.size()-1)*(1-trimfrac)+1];
577  ymax = ys[(ys.size()-1)*(1-trimfrac)+1];
578  zmax = zs[(zs.size()-1)*(1-trimfrac)+1];
579  }
580  }
581 
582  //---------------------------------------------------------------
584  double& xmin, double& xmax,
585  double& ymin, double& ymax,
586  double& zmin, double& zmax,
587  double trimfrac)
588  {
589  // Fallback to the whole detector in case we don't get values below
591  xmin = -geom->DetHalfWidth();
592  xmax = +geom->DetHalfWidth();
593  ymin = -geom->DetHalfHeight();
594  ymax = +geom->DetHalfHeight();
595  zmin = 0;
596  zmax = geom->DetLength();
597 
598  // Use Fiducial dimensions if smaller than slice
600 
601  float xbox=0;
602  float ybox=0;
603  float zbox=0;
604  if ( (drawopt->fSliceBoxSize).size() == 3 ) {
605  std::vector< float > sizes = drawopt->fSliceBoxSize;
606  xbox = sizes[0];
607  ybox = sizes[1];
608  zbox = sizes[2];
609  }
612 
613  if(slices.failedToGet()){
614  std::cerr << "Couldn't find any slices under label "
615  << fSliceLabel << std::endl;
616  return;
617  }
618 
619  if(fCurrentSlice >= 0 && fCurrentSlice < int(slices->size())){
620  const rb::Cluster& slice = (*slices)[fSlicesToNavigate[fCurrentSlice]];
621 
622  if(trimfrac == 0){
623  const TVector3 r0 = slice.MinXYZ();
624  const TVector3 r1 = slice.MaxXYZ();
625  xmin = r0.X(); xmax = r1.X();
626  ymin = r0.Y(); ymax = r1.Y();
627  zmin = r0.Z(); zmax = r1.Z();
628  return;
629  }
630 
631  std::vector<double> xs, ys, zs;
632 
633  for(unsigned int i = 0; i < slice.NCell(); ++i){
634  const art::Ptr<rb::CellHit>& chit = slice.Cell(i);
635  double xyz[3];
636  geom->Plane(chit->Plane())->Cell(chit->Cell())->GetCenter(xyz);
637  zs.push_back(xyz[2]);
638  if(chit->View() == geo::kX)
639  xs.push_back(xyz[0]);
640  else
641  ys.push_back(xyz[1]);
642  }
643  std::sort(xs.begin(), xs.end());
644  std::sort(ys.begin(), ys.end());
645  std::sort(zs.begin(), zs.end());
646 
647  xmin = xs[xs.size()*trimfrac];
648  ymin = ys[ys.size()*trimfrac];
649  zmin = zs[zs.size()*trimfrac];
650 
651  // For small events we want to pick up the last hit, not the N-1th hit
652  xmax = xs[(xs.size()-1)*(1-trimfrac)+1];
653  ymax = ys[(ys.size()-1)*(1-trimfrac)+1];
654  zmax = zs[(zs.size()-1)*(1-trimfrac)+1];
655 
656  double xmid=(xmax+xmin)/2;
657  double ymid=(ymax+ymin)/2;
658  double zmid=(zmax+zmin)/2;
659  xmax= ( xbox==0 ) ? xmax : xmid+xbox/2;
660  ymax= ( ybox==0 ) ? ymax : ymid+ybox/2;
661  zmax= ( zbox==0 ) ? zmax : zmid+zbox/2;
662  xmin= ( xbox==0 ) ? xmin : xmid-xbox/2;
663  ymin= ( ybox==0 ) ? ymin : ymid-ybox/2;
664  zmin= ( zbox==0 ) ? zmin : zmid-zbox/2;
665  }
666  }
667 
668  //---------------------------------------------------------------
669  std::vector<const rb::Cluster*> SliceNavigator::SlicesToNavigate(const art::Event& evt)
670  {
671  std::vector<const rb::Cluster*> clusts;
674  if(slices.failedToGet()) return {};
675 
676  for(unsigned int i = 0; i < fSlicesToNavigate.size(); ++i)
677  clusts.push_back(&(*slices)[fSlicesToNavigate[i]]);
678 
679  return clusts;
680  }// End of SlicesToNavigate
681 
682  //---------------------------------------------------------------
684  const std::string &toReplace,
685  const std::string &replaceWith)
686  {
687  return(s.replace(s.find(toReplace), toReplace.length(), replaceWith));
688  }
689 
690  // Need to explicitly instantiate every product that can be got. It's a lot
691  // of typing, so use a macro
692 #define INSTANTIATE(T) template size_t SliceNavigator::GetProducts<T>(const art::Event&, const std::string&, const std::string&, std::vector<const T*>&)
693 
701 
703 
704 } // end namespace evd
705 ////////////////////////////////////////////////////////////////////////
int fAutoPrintMax
How many events to print (zero = disable printing)
static constexpr int kDRAWING_SERVICE
Definition: ServiceTable.h:19
const XML_Char * name
Definition: expat.h:151
A 3D position and time representing an interaction vertex.
Definition: Vertex.h:15
back track the reconstruction to the simulation
static void Set(int which)
Definition: NavState.cxx:24
void ParseModuleInstanceString(std::string &mod, std::string &inst)
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
Definition: Cluster.cxx:134
std::map< std::string, double > xmax
void GetBounds(const art::Event &evt, double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax, double trimfrac=0)
set< int >::iterator it
std::vector< art::Ptr< rb::Cluster > > fSlices
Base class for printable objects.
Definition: Printable.h:15
unsigned short Plane() const
Definition: CellHit.h:39
#define DEFINE_ART_SERVICE(svc)
Definition: ServiceMacros.h:93
std::string fSliceLabel
geo::View_t View() const
Definition: CellHit.h:41
void postProcessEvent(const art::Event &evt)
const char * p
Definition: xmltok.h:285
Vertical planes which measure X.
Definition: PlaneGeo.h:28
void GetBox(const art::Event &evt, double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax, double trimfrac=0)
int fInitialSlice
-1 afterwards
A collection of associated CellHits.
Definition: Cluster.h:47
double DetLength() const
OStream cerr
Definition: OStream.cxx:7
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
string filename
Definition: shutoffs.py:106
A rb::Prong with full reconstructed trajectory.
Definition: Track.h:20
const PlaneGeo * Plane(unsigned int i) const
size_t GetProducts(const art::Event &evt, const std::string &which, const std::string &instance, std::vector< const T * > &prods)
RunNumber_t run() const
Definition: Run.h:47
unsigned distance(const T &t1, const T &t2)
Manage all things related to colors for the event display.
Definition: Display3DPad.h:11
Singleton to hold the current art::Event for the event display.
Definition: Run.h:31
TVector3 MaxXYZ() const
Definition: Cluster.cxx:492
std::string fCellHitLabel
Double_t ymax
Definition: plot.C:25
Base class for printable objects.
unsigned short Cell() const
Definition: CellHit.h:40
const XML_Char * s
Definition: expat.h:262
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::vector< ELEMENT const * > &result) const
Definition: DataViewImpl.h:474
static std::map< std::string, evdb::Printable * > & GetPrintables()
Definition: Printable.cxx:61
nova event display
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:441
size_t GetProductsImplFull(const art::Event &evt, const std::string &which, const std::string &instance, std::vector< const T * > &prods)
std::vector< int > fSlicesToNavigate
T get(std::string const &key) const
Definition: ParameterSet.h:231
int evt
std::string fAutoPrintPattern
Pattern for constructing filename.
int fCurrentSlice
Index into fSlicesToNavigate.
bool IsFiltered(const art::Event &evt, art::Ptr< T > x, const std::vector< std::string > &labels)
Is this Ptr marked "filtered out"?
Definition: FilterList.h:96
EventNumber_t event() const
Definition: Event.h:67
double DetHalfHeight() const
Vertex location in position and time.
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
Definition: Cluster.cxx:145
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
A Cluster with defined start position and direction.
Definition: Prong.h:19
int fAutoAdvanceInterval
Wait time in milliseconds.
double DetHalfWidth() const
std::string stringReplace(std::string &s, const std::string &toReplace, const std::string &replaceWith)
Data resulting from a Hough transform on the cell hit positions.
void SetFullEventMode(bool mode)
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
TVector3 MinXYZ() const
Definition: Cluster.cxx:446
art::PtrVector< rb::CellHit > fAllHits
size_t GetProductsImplPart(const art::Event &evt, const std::string &which, const std::string &instance, std::vector< const T * > &prods)
A (plane, cell) pair.
Definition: OfflineChan.h:17
bool fFilterResults
Only navigate slices that aren&#39;t filtered out.
INSTANTIATE(geo::OfflineChan)
void geom(int which=0)
Definition: geom.C:163
exit(0)
void preBeginRun(art::Run const &r)
std::vector< float > fSliceBoxSize
TRandom3 r(0)
Double_t ymin
Definition: plot.C:24
static void OverrideCategory(std::string const &s, int cat)
size_t GetProductsImpl(const art::Event &evt, const std::string &which, const std::string &instance, std::vector< const T * > &prods)
double T
Definition: Xdiff_gwt.C:5
std::string fSliceInstance
std::string to_string(ModuleType mt)
Definition: ModuleType.h:32
Event generator information.
Definition: MCTruth.h:32
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:464
Interface to services and their configurations.
Float_t e
Definition: plot.C:35
Summary from a Hough transform applied to a group of cell hits.
Definition: HoughResult.h:35
void clear()
Definition: PtrVector.h:537
Simple object representing a (plane, cell) pair.
std::string fCellHitInstance
std::vector< NeutrinoEffPur > SliceToMCTruth(const std::vector< const rb::CellHit * > &sliceHits, const std::vector< const rb::CellHit * > &allHits, bool sortPur=false) const
Given a collection of hits (often a slice), returns vector of structures of MCTruth, efficiency, and purity of that neutrino interaction relative to the slice. Efficiency is defined as FLS energy from neutrino interaction in slice / total FLS energy from neutrino interaction in event. This vector is sorted from the highest efficiency interaction to lowest. This function returns all MCTruth, including those without neutrino interactions, i.e. cosmics.
Encapsulate the geometry of one entire detector (near, far, ndos)
std::vector< const rb::Cluster * > SlicesToNavigate(const art::Event &evt)
void reconfigure(const fhicl::ParameterSet &pset) override
bool failedToGet() const
Definition: Handle.h:196
SliceNavigator(const fhicl::ParameterSet &pset, art::ActivityRegistry &reg)
virtual void Print(const char *filename)=0
Global drawing options that apply to all displays.