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 #include "TTimer.h"
36 
37 namespace evd
38 {
39  //---------------------------------------------------------------
42  : evdb::Reconfigurable{pset},
43  fAutoPrintCount(0),
44  fRun(0),
45  fFullEvent(true),
46  fCurrentSlice(0),
47  fMaxSliceId(0),
48  fInitialSlice(-1),
49  fTimer(0)
50  {
51  reconfigure(pset);
52 
53  evdb::ServiceTable::OverrideCategory("SliceNavigator",
55 
56  reg.sPostProcessEvent.watch(this, &SliceNavigator::postProcessEvent);
57  reg.sPreBeginRun.watch(this, &SliceNavigator::preBeginRun);
58  }
59 
60  //---------------------------------------------------------------
62  {
63  fSlicesToNavigate.clear();
64  delete fTimer;
65  }
66 
67  //---------------------------------------------------------------
69  {
70  fSliceLabel = pset.get<std::string>("SliceLabel");
71  fCellHitLabel = pset.get<std::string>("CellHitLabel");
72  fAutoAdvanceInterval = pset.get<int>("AutoAdvanceInterval");
73  fAutoPrintPattern = pset.get<std::string>("AutoPrintPattern");
74  fAutoPrintMax = pset.get<int>("AutoPrintMax");
75  fFilterResults = (pset.get<int>("SliceOpt.val") & 1);
76  fDimHits = (pset.get<int>("SliceOpt.val") & 2);
77  fDimOthers = (pset.get<int>("SliceOpt.val") & 4);
78 
79  fFullEvent = !pset.get<bool>("InitiallyEnabled");
80  fInitialSlice = pset.get<int>("InitialSlice");
81 
83  this->ParseModuleInstanceString(fCellHitLabel, fCellHitInstance);
84 
85  }
86 
87  //---------------------------------------------------------------
89  std::string & inst)
90  {
91  const size_t splitPos = mod.find_first_of('_');
92  if(splitPos == std::string::npos){
93  inst = "";
94  return;
95  }
96  inst = mod.substr(splitPos+1);
97  mod.resize(splitPos);
98  }
99 
100  //---------------------------------------------------------------
102  {
103  fRun = r.run();
104  }
105 
106  //---------------------------------------------------------------
108  {
109  // Clear the slices to navigate vector
110  fSlicesToNavigate.clear();
111 
113 
115 
116  evt.getByLabel( sliceTag, slices);
117 
118  if(slices.failedToGet()){
119  std::cerr << "Couldn't find any slices under label "
120  << fSliceLabel << std::endl;
121  fMaxSliceId = 0;
122  return;
123  }
124 
125  int nSli = slices->size();
126  for( int iSli = 0; iSli < nSli; ++iSli){
127  // if we only want to look at slices that
128  // survived filtering, throw the rest away
129  if(!fFullEvent && fFilterResults && rb::IsFiltered(evt,slices,iSli) )
130  continue;
131  if(!fFullEvent && (*slices)[iSli].IsNoise())
132  continue;
133 
134  fSlicesToNavigate.push_back( iSli );
135  if(iSli == fInitialSlice){
136  fCurrentSlice = fSlicesToNavigate.size()-1;
137  fInitialSlice = -1; // Don't do this again
138  }
139  }
140  if (fSlicesToNavigate.size() > 0) fMaxSliceId = fSlicesToNavigate.back();
141 
142  // Protecting against segfaults: If we've advanced to the next event
143  // with fCurrentSlice set to the max number of slices, and the next event
144  // has fewer slices than the previous, we need to make sure we don't
145  // suffer from an index out of range problem.
146  if( (fCurrentSlice + 1 > int(fSlicesToNavigate.size())) && !fSlicesToNavigate.empty() )
147  fCurrentSlice = fSlicesToNavigate.size() - 1;
148 
149  if(fCurrentSlice == -1){
150  if(!fSlicesToNavigate.empty())
151  // We pressed the prev slice button
152  fCurrentSlice = fSlicesToNavigate.size()-1;
153  else
155  }
156 
157  if(fCurrentSlice == -2 ){
158  if(!fSlicesToNavigate.empty())
159  // We pressed the next button, but there
160  // no more slices left in the previous event
161  fCurrentSlice = 0;
162  else
164  }
165 
167  evt.getByLabel(sliceTag, slicecol);
168  fSlices.clear();
169  for(unsigned int i = 0; i < slicecol->size(); ++i)
170  fSlices.push_back(art::Ptr<rb::Cluster>(slicecol, i));
171 
174  evt.getByLabel(cellTag, hitcol);
175  fAllHits.clear();
176  for(unsigned int i = 0; i < hitcol->size(); ++i)
178 
179  // Auto-printing
180  if (fAutoPrintMax > 0 || fAutoPrintMax == -1){
181  ++fAutoPrintCount;
182  std::map<std::string, evdb::Printable*>& ps = evdb::Printable::GetPrintables();
183  for(std::map<std::string, evdb::Printable*>::iterator it = ps.begin(); it != ps.end(); ++it){
184  evdb::Printable* p = it->second;
185 
187  // std::string filename = "evd-slice_r%r_e%e_s%s.gif";
188 
189  // Insert instances of run variable into filename
190  if (filename.find("%r") != std::string::npos)
191  stringReplace(filename, "%r", std::to_string(fRun));
192 
193  // Insert instances of event variable into filename
194  if (filename.find("%e") != std::string::npos)
195  stringReplace(filename, "%e", std::to_string(evt.event()));
196 
197  // Insert instances of slice variable into filename
198  if (filename.find("%s") != std::string::npos)
199  stringReplace(filename, "%s", std::to_string(this->CurrentSlice()));
200 
201  // Print file
202  p->Print(TString(filename));
203  }
204  if (fAutoPrintCount >= (fAutoPrintMax - 1) && fAutoPrintMax != -1)
205  {
206  std::cout << "Hit autoprint max and exiting." << std::endl;
207  exit(0);
208  }
209  }
210 
211  if(fTimer){
212  // Auto-advance is active. Fire off one more shot
213  fTimer->Start(fAutoAdvanceInterval, true);
214  }
215  }
216 
217  //---------------------------------------------------------------
218  template<class T> size_t SliceNavigator::
220  const std::string& which,
221  const std::string& instance,
222  std::vector<const T*>& prods)
223  {
224  return GetProductsImpl(evt, which, instance, prods);
225  }
226 
227  //---------------------------------------------------------------
228  template<class T> size_t SliceNavigator::
230  const std::string& which,
231  const std::string& instance,
232  std::vector<const T*>& prods)
233  {
234  if(fFullEvent)
235  return GetProductsImplFull(evt, which, instance, prods);
236  else
237  return GetProductsImplPart(evt, which, instance, prods);
238  }
239 
240 
241  //---------------------------------------------------------------
242  // Need a special function for clusts again
243  // because cluster-cluster assns are not allowed.
244  // See generic GetProductsImplFull for the story
245  template<> size_t SliceNavigator::
247  const std::string& which,
248  const std::string& instance,
249  std::vector<const rb::Cluster*>& clusts)
250  {
251  std::vector<const rb::Cluster*> temp(clusts);
252  try{
253  evt.getView(which, instance, temp);
254  temp.swap(clusts);
255  }
256  catch(cet::exception& e){
257  std::cerr << "Failed to get products of type " << typeid(rb::Cluster).name()
258  << " under label \"" << which << "\": "
259  << e << std::endl;
260  }
261  return clusts.size();
262  }
263 
264  //---------------------------------------------------------------
265  template<class T> size_t SliceNavigator::
267  const std::string& which,
268  const std::string& instance,
269  std::vector<const T*>& prods)
270  {
271 
272  art::Handle<std::vector<T> > tempHandle;
273 
274  std::vector<art::Ptr<T> > temp;
275 
276  try{
277  evt.getByLabel(art::InputTag(which, instance), tempHandle);
278  art::fill_ptr_vector( temp,tempHandle);
279  }
280  catch(cet::exception& e){
281  std::cerr << "Failed to get products of type " << typeid(T).name()
282  << " under label \"" << which << "\": "
283  << e << std::endl;
284  }
285 
286  std::vector<art::Ptr<T> > tempcopy;
287  // If fFilterResults is turned on, we don't want to
288  // draw anything from a slice that was filtered out
289  // So each product has to be mapped to its associated
290  // slice cluster and check if the slice was filtered out.
291  if( fFilterResults &&
292  typeid(T) != typeid(rb::CellHit) &&
293  typeid(T) != typeid(simb::MCTruth)){
294 
296  evt.getByLabel( art::InputTag(fSliceLabel, fSliceInstance), slicesHandle);
297  std::vector<art::Ptr<rb::Cluster> > slices;
298  art::fill_ptr_vector( slices, slicesHandle);
299  art::FindOneP<rb::Cluster> fot(temp, evt, which);
300 
301  if(!fot.isValid()){
302  std::cerr << "Nothing of type " << typeid(T).name()
303  << " with label \"" << which << "\" and instance \"" << instance
304  << "\" associated with slices" << std::endl;
305  return 0;
306  }
307 
308  int nT = temp.size();
309  for( int i = 0; i < nT; i++){
310 
311  art::Ptr<rb::Cluster> slice = fot.at( i );
312  std::vector< art::Ptr< rb::Cluster> >::iterator slicePos =
313  std::find(slices.begin(), slices.end(), slice) ;
314  int iSlice = std::distance( slices.begin(), slicePos );
315 
316  if( fFilterResults && rb::IsFiltered(evt,slicesHandle, iSlice ) )
317  continue;
318  tempcopy.push_back( temp[i] );
319 
320  }// end loop over temp
321  }
322  else
323  tempcopy.swap( temp );
324 
325  for( art::Ptr<T> p: tempcopy)
326  prods.push_back( p.get());
327 
328  return prods.size();
329  }
330 
331 
332  //---------------------------------------------------------------
333  template<class T> size_t SliceNavigator::
335  const std::string& which,
336  const std::string& instance,
337  std::vector<const T*>& prods)
338  {
341 
342  if(slices.failedToGet()){
343  std::cerr << "Couldn't find any slices under label "
344  << fSliceLabel << std::endl;
345  return 0;
346  }
347 
348  art::FindManyP<T> fmt(slices, evt, art::InputTag(which, instance));
349  if(!fmt.isValid()){
350  std::cerr << "Nothing of type " << typeid(T).name()
351  << " with label \"" << which << "\" and instance \"" << instance
352  << "\" associated with slices" << std::endl;
353  return 0;
354  }
355 
356  std::vector<art::Ptr<T>> prodPtrs = fmt.at( fSlicesToNavigate[fCurrentSlice] );
357  prods.clear();
358  for(art::Ptr<T> p: prodPtrs) prods.push_back(p.get());
359  return prods.size();
360  }
361 
362  //---------------------------------------------------------------
363  // Special case for Tracks because there's this MichelE trick
364  template<> size_t SliceNavigator::
366  const std::string& whichTrack,
367  const std::string& whichMichel,
368  const std::string& instance,
369  std::vector<const rb::Track*>& tracks)
370  {
371  std::vector<const me::TrkME*> clusts;
372  GetProductsImpl(evt, whichTrack, instance, tracks);
373  GetProductsImpl(evt, whichMichel, instance, clusts);
374 
375  for(const me::TrkME* c: clusts)
376  tracks.push_back(c->ParentTrk().get());
377 
378  return tracks.size();
379  }
380 
381  //---------------------------------------------------------------
382  // Special case clusters because they *are* the slice, not just associated
383  template<> size_t SliceNavigator::
385  const std::string& which,
386  const std::string& instance,
387  std::vector<const rb::Cluster*>& clusts)
388  {
389  // If it's the actual slices, look them up by index.
390  // Otherwise we'll get nothing
391  // (not possible to associate Cluster with Cluster)
392  if(which == fSliceLabel && instance == ""){
394  evt.getByLabel(fSliceLabel, slices);
395  if(slices.failedToGet()){
396  std::cerr << "Couldn't find any slices under label "
397  << fSliceLabel << std::endl;
398  return 0;
399  }
400  if( fFullEvent ){
401  int nSli = slices->size();
402  for( int iSli=0; iSli < nSli; ++iSli){
403  if ( fFilterResults && rb::IsFiltered(evt,slices, iSli ) )
404  continue;
405  clusts.push_back((art::Ptr<rb::Cluster>(slices, iSli).get())) ;
406  }
407  }// if full event
408  else{
410  if( fCurrentSlice >=0 )
411  clusts.push_back( (art::Ptr<rb::Cluster>(slices, idx)).get() );
412  }
413  }
414  else
415  GetProductsImplFull(evt, which, instance, clusts);
416 
417  return clusts.size();
418  }
419 
420  //---------------------------------------------------------------
421  // Special case for MCTruth because we have to go via backtracker
422  template<> size_t SliceNavigator::
424  const std::string& which,
425  const std::string& instance,
426  std::vector<const simb::MCTruth*>& truths)
427  {
428  truths.clear();
429 
430  if(fFullEvent){
431  GetProductsImpl(evt, which, instance, truths);
432  }
433  else{
435 
436  std::vector<cheat::NeutrinoEffPur> eps =
438  fAllHits);
439 
440  if(!eps.empty()) truths = {eps.front().neutrinoInt.get()};
441  }
442 
443  return truths.size();
444  }
445 
446  //---------------------------------------------------------------
448  {
449  return fFullEvent;
450  }
451 
452  //---------------------------------------------------------------
454  {
455  if(mode == fFullEvent) return;
456 
457  fFullEvent = mode;
459  }
460 
461  //---------------------------------------------------------------
463  {
464  --fCurrentSlice;
465 
466  if(fCurrentSlice < 0){
467  fCurrentSlice = -1;
469  fSlicesToNavigate.clear();
470  }
471  else{
472  // Go to the slice requested
474  }
475  }
476 
477  //---------------------------------------------------------------
479  {
480  ++fCurrentSlice;
481 
482  if(fCurrentSlice >= int(fSlicesToNavigate.size())){
483  fCurrentSlice = -2;
484  fSlicesToNavigate.clear();
486  }
487  else{
488  // Go to the slice requested
490  }
491  }
492 
493  //---------------------------------------------------------------
495  {
496  delete fTimer;
497  fTimer = new TTimer;
498  fTimer->SetObject(this);
499  // One-shot timer, will be re-primed by postProcessEvent()
500  fTimer->Start(fAutoAdvanceInterval, true);
501  }
502 
503  //---------------------------------------------------------------
505  {
506  if(!fTimer) return;
507  fTimer->Stop();
508  delete fTimer;
509  fTimer = 0;
510  }
511 
512  //---------------------------------------------------------------
514  {
515  return fTimer != 0;
516  }
517 
518  //---------------------------------------------------------------
520  {
521  if(fSlicesToNavigate.empty() || fCurrentSlice < 0) return 0;
522 
524  }
525 
526  //---------------------------------------------------------------
528  {
529  return fCurrentSlice;
530  }
531 
532  //---------------------------------------------------------------
534  {
535  auto it = std::find(fSlicesToNavigate.begin(),
536  fSlicesToNavigate.end(),
537  slice);
538  if(it != fSlicesToNavigate.end()){
541  }
542  else{
543  // What else can we do?
544  fCurrentSlice = 0;
546  }
547  }
548 
549  //---------------------------------------------------------------
551  {
552  return fMaxSliceId;
553  }
554 
555  //---------------------------------------------------------------
557  double& xmin, double& xmax,
558  double& ymin, double& ymax,
559  double& zmin, double& zmax,
560  double trimfrac)
561  {
562  // Fallback to the whole detector in case we don't get values below
564  xmin = -geom->DetHalfWidth();
565  xmax = +geom->DetHalfWidth();
566  ymin = -geom->DetHalfHeight();
567  ymax = +geom->DetHalfHeight();
568  zmin = 0;
569  zmax = geom->DetLength();
570 
573 
574  if(slices.failedToGet()){
575  std::cerr << "Couldn't find any slices under label "
576  << fSliceLabel << std::endl;
577  return;
578  }
579 
580  if(fCurrentSlice >= 0 && fCurrentSlice < int(slices->size())){
581  const rb::Cluster& slice = (*slices)[fSlicesToNavigate[fCurrentSlice]];
582 
583  if(trimfrac == 0){
584  const TVector3 r0 = slice.MinXYZ();
585  const TVector3 r1 = slice.MaxXYZ();
586  xmin = r0.X(); xmax = r1.X();
587  ymin = r0.Y(); ymax = r1.Y();
588  zmin = r0.Z(); zmax = r1.Z();
589  return;
590  }
591 
592  std::vector<double> xs, ys, zs;
593 
594  for(unsigned int i = 0; i < slice.NCell(); ++i){
595  const art::Ptr<rb::CellHit>& chit = slice.Cell(i);
596  double xyz[3];
597  geom->Plane(chit->Plane())->Cell(chit->Cell())->GetCenter(xyz);
598  zs.push_back(xyz[2]);
599  if(chit->View() == geo::kX)
600  xs.push_back(xyz[0]);
601  else
602  ys.push_back(xyz[1]);
603  }
604 
605  std::sort(xs.begin(), xs.end());
606  std::sort(ys.begin(), ys.end());
607  std::sort(zs.begin(), zs.end());
608 
609  xmin = xs[xs.size()*trimfrac];
610  ymin = ys[ys.size()*trimfrac];
611  zmin = zs[zs.size()*trimfrac];
612 
613  // For small events we want to pick up the last hit, not the N-1th hit
614  xmax = xs[(xs.size()-1)*(1-trimfrac)+1];
615  ymax = ys[(ys.size()-1)*(1-trimfrac)+1];
616  zmax = zs[(zs.size()-1)*(1-trimfrac)+1];
617  }
618  }
619 
620  //---------------------------------------------------------------
622  double& xmin, double& xmax,
623  double& ymin, double& ymax,
624  double& zmin, double& zmax,
625  double trimfrac)
626  {
627  // Fallback to the whole detector in case we don't get values below
629  xmin = -geom->DetHalfWidth();
630  xmax = +geom->DetHalfWidth();
631  ymin = -geom->DetHalfHeight();
632  ymax = +geom->DetHalfHeight();
633  zmin = 0;
634  zmax = geom->DetLength();
635 
636  // Use Fiducial dimensions if smaller than slice
638 
639  float xbox=0;
640  float ybox=0;
641  float zbox=0;
642  if ( (drawopt->fSliceBoxSize).size() == 3 ) {
643  std::vector< float > sizes = drawopt->fSliceBoxSize;
644  xbox = sizes[0];
645  ybox = sizes[1];
646  zbox = sizes[2];
647  }
650 
651  if(slices.failedToGet()){
652  std::cerr << "Couldn't find any slices under label "
653  << fSliceLabel << std::endl;
654  return;
655  }
656 
657  if(fCurrentSlice >= 0 && fCurrentSlice < int(slices->size())){
658  const rb::Cluster& slice = (*slices)[fSlicesToNavigate[fCurrentSlice]];
659 
660  if(trimfrac == 0){
661  const TVector3 r0 = slice.MinXYZ();
662  const TVector3 r1 = slice.MaxXYZ();
663  xmin = r0.X(); xmax = r1.X();
664  ymin = r0.Y(); ymax = r1.Y();
665  zmin = r0.Z(); zmax = r1.Z();
666  return;
667  }
668 
669  std::vector<double> xs, ys, zs;
670 
671  for(unsigned int i = 0; i < slice.NCell(); ++i){
672  const art::Ptr<rb::CellHit>& chit = slice.Cell(i);
673  double xyz[3];
674  geom->Plane(chit->Plane())->Cell(chit->Cell())->GetCenter(xyz);
675  zs.push_back(xyz[2]);
676  if(chit->View() == geo::kX)
677  xs.push_back(xyz[0]);
678  else
679  ys.push_back(xyz[1]);
680  }
681  std::sort(xs.begin(), xs.end());
682  std::sort(ys.begin(), ys.end());
683  std::sort(zs.begin(), zs.end());
684 
685  xmin = xs[xs.size()*trimfrac];
686  ymin = ys[ys.size()*trimfrac];
687  zmin = zs[zs.size()*trimfrac];
688 
689  // For small events we want to pick up the last hit, not the N-1th hit
690  xmax = xs[(xs.size()-1)*(1-trimfrac)+1];
691  ymax = ys[(ys.size()-1)*(1-trimfrac)+1];
692  zmax = zs[(zs.size()-1)*(1-trimfrac)+1];
693 
694  double xmid=(xmax+xmin)/2;
695  double ymid=(ymax+ymin)/2;
696  double zmid=(zmax+zmin)/2;
697  xmax= ( xbox==0 ) ? xmax : xmid+xbox/2;
698  ymax= ( ybox==0 ) ? ymax : ymid+ybox/2;
699  zmax= ( zbox==0 ) ? zmax : zmid+zbox/2;
700  xmin= ( xbox==0 ) ? xmin : xmid-xbox/2;
701  ymin= ( ybox==0 ) ? ymin : ymid-ybox/2;
702  zmin= ( zbox==0 ) ? zmin : zmid-zbox/2;
703  }
704  }
705 
706  //---------------------------------------------------------------
707  std::vector<const rb::Cluster*> SliceNavigator::SlicesToNavigate(const art::Event& evt)
708  {
709  std::vector<const rb::Cluster*> clusts;
712  if(slices.failedToGet()) return {};
713 
714  for(unsigned int i = 0; i < fSlicesToNavigate.size(); ++i)
715  clusts.push_back(&(*slices)[fSlicesToNavigate[i]]);
716 
717  return clusts;
718  }// End of SlicesToNavigate
719 
720  //---------------------------------------------------------------
722  const std::string &toReplace,
723  const std::string &replaceWith)
724  {
725  return(s.replace(s.find(toReplace), toReplace.length(), replaceWith));
726  }
727 
728  //---------------------------------------------------------------
730  {
731  // This is the auto-advance timer
732  Next();
733  return true;
734  }
735 
736  // Need to explicitly instantiate every product that can be got. It's a lot
737  // of typing, so use a macro
738 #define INSTANTIATE(T) template size_t SliceNavigator::GetProducts<T>(const art::Event&, const std::string&, const std::string&, std::vector<const T*>&)
739 
747 
749 
750 } // end namespace evd
751 ////////////////////////////////////////////////////////////////////////
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
Bool_t HandleTimer(TTimer *t)
double DetHalfHeight() const
Vertex location in position and time.
OStream cout
Definition: OStream.cxx:6
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
Definition: Cluster.cxx:145
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.
enum BeamMode string