1 #include "numuCC4piMultiPiFGD2Selection.hxx" 2 #include "baseSelection.hxx" 3 #include "SystematicTuning.hxx" 4 #include "CutUtils.hxx" 5 #include "EventBoxUtils.hxx" 6 #include "Parameters.hxx" 7 #include "SubDetId.hxx" 9 #include "SystematicUtils.hxx" 12 numuCC4piMultiPiFGD2Selection::numuCC4piMultiPiFGD2Selection(
bool forceBreak):
SelectionBase(forceBreak,
EventBoxId::kEventBoxTracker) {
16 systTuning::Initialize();
39 AddStep(0, StepBase::kCut,
"Fwd 4piMultiPi Cut",
new numuCC4pi::Fwd());
53 AddStep(1, StepBase::kCut,
"Bwd 4piMultiPi Cut",
new numuCC4pi::Bwd());
92 SetBranchAlias(0,
"Fwd CC0pi", 0, 0);
93 SetBranchAlias(1,
"Fwd CC1pi", 0, 1);
94 SetBranchAlias(2,
"Fwd CCOther", 0, 2);
96 SetBranchAlias(3,
"Bwd CC0pi", 1,0);
97 SetBranchAlias(4,
"Bwd CC1pi", 1,1);
98 SetBranchAlias(5,
"Bwd CCOther", 1,2);
100 SetBranchAlias(6,
"HAFwd CC0pi", 2,0);
101 SetBranchAlias(7,
"HAFwd CC1pi", 2,1);
102 SetBranchAlias(8,
"HAFwd CCOther", 2,2);
104 SetBranchAlias(9,
"HABwd CC0pi", 3,0);
105 SetBranchAlias(10,
"HABwd CC1pi", 3,1);
106 SetBranchAlias(11,
"HABwd CCOther", 3,2);
108 SetPreSelectionAccumLevel(2);
118 FVDef::FVdefminFGD2[2] = 0;
119 FVDef::FVdefmaxFGD2[2] = 0;
122 SetDetectorFV(SubDetId::kFGD2);
134 if (!event.EventBoxes[EventBoxId::kEventBoxTracker])
event.EventBoxes[EventBoxId::kEventBoxTracker] =
new EventBoxTracker();
136 boxUtils::FillTracksWithTPC(event, static_cast<SubDetId::SubDetEnum>(GetDetectorFV()));
137 boxUtils::FillTracksWithFGD(event, static_cast<SubDetId::SubDetEnum>(GetDetectorFV()));
138 boxUtils::FillTracksWithECal(event);
140 boxUtils::FillTrajsChargedInTPC(event);
141 boxUtils::FillTrajsChargedInFGDAndNoTPC(event, static_cast<SubDetId::SubDetEnum>(GetDetectorFV()));
142 boxUtils::FillTrajsChargedHATracker(event, static_cast<SubDetId::SubDetEnum>(GetDetectorFV()));
143 boxUtils::FillTrajsInECal(event);
148 bool numuCC4piMultiPiFGD2Selection::FillEventSummary(
AnaEventC& event, Int_t allCutsPassed[]){
151 if(allCutsPassed[0])
static_cast<AnaEventSummaryB*
>(
event.Summary)->EventSample = SampleId::kFGD2NuMuCC0Pi;
152 if(allCutsPassed[1])
static_cast<AnaEventSummaryB*
>(
event.Summary)->EventSample = SampleId::kFGD2NuMuCC1Pi;
153 if(allCutsPassed[2])
static_cast<AnaEventSummaryB*
>(
event.Summary)->EventSample = SampleId::kFGD2NuMuCCOther;
155 if(allCutsPassed[3])
static_cast<AnaEventSummaryB*
>(
event.Summary)->EventSample = SampleId::kFGD2NuMuCC0Pi;
156 if(allCutsPassed[4])
static_cast<AnaEventSummaryB*
>(
event.Summary)->EventSample = SampleId::kFGD2NuMuCC1Pi;
157 if(allCutsPassed[5])
static_cast<AnaEventSummaryB*
>(
event.Summary)->EventSample = SampleId::kFGD2NuMuCCOther;
159 if(allCutsPassed[6])
static_cast<AnaEventSummaryB*
>(
event.Summary)->EventSample = SampleId::kFGD2NuMuCC0Pi;
160 if(allCutsPassed[7])
static_cast<AnaEventSummaryB*
>(
event.Summary)->EventSample = SampleId::kFGD2NuMuCC1Pi;
161 if(allCutsPassed[8])
static_cast<AnaEventSummaryB*
>(
event.Summary)->EventSample = SampleId::kFGD2NuMuCCOther;
163 if(allCutsPassed[9])
static_cast<AnaEventSummaryB*
>(
event.Summary)->EventSample = SampleId::kFGD2NuMuCC0Pi;
164 if(allCutsPassed[10])
static_cast<AnaEventSummaryB*
>(
event.Summary)->EventSample = SampleId::kFGD2NuMuCC1Pi;
165 if(allCutsPassed[11])
static_cast<AnaEventSummaryB*
>(
event.Summary)->EventSample = SampleId::kFGD2NuMuCCOther;
167 return (static_cast<AnaEventSummaryB*>(event.
Summary)->EventSample != SampleId::kUnassigned);
177 if(!cc4piMultiPibox->
MainTrack)
return 1;
180 static_cast<AnaEventSummaryB*>(event.
Summary)->LeptonCandidate[SampleId::kFGD2NuMuCC1Pi] = cc4piMultiPibox->
MainTrack;
183 anaUtils::CopyArray( cc4piMultiPibox->
MainTrack->
PositionStart, static_cast<AnaEventSummaryB*>(event.
Summary)->VertexPosition[SampleId::kFGD2NuMuCC0Pi], 4);
184 anaUtils::CopyArray( cc4piMultiPibox->
MainTrack->
PositionStart, static_cast<AnaEventSummaryB*>(event.
Summary)->VertexPosition[SampleId::kFGD2NuMuCC1Pi], 4);
185 anaUtils::CopyArray( cc4piMultiPibox->
MainTrack->
PositionStart, static_cast<AnaEventSummaryB*>(event.
Summary)->VertexPosition[SampleId::kFGD2NuMuCCOther], 4);
217 if (!track)
return false;
234 if (!trueTrack)
return false;
251 if(systId == SystId::kTpcClusterEff){
255 if (tpcTrack->
NNodes > 16 && tpcTrack->
NNodes < 19)
return true;
260 if(systId == SystId::kChargeIDEff){
261 if (track == cc4piMultiPibox.
MainTrack)
return true;
264 if(systId == SystId::kTpcFgdMatchEff){
265 if (track == cc4piMultiPibox.
MainTrack)
return true;
268 if(systId == SystId::kECalPID){
269 if (track == cc4piMultiPibox.
MainTrack) {
270 if (branch==2 || branch==3)
return true;
271 else if (branch==0 || branch==4 || branch==5) {
296 if(systId == SystId::kTpcTrackEff){
301 if(systId == SystId::kECalTrackEff){
306 if(systId == SystId::kTpcP0dMatchEff){
310 if(systId == SystId::kTpcECalMatchEff){
314 if(systId == SystId::kFgdECalMatchEff){
318 if(systId == SystId::kFgdECalSmrdMatchEff){
322 if(systId == SystId::kSIPion){
337 if(systId == SystId::kSIProton){
359 (void)PreviousToyBoxB;
AnaTrueVertexB * TrueVertex
Pointer to the AnaTrueVertexB of the interaction that created this AnaTrueParticleB.
void DefineSteps()
Define all steps in the selection.
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) ...
Float_t PositionStart[4]
The reconstructed start position of the particle.
bool IsRelevantRecObjectForSystematic(const AnaEventC &event, AnaRecObjectC *recObj, SystId_h systId, Int_t branch) const
Is this track relevant for a given systematic (prior to selection, call when initializing the event...
bool IsRelevantTrueObjectForSystematic(const AnaEventC &event, AnaTrueObjectC *trueObj, SystId_h systId, Int_t branch) const
Is this true track relevant for a given systematic (prior to selection, call when initializing the ev...
Int_t NNodes
The number of nodes in the reconstructed object.
Int_t GParentPDG
The PDG code of this particle's grandparent, or 0 if there is no grandparent.
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) ...
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.
bool TrackUsesDet(const AnaTrackB &track, SubDetId::SubDetEnum det)
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...
bool IsRelevantSystematic(const AnaEventC &event, const ToyBoxB &box, SystId_h systId, Int_t branch) const
Is this systematic relevant for this selection.
void DefineDetectorFV()
Define the detector Fiducial Volume in which this selection is applied.
Float_t Momentum
The reconstructed momentum of the particle, at the start position.
int nTPCSegments
How many TPC tracks are associated with this track.
Representation of a true Monte Carlo trajectory/particle.
Int_t PDG
The PDG code of this particle.
Int_t ParentPDG
The PDG code of this particle's immediate parent, or 0 if there is no parent.
void InitializeEvent(AnaEventC &event)
Fill the EventBox with the objects needed by this selection.
Representation of a global track.
Representation of a TPC segment of a global track.
AnaTrackB * MainTrack
For storing tracks information in the bunch.
AnaEventSummaryC * Summary
A summary of the event with high level quantities.
bool CheckRedoSelection(const AnaEventC &event, const ToyBoxB &PreviousToyBox, Int_t &redoFromStep)
bool Apply(AnaEventC &event, ToyBoxB &box) const
AnaParticleB * GetSegmentWithMostNodesInClosestTpc(const AnaTrackB &track)
Combined function to address NuMu selection needs as efficiently as possible - gets the TPC segment w...
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)
A cut on event quality. Requires good beam and ND280 data quality flags.
Float_t PositionEnd[4]
The reconstructed end position of the particle.