All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sbncode/sbncode/GeometryTools/TPCGeoAlg.h
Go to the documentation of this file.
1 #ifndef TPCGEOALG_H_SEEN
2 #define TPCGEOALG_H_SEEN
3 
4 
5 /////////////////////////////////////////////////////////////////////
6 // TPCGeoAlg.h
7 //
8 // Wrapper for easy access to TPC geometry
9 // Written by T Brooks (tbrooks@fnal.gov) for SBND, May 2019
10 // Ported to icaruscode by C Hilgenberg (chilgenb@fnal.gov), Oct 2021
11 /////////////////////////////////////////////////////////////////////
12 
13 // framework
14 #include "art/Framework/Principal/Event.h"
15 #include "art/Framework/Core/ModuleMacros.h"
16 #include "fhiclcpp/ParameterSet.h"
17 #include "art/Framework/Principal/Handle.h"
18 #include "canvas/Persistency/Common/Ptr.h"
19 #include "canvas/Persistency/Common/PtrVector.h"
20 #include "art/Framework/Services/Registry/ServiceHandle.h"
21 #include "messagefacility/MessageLogger/MessageLogger.h"
22 
23 // LArSoft
27 #include "nusimdata/SimulationBase/MCParticle.h"
29 
30 // c++
31 #include <vector>
32 
33 
34 namespace sbn{
35 
36  class TPCGeoAlg {
37  public:
38 
39  TPCGeoAlg();
40 
41  ~TPCGeoAlg();
42 
43  // Getters
44  double MinX() const;
45  double MinY() const;
46  double MinZ() const;
47  double MaxX() const;
48  double MaxY() const;
49  double MaxZ() const;
50  double CpaWidth() const;
51 
52  // Functions for applying fiducial volume cuts to total volume
53  bool InFiducial(geo::Point_t point, double fiducial);
54  bool InFiducial(geo::Point_t point, double fiducial, double fiducialTop);
55  bool InFiducial(geo::Point_t point, double minXCut, double minYCut, double minZCut,
56  double maxXCut, double maxYCut, double maxZCut);
57 
58  // Is point inside given TPC
59  bool InsideTPC(geo::Point_t point, const geo::TPCGeo& tpc, double buffer=0.);
60 
61  // Determine which TPC a collection of hits is detected in (-1 if multiple)
62  int DetectedInTPC(std::vector<art::Ptr<recob::Hit>> hits);
63  // Determine the drift direction for a collection of hits (-1, 0 or 1 assuming drift in X)
64  int DriftDirectionFromHits(std::vector<art::Ptr<recob::Hit>> hits);
65  // Work out the drift limits for a collection of hits
66  std::pair<double, double> XLimitsFromHits(std::vector<art::Ptr<recob::Hit>> hits);
67 
68  double MinDistToWall(geo::Point_t point) const;
69 
70  // Determine if a true particle is ever inside the TPC volume
71  bool InVolume(const simb::MCParticle& particle);
72  // Determine if a true particle is contained inside the TPC volume
73  bool IsContained(const simb::MCParticle& particle);
74  // Determine if a true particle enters the TPC volume
75  bool EntersVolume(const simb::MCParticle& particle);
76  // Determine if a true particle crosses the TPC volume
77  bool CrossesVolume(const simb::MCParticle& particle);
78  // Determine if a true particle crosses either APA
79  bool CrossesApa(const simb::MCParticle& particle);
80 
81  std::pair<TVector3, TVector3> CrossingPoints(const simb::MCParticle& particle);
82  double TpcLength(const simb::MCParticle& particle);
83 
84  private:
85 
86  double fMinX;
87  double fMinY;
88  double fMinZ;
89  double fMaxX;
90  double fMaxY;
91  double fMaxZ;
92  double fCpaWidth;
93 
95 
96  };
97 
98 }
99 
100 #endif
101 
102 
Utilities related to art service access.
bool InsideTPC(geo::Point_t point, const geo::TPCGeo &tpc, double buffer=0.)
Declaration of signal hit object.
Geometry information for a single TPC.
Definition: TPCGeo.h:38
std::pair< TVector3, TVector3 > CrossingPoints(const simb::MCParticle &particle)
bool EntersVolume(const simb::MCParticle &particle)
int DriftDirectionFromHits(std::vector< art::Ptr< recob::Hit >> hits)
double TpcLength(const simb::MCParticle &particle)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
Access the description of detector geometry.
bool IsContained(const simb::MCParticle &particle)
double MinDistToWall(geo::Point_t point) const
bool CrossesVolume(const simb::MCParticle &particle)
int DetectedInTPC(std::vector< art::Ptr< recob::Hit >> hits)
bool InFiducial(geo::Point_t point, double fiducial)
Description of geometry of one entire detector.
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
std::pair< double, double > XLimitsFromHits(std::vector< art::Ptr< recob::Hit >> hits)
art framework interface to geometry description
bool InVolume(const simb::MCParticle &particle)
geo::GeometryCore const * fGeometryService
bool CrossesApa(const simb::MCParticle &particle)