92 const TLorentzVector& v4 = part.Position();
93 const TLorentzVector& p4 = part.Momentum();
95 double x0[3] = {v4.X(), v4.Y(), v4.Z() };
97 double dx[3] = {p4.Px() / p4.Vect().Mag(), p4.Py() / p4.Vect().Mag(), p4.Pz() / p4.Vect().Mag()};
113 std::array<int, 3> quadrant {};
114 std::array<double, 3> candidatePlane {};
115 std::array<double, 3>
coord {};
117 std::array<double, 3> bound_lo = {{bound[0], bound[2], bound[4]}};
118 std::array<double, 3> bound_hi = {{bound[1], bound[3], bound[5]}};
124 for (
int i = 0; i < 3; i++) {
125 if (x0[i] < bound_lo[i]) {
127 candidatePlane[i] = bound_lo[i];
130 else if (x0[i] > bound_hi[i]) {
132 candidatePlane[i] = bound_hi[i];
141 inside_cryo[i_cryo] =
true;
143 intersects_cryo[i_cryo] =
true;
150 std::array<double, 3> maxT {};
151 for (
int i = 0; i < 3; i++) {
152 if (quadrant[i] != 2 &&
abs(dx[i]) > eps) {
153 maxT[i] = (candidatePlane[i] - x0[i]) / dx[i];
163 for (
int i = 1; i < 3; i++) {
164 if (maxT[whichPlane] < maxT[i]) whichPlane = i;
170 if (maxT[whichPlane] < 0.) {
171 intersects_cryo[i_cryo] =
false;
175 for (
int i = 0; i < 3; i++) {
176 if (whichPlane != i) {
177 coord[i] = x0[i] + maxT[whichPlane] * dx[i];
180 coord[i] = candidatePlane[i];
186 intersects_cryo[i_cryo] =
true;
187 for (
int i = 0; i < 3; i++) {
188 if (
coord[i] < bound_lo[i] ||
coord[i] > bound_hi[i]) {
189 intersects_cryo[i_cryo] =
false;
193 if (intersects_cryo[i_cryo]) {
194 distance_to_cryo[i_cryo] = maxT[whichPlane];
204 if (inside_cryo[i_cryo]) {
208 if (intersects_cryo[i_cryo]){
209 double ptime = (distance_to_cryo[i_cryo] * 1
e-2 ) / (TMath::C()*sqrt(1-pow(part.Mass()/part.E(),2))) ;
210 double totT=part.T()+ptime*1e9 ;
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
std::vector< std::array< double, 6 > > fCryostatBoundaries
boundaries of each cryostat