AliPhysics  608b256 (608b256)
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  mgr->AddTask(task);
133 
134  // Create and connect containers for input/output
135  TString outputfile = AliAnalysisManager::GetCommonFileName();
136  outputfile += ":PWG3_D2H_Xic2eleXi_";
137  outputfile += nTour;
138 
139  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
140 
141  // ----- output data -----
142  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("Xichist%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // general histos
143  mgr->ConnectOutput(task,1,coutput1);
144  AliAnalysisDataContainer *coutputLc2 = mgr->CreateContainer(Form("Xic2eleXiCuts%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // cuts
145  mgr->ConnectOutput(task,2,coutputLc2);
146 
147  AliAnalysisDataContainer *coutputLc3 = mgr->CreateContainer(Form("eleXiHisto%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
148  mgr->ConnectOutput(task,3,coutputLc3);
149 
150  AliAnalysisDataContainer *coutputLc4 = mgr->CreateContainer(Form("eleXivariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
151  mgr->ConnectOutput(task,4,coutputLc4);
152  AliAnalysisDataContainer *coutputLc5 = mgr->CreateContainer(Form("eleXi_elevariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
153  mgr->ConnectOutput(task,5,coutputLc5);
154  AliAnalysisDataContainer *coutputLc6 = mgr->CreateContainer(Form("eleXi_cascvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
155  mgr->ConnectOutput(task,6,coutputLc6);
156  AliAnalysisDataContainer *coutputLc7 = mgr->CreateContainer(Form("eleXi_mcvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
157  mgr->ConnectOutput(task,7,coutputLc7);
158  AliAnalysisDataContainer *coutputLc8 = mgr->CreateContainer(Form("eleXiCounter%1d",nTour),AliNormalizationCounter::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //counter
159  mgr->ConnectOutput(task,8,coutputLc8);
160  AliAnalysisDataContainer *coutputLc9 = mgr->CreateContainer(Form("eleXi_mcelevariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
161  mgr->ConnectOutput(task,9,coutputLc9);
162  AliAnalysisDataContainer *coutputLc10 = mgr->CreateContainer(Form("eleXi_mccascvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
163  mgr->ConnectOutput(task,10,coutputLc10);
164  //AliAnalysisDataContainer *coutputLc11 = mgr->CreateContainer(Form("eleXi_mcgenpairvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
165  //mgr->ConnectOutput(task,11,coutputLc11);
166  AliAnalysisDataContainer *coutputLc11 = mgr->CreateContainer(Form("eleXi_singlevariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
167  mgr->ConnectOutput(task,11,coutputLc11);
168  AliAnalysisDataContainer *coutputLc12 = mgr->CreateContainer(Form("eleXi_correlationvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
169  mgr->ConnectOutput(task,12,coutputLc12);
170 
171  return task;
172 
173 }
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:231
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:48
void SetMinPtCandidate(Double_t ptCand=-1.)
Definition: AliRDHFCuts.h:230
bool Bool_t
Definition: External.C:53