1 #include "nueCCSelection.hxx" 3 #include "baseSelection.hxx" 4 #include "CutUtils.hxx" 5 #include "EventBoxUtils.hxx" 6 #include "VersioningUtils.hxx" 7 #include "SystematicUtils.hxx" 8 #include "trackerSelectionUtils.hxx" 10 #include "nueCCUtils.hxx" 11 #include "nueCutUtils.hxx" 12 #include "SystematicTuning.hxx" 22 _Ethreshold = (Float_t)ND::params().GetParameterD(
"psycheSelections.nueCCAnalysis.Cuts.PID.EThreshold");
27 systTuning::Initialize();
36 SetDetectorFV(SubDetId::kFGD1);
48 AddStep(StepBase::kAction,
"Fill vertex info",
new FillVertex());
64 AddStep(StepBase::kCut,
"TPC Veto",
new TPCVetoCut());
68 AddStep(StepBase::kAction,
"find best e+e- pair",
new FindPairsAction());
69 AddStep(StepBase::kCut,
"Pair Veto",
new PairCut());
72 AddStep(StepBase::kCut,
"P0D Veto",
new P0DVetoCut());
75 AddStep(StepBase::kCut,
"ECal Veto",
new ECalVetoCut());
78 AddStep(StepBase::kCut,
"ToF",
new ToFCut());
83 SetBranchAlias(0,
"trunk");
88 SetPreSelectionAccumLevel(3);
90 _FindLeadingTracksStepIndex = GetStepNumber(
"find leading tracks");
91 _TotalMultiplicityCutIndex = GetCutNumber(
"> 0 tracks ");
93 _ElecPIDCutIndex = GetCutNumber(
"TPC Electron Pull");
94 _ElecPIDStepIndex = GetStepNumber(
"TPC Electron Pull");
98 bool nueCCSelection::FillEventSummary(
AnaEventC& event, Int_t allCutsPassed[]){
102 static_cast<AnaEventSummaryB*
>(
event.Summary)->EventSample = SampleId::kFGD1NuECC;
104 return (static_cast<AnaEventSummaryB*>(event.
Summary)->EventSample != SampleId::kUnassigned);
116 for(
int i = 0; i < 4; ++i)
137 if(systId == SystId::kTpcClusterEff){
141 if(!tpcTrack)
return false;
144 if(nueCCUtils::UseEcal(track) && (tpcTrack->
NNodes == 17 || tpcTrack->
NNodes == 18) )
return true;
145 if(!nueCCUtils::UseEcal(track) && (tpcTrack->
NNodes == 35 || tpcTrack->
NNodes == 36) )
return true;
163 if(systId == SystId::kTpcTrackEff){
187 if(systId == SystId::kChargeIDEff){
199 else if(systId == SystId::kTpcClusterEff){
205 cutUtils::FiducialCut(track->
PositionStart, static_cast<SubDetId::SubDetEnum>(GetDetectorFV())) &&
211 else if(systId == SystId::kECalPID){
213 if (track != box.
MainTrack)
return false;
215 if(!nueCCUtils::UseEcal(track))
return false;
221 if(!tpcTrackBack)
return false;
222 if(tpcTrackBack->
Momentum > _Ethreshold)
return false;
242 if(systId == SystId::kTpcTrackEff){
259 else if(systId == SystId::kSIPion){
275 else if(systId == SystId::kSIProton){
290 else if(systId == SystId::kTpcECalMatchEff){
308 if (systId == SystId::kFgdTrackEff)
310 else if(systId == SystId::kFgdHybridTrackEff)
312 else if(systId == SystId::kFgdPid)
314 else if(systId == SystId::kMichelEleEff)
316 else if(systId == SystId::kSIPion){
320 else if(systId == SystId::kSIProton){
324 else if(systId == SystId::kECalEmHipPID)
326 else if(systId == SystId::kFGD2Shower)
328 else if(systId == SystId::kPileUp)
330 else if(systId == SystId::kOOFV)
332 else if(systId == SystId::kECalTrackEff)
335 else if (systId == SystId::kFluxWeightNu){
338 if(run >= 8 && run < 13)
return false;
340 else if (systId == SystId::kFluxWeightAntiNu){
343 if(run < 8 || run == 13)
return false;
346 else if(systId == SystId::kTpcP0dMatchEff)
return false;
347 else if(systId == SystId::kFgdECalMatchEff)
return false;
348 else if(systId == SystId::kFgdECalSmrdMatchEff)
return false;
349 else if(systId == SystId::kMomRangeResol)
return false;
364 if(!PreviousToyBox.
HMNtrack)
return false;
367 if(PreviousToyBox.
MaxAccumLevel > _TotalMultiplicityCutIndex){
369 trackerSelUtils::FindLeadingTracks(event, box);
379 redoFromStep = _FindLeadingTracksStepIndex;
395 redoFromStep = _ElecPIDStepIndex;
410 if(!event.EventBoxes[EventBoxId::kEventBoxTracker])
411 event.EventBoxes[EventBoxId::kEventBoxTracker] =
new EventBoxTracker();
413 boxUtils::FillTracksWithTPC(event, static_cast<SubDetId::SubDetEnum>(GetDetectorFV()));
414 boxUtils::FillTracksWithFGD(event, static_cast<SubDetId::SubDetEnum>(GetDetectorFV()));
415 boxUtils::FillTracksWithECal(event);
416 boxUtils::FillTrajsChargedInTPC(event);
417 boxUtils::FillTrajsChargedInFGDAndNoTPC(event, static_cast<SubDetId::SubDetEnum>(GetDetectorFV()));
418 boxUtils::FillTrajsInECal(event);
427 EventBoxB* EventBox =
event.EventBoxes[EventBoxId::kEventBoxTracker];
441 trackerSelUtils::FindLeadingTracks(event,boxB);
467 box.
Vertex->nParticles = 0;
470 for(Int_t i = 0; i < 4; ++i){
490 nueCCUtils::FindP0DVetoTracks(event, *nuebox.
MainTrack, nTrack);
509 if(!track)
return false;
511 return (track->
Momentum > _min_mom);
524 if(!box.
Vertex)
return false;
527 if(!track)
return false;
529 return nueCutUtils::TrackQuality(track, _num_tpc_nodes, _num_tpc_nodes_ecal);
544 return nueCutUtils::TPCElectronPull(track, _pullel_accept_min, _pullel_accept_max, _pullel_accept_tight_min, _pullel_accept_tight_max, _minMom_ecal);
557 if(!track)
return false;
559 return nueCutUtils::TPCMuonPull(track, _pullmu_reject_min, _pullmu_reject_max, _minMom_ecal);
572 if(!track)
return false;
574 return nueCutUtils::TPCPionPull(track, _pullpi_reject_min, _pullpi_reject_max, _num_tpc_nodes, _minMom_ecal);
587 if(!track)
return false;
589 return nueCutUtils::EcalEMEnergy(track, _Ethreshold, _Emin_ecal, _EoverP,
false);
602 if(!track)
return false;
604 return nueCutUtils::EcalMIPEMPID(track, _Ethreshold, _ecal_mipem_min);
617 if(!track)
return false;
619 return nueCutUtils::SecondTPCPID(track, _pullmu_reject_min, _pullmu_reject_max);
632 if(!track)
return false;
634 nuebox.
VetoTrack = nueCCUtils::FindTPCVetoTrack(event, *track);
639 nueCCUtils::FindGammaIsoTracks(event, *track, _vertex_activity, nTracks);
642 nuebox.TPCVetoFarTracks = nTracks[0];
644 nuebox.TPCVetoP0DNearTracks = nTracks[2];
647 nuebox.
NOOFVTracks = nueCCUtils::FindOOFVFGDTPCTracks(event, *track, static_cast<SubDetId::SubDetEnum>(nuebox.
DetectorFV) );
650 nuebox.
OOFVtrack = cutUtils::FindFGDOOFVtrack(event, *track, static_cast<SubDetId::SubDetEnum>(nuebox.
DetectorFV));
654 nueCCUtils::FindFGD2ShowerTracks(event, *track, nSTracks);
656 nuebox.FGD2ShowerNFGD1TPC2Tracks = nSTracks[0];
672 if(!track)
return false;
675 if(!vetoTrack)
return true;
677 return (nueCutUtils::TPCVeto(*track, vetoTrack, _delta_z_min));
705 if(!track)
return false;
712 nuebox.
PairTrack = nueCCUtils::FindPairTrack(event, *track, _delta_pos_max, _pullel_min, _pullel_max);
727 if(!track)
return false;
730 if(!pair)
return true;
732 return (nueCutUtils::PairCut(*track, pair, _inv_mass_min));
759 nuebox.ECalNCVetoTrack = nueCCUtils::FindEcalVetoTrack(event, *(nuebox.
MainTrack),
true);
773 if(!track)
return false;
776 if(!veto)
return true;
778 return (nueCutUtils::EcalVeto(*track, veto, _delta_z_min));
792 if(!track)
return false;
799 return(nueCutUtils::ToF(*track, _fgdecaltof, run));
833 if(!track)
return false;
836 if(track->
Momentum < 200.0)
return true;
839 if(!longCloseTPC)
return false;
844 if(pullmuon < 0.0 || pullpion < 0.0)
return false;
Float_t dEdxexpMuon
Expected dE/dx for a muon, based on the reconstructed momentum.
AnaTrackB * SHMtrack
For storing the second highest momentum track.
AnaTrueVertexB * TrueVertex
Pointer to the AnaTrueVertexB of the interaction that created this AnaTrueParticleB.
Float_t PositionStart[4]
The reconstructed start position of the particle.
bool IsRelevantRecObjectForSystematic(const AnaEventC &event, AnaRecObjectC *track, SystId_h systId, Int_t branch) const
Is this track relevant for a given systematic (prior to selection, call when initializing the event...
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
AnaTrueVertexB * TrueVertex
void DefineDetectorFV()
Define the detector Fiducial Volume in which this selection is applied.
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
AnaECALParticleB * ECALSegments[NMAXECALS]
The ECAL segments that contributed to this global track.
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
Float_t Position[4]
The identified position of the global vertex.
Int_t NNodes
The number of nodes in the reconstructed object.
SubDetId_h DetectorFV
Indicate the FV we are interested in.
Int_t GParentPDG
The PDG code of this particle's grandparent, or 0 if there is no grandparent.
AnaTrackB * MainTrack
For storing the Main Track (The lepton candidate in geranal: HMN or HMP track)
Int_t FGD2ShowerNFGD2TPC3Tracks
FGD2 shower.
Int_t P0DVetoP0DEcalTracks
Number of P0DEcal tracks. Used in the P0D veto cut.
AnaTrackB * ECalVetoTrack
The most-upstream track containing ECal information.
AnaTrueObjectC * TrueObject
The link to the true oject that most likely generated this reconstructed object.
Float_t Momentum
The initial momentum of the true particle.
AnaTrueVertexB * TrueVertex
For storing the true vertex, for analyses with no reconstructed primary vertex.
Int_t TPCVetoNearTracks
Updated TPC veto.
AnaTrackB * HMPtrack
For storing the highest momentum positive track.
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
bool IsRelevantRecObjectForSystematicInToy(const AnaEventC &, const ToyBoxB &, AnaRecObjectC *, SystId_h systId, Int_t branch=0) const
Is this track relevant for a given systematic (after selection, called for each toy) ...
bool IsRelevantSystematic(const AnaEventC &event, const ToyBoxB &box, SystId_h systId, Int_t branch) const
Is this systematic relevant for this selection.
AnaEventInfoB EventInfo
Run, sunrun, event, time stamp, etc.
Float_t dEdxexpPion
Expected dE/dx for a pion, based on the reconstructed momentum.
Float_t Charge
The reconstructed charge of the particle.
Int_t ID
The ID of the trueObj, which corresponds to the ID of the TTruthParticle that created it...
Int_t SubRun
The subrun number.
Int_t P0DVetoFGD1Tracks
The number of tracks that start in FGD1. Used in the P0D veto cut.
Int_t nRecObjectsInGroup[NMAXRECOBJECTGROUPS]
----—— RecObjects and TrueRecObjects used in the selection and systematics ------------—— ...
Float_t Momentum
The reconstructed momentum of the particle, at the start position.
AnaVertexB * Vertex
For storing the reconstructed vertex.
int nTPCSegments
How many TPC tracks are associated with this track.
Representation of a true Monte Carlo trajectory/particle.
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
void InitializeEvent(AnaEventC &event)
Fill the EventBox with the objects needed by this selection.
int GetRunPeriod(int run, int subrun=-1)
Returns the run period (sequentially: 0,1,2,3,4,5 ...)
bool IsRelevantTrueObjectForSystematicInToy(const AnaEventC &, const ToyBoxB &, AnaTrueObjectC *, SystId_h systId, Int_t branch=0) const
Is this true track relevant for a given systematic (after selection, called for each toy) ...
AnaTrackB * VetoTrack
The TPC veto track.
Int_t PDG
The PDG code of this particle.
AnaTrackB * HMNtrack
For storing the highest momentum negative track.
Int_t ParentPDG
The PDG code of this particle's immediate parent, or 0 if there is no parent.
Float_t dEdxMeas
dE/dx as measured by the TPC.
AnaTrackB * SHMPtrack
For storing the second highest momentum positive track.
Representation of a global track.
AnaTrackB * HMtrack
For storing the highest momentum track.
Int_t NOOFVTracks
OOFV tracks.
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
AnaTrackB * SecondMostEnergeticFGDTPCTrack
The second most energetic TPC track in the same FGD as the main track.
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
Representation of a TPC segment of a global track.
AnaParticleB ** Particles
bool IsRelevantTrueObjectForSystematic(const AnaEventC &event, AnaTrueObjectC *trueTrack, SystId_h systId, Int_t branch) const
Is this true track relevant for a given systematic (prior to selection, call when initializing the ev...
Representation of a global vertex.
bool APPLY_SYST_FINE_TUNING
General tuning, the concept of apply the systematic for only the "relevant" objects.
bool InDetVolume(SubDetId::SubDetEnum det, const Float_t *pos)
bool Apply(AnaEventC &event, ToyBoxB &box) const
AnaEventSummaryC * Summary
A summary of the event with high level quantities.
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
bool CheckRedoSelection(const AnaEventC &eventC, const ToyBoxB &PreviousToyBox, Int_t &redoFromStep)
AnaTrackB * SHMNtrack
For storing the second highest momentum negative track.
AnaTrackB * PairTrack
The particle that isn't HMTrackSelected that forms the e+e- pair with the lowest invariant mass...
Float_t dEdxSigmaMuon
Expected error on the dE/dx measurement, for the muon hypothesis.
AnaTPCParticleB * GetTPCBackSegment(const AnaTrackB *track)
Get the most dowstream TPC segment of the track.
Float_t Position[4]
The initial position of the true particle.
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
void DefineSteps()
Define all steps in the selection.
AnaParticleB * GetSegmentWithMostNodesInClosestTpc(const AnaTrackB &track)
Combined function to address NuMu selection needs as efficiently as possible - gets the TPC segment w...
Float_t dEdxSigmaPion
Expected error on the dE/dx measurement, for the pion hypothesis.
AnaTrueParticleB * GetTrueParticle() const
Return a casted version of the AnaTrueObject associated.
bool InFiducialVolume(SubDetId::SubDetEnum det, const Float_t *pos, const Float_t *FVdefmin, const Float_t *FVdefmax)
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
Int_t P0DVetoP0DTracks
The number of tracks that start in the P0D. Used in the P0D veto cut.
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
A cut on event quality. Requires good beam and ND280 data quality flags.
AnaTrackB * OOFVtrack
For storing the oofv fgd tracks.
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
bool Apply(AnaEventC &event, ToyBoxB &boxB) const
Int_t Run
The ND280 run number.