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