]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/hfe/AliHFEV0pidMC.cxx
Fix in pt weighting
[u/mrichter/AliRoot.git] / PWG3 / hfe / AliHFEV0pidMC.cxx
CommitLineData
70da6c5a 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// class to benchmark the V0 pid capabilties
17// runs over reconstructed V0 candidates and uses MC information for
18// further analysis [purity, PID perfortmance]
19//
20// authors:
21// Matus Kalisky <matus.kalisky@cern.ch>
22//
23
24#include "TIterator.h"
25
70da6c5a 26#include "AliVParticle.h"
27#include "AliESDtrack.h"
28#include "AliMCParticle.h"
faee3b18 29#include "AliMCEvent.h"
30
31#include "AliHFEcollection.h"
70da6c5a 32
33#include "AliHFEV0pidMC.h"
34ClassImp(AliHFEV0pidMC)
35
36//____________________________________________________________
37 AliHFEV0pidMC::AliHFEV0pidMC():
38 fMC(0x0)
faee3b18 39 , fColl(NULL)
40 , fV0cuts(NULL)
70da6c5a 41{
42 //
43 // default constructor
44 //
faee3b18 45
70da6c5a 46}
47//____________________________________________________________
48AliHFEV0pidMC::~AliHFEV0pidMC(){
49 //
50 // destructor
51 //
faee3b18 52 if (fColl) delete fColl;
53 //if (fV0cuts) delete fV0cuts;
70da6c5a 54}
55//____________________________________________________________
56void AliHFEV0pidMC::Init(){
57 //
58 // initialize objects
59 //
faee3b18 60
70da6c5a 61 fColl = new AliHFEcollection("V0pidMC", "MC based V0 benchmarking");
62 // QA
63 fColl->CreateTH1F("h_QA_nParticles", "QA on track processing", 10, -0.5, 9.5);
64
3a72645a 65 const Int_t nBins = 20;
66 const Float_t pMin = 0.1;
67 const Float_t pMax = 10.;
68
70da6c5a 69 // before PID
3a72645a 70 fColl->CreateTH1F("h_Electron", "all electron candidates (no MC); p (GeV/c); counts", nBins, pMin, pMax, 0);
71 fColl->CreateTH1F("h_PionK0", "all K0 pion candidates (no MC); p (GeV/c); counts", nBins, pMin, pMax, 0);
72 fColl->CreateTH1F("h_PionL", "all Lambda pion candidates (no MC); p (GeV/c); counts", nBins, pMin, pMax, 0);
73 fColl->CreateTH1F("h_Kaon", "all Kaon candidates (no MC); p (GeV/c); counts", nBins, pMin, pMax, 0);
74 fColl->CreateTH1F("h_Proton", "all Lambda proton candidates (no MC); p (GeV/c); counts", nBins, pMin, pMax, 0);
70da6c5a 75
3a72645a 76 fColl->CreateTH1F("h_mis_Electron", "all NON electron candidates MC tagged; p (GeV/c); counts", nBins, pMin, pMax, 0);
77 fColl->CreateTH1F("h_mis_PionK0", "all NON K0 pion candidates MC tagged; p (GeV/c); counts", nBins, pMin, pMax, 0);
78 fColl->CreateTH1F("h_mis_PionL", "all NON Lambda pion candidates MC tagged ; p (GeV/c); counts", nBins, pMin, pMax, 0);
79 fColl->CreateTH1F("h_mis_Kaon", "all NON Kaon candidates MC tagged; p (GeV/c); counts", nBins, pMin, pMax, 0);
80 fColl->CreateTH1F("h_mis_Proton", "all NON Lambda proton candidates MC tagged; p (GeV/c); counts", nBins, pMin, pMax, 0);
70da6c5a 81
3a72645a 82 fColl->CreateTH1Fvector1(5, "h_tag_Electron", "electron candidate MC tagged; p (GeV/c); counts", nBins, pMin, pMax, 0);
83 fColl->CreateTH1Fvector1(5, "h_tag_PionK0", "K0 pion candidate MC tagged; p (GeV/c); counts", nBins, pMin, pMax, 0);
84 fColl->CreateTH1Fvector1(5, "h_tag_PionL", "Lambda pion candidate MC tagged; p (GeV/c); counts", nBins, pMin, pMax, 0);
85 fColl->CreateTH1Fvector1(5, "h_tag_Kaon", "kaon candidate MC tagged; p (GeV/c); counts", nBins, pMin, pMax, 0);
86 fColl->CreateTH1Fvector1(5, "h_tag_Proton", "Lambda proton candidate MC tagged; p (GeV/c); counts", nBins, pMin, pMax, 0);
70da6c5a 87
70da6c5a 88}
89//____________________________________________________________
90Bool_t AliHFEV0pidMC::Process(TObjArray * const particles, Int_t type){
91 //
92 // process the selected V0 daughter tracks
93 //
94
e3ae862b 95 TString hname;
96 const TString typeName[5] = {"Electron", "PionK0", "PionL", "Kaon", "Proton"};
70da6c5a 97 const Int_t typePID[5] = {0, 2, 2, 3, 4};
98
99 if(!fMC) return kFALSE;
100 if(!particles) return kFALSE;
101
102 AliVParticle *recTrack = NULL;
103 TIterator *trackIter = particles->MakeIterator();
104 while((recTrack = dynamic_cast<AliVParticle *>(trackIter->Next()))){
105 fColl->Fill("h_QA_nParticles", 0);
106 // only ESD for now
107 AliESDtrack *track = dynamic_cast<AliESDtrack *>(recTrack);
bf892a6a 108 if(!track) continue;
70da6c5a 109 const AliExternalTrackParam *ext = track->GetOuterParam();
110 if(!ext) continue;
111 // MC label
112 Int_t label = track->GetLabel();
113 if(label <0){
114 fColl->Fill("h_QA_nParticles", 1);
115 continue;
116 }
117 AliMCParticle *mcpD = dynamic_cast<AliMCParticle*>(fMC->GetTrack(label));
118 if(!mcpD){
119 fColl->Fill("h_QA_nParticles", 2);
120 continue;
121 }
122
123 Float_t p = ext->P();
124 //Short_t charge = ext->Charge();
125 Int_t pdgD = mcpD->PdgCode();
126 AliMCParticle *mcpM = dynamic_cast<AliMCParticle*>(fMC->GetTrack(mcpD->GetMother()));
127 if(!mcpM){
128 fColl->Fill("h_QA_nParticles", 3);
129 continue;
130 }
131 //Int_t pdgM = mcpM->PdgCode();
faee3b18 132
70da6c5a 133 // all candidates
e3ae862b 134 hname = "h_" + typeName[type];
70da6c5a 135 fColl->Fill(hname, p);
136 Int_t pidD = PDGtoPIDdaughter(pdgD);
137
faee3b18 138 // all misidentified candidates
e3ae862b 139 hname = "h_mis_" + typeName[type];
70da6c5a 140 if(typePID[type] != pidD){
141 fColl->Fill(hname, p);
142 }
70da6c5a 143
faee3b18 144 // for every particle fill detailed information about the missidentified particles
e3ae862b 145 hname = "h_tag_" + typeName[type];
faee3b18 146 Int_t aliPID = PDGtoAliPID(pdgD);
147 fColl->Fill(hname, aliPID, p);
70da6c5a 148
149 }// .. loop over array
150
151
152 return kTRUE;
153}
154//____________________________________________________________
155Int_t AliHFEV0pidMC::PDGtoPIDdaughter(Int_t pdg) const {
156 //
157 // convert PDG to local pid
158 //
159 switch (TMath::Abs(pdg)){
160 case 11:
161 return 0; // electron gamma
162 case 211:
163 return 2; // pion K0 or pion Lambda
164 case 321:
165 return 3; //kaon Phi
166 case 2212:
167 return 4; // proton Lambda
168 default:
169 return -1;
170 };
171
172 return -1;
173}
174//____________________________________________________________
175Int_t AliHFEV0pidMC::PDGtoPIDmother(Int_t pdg) const {
176 //
177 // convert PDG to local pid
178 //
179 switch (TMath::Abs(pdg)){
180 case 22:
181 return 0; // gamma
182 case 310:
183 return 1; // K0s
184 case 333:
185 return 2; // Phi
186 case 3122:
187 return 3; // Lambda
188 default:
189 return -1;
190 };
191
192 return -1;
193}
faee3b18 194//____________________________________________________________
195Int_t AliHFEV0pidMC::PDGtoAliPID(Int_t pdg) const {
196 //
197 // convert PDG to AliPID
198 //
199
200 switch (TMath::Abs(pdg)){
201 case 11:
202 return 0; // electron
203 case 13:
204 return 1; // muon
205 case 211:
206 return 2; // pion
207 case 321:
208 return 3; // kaon
209 case 2212:
210 return 4; // proton
211 default:
212 return -1;
213 };
214 return -1;
215}
c2690925 216//____________________________________________________________
217TList *AliHFEV0pidMC::GetListOfQAhistograms(){
218 //
219 // Get QA histograms
220 //
221 if(fColl)
222 return fColl->GetList();
223 return NULL;
224}
faee3b18 225