Updating track cuts and removing functionality that is now in separate cosmics tasks
[u/mrichter/AliRoot.git] / PWG4 / macros / AddTaskPWG4HighPtSpectra.C
CommitLineData
fdceab34 1//DEFINITION OF A FEW CONSTANTS
67ebd013 2const Float_t ptmin = 2.0 ;
3const Float_t ptmax = 50.0 ;
4const Float_t phimin = 0.;
5const Float_t phimax = 2.*TMath::Pi();
6const Float_t etamin = -0.9;
7const Float_t etamax = 0.9;
8const Float_t dcarmin = -0.2;
9const Float_t dcarmax = 0.2;
10const Float_t chi2TPCmin = 0.0;
d1084bbd 11const Float_t chi2TPCmax = 4.;
67ebd013 12
13const Float_t ptmin1 = ptmin ;
14const Float_t ptmax1 = 10.0 ;
15const Float_t ptmin2 = ptmax1 ;
16const Float_t ptmax2 = 20.0 ;
17const Float_t ptmin3 = ptmax2 ;
18const Float_t ptmax3 = ptmax ;
19
20const Int_t mintrackrefsTPC = 1;
21const Int_t mintrackrefsITS = 1;
22const Int_t charge = 1;
fdceab34 23
10295ac3 24AliPWG4HighPtSpectra* AddTaskPWG4HighPtSpectra()
fdceab34 25{
67ebd013 26 // Creates HighPtSpectra analysis task and adds it to the analysis manager.
fdceab34 27
28 // A. Get the pointer to the existing analysis manager via the static access method.
29 //==============================================================================
30 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
31 if (!mgr) {
32 Error("AddTaskPWG4HighPtSpectra", "No analysis manager to connect to.");
33 return NULL;
34 }
35
36 // B. Check the analysis type using the event handlers connected to the analysis
37 // manager. The availability of MC handler can also be checked here.
38 //==============================================================================
39 if (!mgr->GetInputEventHandler()) {
67ebd013 40 ::Error("AddTaskPWG4HighPtSpectra", "This task requires an input event handler");
fdceab34 41 return NULL;
42 }
43 TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
44 const char *analysisType = "ESD";//"TPC"
45
46 // C. Create the task, add it to manager.
47 //===========================================================================
67ebd013 48 //CONTAINER DEFINITION
fdceab34 49 Info("AliPWG4HighPtSpectra","SETUP CONTAINER");
50 //the sensitive variables, their indices
67ebd013 51 UInt_t ipt = 0;
52 UInt_t iphi = 1;
53 UInt_t ieta = 2;
54 UInt_t idcar = 3;
55 UInt_t ichi2TPC = 4;
56
fdceab34 57 //Setting up the container grid...
9b58297c 58 UInt_t nstep = 5; //Steps/Modes for containers
fdceab34 59 Int_t kStepReconstructed = 0;
60 Int_t kStepReconstructedTPCOnly = 1;
61 Int_t kStepSecondaries = 2;
9b58297c 62 Int_t kStepReconstructedMC = 3;
63 Int_t kStepMCAcceptance = 4;
67ebd013 64
43032097 65 const Int_t nvar = 5; //number of variables on the grid: pt:phi:eta:DCAR:Chi2/NClusTPC
67ebd013 66 const Int_t nbin11 = (int)(ptmax1-ptmin1);
67 const Int_t nbin12 = (int)((ptmax2-ptmin2)/2.)+nbin11;
68 const Int_t nbin13 = (int)((ptmax3-ptmin3)/5.)+nbin12;
43032097 69 const Int_t nbin1 = nbin13; //bins in pt
67ebd013 70 const Int_t nbin2 = 18;//36; //bins in phi
43032097 71 const Int_t nbin3 = 8; //bins in eta
9f54dd56 72 const Int_t nbin4 = 40; //bins in DCAR
d1084bbd 73 const Int_t nbin5 = 20; //bins in Chi2/#NclusTPC
fdceab34 74
fdceab34 75 //arrays for the number of bins in each dimension
76 Int_t iBin[nvar];
77 iBin[0]=nbin1;
67ebd013 78 iBin[1]=nbin2;
79 iBin[2]=nbin3;
80 iBin[3]=nbin4;
81 iBin[4]=nbin5;
82
fdceab34 83 //arrays for lower bounds :
84 Double_t *binLim1=new Double_t[nbin1+1];
67ebd013 85 Double_t *binLim2=new Double_t[nbin2+1];
86 Double_t *binLim3=new Double_t[nbin3+1];
87 Double_t *binLim4=new Double_t[nbin4+1];
88 Double_t *binLim5=new Double_t[nbin5+1];
89
90 //values for bin lower bounds
91 for(Int_t i=0; i<=nbin1; i++) {
92 if(i<=nbin11) binLim1[i]=(Double_t)ptmin1 + (ptmax1-ptmin1)/nbin11*(Double_t)i ;
93 if(i<=nbin12 && i>nbin11) binLim1[i]=(Double_t)ptmin2 + (ptmax2-ptmin2)/(nbin12-nbin11)*((Double_t)i-(Double_t)nbin11) ;
94 if(i<=nbin13 && i>nbin12) binLim1[i]=(Double_t)ptmin3 + (ptmax3-ptmin3)/(nbin13-nbin12)*((Double_t)i-(Double_t)nbin12) ;
95 }
96 // for(Int_t i=0; i<=nbin1; i++) binLim1[i]=(Double_t)ptmin + (ptmax-ptmin)/nbin1*(Double_t)i ;
97 for(Int_t i=0; i<=nbin2; i++) binLim2[i]=(Double_t)phimin + (phimax-phimin)/nbin2*(Double_t)i ;
98 for(Int_t i=0; i<=nbin3; i++) binLim3[i]=(Double_t)etamin + (etamax-etamin)/nbin3*(Double_t)i ;
99 for(Int_t i=0; i<=nbin4; i++) binLim4[i]=(Double_t)dcarmin + (dcarmax-dcarmin)/nbin4*(Double_t)i ;
100 for(Int_t i=0; i<=nbin5; i++) binLim5[i]=(Double_t)chi2TPCmin + (chi2TPCmax-chi2TPCmin)/nbin5*(Double_t)i ;
101
102
103 AliCFContainer* containerPos = new AliCFContainer("containerPos","container for positive tracks",nstep,nvar,iBin);
104 //setting the bin limits
105 containerPos -> SetBinLimits(ipt,binLim1);
106 containerPos -> SetBinLimits(iphi,binLim2);
107 containerPos -> SetBinLimits(ieta,binLim3);
108 containerPos -> SetBinLimits(idcar,binLim4);
109 containerPos -> SetBinLimits(ichi2TPC,binLim5);
fdceab34 110
67ebd013 111 AliCFContainer* containerNeg = new AliCFContainer("containerNeg","container for negative tracks",nstep,nvar,iBin);
fdceab34 112 //setting the bin limits
67ebd013 113 containerNeg -> SetBinLimits(ipt,binLim1);
114 containerNeg -> SetBinLimits(iphi,binLim2);
115 containerNeg -> SetBinLimits(ieta,binLim3);
116 containerNeg -> SetBinLimits(idcar,binLim4);
117 containerNeg -> SetBinLimits(ichi2TPC,binLim5);
118
fdceab34 119 //CREATE THE CUTS -----------------------------------------------
120 //Use AliESDtrackCuts
121 AliESDtrackCuts *trackCuts = new AliESDtrackCuts("AliESDtrackCuts","Standard Cuts");
10295ac3 122 trackCuts->SetEtaRange(-0.9,0.9);
123 trackCuts->SetPtRange(0.15, 1e10);
43032097 124 trackCuts = trackCuts->GetStandardITSTPCTrackCuts2009(kTRUE);//Primary Track Quality Selection for Global tracks
125
126 AliESDtrackCuts *trackCutsTPConly = new AliESDtrackCuts("AliESDtrackCuts","Standard Cuts TPC only tracks");
127 trackCutsTPConly->SetEtaRange(-0.9,0.9);
128 trackCutsTPConly->SetPtRange(0.15, 1e10);
129 trackCutsTPConly = trackCutsTPConly->GetStandardTPCOnlyTrackCuts();//TPC only Track Quality Cuts
130
67ebd013 131
132 // Gen-Level kinematic cuts
fdceab34 133 AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts");
67ebd013 134 mcKineCuts->SetPtRange(0.15,1e10);
fdceab34 135 mcKineCuts->SetRapidityRange(-0.9,0.9);//-0.5,0.5);
136 mcKineCuts->SetRequireIsCharged(kTRUE);
137
138 //Acceptance Cuts
139 AliCFAcceptanceCuts *mcAccCuts = new AliCFAcceptanceCuts("mcAccCuts","MC acceptance cuts");
140 // mcAccCuts->SetMinNHitITS(mintrackrefsITS);
141 mcAccCuts->SetMinNHitTPC(mintrackrefsTPC);
142
143 TObjArray* recList = new TObjArray(0);
fdceab34 144 TObjArray* recTPConlyList = new TObjArray(0);
145 TObjArray* secList = new TObjArray(0) ;
9b58297c 146 TObjArray* recMCList = new TObjArray(0);
fdceab34 147
148 printf("CREATE MC KINE CUTS\n");
149 TObjArray* mcList = new TObjArray(0) ;
150 mcList->AddLast(mcKineCuts);
151 mcList->AddLast(mcAccCuts);
152
153 //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK
154 printf("CREATE INTERFACE AND CUTS\n");
67ebd013 155 AliCFManager* manPos = new AliCFManager("manPos","Manager for Positive tracks") ;
156 manPos->SetParticleContainer(containerPos);
9b58297c 157 manPos->SetParticleCutsList(kStepReconstructed,recList);
158 manPos->SetParticleCutsList(kStepReconstructedTPCOnly,recTPConlyList);
159 manPos->SetParticleCutsList(kStepSecondaries,secList);
160 manPos->SetParticleCutsList(kStepReconstructedMC,recMCList);
161 manPos->SetParticleCutsList(kStepMCAcceptance,mcList);
162
67ebd013 163
164 AliCFManager* manNeg = new AliCFManager("manNeg","Manager for Negative tracks") ;
165 manNeg->SetParticleContainer(containerNeg);
9b58297c 166 manNeg->SetParticleCutsList(kStepReconstructed,recList);
167 manNeg->SetParticleCutsList(kStepReconstructedTPCOnly,recTPConlyList);
168 manNeg->SetParticleCutsList(kStepSecondaries,secList);
169 manNeg->SetParticleCutsList(kStepReconstructedMC,recMCList);
170 manNeg->SetParticleCutsList(kStepMCAcceptance,mcList);
171
67ebd013 172
173
174 printf("Create task AliPWG4HighPtSpectra\n");
fdceab34 175 AliPWG4HighPtSpectra *taskPWG4HighPtSpectra = new AliPWG4HighPtSpectra("taskPWG4HighPtSpectra");
176 taskPWG4HighPtSpectra->SetCuts(trackCuts);
43032097 177 taskPWG4HighPtSpectra->SetCutsTPConly(trackCutsTPConly);
178 taskPWG4HighPtSpectra->SetCFManagerPos(manPos); //here is set the CF manager +
179 taskPWG4HighPtSpectra->SetCFManagerNeg(manNeg); //here is set the CF manager -
67ebd013 180
e50809ff 181
fdceab34 182 // E. Create ONLY the output containers for the data produced by the task.
183 // Get and connect other common input/output containers via the manager as below
184 //==============================================================================
185
43032097 186 //------ output containers ------
fdceab34 187 TString outputfile = AliAnalysisManager::GetCommonFileName();
188 outputfile += ":PWG4_HighPtSpectra";
10295ac3 189
67ebd013 190 AliAnalysisDataContainer *coutput0 = mgr->CreateContainer("chist0HighPtSpectra", TList::Class(),AliAnalysisManager::kOutputContainer,outputfile);
191 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("ccontainer0HighPtSpectra", AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile);
192 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("ccontainer1HighPtSpectra", AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile);
e5abcde9 193 AliAnalysisDataContainer *cout_cuts0 = mgr->CreateContainer("qa_trackCuts", AliESDtrackCuts::Class(), AliAnalysisManager::kParamContainer,outputfile);
43032097 194 AliAnalysisDataContainer *cout_cuts1 = mgr->CreateContainer("qa_trackCutsTPConly", AliESDtrackCuts::Class(), AliAnalysisManager::kParamContainer,outputfile);
195
fdceab34 196 mgr->AddTask(taskPWG4HighPtSpectra);
197
198 mgr->ConnectInput(taskPWG4HighPtSpectra,0,mgr->GetCommonInputContainer());
199 mgr->ConnectOutput(taskPWG4HighPtSpectra,0,coutput0);
200 mgr->ConnectOutput(taskPWG4HighPtSpectra,1,coutput1);
67ebd013 201 mgr->ConnectOutput(taskPWG4HighPtSpectra,2,coutput2);
e5abcde9 202 mgr->ConnectOutput(taskPWG4HighPtSpectra,3,cout_cuts0);
43032097 203 mgr->ConnectOutput(taskPWG4HighPtSpectra,4,cout_cuts1);
fdceab34 204
205 // Return task pointer at the end
206 return taskPWG4HighPtSpectra;
207}