19 #include "Utilities/AssociationUtil.h" 42 :
evdb::Reconfigurable{pset},
91 const size_t splitPos = mod.find_first_of(
'_');
92 if(splitPos == std::string::npos){
96 inst = mod.substr(splitPos+1);
119 std::cerr <<
"Couldn't find any slices under label " 125 int nSli = slices->size();
126 for(
int iSli = 0; iSli < nSli; ++iSli){
169 for(
unsigned int i = 0;
i < slicecol->size(); ++
i)
176 for(
unsigned int i = 0;
i < hitcol->size(); ++
i)
183 for(std::map<std::string, evdb::Printable*>::iterator
it = ps.begin();
it != ps.end(); ++
it){
190 if (filename.find(
"%r") != std::string::npos)
194 if (filename.find(
"%e") != std::string::npos)
198 if (filename.find(
"%s") != std::string::npos)
202 p->
Print(TString(filename));
222 std::vector<const T*>& prods)
232 std::vector<const T*>& prods)
249 std::vector<const rb::Cluster*>& clusts)
251 std::vector<const rb::Cluster*>
temp(clusts);
253 evt.
getView(which, instance, temp);
258 <<
" under label \"" << which <<
"\": " 261 return clusts.size();
269 std::vector<const T*>& prods)
274 std::vector<art::Ptr<T> >
temp;
281 std::cerr <<
"Failed to get products of type " <<
typeid(
T).
name()
282 <<
" under label \"" << which <<
"\": " 286 std::vector<art::Ptr<T> > tempcopy;
297 std::vector<art::Ptr<rb::Cluster> > slices;
303 <<
" with label \"" << which <<
"\" and instance \"" << instance
304 <<
"\" associated with slices" <<
std::endl;
308 int nT = temp.size();
309 for(
int i = 0;
i < nT;
i++){
312 std::vector< art::Ptr< rb::Cluster> >::iterator slicePos =
313 std::find(slices.begin(), slices.end(), slice) ;
318 tempcopy.push_back( temp[
i] );
323 tempcopy.swap( temp );
326 prods.push_back(
p.get());
337 std::vector<const T*>& prods)
343 std::cerr <<
"Couldn't find any slices under label " 351 <<
" with label \"" << which <<
"\" and instance \"" << instance
352 <<
"\" associated with slices" <<
std::endl;
369 std::vector<const rb::Track*>& tracks)
371 std::vector<const me::TrkME*> clusts;
376 tracks.push_back(
c->ParentTrk().get());
378 return tracks.size();
387 std::vector<const rb::Cluster*>& clusts)
396 std::cerr <<
"Couldn't find any slices under label " 401 int nSli = slices->size();
402 for(
int iSli=0; iSli < nSli; ++iSli){
417 return clusts.size();
426 std::vector<const simb::MCTruth*>& truths)
436 std::vector<cheat::NeutrinoEffPur> eps =
440 if(!eps.empty()) truths = {eps.front().neutrinoInt.get()};
443 return truths.size();
559 double& zmin,
double&
zmax,
575 std::cerr <<
"Couldn't find any slices under label " 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();
592 std::vector<double> xs, ys, zs;
594 for(
unsigned int i = 0;
i < slice.
NCell(); ++
i){
598 zs.push_back(xyz[2]);
600 xs.push_back(xyz[0]);
602 ys.push_back(xyz[1]);
605 std::sort(xs.begin(), xs.end());
606 std::sort(ys.begin(), ys.end());
607 std::sort(zs.begin(), zs.end());
609 xmin = xs[xs.size()*trimfrac];
610 ymin = ys[ys.size()*trimfrac];
611 zmin = zs[zs.size()*trimfrac];
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];
624 double& zmin,
double&
zmax,
652 std::cerr <<
"Couldn't find any slices under label " 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();
669 std::vector<double> xs, ys, zs;
671 for(
unsigned int i = 0;
i < slice.
NCell(); ++
i){
675 zs.push_back(xyz[2]);
677 xs.push_back(xyz[0]);
679 ys.push_back(xyz[1]);
681 std::sort(xs.begin(), xs.end());
682 std::sort(ys.begin(), ys.end());
683 std::sort(zs.begin(), zs.end());
685 xmin = xs[xs.size()*trimfrac];
686 ymin = ys[ys.size()*trimfrac];
687 zmin = zs[zs.size()*trimfrac];
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];
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;
709 std::vector<const rb::Cluster*> clusts;
725 return(s.replace(s.find(toReplace), toReplace.length(), replaceWith));
738 #define INSTANTIATE(T) template size_t SliceNavigator::GetProducts<T>(const art::Event&, const std::string&, const std::string&, std::vector<const T*>&) int fAutoPrintMax
How many events to print (zero = disable printing)
static constexpr int kDRAWING_SERVICE
A 3D position and time representing an interaction vertex.
back track the reconstruction to the simulation
static void Set(int which)
void ParseModuleInstanceString(std::string &mod, std::string &inst)
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
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)
std::vector< art::Ptr< rb::Cluster > > fSlices
Base class for printable objects.
unsigned short Plane() const
#define DEFINE_ART_SERVICE(svc)
void postProcessEvent(const art::Event &evt)
Vertical planes which measure X.
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.
::xsd::cxx::tree::exception< char > exception
A rb::Prong with full reconstructed trajectory.
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)
unsigned distance(const T &t1, const T &t2)
Manage all things related to colors for the event display.
Singleton to hold the current art::Event for the event display.
void SetCurrentSlice(int slice)
std::string fCellHitLabel
Base class for printable objects.
unsigned short Cell() const
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::vector< ELEMENT const * > &result) const
bool FullEventMode() const
static std::map< std::string, evdb::Printable * > & GetPrintables()
void push_back(Ptr< U > const &p)
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
std::string fAutoPrintPattern
Pattern for constructing filename.
Holds information about what action to take next.
int fCurrentSlice
Index into fSlicesToNavigate.
int CurrentSliceIndex() const
bool IsFiltered(const art::Event &evt, art::Ptr< T > x, const std::vector< std::string > &labels)
Is this Ptr marked "filtered out"?
EventNumber_t event() const
Bool_t HandleTimer(TTimer *t)
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.
A rawdata::RawDigit with channel information decoded.
A Cluster with defined start position and direction.
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
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)
bool fFilterResults
Only navigate slices that aren't filtered out.
INSTANTIATE(geo::OfflineChan)
void preBeginRun(art::Run const &r)
std::vector< float > fSliceBoxSize
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)
std::string fSliceInstance
std::string to_string(ModuleType mt)
Event generator information.
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Interface to services and their configurations.
Summary from a Hough transform applied to a group of cell hits.
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
SliceNavigator(const fhicl::ParameterSet &pset, art::ActivityRegistry ®)
virtual void Print(const char *filename)=0
Global drawing options that apply to all displays.