]>
Commit | Line | Data |
---|---|---|
b2a297fa | 1 | /************************************************************************* |
2 | * Copyright(c) 1998-2009, 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 | //##################################################### | |
17 | //# # | |
18 | //# Simple efficiency study for dielectrons # | |
19 | //# Author: Jens Wiechula Jens.Wiechula@cern.ch # | |
20 | //# # | |
21 | //##################################################### | |
22 | ||
23 | #include <TParticle.h> | |
24 | #include <TParticlePDG.h> | |
25 | #include <TDatabasePDG.h> | |
26 | #include <TROOT.h> | |
27 | #include "TChain.h" | |
28 | #include <TCanvas.h> | |
29 | // #include "TTree.h" | |
30 | #include <TH1.h> | |
31 | #include <TH2F.h> | |
32 | #include <THashList.h> | |
33 | ||
34 | #include "AliAnalysisManager.h" | |
35 | ||
36 | #include "AliESDInputHandler.h" | |
37 | #include "AliMCEventHandler.h" | |
38 | #include "AliMCEvent.h" | |
39 | #include "AliVEvent.h" | |
40 | #include "AliESDEvent.h" | |
41 | #include "AliESDtrack.h" | |
42 | #include "AliStack.h" | |
43 | #include "AliKFParticle.h" | |
44 | #include "AliESDtrackCuts.h" | |
45 | #include "AliKineTrackCuts.h" | |
46 | #include "AliLog.h" | |
47 | ||
48 | #include "AliDielectronHistos.h" | |
49 | #include "AliAnalysisTaskDielectronEfficiency.h" | |
50 | ||
51 | ClassImp(AliAnalysisTaskDielectronEfficiency) | |
52 | ||
53 | ||
54 | //================================================================================= | |
55 | AliAnalysisTaskDielectronEfficiency::AliAnalysisTaskDielectronEfficiency() : | |
56 | AliAnalysisTask(), | |
57 | fInputEvent(0), | |
58 | fHist(0), | |
59 | fESDtrackCuts(0), | |
60 | fKineCutsLegs(0), | |
61 | fKineCutsMother(0), | |
62 | fIdMCMother(443), | |
63 | fIdMCDaughterP(-11), | |
64 | fIdMCDaughterN(11), | |
65 | fPDG(TDatabasePDG::Instance()) | |
66 | { | |
67 | } | |
68 | ||
69 | //================================================================================= | |
70 | AliAnalysisTaskDielectronEfficiency::AliAnalysisTaskDielectronEfficiency(const char *name) : | |
71 | AliAnalysisTask(name,name), | |
72 | fInputEvent(0), | |
73 | fHist(0), | |
74 | fESDtrackCuts(new AliESDtrackCuts), | |
75 | fKineCutsLegs(new AliKineTrackCuts), | |
76 | fKineCutsMother(new AliKineTrackCuts), | |
77 | fIdMCMother(443), | |
78 | fIdMCDaughterP(-11), | |
79 | fIdMCDaughterN(11), | |
80 | fPDG(TDatabasePDG::Instance()) | |
81 | { | |
82 | // | |
83 | // named constructor. This is the one that should be used by the user, oterwise the | |
84 | // essential objects are not created! | |
85 | // | |
86 | DefineInput(0,TChain::Class()); | |
87 | DefineOutput(0, THashList::Class()); | |
88 | } | |
89 | ||
90 | //================================================================================= | |
91 | AliAnalysisTaskDielectronEfficiency::~AliAnalysisTaskDielectronEfficiency() | |
92 | { | |
93 | // | |
94 | // dtor | |
95 | // | |
96 | if (fESDtrackCuts) delete fESDtrackCuts; | |
97 | if (fKineCutsLegs) delete fKineCutsLegs; | |
98 | if (fKineCutsMother) delete fKineCutsMother; | |
99 | } | |
100 | //================================================================================= | |
101 | void AliAnalysisTaskDielectronEfficiency::CreateOutputObjects() { | |
102 | // | |
103 | // Create histograms | |
104 | // Called once | |
105 | // | |
106 | ||
107 | //------------------- | |
108 | // MC truth produced | |
109 | fHist=new AliDielectronHistos; | |
110 | fHist->AddClass("MC;MCcut;DataSameMother;Event;DataCuts;DataTRDCuts"); | |
111 | ||
112 | fHist->UserHistogram("MC", "JpsiMCPt" ,"MC Jpsi;Pt [GeV]" ,100,0,10); | |
113 | fHist->UserHistogram("MC", "mass" ,"MC Jpsi; Inv.Mass [GeV]" ,100,0,4); | |
114 | fHist->UserHistogram("MC", "e+Pt" ,"MC e+ from JPsi;Pt [GeV]" ,100,0,10); | |
115 | fHist->UserHistogram("MC", "e-Pt" ,"MC e- from JPsi;Pt [GeV]" ,100,0,10); | |
116 | fHist->UserHistogram("MC", "dndyPt" ,"MC Jpsi procution; Rapidity;Pt",100,-4,4,100,0,10); | |
117 | fHist->UserHistogram("MC","dndy" ,"MC dNdy Jpsi;Rapidity;Entries/event" ,100,-4,4); | |
118 | fHist->GetHistogram("MC","dndy")->Sumw2(); | |
119 | ||
120 | //------------------- | |
121 | //MC truth after cuts | |
122 | fHist->UserHistogram("MCcut", "JpsiMCPt" ,"MC Jpsi;Pt [GeV]" ,100,0,10); | |
123 | fHist->UserHistogram("MCcut", "mass" ,"MC Jpsi; Inv.Mass [GeV]" ,100,0,4); | |
124 | fHist->UserHistogram("MCcut", "e+Pt" ,"MC e+ from JPsi;Pt [GeV]" ,100,0,10); | |
125 | fHist->UserHistogram("MCcut", "e-Pt" ,"MC e- from JPsi;Pt [GeV]" ,100,0,10); | |
126 | fHist->UserHistogram("MCcut", "dndyPt" ,"MC Jpsi procution; Rapidity;Pt",100,-4,4,100,0,10); | |
127 | fHist->UserHistogram("MCcut","dndy" ,"MC dNdy Jpsi;Rapidity;Entries/event" ,100,-4,4); | |
128 | fHist->GetHistogram("MCcut","dndy")->Sumw2(); | |
129 | ||
130 | //----------------- | |
131 | //reconstructed data with cuts on MC truth | |
132 | fHist->UserHistogram("DataSameMother","JpsiMCPt","Rec Jpsi; MC Pt [GeV]", 100,0,10); | |
133 | fHist->UserHistogram("DataSameMother","dndyPtMC" ,"Rec Jpsi procution; Rapidity;Pt",100,-4,4,100,0,10); | |
134 | fHist->UserHistogram("DataSameMother", "e+Pt" ,"Rec e+ from JPsi;MC Pt [GeV]" ,100,0,10); | |
135 | fHist->UserHistogram("DataSameMother", "e-Pt" ,"Rec e- from JPsi;MC Pt [GeV]" ,100,0,10); | |
136 | fHist->UserHistogram("DataSameMother","dndy" ,"Rec Jpsi;Rapidity;Entries/event" ,100,-4,4); | |
137 | fHist->GetHistogram("DataSameMother","dndy")->Sumw2(); | |
138 | ||
139 | fHist->UserHistogram("DataSameMother","mass" ,"Rec Jpsi (KF); Inv.Mass [GeV]" ,100,0,4); | |
140 | fHist->UserHistogram("DataSameMother","JpsiPt" ,"Rec Jpsi (KF); Pt [GeV]" ,100,0,10); | |
141 | fHist->UserHistogram("DataSameMother","Chi2" ,"Rec Jpsi (KF); #Chi^{2}" ,100,0,50); | |
142 | fHist->UserHistogram("DataSameMother","dndyPt" ,"Rec Jpsi procution (KF); Rapidity;Pt",100,-4,4,100,0,10); | |
143 | //------------------ | |
144 | // reconstructed data after ESD track cuts and cuts on MC truth | |
145 | //------------------ | |
146 | fHist->UserHistogram("DataCuts","JpsiMCPt","Rec Jpsi; MC Pt [GeV]", 100,0,10); | |
147 | fHist->UserHistogram("DataCuts","dndyPtMC" ,"Rec Jpsi procution; Rapidity;Pt",100,-4,4,100,0,10); | |
148 | fHist->UserHistogram("DataCuts", "e+Pt" ,"Rec e+ from JPsi;MC Pt [GeV]" ,100,0,10); | |
149 | fHist->UserHistogram("DataCuts", "e-Pt" ,"Rec e- from JPsi;MC Pt [GeV]" ,100,0,10); | |
150 | fHist->UserHistogram("DataCuts","dndy" ,"Rec Jpsi;Rapidity;Entries/event" ,100,-4,4); | |
151 | fHist->GetHistogram("DataCuts","dndy")->Sumw2(); | |
152 | ||
153 | fHist->UserHistogram("DataCuts","mass" ,"Rec Jpsi (KF); Inv.Mass [GeV]" ,100,0,4); | |
154 | fHist->UserHistogram("DataCuts","JpsiPt" ,"Rec Jpsi (KF); Pt [GeV]" ,100,0,10); | |
155 | fHist->UserHistogram("DataCuts","Chi2" ,"Rec Jpsi (KF); #Chi^{2}" ,100,0,50); | |
156 | fHist->UserHistogram("DataCuts","dndyPt" ,"Rec Jpsi procution (KF); Rapidity;Pt",100,-4,4,100,0,10); | |
157 | //------------------ | |
158 | // after ESD track cuts + TRD cuts + MC cuts | |
159 | //------------------ | |
160 | fHist->UserHistogram("DataTRDCuts","JpsiMCPt","Rec Jpsi; MC Pt [GeV]", 100,0,10); | |
161 | fHist->UserHistogram("DataTRDCuts","dndyPtMC" ,"Rec Jpsi procution; Rapidity;Pt",100,-4,4,100,0,10); | |
162 | fHist->UserHistogram("DataTRDCuts", "e+Pt" ,"Rec e+ from JPsi;MC Pt [GeV]" ,100,0,10); | |
163 | fHist->UserHistogram("DataTRDCuts", "e-Pt" ,"Rec e- from JPsi;MC Pt [GeV]" ,100,0,10); | |
164 | fHist->UserHistogram("DataTRDCuts","dndy" ,"Rec Jpsi;Rapidity;Entries/event" ,100,-4,4); | |
165 | fHist->GetHistogram("DataTRDCuts","dndy")->Sumw2(); | |
166 | ||
167 | fHist->UserHistogram("DataTRDCuts","mass" ,"Rec Jpsi (KF); Inv.Mass [GeV]" ,100,0,4); | |
168 | fHist->UserHistogram("DataTRDCuts","JpsiPt" ,"Rec Jpsi (KF); Pt [GeV]" ,100,0,10); | |
169 | fHist->UserHistogram("DataTRDCuts","Chi2" ,"Rec Jpsi (KF); #Chi^{2}" ,100,0,50); | |
170 | fHist->UserHistogram("DataTRDCuts","dndyPt" ,"Rec Jpsi procution (KF); Rapidity;Pt",100,-4,4,100,0,10); | |
171 | ||
172 | //----------------- | |
173 | //Event information | |
174 | //----------------- | |
175 | fHist->UserHistogram("Event","NEvents","Number of events",1,0,1); | |
176 | ||
177 | } | |
178 | ||
179 | // //____________________________________________________________ | |
180 | void AliAnalysisTaskDielectronEfficiency::ConnectInputData(Option_t *) { | |
181 | // | |
182 | // connect the input data | |
183 | // | |
184 | fInputEvent=0; | |
185 | TTree* tree=dynamic_cast<TTree*>(GetInputData(0)); | |
186 | if (!tree) { | |
187 | printf("ERROR: Could not read chain from input slot 0\n"); | |
188 | } else { | |
189 | AliInputEventHandler *eventH = dynamic_cast<AliInputEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); | |
190 | if (!eventH) { | |
191 | AliError("Could not get ESDInputHandler"); | |
192 | } else { | |
193 | fInputEvent = eventH->GetEvent(); | |
194 | AliInfo("*** CONNECTED NEW EVENT ****"); | |
195 | } | |
196 | } | |
197 | } | |
198 | ||
199 | //================================================================================= | |
200 | void AliAnalysisTaskDielectronEfficiency::Exec(Option_t *) { | |
201 | // | |
202 | // Main loop. Called for every event | |
203 | // Process the event in FillPlots and post the data afterwards | |
204 | // | |
205 | if (!fInputEvent) { | |
206 | Printf("ERROR: Could not get input event\n"); | |
207 | return; | |
208 | } | |
209 | ||
210 | FillPlots(fInputEvent); | |
211 | ||
212 | PostData(0, const_cast<THashList*>(fHist->GetHistogramList())); | |
213 | } | |
214 | ||
215 | ||
216 | //==================================================================================== | |
217 | void AliAnalysisTaskDielectronEfficiency::FillPlots(AliVEvent *event) | |
218 | { | |
219 | // | |
220 | // Fill histograms | |
221 | // | |
222 | AliESDEvent *esd=dynamic_cast<AliESDEvent*>(event); | |
45b2b1b8 | 223 | if (!esd) return; |
b2a297fa | 224 | Int_t ntrack=esd->GetNumberOfTracks(); |
225 | ||
226 | // Fetch Stack | |
227 | AliMCEventHandler *mcH = (AliMCEventHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler()); | |
228 | if(!mcH) { | |
13242232 | 229 | AliError("No MC handler found\n"); |
b2a297fa | 230 | return; |
231 | } | |
232 | ||
233 | AliMCEvent *mcev=mcH->MCEvent(); | |
234 | if (!mcev){ | |
13242232 | 235 | AliError("No MC event found\n"); |
b2a297fa | 236 | return; |
237 | } | |
238 | AliStack* pStack = mcev->Stack(); | |
239 | ||
240 | if (!pStack) return; | |
241 | ||
242 | //fill event info | |
243 | fHist->Fill("Event","NEvents",0); | |
244 | ||
245 | //fill MC histograms | |
246 | FillMCInfo(pStack); | |
247 | ||
248 | // | |
249 | Float_t massMother=0; | |
250 | if (fIdMCMother>-1) fPDG->GetParticle(fIdMCMother)->Mass(); | |
251 | ||
252 | TLorentzVector v; | |
253 | //loop over all tracks | |
254 | for (Int_t itrack=0; itrack<ntrack; ++itrack){ | |
255 | //negative particles only in this loop | |
256 | AliESDtrack *trackN=esd->GetTrack(itrack); | |
257 | if (trackN->Charge()!=-1) continue; | |
258 | ||
259 | //MC truth | |
260 | Int_t labelN=TMath::Abs(trackN->GetLabel()); | |
261 | if (labelN<0) continue; | |
262 | TParticle *pN=pStack->Particle(labelN); | |
263 | Int_t pdgN=pN->GetPdgCode(); | |
264 | ||
265 | //MC mother | |
266 | Int_t idMotherN=pN->GetFirstMother(); | |
267 | TParticle *motherN=0; | |
268 | Int_t pdgMotherN=-1; | |
269 | if (fIdMCMother>-1&&idMotherN>-1){ | |
270 | motherN=pStack->Particle(idMotherN); | |
271 | pdgMotherN=motherN->GetPdgCode(); | |
272 | } | |
273 | ||
274 | for (Int_t itrack2=0; itrack2<ntrack; ++itrack2){ | |
275 | //positive particles only in this loop | |
276 | AliESDtrack *trackP=esd->GetTrack(itrack2); | |
277 | if (trackP->Charge()!=1) continue; | |
278 | ||
279 | //MC truth | |
280 | Int_t labelP=TMath::Abs(trackP->GetLabel()); | |
281 | if (labelP<0) continue; | |
282 | TParticle *pP=pStack->Particle(labelP); | |
283 | // Int_t pdgP=pP->GetPdgCode(); | |
284 | ||
285 | //MC mother | |
286 | Int_t idMotherP=pP->GetFirstMother(); | |
45b2b1b8 | 287 | // TParticle *motherP=0; |
b2a297fa | 288 | // Int_t pdgMotherP=0; |
289 | if (idMotherP>-1){ | |
45b2b1b8 | 290 | // motherP=pStack->Particle(idMotherP); |
b2a297fa | 291 | // pdgMotherP=motherP->GetPdgCode(); |
292 | } | |
293 | //=============== | |
294 | //Fill histograms | |
295 | //=============== | |
296 | Bool_t motherOK=kFALSE; | |
297 | if (fIdMCMother==-1) motherOK=kTRUE; | |
298 | else if (pdgMotherN==fIdMCMother) motherOK=kTRUE; | |
299 | ||
300 | if (pdgN==fIdMCDaughterN && motherOK){ //electron and mother is fIdMCMother | |
301 | AliKFParticle electron(*trackN,11); | |
302 | AliKFParticle positron(*trackP,-11); | |
303 | AliKFParticle jpsi(electron); | |
304 | jpsi+=positron; | |
305 | ||
306 | Bool_t sameMother=kFALSE; | |
307 | Bool_t motherCutOK=kFALSE; | |
308 | ||
309 | if (fIdMCMother==-1) { | |
310 | //accept as same mother if we don't requite | |
311 | sameMother=kTRUE; | |
312 | motherCutOK=kTRUE; | |
313 | } | |
314 | else | |
315 | { | |
316 | if (idMotherN==idMotherP) sameMother=kTRUE; | |
317 | if (fKineCutsMother->IsSelected(motherN)) motherCutOK=kTRUE; | |
318 | } | |
319 | ||
320 | if ( sameMother && // same mother | |
321 | motherCutOK && //cuts mother MC truth | |
322 | fKineCutsLegs->IsSelected(pN) && fKineCutsLegs->IsSelected(pP)){ //cuts legs MC truth | |
323 | ||
324 | //MC only data | |
325 | if (motherN){ | |
326 | fHist->Fill("DataSameMother","JpsiMCPt",motherN->Pt()); | |
327 | fHist->Fill("DataSameMother","e+Pt",pP->Pt()); | |
328 | fHist->Fill("DataSameMother","e-Pt",pN->Pt()); | |
329 | v.SetPxPyPzE(motherN->Px(),motherN->Py(),motherN->Pz(),motherN->Energy()); | |
330 | fHist->Fill("DataSameMother","dndy",v.Rapidity()); | |
331 | fHist->Fill("DataSameMother","dndyPtMC",v.Rapidity(),motherN->Pt()); | |
332 | } | |
333 | ||
334 | //reconstructed data | |
335 | v.SetPtEtaPhiM(jpsi.GetPt(),jpsi.GetEta(),jpsi.GetPhi(),massMother); | |
336 | // printf("Jpsi: %f,%f,%f,%f\n",jpsi.GetPt(),jpsi.GetEta(),jpsi.GetPhi(),massMother); | |
337 | fHist->Fill("DataSameMother","JpsiPt",jpsi.GetPt()); | |
338 | fHist->Fill("DataSameMother","Chi2",jpsi.GetChi2()/jpsi.GetNDF()); | |
339 | fHist->Fill("DataSameMother","mass",jpsi.GetMass()); | |
340 | fHist->Fill("DataSameMother","dndyPt",v.Rapidity(),jpsi.GetPt()); | |
341 | ||
342 | //histograms after ESD cuts | |
343 | if (fESDtrackCuts->IsSelected(trackN)&&fESDtrackCuts->IsSelected(trackP)){ | |
344 | //MC only | |
345 | if (motherN) { | |
346 | fHist->Fill("DataCuts","JpsiMCPt",motherN->Pt()); | |
347 | fHist->Fill("DataCuts","e+Pt",pP->Pt()); | |
348 | fHist->Fill("DataCuts","e-Pt",pN->Pt()); | |
349 | v.SetPxPyPzE(motherN->Px(),motherN->Py(),motherN->Pz(),motherN->Energy()); | |
350 | fHist->Fill("DataCuts","dndy",v.Rapidity()); | |
351 | fHist->Fill("DataCuts","dndyPtMC",motherN->Eta(),motherN->Pt()); | |
352 | } | |
353 | ||
354 | //reconstructed data | |
355 | v.SetPtEtaPhiM(jpsi.GetPt(),jpsi.GetEta(),jpsi.GetPhi(),massMother); | |
356 | fHist->Fill("DataCuts","JpsiPt",jpsi.GetPt()); | |
357 | fHist->Fill("DataCuts","Chi2",jpsi.GetChi2()/jpsi.GetNDF()); | |
358 | fHist->Fill("DataCuts","mass",jpsi.GetMass()); | |
359 | fHist->Fill("DataCuts","dndyPt",v.Rapidity(),jpsi.GetPt()); | |
360 | ||
361 | //Additional TRD cuts | |
37e9382d | 362 | if ( ((trackN->GetStatus()&AliESDtrack::kTRDrefit)!=0) && trackN->GetTRDntrackletsPID()>4 ){ |
363 | if ( ((trackP->GetStatus()&AliESDtrack::kTRDrefit)!=0) && trackP->GetTRDntrackletsPID()>4 ){ | |
b2a297fa | 364 | if (motherN){ |
365 | fHist->Fill("DataTRDCuts","JpsiMCPt",motherN->Pt()); | |
366 | fHist->Fill("DataTRDCuts","e+Pt",pP->Pt()); | |
367 | fHist->Fill("DataTRDCuts","e-Pt",pN->Pt()); | |
368 | v.SetPxPyPzE(motherN->Px(),motherN->Py(),motherN->Pz(),motherN->Energy()); | |
369 | fHist->Fill("DataTRDCuts","dndy",v.Rapidity()); | |
370 | fHist->Fill("DataTRDCuts","dndyPtMC",v.Rapidity(),motherN->Pt()); | |
371 | } | |
372 | ||
373 | //reconstructed data | |
374 | v.SetPtEtaPhiM(jpsi.GetPt(),jpsi.GetEta(),jpsi.GetPhi(),massMother); | |
375 | fHist->Fill("DataTRDCuts","JpsiPt",jpsi.GetPt()); | |
376 | fHist->Fill("DataTRDCuts","Chi2",jpsi.GetChi2()/jpsi.GetNDF()); | |
377 | fHist->Fill("DataTRDCuts","mass",jpsi.GetMass()); | |
378 | fHist->Fill("DataTRDCuts","dndyPt",v.Rapidity(),jpsi.GetPt()); | |
379 | } | |
380 | } | |
381 | } | |
382 | } | |
383 | } | |
384 | } | |
385 | } | |
386 | } | |
387 | ||
388 | //____________________________________________________________ | |
389 | // Int_t AliAnalysisTaskDielectronEfficiency::Merge(TList *list) | |
390 | // { | |
391 | // // | |
392 | // // Merge function | |
393 | // // | |
394 | // if (!list) return 0; | |
395 | // if (list->IsEmpty()) return 1; | |
396 | // | |
397 | // TIter next(list); | |
398 | // while ( (TObject *o=next()) ){ | |
399 | // AliAnalysisTaskDielectronEfficiency *task=dynamic_cast<AliAnalysisTaskDielectronEfficiency*>o; | |
400 | // if (!o) continue; | |
401 | // fNev+=task->fNev; | |
402 | // } | |
403 | // } | |
404 | ||
405 | ||
e123f993 | 406 | void AliAnalysisTaskDielectronEfficiency::FillMCInfo(AliStack * const pStack) |
b2a297fa | 407 | { |
408 | // | |
409 | // fill pure MC histograms | |
410 | // | |
411 | ||
412 | TLorentzVector v; | |
413 | //Fill MC info | |
37e9382d | 414 | for (Int_t ipart=0; ipart<pStack->GetNtrack(); ++ipart){ |
415 | TParticle *part=pStack->Particle(ipart); | |
b2a297fa | 416 | // printf("Particle %d\n",part->GetPdgCode()); |
417 | if (part->GetPdgCode()!=fIdMCMother || part->GetNDaughters()!=2) continue; | |
418 | TParticle *d1=pStack->Particle(part->GetFirstDaughter()); | |
419 | TParticle *d2=pStack->Particle(part->GetLastDaughter()); | |
420 | TParticle *dP=0; | |
421 | TParticle *dN=0; | |
422 | if (fPDG->GetParticle(d1->GetPdgCode())->Charge()>0){ | |
423 | dP=d1; | |
424 | dN=d2; | |
425 | }else{ | |
426 | dP=d2; | |
427 | dN=d1; | |
428 | } | |
429 | if ( dP->GetPdgCode()!=fIdMCDaughterP || dN->GetPdgCode()!=fIdMCDaughterN ) continue; | |
430 | v.SetPxPyPzE(part->Px(),part->Py(),part->Pz(),part->Energy()); | |
431 | fHist->Fill("MC","JpsiMCPt",part->Pt()); | |
432 | fHist->Fill("MC","dndy",v.Rapidity()); | |
433 | fHist->Fill("MC","dndyPt",v.Rapidity(),part->Pt()); | |
434 | fHist->Fill("MC","e-Pt",dN->Pt()); | |
435 | fHist->Fill("MC","e+Pt",dP->Pt()); | |
436 | //e+ e- inv mass | |
437 | TLorentzVector vE; | |
438 | vE.SetPxPyPzE(dN->Px(),dN->Py(),dN->Pz(),dN->Energy()); | |
439 | TLorentzVector vP; | |
440 | vP.SetPxPyPzE(dP->Px(),dP->Py(),dP->Pz(),dP->Energy()); | |
441 | fHist->Fill("MC","mass",(vE+vP).M()); | |
442 | ||
443 | ||
444 | //cuts | |
445 | if (!fKineCutsMother->IsSelected(part)) continue; | |
446 | if (!fKineCutsLegs->IsSelected(d1) || !fKineCutsLegs->IsSelected(d2) ) continue; | |
447 | ||
448 | v.SetPxPyPzE(part->Px(),part->Py(),part->Pz(),part->Energy()); | |
449 | fHist->Fill("MCcut","JpsiMCPt",part->Pt()); | |
450 | fHist->Fill("MCcut","dndy",v.Rapidity()); | |
451 | fHist->Fill("MCcut","dndyPt",v.Rapidity(),part->Pt()); | |
452 | fHist->Fill("MCcut","e-Pt",dN->Pt()); | |
453 | fHist->Fill("MCcut","e+Pt",dP->Pt()); | |
454 | } | |
455 | } | |
456 | void AliAnalysisTaskDielectronEfficiency::SetupDefaultCuts(Int_t type) | |
457 | { | |
458 | // | |
459 | // setup standard ESD track cuts | |
460 | // | |
461 | ||
462 | if (type==0){ | |
463 | //ESD cuts | |
464 | fESDtrackCuts->SetMaxDCAToVertexZ(3.0); | |
465 | fESDtrackCuts->SetMaxDCAToVertexXY(3.0); | |
466 | fESDtrackCuts->SetRequireTPCRefit(kTRUE); | |
467 | fESDtrackCuts->SetRequireITSRefit(kTRUE); | |
468 | fESDtrackCuts->SetAcceptKinkDaughters(kFALSE); | |
469 | fESDtrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny); | |
470 | ||
471 | fESDtrackCuts->SetMinNClustersTPC(50); | |
472 | fESDtrackCuts->SetMaxChi2PerClusterTPC(4); | |
473 | ||
474 | //MC cuts | |
475 | fKineCutsLegs->SetEtaRange(-0.9,0.9); | |
476 | fKineCutsMother->SetRapRange(-0.9,0.9); | |
477 | } else if (type==1) { | |
478 | // fESDtrackCuts->SetMaxCovDiagonalElements(2, 2, .5, .5, 2); | |
479 | fESDtrackCuts->SetMaxDCAToVertexZ(3.0); | |
480 | fESDtrackCuts->SetMaxDCAToVertexXY(3.0); | |
481 | fESDtrackCuts->SetRequireTPCRefit(kTRUE); | |
482 | fESDtrackCuts->SetRequireITSRefit(kTRUE); | |
483 | fESDtrackCuts->SetAcceptKinkDaughters(kFALSE); | |
484 | fESDtrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny); | |
485 | ||
486 | fESDtrackCuts->SetMinNClustersTPC(50); | |
487 | fESDtrackCuts->SetMaxChi2PerClusterTPC(4); | |
488 | ||
489 | //MC cuts | |
490 | // fKineCutsLegs->SetEtaRange(-0.9,0.9); | |
491 | // fKineCutsMother->SetRapRange(-0.9,0.9); | |
492 | ||
493 | } | |
494 | } | |
495 | ||
496 | //=================================================================================== | |
497 | void AliAnalysisTaskDielectronEfficiency::Terminate(Option_t *) { | |
498 | // | |
499 | // Called once at the end of the query | |
500 | // | |
501 | ||
502 | ||
503 | AliDielectronHistos *hist=new AliDielectronHistos; | |
504 | hist->SetHistogramList(*(THashList*)GetOutputData(0)); | |
505 | ||
506 | if (hist->GetHistogram("Event","NEvents")){ | |
507 | //get number of events | |
508 | Double_t nev=hist->GetHistogram("Event","NEvents")->GetBinContent(1); | |
509 | // | |
510 | //normalise dndy histograms | |
511 | // | |
512 | hist->GetHistogram("DataSameMother","dndy")->Scale(1./nev); | |
513 | hist->GetHistogram("MC","dndy")->Scale(1./nev); | |
514 | hist->GetHistogram("DataCuts","dndy")->Scale(1./nev); | |
515 | hist->GetHistogram("DataTRDCuts","dndy")->Scale(1./nev); | |
516 | ||
517 | // | |
518 | // create the efficiency histograms | |
519 | // | |
520 | // hEffTracking/2D only tracking effects, no esd cuts | |
521 | // hEffESDCuts tracking plus ESD cuts | |
522 | // hEffTRDCuts tracking plus ESD plus TRD cuts | |
523 | // | |
524 | TH1F *hEffTracking=(TH1F*)hist->GetHistogram("DataSameMother","JpsiMCPt")->Clone("Efficiency"); | |
525 | hEffTracking->Divide(hist->GetHistogram("MCcut","JpsiMCPt")); | |
526 | hEffTracking->SetTitle("Efficiencies"); | |
527 | hist->UserHistogram("DataSameMother",hEffTracking); | |
528 | ||
529 | TH1F *hEffESDCuts=(TH1F*)hist->GetHistogram("DataCuts","JpsiMCPt")->Clone("Efficiency"); | |
530 | hEffESDCuts->Divide(hist->GetHistogram("MCcut","JpsiMCPt")); | |
531 | hEffTracking->SetTitle("Efficiencies"); | |
532 | hist->UserHistogram("DataCuts",hEffESDCuts); | |
533 | ||
534 | TH1F *hEffTRDCuts=(TH1F*)hist->GetHistogram("DataTRDCuts","JpsiMCPt")->Clone("Efficiency"); | |
535 | hEffTRDCuts->Divide(hist->GetHistogram("MCcut","JpsiMCPt")); | |
536 | hEffTRDCuts->SetTitle("Efficiencies"); | |
537 | hist->UserHistogram("DataTRDCuts",hEffTRDCuts); | |
538 | ||
539 | hist->DrawSame("Efficiency"); | |
540 | ||
541 | //2D efficiencies | |
542 | TH2F *hEffTracking2D=(TH2F*)hist->GetHistogram("DataSameMother","dndyPtMC")->Clone("2DEfficiency"); | |
543 | hEffTracking2D->Divide(hist->GetHistogram("MCcut","dndyPt")); | |
544 | hEffTracking2D->SetTitle("2D Efficiency - tracking"); | |
545 | hist->UserHistogram("DataSameMother",hEffTracking2D); | |
546 | ||
547 | TH2F *hEffESDCuts2D=(TH2F*)hist->GetHistogram("DataCuts","dndyPtMC")->Clone("2DEfficiency"); | |
548 | hEffESDCuts2D->Divide(hist->GetHistogram("MCcut","dndyPt")); | |
549 | hEffESDCuts2D->SetTitle("2D Efficiency - quality cuts"); | |
550 | hist->UserHistogram("DataCuts",hEffESDCuts2D); | |
551 | ||
552 | TH2F *hEffTRDCuts2D=(TH2F*)hist->GetHistogram("DataTRDCuts","dndyPtMC")->Clone("2DEfficiency"); | |
553 | hEffTRDCuts2D->Divide(hist->GetHistogram("MCcut","dndyPt")); | |
554 | hEffTRDCuts2D->SetTitle("2D Efficiency - quality+TRD cuts"); | |
555 | hist->UserHistogram("DataTRDCuts",hEffTRDCuts2D); | |
556 | ||
557 | // | |
558 | // Draw all histograms of all histogram classes | |
559 | // Use the Draw functionality of AliDielectronHistos | |
560 | // | |
561 | hist->Draw(); | |
562 | ||
563 | // | |
564 | // Draw all histograms with the same name of all classes into one canvas | |
565 | // Use the Draw functionality of AliDielectronHistos | |
566 | // | |
567 | hist->DrawSame("JpsiMCPt"); | |
568 | } | |
569 | ||
570 | PostData(0, const_cast<THashList*>(hist->GetHistogramList())); | |
571 | } | |
572 |