]>
Commit | Line | Data |
---|---|---|
5e2cf960 | 1 | /************************************************************************* |
2 | * Copyright(c) 1998-2009, 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 | /////////////////////////////////////////////////////////////////////////// | |
c081415a | 17 | // Dielectron Histogram framework helper // |
5e2cf960 | 18 | // // |
19 | /* | |
20 | ||
c081415a | 21 | A helper class to extract objects(histograms and/or profiles) from |
22 | a AliDielctronHF array of objects. | |
5e2cf960 | 23 | |
24 | ||
c081415a | 25 | How to use it: |
5e2cf960 | 26 | |
c081415a | 27 | AliDielectronHFhelper *hf = new AliDielectronHFhelper("path/to/the/output/file.root", "ConfigName"); |
28 | // print the structure | |
29 | hf->Print(); | |
5e2cf960 | 30 | |
c081415a | 31 | //apply some cuts and print them |
32 | hf->SetRangeUser("cut1name",cutmin1,cutmax1); | |
33 | hf->SetRangeUser(AliDielectronVarManager::kPt,ptmin,ptmax); | |
34 | hf->PrintCuts(); | |
5e2cf960 | 35 | |
c081415a | 36 | // collect 1-,2- or 3-dim histograms or profiles with error option (default:"") |
37 | TObjArray *arrHists = hf->CollectHistos(AliDielectronVarManager::kM); | |
38 | TObjArray *arrProfs = hf->CollectProfiles("",AliDielectronVarManager::kM,AliDielectronVarManager::kPt); | |
5e2cf960 | 39 | |
c081415a | 40 | // then you are left with an array of histograms for all pair types or MC signals |
5e2cf960 | 41 | |
42 | */ | |
43 | // // | |
44 | /////////////////////////////////////////////////////////////////////////// | |
45 | ||
46 | #include <TObjArray.h> | |
47 | #include <TKey.h> | |
48 | #include <TList.h> | |
49 | #include <TClass.h> | |
50 | #include <TObject.h> | |
51 | #include <TFile.h> | |
52 | #include <TString.h> | |
53 | #include <TObjString.h> | |
54 | #include <TVectorD.h> | |
55 | #include <TMath.h> | |
56 | #include <TH1.h> | |
57 | ||
58 | #include <AliLog.h> | |
59 | ||
443a091c | 60 | #include "AliDielectron.h" |
5e2cf960 | 61 | #include "AliDielectronHFhelper.h" |
62 | #include "AliDielectronHF.h" | |
63 | ||
c081415a | 64 | ClassImp(AliDielectronHFhelper) |
5e2cf960 | 65 | |
66 | //const char* AliDielectronHFhelper::fCutVars[AliDielectronHFhelper::kMaxCuts] = {"","","","","","","","","",""}; | |
67 | ||
68 | //________________________________________________________________ | |
e0f6eeb2 | 69 | AliDielectronHFhelper::AliDielectronHFhelper(const char* filename, const char* container) : |
5e2cf960 | 70 | TNamed(), |
c081415a | 71 | fMainArr(0x0), |
5e2cf960 | 72 | fCutVars(0x0), |
73 | fCutLowLimits(0), | |
74 | fCutUpLimits(0) | |
75 | { | |
76 | // | |
77 | // get HF container(s) from file 'filename' | |
78 | // | |
e0f6eeb2 | 79 | SetHFArray(filename, container); |
187de573 | 80 | |
5e2cf960 | 81 | } |
82 | ||
83 | //________________________________________________________________ | |
84 | AliDielectronHFhelper::~AliDielectronHFhelper() | |
85 | { | |
86 | // | |
87 | // dtor | |
88 | // | |
c081415a | 89 | if(fMainArr) delete fMainArr; |
5e2cf960 | 90 | if(fCutVars) delete fCutVars; |
187de573 | 91 | |
5e2cf960 | 92 | } |
93 | ||
94 | //________________________________________________________________ | |
e0f6eeb2 | 95 | void AliDielectronHFhelper::SetHFArray(const char* filename, const char* container) |
5e2cf960 | 96 | { |
97 | // | |
c081415a | 98 | // get HF container from file |
5e2cf960 | 99 | // |
100 | ||
101 | TFile *f = TFile::Open(filename); | |
102 | ||
103 | TList *l=f->GetListOfKeys(); | |
104 | TIter nextKey(l); | |
105 | TKey *k=0x0; | |
106 | while ( (k=static_cast<TKey*>(nextKey())) ){ | |
187de573 | 107 | |
5e2cf960 | 108 | TObject *o=k->ReadObj(); |
109 | if (o->IsA()==TList::Class()){ | |
187de573 | 110 | |
5e2cf960 | 111 | TList *tlist=(TList*)o; |
187de573 | 112 | |
5e2cf960 | 113 | TIter next(tlist); |
114 | TObject *obj=0x0; | |
115 | while ((obj = next())) { | |
116 | TString objname(obj->GetName()); | |
117 | ||
e0f6eeb2 | 118 | if( objname.Contains(Form("%s_HF",container)) && obj->IsA()==TObjArray::Class()) { |
c081415a | 119 | fMainArr = new TObjArray( *(dynamic_cast<TObjArray*>(obj)) ); |
120 | //fMainArr->Print(); | |
5e2cf960 | 121 | return; |
122 | } | |
123 | } | |
124 | } | |
125 | } | |
126 | ||
127 | } | |
128 | //________________________________________________________________ | |
129 | void AliDielectronHFhelper::SetRangeUser(const char *varname, Double_t min, Double_t max, Bool_t leg) | |
130 | { | |
131 | // | |
132 | // Set range from variable name | |
133 | // | |
187de573 | 134 | |
5e2cf960 | 135 | Int_t size=fCutLowLimits.GetNrows(); |
136 | ||
187de573 | 137 | // check if cut is already set |
138 | for(Int_t icut=0; icut<size; icut++) { | |
139 | TString cutName = fCutVars->At(icut)->GetName(); | |
140 | if(!cutName.CompareTo(Form("%s%s",(leg?"Leg":""),varname))) { | |
141 | UnsetRangeUser(varname,leg); | |
142 | SetRangeUser(varname, min, max, leg); | |
143 | return; | |
144 | } | |
145 | } | |
146 | ||
5e2cf960 | 147 | if(size>=kMaxCuts) return; |
148 | ||
149 | // arrays | |
150 | if(!fCutVars) { | |
151 | fCutVars = new TObjArray(); | |
152 | fCutVars->SetOwner(); | |
153 | } | |
154 | fCutLowLimits.ResizeTo(size+1); | |
155 | fCutUpLimits.ResizeTo(size+1); | |
156 | ||
157 | // fill | |
5e2cf960 | 158 | TObjString *str = new TObjString(Form("%s%s",(leg?"Leg":""),varname)); |
159 | fCutVars->Add(str); | |
160 | fCutLowLimits(size) = min; | |
161 | fCutUpLimits(size) = max; | |
162 | AliWarning(Form(" %s [%.2f,%.2f]",fCutVars->At(size)->GetName(),fCutLowLimits(size),fCutUpLimits(size))); | |
163 | } | |
164 | ||
165 | //________________________________________________________________ | |
166 | void AliDielectronHFhelper::SetRangeUser(AliDielectronVarManager::ValueTypes type, Double_t min, Double_t max, Bool_t leg) | |
167 | { | |
168 | // | |
187de573 | 169 | // Set range from AliDielectronVarManager |
5e2cf960 | 170 | // |
171 | SetRangeUser(AliDielectronVarManager::GetValueName(type), min, max, leg); | |
172 | } | |
173 | ||
4d7704c5 | 174 | //________________________________________________________________ |
175 | void AliDielectronHFhelper::UnsetRangeUser(const char *varname, Bool_t leg) | |
176 | { | |
177 | // | |
178 | // unset range from variable name | |
179 | // | |
c081415a | 180 | |
4d7704c5 | 181 | Int_t size=fCutLowLimits.GetNrows(); |
4d7704c5 | 182 | TVectorD newlow; |
183 | TVectorD newup; | |
184 | ||
187de573 | 185 | // find cut and build new vectors w/o it |
4d7704c5 | 186 | Int_t ientries = 0; |
187 | for(Int_t icut=0; icut<size; icut++) { | |
188 | ||
189 | TString cutName = fCutVars->At(icut)->GetName(); | |
187de573 | 190 | if(!cutName.CompareTo(Form("%s%s",(leg?"Leg":""),varname))) { |
4d7704c5 | 191 | fCutVars->AddAt(0x0,icut); |
192 | continue; | |
193 | } | |
187de573 | 194 | |
4d7704c5 | 195 | // fill new vectors |
196 | newlow.ResizeTo(ientries+1); | |
197 | newup.ResizeTo(ientries+1); | |
198 | newlow(ientries) = fCutLowLimits(icut); | |
199 | newup(ientries) = fCutUpLimits(icut); | |
187de573 | 200 | |
4d7704c5 | 201 | ientries++; |
202 | } | |
187de573 | 203 | |
4d7704c5 | 204 | // adapt new arrays/vectors |
205 | fCutVars->Compress(); | |
206 | ||
207 | fCutLowLimits.ResizeTo(ientries); | |
208 | fCutUpLimits.ResizeTo(ientries); | |
209 | for(Int_t icut=0; icut<ientries; icut++) { | |
210 | fCutLowLimits(icut) = newlow(icut); | |
211 | fCutUpLimits(icut) = newup(icut); | |
212 | } | |
187de573 | 213 | // PrintCuts(); |
214 | ||
4d7704c5 | 215 | } |
216 | ||
217 | //________________________________________________________________ | |
218 | void AliDielectronHFhelper::UnsetRangeUser(AliDielectronVarManager::ValueTypes type, Bool_t leg) | |
219 | { | |
220 | // | |
187de573 | 221 | // Unset range from AliDielectronVarManager |
4d7704c5 | 222 | // |
223 | UnsetRangeUser(AliDielectronVarManager::GetValueName(type), leg); | |
224 | } | |
225 | ||
443a091c | 226 | //________________________________________________________________ |
c081415a | 227 | TObjArray* AliDielectronHFhelper::CollectProfiles(TString option, |
228 | AliDielectronVarManager::ValueTypes varx, | |
229 | AliDielectronVarManager::ValueTypes vary, | |
230 | AliDielectronVarManager::ValueTypes varz, | |
231 | AliDielectronVarManager::ValueTypes vart) | |
443a091c | 232 | { |
233 | // | |
c081415a | 234 | // collect 1-3 dimensional TProfiles for all kind of pair types or sources |
443a091c | 235 | // |
187de573 | 236 | |
c081415a | 237 | // reconstruct the histogram/profile name resp. key |
238 | Int_t dim = 0; | |
239 | if(varx < AliDielectronVarManager::kNMaxValues) dim++; | |
240 | if(vary < AliDielectronVarManager::kNMaxValues) dim++; | |
241 | if(varz < AliDielectronVarManager::kNMaxValues) dim++; | |
242 | Bool_t bPairClass=0; | |
243 | if( varx < AliDielectronVarManager::kPairMax || | |
244 | vary < AliDielectronVarManager::kPairMax || | |
245 | varz < AliDielectronVarManager::kPairMax || | |
246 | vart < AliDielectronVarManager::kPairMax ) bPairClass=kTRUE; | |
247 | Bool_t bprf = !(option.Contains("hist",TString::kIgnoreCase)); | |
248 | Bool_t bStdOpt=kTRUE; | |
249 | if(option.Contains("S",TString::kIgnoreCase) || option.Contains("rms",TString::kIgnoreCase)) bStdOpt=kFALSE; | |
250 | ||
251 | TString key = ""; | |
252 | if(bprf) dim--; | |
253 | switch(dim) { | |
254 | case 3: | |
255 | key+=Form("%s_",AliDielectronVarManager::GetValueName(varx)); | |
256 | key+=Form("%s_",AliDielectronVarManager::GetValueName(vary)); | |
257 | key+=Form("%s",AliDielectronVarManager::GetValueName(varz)); | |
258 | if(bprf) key+=Form("-%s%s",AliDielectronVarManager::GetValueName(vart),(bStdOpt ? "avg" : "rms")); | |
259 | break; | |
260 | case 2: | |
261 | key+=Form("%s_",AliDielectronVarManager::GetValueName(varx)); | |
262 | key+=Form("%s",AliDielectronVarManager::GetValueName(vary)); | |
263 | if(bprf) key+=Form("-%s%s",AliDielectronVarManager::GetValueName(varz),(bStdOpt ? "avg" : "rms")); | |
264 | break; | |
265 | case 1: | |
266 | key+=Form("%s",AliDielectronVarManager::GetValueName(varx)); | |
267 | if(bprf) key+=Form("-%s%s",AliDielectronVarManager::GetValueName(vary),(bStdOpt ? "avg" : "rms")); | |
268 | break; | |
269 | } | |
270 | // to differentiate btw. leg and pair histos | |
271 | if(bPairClass) key.Prepend("p"); | |
272 | // prepend HF | |
273 | key.Prepend("HF_"); | |
274 | ||
275 | //TODO: printf("--------> KEY: %s \n",key.Data()); | |
276 | // get the requested object from the arrays | |
277 | TObjArray *collection = new TObjArray(fMainArr->GetEntriesFast()); | |
278 | ||
279 | TObjArray *cloneArr = (TObjArray*) fMainArr->Clone("tmpArr"); | |
280 | if(!cloneArr) return 0x0; | |
281 | cloneArr->SetOwner(kTRUE); | |
282 | ||
283 | // loop over all pair types or sources | |
284 | for(Int_t i=0; i<cloneArr->GetEntriesFast(); i++) { | |
285 | if(!cloneArr->At(i)) continue; | |
286 | ||
287 | // find histogram of interest from array of objects | |
288 | TObjArray *arr = (TObjArray*) GetObject(cloneArr->At(i)->GetName(),cloneArr); | |
289 | if(arr) { | |
290 | collection->AddAt(arr->FindObject(key.Data()), i); | |
291 | } | |
187de573 | 292 | |
293 | } | |
294 | ||
295 | // clean up the clone | |
c081415a | 296 | if(cloneArr) { |
297 | delete cloneArr; | |
298 | cloneArr=0; | |
443a091c | 299 | } |
300 | ||
301 | return collection; | |
302 | } | |
303 | ||
5e2cf960 | 304 | //________________________________________________________________ |
c081415a | 305 | TObject* AliDielectronHFhelper::GetObject(const char *step, TObjArray *histArr) |
5e2cf960 | 306 | { |
307 | // | |
c081415a | 308 | // main function to recieve a pair type or MC signal array |
309 | // | |
187de573 | 310 | |
311 | AliDebug(1,Form(" Step %s selected",step)); | |
c081415a | 312 | // TODO: check memory |
187de573 | 313 | |
c081415a | 314 | TObjArray *stepArr = 0x0; // this is the requested step |
315 | TObject *hist = 0x0; | |
187de573 | 316 | if(!histArr) { |
c081415a | 317 | stepArr = (TObjArray*) fMainArr->FindObject(step)->Clone("tmpArr"); |
187de573 | 318 | } |
319 | else { | |
c081415a | 320 | stepArr = (TObjArray*) histArr->FindObject(step); |
187de573 | 321 | } |
5e2cf960 | 322 | |
c081415a | 323 | if(stepArr) hist = FindObjects(stepArr); |
5e2cf960 | 324 | return hist; |
187de573 | 325 | |
5e2cf960 | 326 | } |
327 | ||
328 | //________________________________________________________________ | |
c081415a | 329 | TObject* AliDielectronHFhelper::FindObjects(TObjArray *stepArr) |
5e2cf960 | 330 | { |
331 | // | |
c081415a | 332 | // apply cuts and exclude objects from the array |
5e2cf960 | 333 | // |
187de573 | 334 | |
5e2cf960 | 335 | // debug |
c081415a | 336 | // TString title = stepArr->At(0)->GetTitle(); |
5e2cf960 | 337 | // TObjArray* vars = title.Tokenize(":"); |
187de573 | 338 | // AliDebug(1,Form(" number of cuts/vars: %d/%d",fCutLowLimits.GetNrows(),vars->GetEntriesFast())); |
339 | ||
5e2cf960 | 340 | // check for missing cuts |
c081415a | 341 | CheckCuts(stepArr); |
187de573 | 342 | |
5e2cf960 | 343 | // loop over all cuts |
344 | for(Int_t icut=0; icut<fCutLowLimits.GetNrows(); icut++) { | |
345 | ||
c081415a | 346 | Bool_t bFndBin = kFALSE; // bin with exact limits found |
347 | const char *cutvar = fCutVars->At(icut)->GetName(); // cut variable | |
348 | Double_t min = fCutLowLimits(icut); // lower limit | |
349 | Double_t max = fCutUpLimits(icut); // upper limit | |
187de573 | 350 | AliDebug(5,Form(" Cut %d: %s [%.2f,%.2f]",icut,cutvar,min,max)); |
5e2cf960 | 351 | |
c081415a | 352 | // loop over the full grid of given step |
353 | for(Int_t i=0; i<stepArr->GetEntriesFast(); i++) { | |
5e2cf960 | 354 | |
355 | // continue if already empty | |
c081415a | 356 | if(!stepArr->At(i)) continue; |
5e2cf960 | 357 | |
c081415a | 358 | // collect bins from the name |
359 | TString title = stepArr->At(i)->GetName(); | |
5e2cf960 | 360 | if(title.IsNull()) continue; |
c081415a | 361 | AliDebug(5,Form(" %03d object name: %s",i,title.Data())); |
5e2cf960 | 362 | |
c081415a | 363 | // loop over all variables |
5e2cf960 | 364 | TObjArray *vars = title.Tokenize(":"); |
365 | for(Int_t ivar=0; ivar<vars->GetEntriesFast(); ivar++) { | |
366 | TString binvar = vars->At(ivar)->GetName(); | |
c081415a | 367 | AliDebug(10,Form(" --> %d check bin var %s",ivar,binvar.Data())); |
187de573 | 368 | |
c081415a | 369 | // check cuts set by the user, and compare to the bin limits |
5e2cf960 | 370 | if(binvar.Contains(cutvar)) { |
c081415a | 371 | // bin limits |
5e2cf960 | 372 | TObjArray *limits = binvar.Tokenize("#"); |
c081415a | 373 | Double_t binmin = atof(limits->At(1)->GetName()); // lower bin limit |
374 | Double_t binmax = atof(limits->At(2)->GetName()); // upper bin limit | |
187de573 | 375 | AliDebug(10,Form(" bin %s var %s [%.2f,%.2f]",binvar.Data(),limits->At(0)->GetName(),binmin,binmax)); |
c081415a | 376 | if(limits) delete limits; |
187de573 | 377 | |
c081415a | 378 | // cut and remove objects from the array |
5e2cf960 | 379 | if(binmin < min || binmax < min || binmin > max || binmax > max ) { |
c081415a | 380 | AliDebug(10,Form(" removed, out of range! lower bin,cut: %.2f,%.2f or upper bin,cut: %.2f>%.2f",binmin,min,binmax,max)); |
381 | stepArr->AddAt(0x0,i); | |
5e2cf960 | 382 | } |
383 | if(bFndBin && !(binmin == min && binmax == max)) { | |
c081415a | 384 | stepArr->AddAt(0x0,i); |
385 | AliDebug(10,Form(" removed, within range! lower bin,cut: %.2f,%.2f or upper bin,cut: %.2f,%.2f",binmin,min,binmax,max)); | |
8d42b5b9 | 386 | } |
5e2cf960 | 387 | |
c081415a | 388 | // did we found a bin with exact the cut ranges |
389 | // this can happen only once per variable | |
5e2cf960 | 390 | if(binmin==min && binmax==max) bFndBin=kTRUE; |
391 | ||
392 | } | |
393 | ||
394 | } | |
395 | // clean up | |
396 | if(vars) delete vars; | |
187de573 | 397 | |
5e2cf960 | 398 | } |
187de573 | 399 | |
5e2cf960 | 400 | } |
187de573 | 401 | |
c081415a | 402 | // compress the array by removing all empty entries |
403 | stepArr->Compress(); | |
404 | AliDebug(1,Form(" Compression: %d objects left",stepArr->GetEntriesFast())); | |
5e2cf960 | 405 | |
c081415a | 406 | // merge left objects |
407 | TObject* hist = Merge(stepArr); | |
408 | // if(hist) AliDebug(1,Form(" Merging: %e entries",hist->GetEntries())); | |
5e2cf960 | 409 | return hist; |
410 | } | |
411 | ||
412 | //________________________________________________________________ | |
c081415a | 413 | TObject* AliDielectronHFhelper::Merge(TObjArray *arr) |
5e2cf960 | 414 | { |
415 | // | |
c081415a | 416 | // merge left objects to a single one |
5e2cf960 | 417 | // |
5e2cf960 | 418 | |
c081415a | 419 | if(arr->GetEntriesFast()<1) { AliError(" No more objects left!"); return 0x0; } |
187de573 | 420 | |
35363fb9 | 421 | TObject *final=arr->At(0)->Clone(); |
5e2cf960 | 422 | if(!final) return 0x0; |
187de573 | 423 | |
35363fb9 | 424 | TList listH; |
425 | TString listHargs; | |
426 | listHargs.Form("((TCollection*)0x%lx)", (ULong_t)&listH); | |
427 | Int_t error = 0; | |
428 | ||
429 | // final->Reset("CE"); | |
430 | // final->SetTitle(""); //TODO: change in future | |
431 | for(Int_t i=1; i<arr->GetEntriesFast(); i++) { | |
432 | listH.Add(arr->At(i)); | |
c081415a | 433 | // printf("%d: ent %.0f \n",i,((TH1*)((TObjArray*)arr->At(i))->At(0))->GetEntries()); |
35363fb9 | 434 | // final->Add((TH1*)arr->At(i)); |
5e2cf960 | 435 | } |
35363fb9 | 436 | // arr->Clear(); |
5e2cf960 | 437 | |
35363fb9 | 438 | final->Execute("Merge", listHargs.Data(), &error); |
c081415a | 439 | return final; |
5e2cf960 | 440 | } |
441 | ||
442 | //________________________________________________________________ | |
443 | void AliDielectronHFhelper::CheckCuts(TObjArray *arr) | |
444 | { | |
445 | // | |
c081415a | 446 | // Compare binning and cut variables. Add necessary cuts (full range, no exclusion) |
5e2cf960 | 447 | // |
448 | ||
5e2cf960 | 449 | // build array with bin variable, minimum and maximum bin values |
35363fb9 | 450 | TString titleFIRST = arr->First()->GetName(); |
451 | TString titleLAST = arr->Last()->GetName(); | |
5e2cf960 | 452 | TObjArray* binvarsF = titleFIRST.Tokenize(":#"); |
453 | TObjArray* binvarsL = titleLAST.Tokenize(":#"); | |
454 | Double_t binmin[kMaxCuts]= {0.0}; | |
455 | Double_t binmax[kMaxCuts]= {0.0}; | |
456 | for(Int_t ivar=0; ivar<binvarsF->GetEntriesFast(); ivar++) { | |
457 | ||
458 | TString elementF=binvarsF->At(ivar)->GetName(); | |
459 | TString elementL=binvarsL->At(ivar)->GetName(); | |
460 | AliDebug(1,Form(" binvar %d: %s,%s",ivar,elementF.Data(),elementL.Data())); | |
187de573 | 461 | |
5e2cf960 | 462 | switch(ivar%3) { |
463 | case 0: continue; break; | |
464 | case 1: binmin[(int)ivar/3]=atof(elementF.Data()); break; | |
465 | case 2: binmax[(int)ivar/3]=atof(elementL.Data()); break; | |
466 | } | |
187de573 | 467 | |
5e2cf960 | 468 | binvarsF->AddAt(0x0,ivar); |
469 | } | |
470 | binvarsF->Compress(); | |
187de573 | 471 | |
5e2cf960 | 472 | // loop over all vars and cuts, check for missing stuff |
473 | for(Int_t ivar=0; ivar<binvarsF->GetEntriesFast(); ivar++) { | |
187de573 | 474 | |
5e2cf960 | 475 | TString binvar=binvarsF->At(ivar)->GetName(); |
476 | Bool_t selected=kFALSE; | |
477 | ||
478 | AliDebug(1,Form(" check cuts %d %s [%.2f,%.2f]",ivar,binvar.Data(),binmin[ivar],binmax[ivar])); | |
479 | // loop over all cuts and check for missing stuff | |
480 | for(Int_t icut=0; icut<fCutLowLimits.GetNrows(); icut++) { | |
481 | if(binvar.Contains(fCutVars->At(icut)->GetName())) { selected=kTRUE; break; } | |
482 | // else break; | |
483 | } | |
187de573 | 484 | |
5e2cf960 | 485 | // add missing cut with max limits |
486 | if(!selected) { | |
187de573 | 487 | AliWarning(Form(" Bin variable %s not covered. Add cut!",binvar.Data())); |
488 | Bool_t leg = binvar.BeginsWith("Leg"); | |
489 | if(leg) binvar.Remove(0,3); | |
490 | SetRangeUser(binvar.Data(),binmin[ivar],binmax[ivar], leg); | |
5e2cf960 | 491 | } |
187de573 | 492 | |
5e2cf960 | 493 | } |
187de573 | 494 | |
495 | // clean up | |
5e2cf960 | 496 | if(binvarsF) delete binvarsF; |
497 | if(binvarsL) delete binvarsL; | |
498 | } | |
499 | ||
500 | //________________________________________________________________ | |
443a091c | 501 | void AliDielectronHFhelper::Print(const Option_t* /*option*/) const |
5e2cf960 | 502 | { |
503 | ||
504 | // | |
505 | // Print out object contents | |
506 | // | |
c081415a | 507 | AliInfo(Form(" Container: %s",fMainArr->GetName())); |
5e2cf960 | 508 | |
509 | // pairtypes, steps and sources | |
c081415a | 510 | Int_t stepLast=0; |
511 | AliInfo(Form(" Number of filled steps: %d",fMainArr->GetEntries())); | |
512 | for(Int_t istep=0; istep<fMainArr->GetEntriesFast(); istep++) { | |
513 | if(fMainArr->At(istep)) { | |
514 | AliInfo(Form(" step %d: %s",istep,fMainArr->At(istep)->GetName())); | |
515 | stepLast=istep; | |
516 | } | |
187de573 | 517 | } |
518 | ||
c081415a | 519 | AliInfo(Form(" Number of objects: %d", |
520 | ((TObjArray*) ((TObjArray*)fMainArr->At(stepLast)) ->First())->GetEntriesFast())); | |
187de573 | 521 | |
c081415a | 522 | TString title = ((TObjArray*)fMainArr->At(stepLast))->First()->GetName(); |
187de573 | 523 | TObjArray* binvars = title.Tokenize(":"); |
524 | AliInfo(Form(" Number of variables: %d",binvars->GetEntriesFast())); | |
09d5920f | 525 | delete binvars; |
187de573 | 526 | |
527 | TObjArray* binvars2 = title.Tokenize(":#"); | |
528 | for(Int_t ivar=0; ivar<binvars2->GetEntriesFast(); ivar++) { | |
529 | if(ivar%3) continue; | |
530 | AliInfo(Form(" variable %.0f: %s",((Double_t)ivar)/3+1,binvars2->At(ivar)->GetName())); | |
5e2cf960 | 531 | } |
09d5920f | 532 | delete binvars2; |
5e2cf960 | 533 | |
534 | } | |
535 | ||
536 | //________________________________________________________________ | |
537 | void AliDielectronHFhelper::PrintCuts() | |
538 | { | |
539 | ||
540 | // | |
c081415a | 541 | // Print cuts |
5e2cf960 | 542 | // |
543 | ||
544 | // loop over all cuts | |
545 | AliInfo(" Selected cuts:"); | |
546 | for(Int_t icut=0; icut<fCutLowLimits.GetNrows(); icut++) | |
547 | AliInfo(Form(" %d: %s [%.2f,%.2f]",icut,fCutVars->At(icut)->GetName(),fCutLowLimits(icut),fCutUpLimits(icut))); | |
187de573 | 548 | |
5e2cf960 | 549 | } |
550 |