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