AliPhysics  9fe175b (9fe175b)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AddTaskXic2eleXifromAODtracks.C
Go to the documentation of this file.
2  Bool_t theMCon=kFALSE,
3  Bool_t ispp= kFALSE,
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  AliFatal("Input file not found : check your cut object");
29  }
30  }
31 
33  if (stdcuts) RDHFCutsXic2eleXianal->SetStandardCutsPP2010();
34  else RDHFCutsXic2eleXianal = (AliRDHFCutsXictoeleXifromAODtracks*)filecuts->Get("eleXiAnalysisCuts");
35  RDHFCutsXic2eleXianal->SetName("eleXiAnalysisCuts");
36  RDHFCutsXic2eleXianal->SetMinPtCandidate(-1.);
37  RDHFCutsXic2eleXianal->SetMaxPtCandidate(10000.);
38  if (!RDHFCutsXic2eleXianal) {
39  cout << "Specific AliRDHFCutsXic2eleXianal not found\n";
40  return;
41  }
42 
43 
44  //CREATE THE TASK
45 
46  printf("CREATE TASK\n");
47  AliAnalysisTaskSEXic2eleXifromAODtracks *task = new AliAnalysisTaskSEXic2eleXifromAODtracks("AliAnalysisTaskSEXic2eleXifromAODtracks",RDHFCutsXic2eleXianal,writeVariableTree);
48  task->SetMC(theMCon);
49  if(ispp){
50  task->SetUseCentralityV0M(kFALSE);
51  task->SetUseCentralitySPDTracklet(kFALSE);
52  }else{
53  task->SetUseCentralityV0M(kTRUE);
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 
68  //Cent Binning for pool pPb
69  Double_t cent_mult_binlimitspPb[] = { 0,10,20,30,40,50,60,70,80,90,100};
70  Int_t cent_mult_bin_numbpPb = sizeof(cent_mult_binlimitspPb)/sizeof(Double_t) - 1;
71  Double_t cent_mult_binlimitspp[] = { 0,100};
72  Int_t cent_mult_bin_numbpp = sizeof(cent_mult_binlimitspp)/sizeof(Double_t) - 1;
73 
74  task->SetPoolPVzBinLimits(pvzbinnumb,pvzbinlimits);
75  if(ispp){
76  task->SetPoolCentBinLimits(cent_mult_bin_numbpp,cent_mult_binlimitspp);
77  task->SetNumberOfEventsForMixing(10);//pp
78  }else{
79  task->SetPoolCentBinLimits(cent_mult_bin_numbpPb,cent_mult_binlimitspPb);
80  task->SetNumberOfEventsForMixing(10);//pPb
81  }
82 
83  //multiplicity study
84  if(ispp){
85  if(estimatorFilename.EqualTo("") ) {
86  printf("Estimator file not provided, multiplcity corrected histograms will not be filled\n");
87  } else{
88  TFile* fileEstimator=TFile::Open(estimatorFilename.Data());
89  if(!fileEstimator) {
90  AliFatal("File with multiplicity estimator not found\n");
91  return;
92  }
93  task->SetReferenceMultiplcity(9.26);
94  const Char_t* profilebasename="SPDmult10";
95  const Char_t* periodNames[4] = {"LHC10b", "LHC10c", "LHC10d", "LHC10e"};
96  TProfile* multEstimatorAvg[4];
97  for(Int_t ip=0; ip<4; ip++) {
98  multEstimatorAvg[ip] = (TProfile*)(fileEstimator->Get(Form("%s_%s",profilebasename,periodNames[ip]))->Clone(Form("%s_%s_clone",profilebasename,periodNames[ip])));
99  if (!multEstimatorAvg[ip]) {
100  AliFatal(Form("Multiplicity estimator for %s not found! Please check your estimator file",periodNames[ip]));
101  return;
102  }
103  }
104  task->SetMultiplVsZProfileLHC10b(multEstimatorAvg[0]);
105  task->SetMultiplVsZProfileLHC10c(multEstimatorAvg[1]);
106  task->SetMultiplVsZProfileLHC10d(multEstimatorAvg[2]);
107  task->SetMultiplVsZProfileLHC10e(multEstimatorAvg[3]);
108  }
109  }
110 
111  mgr->AddTask(task);
112 
113  // Create and connect containers for input/output
114  TString outputfile = AliAnalysisManager::GetCommonFileName();
115  outputfile += ":PWG3_D2H_Xic2eleXi_";
116  outputfile += nTour;
117 
118  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
119 
120  // ----- output data -----
121  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("Xichist%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // general histos
122  mgr->ConnectOutput(task,1,coutput1);
123  AliAnalysisDataContainer *coutputLc2 = mgr->CreateContainer(Form("Xic2eleXiCuts%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // cuts
124  mgr->ConnectOutput(task,2,coutputLc2);
125 
126  AliAnalysisDataContainer *coutputLc3 = mgr->CreateContainer(Form("eleXiHisto%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
127  mgr->ConnectOutput(task,3,coutputLc3);
128 
129  AliAnalysisDataContainer *coutputLc4 = mgr->CreateContainer(Form("eleXivariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
130  mgr->ConnectOutput(task,4,coutputLc4);
131  AliAnalysisDataContainer *coutputLc5 = mgr->CreateContainer(Form("eleXi_elevariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
132  mgr->ConnectOutput(task,5,coutputLc5);
133  AliAnalysisDataContainer *coutputLc6 = mgr->CreateContainer(Form("eleXi_cascvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
134  mgr->ConnectOutput(task,6,coutputLc6);
135  AliAnalysisDataContainer *coutputLc7 = mgr->CreateContainer(Form("eleXi_mcvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
136  mgr->ConnectOutput(task,7,coutputLc7);
137  AliAnalysisDataContainer *coutputLc8 = mgr->CreateContainer(Form("eleXiCounter%1d",nTour),AliNormalizationCounter::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //counter
138  mgr->ConnectOutput(task,8,coutputLc8);
139  AliAnalysisDataContainer *coutputLc9 = mgr->CreateContainer(Form("eleXi_mcelevariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
140  mgr->ConnectOutput(task,9,coutputLc9);
141  AliAnalysisDataContainer *coutputLc10 = mgr->CreateContainer(Form("eleXi_mccascvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
142  mgr->ConnectOutput(task,10,coutputLc10);
143  AliAnalysisDataContainer *coutputLc11 = mgr->CreateContainer(Form("eleXi_mcgenpairvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
144  mgr->ConnectOutput(task,11,coutputLc11);
145  AliAnalysisDataContainer *coutputLc12 = mgr->CreateContainer(Form("eleXi_correlationvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
146  mgr->ConnectOutput(task,12,coutputLc12);
147 
148  return task;
149 
150 }
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)
AliAnalysisTaskSEXic2eleXifromAODtracks * AddTaskXic2eleXifromAODtracks(TString finname="", Bool_t theMCon=kFALSE, Bool_t ispp=kFALSE, 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:46
void SetMinPtCandidate(Double_t ptCand=-1.)
Definition: AliRDHFCuts.h:215