19 :fCaloAlg(pset.get<
fhicl::ParameterSet>(
"CaloAlg")), fMVAReader(
"Silent")
33 bool badinput =
false;
40 if(pset.
has_key(
"Mode")) userMode = pset.
get<
short >(
"Mode");
44 std::cout<<
"StudyMode is not valid anymore. Try Study: 1 or Study: 2, etc/n";
47 userMode = pset.
get<
short >(
"Study");
56 std::vector<std::string> skipAlgsVec;
57 if(pset.
has_key(
"SkipAlgs")) skipAlgsVec = pset.
get<std::vector<std::string>>(
"SkipAlgs");
58 std::vector<std::string> debugConfigVec;
59 if(pset.
has_key(
"DebugConfig")) debugConfigVec = pset.
get<std::vector<std::string>>(
"DebugConfig");
60 std::vector<std::string> specialAlgsVec;
61 if(pset.
has_key(
"SpecialAlgs")) specialAlgsVec = pset.
get<std::vector<std::string>>(
"SpecialAlgs");
65 std::vector<float> aveHitRMS;
66 if(pset.
has_key(
"AveHitRMS")) aveHitRMS = pset.
get<std::vector<float>>(
"AveHitRMS");
68 if(!aveHitRMS.empty()) {
75 tcc.
minPts = pset.
get< std::vector<unsigned short >>(
"MinPts");
79 tcc.
chargeCuts = pset.
get< std::vector<float >>(
"ChargeCuts", {3, 0.15, 0.25});
81 tcc.
kinkCuts = pset.
get< std::vector<float >>(
"KinkCuts", {0.4, 1.5, 4});
89 tcc.
muonTag = pset.
get< std::vector<short>>(
"MuonTag", {-1, -1, -1, - 1});
91 tcc.
showerTag = pset.
get< std::vector<float>>(
"ShowerTag", {-1, -1, -1, -1, -1, -1});
92 std::string fMVAShowerParentWeights =
"NA";
93 pset.
get_if_present<std::string>(
"MVAShowerParentWeights", fMVAShowerParentWeights);
95 tcc.
matchTruth = pset.
get< std::vector<float> >(
"MatchTruth", {-1, -1, -1, -1});
96 tcc.
vtx2DCuts = pset.
get< std::vector<float >>(
"Vertex2DCuts", {-1, -1, -1, -1, -1, -1, -1});
97 tcc.
vtx3DCuts = pset.
get< std::vector<float >>(
"Vertex3DCuts", {-1, -1});
99 tcc.
match3DCuts = pset.
get< std::vector<float >>(
"Match3DCuts", {-1, -1, -1, -1, -1});
109 if(badinput)
throw art::Exception(
art::errors::Configuration)<<
"Bad input from fcl file. Vector lengths for MinPtsFit, MaxAngleRange and MinMCSMom should be defined for each reconstruction pass";
111 if(
tcc.
vtx2DCuts.size() < 10)
throw art::Exception(
art::errors::Configuration)<<
"Vertex2DCuts must be size 11\n 0 = Max length definition for short TJs\n 1 = Max vtx-TJ sep short TJs\n 2 = Max vtx-TJ sep long TJs\n 3 = Max position pull for >2 TJs\n 4 = Max vtx position error\n 5 = Min MCSMom for one of two TJs\n 6 = Min fraction of wires hit btw vtx and Tjs\n 7 = Min Score\n 8 = min ChgFrac at a vtx or merge point\n 9 = max MCSMom asymmetry, 10 = require chg on wires btw vtx and tjs in induction planes?";
126 std::cout<<
"ShowerTag must be size 13\n 0 = Mode\n 1 = max MCSMom\n 2 = max separation (WSE units)\n 3 = Max angle diff\n 4 = Factor * rms width\n 5 = Min half width\n 6 = min total Tps\n 7 = Min Tjs\n 8 = max parent FOM\n 9 = max direction FOM 10 = max AspectRatio\n 11 = min Score to preserve a vertex\n 12 = Debug showers in CTP\n";
127 std::cout<<
" Fixing this problem...";
135 std::cout<<
">>>>>>>> Match3DCuts has been expanded to size 7. Please update your fcl file\n";
138 if(oldsize < 5) std::cout<<
" Setting Match3DCuts[4] = 2000 combinations\n";
139 if(oldsize < 6) std::cout<<
" Setting Match3DCuts[5] = 1, which disables charge asymmetry checking\n";
149 mf::LogVerbatim(
"TC")<<
"Last element of AngleRange != 90 degrees. Fixing it\n";
168 for(
auto strng : debugConfigVec) {
172 for(
unsigned short ib = 0; ib <
AlgBitNames.size(); ++ib) {
205 bool printHelp =
false;
214 for(
auto strng : skipAlgsVec) {
222 for(
unsigned short ib = 0; ib <
AlgBitNames.size(); ++ib) {
230 std::cout<<
"******* Unknown SkipAlgs input string '"<<strng<<
"'\n";
235 std::cout<<
"Valid AlgNames:";
236 for(
auto strng :
AlgBitNames) std::cout<<
" "<<strng;
238 std::cout<<
"Or specify All to turn all algs off\n";
242 for(
auto strng : specialAlgsVec) {
244 for(
unsigned short ib = 0; ib <
AlgBitNames.size(); ++ib) {
252 std::cout<<
"******* Unknown SpecialAlgs input string '"<<strng<<
"'\n";
257 std::cout<<
"Valid AlgNames:";
258 for(
auto strng :
AlgBitNames) std::cout<<
" "<<strng;
260 std::cout<<
"Or specify All to turn all algs off\n";
268 std::cout<<
"Debug mode: using algs:";
269 for(
unsigned short ib = 0; ib <
AlgBitNames.size(); ++ib) {
270 if(ib % 15 == 0) std::cout<<
"\n";
274 std::cout<<
"Skipping algs:";
278 std::cout<<
"Debugging in all slices\n";
280 std::cout<<
"Debug sub-slice index "<<
debug.
Slice<<
"\n";
297 tcc.
detprop = lar::providerFrom<detinfo::DetectorPropertiesService>();
298 tcc.
geom = lar::providerFrom<geo::Geometry>();
317 if(hitsInSlice.size() < 2)
return;
323 std::cout<<
"CreateSlice failed\n";
332 if(
tcc.
recoSlice) std::cout<<
"Reconstruct "<<hitsInSlice.size()<<
" hits in Slice "<<sliceID<<
" in TPC "<<slc.TPCID.TPC<<
"\n";
333 for(
unsigned short plane = 0; plane < slc.nPlanes; ++plane) {
334 CTP_t inCTP =
EncodeCTP(slc.TPCID.Cryostat, slc.TPCID.TPC, plane);
336 if(!slc.isValid)
return;
349 for(
unsigned short plane = 0; plane < slc.nPlanes; ++plane) {
350 CTP_t inCTP =
EncodeCTP(slc.TPCID.Cryostat, slc.TPCID.TPC, plane);
352 std::cout<<
"RTC: ChkVtxAssociations found an error\n";
376 std::cout <<
"SHOWER TREE STAGE NUM SIZE: " <<
stv.
StageNum.size() << std::endl;
404 for(
auto& tj : slc.tjs) {
409 slc.mallTraj.clear();
410 slc.matchVec.clear();
422 if(nwires > slc.
nWires[plane])
return;
428 for(
unsigned short pass = 0; pass <
tcc.
minPtsFit.size(); ++pass) {
429 for(
unsigned int ii = 0; ii < nwires; ++ii) {
431 unsigned int iwire = 0;
432 unsigned int jwire = 0;
439 iwire = slc.
lastWire[plane] - ii - 1;
442 if(iwire > slc.
wireHitRange[plane].size() - 1)
continue;
443 if(jwire > slc.
wireHitRange[plane].size() - 1)
continue;
447 unsigned int ifirsthit = (
unsigned int)slc.
wireHitRange[plane][iwire].first;
448 unsigned int ilasthit = (
unsigned int)slc.
wireHitRange[plane][iwire].second;
449 unsigned int jfirsthit = (
unsigned int)slc.
wireHitRange[plane][jwire].first;
450 unsigned int jlasthit = (
unsigned int)slc.
wireHitRange[plane][jwire].second;
451 for(
unsigned int iht = ifirsthit; iht < ilasthit; ++iht) {
457 if(slc.
slHits[iht].InTraj != 0)
continue;
462 unsigned int fromWire = iHit.WireID().Wire;
463 float fromTick = iHit.PeakTime();
464 float iqtot = iHit.Integral();
465 float hitsRMSTick = iHit.RMS();
466 std::vector<unsigned int> iHitsInMultiplet;
469 iHitsInMultiplet.resize(1);
470 iHitsInMultiplet[0] = iht;
474 if(iHitsInMultiplet.size() > 4)
continue;
476 if(iHitsInMultiplet.size() > 1) {
480 if(hitsRMSTick == 0)
continue;
481 bool fatIHit = (hitsRMSTick > maxHitsRMS);
482 if(
tcc.
dbgStp)
mf::LogVerbatim(
"TC")<<
" hit RMS "<<iHit.RMS()<<
" BB Multiplicity "<<iHitsInMultiplet.size()<<
" AveHitRMS["<<plane<<
"] "<<
evt.
aveHitRMS[plane]<<
" HitsRMSTick "<<hitsRMSTick<<
" fatIHit "<<fatIHit;
483 for(
unsigned int jht = jfirsthit; jht < jlasthit; ++jht) {
485 if(slc.
slHits[iht].InTraj != 0)
break;
486 if(slc.
slHits[jht].InTraj != 0)
continue;
488 for(
auto& slHit : slc.
slHits) {
489 if(slHit.InTraj < 0) {
494 unsigned int toWire = jwire;
497 float toTick = jHit.PeakTime();
498 float jqtot = jHit.Integral();
499 std::vector<unsigned int> jHitsInMultiplet;
502 jHitsInMultiplet.resize(1);
503 jHitsInMultiplet[0] = jht;
507 if(jHitsInMultiplet.size() > 4)
continue;
510 if(hitsRMSTick == 0)
continue;
511 bool fatJHit = (hitsRMSTick > maxHitsRMS);
514 if((fatIHit && !fatJHit) || (!fatIHit && fatJHit)) {
521 bool hitsOK =
TrajHitsOK(slc, iHitsInMultiplet, jHitsInMultiplet);
523 if(!hitsOK)
continue;
526 if(!
StartTraj(slc, work, fromWire, fromTick, toWire, toTick, inCTP, pass))
continue;
529 if(work.
Pts.empty()) {
548 if(!sigOK || work.
Pts[0].Chg == 0) {
554 work.
Pts[0].Pos = work.
Pts[0].HitPos;
590 auto& tj = slc.
tjs[slc.
tjs.size() - 1];
609 for(
auto tp :
seeds) {
610 unsigned short nAvailable = 0;
611 for(
unsigned short ii = 0; ii < tp.Hits.size(); ++ii) {
612 if(!tp.UseHit[ii])
continue;
613 unsigned int iht = tp.Hits[ii];
614 if(slc.
slHits[iht].InTraj == 0) ++nAvailable;
620 if(nAvailable == 0)
continue;
624 for(
unsigned short ii = 0; ii < tp.Hits.size(); ++ii) {
625 if(!tp.UseHit[ii])
continue;
626 unsigned int iht = tp.Hits[ii];
631 if(tp.Dir[0] < 0) work.
StepDir = -1;
638 work.
Pts.push_back(tp);
656 auto& tj = slc.
tjs[slc.
tjs.size() - 1];
690 for(
auto& tj : slc.
tjs) {
691 if(tj.AlgMod[
kKilled])
continue;
692 if(tj.PDGCode != 13)
continue;
708 for(
unsigned short ivx = 0; ivx < slc.
vtxs.size(); ++ivx) {
709 auto& vx2 = slc.
vtxs[ivx];
710 if(vx2.ID == 0)
continue;
711 if(vx2.CTP != inCTP)
continue;
737 for(
auto& slHit : slc.
slHits) {
738 if(slHit.InTraj < 0) {
739 std::cout<<
"FJT: dirty hit "<<
PrintHit(slHit)<<
"\n";
744 std::vector<unsigned int> tHits;
746 for(
unsigned int iwire = slc.
firstWire[plane]; iwire < slc.
lastWire[plane] - 3; ++iwire) {
749 unsigned int jwire = iwire + 1;
751 unsigned int ifirsthit = (
unsigned int)slc.
wireHitRange[plane][iwire].first;
752 unsigned int ilasthit = (
unsigned int)slc.
wireHitRange[plane][iwire].second;
753 unsigned int jfirsthit = (
unsigned int)slc.
wireHitRange[plane][jwire].first;
754 unsigned int jlasthit = (
unsigned int)slc.
wireHitRange[plane][jwire].second;
755 for(
unsigned int iht = ifirsthit; iht < ilasthit; ++iht) {
757 auto& islHit = slc.
slHits[iht];
758 if(islHit.InTraj != 0)
continue;
761 mf::LogVerbatim(
"TC")<<
"FindJunkTraj: Found debug hit "<<
PrintHit(islHit)<<
" iht "<<iht<<
" jfirsthit "<<jfirsthit<<
" jlasthit "<<jlasthit;
763 std::vector<unsigned int> iHits;
765 for(
unsigned int jht = jfirsthit; jht < jlasthit; ++jht) {
766 auto& jslHit = slc.
slHits[jht];
767 if(jslHit.InTraj != 0)
continue;
770 std::vector<unsigned int> jHits;
776 for(
auto iht : iHits)
if(slc.
slHits[iht].InTraj == 0) tHits.push_back(iht);
777 for(
auto jht : jHits)
if(slc.
slHits[jht].InTraj == 0) tHits.push_back(jht);
778 for(
auto tht : tHits) slc.
slHits[tht].InTraj = -4;
780 if(iwire != 0) { loWire = iwire - 1; }
else { loWire = 0; }
781 unsigned int hiWire = jwire + 1;
782 if(hiWire > slc.
nWires[plane])
break;
784 unsigned short nit = 0;
786 bool hitsAdded =
false;
787 for(
unsigned int kwire = loWire; kwire <= hiWire; ++kwire) {
789 unsigned int kfirsthit = (
unsigned int)slc.
wireHitRange[plane][kwire].first;
790 unsigned int klasthit = (
unsigned int)slc.
wireHitRange[plane][kwire].second;
791 for(
unsigned int kht = kfirsthit; kht < klasthit; ++kht) {
792 if(slc.
slHits[kht].InTraj != 0)
continue;
794 if(std::find(tHits.begin(), tHits.end(), kht) != tHits.end())
continue;
799 for(
auto jht : jHits) {
800 if(slc.
slHits[jht].InTraj != 0)
continue;
801 tHits.push_back(jht);
802 slc.
slHits[jht].InTraj = -4;
803 if(kwire > hiWire) hiWire = kwire;
804 if(kwire < loWire) loWire = kwire;
809 if(!hitsAdded)
break;
812 if(hiWire >= slc.
nWires[plane])
break;
815 for(
auto iht : tHits) slc.
slHits[iht].InTraj = 0;
828 if(slc.
slHits[jht].InTraj > 0)
break;
886 unsigned short itj = 0;
887 std::vector<unsigned int> tHits;
888 std::vector<unsigned int> atHits;
889 for(
auto& tj : slc.
tjs) {
891 if(tj.AlgMod[
kKilled])
continue;
893 for(
auto& tp : tj.Pts) {
894 if(tp.Hits.size() > 16) {
896 mf::LogWarning(
"TC")<<
"ChkInTraj: More than 16 hits created a UseHit bitset overflow\n";
902 std::cout<<someText<<
" ChkInTraj hit size mis-match in tj ID "<<tj.ID<<
" AlgBitNames";
903 for(
unsigned short ib = 0; ib <
AlgBitNames.size(); ++ib)
if(tj.AlgMod[ib]) std::cout<<
" "<<
AlgBitNames[ib];
908 if(tHits.size() < 2) {
909 mf::LogVerbatim(
"TC")<<someText<<
" ChkInTraj: Insufficient hits in traj "<<tj.ID;
914 std::sort(tHits.begin(), tHits.end());
916 for(iht = 0; iht < slc.
slHits.size(); ++iht) {
917 if(slc.
slHits[iht].InTraj == tID) atHits.push_back(iht);
919 if(atHits.size() < 2) {
920 mf::LogVerbatim(
"TC")<<someText<<
" ChkInTraj: Insufficient hits in atHits in traj "<<tj.ID<<
" Killing it";
924 if(!std::equal(tHits.begin(), tHits.end(), atHits.begin())) {
926 myprt<<someText<<
" ChkInTraj failed: inTraj - UseHit mis-match for tj ID "<<tID<<
" tj.WorkID "<<tj.WorkID<<
" atHits size "<<atHits.size()<<
" tHits size "<<tHits.size()<<
" in CTP "<<tj.CTP<<
"\n";
930 myprt<<
"index inTraj UseHit \n";
931 for(iht = 0; iht < atHits.size(); ++iht) {
933 if(iht < tHits.size()) myprt<<
" "<<
PrintHit(slc.
slHits[tHits[iht]]);
934 if(atHits[iht] != tHits[iht]) myprt<<
" <<< "<<atHits[iht]<<
" != "<<tHits[iht];
938 if(tHits.size() > atHits.size()) {
939 for(iht = atHits.size(); iht < atHits.size(); ++iht) {
940 myprt<<
"atHits "<<iht<<
" "<<
PrintHit(slc.
slHits[atHits[iht]])<<
"\n";
946 for(
unsigned short end = 0;
end < 2; ++
end) {
947 if(tj.VtxID[
end] > slc.
vtxs.size()) {
949 std::cout<<someText<<
" ChkInTraj: Bad VtxID "<<tj.ID<<
" vtx size "<<slc.
vtxs.size()<<
"\n";
972 for(
unsigned short iv3 = 0; iv3 < slc.
vtx3s.size(); ++iv3) {
975 if(vx3.
ID == 0)
continue;
977 if(vx3.
Wire < 0)
continue;
978 unsigned short mPlane = USHRT_MAX;
979 unsigned short ntj_1stPlane = USHRT_MAX;
980 unsigned short ntj_2ndPlane = USHRT_MAX;
981 for(
unsigned short plane = 0; plane < slc.
nPlanes; ++plane) {
982 if(vx3.
Vx2ID[plane] > 0) {
983 auto& vx2 = slc.
vtxs[vx3.
Vx2ID[plane] - 1];
984 if(ntj_1stPlane == USHRT_MAX) {
985 ntj_1stPlane = vx2.NTraj;
987 ntj_2ndPlane = vx2.NTraj;
993 if(mPlane == USHRT_MAX)
continue;
1000 std::vector<int> tjIDs;
1001 std::vector<unsigned short> tj2Pts;
1002 for(
unsigned short itj = 0; itj < slc.
tjs.size(); ++itj) {
1003 auto& tj = slc.
tjs[itj];
1004 if(tj.CTP != mCTP)
continue;
1006 if(tj.Pts.size() < 6)
continue;
1008 float doca = maxdoca;
1010 unsigned short closePt = 0;
1012 if(closePt > tj.EndPt[1])
continue;
1013 if(prt)
mf::LogVerbatim(
"TC")<<
"MisdVxTj: 3V"<<vx3.
ID<<
" candidate T"<<slc.
tjs[itj].ID<<
" closePT "<<closePt<<
" doca "<<doca;
1014 tjIDs.push_back(tj.ID);
1015 tj2Pts.push_back(closePt);
1019 if(tjIDs.empty())
continue;
1020 if(prt)
mf::LogVerbatim(
"TC")<<
" 3V"<<vx3.
ID<<
" mPlane "<<mPlane<<
" ntj_1stPlane "<<ntj_1stPlane<<
" ntj_2ndPlane "<<ntj_2ndPlane;
1026 std::vector<unsigned int>& newHitAssns)
1031 if(tpHits.empty())
return;
1034 if(tpHits.size() == 1) {
1036 std::cout<<
"MergeTPHits Bad input hit index "<<tpHits[0]<<
" allHits size "<<(*
evt.
allHits).size()<<
"\n";
1040 newHitAssns[tpHits[0]] = newHitCol.size() - 1;
1045 std::vector<unsigned int> wires;
1046 std::vector<std::vector<unsigned int>> wireHits;
1048 wires.push_back(firstHit.WireID().Wire);
1049 std::vector<unsigned int>
tmp(1, tpHits[0]);
1050 wireHits.push_back(tmp);
1051 for(
unsigned short ii = 1; ii < tpHits.size(); ++ii) {
1053 unsigned int wire =
hit.WireID().Wire;
1054 unsigned short indx = 0;
1055 for(indx = 0; indx < wires.size(); ++indx)
if(wires[indx] == wire)
break;
1056 if(indx == wires.size()) {
1057 wires.push_back(wire);
1058 wireHits.resize(wireHits.size() + 1);
1060 wireHits[indx].push_back(tpHits[ii]);
1064 for(
unsigned short indx = 0; indx < wireHits.size(); ++indx) {
1065 auto& hitsOnWire = wireHits[indx];
1066 if(hitsOnWire.empty()) {
1067 std::cout<<
"coding error\n";
1071 for(
unsigned short ii = 0; ii < hitsOnWire.size(); ++ii) {
1072 newHitAssns[hitsOnWire[ii]] = newHitCol.size() - 1;
1088 if(tpHits.size() == 1) {
1090 std::cout<<
"MergeTPHits Bad input hit index "<<tpHits[0]<<
" allHits size "<<(*
evt.
allHits).size()<<
"\n";
1099 oldHit.PeakTime(), oldHit.SigmaPeakTime(),
1101 oldHit.PeakAmplitude(), oldHit.SigmaPeakAmplitude(),
1102 oldHit.SummedADC(), oldHit.Integral(), oldHit.SigmaIntegral(),
1106 oldHit.SignalType(),
1111 double integral = 0;
1112 double sIntegral = 0;
1113 double peakTime = 0;
1114 double sPeakTime = 0;
1116 double sPeakAmp = 0;
1120 for(
auto allHitsIndex : tpHits) {
1123 if(
hit.StartTick() < startTick) startTick =
hit.StartTick();
1124 if(
hit.EndTick() > endTick) endTick =
hit.EndTick();
1125 double intgrl =
hit.Integral();
1126 sPeakTime += intgrl *
hit.SigmaPeakTime();
1127 sPeakAmp += intgrl *
hit.SigmaPeakAmplitude();
1128 sumADC +=
hit.SummedADC();
1130 sIntegral += intgrl *
hit.SigmaIntegral();
1134 std::cout<<
"MergeTPHits found bad hit integral "<<integral<<
"\n";
1139 std::vector<double> shape(endTick - startTick + 1, 0.);
1140 for(
auto allHitsIndex : tpHits) {
1142 double peakTick =
hit.PeakTime();
1143 double rms =
hit.RMS();
1144 double peakAmp =
hit.PeakAmplitude();
1146 double arg = ((double)tick - peakTick) / rms;
1147 unsigned short indx = tick - startTick;
1148 shape[indx] += peakAmp * exp(-0.5 * arg * arg);
1156 unsigned short indx = tick - startTick;
1157 sigsum += shape[indx];
1158 sigsumt += shape[indx] * tick;
1161 peakTime = sigsumt / sigsum;
1163 sPeakTime /= integral;
1168 double dTick = tick - peakTime;
1169 unsigned short indx = tick - startTick;
1170 sigsumt += shape[indx] * dTick * dTick;
1172 double rms = std::sqrt(sigsumt / sigsum);
1175 double chgNorm = 2.507 * firstHit.PeakAmplitude() * firstHit.RMS() / firstHit.Integral();
1177 peakAmp = (float)(integral * chgNorm / (2.507 * rms));
1179 sPeakAmp /= integral;
1181 startTick = peakTime - 3 * rms;
1182 endTick = peakTime + 3 * rms;
1187 peakTime, sPeakTime,
1190 sumADC, integral, sIntegral,
1194 firstHit.SignalType(),
1258 if(hitsInSlice.size() < 2)
return false;
1261 slc.
slHits.resize(hitsInSlice.size());
1263 unsigned int cstat = 0;
1264 unsigned int tpc = 0;
1265 unsigned int cnt = 0;
1266 for(
auto iht : hitsInSlice) {
1267 if(iht > (*
evt.
allHits).size() - 1)
return false;
1270 cstat =
hit.WireID().Cryostat;
1271 tpc =
hit.WireID().TPC;
1275 if(
hit.WireID().Cryostat != cstat ||
hit.WireID().TPC != tpc)
return false;
1276 slc.
slHits[cnt].allHitsIndex = iht;
1285 if(
tcc.
dbgSlc) std::cout<<
"Enabled debugging in sub-slice "<<
slices.size() - 1<<
"\n";
1300 for(
auto& slc :
slices) {
1301 if(!slc.isValid)
continue;
1302 for(
auto& pfp : slc.pfps) {
1303 if(pfp.ID <= 0)
continue;
1304 pfp.TjUIDs.resize(pfp.TjIDs.size());
1305 for(
unsigned short ii = 0; ii < pfp.TjIDs.size(); ++ii) {
1307 if(pfp.TjIDs[ii] <=0 || pfp.TjIDs[ii] > (
int)slc.tjs.size()) {
1308 std::cout<<
"FinishEvent found an invalid T"<<pfp.TjIDs[ii]<<
" in P"<<pfp.UID<<
"\n";
1309 slc.isValid =
false;
1312 auto& tj = slc.tjs[pfp.TjIDs[ii] - 1];
1313 pfp.TjUIDs[ii] = tj.UID;
Expect tracks entering from the front face. Don't create neutrino PFParticles.
calo::CalorimetryAlg * caloAlg
void PrintTrajectory(std::string someText, TCSlice &slc, const Trajectory &tj, unsigned short tPoint)
void ClearResults()
Deletes all the results.
don't mess with this line
void CheckTrajBeginChg(TCSlice &slc, unsigned short itj)
float AveChg
Calculated using ALL hits.
void ReleaseHits(TCSlice &slc, Trajectory &tj)
std::vector< int > EnvStage
float HitsRMSTick(TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, HitStatus_t hitRequest)
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
std::vector< int > IsShowerParent
std::vector< Trajectory > tjs
vector of all trajectories in each plane
std::vector< Vtx3Store > vtx3s
3D vertices
void StepAway(TCSlice &slc, Trajectory &tj)
void VtxHitsSwap(TCSlice &slc, const CTP_t inCTP)
void ConfigureMVA(TCConfig &tcc, std::string fMVAShowerParentWeights)
bool TrajHitsOK(TCSlice &slc, const std::vector< unsigned int > &iHitsInMultiplet, const std::vector< unsigned int > &jHitsInMultiplet)
std::vector< float > kinkCuts
kink angle, nPts fit, (alternate) kink angle significance
bool IsGhost(TCSlice &slc, Trajectory &tj)
bool InTrajOK(TCSlice &slc, std::string someText)
recob::Hit MergeTPHitsOnWire(std::vector< unsigned int > &tpHits)
Deletes all the results.
std::vector< float > EndWir
std::vector< float > EndAng
void TrajPointTrajDOCA(TCSlice &slc, TrajPoint const &tp, Trajectory const &tj, unsigned short &closePt, float &minSep)
const std::vector< std::string > AlgBitNames
std::vector< unsigned short > minPtsFit
Reconstruct in several passes.
std::vector< float > vtx3DCuts
2D vtx -> 3D vtx matching cuts
std::vector< float > qualityCuts
Min points/wire, min consecutive pts after a gap.
void ReconstructAllTraj(TCSlice &slc, CTP_t inCTP)
Deletes all the results.
std::vector< float > BeginTim
void AddHits(TCSlice &slc, Trajectory &tj, unsigned short ipt, bool &sigOK)
std::vector< unsigned int > PutTrajHitsInVector(Trajectory const &tj, HitStatus_t hitRequest)
std::vector< float > BeginAng
void SplitTrajCrossingVertices(TCSlice &slc, CTP_t inCTP)
int ParentID
ID of the parent, or the ID of the Tj this one was merged with if it is killed.
step from US -> DS (true) or DS -> US (false)
void FindMissedVxTjs(TCSlice &slc)
Deletes all the results.
bool StoreTraj(TCSlice &slc, Trajectory &tj)
calo::CalorimetryAlg fCaloAlg
Deletes all the results.
float maxWireSkipWithSignal
max number of wires to skip with a signal on them
call study functions to develop cuts, etc
CryostatID_t Cryostat
Index of cryostat.
void GetHitMultiplet(TCSlice &slc, unsigned int theHit, std::vector< unsigned int > &hitsInMultiplet)
void MergeTPHits(std::vector< unsigned int > &tpHits, std::vector< recob::Hit > &newHitCol, std::vector< unsigned int > &newHitAssns)
Deletes all the results.
bool AttachAnyTrajToVertex(TCSlice &slc, unsigned short ivx, bool prt)
bool SetInputHits(std::vector< recob::Hit > const &inputHits)
Deletes all the results.
bool MakeJunkTraj(TCSlice &slc, std::vector< unsigned int > tHits)
std::vector< float > electronTag
void TagDeltaRays(TCSlice &slc, const CTP_t &inCTP)
bool dbgSlc
debug only in the user-defined slice? default is all slices
bool StartTraj(TCSlice &slc, Trajectory &tj, unsigned int fromhit, unsigned int tohit, unsigned short pass)
std::vector< float > matchTruth
Match to MC truth.
std::vector< unsigned int > lastWire
the last wire with a hit
bool LongPulseHit(const recob::Hit &hit)
unsigned int eventsProcessed
bool IsGood
set false if there is a failure or the Tj fails quality cuts
bool doForecast
See TCMode_t above.
std::vector< float > angleRanges
list of max angles for each angle range
virtual double ConvertXToTicks(double X, int p, int t, int c) const =0
std::vector< float > showerTag
[min MCSMom, max separation, min # Tj < separation] for a shower tag
unsigned short Pass
the pass on which it was created
bool dbg3V
debug 3D vertex finding
int TDCtick_t
Type representing a TDC tick.
void UpdateVxEnvironment(std::string inFcnLabel, TCSlice &slc, VtxStore &vx2, bool prt)
float HitsPosTick(TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, float &sum, HitStatus_t hitRequest)
std::vector< float > EndTim
std::vector< int > ShowerID
std::vector< std::vector< std::pair< int, int > > > wireHitRange
std::vector< unsigned short > maxAngleCode
max allowed angle code for each pass
void DefineShTree(TTree *t)
Deletes all the results.
std::vector< unsigned int > fAlgModCount
Deletes all the results.
float projectionErrFactor
unsigned int Hit
set to the hit index in evt.allHits if a Plane:Wire:Tick match is found
bool CreateSlice(std::vector< unsigned int > &hitsInSlice)
Deletes all the results.
std::vector< std::string > StageName
int Cryostat
Select Cryostat.
struct of temporary 3D vertices
short nPtsAve
dump trajectory points
void PFPVertexCheck(TCSlice &slc)
bool dbgStp
debug stepping using debug.Cryostat, debug.TPC, etc
std::vector< float > testBeamCuts
float unitsPerTick
scale factor from Tick to WSE equivalent units
const detinfo::DetectorProperties * detprop
std::vector< short > minMCSMom
Min MCSMom for each pass.
int WorkID
Select the StartWorkID for debugging.
std::vector< short > BeginVtx
CTP_t CTP
Cryostat, TPC, Plane code.
bool dbg2V
debug 2D vertex finding
const std::vector< std::string > StopFlagNames
std::vector< float > aveHitRMS
average RMS of an isolated hit
void TagShowerLike(std::string inFcnLabel, TCSlice &slc, const CTP_t &inCTP)
std::vector< TrajPoint > Pts
Trajectory points.
TMVA::Reader * showerParentReader
bool ChkVtxAssociations(TCSlice &slc, const CTP_t &inCTP)
T get(std::string const &key) const
std::vector< float > neutralVxCuts
void MakeHaloTj(TCSlice &slc, Trajectory &muTj, bool prt)
std::vector< short > EndVtx
std::array< unsigned short, 2 > EndPt
First and last point in the trajectory that has charge.
virtual void reconfigure(fhicl::ParameterSet const &pset)
Deletes all the results.
std::vector< float > match3DCuts
3D matching cuts
void ScoreVertices(TCSlice &slc)
void ChkHiChgHits(TCSlice &slc, CTP_t inCTP)
bool get_if_present(std::string const &key, T &value) const
std::string PrintHit(const TCHit &tch)
std::vector< float > Envelope
call study functions to develop cuts, etc
const geo::GeometryCore * geom
TMVA::Reader fMVAReader
Deletes all the results.
std::vector< unsigned short > minPts
min number of Pts required to make a trajectory
bool has_key(std::string const &key) const
The data type to uniquely identify a TPC.
PlaneID_t Plane
Index of the plane within its TPC.
void DefineTjParents(TCSlice &slc, bool prt)
std::vector< unsigned int > firstWire
the first wire with a hit
std::vector< float > BeginChg
int ID
ID that is local to one slice.
std::vector< TCSlice > slices
Detector simulation of raw signals on wires.
unsigned short NumPtsWithCharge(TCSlice &slc, const Trajectory &tj, bool includeDeadWires)
std::bitset< 16 > modes
number of points to find AveChg
std::vector< TCHit > slHits
void FindPFParticles(TCSlice &slc)
void FinishEvent()
Deletes all the results.
std::vector< float > chargeCuts
bool aveHitRMSValid
set true when the average hit RMS is well-known
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::vector< int > EnvPlane
std::vector< TrajPoint > seeds
float maxWireSkipNoSignal
max number of wires to skip w/o a signal on them
std::vector< short > MCSMom
void CheckTraj(TCSlice &slc, Trajectory &tj)
std::vector< float > vtxScoreWeights
bool DecodeDebugString(std::string strng)
std::vector< int > StageNum
bool FindShowers3D(TCSlice &slc)
std::bitset< 128 > useAlg
Max hit separation for making junk trajectories. < 0 to turn off.
std::vector< float > pfpStitchCuts
cuts for stitching between TPCs
std::vector< short > deltaRayTag
min length, min MCSMom and min separation (WSE) for a delta ray tag
std::vector< VtxStore > vtxs
2D vertices
short StepDir
-1 = going US (-> small wire#), 1 = going DS (-> large wire#)
std::bitset< 128 > AlgMod
Bit set if algorithm AlgBit_t modifed the trajectory.
call study functions to develop cuts, etc
std::vector< short > muonTag
min length and min MCSMom for a muon tag
std::vector< float > BeginWir
geo::PlaneID DecodeCTP(CTP_t CTP)
TTree * showertree
Deletes all the results.
std::vector< float > EndChg
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
TrajClusterAlg(fhicl::ParameterSet const &pset)
Deletes all the results.
std::bitset< 128 > dbgAlg
Allow user to turn on debug printing in algorithms (that print...)
std::vector< recob::Hit > const * allHits
std::string PrintPos(TCSlice &slc, const TrajPoint &tp)
CTP_t EncodeCTP(unsigned int cryo, unsigned int tpc, unsigned int plane)
float HitSep2(TCSlice &slc, unsigned int iht, unsigned int jht)
void Find2DVertices(TCSlice &slc, const CTP_t &inCTP, unsigned short pass)
std::vector< unsigned int > nWires
void KillPoorVertices(TCSlice &slc)
void FillmAllTraj(TCSlice &slc)
std::vector< float > chkStopCuts
[Min Chg ratio, Chg slope pull cut, Chg fit chi cut]
void EndMerge(TCSlice &slc, CTP_t inCTP, bool lastPass)
bool FillWireHitRange(TCSlice &slc)
void DefinePFPParents(TCSlice &slc, bool prt)
std::vector< float > vtx2DCuts
Max position pull, max Position error rms.
std::bitset< 8 > Strategy
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
void Finish3DShowers(TCSlice &slc)
float multHitSep
preferentially "merge" hits with < this separation
2D representation of charge deposited in the TDC/wire plane
void ChkInTraj(std::string someText, TCSlice &slc)
Deletes all the results.
void FindNeutralVertices(TCSlice &slc)
std::vector< int > EnvShowerID
void MakeJunkVertices(TCSlice &slc, const CTP_t &inCTP)
call study functions to develop cuts, etc (see TCTruth.cxx)
TPCID_t TPC
Index of the TPC within its cryostat.
std::vector< int > IsShowerTj
void Find3DVertices(TCSlice &slc)
std::vector< short > PlaneNum
short recoSlice
only reconstruct the slice with ID (0 = all)
void RunTrajClusterAlg(std::vector< unsigned int > &hitsInSlice, int sliceID)
Deletes all the results.
master switch for turning on debug mode
don't mess with this line
CTP_t CTP
set to an invalid CTP
void FindJunkTraj(TCSlice &slc, CTP_t inCTP)
Deletes all the results.