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