HighLAND
CoreDataClasses.cxx
1 #define CoreDataClasses_C
2 
3 #include "CoreDataClasses.hxx"
4 #include "TMath.h"
5 
6 //********************************************************************
7 AnaRecObjectC::AnaRecObjectC(){
8 //********************************************************************
9 
10  UniqueID = -999;
11  Status = -999;
12  Detector = 0;
13  TrueObject = NULL;
14 }
15 
16 //********************************************************************
17 AnaRecObjectC::~AnaRecObjectC(){
18 //********************************************************************
19 
20 }
21 
22 //********************************************************************
23 AnaRecObjectC::AnaRecObjectC(const AnaRecObjectC& recObj){
24 //********************************************************************
25 
26  Status = recObj.Status;
27  Detector = recObj.Detector;
28  UniqueID = recObj.UniqueID;
29 
30  // The associated true recObj
31  TrueObject = recObj.TrueObject;
32 }
33 
34 //********************************************************************
35 void AnaRecObjectC::Print() const{
36 //********************************************************************
37 
38  std::cout << "-------- AnaRecObjectC --------- " << std::endl;
39 
40  std::cout << "UniqueID: " << UniqueID << std::endl;
41 }
42 
43 //********************************************************************
44 AnaTrueObjectC::AnaTrueObjectC(){
45 //********************************************************************
46 
47  ID = -999;
48 }
49 
50 //********************************************************************
51 AnaTrueObjectC::~AnaTrueObjectC(){
52 //********************************************************************
53 
54 }
55 
56 //********************************************************************
57 AnaTrueObjectC::AnaTrueObjectC(const AnaTrueObjectC& trueObj){
58 //********************************************************************
59 
60  ID = trueObj.ID;
61 }
62 
63 //********************************************************************
64 void AnaTrueObjectC::Print() const{
65 //********************************************************************
66 
67  std::cout << "-------- AnaTrueObjectC --------- " << std::endl;
68 
69  std::cout << "ID: " << ID << std::endl;
70 }
71 
72 //********************************************************************
73 EventBoxB::EventBoxB(){
74 //********************************************************************
75 
76  for (UInt_t i=0;i<NMAXRECOBJECTGROUPS;i++){
77  nRecObjectsInGroup[i]=0;
78  RecObjectsInGroup[i]=NULL;
79  }
80 
81  for (UInt_t i=0;i<NMAXTRUEOBJECTGROUPS;i++){
82  nTrueObjectsInGroup[i]=0;
83  TrueObjectsInGroup[i]=NULL;
84  }
85 }
86 
87 //********************************************************************
88 EventBoxB::~EventBoxB(){
89 //********************************************************************
90 
91  for (UInt_t i=0;i<NMAXRECOBJECTGROUPS;i++){
92  if (RecObjectsInGroup[i])
93  delete [] RecObjectsInGroup[i];
94  RecObjectsInGroup[i] = NULL;
95  }
96 
97  for (UInt_t i=0;i<NMAXTRUEOBJECTGROUPS;i++){
98  if (TrueObjectsInGroup[i])
99  delete [] TrueObjectsInGroup[i];
100  TrueObjectsInGroup[i] = NULL;
101  }
102 }
103 
104 //********************************************************************
105 AnaBunchC::AnaBunchC(){
106 //********************************************************************
107 
108  Bunch = -999;
109  // The initial weight of the bunch is 1;
110  Weight=1;
111 }
112 
113 //********************************************************************
114 AnaBunchC::~AnaBunchC(){
115 //********************************************************************
116 
117 }
118 
119 //********************************************************************
120 AnaBunchC::AnaBunchC(const AnaBunchC& bunch){
121 //********************************************************************
122 
123  Bunch = bunch.Bunch;
124  Weight = bunch.Weight;
125 }
126 
127 //********************************************************************
128 void AnaBunchC::Print() const{
129 //********************************************************************
130 
131  std::cout << "Bunch: " << Bunch << std::endl;
132  std::cout << "Weight: " << Weight << std::endl;
133 }
134 
135 
136 //********************************************************************
137 AnaSpillC::AnaSpillC(){
138 //********************************************************************
139 
140  isClone = false;
141 
142  Bunches.clear();
143 }
144 
145 //********************************************************************
146 AnaSpillC::~AnaSpillC(){
147 //********************************************************************
148 
149  for (UInt_t i=0;i<Bunches.size();i++)
150  delete Bunches[i];
151 
152  Bunches.clear();
153 }
154 
155 //********************************************************************
156 AnaSpillC::AnaSpillC(const AnaSpillC& spill){
157 //********************************************************************
158 
159  Bunches.clear();
160  for (UInt_t i=0;i<spill.Bunches.size();i++)
161  Bunches.push_back(spill.Bunches[i]->Clone());
162 }
163 
164 //********************************************************************
165 void AnaSpillC::Print() const{
166 //********************************************************************
167 
168 }
169 
170 //********************************************************************
171 AnaEventC::AnaEventC(){
172 //********************************************************************
173 
174  UniqueID = 0;
175  // DataQuality = NULL;
176  isClone = false;
177 
178  nEventBoxes=0;
179  for (UInt_t i=0;i<NMAXEVENTBOXES;i++)
180  EventBoxes[i]=NULL;
181 
182  // The initial weight of the Event is 1;
183  Weight=1;
184 
185  // Must create a summary object when we create an event
186  // This is initialised to NULL and SampleId::kUnassigned, so you know it has not passed a selection
187  // Summary = new AnaEventSummaryC();
188 }
189 
190 //********************************************************************
191 AnaEventC::~AnaEventC(){
192 //********************************************************************
193 /*
194  if (DataQuality){
195  delete DataQuality;
196  DataQuality = NULL;
197  }
198 */
199  nEventBoxes=0;
200  for (UInt_t i=0;i<NMAXEVENTBOXES;i++){
201  if (EventBoxes[i]) delete EventBoxes[i];
202  EventBoxes[i]=NULL;
203  }
204 
205  if(!isClone){
206  if (Summary){
207  delete Summary;
208  Summary = NULL;
209  }
210  }
211  else{
212  Summary = NULL;
213  }
214 }
215 
216 //********************************************************************
217 void AnaEventC::Copy(const AnaEventC& event, bool copyBunchInfo, bool cloneTruth){
218 //********************************************************************
219 
220  (void) cloneTruth;
221 
222  if (copyBunchInfo){
223  Weight = event.Weight;
224  Summary = event.Summary;
225  }
226 
227  nEventBoxes=0;
228  for (UInt_t i=0;i<NMAXEVENTBOXES;i++)
229  EventBoxes[i]=NULL;
230 
231  UniqueID = event.UniqueID;
232 
233 }
234 
235 //********************************************************************
236 AnaEventC::AnaEventC(const AnaEventC& event){
237 //********************************************************************
238 
239  // copy bunch info but don't clone truth
240  Copy(event, true, false);
241 }
242 
243 //********************************************************************
244 void AnaEventC::Print() const{
245 //********************************************************************
246 
247  std::cout << "-------- AnaEventC --------- " << std::endl;
248 
249 
250  //EventInfo.Print();
251 
252  // std::cout << "Good DQ: " << DataQuality->GoodDaq << std::endl;
253  // std::cout << "Good Spill: " << Beam->GoodSpill << std::endl;
254 
255 }
256 
257 //********************************************************************
258 AnaSuperEventB::AnaSuperEventB(){
259 //********************************************************************
260  RawEvent = NULL;
261  Event = NULL;
262 }
263 
264 //********************************************************************
265 AnaSuperEventB::AnaSuperEventB(AnaEventC* event){
266 //********************************************************************
267  RawEvent = event;
268  Event = RawEvent->Clone();
269  POTWeight = 1.0;
270 }
271 
272 //********************************************************************
273 AnaSuperEventB::~AnaSuperEventB(){
274 //********************************************************************
275  delete RawEvent;
276  delete Event;
277  RawEvent = NULL;
278  Event = NULL;
279 }
280 
281 //********************************************************************
282 AnaSuperEventB::AnaSuperEventB(const AnaSuperEventB& sevent){
283 //********************************************************************
284 
285  Event = sevent.RawEvent->Clone();
286  POTWeight = sevent.POTWeight;
287 
288 }
289 
290 
virtual void Print() const
Dump the object to screen.
unsigned long Detector
Int_t Status
The Status of the fit of this reconstructed object.
virtual void Print() const
Dump the object to screen.
std::vector< AnaBunchC * > Bunches
The reconstructed objects, split into timing bunches.
virtual void Copy(const AnaEventC &event, bool copyBunchInfo=true, bool cloneTruth=true)
Copy the entire object.
AnaTrueObjectC * TrueObject
The link to the true oject that most likely generated this reconstructed object.
virtual AnaEventC * Clone()=0
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...
void Print() const
Dump the object to screen.
virtual void Print() const
Dump the object to screen.
Float_t Weight
The weight to apply to this bunch (nominally 1). An example is the beam flux weight.
AnaEventC * RawEvent
The Raw event.
Int_t Bunch
The index of this bunch (0-7).
void Print() const
Dump the object to screen.
Float_t POTWeight
The data/MC POT ratio.