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