34 float avededxlast = -5;
36 if(track->
NCell() < nLastCells){
42 std::vector<std::vector<double> > vec_trkRecoHitInfo;
43 std::pair<uint32_t, uint32_t>
pc;
45 std::set<double> planeZBounds;
48 if(boundaryMap.size() < 1)
return avededxlast;
50 for(
unsigned int jcell = 0; jcell < track->
NCell();jcell++){
52 if(btrk->
IsNoise(cellhit))
continue;
53 pc.first = cellhit->
Plane();
54 pc.second = cellhit->
Cell();
59 std::vector<double> rhitInfo(5);
60 rhitInfo[0] = rhit.
X();
61 rhitInfo[1] = rhit.
Y();
62 rhitInfo[2] = rhit.
Z();
63 point = TVector3(rhitInfo[0], rhitInfo[1], rhitInfo[2]);
64 rhitInfo[3] = rhit.
GeV();
67 vec_trkRecoHitInfo.push_back(rhitInfo);
71 std::sort(vec_trkRecoHitInfo.begin(), vec_trkRecoHitInfo.end(),
72 [](
const std::vector<double>&
a,
const std::vector<double>&
b) {
76 float sumEnLast = 0.0;
77 float sumPathLast = 0.0;
78 if (!vec_trkRecoHitInfo.empty()){
79 if (nLastCells < 1 || vec_trkRecoHitInfo.size() < nLastCells){
80 mf::LogWarning(
"TrackInfoFxs") <<
"nLastCells incompatible with reco hit info size";
84 size_t min_index = vec_trkRecoHitInfo.size()-nLastCells;
85 for(
size_t a = min_index;a<vec_trkRecoHitInfo.size();a++) {
86 sumEnLast += (1000.*vec_trkRecoHitInfo[
a][3]);
87 sumPathLast += vec_trkRecoHitInfo[
a][4];
92 avededxlast = (sumEnLast)/(sumPathLast);
99 std::vector<double> &stemp,
double trk_len,
double wanted_dist){
100 float avededxend = -5;
101 if(trk_len < wanted_dist){
108 unsigned int min_index = 10000;
109 for(
unsigned int p = 0;
p< stemp.size();
p++){
110 double distcell_to_end = trk_len-stemp[
p];
111 if(distcell_to_end < 0){
112 mf::LogWarning(
"TrackInfoFxs")<<
"Something is wrong with this track, distance of a cell in the track to the end of the track is negative";
115 if(distcell_to_end < wanted_dist){
121 for(
unsigned int p = min_index;
p < stemp.size();
p++){
123 mf::LogWarning(
"TrackInfoFxs")<<
"Something is wrong with dx... not positive value";
126 acc_dE += 1000. * dEtemp[
p];
129 if(acc_dx>0)avededxend = acc_dE / acc_dx;
back track the reconstruction to the simulation
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
zBoundMap MakeZBoundaryMap(std::set< double > const &planeZBounds, std::vector< TVector3 > const &trajectory)
Return a map of the z position of each trajectory point on a track to the bounding positions of where...
unsigned short Plane() const
bool IsNoise(const art::Ptr< rb::CellHit > &hit) const
Is this hit not associated with any particles?
Calibrated quantities relying on position in the orthogonal view. To generate a rb::CellHit from a rb...
unsigned short Cell() const
rb::RecoHit RecoHit(const art::Ptr< rb::CellHit > &chit) const
Return calibrated hit based on assumed W coordinate.
Collect Geo headers and supply basic geometry functions.
float getAveTrackdEdxEnd(std::vector< double > &dEtemp, std::vector< double > &dxtemp, std::vector< double > &stemp, double trk_len, double wanted_dist)
bool IsCalibrated() const
You MUST check here before accessing PECorr, MIP or GeV.
float getAveTrackdEdxLastCells(const art::Ptr< rb::Track > track, unsigned int nLastCells)
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::vector< TVector3 > const & Trajectory() const
return a constant reference to the track trajectory points
void FindZBoundaries(std::set< double > &planeZBounds)
Find the boundaries in the z direction of planes in the detector.
Encapsulate the geometry of one entire detector (near, far, ndos)
float PathLengthInCell(zBoundMap const &zBounds, TVector3 const &recoHitLoc, std::pair< uint32_t, uint32_t > const &pc)
Return the path length of a track in the cell in question.