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