10#include "FairLogger.h"
22 fvtx.push_back(vecpos);
23 fvtxT.push_back(time);
24 fpvec.push_back(vecp);
29 minLength = std::clamp(minLength, 0.,
flength);
30 double weightedDensity = 0.;
32 for (
unsigned i = 0; i <
fendLength.size(); ++i) {
34 std::max(0.,
fendLength[i] - std::max(previous, minLength));
38 return weightedDensity;
44 length = std::clamp(length, 0.,
flength);
49 const double previous = idx == 0 ? 0. :
fendLength[idx - 1];
50 const double step =
fendLength[idx] - previous;
51 return step > 0. ?
fstart[idx].Z() + (length - previous) / step *
60 const double z =
GetZ(aZ, idx);
61 const double previous = idx == 0 ? 0. :
fendLength[idx - 1];
63 return previous + (dz > 0. ? std::clamp((z -
fstart[idx].Z()) / dz, 0., 1.) *
80 double prevz =
fendZ[0];
81 for (
unsigned iz(1); iz < nSlices; ++iz) {
82 double extraz = aZ - prevz;
86 return fstart[iz].Z() + extraz;
96 const std::string& aMat)
const {
98 std::string label =
"REST";
99 if (aVol.find(
"Magn") != aVol.npos)
101 else if (aVol.find(
"Upstream") != aVol.npos)
104 else if (aVol.find(
"HeBalloon") != aVol.npos)
106 else if (aMat.find(
"helium") != aMat.npos)
108 else if (aMat.find(
"air") != aMat.npos)
110 else if (aVol.find(
"straw") != aVol.npos)
112 else if (aVol.find(
"gas") != aVol.npos && aMat.find(
"STT") != aMat.npos)
114 else if (aVol.find(
"wire") != aVol.npos && aMat.find(
"tungsten") != aMat.npos)
116 else if ((aVol.find(
"Tr1_frame") != aVol.npos ||
117 aVol.find(
"Tr2_frame") != aVol.npos ||
118 aVol.find(
"Tr3_frame") != aVol.npos ||
119 aVol.find(
"Tr4_frame") != aVol.npos))
121 else if ((aVol.find(
"Veto") != aVol.npos ||
122 aVol.find(
"vLongitRib") != aVol.npos))
124 else if (aVol.find(
"LiSc") != aVol.npos)
126 LOG(
debug) << aVol <<
" " << aMat <<
" assigned to " << label <<
".";
133 std::ostringstream ldebug;
139 ldebug <<
"z-slices n=0" << std::endl;
140 LOG(
debug) << ldebug.str();
144 ldebug <<
" zIn=" <<
fstart[0].Z() <<
" zOut=" <<
fendZ[nSlices - 1]
146 ldebug <<
"z-slices n=" << nSlices <<
": " << std::endl;
147 for (
unsigned iz(0); iz < nSlices; ++iz) {
149 <<
" slice [" <<
fstart[iz].Z() <<
"-" <<
fendZ[iz] <<
"] "
153 LOG(
debug) << ldebug.str();
159 LOG(error) <<
" -- incorrect number of elements in path: "
std::string GetLabel() const
std::vector< TVector3 > fpvec
double GetWeightedDensity() const
std::vector< double > fsliceDensity
std::vector< std::string > fvolName
unsigned GetNSlices() const
std::vector< std::string > fmaterial
void SetVertexInfo(const TVector3 &vecpos, const TVector3 &vecp, const double &time)
std::vector< TVector3 > fvtx
std::vector< double > fvtxT
double GetZ(const double &aZ, unsigned &idx) const
std::vector< double > fendLength
std::vector< TVector3 > fstart
std::vector< double > fstartT
double GetLengthAtZ(const double &aZ) const
double GetZAtLength(double length, unsigned &idx) const
std::vector< double > fendZ
bool Add(const MuonPath &aEle)