]>
Commit | Line | Data |
---|---|---|
a75aacd6 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id:$ */ | |
17 | ||
18 | #include <TROOT.h> | |
19 | #include <TChain.h> | |
20 | #include <TFile.h> | |
21 | #include <TList.h> | |
22 | #include <TMath.h> | |
23 | #include <TTree.h> | |
24 | #include <TH2F.h> | |
25 | #include <TRandom.h> | |
26 | //#include <TVector3.h> | |
27 | ||
28 | #include "AliAnalysisTaskLeadingTrackUE.h" | |
29 | #include "AliAnalyseLeadingTrackUE.h" | |
30 | #include "AliUEHistograms.h" | |
31 | #include "AliUEHist.h" | |
32 | ||
33 | #include "AliAnalysisHelperJetTasks.h" | |
34 | #include "AliAnalysisManager.h" | |
35 | #include "AliAODHandler.h" | |
36 | #include "AliAODInputHandler.h" | |
37 | #include "AliAODMCParticle.h" | |
38 | #include "AliGenPythiaEventHeader.h" | |
39 | #include "AliInputEventHandler.h" | |
40 | #include "AliLog.h" | |
41 | #include "AliMCEventHandler.h" | |
42 | #include "AliVParticle.h" | |
43 | ||
44 | ||
45 | //////////////////////////////////////////////////////////////////////// | |
46 | // | |
47 | // Analysis class for Underlying Event studies w.r.t. leading track | |
48 | // | |
49 | // Look for correlations on the tranverse regions w.r.t | |
50 | // the leading track in the event | |
51 | // | |
52 | // This class needs input AODs. | |
53 | // The output is a list of analysis-specific containers. | |
54 | // | |
55 | // The AOD can be either connected to the InputEventHandler | |
56 | // for a chain of AOD files | |
57 | // or | |
58 | // to the OutputEventHandler | |
59 | // for a chain of ESD files, | |
60 | // in this case the class should be in the train after the jet-finder | |
61 | // | |
62 | // Authors: | |
63 | // Arian Abrahantes Quintana | |
64 | // Jan Fiete Grosse-Oetringhaus | |
65 | // Ernesto Lopez Torres | |
66 | // Sara Vallero | |
67 | // | |
68 | //////////////////////////////////////////////////////////////////////// | |
69 | ||
70 | ||
71 | ClassImp( AliAnalysisTaskLeadingTrackUE ) | |
72 | ||
73 | // Define global pointer | |
74 | AliAnalysisTaskLeadingTrackUE* AliAnalysisTaskLeadingTrackUE::fgTaskLeadingTrackUE=NULL; | |
75 | ||
76 | //____________________________________________________________________ | |
77 | AliAnalysisTaskLeadingTrackUE:: AliAnalysisTaskLeadingTrackUE(const char* name): | |
78 | AliAnalysisTask(name,""), | |
79 | // general configuration | |
80 | fDebug(0), | |
81 | fMode(0), | |
82 | // pointers to UE classes | |
83 | fAnalyseUE(0x0), | |
84 | fHistosUE(0x0), | |
85 | fTrackingEfficiency(0x0), | |
86 | // handlers and events | |
87 | fAOD(0x0), | |
88 | fArrayMC(0x0), | |
89 | fInputHandler(0x0), | |
90 | fMcEvent(0x0), | |
91 | fMcHandler(0x0), | |
92 | // histogram settings | |
93 | fListOfHistos(0x0), | |
94 | fBinsPtInHist(30), | |
95 | fMinJetPtInHist(0.), | |
96 | fMaxJetPtInHist(300.), | |
97 | // event QA | |
98 | fnTracksVertex(3), // QA tracks pointing to principal vertex (= 3 default) | |
99 | fZVertex(5.), | |
100 | // track cuts | |
101 | fTrackEtaCut(0.8), | |
102 | fLeadingTrackEtaCut(0.8), | |
103 | fFilterBit(0xFF), | |
104 | fUseChargeHadrons(kFALSE), | |
105 | //For MC weighting | |
106 | fAvgTrials(1) | |
107 | { | |
108 | // Default constructor | |
109 | // Define input and output slots here | |
110 | // Input slot #0 works with a TChain | |
111 | DefineInput(0, TChain::Class()); | |
112 | // Output slot #0 writes into a TList container | |
113 | DefineOutput(0, TList::Class()); | |
114 | ||
115 | } | |
116 | ||
117 | ||
118 | /************** INTERFACE METHODS *****************************/ | |
119 | ||
120 | //______________________________________________________________ | |
121 | Bool_t AliAnalysisTaskLeadingTrackUE::Notify() | |
122 | { | |
123 | ||
124 | // Implemented Notify() to read the cross sections | |
125 | // and number of trials from pyxsec.root. | |
126 | // This will be used when merging different MC samples. | |
127 | // (Copied from AliAnalysisTaskJFSystematics) | |
128 | ||
129 | fAvgTrials = 1; | |
130 | TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree(); | |
131 | Float_t xsection = 0; | |
132 | Float_t trials = 1; | |
133 | if(tree){ | |
134 | TFile *curfile = tree->GetCurrentFile(); | |
135 | if (!curfile) { | |
136 | Error("Notify","No current file"); | |
137 | return kFALSE; | |
138 | } | |
139 | ||
140 | AliAnalysisHelperJetTasks::PythiaInfoFromFile(curfile->GetName(),xsection,trials); | |
141 | ||
142 | //TO-DO | |
143 | //fHistosUE->GetXsec()->Fill("<#sigma>",xsection); | |
144 | ||
145 | // construct average trials | |
146 | Float_t nEntries = (Float_t)tree->GetTree()->GetEntries(); | |
147 | if(trials>=nEntries && nEntries>0.)fAvgTrials = trials/nEntries; | |
148 | } | |
149 | ||
150 | return kTRUE; | |
151 | } | |
152 | ||
153 | //____________________________________________________________________ | |
154 | void AliAnalysisTaskLeadingTrackUE::ConnectInputData(Option_t* /*option*/) | |
155 | { | |
156 | ||
157 | // Connect the input data | |
158 | if (fDebug > 1) AliInfo("ConnectInputData() "); | |
159 | ||
160 | // Since AODs can either be connected to the InputEventHandler | |
161 | // or to the OutputEventHandler ( the AOD is created by a previus task in the train ) | |
162 | // we need to get the pointer to the AODEvent correctly. | |
163 | ||
164 | // Delta AODs are also accepted. | |
165 | ||
166 | TObject* handler = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler(); | |
167 | ||
168 | if( handler && handler->InheritsFrom("AliAODInputHandler") ) { // input AOD | |
169 | fAOD = ((AliAODInputHandler*)handler)->GetEvent(); | |
170 | if (fDebug > 1) AliInfo(" ==== Tracks and Jets from AliAODInputHandler"); | |
171 | } else { //output AOD | |
172 | handler = AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler(); | |
173 | if( handler && handler->InheritsFrom("AliAODHandler") ) { | |
174 | fAOD = ((AliAODHandler*)handler)->GetAOD(); | |
175 | if (fDebug > 1) AliInfo(" ==== Tracks and Jets from AliAODHandler"); | |
176 | } else { // no AOD | |
177 | AliFatal("I can't get any AOD Event Handler"); | |
178 | return; | |
179 | } | |
180 | } | |
181 | ||
182 | // Initialize common pointers | |
183 | Initialize(); | |
184 | ||
185 | } | |
186 | ||
187 | //____________________________________________________________________ | |
188 | void AliAnalysisTaskLeadingTrackUE::CreateOutputObjects() | |
189 | { | |
190 | // Create the output container | |
191 | ||
192 | if (fDebug > 1) AliInfo("CreateOutputObjects()"); | |
193 | ||
194 | // Initialize class with main algorithms, event and track selection. | |
195 | fAnalyseUE = new AliAnalyseLeadingTrackUE(); | |
196 | fAnalyseUE->SetParticleSelectionCriteria(fFilterBit, fUseChargeHadrons, fLeadingTrackEtaCut); | |
197 | fAnalyseUE->SetDebug(fDebug); | |
198 | ||
199 | // Initialize output list of containers | |
200 | if (fListOfHistos != NULL){ | |
201 | delete fListOfHistos; | |
202 | fListOfHistos = NULL; | |
203 | } | |
204 | if (!fListOfHistos){ | |
205 | fListOfHistos = new TList(); | |
206 | fListOfHistos->SetOwner(kTRUE); | |
207 | } | |
208 | ||
209 | // Initialize class to handle histograms | |
210 | fHistosUE = new AliUEHistograms; | |
211 | ||
212 | // add histograms to list | |
213 | fListOfHistos->Add(fHistosUE); | |
214 | ||
215 | //fListOfHistos->Add(new TH2F("multVsLeadStep5", ";multiplicity;leading pT", 100, -0.5, 99.5, 20, 0, 10)); | |
216 | ||
217 | // Add task configuration to output list | |
218 | AddSettingsTree(); | |
219 | ||
220 | ||
221 | PostData(0,fListOfHistos); | |
222 | } | |
223 | ||
224 | //____________________________________________________________________ | |
225 | void AliAnalysisTaskLeadingTrackUE::Exec(Option_t */*option*/) | |
226 | { | |
227 | // array of MC particles | |
228 | if (fMcHandler){ | |
229 | fArrayMC = dynamic_cast<TClonesArray*>(fAOD->FindListObject(AliAODMCParticle::StdBranchName())); | |
230 | if (!fArrayMC)AliFatal("No array of MC particles found !!!"); | |
231 | } | |
232 | ||
233 | // Get number of trials from MC header | |
234 | Float_t nTrials = 1; | |
235 | if (fMcHandler) { | |
236 | fMcEvent = fMcHandler->MCEvent(); | |
237 | if (fMcEvent) { | |
238 | // TO-DO: extend to PHOJET | |
239 | AliGenPythiaEventHeader* pythiaGenHeader = AliAnalysisHelperJetTasks::GetPythiaEventHeader(fMcEvent); | |
240 | if(pythiaGenHeader){ | |
241 | nTrials = pythiaGenHeader->Trials(); | |
242 | } | |
243 | } | |
244 | } | |
245 | ||
246 | // TO-DO | |
247 | //fHistosUE->GetTrials()->Fill("#sum{ntrials}",fAvgTrials); | |
248 | ||
249 | // Analyse the event | |
250 | if (fMode) AnalyseCorrectionMode(); | |
251 | else AnalyseDataMode(); | |
252 | ||
253 | PostData(0,fListOfHistos); | |
254 | } | |
255 | ||
256 | //____________________________________________________________________ | |
257 | void AliAnalysisTaskLeadingTrackUE::Terminate(Option_t */*option*/) | |
258 | { | |
259 | ||
260 | // Terminate analysis | |
261 | if( fDebug > 1 ) AliInfo("End analysis"); | |
262 | ||
263 | if (!gROOT->IsBatch()){ | |
264 | fListOfHistos = dynamic_cast<TList*> (GetOutputData(0)); | |
265 | if (!fListOfHistos){ | |
266 | AliError("Histogram List is not available"); | |
267 | return; | |
268 | }else{ | |
269 | // Draw something | |
270 | } | |
271 | } else { | |
272 | AliInfo(" Batch mode, not histograms will be shown..."); | |
273 | } | |
274 | ||
275 | } | |
276 | ||
277 | ||
278 | /******************** ANALYSIS METHODS *****************************/ | |
279 | ||
280 | //____________________________________________________________________ | |
281 | void AliAnalysisTaskLeadingTrackUE::AddSettingsTree() | |
282 | { | |
283 | //Write settings to output list | |
284 | TTree *settingsTree = new TTree("UEAnalysisSettings","Analysis Settings in UE estimation"); | |
285 | settingsTree->Branch("fFilterBit", &fFilterBit,"FilterBit/I"); | |
286 | settingsTree->Branch("fLeadingTrackEtaCut", &fLeadingTrackEtaCut, "LeadingTrackEtaCut/D"); | |
287 | settingsTree->Branch("fUseChargeHadrons", &fUseChargeHadrons,"UseChHadrons/O"); | |
288 | settingsTree->Fill(); | |
289 | fListOfHistos->Add(settingsTree); | |
290 | } | |
291 | ||
292 | //____________________________________________________________________ | |
293 | void AliAnalysisTaskLeadingTrackUE::AnalyseCorrectionMode() | |
294 | { | |
295 | ||
296 | // Run the analysis on MC to get the correction maps | |
297 | ||
298 | PostData(0,fListOfHistos); | |
299 | ||
300 | if ( fDebug > 3 ) AliInfo( " Processing event in Corrections mode ..." ); | |
301 | ||
302 | //PROCESS TYPE (ND,SD,DD) | |
303 | AliAnalysisHelperJetTasks::MCProcessType eventId = AliAnalysisHelperJetTasks::kInvalidProcess; | |
304 | if (fMcHandler && fMcEvent) { | |
305 | AliGenEventHeader* genHeader = fMcEvent->GenEventHeader(); | |
306 | eventId = AliAnalysisHelperJetTasks::GetPythiaEventProcessType(genHeader,kFALSE); | |
307 | if (eventId<0){ | |
308 | eventId = AliAnalysisHelperJetTasks::GetDPMjetEventProcessType(genHeader,kFALSE); | |
309 | } | |
310 | if (eventId<0 && fDebug>1)AliInfo("No Pythia or Phojet Header retrived!"); | |
311 | } | |
312 | Int_t fillId=-1; | |
313 | if (eventId == AliAnalysisHelperJetTasks::kND)fillId = 0; | |
314 | if (eventId == AliAnalysisHelperJetTasks::kSD)fillId = 1; | |
315 | if (eventId == AliAnalysisHelperJetTasks::kDD)fillId = 2; | |
316 | ||
317 | // count all events | |
318 | fHistosUE->FillEvent(fillId, -1); | |
319 | ||
320 | // Only consider MC events within the vtx-z region used also as cut on the reconstructed vertex | |
321 | if (!fAnalyseUE->VertexSelection(fMcEvent, 0, fZVertex)) | |
322 | return; | |
323 | ||
324 | // Get MC-true leading particle (but do not cut out events!) | |
325 | TObjArray *ltMC = (TObjArray*)fAnalyseUE->FindLeadingObjects(fArrayMC); | |
326 | AliVParticle* leadingMC = 0; | |
327 | if (ltMC) | |
328 | leadingMC = (AliVParticle*) ltMC->At(0); | |
329 | ||
330 | // it can happen that there is no MC leading particle in the acceptance required (|eta|<0.8) | |
331 | // and we do not want to base the event slection on MC information | |
332 | ||
333 | // Sort MC-true charged particles | |
334 | // as output you get an array of 3 lists of particles belonging to different regions: | |
335 | // - at 0: towards | |
336 | // - at 1: away | |
337 | // - at 2: transverse MIN | |
338 | // - at 3: transverse MAX | |
339 | TObjArray *regionSortedParticlesMC = (TObjArray*)fAnalyseUE->SortRegions(leadingMC, fArrayMC, 0x0); | |
340 | TObjArray *regionsMinMaxMC = (TObjArray*)fAnalyseUE->GetMinMaxRegion((TList*)regionSortedParticlesMC->At(2),(TList*)regionSortedParticlesMC->At(3)); | |
341 | // Fill UE containers (step, leading track, towards particles, away particles, transverse MIN and MAX particles) | |
342 | // (MC-true leading particle and MC-true all particles) | |
343 | // STEP 0 | |
344 | fHistosUE->Fill(fillId,AliUEHist::kCFStepAll,leadingMC,(TList*)regionSortedParticlesMC->At(0),(TList*)regionSortedParticlesMC->At(1),(TList*)regionsMinMaxMC->At(0),(TList*)regionsMinMaxMC->At(1)); | |
345 | ||
346 | // Trigger selection ************************************************ | |
347 | if (fAnalyseUE->TriggerSelection(fInputHandler)) | |
348 | { | |
349 | // Count events that pass AliPhysicsSelection | |
350 | ||
351 | // Fill UE containers (step, leading track, towards particles, away particles, transverse MIN and MAX particles) | |
352 | // (MC-true leading particle and MC-true all particles) | |
353 | // STEP 1 | |
354 | fHistosUE->Fill(fillId,AliUEHist::kCFStepTriggered,leadingMC,(TList*)regionSortedParticlesMC->At(0),(TList*)regionSortedParticlesMC->At(1),(TList*)regionsMinMaxMC->At(0),(TList*)regionsMinMaxMC->At(1)); | |
355 | ||
356 | // count number of MC tracks above 150 MeV/c | |
357 | Int_t nMCTracks = 0; | |
358 | if (leadingMC && leadingMC->Pt() > 0.15) | |
359 | nMCTracks++; | |
360 | for (Int_t i=0; i<4; i++) | |
361 | for (Int_t j=0; j<((TList*)regionSortedParticlesMC->At(i))->GetEntries(); j++) | |
362 | if (((AliVParticle*) ((TList*)regionSortedParticlesMC->At(i))->At(j))->Pt() > 0.15) | |
363 | nMCTracks++; | |
364 | ||
365 | //((TH2F*)fListOfHistos->FindObject("multVsLeadStep5"))->Fill(nMCTracks, leadingMC->Pt()); | |
366 | ||
367 | // Vertex selection ************************************************* | |
368 | if (fAnalyseUE->VertexSelection(fAOD, fnTracksVertex, fZVertex)) | |
369 | { | |
370 | // Count events that pass Vertex selection | |
371 | ||
372 | // Fill UE containers (step, leading track, towards particles, away particles, transverse MIN and MAX particles) | |
373 | // (MC-true leading particle and MC-true all particles) | |
374 | // STEP 2 | |
375 | fHistosUE->Fill(fillId,AliUEHist::kCFStepVertex,leadingMC,(TList*)regionSortedParticlesMC->At(0),(TList*)regionSortedParticlesMC->At(1),(TList*)regionsMinMaxMC->At(0),(TList*)regionsMinMaxMC->At(1)); | |
376 | ||
377 | // Get Reconstructed leading particle ******************************* | |
378 | TObjArray *ltRECO = fAnalyseUE->FindLeadingObjects(fAOD); | |
379 | if (ltRECO) | |
380 | { | |
381 | // Count events where a reconstructed track was found in |eta|<0.8 | |
382 | // the pT cut will be set when projecting output containers | |
383 | // for leading particle correlation plots | |
384 | if (leadingMC) { | |
385 | fHistosUE->Fill(leadingMC, (AliVParticle*)ltRECO->At(0)); | |
386 | } | |
387 | ||
388 | // If there is no MC leading track the container is not filled, so the number of entries in the container might be different | |
389 | // from the number of events after the selection, since the selection is based on RECO tracks | |
390 | // Fill UE containers (step, leading track, towards particles, away particles, transverse MIN and MAX particles) | |
391 | // (MC-true leading particle and MC-true all particles) | |
392 | // STEP 3 | |
393 | fHistosUE->Fill(fillId,AliUEHist::kCFStepAnaTopology,leadingMC,(TList*)regionSortedParticlesMC->At(0),(TList*)regionSortedParticlesMC->At(1),(TList*)regionsMinMaxMC->At(0),(TList*)regionsMinMaxMC->At(1)); | |
394 | ||
395 | //Sort RECO particles w.r.t. MC-leading and return matched (primary) MC particle | |
396 | // (you cannot sort tracks w.r.t. RECO-leading and plot it vs. MC-leading ...) | |
397 | TObjArray *regionSortedParticlesRECOLTMC = (TObjArray*)fAnalyseUE->SortRegions(leadingMC, fAOD, fArrayMC); | |
398 | TObjArray *regionsMinMaxRECOLTMC = (TObjArray*)fAnalyseUE->GetMinMaxRegion((TList*)regionSortedParticlesRECOLTMC->At(2),(TList*)regionSortedParticlesRECOLTMC->At(3)); | |
399 | // Fill UE containers (step, leading track, towards particles, away particles, transverse MIN and MAX particles) | |
400 | // (MC leading particle and RECO-matched (quantities from MC particle) all particles) | |
401 | // STEP 4 | |
402 | fHistosUE->Fill(fillId,AliUEHist::kCFStepTrackedOnlyPrim,leadingMC,(TList*)regionSortedParticlesRECOLTMC->At(0),(TList*)regionSortedParticlesRECOLTMC->At(1),(TList*)regionsMinMaxRECOLTMC->At(0),(TList*)regionsMinMaxRECOLTMC->At(1)); | |
403 | // comparing this step with step 3 (for all-tracks observables) you get the tracking efficiency | |
404 | ||
405 | //Sort RECO particles w.r.t. MC-leading and return matched (primary+secondary) MC particle | |
406 | // (you cannot sort tracks w.r.t. RECO-leading and plot it vs. MC-leading ...) | |
407 | TObjArray *regionSortedParticlesRECOLTMC2 = (TObjArray*)fAnalyseUE->SortRegions(leadingMC, fAOD, fArrayMC,kFALSE); | |
408 | TObjArray *regionsMinMaxRECOLTMC2 = (TObjArray*)fAnalyseUE->GetMinMaxRegion((TList*)regionSortedParticlesRECOLTMC2->At(2),(TList*)regionSortedParticlesRECOLTMC2->At(3)); | |
409 | ||
410 | // Fill UE containers (step, leading track, towards particles, away particles, transverse MIN and MAX particles) | |
411 | // (MC leading particle and RECO-matched (quantities from MC particle) all particles) | |
412 | // STEP 5 | |
413 | fHistosUE->Fill(fillId,AliUEHist::kCFStepTracked,leadingMC,(TList*)regionSortedParticlesRECOLTMC2->At(0),(TList*)regionSortedParticlesRECOLTMC2->At(1),(TList*)regionsMinMaxRECOLTMC2->At(0),(TList*)regionsMinMaxRECOLTMC2->At(1)); | |
414 | // comparing this step with step 3 (for all-tracks observables) you get the tracking efficiency | |
415 | ||
416 | // SWITCH TO RECONSTRUCTED TRACKS ************************************ | |
417 | // The next steps correspond to track selections | |
418 | // Sort RECO particles w.r.t. RECO-leading and return RECO particle | |
419 | TObjArray *regionSortedParticlesRECO = (TObjArray*)fAnalyseUE->SortRegions((AliVParticle*)ltRECO->At(0), fAOD,0); | |
420 | TObjArray *regionsMinMaxRECO = (TObjArray*)fAnalyseUE->GetMinMaxRegion((TList*)regionSortedParticlesRECO->At(2),(TList*)regionSortedParticlesRECO->At(3)); | |
421 | // Fill UE containers (step, leading track, towards particles, away particles, transverse MIN and MAX particles) | |
422 | // (RECO leading particle and RECO all particles) | |
423 | // STEP 6 | |
424 | fHistosUE->Fill(fillId,AliUEHist::kCFStepReconstructed,(AliVParticle*)ltRECO->At(0),(TList*)regionSortedParticlesRECO->At(0),(TList*)regionSortedParticlesRECO->At(1),(TList*)regionsMinMaxRECO->At(0),(TList*)regionsMinMaxRECO->At(1)); | |
425 | ||
426 | // STEP 8 for reduced efficiency study | |
427 | FillReducedEfficiency(fillId, AliUEHist::kCFStepBiasStudy, ltRECO, kFALSE); | |
428 | FillReducedEfficiency(fillId, AliUEHist::kCFStepBiasStudy2, ltRECO, kTRUE); | |
429 | ||
430 | // count number of reco tracks above 150 MeV/c | |
431 | Int_t nRecoTracks = 0; | |
432 | if (((AliVParticle*) ltRECO->At(0))->Pt() > 0.15) | |
433 | nRecoTracks++; | |
434 | for (Int_t i=0; i<4; i++) | |
435 | for (Int_t j=0; j<((TList*)regionSortedParticlesRECO->At(i))->GetEntries(); j++) | |
436 | if (((AliVParticle*) ((TList*)regionSortedParticlesRECO->At(i))->At(j))->Pt() > 0.15) | |
437 | nRecoTracks++; | |
438 | ||
439 | if (leadingMC && leadingMC->Pt() > 0.5) | |
440 | fHistosUE->GetCorrelationMultiplicity()->Fill(nMCTracks, nRecoTracks); | |
441 | ||
442 | if (leadingMC) | |
443 | { | |
444 | // Match reco leading track with true ********************************* | |
445 | Int_t recoLabel = ((AliAODTrack*)ltRECO->At(0))->GetLabel(); | |
446 | Int_t mcLabel = ((AliAODMCParticle*)leadingMC)->GetLabel(); | |
447 | if (recoLabel != mcLabel) | |
448 | return; | |
449 | ||
450 | // Fill UE containers (step, leading track, towards particles, away particles, transverse MIN and MAX particles) | |
451 | // (RECO-MATCHED leading particle and RECO all particles) | |
452 | // STEP 7 | |
453 | fHistosUE->Fill(fillId,AliUEHist::kCFStepRealLeading,(AliVParticle*)ltRECO->At(0),(TList*)regionSortedParticlesRECO->At(0),(TList*)regionSortedParticlesRECO->At(1),(TList*)regionsMinMaxRECO->At(0),(TList*)regionsMinMaxRECO->At(1)); | |
454 | // comparing this step with step 6 (for leading-track observables) you get the efficiency to reconstruct the leading track | |
455 | // comparing this step with step 6 (for all-tracks observables) you see how leading-track misidentification affects the final distributions | |
456 | } | |
457 | ||
458 | delete regionSortedParticlesRECOLTMC; | |
459 | delete regionsMinMaxRECOLTMC; | |
460 | delete regionSortedParticlesRECOLTMC2; | |
461 | delete regionsMinMaxRECOLTMC2; | |
462 | delete regionSortedParticlesRECO; | |
463 | delete regionsMinMaxRECO; | |
464 | delete ltRECO; | |
465 | } | |
466 | } | |
467 | } | |
468 | ||
469 | if (ltMC) | |
470 | delete ltMC; | |
471 | delete regionSortedParticlesMC; | |
472 | delete regionsMinMaxMC; | |
473 | } | |
474 | ||
475 | //____________________________________________________________________ | |
476 | void AliAnalysisTaskLeadingTrackUE::AnalyseDataMode() | |
477 | { | |
478 | ||
479 | // Run the analysis on DATA or MC to get raw distributions | |
480 | ||
481 | PostData(0,fListOfHistos); | |
482 | ||
483 | if ( fDebug > 3 ) AliInfo( " Processing event in Data mode ..." ); | |
484 | Int_t eventId = 0; | |
485 | ||
486 | // Fill the "event-counting-container", it is needed to get the number of events remaining after each event-selection cut | |
487 | fHistosUE->FillEvent(eventId, AliUEHist::kCFStepAll); | |
488 | ||
489 | // Trigger selection ************************************************ | |
490 | if (!fAnalyseUE->TriggerSelection(fInputHandler)) return; | |
491 | // Fill the "event-counting-container", it is needed to get the number of events remaining after each event-selection cut | |
492 | fHistosUE->FillEvent(eventId, AliUEHist::kCFStepTriggered); | |
493 | ||
494 | // Vertex selection ************************************************* | |
495 | if(!fAnalyseUE->VertexSelection(fAOD, fnTracksVertex, fZVertex)) return; | |
496 | // Fill the "event-counting-container", it is needed to get the number of events remaining after each event-selection cut | |
497 | fHistosUE->FillEvent(eventId, AliUEHist::kCFStepVertex); | |
498 | // comparing this step with previous one you get the vertex selection efficiency from data (?) | |
499 | ||
500 | // Get Reconstructed leading particle ******************************* | |
501 | TObjArray *ltRECO = fAnalyseUE->FindLeadingObjects(fAOD); | |
502 | if (!ltRECO) return; | |
503 | ||
504 | // fill control distributions | |
505 | fHistosUE->Fill(0, (AliVParticle*)ltRECO->At(0)); | |
506 | ||
507 | // Fill the "event-counting-container", it is needed to get the number of events remaining after each event-selection cut | |
508 | fHistosUE->FillEvent(eventId, AliUEHist::kCFStepAnaTopology); | |
509 | ||
510 | // Switch to reconstructed tracks ************************************ | |
511 | // Sort RECO particles w.r.t. RECO-leading and return RECO particle | |
512 | TObjArray *regionSortedParticlesRECO = (TObjArray*)fAnalyseUE->SortRegions((AliVParticle*)ltRECO->At(0), fAOD,0); | |
513 | TObjArray *regionsMinMaxRECO = (TObjArray*)fAnalyseUE->GetMinMaxRegion((TList*)regionSortedParticlesRECO->At(2),(TList*)regionSortedParticlesRECO->At(3)); | |
514 | // Fill UE containers (step, leading track, towards particles, away particles, transverse MIN and MAX particles) | |
515 | // (RECO leading particle and RECO all particles) | |
516 | // STEP 6 | |
517 | fHistosUE->Fill(eventId,AliUEHist::kCFStepReconstructed,(AliVParticle*)ltRECO->At(0),(TList*)regionSortedParticlesRECO->At(0),(TList*)regionSortedParticlesRECO->At(1),(TList*)regionsMinMaxRECO->At(0),(TList*)regionsMinMaxRECO->At(1)); | |
518 | ||
519 | // STEP 8 and 9 for reduced efficiency study | |
520 | FillReducedEfficiency(eventId, AliUEHist::kCFStepBiasStudy, ltRECO, kFALSE); | |
521 | FillReducedEfficiency(eventId, AliUEHist::kCFStepBiasStudy2, ltRECO, kTRUE); | |
522 | ||
523 | delete ltRECO; | |
524 | delete regionSortedParticlesRECO; | |
525 | delete regionsMinMaxRECO; | |
526 | } | |
527 | ||
528 | //____________________________________________________________________ | |
529 | void AliAnalysisTaskLeadingTrackUE::FillReducedEfficiency(Int_t eventId, AliUEHist::CFStep step, TObjArray* ltRECO, Bool_t twoStep) | |
530 | { | |
531 | // remove leading particle using fTrackingEfficiency and use subleading particle to fill the histograms | |
532 | // | |
533 | // if twoStep is kTRUE, do a two step procedure where in each step only 50% of the loss due to the tracking efficiency is applied | |
534 | ||
535 | if (!fTrackingEfficiency) | |
536 | return; | |
537 | ||
538 | TObjArray* particleList = (TObjArray*) ltRECO->Clone(); | |
539 | AliVParticle* leading = (AliVParticle*) particleList->At(0); | |
540 | if (!leading) | |
541 | return; | |
542 | ||
543 | // remove particles depending on tracking efficiency | |
544 | Int_t count = (twoStep) ? 2 : 1; | |
545 | ||
546 | for (Int_t i=0; i<count; i++) | |
547 | { | |
548 | Float_t trackingEff = fTrackingEfficiency->GetBinContent(fTrackingEfficiency->GetXaxis()->FindBin(leading->Pt())); | |
549 | if (twoStep) | |
550 | trackingEff = 0.5 * (trackingEff + 1); | |
551 | ||
552 | if (gRandom->Uniform() > trackingEff) | |
553 | { | |
554 | //Printf("LOWEFF: Removing leading particle"); | |
555 | particleList->RemoveAt(0); | |
556 | particleList->Compress(); | |
557 | } | |
558 | ||
559 | if (particleList->GetEntries() == 0) | |
560 | { | |
561 | delete particleList; | |
562 | return; | |
563 | } | |
564 | ||
565 | leading = (AliVParticle*) particleList->At(0); | |
566 | } | |
567 | ||
568 | TObjArray *regionSortedParticlesRECOLowEff = fAnalyseUE->SortRegions(leading, particleList, 0); | |
569 | TObjArray *regionsMinMaxRECOLowEff = fAnalyseUE->GetMinMaxRegion((TList*)regionSortedParticlesRECOLowEff->At(2), (TList*)regionSortedParticlesRECOLowEff->At(3)); | |
570 | ||
571 | fHistosUE->Fill(eventId,step,leading,(TList*)regionSortedParticlesRECOLowEff->At(0), (TList*)regionSortedParticlesRECOLowEff->At(1), (TList*)regionsMinMaxRECOLowEff->At(0), (TList*)regionsMinMaxRECOLowEff->At(1)); | |
572 | ||
573 | delete regionSortedParticlesRECOLowEff; | |
574 | delete regionsMinMaxRECOLowEff; | |
575 | delete particleList; | |
576 | } | |
577 | ||
578 | //____________________________________________________________________ | |
579 | void AliAnalysisTaskLeadingTrackUE::Initialize() | |
580 | { | |
581 | // input handler | |
582 | fInputHandler = (AliInputEventHandler*) | |
583 | ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler()); | |
584 | // MC handler | |
585 | fMcHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); | |
586 | } | |
587 | ||
588 | ||
589 | ||
590 | ||
591 | ||
592 |