AliPhysics  master (3d17d9d)
AddTaskXic2eleXifromAODtracks.C
Go to the documentation of this file.
2  Bool_t theMCon=kFALSE,
3  Int_t iscoltype= 0,
4  Bool_t writeVariableTree=kTRUE,
5  Bool_t domixing=kFALSE,
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  Printf("FATAL: Input file not found : check your cut object");
29  return NULL;
30  }
31  }
32 
34  if (stdcuts) RDHFCutsXic2eleXianal->SetStandardCutsPP2010();
35  else RDHFCutsXic2eleXianal = (AliRDHFCutsXictoeleXifromAODtracks*)filecuts->Get("eleXiAnalysisCuts");
36  RDHFCutsXic2eleXianal->SetName("eleXiAnalysisCuts");
37  RDHFCutsXic2eleXianal->SetMinPtCandidate(-1.);
38  RDHFCutsXic2eleXianal->SetMaxPtCandidate(10000.);
39  if (!RDHFCutsXic2eleXianal) {
40  cout << "Specific AliRDHFCutsXic2eleXianal not found\n";
41  return NULL;
42  }
43 
44 
45  //CREATE THE TASK
46 
47  printf("CREATE TASK\n");
48  AliAnalysisTaskSEXic2eleXifromAODtracks *task = new AliAnalysisTaskSEXic2eleXifromAODtracks("AliAnalysisTaskSEXic2eleXifromAODtracks",RDHFCutsXic2eleXianal,writeVariableTree);
49  task->SetMC(theMCon);
50  if(iscoltype==0){
51  task->SetUseCentralityV0M(kFALSE);
52  task->SetUseCentralitySPDTracklet(kFALSE);
53  }else{
54  task->SetUseCentralityV0M(kTRUE);
55  task->SetUseEventPlane(4);
56  }
57  task->SetDebugLevel(1);
58  task->SetReconstructPrimVert(reconstructPrimVert);
59  task->SetWriteEachVariableTree(writeEachVariableTree);
60  task->SetWriteMCVariableTree(writeMCVariableTree);
61  if(domixing)
63  else
64  task->SetEventMixingOff();
65 
66  //PVz Binning for pool PP or PbPb
67  Double_t pvzbinlimits[] = {-12,-10,-8,-6,-4,-2,0,2,4,6,8,10,12};
68  Int_t pvzbinnumb = sizeof(pvzbinlimits)/sizeof(Double_t) - 1;
69 
70  //Cent Binning for pool pPb
71  Double_t cent_mult_binlimitspPb[] = { 0,10,20,30,40,50,60,70,80,90,100};
72  Int_t cent_mult_bin_numbpPb = sizeof(cent_mult_binlimitspPb)/sizeof(Double_t) - 1;
73  Double_t cent_mult_binlimitspp[] = { 0,100};
74  Int_t cent_mult_bin_numbpp = sizeof(cent_mult_binlimitspp)/sizeof(Double_t) - 1;
75  Double_t cent_mult_binlimitsPbPb[] = { 0,2.5,5,7.5,10,20,30,40,50,60,70,80,90,100};
76  Int_t cent_mult_bin_numbPbPb = sizeof(cent_mult_binlimitsPbPb)/sizeof(Double_t) - 1;
77 
78  task->SetPoolPVzBinLimits(pvzbinnumb,pvzbinlimits);
79  if(iscoltype==0){
80  task->SetPoolCentBinLimits(cent_mult_bin_numbpp,cent_mult_binlimitspp);
81  task->SetNumberOfEventsForMixing(10);//pp
82  }else if(iscoltype==0){
83  task->SetPoolCentBinLimits(cent_mult_bin_numbpPb,cent_mult_binlimitspPb);
84  task->SetNumberOfEventsForMixing(10);//pPb
85  }else{
86  task->SetPoolCentBinLimits(cent_mult_bin_numbPbPb,cent_mult_binlimitsPbPb);
87  task->SetNumberOfEventsForMixing(10);//PbPb
88  }
89 
90  if(iscoltype==0 || iscoltype==1){
91  Int_t nrpbin = 1.;
92  Double_t rpbinlimits[2] = {-3.2,3.2};
93  task->SetPoolRPBinLimits(nrpbin,rpbinlimits);
94  }else{
95  Int_t nrpbin = 8;
96  Double_t rpbinlimits[9];
97  Double_t steprp = TMath::Pi()/(Double_t)nrpbin;
98  for(Int_t ir=0;ir<9;ir++){
99  rpbinlimits[ir] = -1.*TMath::Pi()/2. + steprp * (Double_t) ir;
100  }
101  task->SetPoolRPBinLimits(nrpbin,rpbinlimits);
102  }
103 
104  //multiplicity study
105  if(iscoltype==0){
106  if(estimatorFilename.EqualTo("") ) {
107  printf("Estimator file not provided, multiplcity corrected histograms will not be filled\n");
108  } else{
109  TFile* fileEstimator=TFile::Open(estimatorFilename.Data());
110  if(!fileEstimator) {
111  Printf("FATAL: File with multiplicity estimator not found\n");
112  return NULL;
113  }
114  task->SetReferenceMultiplcity(9.26);
115  const Char_t* profilebasename="SPDmult10";
116  const Char_t* periodNames[4] = {"LHC10b", "LHC10c", "LHC10d", "LHC10e"};
117  TProfile* multEstimatorAvg[4];
118  for(Int_t ip=0; ip<4; ip++) {
119  multEstimatorAvg[ip] = (TProfile*)(fileEstimator->Get(Form("%s_%s",profilebasename,periodNames[ip]))->Clone(Form("%s_%s_clone",profilebasename,periodNames[ip])));
120  if (!multEstimatorAvg[ip]) {
121  Printf("Multiplicity estimator for %s not found! Please check your estimator file",periodNames[ip]);
122  return NULL;
123  }
124  }
125  task->SetMultiplVsZProfileLHC10b(multEstimatorAvg[0]);
126  task->SetMultiplVsZProfileLHC10c(multEstimatorAvg[1]);
127  task->SetMultiplVsZProfileLHC10d(multEstimatorAvg[2]);
128  task->SetMultiplVsZProfileLHC10e(multEstimatorAvg[3]);
129  }
130  }
131 
132  //=================== for 5 TeV reweighting==========
133  TF1 * weightfit = new TF1("weightfit","expo");
134  weightfit -> SetParameter(0,8.66109e-01);
135  weightfit -> SetParameter(1,-2.59812e-01);
136  task -> SetFunction(weightfit);
137  //=================== for 13 TeV reweighting===========
138  TF1 * weightfit13 = new TF1("weightfit13","expo");
139  weightfit13 -> SetParameter(0,1.04603e+00);
140  weightfit13 -> SetParameter(1,-2.46920e-01);
141  task -> SetFunction13(weightfit13);
142 
143 
144  //============== weight process for the acceptance phi distribution
145  // =========== electron =================================
146  TF1 * AccWeight = new TF1("AccWeight","expo+pol4(2)");
147  AccWeight -> SetParameter(0,7.25182e+00);
148  AccWeight -> SetParameter(1,-1.59753e+01);
149  AccWeight -> SetParameter(2,1.48939e-01);
150  AccWeight -> SetParameter(3,-2.29063e-01);
151  AccWeight -> SetParameter(4,1.78563e-01);
152  AccWeight -> SetParameter(5,-5.70464e-02);
153  AccWeight -> SetParameter(6,6.25614e-03);
154  task -> SetFunctionElectron(AccWeight);
155  // ============== positron ================================
156  TF1 * AccWeightPositron = new TF1("AccWeightPositron","expo+pol4(2)");
157  AccWeightPositron -> SetParameter(0,7.23466e+00);
158  AccWeightPositron -> SetParameter(1,-1.59978e+01);
159  AccWeightPositron -> SetParameter(2,1.25472e-01);
160  AccWeightPositron -> SetParameter(3,-1.80599e-01);
161  AccWeightPositron -> SetParameter(4,1.43474e-01);
162  AccWeightPositron -> SetParameter(5,-4.66011e-02);
163  AccWeightPositron -> SetParameter(6,5.17285e-03);
164 
165  task -> SetFunctionPositron(AccWeightPositron);
166 
167 
168  mgr->AddTask(task);
169 
170  // Create and connect containers for input/output
171  TString outputfile = AliAnalysisManager::GetCommonFileName();
172  outputfile += ":PWG3_D2H_Xic2eleXi_";
173  outputfile += nTour;
174 
175  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
176 
177  // ----- output data -----
178  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("Xichist%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // general histos
179  mgr->ConnectOutput(task,1,coutput1);
180  AliAnalysisDataContainer *coutputLc2 = mgr->CreateContainer(Form("Xic2eleXiCuts%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // cuts
181  mgr->ConnectOutput(task,2,coutputLc2);
182 
183  AliAnalysisDataContainer *coutputLc3 = mgr->CreateContainer(Form("eleXiHisto%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
184  mgr->ConnectOutput(task,3,coutputLc3);
185 
186  AliAnalysisDataContainer *coutputLc4 = mgr->CreateContainer(Form("eleXivariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
187  mgr->ConnectOutput(task,4,coutputLc4);
188  AliAnalysisDataContainer *coutputLc5 = mgr->CreateContainer(Form("eleXi_elevariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
189  mgr->ConnectOutput(task,5,coutputLc5);
190  AliAnalysisDataContainer *coutputLc6 = mgr->CreateContainer(Form("eleXi_cascvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
191  mgr->ConnectOutput(task,6,coutputLc6);
192  AliAnalysisDataContainer *coutputLc7 = mgr->CreateContainer(Form("eleXi_mcvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
193  mgr->ConnectOutput(task,7,coutputLc7);
194  AliAnalysisDataContainer *coutputLc8 = mgr->CreateContainer(Form("eleXiCounter%1d",nTour),AliNormalizationCounter::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //counter
195  mgr->ConnectOutput(task,8,coutputLc8);
196  AliAnalysisDataContainer *coutputLc9 = mgr->CreateContainer(Form("eleXi_mcelevariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
197  mgr->ConnectOutput(task,9,coutputLc9);
198  AliAnalysisDataContainer *coutputLc10 = mgr->CreateContainer(Form("eleXi_mccascvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
199  mgr->ConnectOutput(task,10,coutputLc10);
200  //AliAnalysisDataContainer *coutputLc11 = mgr->CreateContainer(Form("eleXi_mcgenpairvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
201  //mgr->ConnectOutput(task,11,coutputLc11);
202  AliAnalysisDataContainer *coutputLc11 = mgr->CreateContainer(Form("eleXi_singlevariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
203  mgr->ConnectOutput(task,11,coutputLc11);
204  AliAnalysisDataContainer *coutputLc12 = mgr->CreateContainer(Form("eleXi_correlationvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
205  mgr->ConnectOutput(task,12,coutputLc12);
206 
207  return task;
208 
209 }
void SetPoolRPBinLimits(Int_t Nrpbins, const Double_t *RPBins)
double Double_t
Definition: External.C:58
char Char_t
Definition: External.C:18
void SetMaxPtCandidate(Double_t ptCand=1000.)
Definition: AliRDHFCuts.h:233
void SetPoolCentBinLimits(Int_t Ncentbins, const Double_t *CentBins)
int Int_t
Definition: External.C:63
void SetPoolPVzBinLimits(Int_t Nzvtxbins, const Double_t *ZvtxBins)
AliAnalysisTaskSEXic2eleXifromAODtracks * AddTaskXic2eleXifromAODtracks(TString finname="", Bool_t theMCon=kFALSE, Int_t iscoltype=0, Bool_t writeVariableTree=kTRUE, Bool_t domixing=kFALSE, Bool_t reconstructPrimVert=kFALSE, Bool_t writeEachVariableTree=kFALSE, Bool_t writeMCVariableTree=kFALSE, TString estimatorFilename="", Int_t nTour=0)
virtual void SetStandardCutsPP2010()
Definition: AliRDHFCuts.h:49
void SetMinPtCandidate(Double_t ptCand=-1.)
Definition: AliRDHFCuts.h:232
bool Bool_t
Definition: External.C:53