]>
Commit | Line | Data |
---|---|---|
70da6c5a | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
27de2dfb | 15 | |
16 | /* $Id$ */ | |
17 | ||
70da6c5a | 18 | // |
19 | // HFE correction framework container | |
20 | // Contains many single containers | |
21 | // Extra fuctionality like appending added | |
22 | // | |
23 | // Author: | |
24 | // Markus Fasel <M.Fasel@gsi.de> | |
25 | // | |
26 | #include <iostream> | |
27 | #include <TAxis.h> | |
28 | #include <TClass.h> | |
29 | #include <TCollection.h> | |
30 | #include <THashList.h> | |
67fe7bd0 | 31 | #include <THnSparse.h> |
70da6c5a | 32 | #include <TList.h> |
33 | #include <TObjArray.h> | |
34 | #include <TObjString.h> | |
35 | #include <TString.h> | |
36 | ||
37 | #include "AliCFContainer.h" | |
38 | #include "AliHFEcontainer.h" | |
39 | #include "AliHFEtools.h" | |
40 | ||
41 | ClassImp(AliHFEcontainer) | |
42 | ClassImp(AliHFEcontainer::AliHFEvarInfo) | |
43 | ||
44 | //__________________________________________________________________ | |
45 | AliHFEcontainer::AliHFEcontainer(): | |
46 | TNamed("HFEcontainer", ""), | |
47 | fContainers(NULL), | |
67fe7bd0 | 48 | fCorrelationMatrices(NULL), |
70da6c5a | 49 | fVariables(NULL), |
50 | fNVars(0), | |
51 | fNEvents(0) | |
52 | { | |
53 | // | |
54 | // Default constructor | |
55 | // | |
56 | fContainers = new THashList(); | |
3a72645a | 57 | fContainers->SetOwner(); |
70da6c5a | 58 | } |
59 | ||
60 | //__________________________________________________________________ | |
61 | AliHFEcontainer::AliHFEcontainer(const Char_t *name): | |
62 | TNamed(name, ""), | |
63 | fContainers(NULL), | |
67fe7bd0 | 64 | fCorrelationMatrices(NULL), |
70da6c5a | 65 | fVariables(NULL), |
66 | fNVars(0), | |
67 | fNEvents(0) | |
68 | { | |
69 | // | |
70 | // Default constructor | |
71 | // | |
72 | fContainers = new THashList(); | |
3a72645a | 73 | fContainers->SetOwner(); |
70da6c5a | 74 | } |
75 | ||
76 | //__________________________________________________________________ | |
77 | AliHFEcontainer::AliHFEcontainer(const Char_t *name, UInt_t nVar): | |
78 | TNamed(name, ""), | |
79 | fContainers(NULL), | |
67fe7bd0 | 80 | fCorrelationMatrices(NULL), |
70da6c5a | 81 | fVariables(NULL), |
82 | fNVars(0), | |
83 | fNEvents(0) | |
84 | { | |
85 | // | |
86 | // Constructor | |
87 | // Setting Number of Variables too | |
88 | // | |
89 | fContainers = new THashList(); | |
3a72645a | 90 | fContainers->SetOwner(); |
70da6c5a | 91 | SetNumberOfVariables(nVar); |
92 | } | |
93 | ||
94 | //__________________________________________________________________ | |
95 | AliHFEcontainer::AliHFEcontainer(const AliHFEcontainer &ref): | |
96 | TNamed(ref), | |
97 | fContainers(NULL), | |
67fe7bd0 | 98 | fCorrelationMatrices(NULL), |
70da6c5a | 99 | fVariables(NULL), |
100 | fNVars(ref.fNVars), | |
101 | fNEvents(ref.fNEvents) | |
102 | { | |
103 | // | |
104 | // Copy constructor | |
67fe7bd0 | 105 | // creates a new object with new (empty) containers |
70da6c5a | 106 | // |
70da6c5a | 107 | if(fNVars){ |
108 | fVariables = new TObjArray(fNVars); | |
bf892a6a | 109 | AliHFEvarInfo *vtmp = NULL; |
110 | for(UInt_t ivar = 0; ivar < fNVars; ivar++){ | |
111 | vtmp = dynamic_cast<AliHFEvarInfo *>(ref.fVariables->UncheckedAt(ivar)); | |
112 | if(vtmp) fVariables->AddAt(new AliHFEvarInfo(*vtmp), ivar); | |
113 | } | |
70da6c5a | 114 | } |
67fe7bd0 | 115 | fContainers = new THashList; |
3a72645a | 116 | fContainers->SetOwner(); |
67fe7bd0 | 117 | AliCFContainer *ctmp = NULL; |
118 | for(Int_t ien = 0; ien < ref.fContainers->GetEntries(); ien++){ | |
119 | ctmp = dynamic_cast<AliCFContainer *>(ref.fContainers->At(ien)); | |
bf892a6a | 120 | if(ctmp) CreateContainer(ctmp->GetName(), ctmp->GetTitle(), ctmp->GetNStep()); |
67fe7bd0 | 121 | } |
122 | // Copy also correlation matrices | |
123 | if(ref.fCorrelationMatrices){ | |
124 | THnSparseF *htmp = NULL; | |
125 | fCorrelationMatrices = new THashList; | |
3a72645a | 126 | fCorrelationMatrices->SetOwner(); |
67fe7bd0 | 127 | for(Int_t ien = 0; ien < ref.fCorrelationMatrices->GetEntries(); ien++){ |
128 | htmp = dynamic_cast<THnSparseF *>(ref.fCorrelationMatrices->At(ien)); | |
bf892a6a | 129 | if(htmp) CreateCorrelationMatrix(htmp->GetName(), htmp->GetTitle()); |
67fe7bd0 | 130 | } |
131 | } | |
70da6c5a | 132 | } |
133 | ||
134 | //__________________________________________________________________ | |
135 | AliHFEcontainer &AliHFEcontainer::operator=(const AliHFEcontainer &ref){ | |
136 | // | |
137 | // Assignment operator | |
138 | // Cleanup old object, create a new one with new containers inside | |
139 | // | |
140 | this->~AliHFEcontainer(); // cleanup old object before creating the new onwe | |
141 | TNamed::operator=(ref); | |
142 | fContainers = new THashList(); | |
e3ae862b | 143 | fCorrelationMatrices = NULL; |
70da6c5a | 144 | fNVars = ref.fNVars; |
70da6c5a | 145 | if(fNVars){ |
146 | fVariables = new TObjArray(fNVars); | |
bf892a6a | 147 | AliHFEvarInfo *vtmp = NULL; |
148 | for(UInt_t ivar = 0; ivar < fNVars; ivar++){ | |
149 | vtmp = dynamic_cast<AliHFEvarInfo *>(ref.fVariables->UncheckedAt(ivar)); | |
150 | if(vtmp) fVariables->AddAt(new AliHFEvarInfo(*vtmp), ivar); | |
151 | } | |
70da6c5a | 152 | } else { |
e3ae862b | 153 | // No varible defined, do not try to copy anything |
70da6c5a | 154 | fVariables = NULL; |
e3ae862b | 155 | return *this; |
156 | } | |
157 | ||
158 | // Reference contains content, try copying also the containers and the correlation matrices | |
159 | fContainers = new THashList(); | |
160 | AliCFContainer *ctmp = NULL; | |
161 | for(Int_t ien = 0; ien < ref.fContainers->GetEntries(); ien++){ | |
162 | ctmp = dynamic_cast<AliCFContainer *>(ref.fContainers->At(ien)); | |
163 | if(ctmp) fContainers->Add(new AliCFContainer(*ctmp)); | |
70da6c5a | 164 | } |
3a72645a | 165 | // Copy also correlation matrices |
166 | if(ref.fCorrelationMatrices){ | |
167 | THnSparseF *htmp = NULL; | |
168 | fCorrelationMatrices = new THashList; | |
169 | fCorrelationMatrices->SetOwner(); | |
170 | for(Int_t ien = 0; ien < ref.fCorrelationMatrices->GetEntries(); ien++){ | |
171 | htmp = dynamic_cast<THnSparseF *>(ref.fCorrelationMatrices->At(ien)); | |
bf892a6a | 172 | if(htmp) CreateCorrelationMatrix(htmp->GetName(), htmp->GetTitle()); |
3a72645a | 173 | } |
174 | } | |
70da6c5a | 175 | return *this; |
176 | } | |
177 | ||
178 | //__________________________________________________________________ | |
179 | AliHFEcontainer::~AliHFEcontainer(){ | |
180 | // | |
181 | // Destructor | |
182 | // | |
70da6c5a | 183 | delete fContainers; |
3a72645a | 184 | if(fCorrelationMatrices) delete fCorrelationMatrices; |
70da6c5a | 185 | if(fVariables){ |
186 | fVariables->Delete(); | |
187 | delete fVariables; | |
188 | } | |
189 | } | |
190 | ||
191 | //__________________________________________________________________ | |
192 | Long64_t AliHFEcontainer::Merge(TCollection *coll){ | |
193 | // | |
194 | // Merge Container | |
195 | // | |
196 | if(!coll) | |
197 | return 0; | |
198 | if(coll->IsEmpty()) | |
199 | return 1; | |
200 | ||
201 | TIterator *iter = coll->MakeIterator(); | |
202 | TObject *o = NULL; | |
203 | Long64_t count = 0; | |
204 | while((o = iter->Next())){ | |
205 | AliHFEcontainer *cont = dynamic_cast<AliHFEcontainer *>(o); | |
206 | if(!cont) continue; | |
207 | ||
208 | // Merge the two TObjArrays | |
209 | TList containers; | |
210 | containers.Add(cont->fContainers); | |
211 | fContainers->Merge(&containers); | |
212 | ||
67fe7bd0 | 213 | if(fCorrelationMatrices && cont->fCorrelationMatrices){ |
214 | containers.Clear(); | |
215 | containers.Add(cont->fCorrelationMatrices); | |
216 | fCorrelationMatrices->Merge(&containers); | |
217 | } | |
218 | ||
70da6c5a | 219 | fNEvents += cont->GetNumberOfEvents(); |
220 | count++; | |
221 | } | |
222 | return count + 1; | |
223 | } | |
224 | ||
225 | //__________________________________________________________________ | |
226 | void AliHFEcontainer::SetNumberOfVariables(UInt_t nVar){ | |
227 | // | |
228 | // Define the number of variables | |
229 | // Initialize containers for the variable informations | |
230 | // | |
231 | if(fNVars) return; | |
232 | ||
233 | fNVars = nVar; | |
234 | fVariables = new TObjArray(nVar); | |
235 | for(UInt_t ivar = 0; ivar < nVar; ivar++) | |
236 | fVariables->AddAt(new AliHFEvarInfo, ivar); | |
237 | } | |
238 | ||
239 | //__________________________________________________________________ | |
240 | void AliHFEcontainer::CreateContainer(const Char_t *name, const Char_t *title, UInt_t nStep){ | |
241 | // | |
242 | // Create a new Correction Framework Container and store it | |
243 | // | |
244 | if(fContainers->FindObject(name)){ | |
245 | AliError(Form("Container %s already exists. Cannot replace it!", name)); | |
246 | return; | |
247 | } | |
248 | ||
249 | Int_t *nBins = new Int_t[fNVars]; | |
70da6c5a | 250 | AliHFEvarInfo *var = NULL; |
bf892a6a | 251 | for(UInt_t ivar = 0; ivar < fNVars; ivar++){ |
252 | var = dynamic_cast<AliHFEvarInfo *>(fVariables->UncheckedAt(ivar)); | |
253 | nBins[ivar] = var ? var->GetNumberOfBins() : 0; | |
254 | } | |
70da6c5a | 255 | AliCFContainer *cont = new AliCFContainer(name, title, nStep, fNVars, nBins); |
256 | for(UInt_t ivar = 0; ivar < fNVars; ivar++){ | |
257 | var = dynamic_cast<AliHFEvarInfo *>(fVariables->UncheckedAt(ivar)); | |
bf892a6a | 258 | if(var){ |
259 | cont->SetBinLimits(ivar, var->GetBinning()); | |
260 | cont->SetVarTitle(ivar, var->GetVarName()->Data()); | |
261 | } | |
70da6c5a | 262 | } |
263 | delete[] nBins; | |
264 | fContainers->Add(cont); | |
265 | AliInfo(Form("Container %s created with %d cut steps", name, nStep)); | |
266 | } | |
267 | ||
268 | //__________________________________________________________________ | |
67fe7bd0 | 269 | void AliHFEcontainer::CreateCorrelationMatrix(const Char_t *name, const Char_t *title){ |
270 | // | |
271 | // Create Correlation Matrix | |
272 | // | |
273 | if(!fCorrelationMatrices){ | |
274 | fCorrelationMatrices = new THashList; | |
275 | fCorrelationMatrices->SetName("fCorrelationMatrices"); | |
3a72645a | 276 | fCorrelationMatrices->SetOwner(); |
67fe7bd0 | 277 | } |
278 | ||
279 | Int_t *nBins = new Int_t[2*fNVars]; | |
67fe7bd0 | 280 | AliHFEvarInfo *var = NULL; |
281 | for(UInt_t ivar = 0; ivar < fNVars; ivar++){ | |
282 | var = dynamic_cast<AliHFEvarInfo *>(fVariables->UncheckedAt(ivar)); | |
bf892a6a | 283 | if(var){ |
284 | nBins[ivar] = var->GetNumberOfBins(); | |
285 | nBins[ivar+fNVars] = var->GetNumberOfBins(); | |
286 | } | |
67fe7bd0 | 287 | } |
288 | ||
3a72645a | 289 | THnSparseF * hTmp = new THnSparseF(name, title, 2*fNVars, nBins); |
67fe7bd0 | 290 | for(UInt_t ivar = 0; ivar < fNVars; ivar++){ |
291 | var = dynamic_cast<AliHFEvarInfo *>(fVariables->UncheckedAt(ivar)); | |
bf892a6a | 292 | if(var){ |
293 | hTmp->SetBinEdges(ivar,var->GetBinning()); | |
294 | //hTmp->GetAxis(ivar)->Set(var->GetNumberOfBins(), var->GetBinning()); | |
295 | hTmp->GetAxis(ivar)->SetTitle(var->GetVarName()->Data()); | |
296 | //hTmp->GetAxis(ivar + fNVars)->Set(var->GetNumberOfBins(), var->GetBinning()); | |
297 | hTmp->GetAxis(ivar + fNVars)->SetTitle(Form("%s_{MC}", var->GetVarName()->Data())); | |
298 | hTmp->SetBinEdges(ivar+fNVars,var->GetBinning()); | |
299 | } | |
67fe7bd0 | 300 | } |
301 | hTmp->Sumw2(); | |
302 | fCorrelationMatrices->AddLast(hTmp); | |
303 | } | |
304 | ||
305 | //__________________________________________________________________ | |
306 | AliCFContainer *AliHFEcontainer::GetCFContainer(const Char_t *name) const{ | |
70da6c5a | 307 | // |
308 | // Find a given container | |
309 | // | |
310 | return dynamic_cast<AliCFContainer *>(fContainers->FindObject(name)); | |
311 | } | |
312 | ||
67fe7bd0 | 313 | //__________________________________________________________________ |
314 | THnSparseF *AliHFEcontainer::GetCorrelationMatrix(const Char_t *name) const{ | |
315 | // | |
316 | // Find Correlation Matrix | |
317 | // | |
6555e2ad | 318 | if(fCorrelationMatrices) return dynamic_cast<THnSparseF *>(fCorrelationMatrices->FindObject(name)); |
319 | else return 0x0; | |
320 | ||
67fe7bd0 | 321 | } |
322 | ||
70da6c5a | 323 | //__________________________________________________________________ |
3a72645a | 324 | void AliHFEcontainer::FillCFContainer(const Char_t *name, UInt_t step, Double_t *content, Double_t weight) const { |
70da6c5a | 325 | // |
326 | // Fill container | |
327 | // | |
328 | AliCFContainer *cont = GetCFContainer(name); | |
329 | if(!cont) return; | |
3a72645a | 330 | cont->Fill(content, step, weight); |
331 | } | |
332 | ||
333 | //__________________________________________________________________ | |
334 | void AliHFEcontainer::FillCFContainerStepname(const Char_t *name, const Char_t *steptitle, Double_t *content, Double_t weight)const{ | |
335 | // | |
336 | // Fill container | |
337 | // | |
338 | AliCFContainer *cont = GetCFContainer(name); | |
339 | if(!cont) return; | |
340 | // find the matching step title | |
341 | Int_t mystep = -1; | |
342 | for(Int_t istep = 0; istep < cont->GetNStep(); istep++){ | |
343 | TString tstept = cont->GetStepTitle(istep); | |
344 | if(!tstept.CompareTo(steptitle)){ | |
345 | mystep = istep; | |
346 | break; | |
347 | } | |
348 | } | |
349 | if(mystep < 0){ | |
350 | // step not found | |
351 | AliDebug(1, Form("Step %s not found in container %s", steptitle, name)); | |
352 | return; | |
353 | } | |
354 | AliDebug(1, Form("Filling step %s(%d) for container %s", steptitle, mystep, name)); | |
355 | cont->Fill(content, mystep, weight); | |
70da6c5a | 356 | } |
357 | ||
358 | //__________________________________________________________________ | |
6555e2ad | 359 | AliCFContainer *AliHFEcontainer::MakeMergedCFContainer(const Char_t *name, const Char_t *title, const Char_t* contnames) const { |
70da6c5a | 360 | // |
361 | // Merge CF Container out of several containers | |
362 | // Container names are separated by : | |
363 | // returns a new object which has to be taken care of by the user | |
364 | // | |
365 | ||
366 | TObjArray *containers = TString(contnames).Tokenize(":"); | |
367 | // we first need the size of the container to be merged | |
368 | Int_t nStepMerged = 0; | |
369 | AliCFContainer *ctemp = NULL; | |
370 | TObjString *cname = NULL; | |
371 | for(Int_t icont = 0; icont < containers->GetEntries(); icont++){ | |
372 | cname = dynamic_cast<TObjString *>(containers->At(icont)); | |
373 | ctemp = dynamic_cast<AliCFContainer *>(fContainers->FindObject(cname->String().Data())); | |
374 | if(!ctemp){ | |
375 | AliWarning(Form("Container %s not found. It will be unprocessed", cname->String().Data())); | |
376 | continue; | |
377 | } | |
378 | nStepMerged += ctemp->GetNStep(); | |
379 | } | |
380 | AliInfo("Please Ignore the messgae comming from AliCFContainer!"); | |
381 | Int_t *dummyBinning = new Int_t[fNVars]; | |
382 | for(UInt_t ibin = 0; ibin < fNVars; ibin++) dummyBinning[ibin] = 1; | |
383 | AliCFContainer *cmerged = new AliCFContainer(name, title, nStepMerged, fNVars, dummyBinning); | |
bf892a6a | 384 | delete[] dummyBinning; |
70da6c5a | 385 | // Fill container with content |
386 | AliInfo("Filling new container"); | |
387 | Int_t cstep = 0; | |
388 | for(Int_t icont = 0; icont < containers->GetEntries(); icont++){ | |
389 | cname = dynamic_cast<TObjString *>(containers->At(icont)); | |
390 | ctemp = dynamic_cast<AliCFContainer *>(fContainers->FindObject(cname->String().Data())); | |
391 | if(!ctemp) continue; | |
392 | for(Int_t istep = 0; istep < ctemp->GetNStep(); istep++) | |
393 | cmerged->SetGrid(cstep++, new AliCFGridSparse(*ctemp->GetGrid(istep))); | |
394 | } | |
395 | return cmerged; | |
396 | } | |
3a72645a | 397 | |
398 | //__________________________________________________________________ | |
399 | void AliHFEcontainer::SetStepTitle(const Char_t *contname, const Char_t *steptitle, UInt_t step){ | |
400 | // | |
401 | // Set title for given analysis step in container with name contname | |
402 | // | |
403 | AliCFContainer *cont = GetCFContainer(contname); | |
404 | if(!cont) return; | |
405 | if(step >= static_cast<UInt_t>(cont->GetNStep())) return; | |
406 | cont->SetStepTitle(step, steptitle); | |
407 | } | |
408 | ||
70da6c5a | 409 | //__________________________________________________________________ |
410 | void AliHFEcontainer::MakeLinearBinning(UInt_t var, UInt_t nBins, Double_t begin, Double_t end){ | |
411 | // | |
412 | // Set Linear binning for the given container | |
413 | // | |
bf892a6a | 414 | AliHFEvarInfo *myvar = dynamic_cast<AliHFEvarInfo *>(fVariables->UncheckedAt(var)); |
415 | if(myvar) myvar->SetBinning(nBins, AliHFEtools::MakeLinearBinning(nBins, begin, end)); | |
70da6c5a | 416 | } |
417 | ||
418 | //__________________________________________________________________ | |
419 | void AliHFEcontainer::MakeLogarithmicBinning(UInt_t var, UInt_t nBins, Double_t begin, Double_t end){ | |
420 | // | |
421 | // Set Logarithmic binning for the given container | |
422 | // | |
bf892a6a | 423 | AliHFEvarInfo *myvar = dynamic_cast<AliHFEvarInfo *>(fVariables->UncheckedAt(var)); |
424 | if(myvar) myvar->SetBinning(nBins, AliHFEtools::MakeLogarithmicBinning(nBins, begin, end)); | |
70da6c5a | 425 | } |
426 | ||
427 | //__________________________________________________________________ | |
428 | void AliHFEcontainer::SetVariableName(UInt_t var, const Char_t *varname){ | |
429 | // | |
430 | // Variable name | |
431 | // | |
bf892a6a | 432 | AliHFEvarInfo *myvar = dynamic_cast<AliHFEvarInfo *>(fVariables->UncheckedAt(var)); |
433 | if(myvar) myvar->SetVarName(varname); | |
70da6c5a | 434 | } |
435 | ||
436 | //__________________________________________________________________ | |
437 | Int_t AliHFEcontainer::GetNumberOfCFContainers() const{ | |
438 | // | |
439 | // Get the number of entries | |
440 | // | |
441 | return fContainers->GetEntries(); | |
442 | } | |
443 | ||
444 | //__________________________________________________________________ | |
445 | void AliHFEcontainer::Print(const Option_t *)const{ | |
446 | // | |
447 | // Print Container Status | |
448 | // | |
449 | std::cout << "Container status: " << std::endl; | |
450 | std::cout << "=====================================================\n"; | |
451 | std::cout << "Number of variables: " << fNVars << std::endl; | |
452 | if(fNVars){ | |
453 | UInt_t nVars = fVariables ? fVariables->GetEntriesFast() : 0; | |
454 | if(nVars != fNVars) | |
455 | std::cout << "Inconsistency in number of Variables [" << fNVars << "|" << nVars << "]" << std::endl; | |
456 | AliHFEvarInfo *var = NULL; | |
bf892a6a | 457 | if(fVariables){ |
458 | for(UInt_t ivar = 0; ivar < fNVars; ivar++){ | |
459 | var = dynamic_cast<AliHFEvarInfo *>(fVariables->UncheckedAt(ivar)); | |
460 | if(var) | |
461 | std::cout << "Variable " << ivar << ": Name: " << var->GetVarName()->Data() << ", Number of Bins: " << var->GetNumberOfBins() << std::endl; | |
462 | } | |
70da6c5a | 463 | } |
464 | } | |
465 | std::cout << std::endl; | |
466 | ||
467 | // Print CF Containers: | |
bf892a6a | 468 | if(fContainers){ |
469 | std::cout << "Containers[" << fContainers->GetEntries() << "]: "<< std::endl; | |
470 | std::cout << "=====================================================\n"; | |
471 | for(Int_t icont = 0; icont < fContainers->GetEntries(); icont++){ | |
472 | AliCFContainer *c = dynamic_cast<AliCFContainer *>(fContainers->At(icont)); | |
473 | if(c){ | |
474 | std::cout << "Name: " << c->GetName() << ", Title: " << c->GetTitle() << std::endl; | |
475 | for(Int_t istep = 0; istep < c->GetNStep(); istep++) | |
476 | std::cout << "Step " << istep << ": Title " << c->GetStepTitle(istep) << std::endl; | |
477 | } | |
478 | std::cout << "------------------------------------------------------\n"; | |
479 | } | |
70da6c5a | 480 | } |
481 | std::cout << "Number of Events: " << fNEvents << std::endl; | |
482 | } | |
483 | ||
484 | //------------------------------------ Content of class AliHFEvarInfo ----------------------------------- | |
485 | //__________________________________________________________________ | |
486 | AliHFEcontainer::AliHFEvarInfo::AliHFEvarInfo(): | |
487 | TObject(), | |
488 | fVarName(NULL), | |
489 | fBinning(NULL) | |
490 | { | |
491 | // Default constructor | |
492 | fBinning = new TArrayD; | |
493 | fVarName = new TString; | |
494 | } | |
495 | ||
496 | //__________________________________________________________________ | |
497 | AliHFEcontainer::AliHFEvarInfo::AliHFEvarInfo(const Char_t *name): | |
498 | TObject(), | |
499 | fVarName(NULL), | |
500 | fBinning(NULL) | |
501 | { | |
502 | fBinning = new TArrayD; | |
503 | fVarName = new TString(name); | |
504 | } | |
505 | ||
506 | //__________________________________________________________________ | |
507 | AliHFEcontainer::AliHFEvarInfo::AliHFEvarInfo(const AliHFEvarInfo &ref): | |
508 | TObject(ref), | |
509 | fVarName(NULL), | |
510 | fBinning(NULL) | |
511 | { | |
512 | // | |
513 | // Constructor | |
514 | // | |
515 | fVarName = new TString(*(ref.fVarName)); | |
516 | fBinning = new TArrayD(*(ref.fBinning)); | |
517 | } | |
518 | ||
519 | //__________________________________________________________________ | |
520 | AliHFEcontainer::AliHFEvarInfo &AliHFEcontainer::AliHFEvarInfo::operator=(const AliHFEvarInfo &ref){ | |
521 | // | |
522 | // Assignment operator | |
523 | // | |
524 | TObject::operator=(ref); | |
525 | *fVarName = *(ref.fVarName); | |
526 | *fBinning = *(ref.fBinning); | |
527 | return *this; | |
528 | } | |
529 | ||
530 | //__________________________________________________________________ | |
531 | AliHFEcontainer::AliHFEvarInfo::~AliHFEvarInfo(){ | |
532 | // | |
533 | // Destructor | |
534 | // | |
535 | delete fVarName; | |
536 | delete fBinning; | |
537 | } | |
538 | ||
539 | //__________________________________________________________________ | |
540 | void AliHFEcontainer::AliHFEvarInfo::SetVarName(const Char_t *name){ | |
541 | // | |
542 | // Setter for var name | |
543 | // | |
544 | *fVarName = name; | |
545 | } | |
546 | ||
547 | //__________________________________________________________________ | |
548 | void AliHFEcontainer::AliHFEvarInfo::SetBinning(UInt_t nBins, Double_t *content){ | |
549 | // Setter for binning | |
550 | // | |
551 | fBinning->Set(nBins + 1, content); | |
552 | } | |
553 |