All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sbnana/sbnanalysis/ana/SBNOscReco/CosmicIDAlgs/FiducialVolumeCosmicIdAlg.cc
Go to the documentation of this file.
2 
3 namespace ana{
4 
6  this->reconfigure(manager, config);
7 }
8 
9 
11 
12 
14 
16  fFiducialVolumes.clear();
17 
18  fMinX = config.FiducialCuts().MinX();
19  fMinY = config.FiducialCuts().MinY();
20  fMinZ = config.FiducialCuts().MinZ();
21  fMaxX = config.FiducialCuts().MaxX();
22  fMaxY = config.FiducialCuts().MaxY();
23  fMaxZ = config.FiducialCuts().MaxZ();
24 
25  // get the set of fiducial volumes
26  for (auto const &cryo: manager.GetGeometryProvider()->IterateCryostats()) {
27  geo::GeometryCore::TPC_iterator tstart = manager.GetGeometryProvider()->begin_TPC(cryo.ID()),
28  tend = manager.GetGeometryProvider()->end_TPC(cryo.ID());
29 
30  double Min_X = std::min_element(tstart, tend, [](auto &lhs, auto &rhs) { return lhs.MinX() < rhs.MinX(); })->MinX();
31  double Min_Y = std::min_element(tstart, tend, [](auto &lhs, auto &rhs) { return lhs.MinY() < rhs.MinY(); })->MinY();
32  double Min_Z = std::min_element(tstart, tend, [](auto &lhs, auto &rhs) { return lhs.MinZ() < rhs.MinZ(); })->MinZ();
33 
34  double Max_X = std::max_element(tstart, tend, [](auto &lhs, auto &rhs) { return lhs.MaxX() < rhs.MaxX(); })->MaxX();
35  double Max_Y = std::max_element(tstart, tend, [](auto &lhs, auto &rhs) { return lhs.MaxY() < rhs.MaxY(); })->MaxY();
36  double Max_Z = std::max_element(tstart, tend, [](auto &lhs, auto &rhs) { return lhs.MaxZ() < rhs.MaxZ(); })->MaxZ();
37 
38  fFiducialVolumes.emplace_back(Min_X + fMinX, Max_X - fMaxX, Min_Y + fMinY, Max_Y - fMaxY, Min_Z + fMinZ, Max_Z - fMaxZ);
39  }
40 
41  return;
42 }
43 
44 // Check if point in fiducial volume used by this algorithm
46  for (const geo::BoxBoundedGeo vol: fFiducialVolumes) {
47  if (vol.ContainsPosition(point)) return true;
48  }
49  return false;
50 }
51 
52 // Check both start and end points of track are in fiducial volume
54 
55  bool startInFiducial = InFiducial(track.Vertex());
56 
57  bool endInFiducial = InFiducial(track.End());
58 
59  if(!startInFiducial && !endInFiducial) return true;
60 
61  return false;
62 
63 }
64 
65 
66 }
FiducialVolumeCosmicIdAlg(const core::ProviderManager &manager, const Config &config)
void reconfigure(const core::ProviderManager &manager, const Config &config)
process_name use argoneut_mc_hitfinder track
process_name opflashCryoW ana
const geo::GeometryCore * GetGeometryProvider() const
TPC_iterator begin_TPC() const
Returns an iterator pointing to the first TPC in the detector.
Interface to LArSoft services.
Point_t const & Vertex() const
IteratorBox< cryostat_iterator,&GeometryCore::begin_cryostat,&GeometryCore::end_cryostat > IterateCryostats() const
Enables ranged-for loops on all cryostats of the detector.
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:33
Point_t const & End() const
Forward iterator browsing all geometry elements in the detector.
Definition: GeometryCore.h:727
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a &quot;fitted&quot; track:
TPC_iterator end_TPC() const
Returns an iterator pointing after the last TPC in the detector.