23 #include "canvas/Persistency/Common/FindManyP.h" 24 #include "art_root_io/TFileService.h" 31 #include "nug4/ParticleNavigation/ParticleList.h" 74 class SingleCRTMatching;
96 bool moduleMatcher(
int module1,
int module2);
98 void endJob()
override;
99 double setAngle(
double angle);
100 int moduletoCTB(
int module2,
int module1);
106 int misMatchedTrack=0;
126 double trackX1, trackX2, trackY1, trackY2, trackZ1,
trackZ2;
238 EDAnalyzer(p), fCRTLabel(p.
get <
art::InputTag > (
"CRTLabel")), fCTBLabel(p.
get<
art::InputTag>(
"CTBLabel")) {
239 consumes < std::vector < CRT::Trigger >> (
fCRTLabel);
240 consumes < std::vector < art::Assns < sim::AuxDetSimChannel, CRT::Trigger >>> (
fCRTLabel);
249 if ((module1 == 6 && (module2 == 10 || module2 == 11)) || (module1 == 14 && (module2 == 10 || module2 == 11)) || (module1 == 19 && (module2 == 26 || module2 == 27)) || (module1 == 31 && (module2 == 26 || module2 == 27)) || (module1 == 7 && (module2 == 12 || module2 == 13)) || (module1 == 15 && (module2 == 12 || module2 == 13)) || (module1 == 18 && (module2 == 24 || module2 == 25)) || (module1 == 30 && (module2 == 24 || module2 == 25)) || (module1 == 1 && (module2 == 4 || module2 == 5)) || (module1 == 9 && (module2 == 4 || module2 == 5)) || (module1 == 16 && (module2 == 20 || module2 == 21)) || (module1 == 28 && (module2 == 20 || module2 == 21)) || (module1 == 0 && (module2 == 2 || module2 == 3)) || (module1 == 8 && (module2 == 2 || module2 == 3)) || (module1 == 17 && (module2 == 22 || module2 == 23)) || (module1 == 29 && (module2 == 22 || module2 == 23)))
return 1;
255 if (module1 == 14 && module2 == 11 )
return 15;
256 else if (module1 == 14 && module2 == 10)
return 10;
257 else if (module1 == 6 && module2 == 11)
return 8;
258 else if (module1 == 6 && module2 == 10)
return 9;
259 else if (module1 == 18 && module2 == 25)
return 4;
260 else if (module1 == 18 && module2 == 24)
return 13;
261 else if (module1 == 30 && module2 == 25)
return 3;
262 else if (module1 == 30 && module2 == 24)
return 2;
263 else if (module1 == 31 && module2 == 27)
return 1;
264 else if (module1 == 31 && module2 == 26)
return 0;
265 else if (module1 == 19 && module2 == 27)
return 12;
266 else if (module1 == 19 && module2 == 26)
return 11;
267 else if (module1 == 7 && module2 == 12)
return 7;
268 else if (module1 == 7 && module2 == 13)
return 6;
269 else if (module1 == 15 && module2 == 12)
return 14;
270 else if (module1 == 15 && module2 == 13)
return 5;
271 else if (module1 == 1 && module2 == 4)
return 25;
272 else if (module1 == 1 && module2 == 5)
return 24;
273 else if (module1 == 9 && module2 == 4)
return 26;
274 else if (module1 == 9 && module2 == 5)
return 31;
275 else if (module1 == 16 && module2 == 20)
return 27;
276 else if (module1 == 16 && module2 == 21)
return 28;
277 else if (module1 == 28 && module2 == 20)
return 16;
278 else if (module1 == 28 && module2 == 21)
return 17;
279 else if (module1 == 29 && module2 == 22)
return 18;
280 else if (module1 == 29 && module2 == 23)
return 19;
281 else if (module1 == 17 && module2 == 22)
return 29;
282 else if (module1 == 17 && module2 == 23)
return 20;
283 else if (module1 == 8 && module2 == 2)
return 30;
284 else if (module1 == 8 && module2 == 3)
return 21;
285 else if (module1 == 0 && module2 == 2)
return 23;
286 else if (module1 == 0 && module2 == 3)
return 22;
292 angle += 3.14159265359;
294 angle *= 180.00 / 3.14159265359;
318 timeStamp=timingHandle->at(0).GetTimeStamp();
332 std::vector<art::Ptr<recob::OpFlash> > opHitList;
333 auto opListHandle =
event.getHandle< std::vector<recob::OpFlash> >(
fopModuleLabel);
339 auto const* SCE = lar::providerFrom<spacecharge::SpaceChargeService>();
353 const auto & triggers =
event.getValidHandle < std::vector < CRT::Trigger >> (
fCRTLabel);
355 art::FindManyP < sim::AuxDetSimChannel > trigToSim(triggers, event,
fCRTLabel);
361 std::unordered_map < size_t, double > prevTimes;
367 for (
const auto &
trigger: * triggers) {
368 const auto & hits =
trigger.Hits();
369 for (
const auto &
hit: hits) {
390 const auto & trigGeo = geom -> AuxDet(
trigger.Channel());
391 const auto & csens = trigGeo.SensitiveVolume(
hit.Channel());
392 const auto center = csens.GetCenter();
401 cout <<
"Hits compiled for event: " <<
nEvents <<
endl;
402 cout <<
"Number of Hits above Threshold: " << hitID <<
endl;
405 for (
unsigned int f_test = 0; f_test <
tempHits_F.size(); f_test++) {
407 const auto & trigGeo = geom -> AuxDet(
tempHits_F[
f].module);
408 const auto & trigGeo2 = geom -> AuxDet(
tempHits_F[f_test].module);
411 const auto hit1Center = hit1Geo.GetCenter();
413 const auto & hit2Geo = trigGeo2.SensitiveVolume(
tempHits_F[f_test].channel);
414 const auto hit2Center = hit2Geo.GetCenter();
419 double hitX = hit1Center.X();
424 double hitYPrelim=hit2Center.Y();
432 double hitY=hitYPrelim;
433 double hitZ = (hit1Center.Z() + hit2Center.Z()) / 2.
f;
454 for (
unsigned int f_test = 0; f_test <
tempHits_B.size(); f_test++) {
457 const auto & trigGeo = geom -> AuxDet(
tempHits_B[
f].module);
458 const auto & trigGeo2 = geom -> AuxDet(
tempHits_B[f_test].module);
460 const auto hit1Center = hit1Geo.GetCenter();
462 const auto & hit2Geo = trigGeo2.SensitiveVolume(
tempHits_B[f_test].channel);
463 const auto hit2Center = hit2Geo.GetCenter();
468 double hitX = hit1Center.X();
476 double hitYPrelim = hit2Center.Y();
482 double hitY=hitYPrelim;
485 double hitZ = (hit1Center.Z() + hit2Center.Z()) / 2.
f;
507 vector < art::Ptr < recob::Track > > trackList;
508 vector<art::Ptr<recob::PFParticle> > pfplist;
509 auto PFPListHandle =
event.getHandle< std::vector<recob::PFParticle> >(
fTrackModuleLabel);
510 if (trackListHandle) {
514 auto PFPListHandle2 =
event.getHandle< std::vector<recob::PFParticle> >(
"pandora");
517 art::FindManyP<anab::T0> trk_t0_assn_v(PFPListHandle2, event ,
"pandora");
518 art::FindManyP<recob::PFParticle> pfp_trk_assn(trackListHandle,event,
"pandoraTrack");
519 art::FindManyP<recob::Hit> trackHits(trackListHandle, event,
"pandoraTrack");
521 int nTracksReco = trackList.size();
522 art::FindManyP < recob::Hit > hitsFromTrack(trackListHandle, event,
fTrackModuleLabel);
524 for (
int iRecoTrack = 0; iRecoTrack < nTracksReco; ++iRecoTrack) {
525 double mccX=-999;
double mccY=-999;
double mccZ=-999;
528 std::vector< art::Ptr<recob::Hit> > allHits = hitsFromTrack.at(iRecoTrack);
532 std::vector<art::Ptr<recob::PFParticle>> pfps=pfp_trk_assn.at(iRecoTrack);
533 if(!pfps.size())
continue;
534 std::vector<art::Ptr<anab::T0>> t0s=trk_t0_assn_v.at(pfps[0].
key());
542 int lastHit=allHits.size()-2;
547 double trackStartPositionZ_noSCE = trackList[iRecoTrack]->Vertex().Z();
548 double trackEndPositionZ_noSCE = trackList[iRecoTrack] ->
End().Z();
550 double trackStartPositionX_noSCE = trackList[iRecoTrack]->Vertex().X();
551 double trackStartPositionY_noSCE = trackList[iRecoTrack]->Vertex().Y();
554 double trackEndPositionX_noSCE = trackList[iRecoTrack] ->
End().X();
555 double trackEndPositionY_noSCE = trackList[iRecoTrack] ->
End().Y();
556 if (trackStartPositionZ_noSCE>trackEndPositionZ_noSCE){
557 trackEndPositionZ_noSCE = trackList[iRecoTrack]->Vertex().Z();
558 trackStartPositionZ_noSCE = trackList[iRecoTrack] ->
End().Z();
559 trackEndPositionX_noSCE = trackList[iRecoTrack]->Vertex().X();
560 trackEndPositionY_noSCE = trackList[iRecoTrack]->Vertex().Y();
563 trackStartPositionX_noSCE = trackList[iRecoTrack] ->
End().X();
564 trackStartPositionY_noSCE = trackList[iRecoTrack] ->
End().Y();
568 if ((trackEndPositionZ_noSCE>90 && trackEndPositionZ_noSCE < 660 && trackStartPositionZ_noSCE <50 && trackStartPositionZ_noSCE<660) || (trackStartPositionZ_noSCE>90 && trackStartPositionZ_noSCE < 660 && trackEndPositionZ_noSCE <50 && trackEndPositionZ_noSCE<660)) {
571 double min_delta = DBL_MAX;
573 double best_dotProductCos = DBL_MAX;
574 double best_deltaXF = DBL_MAX;
575 double best_deltaYF = DBL_MAX;
576 double best_T=DBL_MAX;
577 double best_trackX1=DBL_MAX;
578 double best_trackX2=DBL_MAX;
579 double best_xOffset=DBL_MAX;
580 int bestHitIndex_F=0;
588 std::vector<art::Ptr<recob::Hit>> allHits=trackHits.at(iRecoTrack);
590 std::map<int,double> trkide;
591 std::map<int,double> trknumelec;
594 for(
size_t h=0;
h<allHits.size();
h++){
596 std::vector<sim::TrackIDE> eveIDs = backTracker->
HitToTrackIDEs(clockData, hit);
597 for(
size_t e=0;
e<eveIDs.size(); ++
e){
598 trkide[eveIDs[
e].trackID] += eveIDs[
e].energy;
605 if((ii->second)>maxe){
616 auto const startPos=particle->
Position(0);
625 for (
int i=0; i<nTrajectory-2; i++){
630 for (
int i=0; i<nTrajectory-2; i++){
637 else if (beamLeft!=-1){
643 mccX=particle->
Position(beamRight).X();
644 mccY=particle->
Position(beamRight).Y();
645 mccZ=particle->
Position(beamRight).Z();}
648 mccX=particle->
Position(beamLeft).X();
649 mccY=particle->
Position(beamLeft).Y();
650 mccZ=particle->
Position(beamLeft).Z();}
652 if (beamLeft!=-1 || beamRight!=-1){
654 for (
unsigned int iHit_F = 0; iHit_F <
primaryHits_F.size(); iHit_F++) {
662 double mccHitY=(endPos.Y()-startPos.Y())/(endPos.Z()-startPos.Z())*(Z1-startPos.Z())+startPos.Y();
663 double mccHitX=(endPos.X()-startPos.X())/(endPos.Z()-startPos.Z())*(Z1-startPos.Z())+startPos.X();
665 if (fabs(X1-mccHitX)<60 && fabs(Y1-mccHitY)<60) {
mccTruthCheck=1;
701 for (
unsigned int iHit_F = 0; iHit_F <
primaryHits_F.size(); iHit_F++) {
704 double trackStartPositionX_notCorrected=trackStartPositionX_noSCE;
705 double trackEndPositionX_notCorrected=trackEndPositionX_noSCE;
714 double ticksOffset=0;
717 if (!
fMCCSwitch) ticksOffset = (
primaryHits_F[iHit_F].timeAvg+RDOffset)/25.
f+detProp.GetXTicksOffset(allHits[firstHit]->WireID().Plane, allHits[firstHit]->WireID().TPC, allHits[firstHit]->WireID().Cryostat);
719 else if (
fMCCSwitch) ticksOffset = (
primaryHits_F[iHit_F].timeAvg/500.f)+detProp.GetXTicksOffset(allHits[firstHit]->WireID().Plane, allHits[firstHit]->WireID().TPC, allHits[firstHit]->WireID().Cryostat);
721 xOffset=detProp.ConvertTicksToX(ticksOffset,allHits[firstHit]->
WireID().
Plane, allHits[firstHit]->
WireID().
TPC, allHits[firstHit]->
WireID().Cryostat);
724 trackStartPositionX_noSCE=trackStartPositionX_notCorrected-xOffset;
725 trackEndPositionX_noSCE=trackEndPositionX_notCorrected-xOffset;
726 if (fabs(xOffset)>300 || ((trackStartPositionX_notCorrected<0 && trackStartPositionX_noSCE>0) || (trackEndPositionX_notCorrected<0 && trackEndPositionX_noSCE>0)) || ((trackStartPositionX_notCorrected>0 && trackStartPositionX_noSCE<0) || (trackEndPositionX_notCorrected>0 && trackEndPositionX_noSCE<0)) )
continue;
729 double trackStartPositionX=trackStartPositionX_noSCE;
730 double trackStartPositionY=trackStartPositionY_noSCE;
731 double trackStartPositionZ=trackStartPositionZ_noSCE;
733 double trackEndPositionX=trackEndPositionX_noSCE;
734 double trackEndPositionY=trackEndPositionY_noSCE;
735 double trackEndPositionZ=trackEndPositionZ_noSCE;
748 TVector3 trackStart(trackStartPositionX, trackStartPositionY, trackStartPositionZ);
749 TVector3 trackEnd(trackEndPositionX, trackEndPositionY, trackEndPositionZ);
750 TVector3 v1(X1,Y1,Z1);
751 TVector3 v2(trackStartPositionX, trackStartPositionY, trackStartPositionZ);
753 TVector3 v4(trackStartPositionX,
755 trackStartPositionZ);
756 TVector3 v5(trackEndPositionX,
759 TVector3 trackVector = (v5-v4).Unit();
760 TVector3 hitVector=(v2-v1).Unit();
765 double predictedHitPositionY1 = (v1.Z()-v5.Z())/(v4.Z()-v5.Z())*(v4.Y()-v5.Y())+v5.Y();
768 double predictedHitPositionX1 = (v1.Z()-v5.Z())/(v4.Z()-v5.Z())*(v4.X()-v5.X())+v5.X();
770 if (predictedHitPositionX1<-200 || predictedHitPositionX1>580 || predictedHitPositionY1<-50 || predictedHitPositionY1>620)
continue;
772 double dotProductCos=trackVector*hitVector;
774 double deltaX1 = (predictedHitPositionX1-X1);
777 double deltaY1 = (predictedHitPositionY1-Y1);
783 best_dotProductCos = dotProductCos;
784 best_trackX1=trackStartPositionX;
785 best_trackX2=trackEndPositionX;
786 best_deltaXF = deltaX1;
787 best_deltaYF = deltaY1;
788 best_xOffset=xOffset;
790 bestHitIndex_F=iHit_F;
797 int f=bestHitIndex_F;
800 double dotProductCos=best_dotProductCos;
802 double trackStartPositionX=best_trackX1;
803 double trackStartPositionY=trackStartPositionY_noSCE;
804 double trackStartPositionZ=trackStartPositionZ_noSCE;
806 double trackEndPositionX=best_trackX2;
807 double trackEndPositionY=trackEndPositionY_noSCE;
808 double trackEndPositionZ=trackEndPositionZ_noSCE;
811 TVector3 trackStart(trackStartPositionX, trackStartPositionY, trackStartPositionZ);
812 TVector3 trackEnd(trackEndPositionX, trackEndPositionY, trackEndPositionZ);
814 if (deltaX==DBL_MAX || deltaY==DBL_MAX)
continue;
816 double minTimeDifference=999999.99;
820 tPair.
recoId = iRecoTrack;
854 if ( (trackStartPositionZ_noSCE<620 && trackEndPositionZ_noSCE > 660 && trackStartPositionZ_noSCE > 50 && trackEndPositionZ_noSCE > 50) || (trackStartPositionZ_noSCE>660 && trackEndPositionZ_noSCE < 620 && trackStartPositionZ_noSCE > 50 && trackEndPositionZ_noSCE > 50)) {
856 double min_delta = DBL_MAX;
858 double best_dotProductCos = DBL_MAX;
859 double best_deltaXF = DBL_MAX;
860 double best_deltaYF = DBL_MAX;
861 double best_T=DBL_MAX;
862 double best_xOffset=DBL_MAX;
863 int bestHitIndex_B=0;
864 double best_trackX1=DBL_MAX;
865 double best_trackX2=DBL_MAX;
870 std::vector<art::Ptr<recob::Hit>> allHits=trackHits.at(iRecoTrack);
873 std::map<int,double> trkide;
874 std::map<int,double> trknumelec;
877 for(
size_t h=0;
h<allHits.size();
h++){
879 std::vector<sim::TrackIDE> eveIDs = backTracker->
HitToTrackIDEs(clockData, hit);
880 for(
size_t e=0;
e<eveIDs.size(); ++
e){
881 trkide[eveIDs[
e].trackID] += eveIDs[
e].energy;
888 if((ii->second)>maxe){
901 auto const startPos=particle->
Position(0);
912 for (
int i=0; i<nTrajectory-2; i++){
919 mccX=particle->
Position(approxExit).X();
920 mccY=particle->
Position(approxExit).Y();
921 mccZ=particle->
Position(approxExit).Z();
926 for (
unsigned int iHit_F = 0; iHit_F <
primaryHits_B.size(); iHit_F++) {
934 double mccHitY=(endPos.Y()-startPos.Y())/(endPos.Z()-startPos.Z())*(Z1-startPos.Z())+startPos.Y();
935 double mccHitX=(endPos.X()-startPos.X())/(endPos.Z()-startPos.Z())*(Z1-startPos.Z())+startPos.X();
936 if (fabs(X1-mccHitX)<60 && fabs(Y1-mccHitY)<60) {
mccTruthCheck=1;
957 for (
unsigned int iHit_B = 0; iHit_B <
primaryHits_B.size(); iHit_B++) {
961 double trackStartPositionX_notCorrected=trackStartPositionX_noSCE;
962 double trackEndPositionX_notCorrected=trackEndPositionX_noSCE;
972 double ticksOffset=0;
975 if (!
fMCCSwitch) ticksOffset = (
primaryHits_B[iHit_B].timeAvg+RDOffset)/25.
f+detProp.GetXTicksOffset(allHits[firstHit]->WireID().Plane, allHits[firstHit]->WireID().TPC, allHits[firstHit]->WireID().Cryostat);
977 else if (
fMCCSwitch) ticksOffset = (
primaryHits_B[iHit_B].timeAvg/500.f)+detProp.GetXTicksOffset(allHits[firstHit]->WireID().Plane, allHits[firstHit]->WireID().TPC, allHits[firstHit]->WireID().Cryostat);
979 xOffset=detProp.ConvertTicksToX(ticksOffset,allHits[firstHit]->
WireID().
Plane, allHits[firstHit]->
WireID().
TPC, allHits[firstHit]->
WireID().Cryostat);
982 trackStartPositionX_noSCE=trackStartPositionX_notCorrected-xOffset;
983 trackEndPositionX_noSCE=trackEndPositionX_notCorrected-xOffset;
984 if (fabs(xOffset)>300 || ((trackStartPositionX_notCorrected<0 && trackStartPositionX_noSCE>0) || (trackEndPositionX_notCorrected<0 && trackEndPositionX_noSCE>0)) || ((trackStartPositionX_notCorrected>0 && trackStartPositionX_noSCE<0) || (trackEndPositionX_notCorrected>0 && trackEndPositionX_noSCE<0)) )
continue;
987 double trackStartPositionX=trackStartPositionX_noSCE;
988 double trackStartPositionY=trackStartPositionY_noSCE;
989 double trackStartPositionZ=trackStartPositionZ_noSCE;
991 double trackEndPositionX=trackEndPositionX_noSCE;
992 double trackEndPositionY=trackEndPositionY_noSCE;
993 double trackEndPositionZ=trackEndPositionZ_noSCE;
998 trackStartPositionX -= posOffsets_F.X();
999 trackStartPositionY += posOffsets_F.Y();
1000 trackStartPositionZ += posOffsets_F.Z();
1002 trackEndPositionX -= posOffsets_B.X();
1003 trackEndPositionY += posOffsets_B.Y();
1004 trackEndPositionZ += posOffsets_B.Z();
1016 TVector3 trackStart(trackStartPositionX, trackStartPositionY, trackStartPositionZ);
1017 TVector3 trackEnd(trackEndPositionX, trackEndPositionY, trackEndPositionZ);
1018 TVector3 v1(X1,Y1,Z1);
1019 TVector3 v2(trackStartPositionX, trackStartPositionY, trackStartPositionZ);
1021 TVector3 v4(trackStartPositionX,
1022 trackStartPositionY,
1023 trackStartPositionZ);
1024 TVector3 v5(trackEndPositionX,
1027 TVector3 trackVector = (v5-v4).Unit();
1028 TVector3 hitVector=(v2-v1).Unit();
1033 double predictedHitPositionY1 = (v1.Z()-v5.Z())/(v4.Z()-v5.Z())*(v4.Y()-v5.Y())+v5.Y();
1036 double predictedHitPositionX1 = (v1.Z()-v5.Z())/(v4.Z()-v5.Z())*(v4.X()-v5.X())+v5.X();
1038 if (
abs(predictedHitPositionX1)>340 || predictedHitPositionY1<-160 || predictedHitPositionY1>560)
continue;
1040 double dotProductCos=trackVector*hitVector;
1042 double deltaX1 = (predictedHitPositionX1-X1);
1045 double deltaY1 = (predictedHitPositionY1-Y1);
1053 best_dotProductCos = dotProductCos;
1054 best_trackX1=trackStartPositionX;
1055 best_trackX2=trackEndPositionX;
1056 best_deltaXF = deltaX1;
1057 best_deltaYF = deltaY1;
1058 best_xOffset=xOffset;
1060 bestHitIndex_B=iHit_B;
1066 int f=bestHitIndex_B;
1068 double deltaX=best_deltaXF;
double deltaY=best_deltaYF;
1069 double dotProductCos=best_dotProductCos;
1074 double trackStartPositionX=best_trackX1;
1075 double trackStartPositionY=trackStartPositionY_noSCE;
1076 double trackStartPositionZ=trackStartPositionZ_noSCE;
1078 double trackEndPositionX=best_trackX2;
1079 double trackEndPositionY=trackEndPositionY_noSCE;
1080 double trackEndPositionZ=trackEndPositionZ_noSCE;
1083 TVector3 trackStart(trackStartPositionX, trackStartPositionY, trackStartPositionZ);
1084 TVector3 trackEnd(trackEndPositionX, trackEndPositionY, trackEndPositionZ);
1086 if (deltaX==DBL_MAX && deltaY==DBL_MAX)
continue;
1088 double minTimeDifference=999999.99;
1092 tPair.
recoId = iRecoTrack;
1136 vector < tracksPair > allUniqueTracksPair;
1151 if (allUniqueTracksPair.size() > 0) {
1152 for (
unsigned int u = 0; u < allUniqueTracksPair.size(); u++) {
1153 deltaX=allUniqueTracksPair[u].deltaX;
1155 deltaY=allUniqueTracksPair[u].deltaY;
1157 opCRTTDiff=allUniqueTracksPair[u].flashTDiff;
1159 dotCos=fabs(allUniqueTracksPair[u].dotProductCos);
1160 trackX1=allUniqueTracksPair[u].trackStartPosition.X();
1161 trackY1=allUniqueTracksPair[u].trackStartPosition.Y();
1162 trackZ1=allUniqueTracksPair[u].trackStartPosition.Z();
1164 trackX2=allUniqueTracksPair[u].trackEndPosition.X();
1165 trackY2=allUniqueTracksPair[u].trackEndPosition.Y();
1166 trackZ2=allUniqueTracksPair[u].trackEndPosition.Z();
1172 moduleX=allUniqueTracksPair[u].moduleX1;
1173 moduleY=allUniqueTracksPair[u].moduleY1;
1175 adcX=allUniqueTracksPair[u].adcX1;
1176 adcY=allUniqueTracksPair[u].adcY1;
1178 CRTT0=allUniqueTracksPair[u].timeAvg;
1179 stripX=allUniqueTracksPair[u].stripX1;
1180 stripY=allUniqueTracksPair[u].stripY1;
1182 X_CRT=allUniqueTracksPair[u].X1;
1183 Y_CRT=allUniqueTracksPair[u].Y1;
1184 Z_CRT=allUniqueTracksPair[u].Z1;
1186 mccE=allUniqueTracksPair[u].mccE;
1187 mccT0=allUniqueTracksPair[u].mccT0;
1201 for (
unsigned int iHit_F = 0; iHit_F <
primaryHits_F.size(); iHit_F++) {
1208 for (
unsigned int iHit_F = 0; iHit_F <
primaryHits_B.size(); iHit_F++) {
1218 std::set<int> signal_trackids;
1219 signal_trackids.emplace(allUniqueTracksPair[u].truthId);
1224 for(
unsigned int i = 0; i < opHitList.size(); ++i) {
1227 std::vector< art::Ptr<recob::OpHit> > hitFromFlash = pbt->
OpFlashToOpHits_Ps(FlashP);
1238 auto const startPos=particle->
Position(0);
1240 if (fabs(
mccT0-CRTT0)>100000){
1241 double mccHitY=(endPos.Y()-startPos.Y())/(endPos.Z()-startPos.Z())*(
Z_CRT-startPos.Z())+startPos.Y();
1242 double mccHitX=(endPos.X()-startPos.X())/(endPos.Z()-startPos.Z())*(
Z_CRT-startPos.Z())+startPos.X();
1243 std::cout<<mccHitX<<
','<<mccHitY<<
std::endl;
1260 fCRTTree = fileServiceHandle->make<TTree>(
"Displacement",
"event by event info");
1261 fMCCTree= fileServiceHandle->make<TTree>(
"MCC",
"event by event info");
1308 fMCCTree->Branch(
"hpartProcess", &
partProcess,
"partProcess/I");
1309 fMCCTree->Branch(
"htruthPosX", &
truthPosX,
"truthPosX/D");
1310 fMCCTree->Branch(
"htruthPosY", &
truthPosY,
"truthPosY/D");
1311 fMCCTree->Branch(
"htruthPosZ", &
truthPosZ,
"truthPosZ/D");
1312 fMCCTree->Branch(
"hmccE", &
mccE,
"mccE/D");
1313 fMCCTree->Branch(
"hmccT0", &
mccT0,
"mccT0/D");
def analyze(root, level, gtrees, gbranches, doprint)
double E(const int i=0) const
code to link reconstructed objects back to the MC truth information
double averageSignedDistanceXY
double averageSignedDistance
unsigned int NumberTrajectoryPoints() const
void analyze(art::Event const &e) override
const TLorentzVector & Position(const int i=0) const
std::string fopModuleLabel
std::vector< tracksPair > tracksPair_B
const std::vector< art::Ptr< recob::OpHit > > OpFlashToOpHits_Ps(art::Ptr< recob::OpFlash > &flash_P)
const TLorentzVector & EndPosition() const
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
const simb::MCParticle * TrackIdToParticle_P(int id) const
double averageSignedDistanceYZ
double setAngle(double angle)
simb::Origin_t Origin() const
double averageSignedDistanceXZ
geo::TPCID PositionToTPCID(geo::Point_t const &point) const
Returns the ID of the TPC at specified location.
std::string Process() const
const double OpHitCollectionPurity(std::set< int > const &tkIds, std::vector< art::Ptr< recob::OpHit > > const &opHits_Ps)
std::vector< recoHits > primaryHits_F
art framework interface to geometry description
bool operator()(const tracksPair &pair1, const tracksPair &pair2)
#define DEFINE_ART_MODULE(klass)
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
std::vector< tracksPair > tracksPair_F
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P(int id) const
T get(std::string const &key) const
std::vector< tempHits > tempHits_F
double T(const int i=0) const
TVector3 trackStartPosition
TVector3 trackEndPosition
int moduletoCTB(int module2, int module1)
std::string fTrackModuleLabel
Detector simulation of raw signals on wires.
std::vector< recoHits > primaryHits_B
int fFronttoBackTimingCut
SingleCRTMatching(fhicl::ParameterSet const &p)
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Declaration of signal hit object.
int fModuletoModuleTimingCut
const tracksPair tracksPair1
Provides recob::Track data product.
bool operator()(const tracksPair &tracksPair2)
constexpr auto const & deepestIndex() const
Returns the value of the deepest ID available (TPC's).
auto const & get(AssnsNode< L, R, D > const &r)
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
bool moduleMatcher(int module1, int module2)
recob::tracking::Plane Plane
removePairIndex(const tracksPair &tracksPair0)
QTextStream & endl(QTextStream &s)
Event finding and building.
std::vector< tempHits > tempHits_B