59 unsigned short minLen = 9999;
60 unsigned short maxLen = 0;
61 unsigned short nPlnsWithHits = 0;
62 unsigned short ipl, aPlane = 3;
63 for(ipl = 0; ipl < 3; ++ipl) {
64 if(trkX[ipl].
size() == 0)
continue;
66 if(trkX[ipl].
size() < minLen) {
67 minLen = trkX[ipl].size();
69 if(trkX[ipl].
size() > maxLen) {
70 maxLen = trkX[ipl].size();
74 if(
prt)
mf::LogVerbatim(
"TTA")<<
"trkX sizes "<<trkX[0].size()<<
" "<<trkX[1].size()<<
" "<<trkX[2].size()<<
" "<<
" nPlnsWithHits "<<nPlnsWithHits;
75 if(nPlnsWithHits < 2)
return;
76 if(aPlane > 2)
return;
86 iht = trkX[aPlane].size() - 1;
87 if(trkX[aPlane][0] > trkX[aPlane][iht]) {
89 for(ipl = 0; ipl < 3; ++ipl) {
90 if(trkX[ipl].
size() == 0)
continue;
101 for(ipl = 0; ipl < 3; ++ipl) {
102 if(trkX[ipl].
size() == 0)
continue;
103 myprt<<
" "<<trkX[ipl][0];
107 for(ipl = 0; ipl < 3; ++ipl) {
108 if(trkX[ipl].
size() == 0)
continue;
109 iht = trkX[ipl].size() - 1;
110 myprt<<
" "<<trkX[ipl][iht];
121 for(
unsigned short ipl = 0; ipl < 3; ++ipl) {
122 if(trkX[ipl].
size() == 0)
continue;
123 if(trkX[ipl][0] <
minX) {
127 iht = trkX[ipl].size() - 1;
128 if(trkX[ipl][iht] >
maxX) {
129 maxX = trkX[ipl][iht];
138 double aveHitXErr = 0;
139 unsigned short nHit = 0;
140 for(ipl = 0; ipl < 3; ++ipl) {
141 for(iht = 0; iht < trkXErr[ipl].size(); ++iht) {
142 aveHitXErr += trkXErr[ipl][iht];
146 aveHitXErr /= (double)nHit;
148 unsigned short npt = (
maxX -
minX) / (1 * aveHitXErr);
150 if(npt > maxLen) npt = maxLen;
152 if(
prt)
mf::LogVerbatim(
"TTA")<<
" aveHitXErr "<<aveHitXErr<<
" number of traj points ";
154 double maxBinX = (
maxX -
minX) / (
double)(npt - 1);
155 double binX = maxBinX;
156 double xOrigin =
minX;
160 std::vector<geo::WireID> hitWID;
161 std::vector<double> hitX;
162 std::vector<double> hitXErr;
166 std::vector<TVector3> STPos;
167 std::vector<TVector3> STDir;
170 if(STPos.size() != 2 || STDir.size() != STPos.size()) {
174 for(ipl = 0; ipl < 3; ++ipl) {
175 if(trkX[ipl].
size() == 0)
continue;
186 for(
unsigned short ii = 0; ii < STPos.size(); ++ii)
mf::LogVerbatim(
"TTA")<<ii<<
" "<<std::fixed<<
std::setprecision(1)<<STPos[ii](0)<<
" "<<STPos[ii](1)<<
" "<<STPos[ii](2);
189 if(maxLen < 4 || npt < 2) {
196 for(ipl = 0; ipl < 3; ++ipl) {
197 if(trkX[ipl].
size() == 0)
continue;
207 std::array<unsigned short, 3> hStart;
208 for(ipl = 0; ipl < 3; ++ipl) hStart[ipl] = 0;
210 bool gotLastPoint =
false;
211 for(
unsigned short ipt = 0; ipt < npt + 1; ++ipt) {
215 for(ipl = 0; ipl < 3; ++ipl) {
216 for(iht = hStart[ipl]; iht < trkX[ipl].size(); ++iht) {
217 if(trkX[ipl][iht] < xOrigin - binX)
continue;
218 if(trkX[ipl][iht] > xOrigin + binX)
break;
219 hitWID.push_back(trkWID[ipl][iht]);
220 hitX.push_back(trkX[ipl][iht]);
221 hitXErr.push_back(trkXErr[ipl][iht]);
225 if(
prt)
mf::LogVerbatim(
"TTA")<<
"ipt "<<ipt<<
" xOrigin "<<xOrigin<<
" binX "<<binX<<
" hitX size "<<hitX.size();
226 if(hitX.size() > 3) {
228 if(
prt)
mf::LogVerbatim(
"TTA")<<
" xyz "<<xyz(0)<<
" "<<xyz(1)<<
" "<<xyz(2)<<
" dir "<<
dir(0)<<
" "<<
dir(1)<<
" "<<
dir(2)<<
" ChiDOF "<<ChiDOF<<
" hitX size "<<hitX.size();
229 }
else if(ipt == 0 && STPos.size() == 2) {
235 if(xOrigin >=
maxX)
break;
237 if(
maxX - xOrigin < binX) {
242 if(ChiDOF < 0 || ChiDOF > 100)
continue;
243 TrajPos.push_back(xyz);
244 TrajDir.push_back(dir);
245 if(ipt == npt) gotLastPoint =
true;
249 for(
unsigned short ii = 0; ii < TrajPos.size(); ++ii)
mf::LogVerbatim(
"TTA")<<ii<<
" "<<std::fixed<<
std::setprecision(1)<<TrajPos[ii](0)<<
" "<<TrajPos[ii](1)<<
" "<<TrajPos[ii](2);
252 if(!gotLastPoint && STPos.size() == 2) {
254 TrajPos.push_back(STPos[1]);
255 TrajDir.push_back(STDir[1]);
258 if(TrajPos.size() < 2) {
267 for(ipl = 0; ipl < 3; ++ipl) {
268 if(trkX[ipl].
size() == 0)
continue;
277 for(
unsigned short ii = 0; ii < TrajPos.size(); ++ii)
mf::LogVerbatim(
"TTA")<<ii<<
" "<<std::fixed<<
std::setprecision(1)<<TrajPos[ii](0)<<
" "<<TrajPos[ii](1)<<
" "<<TrajPos[ii](2);
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
void TrkLineFit(std::vector< geo::WireID > &hitWID, std::vector< double > &hitX, std::vector< double > &hitXErr, double XOrigin, TVector3 &Pos, TVector3 &Dir, float &ChiDOF) const
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
TrackLineFitAlg fTrackLineFitAlg
unsigned short fMaxTrajPoints
Q_EXPORT QTSManip setprecision(int p)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
void ShortTrackTrajectory(std::array< std::vector< geo::WireID >, 3 > trkWID, std::array< std::vector< double >, 3 > trkX, std::array< std::vector< double >, 3 > trkXErr, std::vector< TVector3 > &TrajPos, std::vector< TVector3 > &TrajDir)
static unsigned int reverse(QString &chars, unsigned char *level, unsigned int a, unsigned int b)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.