]>
Commit | Line | Data |
---|---|---|
c683985a | 1 | //DEFINITION OF A FEW CONSTANTS |
2 | //---------------------------------------------------- | |
3 | ||
4 | /* $Id$ */ | |
5 | ||
3f80f3f5 | 6 | AliAnalysisTaskDStarCorrelations *AddTaskDStarCorrelations(AliAnalysisTaskDStarCorrelations::CollSyst syst, // set collisional system (pp, pA, AA) |
7 | Bool_t theMCon, // flag for Data (kFALSE) or MC (kTRUE) analysis | |
8 | Bool_t mixing, // flag for Single Event (kFALSE) or Mixed Event (kTRUE) analysis | |
9 | Bool_t UseReco=kTRUE, // flag for Kine/pure MC (kFALSE) or Reconstruction (kTRUE) analysis - in data, kTRUE by default | |
10 | Bool_t UseHadChannelinMC, // flag to use D*->Kpipi (kTRUE) or any decay (kFALSE) in MC kine | |
11 | Bool_t fullmode = kFALSE, // flag to run in fast mode (kFALSE) or slow and detailed (kTRUE) | |
12 | Bool_t UseEffic=kFALSE, // flag to use associated track eff (kTRUE = YES, kFALSE = NO) | |
13 | Bool_t UseDEffic = kFALSE, // flag to use Dmeson track eff (kTRUE = YES, kFALSE = NO) | |
14 | Bool_t useDStarSidebands = kFALSE, // flag to use sidebands from D0 (kFALSE) or sidebands from Dstar (kTRUE) | |
15 | Bool_t useOnlyOneDStarPerEvent, // use only one D* per event (kTRUE) or all of them (kFALSE) | |
16 | AliAnalysisTaskDStarCorrelations::DEffVariable var, // variable to use in D mesn efficiency correction besides pt | |
17 | Int_t trackselect =1, // correlate with hadrons (1), kaons (2), kzeros (3) | |
18 | Int_t usedispl =0, // don't use displacement (0), use absolute displacement (1) or relative (normalized by impac.par resol.) displacement (2) | |
19 | Int_t nbins, //number of bins in correlations histo | |
20 | Float_t DStarSigma, // number of sigmas in dstar selection (for pt shape, eta, phi distr. studies) | |
21 | Float_t D0Sigma, // number of sigmas in dzero selection (for pt shape, eta, phi distr. studies) | |
22 | Float_t D0SBSigmaLow, // number of sigmas in dzero sb selection (for pt shape, eta, phi distr. studies) | |
23 | Float_t D0SBSigmaHigh, // number of sigmas in dzero sb selection (for pt shape, eta, phi distr. studies) | |
24 | Float_t eta, // maximum D* eta | |
25 | Float_t minDStarPt, // set minimum pt for Dstar | |
26 | TString DStarCutsFile, // path of Dmeson cut object | |
27 | TString TrackCutsFile, // path of associated cut object | |
28 | TString suffix = "" // suffix for output | |
29 | ) | |
c683985a | 30 | { |
31 | ||
32 | ||
33 | ||
34 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
35 | if (!mgr) { | |
36 | ::Error(" AliAnalysisTaskDStarCorrelations", "No analysis manager to connect to."); | |
37 | return NULL; | |
38 | } | |
39 | ||
40 | cout << "==========================================================" << endl; | |
41 | cout << "Set Inputs : " << endl; | |
42 | cout << " " << endl; | |
43 | if(syst == AliAnalysisTaskDStarCorrelations::pp) cout << "Running on pp @ 7 TeV" << endl; | |
44 | if(syst == AliAnalysisTaskDStarCorrelations::pA) cout << "Running on pPb @ 5.02 TeV" << endl; | |
45 | if(syst == AliAnalysisTaskDStarCorrelations::AA) cout << "Running on PbPb @ 2.76 TeV" << endl; | |
46 | ||
47 | if(theMCon) cout << "Analysis on MonteCarlo" << endl; | |
48 | else cout << "Analysis on Data" << endl; | |
49 | ||
50 | if(mixing) cout << "Analysis on Mixed Events" << endl; | |
51 | else cout << "Analysis on Single Events" << endl; | |
52 | ||
53 | if(UseReco) cout << "Using Reconstructed objects" << endl; | |
54 | else cout << "Using Pure MC information " << endl; | |
55 | ||
56 | if(fullmode) cout << "Running in full mode" << endl; | |
57 | else cout << "Running in fast mode " << endl; | |
58 | ||
59 | if(UseEffic) cout << "Using single track efficiency map" << endl; | |
60 | else cout << "Not Using single track efficiency map " << endl; | |
61 | ||
62 | if(UseDEffic) cout << "Using Dmeson efficiency map" << endl; | |
63 | else cout << "Not Using Dmeson efficiency map " << endl; | |
64 | ||
65 | ||
66 | if(var == AliAnalysisTaskDStarCorrelations::kNone) cout << "Applying D Efficiency map vs pT " << endl; | |
67 | if(var == AliAnalysisTaskDStarCorrelations::kMult) cout << "Applying D Efficiency map vs pT vs Multiplicity" << endl; | |
68 | if(var == AliAnalysisTaskDStarCorrelations::kCentr) cout << "Applying D Efficiency map vs pT vs Centrality" << endl; | |
69 | if(var == AliAnalysisTaskDStarCorrelations::kRapidity) cout << "Applying D Efficiency map vs pT vs Rapidity" << endl; | |
70 | if(var == AliAnalysisTaskDStarCorrelations::kEta) cout << "Applying D Efficiency map vs pT vs Eta" << endl; | |
71 | ||
72 | if(trackselect == 1) cout << "Correlating with hadrons" << endl; | |
73 | if(trackselect == 2) cout << "Correlating with kaons" << endl; | |
74 | if(trackselect == 3) cout << "Correlating with kzeros" << endl; | |
75 | ||
76 | if(usedispl == 0) cout << "Not using displacement cut" << endl; | |
77 | if(usedispl == 1) cout << "Using absolute displacement cut" << endl; | |
78 | if(usedispl == 2) cout << "Using relative displacement cut" << endl; | |
79 | ||
80 | ||
81 | cout << "Number of bins in deltaphi = " << nbins << endl; | |
82 | ||
83 | cout << "N of Sigmas in D* selection =" << DStarSigma << endl; | |
84 | cout << "N of Sigmas in D0 selection = " << D0Sigma << endl; | |
85 | cout << "D0 Sidebands taken from = " << D0SBSigmaLow << " - " << D0SBSigmaHigh << " sigmas " << endl; endl; | |
86 | ||
87 | ||
88 | ||
89 | cout << "DStar cut object: " << DStarCutsFile << endl; | |
90 | cout << "Tracks cut object: " << TrackCutsFile << endl; | |
91 | ||
92 | ||
93 | cout << "==========================================================" << endl; | |
94 | //gSystem->Sleep(2000); | |
95 | ||
96 | // TString DCutObjPath = "CutObjects/DStar/"; | |
97 | ||
98 | ||
99 | // ******************************** OPENING THE D* CUTS ************************************ | |
100 | cout << "Getting D meson cut object from file \n" << DStarCutsFile.Data() << "\n " << endl; | |
101 | TFile* filecuts=TFile::Open(DStarCutsFile.Data()); | |
102 | if(!filecuts->IsOpen()){ | |
103 | cout<<"DStar cut object file not found: exit"<<endl; | |
104 | return; | |
105 | } | |
106 | ||
107 | AliRDHFCutsDStartoKpipi* RDHFDStartoKpipi=new AliRDHFCutsDStartoKpipi(); | |
108 | RDHFDStartoKpipi = (AliRDHFCutsDStartoKpipi*)filecuts->Get("DStartoKpipiCuts"); | |
109 | RDHFDStartoKpipi->SetName("DStartoKpipiCuts"); | |
110 | ||
111 | // mm let's see if everything is ok | |
112 | if(!RDHFDStartoKpipi){ | |
113 | cout<<"Specific AliRDHFCuts not found"<<endl; | |
114 | return; | |
115 | } | |
116 | ||
117 | ||
118 | // RDHFDStartoKpipi->SetTriggerClass(""); | |
119 | // RDHFDStartoKpipi->SetTriggerMask(AliVEvent::kCentral); | |
120 | ||
3f80f3f5 | 121 | if(minDStarPt>RDHFDStartoKpipi->GetMinPtCandidate()){ |
122 | cout << "Changing minimum pT of DStar from " << RDHFDStartoKpipi->GetMinPtCandidate() << " to " << minDStarPt << endl; | |
123 | RDHFDStartoKpipi->SetMinPtCandidate(minDStarPt); | |
124 | } | |
c683985a | 125 | |
126 | // ******************************** OPENING THE ASSOCIATED TRACK CUTS ************************************ | |
127 | cout << "Getting associated track cut object from file \n" << TrackCutsFile.Data() << "\n " << endl; | |
128 | TFile* filecuts2=TFile::Open(TrackCutsFile.Data()); | |
129 | if(!filecuts2->IsOpen()){ | |
130 | cout<<"Track cut object file not found: exit"<<endl; | |
131 | return; | |
132 | } | |
133 | AliHFAssociatedTrackCuts* corrCuts=new AliHFAssociatedTrackCuts(); | |
134 | corrCuts = (AliHFAssociatedTrackCuts*)filecuts2->Get("AssociatedCuts"); | |
135 | corrCuts->SetName("AssociatedCuts"); | |
136 | corrCuts->PrintAll(); | |
137 | if(!corrCuts){ | |
138 | cout<<"Specific associated track cuts not found"<<endl; | |
139 | return; | |
140 | } | |
141 | ||
3f80f3f5 | 142 | if(UseEffic && !corrCuts->IsTrackEffMap()){ |
143 | cout << "You are trying to use the single track efficiency, but there is no map loaded in the cut object " << endl; | |
144 | return; | |
145 | } | |
146 | ||
c683985a | 147 | |
3f80f3f5 | 148 | |
149 | if(UseDEffic && var == AliAnalysisTaskDStarCorrelations::kNone && (!corrCuts->IsTrigEffMap1D()&&(!corrCuts->IsTrigEffMap1DB()))){ | |
150 | cout << "You are trying to use the DStar efficiency vs pt only, but there is no map loaded in the cut object " << endl; | |
151 | return; | |
152 | } | |
153 | ||
154 | if(UseDEffic && (var != AliAnalysisTaskDStarCorrelations::kNone) && (!corrCuts->IsTrigEffMap2D()&&(!corrCuts->IsTrigEffMap2DB()))){ | |
155 | cout << "You are trying to use the DStar efficiency vs pt only, but there is no map loaded in the cut object " << endl; | |
156 | return; | |
157 | } | |
158 | ||
c683985a | 159 | // ******************************** SELECTING THE MC PROCESS ************************************ |
160 | ||
161 | TString selectMCproc = ""; | |
162 | ||
163 | Int_t NMCevents = corrCuts->GetNofMCEventType(); | |
164 | for(Int_t k=0; k<NMCevents; k++){ | |
165 | Int_t * MCEventType = corrCuts->GetMCEventType(); | |
166 | selectMCproc += Form("%d",MCEventType[k]); | |
167 | } | |
168 | ||
169 | cout << "Select process string = " << selectMCproc << endl; | |
170 | ||
171 | ||
172 | ||
173 | // ******************************** CREATING THE TASK ************************************ | |
174 | ||
175 | printf("CREATE TASK \n"); | |
176 | // create the task | |
177 | AliAnalysisTaskDStarCorrelations *task = new AliAnalysisTaskDStarCorrelations("AliAnalysisTaskDStarCorrelations",RDHFDStartoKpipi,corrCuts,syst,fullmode); | |
178 | ||
179 | // Setters | |
180 | ||
181 | if(!theMCon) { | |
182 | printf("Analysis on Data - reconstruction only!"); | |
183 | UseReco = kTRUE; | |
184 | printf("Analysis on Data - hadronic channel only!"); | |
185 | UseHadChannelinMC = kFALSE; | |
186 | } | |
187 | ||
188 | ||
189 | ||
190 | ||
c683985a | 191 | task->SetNofPhiBins(nbins); |
192 | task->SetMonteCarlo(theMCon); | |
193 | task->SetUseMixing(mixing); | |
194 | task->SetCorrelator(trackselect) ; | |
195 | task->SetUseDisplacement(usedispl); | |
196 | //task->SetCollSys(syst); | |
197 | task->SetLevelOfDebug(2); | |
198 | task->SetUseReconstruction(UseReco); // set kTRUE for Using Reconstruction, kFALSe for MC Truth | |
199 | task->SetDMesonSigmas(DStarSigma,D0Sigma,D0SBSigmaLow,D0SBSigmaHigh); | |
200 | //task->SetDMesonSigmas(sigmas); | |
201 | //task->SetDMesonSigmas(sigmas); | |
202 | task->SetUseEfficiencyCorrection(UseEffic); | |
203 | task->SetUseDmesonEfficiencyCorrection(UseDEffic); | |
3f80f3f5 | 204 | task->SetUseRemoveMoreThanOneCDmesonCandidate(useOnlyOneDStarPerEvent); |
c683985a | 205 | |
206 | task->SetEfficiencyVariable(var); | |
207 | task->SetMaxDStarEta(eta); | |
208 | task->SetUseHadronicChannelAtKineLevel(UseHadChannelinMC); | |
c3cc0c2f | 209 | if(useDStarSidebands)task->SetBkgEstimationMethod(AliAnalysisTaskDStarCorrelations::kDStarSB); |
210 | if(!useDStarSidebands)task->SetBkgEstimationMethod(AliAnalysisTaskDStarCorrelations::kDZeroSB); | |
c683985a | 211 | |
212 | if(trackselect == 1) Info(" AliAnalysisTaskDStarCorrelations","Correlating D* with charged hadrons \n"); | |
213 | else if(trackselect == 2) Info(" AliAnalysisTaskDStarCorrelations","Correlating D* with charged kaons \n"); | |
214 | else if(trackselect == 3) Info(" AliAnalysisTaskDStarCorrelations","Correlating D* with reconstructed K0s \n"); | |
215 | else Fatal(" AliAnalysisTaskDStarCorrelations","Nothing to correlate with!"); | |
216 | if(mixing) Info (" AliAnalysisTaskDStarCorrelations","Event Mixing Analysis\n"); | |
217 | if(!mixing) Info (" AliAnalysisTaskDStarCorrelations","Single Event Analysis \n"); | |
218 | ||
219 | // Create and connect containers for input/output | |
220 | //TString dcavalue = " "; | |
5d3b1a33 | 221 | |
222 | TString contname1 = "OutputEvent"; | |
223 | TString contname2 = "OutputDmeson"; | |
224 | TString contname3 = "OutputTracks"; | |
225 | TString contname4 = "OutputEventMixing"; | |
226 | TString contname5 = "OutputCorrelations"; | |
227 | TString contname6 = "OutputMC"; | |
228 | TString counter = "NormCounter"; | |
229 | TString cutname1 = "Dcuts" ; | |
c683985a | 230 | TString cutname2 = "hadroncuts" ; |
5d3b1a33 | 231 | |
232 | //if(suffix != ""){ | |
233 | contname1 += suffix; | |
234 | contname2 += suffix; | |
235 | contname3 += suffix; | |
236 | contname4 += suffix; | |
237 | contname5 += suffix; | |
238 | contname6 += suffix; | |
239 | counter += suffix; | |
240 | cutname1 += suffix; | |
241 | cutname2 += suffix; | |
242 | ||
243 | ||
244 | // } | |
245 | ||
246 | // else{ | |
247 | ||
248 | //if(!theMCon) TString contname = "Data"; | |
249 | //if(theMCon) TString contname = "MonteCarlo"; | |
250 | //TString contname2 = "MC"; | |
251 | //if(trackselect ==1) TString particle = "Hadron"; | |
252 | //if(trackselect ==2) TString particle = "Kaon"; | |
253 | //if(trackselect ==3) TString particle = "KZero"; | |
254 | ||
255 | ||
c683985a | 256 | TString outputfile = AliAnalysisManager::GetCommonFileName(); |
5d3b1a33 | 257 | //TString outputfileMC = AliAnalysisManager::GetCommonFileName(); |
258 | //TString counter = "NormCounter"; | |
c683985a | 259 | outputfile += ":PWGHF_HFCJ_"; |
5d3b1a33 | 260 | //outputfileMC += ":PWGHF_HFCJ_"; |
c683985a | 261 | |
262 | if(!mixing) { | |
263 | outputfile += "SE"; | |
5d3b1a33 | 264 | //outputfileMC += "SE"; |
265 | /*contname1 += "SE"; | |
c683985a | 266 | contname2 += "SE"; |
5d3b1a33 | 267 | contname3 += "SE"; |
268 | contname4 += "SE"; | |
269 | contname5 += "SE"; | |
270 | counter+= "SE"; | |
271 | cutname1 += "SE"; | |
272 | cutname2 += "SE";*/ | |
273 | ||
c683985a | 274 | } |
275 | if(mixing){ | |
276 | outputfile += "ME"; | |
5d3b1a33 | 277 | //outputfileMC += "ME"; |
278 | ||
c683985a | 279 | } |
280 | ||
281 | ||
282 | ||
5d3b1a33 | 283 | /*outputfile += "Dphi_DStar"; |
284 | //outputfileMC += "Dphi_DStar"; | |
c683985a | 285 | outputfile += particle; |
5d3b1a33 | 286 | //outputfileMC += particle; |
287 | */ | |
c683985a | 288 | if(UseEffic){ |
289 | outputfile += "_EffY_"; | |
5d3b1a33 | 290 | //outputfileMC += "_EffY_"; |
291 | ||
c683985a | 292 | } |
293 | ||
294 | if(!UseEffic){ | |
295 | outputfile += "_EffN_"; | |
5d3b1a33 | 296 | //outputfileMC += "_EffN_"; |
297 | ||
c683985a | 298 | } |
299 | ||
300 | if(UseDEffic){ | |
301 | TString string = "DEffY_"; | |
302 | ||
303 | if(var == AliAnalysisTaskDStarCorrelations::kNone) string += "vsPt_"; | |
304 | if(var == AliAnalysisTaskDStarCorrelations::kMult) string += "vsPtMult_"; | |
305 | if(var == AliAnalysisTaskDStarCorrelations::kCentr) string += "vsPCentrt_"; | |
306 | if(var == AliAnalysisTaskDStarCorrelations::kRapidity) string += "vsPtY_"; | |
307 | if(var == AliAnalysisTaskDStarCorrelations::kEta) string += "vsPtEta_"; | |
308 | ||
309 | outputfile += string; | |
5d3b1a33 | 310 | //outputfileMC += string; |
311 | ||
c683985a | 312 | } |
313 | ||
314 | if(!UseDEffic){ | |
315 | outputfile += "DEffN_"; | |
5d3b1a33 | 316 | //outputfileMC += "DEffN_"; |
317 | ||
c683985a | 318 | } |
319 | ||
320 | ||
321 | outputfile += Form("%d_bins_",nbins); | |
5d3b1a33 | 322 | //outputfileMC += Form("%d_bins_",nbins); |
323 | ||
c683985a | 324 | |
325 | ||
5d3b1a33 | 326 | outputfile += suffix; |
327 | //outputfileMC += Form("task_%d",tasknumber); | |
328 | ||
c683985a | 329 | |
330 | /* outputfile += TrackCutObjNamePrefix; | |
5d3b1a33 | 331 | //outputfileMC += TrackCutObjNamePrefix; |
c683985a | 332 | cutname += TrackCutObjNamePrefix; |
333 | cutname2 += TrackCutObjNamePrefix; | |
334 | contname += TrackCutObjNamePrefix; | |
335 | contname2 += TrackCutObjNamePrefix; | |
336 | counter+= TrackCutObjNamePrefix; | |
337 | */ | |
338 | outputfile += selectMCproc; | |
5d3b1a33 | 339 | //outputfileMC += selectMCproc; |
340 | ||
c683985a | 341 | |
342 | TString reco = ""; | |
343 | ||
344 | if(UseReco) reco = "_reco"; | |
345 | if(!UseReco) { | |
346 | if(UseHadChannelinMC) reco = "_MCTruthHadChan"; | |
347 | if(!UseHadChannelinMC) reco = "_MCTruthAllChan"; | |
348 | } | |
349 | outputfile += reco; | |
5d3b1a33 | 350 | //outputfileMC += reco; |
351 | ||
c683985a | 352 | |
353 | TString nsigma = Form("_%.0f_%.0f%.0f%.0f_sigmas",DStarSigma,D0Sigma,D0SBSigmaLow,D0SBSigmaHigh); | |
354 | ||
355 | //cout << "nsigma string = "<< nsigma << endl; | |
356 | ||
357 | outputfile += nsigma; | |
5d3b1a33 | 358 | //outputfileMC += nsigma; |
359 | ||
c683985a | 360 | |
5d3b1a33 | 361 | /* |
c683985a | 362 | cout << contname << endl; |
363 | cout << contname2 << endl; | |
364 | cout << cutname << endl; | |
365 | cout << cutname2 << endl; | |
366 | cout << counter << endl; | |
5d3b1a33 | 367 | cout << outputfile << endl;*/ |
c683985a | 368 | //return; |
5d3b1a33 | 369 | //}// end else |
c683985a | 370 | mgr->AddTask(task); |
371 | // ------ input data ------ | |
372 | AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer(); | |
373 | ||
374 | // ----- output data ----- | |
375 | ||
376 | // output TH1I for event counting | |
377 | ||
378 | //TLists | |
5d3b1a33 | 379 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname1, TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); |
380 | AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(contname2, TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); | |
381 | AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(contname3, TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); | |
382 | AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(contname4, TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); | |
383 | AliAnalysisDataContainer *coutput5 = mgr->CreateContainer(contname5, TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); | |
384 | AliAnalysisDataContainer *coutput6 = mgr->CreateContainer(contname6, TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); | |
385 | // Normalization Counter | |
386 | AliAnalysisDataContainer *coutput7 = mgr->CreateContainer(counter,AliNormalizationCounter::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); | |
c683985a | 387 | // Cut Objects |
5d3b1a33 | 388 | AliAnalysisDataContainer *coutput8 = mgr->CreateContainer(cutname1,AliRDHFCutsDStartoKpipi::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //cuts D |
389 | AliAnalysisDataContainer *coutput9 = mgr->CreateContainer(cutname2,AliHFAssociatedTrackCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //cuts tracks | |
390 | ||
c683985a | 391 | |
392 | ||
393 | mgr->ConnectInput(task,0,mgr->GetCommonInputContainer()); | |
394 | mgr->ConnectOutput(task,1,coutput1); | |
395 | mgr->ConnectOutput(task,2,coutput2); | |
396 | mgr->ConnectOutput(task,3,coutput3); | |
397 | mgr->ConnectOutput(task,4,coutput4); | |
398 | mgr->ConnectOutput(task,5,coutput5); | |
5d3b1a33 | 399 | mgr->ConnectOutput(task,6,coutput6); |
400 | mgr->ConnectOutput(task,7,coutput7); | |
401 | mgr->ConnectOutput(task,8,coutput8); | |
402 | mgr->ConnectOutput(task,9,coutput9); | |
c683985a | 403 | |
404 | return task ; | |
405 | ||
406 | } | |
407 |