more consistent use of cuts, new cut number 1008
[u/mrichter/AliRoot.git] / PWGJE / macros / AddTaskPWG4HighPtSpectra.C
CommitLineData
fdceab34 1//DEFINITION OF A FEW CONSTANTS
de88b926 2#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
3
67ebd013 4const Float_t phimin = 0.;
5const Float_t phimax = 2.*TMath::Pi();
6const Float_t etamin = -0.9;
7const Float_t etamax = 0.9;
67ebd013 8
dae7dd67 9const Int_t mintrackrefsTPC = 0;
10const Int_t mintrackrefsITS = 0;
fdceab34 11
5d87a047 12void AddTaskPWG4HighPtSpectra(char *prodType = "LHC10h",Bool_t isPbPb=kTRUE, Int_t iAODanalysis = 0, UInt_t triggerMask = AliVEvent::kMB)
fdceab34 13{
7b90d977 14 int cent = 10;
15
5d87a047 16 AliPWG4HighPtSpectra *taskSpectra00cent10 = ConfigureTaskPWG4HighPtSpectra(prodType,isPbPb,cent,0,0,triggerMask);
17 AliPWG4HighPtSpectra *taskSpectra01cent10 = ConfigureTaskPWG4HighPtSpectra(prodType,isPbPb,cent,0,1,triggerMask);
18 // AliPWG4HighPtSpectra *taskSpectra02cent10 = ConfigureTaskPWG4HighPtSpectra(prodType,isPbPb,cent,0,2,triggerMask);
19 // AliPWG4HighPtSpectra *taskSpectra10cent10 = ConfigureTaskPWG4HighPtSpectra(prodType,isPbPb,cent,1,0,triggerMask);
20 // AliPWG4HighPtSpectra *taskSpectra20cent10 = ConfigureTaskPWG4HighPtSpectra(prodType,isPbPb,cent,2,0,triggerMask);
21 AliPWG4HighPtSpectra *taskSpectra70cent10 = ConfigureTaskPWG4HighPtSpectra(prodType,isPbPb,cent,7,0,triggerMask);
22 AliPWG4HighPtSpectra *taskSpectra71cent10 = ConfigureTaskPWG4HighPtSpectra(prodType,isPbPb,cent,7,1,triggerMask);
23 AliPWG4HighPtSpectra *taskSpectra72cent10 = ConfigureTaskPWG4HighPtSpectra(prodType,isPbPb,cent,7,2,triggerMask);
7b90d977 24
25 if(isPbPb) {
26 for(cent=0; cent<4; cent++) {
5d87a047 27 AliPWG4HighPtSpectra *taskSpectra00 = ConfigureTaskPWG4HighPtSpectra(prodType,isPbPb,cent,0,0,triggerMask);
28 AliPWG4HighPtSpectra *taskSpectra01 = ConfigureTaskPWG4HighPtSpectra(prodType,isPbPb,cent,0,1,triggerMask);
29 // AliPWG4HighPtSpectra *taskSpectra02 = ConfigureTaskPWG4HighPtSpectra(prodType,isPbPb,cent,0,2,triggerMask);
30 // AliPWG4HighPtSpectra *taskSpectra10 = ConfigureTaskPWG4HighPtSpectra(prodType,isPbPb,cent,1,0,triggerMask);
31 // AliPWG4HighPtSpectra *taskSpectra20 = ConfigureTaskPWG4HighPtSpectra(prodType,isPbPb,cent,2,0,triggerMask);
32 AliPWG4HighPtSpectra *taskSpectra70 = ConfigureTaskPWG4HighPtSpectra(prodType,isPbPb,cent,7,0,triggerMask);
33 AliPWG4HighPtSpectra *taskSpectra71 = ConfigureTaskPWG4HighPtSpectra(prodType,isPbPb,cent,7,1,triggerMask);
34 AliPWG4HighPtSpectra *taskSpectra72 = ConfigureTaskPWG4HighPtSpectra(prodType,isPbPb,cent,7,2,triggerMask);
7b90d977 35 }
36 }
37
38}
39
40
5d87a047 41AliPWG4HighPtSpectra* ConfigureTaskPWG4HighPtSpectra(char *prodType = "LHC10e14", Bool_t isPbPb=kTRUE,Int_t centClass = 0,
42 Int_t trackType = 0, Int_t cuts = 0, UInt_t triggerMask = AliVEvent::kMB)
7b90d977 43{
44
45 /*
a5e0d236 46 trackType: 0 = global
7b90d977 47 1 = TPC stand alone
48 2 = TPC stand alone constrained to SPD vertex
5a0bd31f 49 cuts: 0 (global) = standard ITSTPC2010 a la RAA analysis
50 1 (global) = ITSrefit, no SPD requirements -> standard for jet analysis
51 2 (global) = ITSrefit + no hits in SPD
52 3 (global) = standard ITS tight cuts with nCrossed rows cut for hybrid tracks
7b90d977 53 0 (TPC) = standard TPC + NClusters>70
54 1 (TPC) = standard TPC + NClusters>0 --> to study new TPC QA recommendations
55 */
56
67ebd013 57 // Creates HighPtSpectra analysis task and adds it to the analysis manager.
fdceab34 58
380cff49 59 //Load common track cut class
5c4489e2 60 gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/CreateTrackCutsPWGJE.C");
380cff49 61
fdceab34 62 // A. Get the pointer to the existing analysis manager via the static access method.
63 //==============================================================================
64 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
65 if (!mgr) {
66 Error("AddTaskPWG4HighPtSpectra", "No analysis manager to connect to.");
67 return NULL;
68 }
69
70 // B. Check the analysis type using the event handlers connected to the analysis
71 // manager. The availability of MC handler can also be checked here.
72 //==============================================================================
73 if (!mgr->GetInputEventHandler()) {
67ebd013 74 ::Error("AddTaskPWG4HighPtSpectra", "This task requires an input event handler");
fdceab34 75 return NULL;
76 }
77 TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
78 const char *analysisType = "ESD";//"TPC"
79
80 // C. Create the task, add it to manager.
81 //===========================================================================
67ebd013 82 //CONTAINER DEFINITION
fdceab34 83 Info("AliPWG4HighPtSpectra","SETUP CONTAINER");
84 //the sensitive variables, their indices
67ebd013 85 UInt_t ipt = 0;
86 UInt_t iphi = 1;
87 UInt_t ieta = 2;
dae7dd67 88 UInt_t incls = 3;
67ebd013 89
fdceab34 90 //Setting up the container grid...
de88b926 91 UInt_t nstep = 4; //Steps/Modes for containers
7b90d977 92 Int_t kStepReconstructed = 0;
93 Int_t kStepSecondaries = 1;
94 Int_t kStepReconstructedMC = 2;
95 Int_t kStepMCAcceptance = 3;
b1cd0099 96
97 //redefine pt ranges in case of Jet-Jet production
de88b926 98 Float_t ptBinEdges[4][4];
99 Float_t ptmin = 0.0 ;
100 Float_t ptmax = 100.0 ;
101
102 ptBinEdges[0][0] = 2.;
103 ptBinEdges[0][1] = 0.2;
104 ptBinEdges[1][0] = 6.;
105 ptBinEdges[1][1] = 0.5;
106 ptBinEdges[2][0] = 20.;
107 ptBinEdges[2][1] = 2.;
108 ptBinEdges[3][0] = 100.;
109 ptBinEdges[3][1] = 5.;
110
dae7dd67 111 const Int_t nvar = 4; //number of variables on the grid: pt:phi:eta:NClsIter1
de88b926 112
113 const Int_t nbin11 = round((ptBinEdges[0][0]-ptmin)/ptBinEdges[0][1]);
114 const Int_t nbin12 = round((ptBinEdges[1][0]-ptBinEdges[0][0])/ptBinEdges[1][1])+nbin11;
115 const Int_t nbin13 = round((ptBinEdges[2][0]-ptBinEdges[1][0])/ptBinEdges[2][1])+nbin12;
116 const Int_t nbin14 = round((ptBinEdges[3][0]-ptBinEdges[2][0])/ptBinEdges[3][1])+nbin13;
117
118 const Int_t nbin1 = nbin14; //bins in pt
a31b8a87 119 const Int_t nbin2 = 18; //bins in phi
120 const Int_t nbin3 = 2; //bins in eta
dae7dd67 121 const Int_t nbin4 = 6; //bins in NClsIter1: 0 70 80 90 100 120
122
fdceab34 123
fdceab34 124 //arrays for the number of bins in each dimension
125 Int_t iBin[nvar];
126 iBin[0]=nbin1;
67ebd013 127 iBin[1]=nbin2;
128 iBin[2]=nbin3;
dae7dd67 129 iBin[3]=nbin4;
ec555a3c 130
fdceab34 131 //arrays for lower bounds :
132 Double_t *binLim1=new Double_t[nbin1+1];
67ebd013 133 Double_t *binLim2=new Double_t[nbin2+1];
134 Double_t *binLim3=new Double_t[nbin3+1];
dae7dd67 135 Double_t *binLim4=new Double_t[nbin4+1];
ec555a3c 136
67ebd013 137 //values for bin lower bounds
138 for(Int_t i=0; i<=nbin1; i++) {
b1cd0099 139 if(i<=nbin11) binLim1[i]=(Double_t)ptmin + (ptBinEdges[0][0]-ptmin)/nbin11*(Double_t)i ;
de88b926 140 if(i<=nbin12 && i>nbin11) binLim1[i]=(Double_t)ptBinEdges[0][0] + (ptBinEdges[1][0]-ptBinEdges[0][0])/(nbin12-nbin11)*((Double_t)i-(Double_t)nbin11) ;
141 if(i<=nbin13 && i>nbin12) binLim1[i]=(Double_t)ptBinEdges[1][0] + (ptBinEdges[2][0]-ptBinEdges[1][0])/(nbin13-nbin12)*((Double_t)i-(Double_t)nbin12) ;
142 if(i<=nbin14 && i>nbin13) binLim1[i]=(Double_t)ptBinEdges[2][0] + (ptBinEdges[3][0]-ptBinEdges[2][0])/(nbin14-nbin13)*((Double_t)i-(Double_t)nbin13) ;
67ebd013 143 }
67ebd013 144 for(Int_t i=0; i<=nbin2; i++) binLim2[i]=(Double_t)phimin + (phimax-phimin)/nbin2*(Double_t)i ;
145 for(Int_t i=0; i<=nbin3; i++) binLim3[i]=(Double_t)etamin + (etamax-etamin)/nbin3*(Double_t)i ;
dae7dd67 146 binLim4[0] = 0.;
147 binLim4[1] = 70.;
148 binLim4[2] = 80.;
149 binLim4[3] = 90.;
150 binLim4[4] = 100.;
151 binLim4[5] = 120.;
152 binLim4[6] = 160.;
153
67ebd013 154
155 AliCFContainer* containerPos = new AliCFContainer("containerPos","container for positive tracks",nstep,nvar,iBin);
156 //setting the bin limits
157 containerPos -> SetBinLimits(ipt,binLim1);
158 containerPos -> SetBinLimits(iphi,binLim2);
159 containerPos -> SetBinLimits(ieta,binLim3);
dae7dd67 160 containerPos -> SetBinLimits(incls,binLim4);
fdceab34 161
67ebd013 162 AliCFContainer* containerNeg = new AliCFContainer("containerNeg","container for negative tracks",nstep,nvar,iBin);
fdceab34 163 //setting the bin limits
67ebd013 164 containerNeg -> SetBinLimits(ipt,binLim1);
165 containerNeg -> SetBinLimits(iphi,binLim2);
166 containerNeg -> SetBinLimits(ieta,binLim3);
dae7dd67 167 containerNeg -> SetBinLimits(incls,binLim4);
67ebd013 168
fdceab34 169 //CREATE THE CUTS -----------------------------------------------
170 //Use AliESDtrackCuts
327d12da 171 AliESDtrackCuts *trackCuts = new AliESDtrackCuts("AliESDtrackCuts","Standard Cuts");
172 AliESDtrackCuts *trackCutsReject = 0x0;
7b90d977 173 //Standard Cuts
174 //Set track cuts for global tracks
175 if(trackType==0 && cuts==0) {
380cff49 176 // tight global tracks - RAA analysis
5c4489e2 177 trackCuts = CreateTrackCutsPWGJE(1000);
34fc6450 178 }
7b90d977 179 if(trackType==0 && cuts==1) {
380cff49 180 //Cuts global tracks with ITSrefit requirement and SPDrequirement for jet analysis
5d87a047 181 if (!strcmp(prodType,"LHC12a15e"))
f8bd6b9f 182 trackCuts = CreateTrackCutsPWGJE(10001008);
5d87a047 183 else
184 trackCuts = CreateTrackCutsPWGJE(10001006);
5a0bd31f 185 }
186 if(trackType==0 && cuts==2) {
187 //Cuts global tracks with ITSrefit requirement but without SPD
5d87a047 188 if (!strcmp(prodType,"LHC12a15e"))
f8bd6b9f 189 trackCuts = CreateTrackCutsPWGJE(10011008);
5d87a047 190 else
191 trackCuts = CreateTrackCutsPWGJE(10011006);
5a0bd31f 192 }
380cff49 193 if(trackType==7 && cuts==0) {
b43ea0be 194 // no requirements on SPD and ITSrefit failed
5d87a047 195 if (!strcmp(prodType,"LHC12a15e")){
f8bd6b9f 196 trackCuts = CreateTrackCutsPWGJE(10041008); //no ITSrefit requirement
197 trackCutsReject = CreateTrackCutsPWGJE(1008); //ITSrefit requirement
5d87a047 198 }
199 else {
200 trackCuts = CreateTrackCutsPWGJE(10041006); //no ITSrefit requirement
201 trackCutsReject = CreateTrackCutsPWGJE(1006); //ITSrefit requirement
202 }
ed5c9f3f 203 trackCutsReject->SetEtaRange(etamin,etamax);
b43ea0be 204 trackCutsReject->SetPtRange(0.15, 1e10);
34fc6450 205 }
380cff49 206 if(trackType==7 && cuts==1) {
b43ea0be 207 //Cuts global tracks with ITSrefit requirement but without SPD
5d87a047 208 if (!strcmp(prodType,"LHC12a15e"))
f8bd6b9f 209 trackCuts = CreateTrackCutsPWGJE(10011008);
5d87a047 210 else
211 trackCuts = CreateTrackCutsPWGJE(10011006);
b43ea0be 212 }
213 if(trackType==7 && cuts==2) {
214 // no requirements on SPD and ITSrefit failed
5d87a047 215 if (!strcmp(prodType,"LHC12a15e")){
f8bd6b9f 216 trackCuts = CreateTrackCutsPWGJE(10041008); //no ITSrefit requirement filter 256
217 trackCutsReject = CreateTrackCutsPWGJE(10001008); //ITSrefit requirement filter 16
5d87a047 218 }
219 else {
220 trackCuts = CreateTrackCutsPWGJE(10041006); //no ITSrefit requirement filter 256
221 trackCutsReject = CreateTrackCutsPWGJE(10001006); //ITSrefit requirement filter 16
222 }
dae7dd67 223 trackCutsReject->SetEtaRange(etamin,etamax);
b43ea0be 224 trackCutsReject->SetPtRange(0.15, 1e10);
380cff49 225 }
226
7b90d977 227 if(trackType==1 && cuts==0) {
228 //Set track cuts for TPConly tracks
5c4489e2 229 trackCuts = CreateTrackCutsPWGJE(2001);
7b90d977 230 }
231 if(trackType==2 && cuts==0) {
232 // Set track cuts for TPConly constrained tracks
5c4489e2 233 trackCuts = CreateTrackCutsPWGJE(2001);
7b90d977 234 }
dae7dd67 235 trackCuts->SetEtaRange(etamin,etamax);
10295ac3 236 trackCuts->SetPtRange(0.15, 1e10);
43032097 237
ec555a3c 238 // Gen-Level kinematic cuts
fdceab34 239 AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts");
67ebd013 240 mcKineCuts->SetPtRange(0.15,1e10);
dae7dd67 241 mcKineCuts->SetEtaRange(etamin,etamax);//-0.5,0.5);
fdceab34 242 mcKineCuts->SetRequireIsCharged(kTRUE);
243
244 //Acceptance Cuts
dae7dd67 245 //AliCFAcceptanceCuts *mcAccCuts = new AliCFAcceptanceCuts("mcAccCuts","MC acceptance cuts");
fdceab34 246 // mcAccCuts->SetMinNHitITS(mintrackrefsITS);
dae7dd67 247 //mcAccCuts->SetMinNHitTPC(mintrackrefsTPC);
fdceab34 248
249 TObjArray* recList = new TObjArray(0);
fdceab34 250 TObjArray* secList = new TObjArray(0) ;
9b58297c 251 TObjArray* recMCList = new TObjArray(0);
fdceab34 252
253 printf("CREATE MC KINE CUTS\n");
254 TObjArray* mcList = new TObjArray(0) ;
255 mcList->AddLast(mcKineCuts);
dae7dd67 256 //mcList->AddLast(mcAccCuts);
fdceab34 257
258 //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK
259 printf("CREATE INTERFACE AND CUTS\n");
67ebd013 260 AliCFManager* manPos = new AliCFManager("manPos","Manager for Positive tracks") ;
261 manPos->SetParticleContainer(containerPos);
9b58297c 262 manPos->SetParticleCutsList(kStepReconstructed,recList);
9b58297c 263 manPos->SetParticleCutsList(kStepSecondaries,secList);
264 manPos->SetParticleCutsList(kStepReconstructedMC,recMCList);
265 manPos->SetParticleCutsList(kStepMCAcceptance,mcList);
67ebd013 266
267 AliCFManager* manNeg = new AliCFManager("manNeg","Manager for Negative tracks") ;
268 manNeg->SetParticleContainer(containerNeg);
9b58297c 269 manNeg->SetParticleCutsList(kStepReconstructed,recList);
9b58297c 270 manNeg->SetParticleCutsList(kStepSecondaries,secList);
271 manNeg->SetParticleCutsList(kStepReconstructedMC,recMCList);
272 manNeg->SetParticleCutsList(kStepMCAcceptance,mcList);
67ebd013 273
274
aa3ba8d2 275 AliPWG4HighPtSpectra *taskPWG4HighPtSpectra = new AliPWG4HighPtSpectra(Form("AliPWG4HighPtSpectraCent%dTrackType%dCuts%d",centClass,trackType,cuts));
34fc6450 276 taskPWG4HighPtSpectra->SetTrackType(trackType);
fdceab34 277 taskPWG4HighPtSpectra->SetCuts(trackCuts);
327d12da 278 taskPWG4HighPtSpectra->SetCutsReject(trackCutsReject);
43032097 279 taskPWG4HighPtSpectra->SetCFManagerPos(manPos); //here is set the CF manager +
280 taskPWG4HighPtSpectra->SetCFManagerNeg(manNeg); //here is set the CF manager -
5d87a047 281 taskPWG4HighPtSpectra->SetTriggerMask(triggerMask);
67ebd013 282
7b90d977 283 if(isPbPb) {
284 taskPWG4HighPtSpectra->SetIsPbPb(kTRUE);
285 taskPWG4HighPtSpectra->SetCentralityClass(centClass);
286 }
dae7dd67 287 // taskPWG4HighPtSpectra->SetSigmaConstrainedMax(5.);
7b90d977 288
e50809ff 289
fdceab34 290 // E. Create ONLY the output containers for the data produced by the task.
291 // Get and connect other common input/output containers via the manager as below
292 //==============================================================================
293
43032097 294 //------ output containers ------
fdceab34 295 TString outputfile = AliAnalysisManager::GetCommonFileName();
7b90d977 296 outputfile += Form(":PWG4_HighPtSpectraCent%dTrackType%dCuts%d",centClass,trackType,cuts);
10295ac3 297
7b90d977 298 AliAnalysisDataContainer *coutput0 = mgr->CreateContainer(Form("chist0HighPtSpectraCent%dTrackType%dCuts%d",centClass,trackType,cuts), TList::Class(),AliAnalysisManager::kOutputContainer,outputfile);
299 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("ccontainer0HighPtSpectraCent%dTrackType%dCuts%d",centClass,trackType,cuts), AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile);
300 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(Form("ccontainer1HighPtSpectraCent%dTrackType%dCuts%d",centClass,trackType,cuts), AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile);
301 AliAnalysisDataContainer *cout_cuts0 = mgr->CreateContainer(Form("qa_SpectraTrackCutsCent%dTrackType%dCuts%d",centClass,trackType,cuts), AliESDtrackCuts::Class(), AliAnalysisManager::kParamContainer,outputfile);
43032097 302
fdceab34 303 mgr->AddTask(taskPWG4HighPtSpectra);
304
305 mgr->ConnectInput(taskPWG4HighPtSpectra,0,mgr->GetCommonInputContainer());
306 mgr->ConnectOutput(taskPWG4HighPtSpectra,0,coutput0);
307 mgr->ConnectOutput(taskPWG4HighPtSpectra,1,coutput1);
67ebd013 308 mgr->ConnectOutput(taskPWG4HighPtSpectra,2,coutput2);
e5abcde9 309 mgr->ConnectOutput(taskPWG4HighPtSpectra,3,cout_cuts0);
fdceab34 310
311 // Return task pointer at the end
312 return taskPWG4HighPtSpectra;
313}