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