22 for (
size_t tpc_i = 0; tpc_i < cryostat.
NTPC(); tpc_i++)
78 return InFiducial(point, fiducial, fiducial, fiducial, fiducial, fiducialTop, fiducial);
82 double maxXCut,
double maxYCut,
double maxZCut){
85 double xmax =
fMaxX - maxXCut;
86 double ymin =
fMinY + minYCut;
87 double ymax =
fMaxY - maxYCut;
88 double zmin =
fMinZ + minZCut;
89 double zmax =
fMaxZ - maxZCut;
94 if(x>xmin && x<xmax && y>ymin && y<ymax && z>zmin && z<zmax)
return true;
103 if(hits.size() == 0)
return -1;
104 int tpc = hits[0]->WireID().TPC;
105 for(
size_t i = 0; i < hits.size(); i++){
106 if((
int)hits[i]->WireID().TPC != tpc)
return -1;
114 if(hits.size() == 0)
return 0;
123 if(
std::abs(driftDirection) != 1) driftDirection = 0;
124 return driftDirection;
130 if(hits.size() == 0)
return std::make_pair(0, 0);
138 return std::make_pair(tpcGeo.
MinX(), tpcGeo.
MaxX());
143 if(point.X() < (tpc.
MinX()-buffer) || point.X() > (tpc.
MaxX()+buffer)
144 || point.Y() < (tpc.
MinY()-buffer) || point.Y() > (tpc.
MaxY()+buffer)
145 || point.Z() < (tpc.
MinZ()-buffer) || point.Z() > (tpc.
MaxZ()+buffer))
return false;
152 std::vector<double> dists;
161 std::sort(dists.begin(), dists.end());
170 for(
size_t i = 0; i < particle.NumberTrajectoryPoints(); i++){
171 double x = particle.Vx(i);
172 double y = particle.Vy(i);
173 double z = particle.Vz(i);
184 for(
size_t i = 0; i < particle.NumberTrajectoryPoints(); i++){
185 double x = particle.Vx(i);
186 double y = particle.Vy(i);
187 double z = particle.Vz(i);
199 bool startOutside =
false;
200 bool endOutside =
false;
201 for(
size_t i = 0; i < particle.NumberTrajectoryPoints(); i++){
202 double x = particle.Vx(i);
203 double y = particle.Vy(i);
204 double z = particle.Vz(i);
208 else if(i == 0) startOutside =
true;
209 else if(i == particle.NumberTrajectoryPoints()-1) endOutside =
true;
211 if(enters && (startOutside || endOutside))
return true;
219 bool startOutside =
false;
220 bool endOutside =
false;
221 for(
size_t i = 0; i < particle.NumberTrajectoryPoints(); i++){
222 double x = particle.Vx(i);
223 double y = particle.Vy(i);
224 double z = particle.Vz(i);
228 else if(i == 0) startOutside =
true;
229 else if(i == particle.NumberTrajectoryPoints()-1) endOutside =
true;
231 if(startOutside && enters && endOutside)
return true;
238 for(
size_t i = 0; i < particle.NumberTrajectoryPoints()-1; i++){
239 double x = particle.Vx(i);
240 double y = particle.Vy(i);
241 double z = particle.Vz(i);
242 double x1 = particle.Vx(i+1);
243 double y1 = particle.Vy(i+1);
244 double z1 = particle.Vz(i+1);
247 if(x <= fMinX && x1 >=
fMinX)
return true;
249 if(x <= fMaxX && x1 >=
fMaxX)
return true;
258 TVector3 start (-99999, -99999, -99999);
259 TVector3
end (-99999, -99999, -99999);
260 for(
size_t i = 0; i < particle.NumberTrajectoryPoints(); i++){
261 double x = particle.Vx(i);
262 double y = particle.Vy(i);
263 double z = particle.Vz(i);
267 start.SetXYZ(x, y, z);
272 return std::make_pair(start, end);
278 TVector3 point, disp;
279 for(
size_t i = 0; i < particle.NumberTrajectoryPoints(); i++){
280 double x = particle.Vx(i);
281 double y = particle.Vy(i);
282 double z = particle.Vz(i);
284 point.SetXYZ(x, y, z);
287 length += disp.Mag();
process_name opflash particleana ie ie ie z
CryostatGeo const & GetElement(geo::CryostatID const &cryoid) const
bool InsideTPC(geo::Point_t point, const geo::TPCGeo &tpc, double buffer=0.)
process_name opflash particleana ie x
double MinX() const
Returns the world x coordinate of the start of the box.
Geometry information for a single TPC.
std::pair< TVector3, TVector3 > CrossingPoints(const simb::MCParticle &particle)
double MaxX() const
Returns the world x coordinate of the end of the box.
bool EntersVolume(const simb::MCParticle &particle)
int DriftDirectionFromHits(std::vector< art::Ptr< recob::Hit >> hits)
Geometry information for a single cryostat.
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
double TpcLength(const simb::MCParticle &particle)
process_name pandoraGausCryo1 vertexChargeCryo1 vertexStubCryo1 xmin
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
bool IsContained(const simb::MCParticle &particle)
double MinDistToWall(geo::Point_t point) const
bool CrossesVolume(const simb::MCParticle &particle)
process_name opflash particleana ie ie y
int DetectedInTPC(std::vector< art::Ptr< recob::Hit >> hits)
auto end(FixedBins< T, C > const &) noexcept
double MinZ() const
Returns the world z coordinate of the start of the box.
unsigned int NTPC() const
Number of TPCs in this cryostat.
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
bool InFiducial(geo::Point_t point, double fiducial)
The data type to uniquely identify a TPC.
double MaxY() const
Returns the world y coordinate of the end of the box.
constexpr TPCID const & asTPCID() const
Conversion to TPCID (for convenience of notation).
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
short int DetectDriftDirection() const
Returns the expected drift direction based on geometry.
double MaxZ() const
Returns the world z coordinate of the end of the box.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
double MinY() const
Returns the world y coordinate of the start of the box.
std::pair< double, double > XLimitsFromHits(std::vector< art::Ptr< recob::Hit >> hits)
bool InVolume(const simb::MCParticle &particle)
geo::GeometryCore const * fGeometryService
bool CrossesApa(const simb::MCParticle &particle)