-
Notifications
You must be signed in to change notification settings - Fork 0
/
MCTools.h
190 lines (151 loc) · 8.38 KB
/
MCTools.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
//////////////////////////////////////////////////////////////
// Name: MCTools.h
// Date: 25 March 2016
// Author: Everybody is an author!
//////////////////////////////////////////////////////////////
#ifndef MCTOOLS_H
#define MCTOOLS_H
// Framework includes
#include "art/Framework/Principal/Handle.h"
#include "fhiclcpp/ParameterSet.h"
// LArSoft includes
#include "larcore/Geometry/Geometry.h"
#include "larcore/Geometry/GeometryCore.h"
#include "larcore/SimpleTypesAndConstants/geo_types.h"
#include "larsim/Simulation/sim.h"
#include "larsim/Simulation/SimChannel.h"
#include "SimulationBase/MCParticle.h"
// ROOT includes
#include "TVector3.h"
// C++ includes
#include <utility>
#include <vector>
namespace EMShowerContainment {
class MCTools {
public:
// constructor
MCTools(fhicl::ParameterSet const& pset);
// destructor
~MCTools();
// this method reads in any parameters from the .fcl files
void reconfigure(fhicl::ParameterSet const& pset);
// returns dimensions of TPC
double const detectorLength_();
double const detectorWidth_();
double const detectorHeight_();
double const detectorDiagonal_();
// returns true if point (x, y, z) is inside TPC
bool isInsideTPC_(double const& x,
double const& y,
double const& z);
// set fiducial cuboid volume
void setFiducialCuboid_(double const (&fiducialCuboidBoundaryLower)[3],
double const (&fiducialCuboidBoundaryUpper)[3]);
// returns true if point (x, y, z) is inside fiducial cuboid volume
bool isInsideFiducialCuboid_(double const& x,
double const& y,
double const& z);
// returns distance between two 3D points (x0, y0, z0) and (x1, y1, z1)
double distance_(double const& x0,
double const& y0,
double const& z0,
double const& x1,
double const& y1,
double const& z1);
// returns 3D spatial distance between two four-vectors
double distance3D_(double const (& aXYZT)[4],
double const (& bXYZT)[4]);
// returns 4D distance between two four-vectors
double distance4D_(double const (& aXYZT)[4],
double const (& bXYZT)[4]);
// returns 3D spatial angle between two four-vectors
double angle3D_(double const (& aXYZT)[4],
double const (& bXYZT)[4]);
// get four-vectors of start/end positions and momenta from particle
void getFourVectors_(simb::MCParticle const& particle,
double (& startXYZT)[4],
double (& endXYZT)[4],
double (& startPE)[4],
double (& endPE)[4]);
// get length of a particle's trajectory
double getTrajectoryLength_(simb::MCParticle const& particle);
// get daughter particles of showers
void getShowerDaughters_(int const& trackID,
std::map< int, const simb::MCParticle* > const& particleMap,
std::map< int, const simb::MCParticle* > & showerParticleMap);
// get distance from \vec{a} to TPC edge in the direction of
// (\vec{a} - \vec{b})
double distanceToTPCEdge_(double const (& aXYZT)[4],
double const (& bXYZT)[4]);
// get distance from \vec{a} to TPC boundary in the direction
// of (\vec{a} - \vec{b})
void distanceToTPCBoundary_(double const (& aXYZT)[4],
double const (& bXYZT)[4],
double & distanceX,
double & distanceY,
double & distanceZ,
double & distance);
// get longitudinal shower profile
void longitudinalShowerProfile_(std::map< int, const simb::MCParticle* > const& showerParticleMap,
art::ValidHandle< std::vector< sim::SimChannel > > const& simChannelHandle,
double const& dz,
//double const& maxDepth,
TVector3 const& startPoint,
TVector3 const& longitudinalDirection,
std::vector< double > & longitudinalProfile);
// get radial shower profile
void radialShowerProfile_(std::map< int, const simb::MCParticle* > const& showerParticleMap,
art::ValidHandle< std::vector< sim::SimChannel > > const& simChannelHandle,
double const& dr,
//double const& maxRadius,
TVector3 const& startPoint,
std::vector< double > & radialProfile);
// get shower variables
void getShowerVariables_(int const& trackID,
std::map< int, const simb::MCParticle* > const& particleMap,
art::ValidHandle< std::vector< sim::SimChannel > > const& simChannelHandle,
std::map< int, const simb::MCParticle* > & showerParticleMap,
double (& startXYZT)[4],
double (& endXYZT)[4],
double (& startPE)[4],
double (& endPE)[4],
double & photonAngleZ,
bool & photonConvert,
double & photonConversionLength,
double & photonEnergy,
double & photonEnergyDeposited,
double & photonTPCContainment,
double & photonTPCDistanceX,
double & photonTPCDistanceY,
double & photonTPCDistanceZ,
double & photonTPCDistance,
double & photonSphereEnergy,
double & photonSphereContainment,
double & photonSphereRadius);
// this method is used for testing porpoises
void hello_world();
private:
// this method is used for testing dolphins
void hello_kitty();
// pointer to geometry provider
geo::GeometryCore const* fGeometry;
// dimensions of TPC
double fDetectorLength;
double fDetectorWidth;
double fDetectorHeight;
double fDetectorDiagonal;
// TPC boundaries
double fTPCBoundaryLower[3];
double fTPCBoundaryUpper[3];
// fiducial volume boundaries
double fFiducialCuboidBoundaryLower[3];
double fFiducialCuboidBoundaryUpper[3];
//double fFiducialCylinderCenter;
//double fFiducialCylinderRadius;
//double fFiducialCylinderHeight;
// maximum distance to boundary 1D
double fMaxDistanceToBoundary1D;
bool fDebug; // print messages out for debugging
};
} // namespace EMShowerContainment
#endif