]>
Commit | Line | Data |
---|---|---|
b2a297fa | 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 | /////////////////////////////////////////////////////////////////////////// | |
17 | // Dielectron Correction framework manager // | |
18 | // // | |
19 | /* | |
20 | ||
21 | ||
22 | ||
23 | ||
24 | ||
25 | ||
26 | ||
27 | ||
28 | ||
29 | */ | |
30 | // // | |
31 | /////////////////////////////////////////////////////////////////////////// | |
32 | ||
33 | #include <TList.h> | |
61d106d3 | 34 | #include <TObjArray.h> |
35 | #include <TVectorD.h> | |
3505bfad | 36 | #include <TString.h> |
37 | #include <TObjString.h> | |
b2a297fa | 38 | |
39 | #include <AliCFContainer.h> | |
40 | #include <AliAnalysisFilter.h> | |
41 | #include <AliAnalysisCuts.h> | |
6551594b | 42 | #include <AliVParticle.h> |
b2a297fa | 43 | #include <AliLog.h> |
44 | ||
45 | #include "AliDielectronCF.h" | |
46 | #include "AliDielectronMC.h" | |
6551594b | 47 | #include "AliDielectronPair.h" |
b2a297fa | 48 | |
49 | ClassImp(AliDielectronCF) | |
50 | ||
51 | AliDielectronCF::AliDielectronCF() : | |
52 | TNamed("DielectronCF","DielectronCF"), | |
53 | fNSteps(0), | |
54 | fNVars(0), | |
61d106d3 | 55 | fVarBinLimits(0x0), |
6551594b | 56 | fNVarsLeg(0), |
3505bfad | 57 | fVarBinLimitsLeg(0x0), |
b2a297fa | 58 | fNCuts(0), |
6551594b | 59 | fValues(0x0), |
e123f993 | 60 | fStepForMCtruth(kFALSE), |
61 | fStepForNoCutsMCmotherPid(kFALSE), | |
62 | fStepForAfterAllCuts(kTRUE), | |
554e40f8 | 63 | fStepForPreFilter(kFALSE), |
e123f993 | 64 | fStepsForEachCut(kFALSE), |
b2a297fa | 65 | fStepsForCutsIncreasing(kFALSE), |
572b0139 | 66 | fStepsForSignal(kTRUE), |
67 | fStepsForBackground(kFALSE), | |
b2a297fa | 68 | fNStepMasks(0), |
69 | fPdgMother(-1), | |
572b0139 | 70 | fCfContainer(0x0), |
71 | fHasMC(kFALSE), | |
72 | fNAddSteps(0) | |
b2a297fa | 73 | { |
74 | // | |
75 | // Default constructor | |
76 | // | |
77 | for (Int_t i=0; i<AliDielectronVarManager::kNMaxValues; ++i){ | |
78 | fVariables[i]=0; | |
61d106d3 | 79 | fVariablesLeg[i]=0; |
b2a297fa | 80 | } |
81 | ||
82 | for (Int_t i=0; i<kNmaxAddSteps; ++i){ | |
e123f993 | 83 | fStepMasks[i]=0xFFFFFF; |
b2a297fa | 84 | } |
85 | } | |
86 | ||
87 | //________________________________________________________________ | |
88 | AliDielectronCF::AliDielectronCF(const char* name, const char* title) : | |
89 | TNamed(name, title), | |
90 | fNSteps(0), | |
91 | fNVars(0), | |
61d106d3 | 92 | fVarBinLimits(0x0), |
6551594b | 93 | fNVarsLeg(0), |
3505bfad | 94 | fVarBinLimitsLeg(0x0), |
b2a297fa | 95 | fNCuts(0), |
6551594b | 96 | fValues(0x0), |
e123f993 | 97 | fStepForMCtruth(kFALSE), |
98 | fStepForNoCutsMCmotherPid(kFALSE), | |
99 | fStepForAfterAllCuts(kTRUE), | |
554e40f8 | 100 | fStepForPreFilter(kFALSE), |
e123f993 | 101 | fStepsForEachCut(kFALSE), |
b2a297fa | 102 | fStepsForCutsIncreasing(kFALSE), |
572b0139 | 103 | fStepsForSignal(kTRUE), |
104 | fStepsForBackground(kFALSE), | |
b2a297fa | 105 | fNStepMasks(0), |
106 | fPdgMother(-1), | |
572b0139 | 107 | fCfContainer(0x0), |
108 | fHasMC(kFALSE), | |
109 | fNAddSteps(0) | |
b2a297fa | 110 | { |
111 | // | |
112 | // Named constructor | |
113 | // | |
114 | for (Int_t i=0; i<AliDielectronVarManager::kNMaxValues; ++i){ | |
115 | fVariables[i]=0; | |
61d106d3 | 116 | fVariablesLeg[i]=0; |
b2a297fa | 117 | } |
118 | ||
119 | for (Int_t i=0; i<kNmaxAddSteps; ++i){ | |
e123f993 | 120 | fStepMasks[i]=0xFFFFFF; |
b2a297fa | 121 | } |
122 | } | |
123 | ||
124 | //________________________________________________________________ | |
125 | AliDielectronCF::~AliDielectronCF() | |
126 | { | |
127 | // | |
128 | // Destructor | |
129 | // | |
6551594b | 130 | if (fValues) delete [] fValues; |
3505bfad | 131 | if (fVarBinLimits) delete fVarBinLimits; |
132 | if (fVarBinLimitsLeg) delete fVarBinLimitsLeg; | |
b2a297fa | 133 | } |
134 | ||
135 | //________________________________________________________________ | |
3505bfad | 136 | void AliDielectronCF::AddVariable(AliDielectronVarManager::ValueTypes type, Int_t nbins, |
137 | Double_t min, Double_t max, Bool_t leg, Bool_t log) | |
b2a297fa | 138 | { |
139 | // | |
140 | // Add a variable to the CF configuration | |
3505bfad | 141 | // if leg is true it will add the variables of the leg |
142 | // if log is true log binning will be created | |
b2a297fa | 143 | // |
6551594b | 144 | |
3505bfad | 145 | TVectorD *binLimits=0x0; |
146 | if (!log) binLimits=MakeLinBinning(nbins,min,max); | |
147 | else binLimits=MakeLogBinning(nbins,min,max); | |
148 | AddVariable(type,binLimits,leg); | |
149 | } | |
150 | ||
151 | //________________________________________________________________ | |
152 | void AliDielectronCF::AddVariable(AliDielectronVarManager::ValueTypes type, const char* binLimitStr, Bool_t leg/*=kFALSE*/) | |
153 | { | |
154 | // | |
155 | // Add a variable to the CF configuration | |
156 | // specify arbitrary binning in a string. | |
157 | // Bin limits need to be separated by a "," | |
158 | // | |
159 | TString limits(binLimitStr); | |
160 | if (limits.IsNull()){ | |
161 | AliError(Form("Bin Limit string is empty, cannot add the variable '%s'",AliDielectronVarManager::GetValueName(type))); | |
162 | return; | |
163 | } | |
164 | ||
165 | TObjArray *arr=limits.Tokenize(","); | |
166 | Int_t nLimits=arr->GetEntries(); | |
167 | if (nLimits<2){ | |
168 | AliError(Form("Need at leas 2 bin limits, cannot add the variable '%s'",AliDielectronVarManager::GetValueName(type))); | |
169 | delete arr; | |
170 | return; | |
171 | } | |
172 | ||
173 | TVectorD *binLimits=new TVectorD(nLimits); | |
174 | for (Int_t iLim=0; iLim<nLimits; ++iLim){ | |
175 | (*binLimits)[iLim]=(static_cast<TObjString*>(arr->At(iLim)))->GetString().Atof(); | |
176 | } | |
177 | ||
178 | delete arr; | |
179 | AddVariable(type,binLimits,leg); | |
180 | } | |
181 | ||
182 | //________________________________________________________________ | |
183 | void AliDielectronCF::AddVariable(AliDielectronVarManager::ValueTypes type, TVectorD *binLimits, Bool_t leg/*=kFALSE*/) | |
184 | { | |
185 | // | |
186 | // Add variable with the binning given in the TVectorD | |
187 | // | |
6551594b | 188 | if (!leg){ |
3505bfad | 189 | if (!fVarBinLimits){ |
190 | fVarBinLimits=new TObjArray; | |
191 | fVarBinLimits->SetOwner(); | |
61d106d3 | 192 | } |
3505bfad | 193 | fVarBinLimits->Add(binLimits); |
6551594b | 194 | fVariables[fNVars] = (UInt_t)type; |
6551594b | 195 | ++fNVars; |
196 | } else { | |
3505bfad | 197 | if (!fVarBinLimitsLeg){ |
198 | fVarBinLimitsLeg=new TObjArray; | |
199 | fVarBinLimitsLeg->SetOwner(); | |
200 | } | |
201 | fVarBinLimitsLeg->Add(binLimits); | |
6551594b | 202 | fVariablesLeg[fNVarsLeg] = (UInt_t)type; |
6551594b | 203 | ++fNVarsLeg; |
204 | } | |
b2a297fa | 205 | } |
206 | ||
207 | //________________________________________________________________ | |
208 | void AliDielectronCF::InitialiseContainer(const AliAnalysisFilter& filter) | |
209 | { | |
210 | // | |
211 | // Initialise container based on the cuts in the analysis filter | |
212 | // | |
213 | ||
214 | fNCuts=filter.GetCuts()->GetEntries(); | |
e123f993 | 215 | |
572b0139 | 216 | fHasMC=AliDielectronMC::Instance()->HasMC(); |
217 | fNAddSteps=1; | |
218 | if (fHasMC){ | |
219 | if (fStepsForSignal) ++fNAddSteps; | |
220 | if (fStepsForBackground) ++fNAddSteps; | |
221 | } else { | |
222 | //if | |
223 | fStepForMCtruth=kFALSE; | |
224 | fStepForNoCutsMCmotherPid=kFALSE; | |
225 | fStepsForSignal=kFALSE; | |
226 | fStepsForBackground=kFALSE; | |
227 | } | |
228 | ||
e123f993 | 229 | fNSteps=0; |
230 | if (fStepForMCtruth) ++fNSteps; | |
231 | if (fStepForNoCutsMCmotherPid) ++fNSteps; | |
572b0139 | 232 | if (fStepForAfterAllCuts) fNSteps+=fNAddSteps; |
233 | ||
234 | if (fStepsForEachCut&&fNCuts>1) fNSteps+=(fNAddSteps*fNCuts); //one step for each cut + Signal (MC) | |
235 | if (fStepsForCutsIncreasing&&fNCuts>2) fNSteps+=(fNAddSteps*(fNCuts-2)); //one step for the increasing cuts + Signal (MC) | |
b2a297fa | 236 | // e.g. cut2&cut3, cut2&cut3&cut4 |
572b0139 | 237 | fNSteps+=(fNAddSteps*fNStepMasks); // cuts for the additional cut masks |
554e40f8 | 238 | |
239 | if (fStepForPreFilter) fNSteps+=fNAddSteps; //Add at the end for Prefilter (maxcutmask+1) | |
240 | ||
b2a297fa | 241 | // create the container |
3505bfad | 242 | |
6551594b | 243 | Int_t *nbins=new Int_t[fNVars+2*fNVarsLeg]; |
3505bfad | 244 | for (Int_t i=0;i<fNVars;++i) { |
245 | Int_t nBins=(static_cast<TVectorD*>(fVarBinLimits->At(i)))->GetNrows()-1; | |
246 | nbins[i]=nBins; | |
247 | } | |
248 | for (Int_t i=0;i<fNVarsLeg;++i){ | |
249 | Int_t nBins=(static_cast<TVectorD*>(fVarBinLimitsLeg->At(i)))->GetNrows()-1; | |
250 | nbins[i+fNVars]=nBins; | |
251 | nbins[i+fNVars+fNVarsLeg]=nBins; | |
252 | } | |
6551594b | 253 | |
254 | fCfContainer = new AliCFContainer(GetName(), GetTitle(), fNSteps, fNVars+2*fNVarsLeg, nbins); | |
255 | delete [] nbins; | |
b2a297fa | 256 | |
257 | // initialize the variables and their bin limits | |
258 | for (Int_t iVar=0; iVar<fNVars; iVar++) { | |
259 | UInt_t type=fVariables[iVar]; | |
3505bfad | 260 | Double_t *binLim = (static_cast<TVectorD*>(fVarBinLimits->At(iVar)))->GetMatrixArray(); |
261 | ||
b2a297fa | 262 | fCfContainer->SetBinLimits(iVar, binLim); |
263 | fCfContainer->SetVarTitle(iVar, AliDielectronVarManager::GetValueName(type)); | |
6551594b | 264 | } |
265 | ||
266 | // initialize the variables and their bin limits for the Legs | |
267 | for (Int_t iVar=0; iVar<fNVarsLeg; iVar++) { | |
268 | UInt_t type=fVariablesLeg[iVar]; | |
3505bfad | 269 | Double_t *binLim=(static_cast<TVectorD*>(fVarBinLimitsLeg->At(iVar)))->GetMatrixArray(); |
6551594b | 270 | |
271 | //Leg1 | |
272 | fCfContainer->SetBinLimits(iVar+fNVars, binLim); | |
273 | fCfContainer->SetVarTitle(iVar+fNVars, Form("Leg1_%s",AliDielectronVarManager::GetValueName(type))); | |
274 | ||
275 | //Leg2 | |
276 | fCfContainer->SetBinLimits(iVar+fNVars+fNVarsLeg, binLim); | |
277 | fCfContainer->SetVarTitle(iVar+fNVars+fNVarsLeg, Form("Leg2_%s",AliDielectronVarManager::GetValueName(type))); | |
b2a297fa | 278 | } |
6551594b | 279 | |
280 | // array for storing values | |
281 | fValues = new Double_t[fNVars+2*fNVarsLeg]; | |
b2a297fa | 282 | |
283 | //=================// | |
284 | // Set step titles // | |
285 | //=================// | |
286 | Int_t step=0; | |
287 | ||
288 | //Pure MC truth | |
e123f993 | 289 | if (fStepForMCtruth){ |
8df8e382 | 290 | fCfContainer->SetStepTitle(step++,"MC truth"); |
e123f993 | 291 | } |
b2a297fa | 292 | |
293 | //before cuts (MC truth) | |
e123f993 | 294 | if (fStepForNoCutsMCmotherPid){ |
a655b716 | 295 | fCfContainer->SetStepTitle(step++,"No cuts (Signal)"); |
e123f993 | 296 | } |
b2a297fa | 297 | |
e123f993 | 298 | TString cutName; |
b2a297fa | 299 | //Steps for each of the cuts |
e123f993 | 300 | if (fStepsForEachCut&&fNCuts>1){ |
b2a297fa | 301 | for (Int_t iCut=0; iCut<fNCuts;++iCut) { |
37e9382d | 302 | cutName=filter.GetCuts()->At(iCut)->GetName(); //TODO: User GetTitle??? |
572b0139 | 303 | |
b2a297fa | 304 | fCfContainer->SetStepTitle(step++, cutName.Data()); //Step for the cut |
572b0139 | 305 | |
306 | if (fHasMC){ | |
307 | if (fStepsForSignal) | |
308 | fCfContainer->SetStepTitle(step++, (cutName+" (Signal)").Data()); //Step for the cut with MC truth | |
309 | if (fStepsForBackground) | |
310 | fCfContainer->SetStepTitle(step++, (cutName+" (Background)").Data()); //Step for the cut with MC truth | |
311 | } | |
b2a297fa | 312 | } |
313 | } | |
314 | ||
315 | //Steps for increasing cut match | |
78091935 | 316 | if (fStepsForCutsIncreasing&&fNCuts>2){ |
37e9382d | 317 | cutName=filter.GetCuts()->At(0)->GetName(); //TODO: User GetTitle??? |
b2a297fa | 318 | for (Int_t iCut=1; iCut<fNCuts-1;++iCut) { |
319 | cutName+="&"; | |
320 | cutName+=filter.GetCuts()->At(iCut)->GetName(); | |
572b0139 | 321 | |
b2a297fa | 322 | fCfContainer->SetStepTitle(step++, cutName.Data()); //Step for the cut |
572b0139 | 323 | |
324 | if (fHasMC){ | |
325 | if (fStepsForSignal) | |
326 | fCfContainer->SetStepTitle(step++, (cutName+" (Signal)").Data()); //Step for the cut with MC truth | |
327 | if (fStepsForBackground) | |
328 | fCfContainer->SetStepTitle(step++, (cutName+" (Background)").Data()); //Step for the cut with MC truth | |
329 | } | |
b2a297fa | 330 | } |
331 | } | |
332 | ||
333 | //Steps of user defined cut combinations | |
334 | for (UInt_t iComb=0; iComb<fNStepMasks; ++iComb){ | |
37e9382d | 335 | cutName=""; |
b2a297fa | 336 | UInt_t mask=fStepMasks[iComb]; |
337 | for (Int_t iCut=0; iCut<fNCuts;++iCut) { | |
338 | if (mask&(1<<iCut)){ | |
339 | if (cutName.IsNull()){ | |
340 | cutName=filter.GetCuts()->At(iCut)->GetName(); | |
341 | }else{ | |
342 | cutName+="&"; | |
343 | cutName+=filter.GetCuts()->At(iCut)->GetName(); | |
344 | } | |
345 | } | |
346 | } | |
572b0139 | 347 | |
b2a297fa | 348 | fCfContainer->SetStepTitle(step++, cutName.Data()); //Step for the cut |
572b0139 | 349 | |
350 | if (fHasMC){ | |
351 | if (fStepsForSignal) | |
352 | fCfContainer->SetStepTitle(step++, (cutName+" (Signal)").Data()); //Step for the cut with MC truth | |
353 | if (fStepsForBackground) | |
354 | fCfContainer->SetStepTitle(step++, (cutName+" (Background)").Data()); //Step for the cut with MC truth | |
355 | } | |
356 | } | |
357 | ||
358 | //After All cuts | |
359 | if (fStepForAfterAllCuts){ | |
360 | cutName="No pair cuts"; | |
361 | if (filter.GetCuts()->At(0)){ | |
362 | cutName=filter.GetCuts()->At(0)->GetName(); //TODO: User GetTitle??? | |
363 | for (Int_t iCut=1; iCut<fNCuts;++iCut) { | |
364 | cutName+="&"; | |
365 | cutName+=filter.GetCuts()->At(iCut)->GetName(); | |
366 | } | |
572b0139 | 367 | } |
8df8e382 | 368 | fCfContainer->SetStepTitle(step++, cutName.Data()); //Step for the cut |
572b0139 | 369 | if (fHasMC){ |
370 | if (fStepsForSignal) | |
371 | fCfContainer->SetStepTitle(step++, (cutName+" (Signal)").Data()); //Step for the cut with MC truth | |
372 | if (fStepsForBackground) | |
373 | fCfContainer->SetStepTitle(step++, (cutName+" (Background)").Data()); //Step for the cut with MC truth | |
374 | } | |
b2a297fa | 375 | } |
376 | ||
554e40f8 | 377 | //Additional Step for result after PreFilter |
378 | if (fStepForPreFilter){ | |
379 | cutName="PreFilter"; | |
380 | fCfContainer->SetStepTitle(step++, cutName.Data()); //Step for the cut | |
381 | if (fHasMC){ | |
382 | if (fStepsForSignal) | |
383 | fCfContainer->SetStepTitle(step++, (cutName+" (Signal)").Data()); //Step for the cut with MC truth | |
384 | if (fStepsForBackground) | |
385 | fCfContainer->SetStepTitle(step++, (cutName+" (Background)").Data()); //Step for the cut with MC truth | |
386 | } | |
387 | } | |
388 | ||
389 | ||
390 | ||
b2a297fa | 391 | if (step!=fNSteps) { |
8df8e382 | 392 | AliError(Form("Something went wrong in the naming of the steps!!! (%d != %d)",step,fNSteps)); |
b2a297fa | 393 | } |
394 | } | |
395 | ||
396 | //________________________________________________________________ | |
6551594b | 397 | void AliDielectronCF::Fill(UInt_t mask, const AliDielectronPair *particle) |
b2a297fa | 398 | { |
399 | // | |
400 | // Fill the containers | |
401 | // | |
402 | ||
403 | Bool_t isMCTruth=kFALSE; | |
572b0139 | 404 | if (fHasMC) isMCTruth=AliDielectronMC::Instance()->IsMotherPdg(particle,fPdgMother); |
b2a297fa | 405 | |
6551594b | 406 | Double_t valuesPair[AliDielectronVarManager::kNMaxValues]; |
407 | AliDielectronVarManager::Fill(particle,valuesPair); | |
b2a297fa | 408 | |
b2a297fa | 409 | for (Int_t iVar=0; iVar<fNVars; ++iVar){ |
410 | Int_t var=fVariables[iVar]; | |
6551594b | 411 | fValues[iVar]=valuesPair[var]; |
b2a297fa | 412 | } |
413 | ||
6551594b | 414 | if (fNVarsLeg>0){ |
415 | Double_t valuesLeg1[AliDielectronVarManager::kNMaxValues]; | |
416 | AliDielectronVarManager::Fill(particle->GetFirstDaughter(),valuesLeg1); | |
417 | Double_t valuesLeg2[AliDielectronVarManager::kNMaxValues]; | |
418 | AliDielectronVarManager::Fill(particle->GetSecondDaughter(),valuesLeg2); | |
419 | ||
420 | for (Int_t iVar=0; iVar<fNVarsLeg; ++iVar){ | |
421 | Int_t var=fVariablesLeg[iVar]; | |
422 | fValues[iVar+fNVars]=valuesLeg1[var]; | |
423 | fValues[iVar+fNVars+fNVarsLeg]=valuesLeg2[var]; | |
424 | } | |
425 | } | |
426 | ||
b2a297fa | 427 | UInt_t selectedMask=(1<<fNCuts)-1; |
428 | ||
429 | //============// | |
430 | // Fill steps // | |
431 | //============// | |
432 | // step 0 would be full MC truth and is handled in FillMC | |
e123f993 | 433 | Int_t step=0; |
434 | if (fStepForMCtruth) ++step; | |
8df8e382 | 435 | |
b2a297fa | 436 | //No cuts (MC truth) |
e123f993 | 437 | if (fStepForNoCutsMCmotherPid){ |
6551594b | 438 | if (isMCTruth) fCfContainer->Fill(fValues,step); |
b2a297fa | 439 | ++step; |
b2a297fa | 440 | } |
e123f993 | 441 | |
b2a297fa | 442 | //Steps for each of the cuts |
e123f993 | 443 | if (fStepsForEachCut&&fNCuts>1){ |
b2a297fa | 444 | for (Int_t iCut=0; iCut<fNCuts;++iCut) { |
445 | if (mask&(1<<iCut)) { | |
6551594b | 446 | fCfContainer->Fill(fValues,step); |
b2a297fa | 447 | ++step; |
572b0139 | 448 | |
449 | if (fHasMC){ | |
450 | if ( fStepsForSignal){ | |
451 | if (isMCTruth) fCfContainer->Fill(fValues,step); | |
452 | ++step; | |
453 | } | |
454 | if ( fStepsForBackground ){ | |
455 | if (!isMCTruth) fCfContainer->Fill(fValues,step); | |
456 | ++step; | |
457 | } | |
458 | } | |
b2a297fa | 459 | } else { |
572b0139 | 460 | step+=fNAddSteps; |
b2a297fa | 461 | } |
462 | } | |
463 | } | |
464 | ||
554e40f8 | 465 | |
b2a297fa | 466 | //Steps for increasing cut match |
78091935 | 467 | if (fStepsForCutsIncreasing&&fNCuts>2){ |
b2a297fa | 468 | for (Int_t iCut=1; iCut<fNCuts-1;++iCut) { |
469 | if (mask&(1<<((iCut+1)-1))) { | |
6551594b | 470 | fCfContainer->Fill(fValues,step); |
b2a297fa | 471 | ++step; |
572b0139 | 472 | |
473 | if (fHasMC){ | |
474 | if ( fStepsForSignal){ | |
475 | if (isMCTruth) fCfContainer->Fill(fValues,step); | |
476 | ++step; | |
477 | } | |
478 | if ( fStepsForBackground ){ | |
479 | if (!isMCTruth) fCfContainer->Fill(fValues,step); | |
480 | ++step; | |
481 | } | |
482 | } | |
b2a297fa | 483 | } else { |
572b0139 | 484 | step+=fNAddSteps; |
b2a297fa | 485 | } |
486 | } | |
487 | } | |
488 | ||
489 | //Steps of user defined cut combinations | |
490 | for (UInt_t iComb=0; iComb<fNStepMasks; ++iComb){ | |
491 | UInt_t userMask=fStepMasks[iComb]; | |
492 | if (mask&userMask) { | |
6551594b | 493 | fCfContainer->Fill(fValues,step); |
b2a297fa | 494 | ++step; |
572b0139 | 495 | |
496 | if (fHasMC){ | |
497 | if ( fStepsForSignal){ | |
498 | if (isMCTruth) fCfContainer->Fill(fValues,step); | |
499 | ++step; | |
500 | } | |
501 | if ( fStepsForBackground ){ | |
502 | if (!isMCTruth) fCfContainer->Fill(fValues,step); | |
503 | ++step; | |
504 | } | |
505 | } | |
506 | } else { | |
507 | step+=fNAddSteps; | |
508 | } | |
509 | } | |
510 | ||
511 | //All cuts | |
512 | if (fStepForAfterAllCuts){ | |
513 | if (mask == selectedMask){ | |
514 | fCfContainer->Fill(fValues,step); | |
b2a297fa | 515 | ++step; |
572b0139 | 516 | |
517 | if (fHasMC){ | |
518 | if ( fStepsForSignal){ | |
519 | if (isMCTruth) fCfContainer->Fill(fValues,step); | |
520 | ++step; | |
521 | } | |
522 | if ( fStepsForBackground ){ | |
523 | if (!isMCTruth) fCfContainer->Fill(fValues,step); | |
524 | ++step; | |
525 | } | |
526 | } | |
b2a297fa | 527 | } else { |
572b0139 | 528 | step+=fNAddSteps; |
b2a297fa | 529 | } |
530 | } | |
554e40f8 | 531 | if (fStepForPreFilter) { |
532 | if (mask&(1<<fNCuts)) { | |
533 | fCfContainer->Fill(fValues,step); | |
534 | ++step; | |
535 | ||
536 | if (fHasMC){ | |
537 | if ( fStepsForSignal){ | |
538 | if (isMCTruth) fCfContainer->Fill(fValues,step); | |
539 | ++step; | |
540 | } | |
541 | if ( fStepsForBackground ){ | |
542 | if (!isMCTruth) fCfContainer->Fill(fValues,step); | |
543 | ++step; | |
544 | } | |
545 | } | |
546 | } | |
547 | else { | |
548 | step+=fNAddSteps; | |
549 | } | |
550 | } | |
572b0139 | 551 | if (step!=fNSteps) { |
552 | AliError("Something went wrong in the step filling!!!"); | |
553 | } | |
554 | ||
b2a297fa | 555 | } |
556 | ||
557 | //________________________________________________________________ | |
558 | void AliDielectronCF::FillMC(const TObject *particle) | |
559 | { | |
560 | // | |
561 | // fill MC part of the Container | |
562 | // | |
e123f993 | 563 | if (!fStepForMCtruth) return; |
564 | ||
6551594b | 565 | Double_t valuesPair[AliDielectronVarManager::kNMaxValues]; |
566 | AliDielectronVarManager::Fill(particle,valuesPair); | |
8df8e382 | 567 | |
568 | AliVParticle *d1=0x0; | |
569 | AliVParticle *d2=0x0; | |
570 | AliDielectronMC::Instance()->GetDaughters(particle,d1,d2); | |
571 | ||
572 | valuesPair[AliDielectronVarManager::kThetaHE]=AliDielectronPair::ThetaPhiCM(d1,d2,kTRUE,kTRUE); | |
573 | valuesPair[AliDielectronVarManager::kPhiHE]=AliDielectronPair::ThetaPhiCM(d1,d2,kTRUE,kFALSE); | |
574 | valuesPair[AliDielectronVarManager::kThetaCS]=AliDielectronPair::ThetaPhiCM(d1,d2,kFALSE,kTRUE); | |
575 | valuesPair[AliDielectronVarManager::kPhiCS]=AliDielectronPair::ThetaPhiCM(d1,d2,kFALSE,kFALSE); | |
6551594b | 576 | |
a655b716 | 577 | //TODO: temporary solution, set manually the pair type to 1: unlikesign SE |
6551594b | 578 | valuesPair[AliDielectronVarManager::kPairType]=1; |
b2a297fa | 579 | |
b2a297fa | 580 | for (Int_t iVar=0; iVar<fNVars; ++iVar){ |
581 | Int_t var=fVariables[iVar]; | |
6551594b | 582 | fValues[iVar]=valuesPair[var]; |
b2a297fa | 583 | } |
6551594b | 584 | |
585 | if (fNVarsLeg>0){ | |
6551594b | 586 | Double_t valuesLeg1[AliDielectronVarManager::kNMaxValues]; |
6551594b | 587 | Double_t valuesLeg2[AliDielectronVarManager::kNMaxValues]; |
a655b716 | 588 | if (d1->Pt()>d2->Pt()){ |
589 | AliDielectronVarManager::Fill(d1,valuesLeg1); | |
590 | AliDielectronVarManager::Fill(d2,valuesLeg2); | |
591 | } else { | |
592 | AliDielectronVarManager::Fill(d2,valuesLeg1); | |
593 | AliDielectronVarManager::Fill(d1,valuesLeg2); | |
594 | } | |
6551594b | 595 | |
596 | for (Int_t iVar=0; iVar<fNVarsLeg; ++iVar){ | |
597 | Int_t var=fVariablesLeg[iVar]; | |
598 | fValues[iVar+fNVars]=valuesLeg1[var]; | |
599 | fValues[iVar+fNVars+fNVarsLeg]=valuesLeg2[var]; | |
600 | } | |
601 | } | |
602 | ||
603 | fCfContainer->Fill(fValues,0); | |
b2a297fa | 604 | } |
605 | ||
3505bfad | 606 | //_____________________________________________________________________________ |
607 | TVectorD* AliDielectronCF::MakeLogBinning(Int_t nbinsX, Double_t xmin, Double_t xmax) const | |
608 | { | |
609 | // | |
610 | // Make logarithmic binning | |
611 | // the user has to delete the array afterwards!!! | |
612 | // | |
613 | ||
614 | //check limits | |
615 | if (xmin<1e-20 || xmax<1e-20){ | |
616 | AliError("For Log binning xmin and xmax must be > 1e-20. Using linear binning instead!"); | |
617 | return MakeLinBinning(nbinsX, xmin, xmax); | |
618 | } | |
619 | if (xmax<xmin){ | |
620 | Double_t tmp=xmin; | |
621 | xmin=xmax; | |
622 | xmax=tmp; | |
623 | } | |
624 | TVectorD *binLim=new TVectorD(nbinsX+1); | |
625 | Double_t first=xmin; | |
626 | Double_t last=xmax; | |
627 | Double_t expMax=TMath::Log(last/first); | |
628 | for (Int_t i=0; i<nbinsX+1; ++i){ | |
629 | (*binLim)[i]=first*TMath::Exp(expMax/nbinsX*(Double_t)i); | |
630 | } | |
631 | return binLim; | |
632 | } | |
633 | ||
634 | //_____________________________________________________________________________ | |
635 | TVectorD* AliDielectronCF::MakeLinBinning(Int_t nbinsX, Double_t xmin, Double_t xmax) const | |
636 | { | |
637 | // | |
638 | // Make logarithmic binning | |
639 | // the user has to delete the array afterwards!!! | |
640 | // | |
641 | if (xmax<xmin){ | |
642 | Double_t tmp=xmin; | |
643 | xmin=xmax; | |
644 | xmax=tmp; | |
645 | } | |
646 | TVectorD *binLim=new TVectorD(nbinsX+1); | |
647 | Double_t first=xmin; | |
648 | Double_t last=xmax; | |
649 | Double_t binWidth=(last-first)/nbinsX; | |
650 | for (Int_t i=0; i<nbinsX+1; ++i){ | |
651 | (*binLim)[i]=first+binWidth*(Double_t)i; | |
652 | } | |
653 | return binLim; | |
654 | } | |
655 |