NumuCuts.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "CAFAna/Core/Cut.h"
6 #include "CAFAna/Vars/Vars.h"
8 
9 namespace ana
10 {
11  double ZFrontPosition(int diblock);
12  double ZEndPosition(int diblock);
13 
14  extern const Cut kNumuBasicQuality;
15 
16  const Cut kEbelow5GeV = kCCE < 5.0;
17 
18  const Cut kNumuQuality = kNumuBasicQuality && kEbelow5GeV;
19 
20  extern const Cut kNumuContainFD;
21 
22  extern const Cut kNumuContainND;
23 
24  extern const Cut kNumuNCRej;
25 
26  extern const Cut kCVNmSel;
27 
28  extern const Cut kNumuHybridNCRej;
29 
30  extern const Cut kKirkSATuneFD;
31 
32  extern const Cut kNumuCosmicRej;
33 
34  extern const Cut kNumuCosmicRejLoose;
35 
36  extern const Cut kNumuSACosmicRejLoose;
37 
38  extern const Cut kNumuQESel;
39 
40  extern const Cut kNewTune;
41 
42  extern const Cut kCVNmCosSel;
43 
45 
46  extern const Cut kNumuDecafPresel;
47 
48  // These cuts combine all of the numu cuts to create numu samples all at once
50  kNumuDecafPresel && kNumuContainFD && kNumuCosmicRejLoose;
52  kNumuDecafPresel && kNumuContainND;
53  const Cut kNumuFD =
54  kNumuQuality && kNumuContainFD && kNumuNCRej && kNumuCosmicRej;
55  const Cut kNumuND =
56  kNumuQuality && kNumuContainND && kNumuNCRej;
57  const Cut kNumuSAKTune =
58  kNumuQuality && kNumuContainFD && kKirkSATuneFD;
59 
61  kNumuQuality && kNumuContainFD && kCVNmSel && kCVNmCosSel;
62  const Cut kNumuNDCvn =
63  kNumuQuality && kNumuContainND && kCVNmSel;
64 
65  const Cut kNumuQEFD = kNumuFD && kNumuQESel;
66  const Cut kNumuQEND = kNumuND && kNumuQESel;
67  const Cut kNumuNonQEFD = kNumuFD && !kNumuQESel;
68  const Cut kNumuNonQEND = kNumuND && !kNumuQESel;
69 
70  const Cut kNumuCC = kNumuQuality && kNumuNCRej;
71 }
const Cut kKirkSATuneFD([](const caf::SRProxy *sr){return(sr->sel.remid.pid > 0.5 &&sr->sel.cvn.numuid > 0.5 &&sr->sel.cosrej.anglekal > 0.4 &&sr->slc.nhit< 400 &&sr->sel.nuecosrej.pngptp< 0.9 &&sr->sel.cosrej.numucontpid2019 > 0.51);})
Definition: NumuCuts.h:30
diblock
print "ROW IS " print row
Definition: geo2elec.py:31
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Cut kEbelow5GeV
Definition: NumuCuts.h:16
const Cut kNumuDecafCutND
Definition: NumuCuts.h:51
double ZEndPosition(int diblock)
Definition: NumuCuts.cxx:33
const Cut kCVNmSel([](const caf::SRProxy *sr){return(sr->sel.cvn.numuid >0.5);})
Definition: NumuCuts.h:26
const Cut kNumuCC
Definition: NumuCuts.h:70
const Cut kNumuSACosmicRejLoose([](const caf::SRProxy *sr){return( sr->sel.cosrej.numucontpid2019 > 0.5);})
Definition: NumuCuts.h:36
const Cut kNumuCosmicRej([](const caf::SRProxy *sr){return(sr->sel.cosrej.anglekal > 0.5 && sr->sel.cosrej.numucontpid2019 > 0.535 && sr->slc.nhit< 400);})
Definition: NumuCuts.h:32
double ZFrontPosition(int diblock)
Definition: NumuCuts.cxx:11
const Cut kCosmicRejStraightCuts([](const caf::SRProxy *sr){bool basicsExist=sr->trk.kalman.ntracks > 0 &&sr->trk.kalman.idxremid!=999 &&sr->energy.numu.E!=-5 &&sr->trk.cosmic.ntracks > 0;int best3DRemid=sr->trk.kalman.idxremid;double startX=sr->trk.kalman.tracks[0].start.X();double startY=sr->trk.kalman.tracks[0].start.Y();double startZ=sr->trk.kalman.tracks[0].start.Z();double stopX=sr->trk.kalman.tracks[0].stop.X();double stopY=sr->trk.kalman.tracks[0].stop.Y();double stopZ=sr->trk.kalman.tracks[0].stop.Z();double dirY=sr->trk.kalman.tracks[0].dir.Y();bool negDirY=(dirY< 0);int startDetectorDiblock=sr->hdr.dibfirst;int stopDetectorDiblock=sr->hdr.diblast;double startDetectorZ=ZFrontPosition(startDetectorDiblock);double stopDetectorZ=ZEndPosition(stopDetectorDiblock);bool kVertBasic=(fabs(startX)< 740 &&startY >-750);bool kVertDirContain;if(negDirY){kVertDirContain=(startY< 650 &&startZ >(startDetectorZ+40));}else{kVertDirContain=(startY< 725 &&startZ >(startDetectorZ+20));}bool kContainedVert=kVertBasic &&kVertDirContain;bool kEndBasic=(fabs(stopX)< 740 &&stopY >-750);bool kEndDirContain;if(negDirY){kEndDirContain=(stopY< 725 &&stopZ< (stopDetectorZ-20.0));}else{kEndDirContain=(stopY< 650 &&stopZ< (stopDetectorZ-40.0));}bool kContainedEnd=kEndBasic &&kEndDirContain;int trkHit=sr->trk.kalman.tracks[0].nhit;int trackNPlanes=sr->trk.kalman.tracks[0].nplane;int sliceNHit=sr->slc.nhit;double ratioFlasher=sliceNHit/double(trackNPlanes);bool kNotFlasher=ratioFlasher< 3.0;if(basicsExist &&kContainedVert &&kContainedEnd &&trkHit > 5 &&kNotFlasher){double cosBakDist=sr->sel.contain.cosbakdist;double cosBeamDir=sr->sel.cosrej.anglecos;bool kCosProjDist=(cosBakDist > 50.0);bool kNegDirBeamProjDistInBox=((cosBeamDir > 0.20)&&(cosBeamDir< 0.65)&&(cosBakDist< 725));bool kPosDirBeamProjDistInBox=((cosBeamDir >-0.85)&&(cosBeamDir< -0.2)&&(cosBakDist< 725));bool kNegDirBeamProjDistInTriangle=false;bool kPosDirBeamProjDistInTriangle=false;if(kNegDirBeamProjDistInBox){double y=0.65-(9.0/14500.0)*cosBakDist;if(y > cosBeamDir){kNegDirBeamProjDistInTriangle=true;}}if(kPosDirBeamProjDistInBox){double y=-0.85+(13.0/14500.0)*cosBakDist;if(y< cosBeamDir){kPosDirBeamProjDistInTriangle=true;}}bool kNegDirBeamProjDistInRectangle=((cosBeamDir >-0.3)&&(cosBeamDir< 0.2)&&(cosBakDist< 1500));bool kPosDirBeamProjDistInRectangle=((cosBeamDir >-0.2)&&(cosBeamDir< 0.2)&&(cosBakDist< 1500));bool kDirBeamProjDist=false;if(negDirY){kDirBeamProjDist=!kNegDirBeamProjDistInTriangle &&!kNegDirBeamProjDistInRectangle;}else{kDirBeamProjDist=!kPosDirBeamProjDistInTriangle &&!kPosDirBeamProjDistInRectangle;}TVector3 vert=sr->trk.kalman.tracks[0].start;TVector3 meanpos=TVector3(sr->slc.meanpos.X(), sr->slc.meanpos.Y(), sr->slc.meanpos.Z());TVector3 evtdir=(meanpos-vert).Unit();TVector3 beamdir=TVector3(0, sin(0.05256), cos(0.05256));beamdir.Unit();double evtcosNumi=evtdir.Dot(beamdir);double pt_frac_evt=sqrt(1-evtcosNumi *evtcosNumi);bool kPt=pt_frac_evt< 0.65;if(kCosProjDist &&kDirBeamProjDist &&kPt){int nKal=sr->trk.kalman.ntracks;int nKal2D=sr->trk.kalman.ntracks2d;bool passesAllContainment=true;for(int s=0;s< nKal;++s){if(s==best3DRemid){continue;}double startOtherX=sr->trk.kalman.tracks[s].start.X();double startOtherY=sr->trk.kalman.tracks[s].start.Y();double startOtherZ=sr->trk.kalman.tracks[s].start.Z();double stopOtherX=sr->trk.kalman.tracks[s].stop.X();double stopOtherY=sr->trk.kalman.tracks[s].stop.Y();double stopOtherZ=sr->trk.kalman.tracks[s].stop.Z();bool kContainOtherVert=((fabs(startOtherX)< 740)&&(startOtherY< 725)&&(startOtherY >-750)&&(startOtherZ >(startDetectorZ+20.0)));bool kContainOtherEnd=((fabs(stopOtherX)< 740)&&(stopOtherY< 725)&&(stopOtherY >-750)&&(stopOtherZ< (stopDetectorZ-20.0)));if(!kContainOtherVert){passesAllContainment=false;}if(!kContainOtherEnd){passesAllContainment=false;}}for(int s=0;s< nKal2D;++s){double startOtherX=sr->trk.kalman.tracks2d[s].start.X();double startOtherY=sr->trk.kalman.tracks2d[s].start.Y();double startOtherZ=sr->trk.kalman.tracks2d[s].start.Z();double stopOtherX=sr->trk.kalman.tracks2d[s].stop.X();double stopOtherY=sr->trk.kalman.tracks2d[s].stop.Y();double stopOtherZ=sr->trk.kalman.tracks2d[s].stop.Z();bool kContainOtherVert=((fabs(startOtherX)< 740)&&(startOtherY< 725)&&(startOtherY >-750)&&(startOtherZ >(startDetectorZ+20.0)));bool kContainOtherEnd=((fabs(stopOtherX)< 740)&& (stopOtherY< 725)&&(stopOtherY >-750)&& (stopOtherZ< (stopDetectorZ-20.0)));if(!kContainOtherVert){passesAllContainment=false;}if(!kContainOtherEnd){passesAllContainment=false;}}return passesAllContainment;}else{return false;}}else{return false;}})
Definition: NumuCuts.h:44
const Cut kNumuContainFD([](const caf::SRProxy *sr){ std::pair< int, int > planes=calcFirstLastLivePlane(sr->slc.firstplane, std::bitset< 14 >(sr->hdr.dibmask));int planestofront=sr->slc.firstplane-planes.first;int planestoback=planes.second-sr->slc.lastplane;return( sr->slc.ncellsfromedge > 1 &&planestofront > 1 &&planestoback > 1 &&sr->sel.contain.kalfwdcell > 10 &&sr->sel.contain.kalbakcell > 10 &&sr->sel.contain.cosfwdcell > 0 &&sr->sel.contain.cosbakcell > 0);})
Definition: NumuCuts.h:20
const Cut kNumuFD
Definition: NumuCuts.h:53
const Cut kNumuContainND([](const caf::SRProxy *sr){return( sr->trk.kalman.ntracks > sr->trk.kalman.idxremid &&sr->slc.ncellsfromedge > 1 &&sr->slc.firstplane > 1 &&sr->slc.lastplane< 212 &&sr->trk.kalman.tracks[0].start.Z()< 1150 &&( sr->trk.kalman.tracks[0].stop.Z()< 1275 ||sr->sel.contain.kalyposattrans< 55) &&( sr->energy.numu.ndhadcalcatE +sr->energy.numu.ndhadcaltranE)< 0.03 &&sr->sel.contain.kalfwdcellnd > 4 &&sr->sel.contain.kalbakcellnd > 8);})
Definition: NumuCuts.h:22
const Cut kNumuHybridNCRej([](const caf::SRProxy *sr){return(sr->sel.remid.pid > 0.5 &&sr->sel.cvn.numuid > 0.5);})
Definition: NumuCuts.h:28
const Cut kNumuQEND
Definition: NumuCuts.h:66
const Cut kNumuNDCvn
Definition: NumuCuts.h:62
const Cut kCVNmCosSel([](const caf::SRProxy *sr){return(sr->trk.kalman.tracks[0].start.Y()< 650 &&sr->sel.cosrej.anglekal > 0.3 &&sr->trk.cosmic.tracks[0].start.Y()< 600 &&sr->sel.contain.cosbakdist > 40 &&sr->sel.nuecosrej.pngptp< 0.8);})
Definition: NumuCuts.h:42
const Cut kNumuQESel([](const caf::SRProxy *sr){std::cout<< "WARNING! Attempting to access kNumuQESel which relies on qepid (which no longer exists.) Aborting..."<< std::endl;abort(); return false;})
Definition: NumuCuts.h:38
const Cut kNumuSAKTune
Definition: NumuCuts.h:57
const Cut kNumuND
Definition: NumuCuts.h:55
const Var kCCE
Definition: NumuVars.h:21
const Cut kNumuNonQEFD
Definition: NumuCuts.h:67
const Cut kNumuNCRej([](const caf::SRProxy *sr){return(sr->sel.remid.pid >0.75);})
Definition: NumuCuts.h:24
const Cut kNumuDecafPresel([](const caf::SRProxy *sr){return(sr->slc.nhit > 20 &&sr->sel.remid.pid > 0);})
Definition: NumuCuts.h:46
const Cut kNumuDecafCutFD
Definition: NumuCuts.h:49
const Cut kNumuFDCvnCos
Definition: NumuCuts.h:60
const Cut kNumuBasicQuality([](const caf::SRProxy *sr){return(sr->energy.numu.trkccE > 0 && sr->sel.remid.pid > 0 && sr->slc.nhit > 20 && sr->slc.ncontplanes > 4 && sr->trk.cosmic.ntracks > 0);})
Definition: NumuCuts.h:14
const Cut kNewTune([](const caf::SRProxy *sr){return(sr->sel.cvn.numuid >0.5 && sr->sel.remid.pid >0.75 && sr->sel.cosrej.numucontpid2020 >0.51 && sr->sel.cosrej.anglekal >0.4 && sr->sel.nuecosrej.pngptp< 0.9);})
Definition: NumuCuts.h:40
const Cut kNumuQEFD
Definition: NumuCuts.h:65
const Cut kNumuQuality
Definition: NumuCuts.h:18
const Cut kNumuNonQEND
Definition: NumuCuts.h:68
const Cut kNumuCosmicRejLoose([](const caf::SRProxy *sr){return(sr->sel.cosrej.numucontpid2020 > 0.48);})
Definition: NumuCuts.h:34