AliPhysics  cdeda5a (cdeda5a)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AddTaskLc2eleLambdafromAODtracks.C
Go to the documentation of this file.
2  Bool_t theMCon=kFALSE,
3  Int_t iscoltype= 0,
4  Bool_t writeVariableTree=kFALSE,
5  Int_t domixing=0,
6  Bool_t reconstructPrimVert=kFALSE,
7  Bool_t writeEachVariableTree=kFALSE,
8  Bool_t writeMCVariableTree=kFALSE,
9  TString estimatorFilename="",
10  Int_t nTour=0
11  )
12 
13 {
14 
15  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
16  if (!mgr) {
17  ::Error("AddTaskLc2V0YW", "No analysis manager to connect to.");
18  return NULL;
19  }
20 
21  Bool_t stdcuts=kFALSE;
22  TFile* filecuts;
23  if( finname.EqualTo("") ) {
24  stdcuts=kTRUE;
25  } else {
26  filecuts=TFile::Open(finname.Data());
27  if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
28  AliFatal("Input file not found : check your cut object");
29  }
30  }
31 
33  if (stdcuts) RDHFCutsLc2eleLambdaanal->SetStandardCutsPP2010();
34  else RDHFCutsLc2eleLambdaanal = (AliRDHFCutsLctoeleLambdafromAODtracks*)filecuts->Get("eleLambdaAnalysisCuts");
35  RDHFCutsLc2eleLambdaanal->SetName("eleLambdaAnalysisCuts");
36  RDHFCutsLc2eleLambdaanal->SetMinPtCandidate(-1.);
37  RDHFCutsLc2eleLambdaanal->SetMaxPtCandidate(10000.);
38  if (!RDHFCutsLc2eleLambdaanal) {
39  cout << "Specific AliRDHFCutsLc2eleLambdaanal not found\n";
40  return;
41  }
42 
43  //CREATE THE TASK
44 
45  printf("CREATE TASK\n");
46  AliAnalysisTaskSELc2eleLambdafromAODtracks *task = new AliAnalysisTaskSELc2eleLambdafromAODtracks("AliAnalysisTaskSELc2eleLambdafromAODtracks",RDHFCutsLc2eleLambdaanal,writeVariableTree);
47  task->SetMC(theMCon);
48  if(iscoltype==0){
49  task->SetUseCentralityV0M(kFALSE);
50  task->SetUseCentralitySPDTracklet(kFALSE);
51  }else{
52  task->SetUseCentralityV0M(kTRUE);
53  task->SetUseEventPlane(14);
54  }
55  task->SetDebugLevel(1);
56  task->SetReconstructPrimVert(reconstructPrimVert);
57  task->SetWriteEachVariableTree(writeEachVariableTree);
58  task->SetWriteMCVariableTree(writeMCVariableTree);
59 
60  if(iscoltype==0){
61  if(domixing==0){
62  task->SetEventMixingOff();
63  }else{
65  Double_t pvzbinlimits[] = {-12,-10,-8,-6,-4,-2,0,2,4,6,8,10,12};
66  Int_t pvzbinnumb = sizeof(pvzbinlimits)/sizeof(Double_t) - 1;
67  task->SetPoolPVzBinLimits(pvzbinnumb,pvzbinlimits);
68 
69  Double_t cent_mult_binlimitspp[] = { 0,100};
70  Int_t cent_mult_bin_numbpp = sizeof(cent_mult_binlimitspp)/sizeof(Double_t) - 1;
71  task->SetPoolCentBinLimits(cent_mult_bin_numbpp,cent_mult_binlimitspp);
72 
73  Int_t nrpbin = 1.;
74  Double_t rpbinlimits[2] = {-3.2,3.2};
75  task->SetPoolRPBinLimits(nrpbin,rpbinlimits);
76 
77  task->SetNumberOfEventsForMixing(10);//pp
78  }
79  }else if(iscoltype==1){
80  if(domixing==0){
81  task->SetEventMixingOff();
82  }else{
84  Double_t pvzbinlimits[] = {-12,-10,-8,-6,-4,-2,0,2,4,6,8,10,12};
85  Int_t pvzbinnumb = sizeof(pvzbinlimits)/sizeof(Double_t) - 1;
86  task->SetPoolPVzBinLimits(pvzbinnumb,pvzbinlimits);
87 
88  Double_t cent_mult_binlimitspPb[] = { 0,10,20,30,40,50,60,70,80,90,100};
89  Int_t cent_mult_bin_numbpPb = sizeof(cent_mult_binlimitspPb)/sizeof(Double_t) - 1;
90  task->SetPoolCentBinLimits(cent_mult_bin_numbpPb,cent_mult_binlimitspPb);
91 
92  Int_t nrpbin = 1.;
93  Double_t rpbinlimits[2] = {-3.2,3.2};
94  task->SetPoolRPBinLimits(nrpbin,rpbinlimits);
95 
96  task->SetNumberOfEventsForMixing(10);//pPb
97  }
98  }else if(iscoltype==2){
99  if(domixing==0){
100  task->SetEventMixingOff();
101  }else if(domixing==1){
102  //Standard
103  task->SetEventMixingWithPools();
104  Double_t pvzbinlimits[] = {-12,-10,-8,-6,-4,-2,0,2,4,6,8,10,12};
105  Int_t pvzbinnumb = sizeof(pvzbinlimits)/sizeof(Double_t) - 1;
106  task->SetPoolPVzBinLimits(pvzbinnumb,pvzbinlimits);
107 
108  Double_t cent_mult_binlimitsPbPb[] = { 0,2.5,5,7.5,10,20,30,40,50,60,70,80,90,100};
109  Int_t cent_mult_bin_numbPbPb = sizeof(cent_mult_binlimitsPbPb)/sizeof(Double_t) - 1;
110  task->SetPoolCentBinLimits(cent_mult_bin_numbPbPb,cent_mult_binlimitsPbPb);
111 
112  Int_t nrpbin = 8;
113  Double_t rpbinlimits[9];
114  Double_t steprp = TMath::Pi()/(Double_t)nrpbin;
115  for(Int_t ir=0;ir<9;ir++){
116  rpbinlimits[ir] = steprp * (Double_t) ir;
117  }
118  task->SetPoolRPBinLimits(nrpbin,rpbinlimits);
119 
120  task->SetNumberOfEventsForMixing(10);//PbPb
121  }else if(domixing==2){
122  //Depth x 1/2
123  task->SetEventMixingWithPools();
124  Double_t pvzbinlimits[] = {-12,-10,-8,-6,-4,-2,0,2,4,6,8,10,12};
125  Int_t pvzbinnumb = sizeof(pvzbinlimits)/sizeof(Double_t) - 1;
126  task->SetPoolPVzBinLimits(pvzbinnumb,pvzbinlimits);
127 
128  Double_t cent_mult_binlimitsPbPb[] = { 0,2.5,5,7.5,10,20,30,40,50,60,70,80,90,100};
129  Int_t cent_mult_bin_numbPbPb = sizeof(cent_mult_binlimitsPbPb)/sizeof(Double_t) - 1;
130  task->SetPoolCentBinLimits(cent_mult_bin_numbPbPb,cent_mult_binlimitsPbPb);
131 
132  Int_t nrpbin = 8;
133  Double_t rpbinlimits[9];
134  Double_t steprp = TMath::Pi()/(Double_t)nrpbin;
135  for(Int_t ir=0;ir<9;ir++){
136  rpbinlimits[ir] = steprp * (Double_t) ir;
137  }
138  task->SetPoolRPBinLimits(nrpbin,rpbinlimits);
139 
140  task->SetNumberOfEventsForMixing(5);//PbPb
141  }else if(domixing==3){
142  //Depth x 2
143  task->SetEventMixingWithPools();
144  Double_t pvzbinlimits[] = {-12,-10,-8,-6,-4,-2,0,2,4,6,8,10,12};
145  Int_t pvzbinnumb = sizeof(pvzbinlimits)/sizeof(Double_t) - 1;
146  task->SetPoolPVzBinLimits(pvzbinnumb,pvzbinlimits);
147 
148  Double_t cent_mult_binlimitsPbPb[] = { 0,2.5,5,7.5,10,20,30,40,50,60,70,80,90,100};
149  Int_t cent_mult_bin_numbPbPb = sizeof(cent_mult_binlimitsPbPb)/sizeof(Double_t) - 1;
150  task->SetPoolCentBinLimits(cent_mult_bin_numbPbPb,cent_mult_binlimitsPbPb);
151 
152  Int_t nrpbin = 8;
153  Double_t rpbinlimits[9];
154  Double_t steprp = TMath::Pi()/(Double_t)nrpbin;
155  for(Int_t ir=0;ir<9;ir++){
156  rpbinlimits[ir] = steprp * (Double_t) ir;
157  }
158  task->SetPoolRPBinLimits(nrpbin,rpbinlimits);
159 
160  task->SetNumberOfEventsForMixing(20);//PbPb
161  }else if(domixing==4){
162  //z binning x1/2
163  task->SetEventMixingWithPools();
164  Double_t pvzbinlimits[] = {-12,-10,-6,-2,2,6,10,12};
165  Int_t pvzbinnumb = sizeof(pvzbinlimits)/sizeof(Double_t) - 1;
166  task->SetPoolPVzBinLimits(pvzbinnumb,pvzbinlimits);
167 
168  Double_t cent_mult_binlimitsPbPb[] = { 0,2.5,5,7.5,10,20,30,40,50,60,70,80,90,100};
169  Int_t cent_mult_bin_numbPbPb = sizeof(cent_mult_binlimitsPbPb)/sizeof(Double_t) - 1;
170  task->SetPoolCentBinLimits(cent_mult_bin_numbPbPb,cent_mult_binlimitsPbPb);
171 
172  Int_t nrpbin = 8;
173  Double_t rpbinlimits[9];
174  Double_t steprp = TMath::Pi()/(Double_t)nrpbin;
175  for(Int_t ir=0;ir<9;ir++){
176  rpbinlimits[ir] = steprp * (Double_t) ir;
177  }
178  task->SetPoolRPBinLimits(nrpbin,rpbinlimits);
179 
180  task->SetNumberOfEventsForMixing(10);//PbPb
181  }else if(domixing==5){
182  //z binning x2
183  task->SetEventMixingWithPools();
184  Double_t pvzbinlimits[] = {-12,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,12};
185  Int_t pvzbinnumb = sizeof(pvzbinlimits)/sizeof(Double_t) - 1;
186  task->SetPoolPVzBinLimits(pvzbinnumb,pvzbinlimits);
187 
188  Double_t cent_mult_binlimitsPbPb[] = { 0,2.5,5,7.5,10,20,30,40,50,60,70,80,90,100};
189  Int_t cent_mult_bin_numbPbPb = sizeof(cent_mult_binlimitsPbPb)/sizeof(Double_t) - 1;
190  task->SetPoolCentBinLimits(cent_mult_bin_numbPbPb,cent_mult_binlimitsPbPb);
191 
192  Int_t nrpbin = 8;
193  Double_t rpbinlimits[9];
194  Double_t steprp = TMath::Pi()/(Double_t)nrpbin;
195  for(Int_t ir=0;ir<9;ir++){
196  rpbinlimits[ir] = steprp * (Double_t) ir;
197  }
198  task->SetPoolRPBinLimits(nrpbin,rpbinlimits);
199 
200  task->SetNumberOfEventsForMixing(10);//PbPb
201  }else if(domixing==6){
202  //Cent x 2
203  task->SetEventMixingWithPools();
204  Double_t pvzbinlimits[] = {-12,-10,-8,-6,-4,-2,0,2,4,6,8,10,12};
205  Int_t pvzbinnumb = sizeof(pvzbinlimits)/sizeof(Double_t) - 1;
206  task->SetPoolPVzBinLimits(pvzbinnumb,pvzbinlimits);
207 
208  Double_t cent_mult_binlimitsPbPb[] = { 0,1.25,2.5,3.75,5,6.25,7.5,8.75,10,15.,20,25.,30,35.,40,45.,50,55.,60,65.,70,75.,80,85.,90,100};
209  Int_t cent_mult_bin_numbPbPb = sizeof(cent_mult_binlimitsPbPb)/sizeof(Double_t) - 1;
210  task->SetPoolCentBinLimits(cent_mult_bin_numbPbPb,cent_mult_binlimitsPbPb);
211 
212  Int_t nrpbin = 8;
213  Double_t rpbinlimits[9];
214  Double_t steprp = TMath::Pi()/(Double_t)nrpbin;
215  for(Int_t ir=0;ir<9;ir++){
216  rpbinlimits[ir] = steprp * (Double_t) ir;
217  }
218  task->SetPoolRPBinLimits(nrpbin,rpbinlimits);
219 
220  task->SetNumberOfEventsForMixing(10);//PbPb
221  }else if(domixing==7){
222  //Cent x 1/2
223  task->SetEventMixingWithPools();
224  Double_t pvzbinlimits[] = {-12,-10,-8,-6,-4,-2,0,2,4,6,8,10,12};
225  Int_t pvzbinnumb = sizeof(pvzbinlimits)/sizeof(Double_t) - 1;
226  task->SetPoolPVzBinLimits(pvzbinnumb,pvzbinlimits);
227 
228  Double_t cent_mult_binlimitsPbPb[] = { 0,5,10,30,50,70,90,100};
229  Int_t cent_mult_bin_numbPbPb = sizeof(cent_mult_binlimitsPbPb)/sizeof(Double_t) - 1;
230  task->SetPoolCentBinLimits(cent_mult_bin_numbPbPb,cent_mult_binlimitsPbPb);
231 
232  Int_t nrpbin = 8;
233  Double_t rpbinlimits[9];
234  Double_t steprp = TMath::Pi()/(Double_t)nrpbin;
235  for(Int_t ir=0;ir<9;ir++){
236  rpbinlimits[ir] = steprp * (Double_t) ir;
237  }
238  task->SetPoolRPBinLimits(nrpbin,rpbinlimits);
239 
240  task->SetNumberOfEventsForMixing(10);//PbPb
241  }else if(domixing==8){
242  //RP x 2
243  task->SetEventMixingWithPools();
244  Double_t pvzbinlimits[] = {-12,-10,-8,-6,-4,-2,0,2,4,6,8,10,12};
245  Int_t pvzbinnumb = sizeof(pvzbinlimits)/sizeof(Double_t) - 1;
246  task->SetPoolPVzBinLimits(pvzbinnumb,pvzbinlimits);
247 
248  Double_t cent_mult_binlimitsPbPb[] = { 0,2.5,5,7.5,10,20,30,40,50,60,70,80,90,100};
249  Int_t cent_mult_bin_numbPbPb = sizeof(cent_mult_binlimitsPbPb)/sizeof(Double_t) - 1;
250  task->SetPoolCentBinLimits(cent_mult_bin_numbPbPb,cent_mult_binlimitsPbPb);
251 
252  Int_t nrpbin = 16;
253  Double_t rpbinlimits[17];
254  Double_t steprp = TMath::Pi()/(Double_t)nrpbin;
255  for(Int_t ir=0;ir<17;ir++){
256  rpbinlimits[ir] = steprp * (Double_t) ir;
257  }
258  task->SetPoolRPBinLimits(nrpbin,rpbinlimits);
259 
260  task->SetNumberOfEventsForMixing(10);//PbPb
261  }else if(domixing==9){
262  //RP x 2
263  task->SetEventMixingWithPools();
264  Double_t pvzbinlimits[] = {-12,-10,-8,-6,-4,-2,0,2,4,6,8,10,12};
265  Int_t pvzbinnumb = sizeof(pvzbinlimits)/sizeof(Double_t) - 1;
266  task->SetPoolPVzBinLimits(pvzbinnumb,pvzbinlimits);
267 
268  Double_t cent_mult_binlimitsPbPb[] = { 0,2.5,5,7.5,10,20,30,40,50,60,70,80,90,100};
269  Int_t cent_mult_bin_numbPbPb = sizeof(cent_mult_binlimitsPbPb)/sizeof(Double_t) - 1;
270  task->SetPoolCentBinLimits(cent_mult_bin_numbPbPb,cent_mult_binlimitsPbPb);
271 
272  Int_t nrpbin = 4;
273  Double_t rpbinlimits[5];
274  Double_t steprp = TMath::Pi()/(Double_t)nrpbin;
275  for(Int_t ir=0;ir<5;ir++){
276  rpbinlimits[ir] = steprp * (Double_t) ir;
277  }
278  task->SetPoolRPBinLimits(nrpbin,rpbinlimits);
279 
280  task->SetNumberOfEventsForMixing(10);//PbPb
281  }else{
282  cout<<"Such pool binning option is not supported"<<endl;
283  exit(1);
284  }
285  }
286 
287  //multiplicity study
288  if(iscoltype==0){
289  if(estimatorFilename.EqualTo("") ) {
290  printf("Estimator file not provided, multiplcity corrected histograms will not be filled\n");
291  } else{
292  TFile* fileEstimator=TFile::Open(estimatorFilename.Data());
293  if(!fileEstimator) {
294  AliFatal("File with multiplicity estimator not found\n");
295  return;
296  }
297  task->SetReferenceMultiplcity(9.26);
298  const Char_t* profilebasename="SPDmult10";
299  const Char_t* periodNames[4] = {"LHC10b", "LHC10c", "LHC10d", "LHC10e"};
300  TProfile* multEstimatorAvg[4];
301  for(Int_t ip=0; ip<4; ip++) {
302  multEstimatorAvg[ip] = (TProfile*)(fileEstimator->Get(Form("%s_%s",profilebasename,periodNames[ip]))->Clone(Form("%s_%s_clone",profilebasename,periodNames[ip])));
303  if (!multEstimatorAvg[ip]) {
304  AliFatal(Form("Multiplicity estimator for %s not found! Please check your estimator file",periodNames[ip]));
305  return;
306  }
307  }
308  task->SetMultiplVsZProfileLHC10b(multEstimatorAvg[0]);
309  task->SetMultiplVsZProfileLHC10c(multEstimatorAvg[1]);
310  task->SetMultiplVsZProfileLHC10d(multEstimatorAvg[2]);
311  task->SetMultiplVsZProfileLHC10e(multEstimatorAvg[3]);
312  }
313  }
314 
315  mgr->AddTask(task);
316 
317  // Create and connect containers for input/output
318  TString outputfile = AliAnalysisManager::GetCommonFileName();
319  outputfile += ":PWG3_D2H_Lc2eleLambda_";
320  outputfile += nTour;
321 
322  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
323 
324  // ----- output data -----
325  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("Lchist%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // general histos
326  mgr->ConnectOutput(task,1,coutput1);
327  AliAnalysisDataContainer *coutputLc2 = mgr->CreateContainer(Form("Lc2eleLambdaCuts%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // cuts
328  mgr->ConnectOutput(task,2,coutputLc2);
329 
330  AliAnalysisDataContainer *coutputLc3 = mgr->CreateContainer(Form("eleLambdaHisto%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
331  mgr->ConnectOutput(task,3,coutputLc3);
332 
333  AliAnalysisDataContainer *coutputLc4 = mgr->CreateContainer(Form("eleLambdavariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
334  mgr->ConnectOutput(task,4,coutputLc4);
335  AliAnalysisDataContainer *coutputLc5 = mgr->CreateContainer(Form("eleLambda_elevariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
336  mgr->ConnectOutput(task,5,coutputLc5);
337  AliAnalysisDataContainer *coutputLc6 = mgr->CreateContainer(Form("eleLambda_v0variables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
338  mgr->ConnectOutput(task,6,coutputLc6);
339  AliAnalysisDataContainer *coutputLc7 = mgr->CreateContainer(Form("eleLambda_mcvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
340  mgr->ConnectOutput(task,7,coutputLc7);
341  AliAnalysisDataContainer *coutputLc8 = mgr->CreateContainer(Form("eleLambdaCounter%1d",nTour),AliNormalizationCounter::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //counter
342  mgr->ConnectOutput(task,8,coutputLc8);
343  AliAnalysisDataContainer *coutputLc9 = mgr->CreateContainer(Form("eleLambda_mcelevariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
344  mgr->ConnectOutput(task,9,coutputLc9);
345  AliAnalysisDataContainer *coutputLc10 = mgr->CreateContainer(Form("eleLambda_mcv0variables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
346  mgr->ConnectOutput(task,10,coutputLc10);
347  //AliAnalysisDataContainer *coutputLc11 = mgr->CreateContainer(Form("eleLambda_mcgenpairvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
348  //mgr->ConnectOutput(task,11,coutputLc11);
349  AliAnalysisDataContainer *coutputLc11 = mgr->CreateContainer(Form("eleLambda_singlevariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
350  mgr->ConnectOutput(task,11,coutputLc11);
351  AliAnalysisDataContainer *coutputLc12 = mgr->CreateContainer(Form("eleLambda_correlationvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
352  mgr->ConnectOutput(task,12,coutputLc12);
353 
354  return task;
355 
356 }
double Double_t
Definition: External.C:58
AliAnalysisTaskSELc2eleLambdafromAODtracks * AddTaskLc2eleLambdafromAODtracks(TString finname="", Bool_t theMCon=kFALSE, Int_t iscoltype=0, Bool_t writeVariableTree=kFALSE, Int_t domixing=0, Bool_t reconstructPrimVert=kFALSE, Bool_t writeEachVariableTree=kFALSE, Bool_t writeMCVariableTree=kFALSE, TString estimatorFilename="", Int_t nTour=0)
char Char_t
Definition: External.C:18
void SetPoolRPBinLimits(Int_t Nrpbins, const Double_t *RPBins)
void SetMaxPtCandidate(Double_t ptCand=1000.)
Definition: AliRDHFCuts.h:217
int Int_t
Definition: External.C:63
void SetPoolCentBinLimits(Int_t Ncentbins, const Double_t *CentBins)
void SetPoolPVzBinLimits(Int_t Nzvtxbins, const Double_t *ZvtxBins)
virtual void SetStandardCutsPP2010()
Definition: AliRDHFCuts.h:46
void SetMinPtCandidate(Double_t ptCand=-1.)
Definition: AliRDHFCuts.h:216
bool Bool_t
Definition: External.C:53