HighLAND
CoreDataClasses.hxx
1 #ifndef CoreDataClasses_hxx
2 #define CoreDataClasses_hxx
3 
4 #include <sstream>
5 #include <fstream>
6 #include <stdio.h>
7 #include <iostream>
8 
9 #include "TVector3.h"
10 #include "TLorentzVector.h"
11 #include "BasicTypes.hxx"
12 
13 /// Classes for high level analysis. All input formats (oaAnalysis, flatTree, etc)
14 /// are converted into these data classes, which are later used in the actual analysis.
15 ///
16 
17 ///Array printing
18 
19 #define dump_array4(par) std::cout<< #par << ": \t" << par[0] << " " << par[1] << " " << par[2] << " " << par[3] << std::endl;
20 #define dump_array3(par) std::cout<< #par << ": \t" << par[0] << " " << par[1] << " " << par[2] << std::endl;
21 
22 
23 
24 const UInt_t NMAXRECOBJECTGROUPS = 20;
25 const UInt_t NMAXTRUEOBJECTGROUPS = 20;
26 
27 const UInt_t NMAXEVENTBOXES = 5;
28 
30  public :
31 
33  virtual ~AnaTrueObjectC();
34 
35  /// Clone this object.
36  virtual AnaTrueObjectC* Clone() {
37  return new AnaTrueObjectC(*this);
38  }
39 
40  /// Dump the object to screen.
41  void Print() const;
42 
43  protected:
44 
45  /// Copy constructor is protected, as Clone() should be used to copy this object.
46  AnaTrueObjectC(const AnaTrueObjectC& trueObj);
47 
48  public:
49 
50  /// The ID of the trueObj, which corresponds to the ID of the TTruthParticle that created it
51  Int_t ID;
52 };
53 
55  public :
56 
57  AnaRecObjectC();
58  virtual ~AnaRecObjectC();
59 
60  /// Clone this object.
61  virtual AnaRecObjectC* Clone() {
62  return new AnaRecObjectC(*this);
63  }
64 
65  /// Dump the object to screen.
66  void Print() const;
67 
68  protected:
69 
70  /// Copy constructor is protected, as Clone() should be used to copy this object.
71  AnaRecObjectC(const AnaRecObjectC& recObj);
72 
73  public:
74 
75  /// The UniqueID of this reconstructed object.
76  Int_t UniqueID;
77 
78  /// The Status of the fit of this reconstructed object.
79  Int_t Status;
80 
81  /// The link to the true oject that most likely generated this reconstructed object
83 
84  /// Bit field describing the detector that the object is in.
85  /// See SubDetId.hxx for the detector enumerations used to
86  /// interrogate this object
87  unsigned long Detector;
88 };
89 
91  public :
92 
94  virtual ~AnaEventSummaryC(){}
95 
96 
97  /*
98  AnaEventSummaryC() {
99  for(int i = 0; i < SampleId::kNSamples; ++i){
100  LeptonCandidate[i]=NULL;
101  RooVertexIndex[i] = -1;
102  TrueVertex[i] = NULL;
103  for(int j = 0; j < 4; ++j){
104  VertexPosition[i][j] = -9999;
105  }
106  }
107  EventSample = SampleId::kUnassigned;
108  }
109  virtual ~AnaEventSummaryC(){}
110 
111  void ResetSummary(){
112  for(int i = 0; i < SampleId::kNSamples; ++i){
113  LeptonCandidate[i]=NULL;
114  RooVertexIndex[i] = -1;
115  TrueVertex[i] = NULL;
116  for(int j = 0; j < 4; ++j){
117  VertexPosition[i][j] = -9999;
118  }
119  }
120  EventSample = SampleId::kUnassigned;
121  }
122 
123  /// A pointer to the Lepton Candidate
124  AnaParticleB* LeptonCandidate[SampleId::kNSamples];
125 
126  /// A pointer to the event's true vertex
127  AnaTrueVertexB* TrueVertex[SampleId::kNSamples];
128 
129  /// Event recon vertex position
130  float VertexPosition[SampleId::kNSamples][4];
131 
132  /// Event sample - whether it passes the NuMu-CCQE selection, or CC1Pi selection for example
133  SampleId::SampleEnum EventSample;
134 
135  /// The link to the RooTrackerVtx tree
136  UInt_t RooVertexIndex[SampleId::kNSamples];
137  */
138 };
139 
140 
141 class EventBoxB{
142  public :
143 
144  EventBoxB();
145  virtual ~EventBoxB();
146 
147  ///---------- RecObjects and TrueRecObjects used in the selection and systematics ------------------
148 
149  /// Different groups of rec objects used for selection and systematics
150  Int_t nRecObjectsInGroup[NMAXRECOBJECTGROUPS];
151  AnaRecObjectC** RecObjectsInGroup[NMAXRECOBJECTGROUPS];
152 
153  /// Different groups of rec objects used for systematics
154  Int_t nTrueObjectsInGroup[NMAXTRUEOBJECTGROUPS];
155  AnaTrueObjectC** TrueObjectsInGroup[NMAXTRUEOBJECTGROUPS];
156 };
157 
158 class AnaBunchC{
159  public :
160 
161  AnaBunchC();
162  virtual ~AnaBunchC();
163 
164  /// Clone this object.
165  virtual AnaBunchC* Clone() {
166  return new AnaBunchC(*this);
167  }
168 
169  /// Dump the object to screen.
170  virtual void Print() const;
171 
172  protected:
173 
174  /// Copy constructor is protected, as Clone() should be used to copy this object.
175  AnaBunchC(const AnaBunchC& bunch);
176 
177  public:
178 
179  /// The index of this bunch (0-7).
180  Int_t Bunch;
181 
182  /// The weight to apply to this bunch (nominally 1). An example is the beam flux weight
183  Float_t Weight;
184 };
185 
186 
187 class AnaSpillC{
188  public :
189 
190  AnaSpillC();
191  virtual ~AnaSpillC();
192 
193  /// Clone this object.
194  virtual AnaSpillC* Clone() = 0;
195 
196  /// Dump the object to screen.
197  virtual void Print() const;
198 
199  /// Return whether this spill is from Monte Carlo or not.
200  virtual bool GetIsMC() const = 0;
201 
202  /// Copy the arrays into std vectors, needed for FlatTree creation
203  virtual void CopyArraysIntoVectors() = 0;
204 
205  /// Copy the vectore into the arrays, needed after FlatTree reading
206  virtual void CopyVectorsIntoArrays() = 0;
207 
208  /// Redo reco-reco and reco-truth after cloning or reading MiniTree
209  virtual void RedoLinks() = 0;
210 
211 
212 protected:
213 
214  /// Copy constructor is protected, as Clone() should be used to copy this object.
215  AnaSpillC(const AnaSpillC&);
216 
217 public:
218  /// Is this the original Event or a clone
219  bool isClone;
220 
221  /// The reconstructed objects, split into timing bunches.
222  std::vector<AnaBunchC*> Bunches;
223 
224 };
225 
226 class AnaEventC{
227  public :
228 
229  AnaEventC();
230  virtual ~AnaEventC();
231 
232  /// Clone this object.
233  virtual AnaEventC* Clone() = 0;
234 
235  /// Return whether this event is from Monte Carlo or not.
236  virtual bool GetIsMC() const = 0;
237 
238  /// Copy the entire object
239  virtual void Copy(const AnaEventC& event, bool copyBunchInfo = true, bool cloneTruth=true);
240 
241  /// Dump the object to screen.
242  virtual void Print() const;
243 
244  /// User-frienly method to get event info (run,subrun,etc)
245  virtual std::string GetEventInfoString() const {return "";}
246 
247  protected:
248 
249  /// Copy constructor is protected, as Clone() should be used to copy this object.
250  AnaEventC(const AnaEventC& event);
251 
252  public:
253 
254  /// The event unique ID
255  Int_t UniqueID;
256 
257  /// Is this the original Event or a clone
258  bool isClone;
259 
260  /// Run, subrun, event, time stamp, etc
261  // AnaEventInfoB EventInfo;
262 
263  /// The ND280 data quality flags for this event.
264  // AnaDataQualityB* DataQuality;
265 
266  /// The weight to apply to this event (nominally 1). An example is the beam flux weight
267  Float_t Weight;
268 
269  //---------------------------------------------------------
270 
271  /// A summary of the event with high level quantities
273 
274  /// The array of boxes where objects that are valid for all toys are stored
275  Int_t nEventBoxes;
276  EventBoxB* EventBoxes[NMAXEVENTBOXES];
277 };
278 
280  public :
281 
282  AnaSuperEventB();
283  AnaSuperEventB(AnaEventC* event);
284  virtual ~AnaSuperEventB();
285 
286  /// Clone this object.
287  virtual AnaSuperEventB* Clone() {
288  AnaSuperEventB* event = new AnaSuperEventB(*this);
289  event->isClone=true;
290  return event;
291  }
292 
293  protected:
294 
295  /// Copy constructor is protected, as Clone() should be used to copy this object.
296  AnaSuperEventB(const AnaSuperEventB& event);
297 
298  public:
299 
300  /// Is this the original Event or a clone
301  bool isClone;
302 
303  /// The Raw event
305 
306  /// The modified event
308 
309  /// The data/MC POT ratio
310  Float_t POTWeight;
311 
312 };
313 
314 
315 #endif
unsigned long Detector
AnaEventC * Event
The modified event.
virtual AnaRecObjectC * Clone()
Clone this object.
Int_t Status
The Status of the fit of this reconstructed object.
std::vector< AnaBunchC * > Bunches
The reconstructed objects, split into timing bunches.
virtual AnaTrueObjectC * Clone()
Clone this object.
AnaTrueObjectC * TrueObject
The link to the true oject that most likely generated this reconstructed object.
virtual AnaBunchC * Clone()
Clone this object.
Int_t UniqueID
The UniqueID of this reconstructed object.
Int_t ID
The ID of the trueObj, which corresponds to the ID of the TTruthParticle that created it...
bool isClone
Is this the original Event or a clone.
Int_t UniqueID
The event unique ID.
bool isClone
Is this the original Event or a clone.
Float_t Weight
The weight to apply to this bunch (nominally 1). An example is the beam flux weight.
Float_t Weight
Run, subrun, event, time stamp, etc.
AnaEventC * RawEvent
The Raw event.
AnaEventSummaryC * Summary
A summary of the event with high level quantities.
Int_t Bunch
The index of this bunch (0-7).
virtual AnaSuperEventB * Clone()
Clone this object.
bool isClone
Is this the original Event or a clone.
void Print() const
Dump the object to screen.
virtual std::string GetEventInfoString() const
User-frienly method to get event info (run,subrun,etc)
Int_t nEventBoxes
The array of boxes where objects that are valid for all toys are stored.
Float_t POTWeight
The data/MC POT ratio.