HighLAND
numuCC4piMultiPiSelection.hxx
1 #ifndef numuCC4piMultiPiSelection_h
2 #define numuCC4piMultiPiSelection_h
3 
4 #include "SelectionBase.hxx"
5 #include "Parameters.hxx"
6 #include "ToyBoxTracker.hxx"
7 #include "EventBoxId.hxx"
8 #include "SystId.hxx"
9 #include "SubDetId.hxx"
10 
11 #include "ToFSenseCorrector.hxx"
12 
13 #include "numuCC4piSelection.hxx"
14 
16 public:
17  numuCC4piMultiPiSelection(bool forceBreak=true);
18  virtual ~numuCC4piMultiPiSelection(){}
19 
20  //---- These are mandatory functions
21  void DefineSteps();
22  void DefineDetectorFV();
23  inline ToyBoxB* MakeToyBox();
24  bool FillEventSummary(AnaEventC& event, Int_t allCutsPassed[]);
25  SampleId::SampleEnum GetSampleEnum(){return SampleId::kFGD1NuMuCC0Pi;}
26  bool IsRelevantRecObjectForSystematic(const AnaEventC& event, AnaRecObjectC* recObj, SystId_h systId, Int_t branch) const;
27  bool IsRelevantRecObjectForSystematicInToy(const AnaEventC&, const ToyBoxB&, AnaRecObjectC*, SystId_h systId, Int_t branch=0) const;
28  bool IsRelevantTrueObjectForSystematic(const AnaEventC& event, AnaTrueObjectC* trueObj, SystId_h systId, Int_t branch) const;
29  bool IsRelevantTrueObjectForSystematicInToy(const AnaEventC&, const ToyBoxB&, AnaTrueObjectC*, SystId_h systId, Int_t branch=0) const;
30  bool IsRelevantSystematic(const AnaEventC& event, const ToyBoxB& box, SystId_h systId, Int_t branch) const;
31  void InitializeEvent(AnaEventC& event);
32  bool CheckRedoSelection(const AnaEventC& event, const ToyBoxB& PreviousToyBox, Int_t& redoFromStep);
33 
34 private:
35  ToFSenseCorrector _tofCorrector;
36 
37 };
38 
40 
41 public:
42 
44  MainTrack = NULL;
45  LowAngle.clear(); HighAngle.clear();
46  FwdTracks.clear(); BwdTracks.clear(); HAFwdTracks.clear(); HABwdTracks.clear();
47  FwdTracks_Veto.clear(); BwdTracks_Veto.clear(); HAFwdTracks_Veto.clear(); HABwdTracks_Veto.clear();
48  FwdTracks_PID.clear(); BwdTracks_PID.clear(); HAFwdTracks_PID.clear(); HABwdTracks_PID.clear();
49 
50  nPositivePionTPCtracks = 0;
51  nNegativePionTPCtracks = 0;
52  nMichelElectrons = 0;
53  nIsoFGDPiontracks = 0;
54  nPosPi0TPCtracks = 0;
55  nElPi0TPCtracks = 0;
56  nIsoFGDElPi0tracks = 0;
57  nPosPions = 0;
58  nOtherPions = 0;
59 
60  // For ECal Pi0 veto
61  ISOEcal.clear();
62  HObject = NULL;
63  Pi0Ecaltrack = NULL;
64  nPi0Ecaltracks = 0;
65 
66  for( int i = 0; i < 100; i ++){
67  PositivePionTPCtracks[i] = NULL;
68  NegativePionTPCtracks[i] = NULL;
69  MichelElectrons[i] = NULL;
70  IsoFGDPiontracks[i] = NULL;
71  PosPi0TPCtracks[i] = NULL;
72  ElPi0TPCtracks[i] = NULL;
73  IsoFGDElPi0tracks[i] = NULL;
74  }
75  }
76 
77  virtual void Reset(){
78  ResetBase();
79  MainTrack = NULL;
80  LowAngle.clear(); HighAngle.clear();
81  FwdTracks.clear(); BwdTracks.clear(); HAFwdTracks.clear(); HABwdTracks.clear();
82  FwdTracks_Veto.clear(); BwdTracks_Veto.clear(); HAFwdTracks_Veto.clear(); HABwdTracks_Veto.clear();
83  FwdTracks_PID.clear(); BwdTracks_PID.clear(); HAFwdTracks_PID.clear(); HABwdTracks_PID.clear();
84 
85  for( int i = 0; i <nPositivePionTPCtracks ; i ++)
86  PositivePionTPCtracks[i] = NULL;
87  for( int i = 0; i <nNegativePionTPCtracks ; i ++)
88  NegativePionTPCtracks[i] = NULL;
89  for( int i = 0; i <nMichelElectrons ; i ++)
90  MichelElectrons[i] = NULL;
91  for( int i = 0; i <nIsoFGDPiontracks ; i ++)
92  IsoFGDPiontracks[i] = NULL;
93  for( int i = 0; i <nPosPi0TPCtracks ; i ++)
94  PosPi0TPCtracks[i] = NULL;
95  for( int i = 0; i <nElPi0TPCtracks ; i ++)
96  ElPi0TPCtracks[i] = NULL;
97  for( int i = 0; i <nIsoFGDElPi0tracks ; i ++)
98  IsoFGDElPi0tracks[i] = NULL;
99 
100  nPositivePionTPCtracks = 0;
101  nNegativePionTPCtracks = 0;
102  nMichelElectrons = 0;
103  nIsoFGDPiontracks = 0;
104  nPosPi0TPCtracks = 0;
105  nElPi0TPCtracks = 0;
106  nIsoFGDElPi0tracks = 0;
107  nPosPions = 0;
108  nOtherPions = 0;
109 
110  ISOEcal.clear();
111  HObject = NULL;
112  Pi0Ecaltrack = NULL;
113  nPi0Ecaltracks = 0;
114  }
115 
116  virtual ~ToyBoxCC4piMultiPi(){}
117 
118 
119  // positive TPC pion candidates
120  AnaTrackB* PositivePionTPCtracks[100];
121  int nPositivePionTPCtracks;
122 
123  // negative TPC pion candidates
124  AnaTrackB* NegativePionTPCtracks[100];
125  int nNegativePionTPCtracks;
126 
127  // Michel Electron candidates
128  AnaFgdTimeBinB* MichelElectrons[100];
129  int nMichelElectrons;
130 
131  // IsoFGD Pion candidates
132  AnaTrackB* IsoFGDPiontracks[100];
133  int nIsoFGDPiontracks;
134 
135  // Electrons and positrons from Pio in the TPC
136  AnaTrackB* PosPi0TPCtracks[100];
137  AnaTrackB* ElPi0TPCtracks[100];
138  int nPosPi0TPCtracks;
139  int nElPi0TPCtracks;
140 
141  // IsoFGD electron and positron candidates
142  AnaTrackB* IsoFGDElPi0tracks[100];
143  int nIsoFGDElPi0tracks;
144 
145  int nPosPions;
146  int nOtherPions;
147 
148  // isoECal track
149  std::vector<AnaTrackB*> ISOEcal;
150  // Most energetic object in ECal
151  AnaTrackB* HObject;
152  // Candidate Pi0 from Ecal veto
153  AnaTrackB* Pi0Ecaltrack;
154 
155  int nPi0Ecaltracks;
156 };
157 
159 
161 public:
162  using StepBase::Apply;
163  bool Apply(AnaEventC& event, ToyBoxB& box) const;
165 };
166 
167 namespace numuCC4piMultiPi{
168 
169  class FindPionsAction: public StepBase{
170  public:
171  using StepBase::Apply;
172  FindPionsAction(){
173  useTPCPions = (bool)ND::params().GetParameterI("psycheSelections.numuCC4piMultiPi.UseTPCPions");
174  useME = (bool)ND::params().GetParameterI("psycheSelections.numuCC4piMultiPi.UseME");
175  useFGDPions = (bool)ND::params().GetParameterI("psycheSelections.numuCC4piMultiPi.UseFGDPions");
176  useOldSecondaryPID = (bool) ND::params().GetParameterI("psycheSelections.numuCC4piMultiPi.OldSecondaryPID");
177  prod5Cut = (bool)ND::params().GetParameterI("psycheSelections.numuCC4piMultiPi.Prod5Cuts");
178  }
179  bool useTPCPions;
180  bool useME;
181  bool useFGDPions;
182  bool useOldSecondaryPID;
183  bool prod5Cut;
184 
185  bool Apply(AnaEventC& event, ToyBoxB& box) const;
187  };
188 
190  public:
191  using StepBase::Apply;
193  MostUpstreamLayerHitCut = (bool)ND::params().GetParameterI("psycheSelections.numuCC4piMultiPi.MostUpstreamLayerHitCut");
194  prod5Cut = (bool)ND::params().GetParameterI("psycheSelections.numuCC4piMultiPi.Prod5Cuts");
195  }
196  int MostUpstreamLayerHitCut;
197  bool prod5Cut;
198 
199  bool Apply(AnaEventC& event, ToyBoxB& box) const;
201  };
202 
203  class EcalPi0VetoCut: public StepBase{
204  public:
205  using StepBase::Apply;
206  bool Apply(AnaEventC& event, ToyBoxB& box) const;
208  };
209 
210 
211  class NoPionCut: public StepBase{
212  public:
213  using StepBase::Apply;
214  bool Apply(AnaEventC& event, ToyBoxB& box) const;
215  StepBase* MakeClone(){return new NoPionCut();}
216  };
217 
218  class OnePionCut: public StepBase{
219  public:
220  using StepBase::Apply;
221  bool Apply(AnaEventC& event, ToyBoxB& box) const;
222  StepBase* MakeClone(){return new OnePionCut();}
223  };
224 
225  class OthersCut: public StepBase{
226  public:
227  using StepBase::Apply;
228  bool Apply(AnaEventC& event, ToyBoxB& box) const;
229  StepBase* MakeClone(){return new OthersCut();}
230  };
231 }
232 namespace numuCC4piMultiPiUtils{
233 
234  //From NumuCCBANFF Standard Actions.
235  void FindTPCPions(AnaEventC& event, ToyBoxB& box, SubDetId::SubDetEnum det, bool useOldSecondaryPID);
236  void FindIsoFGDPions(AnaEventC& event, ToyBoxB& box, SubDetId::SubDetEnum det);
237  void FindIsoFGDElPi0(AnaEventC& event, ToyBoxB& box, SubDetId::SubDetEnum det);
238  void FindMEPions(AnaEventC& event, SubDetId::SubDetEnum det, bool prod5Cut = 0);
239 
240  //From NumuCCBANFF Analysis Utils.
241  bool TPCpionSelection(AnaTrackB *track);
242  bool TPCElPi0Selection(AnaTrackB *track);
243  bool FGDpionSelection(AnaTrackB *track, SubDetId::SubDetEnum det);
244  bool FGDElPi0Selection(AnaEventC& event, ToyBoxB& box, AnaTrackB *track, SubDetId::SubDetEnum det);
245 
246  // For ECal Pi0 veto
247  bool ECALPi0Selection(AnaEventC& event, ToyBoxB& box, AnaTrackB *HO, int MostUpstreamLayerHitCut, SubDetId::SubDetEnum det);
248 }
249 
250 
251 #endif
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) ...
int GetParameterI(std::string)
Get parameter. Value is returned as integer.
Definition: Parameters.cxx:217
void InitializeEvent(AnaEventC &event)
Fill the EventBox with the objects needed by this selection.
void DefineDetectorFV()
Define the detector Fiducial Volume in which this selection is applied.
bool IsRelevantSystematic(const AnaEventC &event, const ToyBoxB &box, SystId_h systId, Int_t branch) const
Is this systematic relevant for this selection.
bool CheckRedoSelection(const AnaEventC &event, const ToyBoxB &PreviousToyBox, Int_t &redoFromStep)
StepBase * MakeClone()
MANDATORY FUNCTIONS !!!
void DefineSteps()
Define all steps in the selection.
StepBase * MakeClone()
MANDATORY FUNCTIONS !!!
SubDetEnum
Enumeration of all detector systems and subdetectors.
Definition: SubDetId.hxx:25
virtual bool Apply(AnaEventC &event, ToyBoxB &box) const
Definition: StepBase.hxx:46
Representation of a global track.
bool Apply(AnaEventC &event, bool &redo)
Apply all steps in the selection.
StepBase * MakeClone()
MANDATORY FUNCTIONS !!!
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...
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...
StepBase * MakeClone()
MANDATORY FUNCTIONS !!!
virtual void Reset()
This method should be implemented by the derived class. If so it does nothing here.
ToyBoxB * MakeToyBox()
Create the appropriate type of box.
StepBase * MakeClone()
MANDATORY FUNCTIONS !!!
StepBase * MakeClone()
MANDATORY FUNCTIONS !!!
ToyBoxB ** PreviousToyBox
Array of pointers to the PreviousToyBox (for each event)
StepBase * MakeClone()
MANDATORY FUNCTIONS !!!
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) ...