AliPhysics  c923f52 (c923f52)
 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  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  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(4);
54  }
55  task->SetDebugLevel(1);
56  task->SetReconstructPrimVert(reconstructPrimVert);
57  task->SetWriteEachVariableTree(writeEachVariableTree);
58  task->SetWriteMCVariableTree(writeMCVariableTree);
59  if(domixing)
61  else
62  task->SetEventMixingOff();
63 
64  //PVz Binning for pool PP or PbPb
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  //Cent Binning for pool pPb
68  Double_t cent_mult_binlimitspPb[] = { 0,10,20,30,40,50,60,70,80,90,100};
69  Int_t cent_mult_bin_numbpPb = sizeof(cent_mult_binlimitspPb)/sizeof(Double_t) - 1;
70  Double_t cent_mult_binlimitspp[] = { 0,100};
71  Int_t cent_mult_bin_numbpp = sizeof(cent_mult_binlimitspp)/sizeof(Double_t) - 1;
72  Double_t cent_mult_binlimitsPbPb[] = { 0,2.5,5,7.5,10,20,30,40,50,60,70,80,90,100};
73  Int_t cent_mult_bin_numbPbPb = sizeof(cent_mult_binlimitsPbPb)/sizeof(Double_t) - 1;
74 
75  task->SetPoolPVzBinLimits(pvzbinnumb,pvzbinlimits);
76  if(iscoltype==0){
77  task->SetPoolCentBinLimits(cent_mult_bin_numbpp,cent_mult_binlimitspp);
78  task->SetNumberOfEventsForMixing(10);//pp
79  }else if(iscoltype==1){
80  task->SetPoolCentBinLimits(cent_mult_bin_numbpPb,cent_mult_binlimitspPb);
81  task->SetNumberOfEventsForMixing(10);//pPb
82  }else if(iscoltype==2){
83  task->SetPoolCentBinLimits(cent_mult_bin_numbPbPb,cent_mult_binlimitsPbPb);
84  task->SetNumberOfEventsForMixing(10);//PbPb
85  }
86 
87  if(iscoltype==0 || iscoltype == 1){
88  Int_t nrpbin = 1.;
89  Double_t rpbinlimits[2] = {-3.2,3.2};
90  task->SetPoolRPBinLimits(nrpbin,rpbinlimits);
91  }else{
92  Int_t nrpbin = 8;
93  Double_t rpbinlimits[9];
94  Double_t steprp = TMath::Pi()/(Double_t)nrpbin;
95  for(Int_t ir=0;ir<9;ir++){
96  rpbinlimits[ir] = steprp * (Double_t) ir;
97  }
98  task->SetPoolRPBinLimits(nrpbin,rpbinlimits);
99  }
100 
101  //multiplicity study
102  if(iscoltype==0){
103  if(estimatorFilename.EqualTo("") ) {
104  printf("Estimator file not provided, multiplcity corrected histograms will not be filled\n");
105  } else{
106  TFile* fileEstimator=TFile::Open(estimatorFilename.Data());
107  if(!fileEstimator) {
108  AliFatal("File with multiplicity estimator not found\n");
109  return;
110  }
111  task->SetReferenceMultiplcity(9.26);
112  const Char_t* profilebasename="SPDmult10";
113  const Char_t* periodNames[4] = {"LHC10b", "LHC10c", "LHC10d", "LHC10e"};
114  TProfile* multEstimatorAvg[4];
115  for(Int_t ip=0; ip<4; ip++) {
116  multEstimatorAvg[ip] = (TProfile*)(fileEstimator->Get(Form("%s_%s",profilebasename,periodNames[ip]))->Clone(Form("%s_%s_clone",profilebasename,periodNames[ip])));
117  if (!multEstimatorAvg[ip]) {
118  AliFatal(Form("Multiplicity estimator for %s not found! Please check your estimator file",periodNames[ip]));
119  return;
120  }
121  }
122  task->SetMultiplVsZProfileLHC10b(multEstimatorAvg[0]);
123  task->SetMultiplVsZProfileLHC10c(multEstimatorAvg[1]);
124  task->SetMultiplVsZProfileLHC10d(multEstimatorAvg[2]);
125  task->SetMultiplVsZProfileLHC10e(multEstimatorAvg[3]);
126  }
127  }
128 
129  mgr->AddTask(task);
130 
131  // Create and connect containers for input/output
132  TString outputfile = AliAnalysisManager::GetCommonFileName();
133  outputfile += ":PWG3_D2H_Lc2eleLambda_";
134  outputfile += nTour;
135 
136  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
137 
138  // ----- output data -----
139  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("Lchist%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // general histos
140  mgr->ConnectOutput(task,1,coutput1);
141  AliAnalysisDataContainer *coutputLc2 = mgr->CreateContainer(Form("Lc2eleLambdaCuts%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // cuts
142  mgr->ConnectOutput(task,2,coutputLc2);
143 
144  AliAnalysisDataContainer *coutputLc3 = mgr->CreateContainer(Form("eleLambdaHisto%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
145  mgr->ConnectOutput(task,3,coutputLc3);
146 
147  AliAnalysisDataContainer *coutputLc4 = mgr->CreateContainer(Form("eleLambdavariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
148  mgr->ConnectOutput(task,4,coutputLc4);
149  AliAnalysisDataContainer *coutputLc5 = mgr->CreateContainer(Form("eleLambda_elevariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
150  mgr->ConnectOutput(task,5,coutputLc5);
151  AliAnalysisDataContainer *coutputLc6 = mgr->CreateContainer(Form("eleLambda_v0variables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
152  mgr->ConnectOutput(task,6,coutputLc6);
153  AliAnalysisDataContainer *coutputLc7 = mgr->CreateContainer(Form("eleLambda_mcvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
154  mgr->ConnectOutput(task,7,coutputLc7);
155  AliAnalysisDataContainer *coutputLc8 = mgr->CreateContainer(Form("eleLambdaCounter%1d",nTour),AliNormalizationCounter::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //counter
156  mgr->ConnectOutput(task,8,coutputLc8);
157  AliAnalysisDataContainer *coutputLc9 = mgr->CreateContainer(Form("eleLambda_mcelevariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
158  mgr->ConnectOutput(task,9,coutputLc9);
159  AliAnalysisDataContainer *coutputLc10 = mgr->CreateContainer(Form("eleLambda_mcv0variables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
160  mgr->ConnectOutput(task,10,coutputLc10);
161  //AliAnalysisDataContainer *coutputLc11 = mgr->CreateContainer(Form("eleLambda_mcgenpairvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
162  //mgr->ConnectOutput(task,11,coutputLc11);
163  AliAnalysisDataContainer *coutputLc11 = mgr->CreateContainer(Form("eleLambda_singlevariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
164  mgr->ConnectOutput(task,11,coutputLc11);
165  AliAnalysisDataContainer *coutputLc12 = mgr->CreateContainer(Form("eleLambda_correlationvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
166  mgr->ConnectOutput(task,12,coutputLc12);
167 
168  return task;
169 
170 }
double Double_t
Definition: External.C:58
char Char_t
Definition: External.C:18
void SetPoolRPBinLimits(Int_t Nrpbins, const Double_t *RPBins)
AliAnalysisTaskSELc2eleLambdafromAODtracks * AddTaskLc2eleLambdafromAODtracks(TString finname="", Bool_t theMCon=kFALSE, Int_t iscoltype=0, Bool_t writeVariableTree=kFALSE, Bool_t domixing=kFALSE, Bool_t reconstructPrimVert=kFALSE, Bool_t writeEachVariableTree=kFALSE, Bool_t writeMCVariableTree=kFALSE, TString estimatorFilename="", Int_t nTour=0)
void SetMaxPtCandidate(Double_t ptCand=1000.)
Definition: AliRDHFCuts.h:216
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:215
bool Bool_t
Definition: External.C:53