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