Added normalization counter (Andrea, Davide)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / macros / AddTaskSECharmFraction.C
CommitLineData
77ed0cdb 1AliAnalysisTaskSECharmFraction* AddTaskSECharmFraction(TString fileout="d0D0.root",Int_t switchMC[5],Bool_t readmc=kFALSE,Bool_t usepid=kTRUE,Bool_t likesign=kFALSE,TString cutfile="D0toKpiCharmFractCuts.root",TString containerprefix="c",Int_t ppPbPb=0,Int_t analysLevel=3)
95e5b6b5 2{
3 //
4 // Configuration macro for the task to analyze the fraction of prompt charm
5 // using the D0 impact parameter
6 // andrea.rossi@ts.infn.it
7 //
8 //==========================================================================
9
10 //######## !!! THE SWITCH FOR MC ANALYSIS IS NOT IMPLEMENTED YET!!! ##########à
11 switchMC[0]=1;
12 switchMC[1]=1;
13 switchMC[2]=1;
14 switchMC[3]=1;
15 switchMC[4]=1;
16 Int_t last=0;
17
18 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
19 if (!mgr) {
20 ::Error("AddTaskCharmFraction", "No analysis manager to connect to.");
21 return NULL;
22 }
8399826a 23
24 TString str,containername;
25 if(fileout=="standard"){
26 fileout=AliAnalysisManager::GetCommonFileName();
27 fileout+=":PWG3_D2H_";
28 fileout+="d0D0";
29 if(containerprefix!="c")fileout+=containerprefix;
30 str="d0D0";
31 }
77ed0cdb 32 else if(fileout=="standardUp"){
33 fileout=AliAnalysisManager::GetCommonFileName();
34 fileout+=":PWG3_D2H_Up_";
35 fileout+="d0D0";
36 if(containerprefix!="c")fileout+=containerprefix;
37 str="d0D0";
38 }
8399826a 39 else {
40 str=fileout;
41 str.ReplaceAll(".root","");
42 }
95e5b6b5 43 str.Prepend("_");
44
95e5b6b5 45 AliAnalysisTaskSECharmFraction *hfTask;
8399826a 46 if(!gSystem->AccessPathName(cutfile.Data(),kFileExists)){
47 TFile *f=TFile::Open(cutfile.Data());
48 AliRDHFCutsD0toKpi *cutTight= (AliRDHFCutsD0toKpi*)f->Get("D0toKpiCutsStandard");
49 cutTight->PrintAll();
50 AliRDHFCutsD0toKpi *cutLoose= (AliRDHFCutsD0toKpi*)f->Get("D0toKpiCutsLoose");
51 cutLoose->PrintAll();
52 hfTask = new AliAnalysisTaskSECharmFraction("AliAnalysisTaskSECharmFraction",cutTight,cutLoose);
53 }
cc3209fb 54 else {
77ed0cdb 55 //hfTask = new AliAnalysisTaskSECharmFraction("AliAnalysisTaskSECharmFraction");
56 AliRDHFCutsD0toKpi *cutTight=new AliRDHFCutsD0toKpi("D0toKpiCutsStandard");
57 AliRDHFCutsD0toKpi *cutLoose=new AliRDHFCutsD0toKpi("D0toKpiCutsLoose");
58 if(ppPbPb==1){
59 cutTight->SetStandardCutsPbPb2010();
60 cutTight->SetMinCentrality(0.);
61 cutTight->SetMaxCentrality(20.);
62 cutLoose->SetStandardCutsPbPb2010();
63 cutLoose->SetMinCentrality(40.);
64 cutLoose->SetMaxCentrality(80.);
65 }
66 else {
67 cutTight->SetStandardCutsPP2010();
68 cutLoose->SetStandardCutsPP2010();
69 }
70 hfTask = new AliAnalysisTaskSECharmFraction("AliAnalysisTaskSECharmFraction",cutTight,cutLoose);
71 cutLoose->PrintAll();
cc3209fb 72 }
8399826a 73
cc3209fb 74 if(ppPbPb==1){// Switch Off recalctulation of primary vertex w/o candidate's daughters
77ed0cdb 75 // a protection that must be kept here to be sure
76 //that this is done also if the cut objects are provided by outside
cc3209fb 77 Printf("AddTaskSECharmFraction: Switch Off recalctulation of primary vertex w/o candidate's daughters (PbPb analysis) \n");
78 AliRDHFCutsD0toKpi *cloose=hfTask->GetLooseCut();
79 AliRDHFCutsD0toKpi *ctight=hfTask->GetTightCut();
80 cloose->SetRemoveDaughtersFromPrim(kFALSE);
81 ctight->SetRemoveDaughtersFromPrim(kFALSE);
82 // Activate Default PID for proton rejection (TEMPORARY)
77ed0cdb 83 // cloose->SetUseDefaultPID(kTRUE);
84 // ctight->SetUseDefaultPID(kTRUE);
cc3209fb 85 }
86
8399826a 87 hfTask->SetReadMC(readmc);
88 hfTask->SetNMaxTrForVtx(2);
89 hfTask->SetAnalyzeLikeSign(likesign);
90 hfTask->SetUsePID(usepid);
91 hfTask->SetStandardMassSelection();
f1fddf78 92 hfTask->SetAnalysisLevel(analysLevel);
8399826a 93 // hfTask->SignalInvMassCut(0.27);
95e5b6b5 94
95 /* ############### HERE THE POSSIBILITY TO SWITCH ON/OFF THE TLISTS AND MC SELECTION WILL BE SET #########à
96
97 hfTask->SetUseCuts(setD0usecuts);
98 hfTask->SetCheckMC(setcheckMC);
99 hfTask->SetCheckMC_D0(setcheckMC_D0);
100 hfTask->SetCheckMC_2prongs(setcheckMC_2prongs);
101 hfTask->SetCheckMC_prompt(setcheckMC_prompt);
102 hfTask->SetCheckMC_fromB(setcheckMC_fromB);
103 hfTask->SetCheckMC_fromDstar(setSkipD0star);
104 hfTask->SetStudyPureBackground(setStudyPureBack);*/
105 // hfTask->SetSideBands(0);
106 // hfTask->SetDebugLevel(2);
107 mgr->AddTask(hfTask);
108
109
110
111 // Create containers for input/output
112 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
113 //mgr->CreateContainer("cinput",TChain::Class(),AliAnalysisManager::kInputContainer);
114 mgr->ConnectInput(hfTask,0,cinput);
115
116
117 //Now container for general properties histograms
8399826a 118 containername="outputNentries";
119 containername.Prepend(containerprefix.Data());
95e5b6b5 120 containername.Append(str.Data());
121 AliAnalysisDataContainer *coutputNentries = mgr->CreateContainer(containername.Data(),TH1F::Class(),
122 AliAnalysisManager::kOutputContainer,
8399826a 123 fileout.Data());
95e5b6b5 124
125 mgr->ConnectOutput(hfTask,1,coutputNentries);
126
8399826a 127 containername="outputSignalType";
128 containername.Prepend(containerprefix.Data());
95e5b6b5 129 containername.Append(str.Data());
130 AliAnalysisDataContainer *coutputSignalType = mgr->CreateContainer(containername.Data(),TH1F::Class(),
131 AliAnalysisManager::kOutputContainer,
8399826a 132 fileout.Data());
95e5b6b5 133
134 mgr->ConnectOutput(hfTask,2,coutputSignalType);
135
136
8399826a 137 containername="outputSignalType_LsCuts";
138 containername.Prepend(containerprefix.Data());
95e5b6b5 139 containername.Append(str.Data());
140 AliAnalysisDataContainer *coutputSignalType_LsCuts = mgr->CreateContainer(containername.Data(),TH1F::Class(),
141 AliAnalysisManager::kOutputContainer,
8399826a 142 fileout.Data());
95e5b6b5 143
144 mgr->ConnectOutput(hfTask,3,coutputSignalType_LsCuts);
145
146
8399826a 147 containername="outputSignalType_TghCuts";
148 containername.Prepend(containerprefix.Data());
95e5b6b5 149 containername.Append(str.Data());
150 AliAnalysisDataContainer *coutputSignalType_TghCuts = mgr->CreateContainer(containername.Data(),TH1F::Class(),
151 AliAnalysisManager::kOutputContainer,
8399826a 152 fileout.Data());
95e5b6b5 153
154 mgr->ConnectOutput(hfTask,4,coutputSignalType_TghCuts);
bd0c851a 155
156
157 containername="outputNormalizationCounter";
158 containername.Prepend(containerprefix.Data());
159 containername.Append(str.Data());
160 AliAnalysisDataContainer *coutputNormCounter = mgr ->CreateContainer(containername.Data(), AliNormalizationCounter::Class(),
161 AliAnalysisManager::kOutputContainer,
162 fileout.Data());
163 mgr->ConnectOutput(hfTask, 5, coutputNormCounter);
164
165 //Now Container for MC TList
8399826a 166 containername="listMCproperties";
167 containername.Prepend(containerprefix.Data());
168 containername.Append(str.Data());
169 AliAnalysisDataContainer *clistMCprop = mgr->CreateContainer(containername.Data(),TList::Class(),
170 AliAnalysisManager::kOutputContainer,
171 fileout.Data());
bd0c851a 172 mgr->ConnectOutput(hfTask,6,clistMCprop);
8399826a 173
95e5b6b5 174 // Now container for TLists
bd0c851a 175 last=7;
95e5b6b5 176 //########## NO CUTS TLISTS CONTAINER ##############à
8399826a 177 containername="listNCsign";
178 containername.Prepend(containerprefix.Data());
95e5b6b5 179 containername.Append(str.Data());
180 AliAnalysisDataContainer *clistNCsign = mgr->CreateContainer(containername.Data(),TList::Class(),
181 AliAnalysisManager::kOutputContainer,
8399826a 182 fileout.Data());
95e5b6b5 183 mgr->ConnectOutput(hfTask,last,clistNCsign);
184 last++;
185
186
8399826a 187 containername="listNCback";
188 containername.Prepend(containerprefix.Data());
95e5b6b5 189 containername.Append(str.Data());
190 AliAnalysisDataContainer *clistNCback = mgr->CreateContainer(containername.Data(),TList::Class(),
191 AliAnalysisManager::kOutputContainer,
8399826a 192 fileout.Data());
95e5b6b5 193 mgr->ConnectOutput(hfTask,last,clistNCback);
194 last++;
195
8399826a 196 containername="listNCfromB";
197 containername.Prepend(containerprefix.Data());
95e5b6b5 198 containername.Append(str.Data());
199 AliAnalysisDataContainer *clistNCfromB = mgr->CreateContainer(containername.Data(),TList::Class(),
200 AliAnalysisManager::kOutputContainer,
8399826a 201 fileout.Data());
95e5b6b5 202 mgr->ConnectOutput(hfTask,last,clistNCfromB);
203 last++;
204
205
8399826a 206 containername="listNCfromDstar";
207 containername.Prepend(containerprefix.Data());
95e5b6b5 208 containername.Append(str.Data());
209 AliAnalysisDataContainer *clistNCfromDstar = mgr->CreateContainer(containername.Data(),TList::Class(),
210 AliAnalysisManager::kOutputContainer,
8399826a 211 fileout.Data());
95e5b6b5 212 mgr->ConnectOutput(hfTask,last,clistNCfromDstar);
213 last++;
214
215
8399826a 216 containername="listNCother";
217 containername.Prepend(containerprefix.Data());
95e5b6b5 218 containername.Append(str.Data());
219 AliAnalysisDataContainer *clistNCother = mgr->CreateContainer(containername.Data(),TList::Class(),
220 AliAnalysisManager::kOutputContainer,
8399826a 221 fileout.Data());
95e5b6b5 222 mgr->ConnectOutput(hfTask,last,clistNCother);
223 last++;
224
225
226 //######### LOOSE CUTS TLISTS CONTAINER #############
8399826a 227 containername="listLSCsign";
228 containername.Prepend(containerprefix.Data());
95e5b6b5 229 containername.Append(str.Data());
230 AliAnalysisDataContainer *clistLSCsign = mgr->CreateContainer(containername.Data(),TList::Class(),
231 AliAnalysisManager::kOutputContainer,
8399826a 232 fileout.Data());
95e5b6b5 233 mgr->ConnectOutput(hfTask,last,clistLSCsign);
234 last++;
235
236
8399826a 237 containername="listLSCback";
238 containername.Prepend(containerprefix.Data());
95e5b6b5 239 containername.Append(str.Data());
240 AliAnalysisDataContainer *clistLSCback = mgr->CreateContainer(containername.Data(),TList::Class(),
241 AliAnalysisManager::kOutputContainer,
8399826a 242 fileout.Data());
95e5b6b5 243 mgr->ConnectOutput(hfTask,last,clistLSCback);
244 last++;
245
8399826a 246 containername="listLSCfromB";
247 containername.Prepend(containerprefix.Data());
95e5b6b5 248 containername.Append(str.Data());
249 AliAnalysisDataContainer *clistLSCfromB = mgr->CreateContainer(containername.Data(),TList::Class(),
250 AliAnalysisManager::kOutputContainer,
8399826a 251 fileout.Data());
95e5b6b5 252 mgr->ConnectOutput(hfTask,last,clistLSCfromB);
253 last++;
254
255
8399826a 256 containername="listLSCfromDstar";
257 containername.Prepend(containerprefix.Data());
95e5b6b5 258 containername.Append(str.Data());
259 AliAnalysisDataContainer *clistLSCfromDstar = mgr->CreateContainer(containername.Data(),TList::Class(),
260 AliAnalysisManager::kOutputContainer,
8399826a 261 fileout.Data());
95e5b6b5 262 mgr->ConnectOutput(hfTask,last,clistLSCfromDstar);
263 last++;
264
265
8399826a 266 containername="listLSCother";
267 containername.Prepend(containerprefix.Data());
95e5b6b5 268 containername.Append(str.Data());
269 AliAnalysisDataContainer *clistLSCother = mgr->CreateContainer(containername.Data(),TList::Class(),
270 AliAnalysisManager::kOutputContainer,
8399826a 271 fileout.Data());
95e5b6b5 272 mgr->ConnectOutput(hfTask,last,clistLSCother);
273 last++;
274
275
276
277 //######### TIGHT CUTS TLISTS CONTAINER #############
8399826a 278 containername="listTGHCsign";
279 containername.Prepend(containerprefix.Data());
95e5b6b5 280 containername.Append(str.Data());
281 AliAnalysisDataContainer *clistTGHCsign = mgr->CreateContainer(containername.Data(),TList::Class(),
282 AliAnalysisManager::kOutputContainer,
8399826a 283 fileout.Data());
95e5b6b5 284 mgr->ConnectOutput(hfTask,last,clistTGHCsign);
285 last++;
286
287
8399826a 288 containername="listTGHCback";
289 containername.Prepend(containerprefix.Data());
95e5b6b5 290 containername.Append(str.Data());
291 AliAnalysisDataContainer *clistTGHCback = mgr->CreateContainer(containername.Data(),TList::Class(),
292 AliAnalysisManager::kOutputContainer,
8399826a 293 fileout.Data());
95e5b6b5 294 mgr->ConnectOutput(hfTask,last,clistTGHCback);
295 last++;
296
8399826a 297 containername="listTGHCfromB";
298 containername.Prepend(containerprefix.Data());
95e5b6b5 299 containername.Append(str.Data());
300 AliAnalysisDataContainer *clistTGHCfromB = mgr->CreateContainer(containername.Data(),TList::Class(),
301 AliAnalysisManager::kOutputContainer,
8399826a 302 fileout.Data());
95e5b6b5 303 mgr->ConnectOutput(hfTask,last,clistTGHCfromB);
304 last++;
305
306
8399826a 307 containername="listTGHCfromDstar";
308 containername.Prepend(containerprefix.Data());
95e5b6b5 309 containername.Append(str.Data());
310 AliAnalysisDataContainer *clistTGHCfromDstar = mgr->CreateContainer(containername.Data(),TList::Class(),
311 AliAnalysisManager::kOutputContainer,
8399826a 312 fileout.Data());
95e5b6b5 313 mgr->ConnectOutput(hfTask,last,clistTGHCfromDstar);
314 last++;
315
316
8399826a 317 containername="listTGHCother";
318 containername.Prepend(containerprefix.Data());
95e5b6b5 319 containername.Append(str.Data());
320 AliAnalysisDataContainer *clistTGHCother = mgr->CreateContainer(containername.Data(),TList::Class(),
321 AliAnalysisManager::kOutputContainer,
8399826a 322 fileout.Data());
95e5b6b5 323 mgr->ConnectOutput(hfTask,last,clistTGHCother);
8399826a 324 last++;
95e5b6b5 325
8399826a 326 // Container for Cuts Objects
327 containername="cutsObjectTight";
328 containername.Prepend(containerprefix.Data());
329 containername.Append(str.Data());
330 AliAnalysisDataContainer *cCutsObjectTight = mgr->CreateContainer(containername,AliRDHFCutsD0toKpi::Class(),AliAnalysisManager::kOutputContainer,fileout.Data()); //cuts
331 mgr->ConnectOutput(hfTask,last,cCutsObjectTight);
332 last++;
333
334 containername="cutsObjectLoose";
335 containername.Prepend(containerprefix.Data());
336 containername.Append(str.Data());
337 AliAnalysisDataContainer *cCutsObjectLoose = mgr->CreateContainer(containername,AliRDHFCutsD0toKpi::Class(),AliAnalysisManager::kOutputContainer,fileout.Data()); //cuts
338 mgr->ConnectOutput(hfTask,last,cCutsObjectLoose);
95e5b6b5 339
340 return hfTask;
341}