Fix coding rule violations
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemtoUser / AliFemtoCutMonitorParticlePtPDG.cxx
CommitLineData
3d5f4b02 1////////////////////////////////////////////////////////////////////////////////
2// //
3// AliFemtoCutMonitorParticlePtPDG - the cut monitor for particles to study //
4// the difference between reconstructed and true momentum //
5// //
6////////////////////////////////////////////////////////////////////////////////
7#include "AliFemtoCutMonitorParticlePtPDG.h"
8#include "AliFemtoModelHiddenInfo.h"
9#include <TH1D.h>
10#include <TH2D.h>
11#include <TList.h>
12#include <TMath.h>
13
14AliFemtoCutMonitorParticlePtPDG::AliFemtoCutMonitorParticlePtPDG():
15 fPtPDG(0),ftpcHist(0),fPtGoodPi(0),fPtFakePi(0),fPtGoodK(0),fPtFakeK(0),
16 fPtGoodP(0),fPtFakeP(0),fPtRPi(0),fPtRK(0),fPtRP(0),
17 fPtContP(0),
18 fPtContPi(0),
19 fPtContMup(0),
20 fPtContElp(0),
21 fMass(0.13957)
22{
23 // Default constructor
3d5f4b02 24}
25
26AliFemtoCutMonitorParticlePtPDG::AliFemtoCutMonitorParticlePtPDG(const char *aName, float aMass):
27 AliFemtoCutMonitor(),
28 fPtPDG(0),ftpcHist(0),fPtGoodPi(0),fPtFakePi(0),fPtGoodK(0),fPtFakeK(0),
29 fPtGoodP(0),fPtFakeP(0),fPtRPi(0),fPtRK(0),fPtRP(0),
30 fPtContP(0),
31 fPtContPi(0),
32 fPtContMup(0),
33 fPtContElp(0),
34 fMass(aMass)
35{
36 // Normal constructor
37 char name[200];
38 snprintf(name, 200, "PtPDG%s", aName);
39 fPtPDG = new TH2D(name, "PDG vs Pt", 10, 0.0, 5.0, 100, 0.1, 2.0);
40 snprintf(name, 200, "tpcHist%s", aName);
41 ftpcHist=new TH2D(name,"TPC dE/dX vs momentum",100,0.1,2.7,100,0.,6.);
42 snprintf(name, 200, "PtGoodPi%s", aName);
43 fPtGoodPi = new TH1D(name, "good pions Pt", 100, 0.1, 2.0);
44 snprintf(name, 200, "PtFakePi%s", aName);
45 fPtFakePi = new TH1D(name, "fake pions Pt", 100, 0.1, 2.0);
46 snprintf(name, 200, "PtRPi%s", aName);
47 fPtRPi = new TH1D(name, "right pdg pions Pt", 100, 0.1, 2.0);
48 snprintf(name, 200, "PtGoodK%s", aName);
49 fPtGoodK = new TH1D(name, "good kaons Pt", 100, 0.1, 2.0);
50 snprintf(name, 200, "PtFakeK%s", aName);
51 fPtFakeK = new TH1D(name, "fake kaons Pt", 100, 0.1, 2.0);
52 snprintf(name, 200, "PtRK%s", aName);
53 fPtRK = new TH1D(name, "right pdg kaons Pt", 100, 0.1, 2.0);
54 snprintf(name, 200, "PtGoodP%s", aName);
55 fPtGoodP = new TH1D(name, "good protons Pt", 100, 0.1, 2.0);
56 snprintf(name, 200, "PtFakeP%s", aName);
57 fPtFakeP = new TH1D(name, "fake protons Pt", 100, 0.1, 2.0);
58 snprintf(name, 200, "PtRP%s", aName);
59 fPtRP = new TH1D(name, "right pdg protons Pt", 100, 0.1, 2.0);
60
61 snprintf(name, 200, "PtContP%s", aName);
62 fPtContP = new TH1D(name, "contamination", 100, 0.1, 2.0);
63 snprintf(name, 200, "PtContPi%s", aName);
64 fPtContPi = new TH1D(name, "contamination", 100, 0.1, 2.0);
65 snprintf(name, 200, "PtContMup%s", aName);
66 fPtContMup = new TH1D(name, "contamination", 100, 0.1, 2.0);
67 snprintf(name, 200, "PtContElp%s", aName);
68 fPtContElp = new TH1D(name, "contamination", 100, 0.1, 2.0);
69
70}
71
72AliFemtoCutMonitorParticlePtPDG::AliFemtoCutMonitorParticlePtPDG(const AliFemtoCutMonitorParticlePtPDG &aCut):
73 AliFemtoCutMonitor(),
74 fPtPDG(0),ftpcHist(0),fPtGoodPi(0),fPtFakePi(0),fPtGoodK(0),fPtFakeK(0),
75 fPtGoodP(0),fPtFakeP(0),fPtRPi(0),fPtRK(0),fPtRP(0),
76 fPtContP(0),
77 fPtContPi(0),
78 fPtContMup(0),
79 fPtContElp(0),
80 fMass(0.13957)
81{
82 // copy constructor
83 if (fPtPDG) delete fPtPDG;
84 fPtPDG = new TH2D(*aCut.fPtPDG);
85 ftpcHist= new TH2D(*aCut.ftpcHist);
86 fPtGoodPi= new TH1D(*aCut.fPtGoodPi);
87 fPtFakePi= new TH1D(*aCut.fPtFakePi);
88 fPtGoodK= new TH1D(*aCut.fPtGoodK);
89 fPtFakeK= new TH1D(*aCut.fPtFakePi);
90 fPtGoodP= new TH1D(*aCut.fPtGoodP);
91 fPtFakeP= new TH1D(*aCut.fPtFakePi);
92 fPtRPi= new TH1D(*aCut.fPtRPi);
93 fPtRK= new TH1D(*aCut.fPtRK);
94 fPtRP= new TH1D(*aCut.fPtRP);
95
96 fPtContP= new TH1D(*aCut.fPtContP);
97 fPtContPi= new TH1D(*aCut.fPtContPi);
98 fPtContMup= new TH1D(*aCut.fPtContMup);
99 fPtContElp= new TH1D(*aCut.fPtContElp);
100
101 fMass = aCut.fMass;
102}
103
104AliFemtoCutMonitorParticlePtPDG::~AliFemtoCutMonitorParticlePtPDG()
105{
106 // Destructor
107 delete fPtPDG;
108 delete ftpcHist;
109 delete fPtGoodPi;
110 delete fPtFakePi;
111 delete fPtGoodK;
112 delete fPtFakeK;
113 delete fPtGoodP;
114 delete fPtFakeP;
115 delete fPtRPi;
116 delete fPtRK;
117 delete fPtRP;
118
119 delete fPtContP;
120 delete fPtContPi;
121 delete fPtContMup;
122 delete fPtContElp;
123
124}
125
126AliFemtoCutMonitorParticlePtPDG& AliFemtoCutMonitorParticlePtPDG::operator=(const AliFemtoCutMonitorParticlePtPDG& aCut)
127{
128 // assignment operator
129 if (this == &aCut)
130 return *this;
131
132 if (fPtPDG) delete fPtPDG;
133 fPtPDG = new TH2D(*aCut.fPtPDG);
134
135 if (ftpcHist) delete ftpcHist;
136 ftpcHist = new TH2D(*aCut.ftpcHist);
137
138 if (fPtGoodPi) delete fPtGoodPi;
139 fPtGoodPi = new TH1D(*aCut.fPtGoodPi);
140
141 if (fPtFakePi) delete fPtFakePi;
142 fPtFakePi = new TH1D(*aCut.fPtFakePi);
143
144 if (fPtRPi) delete fPtRPi;
145 fPtRPi = new TH1D(*aCut.fPtRPi);
146
147 if (fPtGoodK) delete fPtGoodK;
148 fPtGoodK = new TH1D(*aCut.fPtGoodK);
149
150 if (fPtFakeK) delete fPtFakeK;
151 fPtFakeK = new TH1D(*aCut.fPtFakeK);
152
153 if (fPtRK) delete fPtRK;
154 fPtRK = new TH1D(*aCut.fPtRK);
155
156 if (fPtGoodP) delete fPtGoodP;
157 fPtGoodP = new TH1D(*aCut.fPtGoodP);
158
159 if (fPtFakeP) delete fPtFakeP;
160 fPtFakeP = new TH1D(*aCut.fPtFakeP);
161
162 if (fPtRP) delete fPtRP;
163 fPtRP = new TH1D(*aCut.fPtRP);
164
165 if (fPtContP) delete fPtContP;
166 fPtContP = new TH1D(*aCut.fPtContP);
167
168 if (fPtContPi) delete fPtContPi;
169 fPtContPi = new TH1D(*aCut.fPtContPi);
170
171 if (fPtContMup) delete fPtContMup;
172 fPtContMup = new TH1D(*aCut.fPtContMup);
173
174 if (fPtContElp) delete fPtContElp;
175 fPtContElp = new TH1D(*aCut.fPtContElp);
176
177 return *this;
178}
179
180AliFemtoString AliFemtoCutMonitorParticlePtPDG::Report(){
181 // Prepare report from the execution
182 string stemp = "*** AliFemtoCutMonitorParticlePtPDG report";
183 AliFemtoString returnThis = stemp;
184 return returnThis;
185}
186
187void AliFemtoCutMonitorParticlePtPDG::Fill(const AliFemtoTrack* aTrack)
188{
189 // Fill in the monitor histograms with the values from the current track
04328c66 190 // float tEnergy = ::sqrt(aTrack->P().mag2()+fMass*fMass);
5e301b78 191 // float tRapidity = 0.5*::log((tEnergy+aTrack->P().z())/(tEnergy-aTrack->P().z()));
3d5f4b02 192 float tPt = ::sqrt((aTrack->P().x())*(aTrack->P().x())+(aTrack->P().y())*(aTrack->P().y()));
5e301b78 193 // float tEta = -TMath::Log(TMath::Tan(aTrack->P().theta()/2.0));
194 // float tPhi = aTrack->P().phi();
3d5f4b02 195 float tP = ::sqrt((aTrack->P().z())*(aTrack->P().z())+(aTrack->P().x())*(aTrack->P().x())+(aTrack->P().y())*(aTrack->P().y()));;
196 float dedx = aTrack->TPCsignalN();
197 float w[10];
198 w[0] = aTrack->PidProbElectron();
199 w[1] = aTrack->PidProbMuon();
200 w[2] = aTrack->PidProbPion();
201 w[3] = aTrack->PidProbKaon();
202 w[4] = aTrack->PidProbProton();
203
204 Int_t pdg1=0;
205 AliFemtoModelHiddenInfo *info = ( AliFemtoModelHiddenInfo *) aTrack->GetHiddenInfo();
206 if(info)pdg1 = info->GetPDGPid();
207
208
209//most probable particle
210 fPtGoodPi->Fill(tPt);
211 fPtGoodP->Fill(tPt);
212 fPtGoodK->Fill(tPt);
213
214//contaminations
215 if (abs(pdg1)!=321)fPtFakeK->Fill(tPt);
216 if (abs(pdg1)!=211)fPtFakePi->Fill(tPt);
217 if (abs(pdg1)!=2212)fPtFakeP->Fill(tPt);
218
219
220//contaminations for kaons
221 if (abs(pdg1)==2212)fPtContP->Fill(tPt);
222 if (abs(pdg1)==211)fPtContPi->Fill(tPt);
223 if (abs(pdg1)==13)fPtContMup->Fill(tPt);
224 if (abs(pdg1)==11)fPtContElp->Fill(tPt);
225
226 Float_t pdg=-1.0;
227 if(abs(pdg1)==211){
228 pdg=2.0;
229 fPtRPi->Fill(tPt);
230 }
231
232 if(abs(pdg1)==321){
233 pdg=3.0;
234 fPtRK->Fill(tPt);
235 }
236
237 if(abs(pdg1)==2212){
238 pdg=4.0;
239 fPtRP->Fill(tPt);
240 }
241
242 if(abs(pdg1)==11)pdg=0.0; //+-electron
243 if(abs(pdg1)==13)pdg=1.0; //+-muon
244
245 //cout<<"pdg from CutMonitor.."<<pdg1<<"pdg"<<pdg<<endl;
246
247
248 fPtPDG->Fill(pdg, tPt);
249 ftpcHist->Fill(tP,dedx);
250
251
252}
253
254void AliFemtoCutMonitorParticlePtPDG::Write()
255{
256 // Write out the relevant histograms
257
258 fPtPDG->Write();
259 ftpcHist->Write();
260 fPtGoodPi->Write();
261 fPtFakePi->Write();
262 fPtGoodK->Write();
263 fPtFakeK->Write();
264 fPtGoodP->Write();
265 fPtFakeP->Write();
266 fPtRPi->Write();
267 fPtRK->Write();
268 fPtRP->Write();
269 fPtContP->Write();
270 fPtContPi->Write();
271 fPtContMup->Write();
272 fPtContElp->Write();
273}
274
275TList *AliFemtoCutMonitorParticlePtPDG::GetOutputList()
276{
277 TList *tOutputList = new TList();
278 tOutputList->Add(fPtPDG);
279 tOutputList->Add(ftpcHist);
280 tOutputList->Add(fPtGoodPi);
281 tOutputList->Add(fPtFakePi);
282 tOutputList->Add(fPtGoodK);
283 tOutputList->Add(fPtFakeK);
284 tOutputList->Add(fPtGoodP);
285 tOutputList->Add(fPtFakeP);
286 tOutputList->Add(fPtRPi);
287 tOutputList->Add(fPtRK);
288 tOutputList->Add(fPtRP);
289
290 tOutputList->Add(fPtContP);
291 tOutputList->Add(fPtContPi);
292 tOutputList->Add(fPtContMup);
293 tOutputList->Add(fPtContElp);
294
295 return tOutputList;
296}