AliPhysics  6bc8652 (6bc8652)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 fillTree=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  hfTask->SetFillImpParTree(fillTree);
109 
110  hfTask->SetCheckBitD0flag(checkBitD0);
111  if(readmc&&useWeight)hfTask->SetPtWeightsFromDataPbPb276overLHC12a17a();
112  // hfTask->SignalInvMassCut(0.27);
113 
114  /* ############### HERE THE POSSIBILITY TO SWITCH ON/OFF THE TLISTS AND MC SELECTION WILL BE SET #########à
115 
116  hfTask->SetUseCuts(setD0usecuts);
117  hfTask->SetCheckMC(setcheckMC);
118  hfTask->SetCheckMC_D0(setcheckMC_D0);
119  hfTask->SetCheckMC_2prongs(setcheckMC_2prongs);
120  hfTask->SetCheckMC_prompt(setcheckMC_prompt);
121  hfTask->SetCheckMC_fromB(setcheckMC_fromB);
122  hfTask->SetCheckMC_fromDstar(setSkipD0star);
123  hfTask->SetStudyPureBackground(setStudyPureBack);*/
124  // hfTask->SetSideBands(0);
125  // hfTask->SetDebugLevel(2);
126  mgr->AddTask(hfTask);
127 
128 
129 
130  // Create containers for input/output
131  AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
132  //mgr->CreateContainer("cinput",TChain::Class(),AliAnalysisManager::kInputContainer);
133  mgr->ConnectInput(hfTask,0,cinput);
134 
135 
136  //Now container for general properties histograms
137  containername="outputNentries";
138  containername.Prepend(containerprefix.Data());
139  containername.Append(str.Data());
140  AliAnalysisDataContainer *coutputNentries = mgr->CreateContainer(containername.Data(),TH1F::Class(),
141  AliAnalysisManager::kOutputContainer,
142  fileout.Data());
143 
144  mgr->ConnectOutput(hfTask,1,coutputNentries);
145 
146  containername="outputSignalType";
147  containername.Prepend(containerprefix.Data());
148  containername.Append(str.Data());
149  AliAnalysisDataContainer *coutputSignalType = mgr->CreateContainer(containername.Data(),TH1F::Class(),
150  AliAnalysisManager::kOutputContainer,
151  fileout.Data());
152 
153  mgr->ConnectOutput(hfTask,2,coutputSignalType);
154 
155 
156  containername="outputSignalType_LsCuts";
157  containername.Prepend(containerprefix.Data());
158  containername.Append(str.Data());
159  AliAnalysisDataContainer *coutputSignalType_LsCuts = mgr->CreateContainer(containername.Data(),TH1F::Class(),
160  AliAnalysisManager::kOutputContainer,
161  fileout.Data());
162 
163  mgr->ConnectOutput(hfTask,3,coutputSignalType_LsCuts);
164 
165 
166  containername="outputSignalType_TghCuts";
167  containername.Prepend(containerprefix.Data());
168  containername.Append(str.Data());
169  AliAnalysisDataContainer *coutputSignalType_TghCuts = mgr->CreateContainer(containername.Data(),TH1F::Class(),
170  AliAnalysisManager::kOutputContainer,
171  fileout.Data());
172 
173  mgr->ConnectOutput(hfTask,4,coutputSignalType_TghCuts);
174 
175 
176  containername="outputNormalizationCounter";
177  containername.Prepend(containerprefix.Data());
178  containername.Append(str.Data());
179  AliAnalysisDataContainer *coutputNormCounter = mgr ->CreateContainer(containername.Data(), AliNormalizationCounter::Class(),
180  AliAnalysisManager::kOutputContainer,
181  fileout.Data());
182  mgr->ConnectOutput(hfTask, 5, coutputNormCounter);
183 
184  //Now Container for MC TList
185  containername="listMCproperties";
186  containername.Prepend(containerprefix.Data());
187  containername.Append(str.Data());
188  AliAnalysisDataContainer *clistMCprop = mgr->CreateContainer(containername.Data(),TList::Class(),
189  AliAnalysisManager::kOutputContainer,
190  fileout.Data());
191  mgr->ConnectOutput(hfTask,6,clistMCprop);
192 
193  // Now container for TLists
194  last=7;
195  //########## NO CUTS TLISTS CONTAINER ##############à
196  containername="listNCsign";
197  containername.Prepend(containerprefix.Data());
198  containername.Append(str.Data());
199  AliAnalysisDataContainer *clistNCsign = mgr->CreateContainer(containername.Data(),TList::Class(),
200  AliAnalysisManager::kOutputContainer,
201  fileout.Data());
202  mgr->ConnectOutput(hfTask,last,clistNCsign);
203  last++;
204 
205 
206  containername="listNCback";
207  containername.Prepend(containerprefix.Data());
208  containername.Append(str.Data());
209  AliAnalysisDataContainer *clistNCback = mgr->CreateContainer(containername.Data(),TList::Class(),
210  AliAnalysisManager::kOutputContainer,
211  fileout.Data());
212  mgr->ConnectOutput(hfTask,last,clistNCback);
213  last++;
214 
215  containername="listNCfromB";
216  containername.Prepend(containerprefix.Data());
217  containername.Append(str.Data());
218  AliAnalysisDataContainer *clistNCfromB = mgr->CreateContainer(containername.Data(),TList::Class(),
219  AliAnalysisManager::kOutputContainer,
220  fileout.Data());
221  mgr->ConnectOutput(hfTask,last,clistNCfromB);
222  last++;
223 
224 
225  containername="listNCfromDstar";
226  containername.Prepend(containerprefix.Data());
227  containername.Append(str.Data());
228  AliAnalysisDataContainer *clistNCfromDstar = mgr->CreateContainer(containername.Data(),TList::Class(),
229  AliAnalysisManager::kOutputContainer,
230  fileout.Data());
231  mgr->ConnectOutput(hfTask,last,clistNCfromDstar);
232  last++;
233 
234 
235  containername="listNCother";
236  containername.Prepend(containerprefix.Data());
237  containername.Append(str.Data());
238  AliAnalysisDataContainer *clistNCother = mgr->CreateContainer(containername.Data(),TList::Class(),
239  AliAnalysisManager::kOutputContainer,
240  fileout.Data());
241  mgr->ConnectOutput(hfTask,last,clistNCother);
242  last++;
243 
244 
245  //######### LOOSE CUTS TLISTS CONTAINER #############
246  containername="listLSCsign";
247  containername.Prepend(containerprefix.Data());
248  containername.Append(str.Data());
249  AliAnalysisDataContainer *clistLSCsign = mgr->CreateContainer(containername.Data(),TList::Class(),
250  AliAnalysisManager::kOutputContainer,
251  fileout.Data());
252  mgr->ConnectOutput(hfTask,last,clistLSCsign);
253  last++;
254 
255 
256  containername="listLSCback";
257  containername.Prepend(containerprefix.Data());
258  containername.Append(str.Data());
259  AliAnalysisDataContainer *clistLSCback = mgr->CreateContainer(containername.Data(),TList::Class(),
260  AliAnalysisManager::kOutputContainer,
261  fileout.Data());
262  mgr->ConnectOutput(hfTask,last,clistLSCback);
263  last++;
264 
265  containername="listLSCfromB";
266  containername.Prepend(containerprefix.Data());
267  containername.Append(str.Data());
268  AliAnalysisDataContainer *clistLSCfromB = mgr->CreateContainer(containername.Data(),TList::Class(),
269  AliAnalysisManager::kOutputContainer,
270  fileout.Data());
271  mgr->ConnectOutput(hfTask,last,clistLSCfromB);
272  last++;
273 
274 
275  containername="listLSCfromDstar";
276  containername.Prepend(containerprefix.Data());
277  containername.Append(str.Data());
278  AliAnalysisDataContainer *clistLSCfromDstar = mgr->CreateContainer(containername.Data(),TList::Class(),
279  AliAnalysisManager::kOutputContainer,
280  fileout.Data());
281  mgr->ConnectOutput(hfTask,last,clistLSCfromDstar);
282  last++;
283 
284 
285  containername="listLSCother";
286  containername.Prepend(containerprefix.Data());
287  containername.Append(str.Data());
288  AliAnalysisDataContainer *clistLSCother = mgr->CreateContainer(containername.Data(),TList::Class(),
289  AliAnalysisManager::kOutputContainer,
290  fileout.Data());
291  mgr->ConnectOutput(hfTask,last,clistLSCother);
292  last++;
293 
294 
295 
296  //######### TIGHT CUTS TLISTS CONTAINER #############
297  containername="listTGHCsign";
298  containername.Prepend(containerprefix.Data());
299  containername.Append(str.Data());
300  AliAnalysisDataContainer *clistTGHCsign = mgr->CreateContainer(containername.Data(),TList::Class(),
301  AliAnalysisManager::kOutputContainer,
302  fileout.Data());
303  mgr->ConnectOutput(hfTask,last,clistTGHCsign);
304  last++;
305 
306 
307  containername="listTGHCback";
308  containername.Prepend(containerprefix.Data());
309  containername.Append(str.Data());
310  AliAnalysisDataContainer *clistTGHCback = mgr->CreateContainer(containername.Data(),TList::Class(),
311  AliAnalysisManager::kOutputContainer,
312  fileout.Data());
313  mgr->ConnectOutput(hfTask,last,clistTGHCback);
314  last++;
315 
316  containername="listTGHCfromB";
317  containername.Prepend(containerprefix.Data());
318  containername.Append(str.Data());
319  AliAnalysisDataContainer *clistTGHCfromB = mgr->CreateContainer(containername.Data(),TList::Class(),
320  AliAnalysisManager::kOutputContainer,
321  fileout.Data());
322  mgr->ConnectOutput(hfTask,last,clistTGHCfromB);
323  last++;
324 
325 
326  containername="listTGHCfromDstar";
327  containername.Prepend(containerprefix.Data());
328  containername.Append(str.Data());
329  AliAnalysisDataContainer *clistTGHCfromDstar = mgr->CreateContainer(containername.Data(),TList::Class(),
330  AliAnalysisManager::kOutputContainer,
331  fileout.Data());
332  mgr->ConnectOutput(hfTask,last,clistTGHCfromDstar);
333  last++;
334 
335 
336  containername="listTGHCother";
337  containername.Prepend(containerprefix.Data());
338  containername.Append(str.Data());
339  AliAnalysisDataContainer *clistTGHCother = mgr->CreateContainer(containername.Data(),TList::Class(),
340  AliAnalysisManager::kOutputContainer,
341  fileout.Data());
342  mgr->ConnectOutput(hfTask,last,clistTGHCother);
343  last++;
344 
345  // Container for Cuts Objects
346  containername="cutsObjectTight";
347  containername.Prepend(containerprefix.Data());
348  containername.Append(str.Data());
349  AliAnalysisDataContainer *cCutsObjectTight = mgr->CreateContainer(containername,AliRDHFCutsD0toKpi::Class(),AliAnalysisManager::kOutputContainer,fileout.Data()); //cuts
350  mgr->ConnectOutput(hfTask,last,cCutsObjectTight);
351  last++;
352 
353  containername="cutsObjectLoose";
354  containername.Prepend(containerprefix.Data());
355  containername.Append(str.Data());
356  AliAnalysisDataContainer *cCutsObjectLoose = mgr->CreateContainer(containername,AliRDHFCutsD0toKpi::Class(),AliAnalysisManager::kOutputContainer,fileout.Data()); //cuts
357  mgr->ConnectOutput(hfTask,last,cCutsObjectLoose);
358 
359  return hfTask;
360 }
return jsonbuilder str().c_str()
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
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 fillTree=kFALSE, Bool_t checkBitD0=kTRUE)
float Float_t
Definition: External.C:68
void SetMaxCentrality(Float_t maxCentrality=100.)
Definition: AliRDHFCuts.h:52
void SetRemoveDaughtersFromPrim(Bool_t removeDaughtersPrim)
Definition: AliRDHFCuts.h:216
void SetMinPtCandidate(Double_t ptCand=-1.)
Definition: AliRDHFCuts.h:217
bool Bool_t
Definition: External.C:53
virtual void SetStandardCutsPbPb2011()