1 //------------------------------------------------------------------------------
2 // Implementation of AliComparisonRes class. It keeps information from
3 // comparison of reconstructed and MC particle tracks. In addtion,
4 // it keeps selection cuts used during comparison. The comparison
5 // information is stored in the ROOT histograms. Analysis of these
6 // histograms can be done by using Analyse() class function. The result of
7 // the analysis (histograms) are stored in the output picture_res.root file.
9 // Author: J.Otwinowski 04/02/2008
10 //------------------------------------------------------------------------------
13 //after running analysis, read the file, and get component
14 gSystem->Load("libPWG1.so");
15 TFile f("Output.root");
16 AliComparisonRes * comp = (AliComparisonRes*)f.Get("AliComparisonRes");
18 // analyse comparison data (output stored in pictures_res.root)
21 // paramtetrisation of the TPC track length (for information only)
22 TF1 fl("fl","((min(250./(abs(x+0.000001)),250)-90))",0,2); // TPC track length function
23 TF1 fl2("fl2","[0]/((min(250./(abs(x+0.000001)),250)-90))^[1]",0,2);
24 fl2.SetParameter(1,1);
25 fl2.SetParameter(0,1);
36 #include "TProfile2D.h"
41 #include "AliESDEvent.h"
43 #include "AliESDfriend.h"
44 #include "AliESDfriendTrack.h"
45 #include "AliESDVertex.h"
46 #include "AliRecInfoCuts.h"
47 #include "AliMCInfoCuts.h"
49 #include "AliTracker.h"
51 #include "AliMathBase.h"
52 #include "AliTreeDraw.h"
54 #include "AliMCInfo.h"
55 #include "AliESDRecInfo.h"
56 #include "AliComparisonRes.h"
60 ClassImp(AliComparisonRes)
62 //_____________________________________________________________________________
63 AliComparisonRes::AliComparisonRes():
64 TNamed("AliComparisonRes","AliComparisonRes"),
67 fPtResolLPT(0), // pt resolution - low pt
68 fPtResolHPT(0), // pt resolution - high pt
69 fPtPullLPT(0), // pt resolution - low pt
70 fPtPullHPT(0), // pt resolution - high pt
72 // Resolution constrained param
74 fCPhiResolTan(0), // angular resolution - constrained
75 fCTanResolTan(0), // angular resolution - constrained
76 fCPtResolTan(0), // pt resolution - constrained
77 fCPhiPullTan(0), // angular resolution - constrained
78 fCTanPullTan(0), // angular resolution - constrained
79 fCPtPullTan(0), // pt resolution - constrained
82 // Parametrisation histograms
86 f1Pt2Resol1PtTPCITS(0),
92 fPhiResol1PtTPCITS(0),
94 fThetaResol1PtTPCITS(0),
98 fC1Pt2Resol1PtTPCITS(0),
100 fCYResol1PtTPCITS(0),
102 fCZResol1PtTPCITS(0),
104 fCPhiResol1PtTPCITS(0),
105 fCThetaResol1PtTPC(0),
106 fCThetaResol1PtTPCITS(0),
119 fVertex = new AliESDVertex();
125 //_____________________________________________________________________________
126 AliComparisonRes::~AliComparisonRes(){
128 // Resolution histograms
129 if(fPtResolLPT) delete fPtResolLPT; fPtResolLPT=0;
130 if(fPtResolHPT) delete fPtResolHPT; fPtResolHPT=0;
131 if(fPtPullLPT) delete fPtPullLPT; fPtPullLPT=0;
132 if(fPtPullHPT) delete fPtPullHPT; fPtPullHPT=0;
134 // Resolution histograms (constrained param)
135 if(fCPhiResolTan) delete fCPhiResolTan; fCPhiResolTan=0;
136 if(fCTanResolTan) delete fCTanResolTan; fCTanResolTan=0;
137 if(fCPtResolTan) delete fCPtResolTan; fCPtResolTan=0;
138 if(fCPhiPullTan) delete fCPhiPullTan; fCPhiPullTan=0;
139 if(fCTanPullTan) delete fCTanPullTan; fCTanPullTan=0;
140 if(fCPtPullTan) delete fCPtPullTan; fCPtPullTan=0;
142 // Parametrisation histograms
144 if(f1Pt2Resol1PtTPC) delete f1Pt2Resol1PtTPC; f1Pt2Resol1PtTPC=0;
145 if(f1Pt2Resol1PtTPCITS) delete f1Pt2Resol1PtTPCITS; f1Pt2Resol1PtTPCITS=0;
146 if(fYResol1PtTPC) delete fYResol1PtTPC; fYResol1PtTPC=0;
147 if(fYResol1PtTPCITS) delete fYResol1PtTPCITS; fYResol1PtTPCITS=0;
148 if(fZResol1PtTPC) delete fZResol1PtTPC; fZResol1PtTPC=0;
149 if(fZResol1PtTPCITS) delete fZResol1PtTPCITS; fZResol1PtTPCITS=0;
150 if(fPhiResol1PtTPC) delete fPhiResol1PtTPC; fPhiResol1PtTPC=0;
151 if(fPhiResol1PtTPCITS) delete fPhiResol1PtTPCITS; fPhiResol1PtTPCITS=0;
152 if(fThetaResol1PtTPC) delete fThetaResol1PtTPC; fThetaResol1PtTPC=0;
153 if(fThetaResol1PtTPCITS) delete fThetaResol1PtTPCITS; fThetaResol1PtTPCITS=0;
156 if(fC1Pt2Resol1PtTPC) delete fC1Pt2Resol1PtTPC; fC1Pt2Resol1PtTPC=0;
157 if(fC1Pt2Resol1PtTPCITS) delete fC1Pt2Resol1PtTPCITS; fC1Pt2Resol1PtTPCITS=0;
158 if(fCYResol1PtTPC) delete fCYResol1PtTPC; fCYResol1PtTPC=0;
159 if(fCYResol1PtTPCITS) delete fCYResol1PtTPCITS; fCYResol1PtTPCITS=0;
160 if(fCZResol1PtTPC) delete fCZResol1PtTPC; fCZResol1PtTPC=0;
161 if(fCZResol1PtTPCITS) delete fCZResol1PtTPCITS; fCZResol1PtTPCITS=0;
162 if(fCPhiResol1PtTPC) delete fCPhiResol1PtTPC; fCPhiResol1PtTPC=0;
163 if(fCPhiResol1PtTPCITS) delete fCPhiResol1PtTPCITS; fCPhiResol1PtTPCITS=0;
164 if(fCThetaResol1PtTPC) delete fCThetaResol1PtTPC; fCThetaResol1PtTPC=0;
165 if(fCThetaResol1PtTPCITS) delete fCThetaResol1PtTPCITS; fCThetaResol1PtTPCITS=0;
167 if(fVertex) delete fVertex; fVertex=0;
171 //_____________________________________________________________________________
172 void AliComparisonRes::InitHisto(){
175 fCPhiResolTan = new TH2F("CPhiResolTan","CPhiResolTan",50, -2,2,200,-0.025,0.025);
176 fCPhiResolTan->SetXTitle("tan(#theta)");
177 fCPhiResolTan->SetYTitle("#Delta#phi");
179 fCTanResolTan = new TH2F("CTanResolTan","CTanResolTan",50, -2,2,200,-0.025,0.025);
180 fCTanResolTan->SetXTitle("tan(#theta)");
181 fCTanResolTan->SetYTitle("#Delta#theta");
183 fCPtResolTan=new TH2F("CPtResol","CPtResol",50, -2,2,200,-0.2,0.2);
184 fCPtResolTan->SetXTitle("Tan(#theta)");
185 fCPtResolTan->SetYTitle("#Deltap_{t}/p_{t}");
187 fCPhiPullTan = new TH2F("CPhiPullTan","CPhiPullTan",50, -2,2,200,-5,5);
188 fCPhiPullTan->SetXTitle("Tan(#theta)");
189 fCPhiPullTan->SetYTitle("#Delta#phi/#Sigma");
191 fCTanPullTan = new TH2F("CTanPullTan","CTanPullTan",50, -2,2,200,-5,5);
192 fCTanPullTan->SetXTitle("Tan(#theta)");
193 fCTanPullTan->SetYTitle("#Delta#theta/#Sigma");
195 fCPtPullTan=new TH2F("CPtPull","CPtPull",50, -2,2,200,-5,5);
196 fCPtPullTan->SetXTitle("Tan(#theta)");
197 fCPtPullTan->SetYTitle("(1/mcp_{t}-1/p_{t})/#Sigma");
199 fPtResolLPT = new TH2F("Pt_resol_lpt","pt resol",10, 0.1,3,200,-0.2,0.2);
200 fPtResolLPT->SetXTitle("p_{t}");
201 fPtResolLPT->SetYTitle("#Deltap_{t}/p_{t}");
203 fPtResolHPT = new TH2F("Pt_resol_hpt","pt resol",10, 2,100,200,-0.3,0.3);
204 fPtResolHPT->SetXTitle("p_{t}");
205 fPtResolHPT->SetYTitle("#Deltap_{t}/p_{t}");
207 fPtPullLPT = new TH2F("Pt_pull_lpt","pt pull",10, 0.1,3,200,-6,6);
208 fPtPullLPT->SetXTitle("p_{t}");
209 fPtPullLPT->SetYTitle("#Deltap_{t}/#Sigma");
211 fPtPullHPT = new TH2F("Pt_pull_hpt","pt pull",10,2,100,200,-6,6);
212 fPtPullHPT->SetXTitle("p_{t}");
213 fPtPullHPT->SetYTitle("#Deltap_{t}/#Sigma");
216 // Parametrisation histograms
219 f1Pt2Resol1PtTPC = new TH2F("f1Pt2Resol1PtTPC","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs 1/pt)",100,0,10,200,-0.010,0.010);
220 f1Pt2Resol1PtTPC->SetXTitle("1/mcp_{t}");
221 f1Pt2Resol1PtTPC->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
223 f1Pt2Resol1PtTPCITS = new TH2F("f1Pt2Resol1PtTPCITS","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs 1/pt)",100,0,10,200,-0.010,0.010);
224 f1Pt2Resol1PtTPCITS->SetXTitle("1/mcp_{t}");
225 f1Pt2Resol1PtTPCITS->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
227 fYResol1PtTPC = new TH2F("fYResol1PtTPC","fYResol1PtTPC",100, 0,10,200,-1.0,1.0);
228 fYResol1PtTPC->SetXTitle("1/mcpt");
229 fYResol1PtTPC->SetYTitle("#DeltaY");
231 fYResol1PtTPCITS = new TH2F("fYResol1PtTPCITS","fYResol1PtTPCITS",100, 0,10,200,-0.05,0.05);
232 fYResol1PtTPCITS->SetXTitle("1/mcpt");
233 fYResol1PtTPCITS->SetYTitle("#DeltaY");
235 fZResol1PtTPC = new TH2F("fZResol1PtTPC","fZResol1PtTPC",100, 0,10,200,-1.0,1.0);
236 fZResol1PtTPC->SetXTitle("1/mcpt");
237 fZResol1PtTPC->SetYTitle("#DeltaZ");
239 fZResol1PtTPCITS = new TH2F("fZResol1PtTPCITS","fZResol1PtTPCITS",100, 0,10,200,-0.05,0.05);
240 fZResol1PtTPCITS->SetXTitle("1/mcpt");
241 fZResol1PtTPCITS->SetYTitle("#DeltaZ");
243 fPhiResol1PtTPC = new TH2F("fPhiResol1PtTPC","fPhiResol1PtTPC",100, 0,10,200,-0.025,0.025);
244 fPhiResol1PtTPC->SetXTitle("1/mcpt");
245 fPhiResol1PtTPC->SetYTitle("#Delta#phi");
247 fPhiResol1PtTPCITS = new TH2F("fPhiResol1PtTPCITS","fPhiResol1PtTPCITS",100, 0,10,200,-0.01,0.01);
248 fPhiResol1PtTPCITS->SetXTitle("1/mcpt");
249 fPhiResol1PtTPCITS->SetYTitle("#Delta#phi");
251 fThetaResol1PtTPC = new TH2F("fThetaResol1PtTPC","fThetaResol1PtTPC",100, 0,10,200,-0.025,0.025);
252 fThetaResol1PtTPC->SetXTitle("1/mcpt");
253 fThetaResol1PtTPC->SetYTitle("#Delta#theta");
255 fThetaResol1PtTPCITS = new TH2F("fThetaResol1PtTPCITS","fThetaResol1PtTPCITS",100, 0,10,200,-0.01,0.01);
256 fThetaResol1PtTPCITS->SetXTitle("1/mcpt");
257 fThetaResol1PtTPCITS->SetYTitle("#Delta#theta");
260 fC1Pt2Resol1PtTPC = new TH2F("fC1Pt2Resol1PtTPC","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs 1/pt)",100,0,10,200,-0.010,0.010);
261 fC1Pt2Resol1PtTPC->SetXTitle("1/mcp_{t}");
262 fC1Pt2Resol1PtTPC->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
264 fC1Pt2Resol1PtTPCITS = new TH2F("fC1Pt2Resol1PtTPCITS","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs 1/pt)",100,0,10,200,-0.010,0.010);
265 fC1Pt2Resol1PtTPCITS->SetXTitle("1/mcp_{t}");
266 fC1Pt2Resol1PtTPCITS->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
268 fCYResol1PtTPC = new TH2F("fCYResol1PtTPC","fCYResol1PtTPC",100, 0,10,200,-1.0,1.0);
269 fCYResol1PtTPC->SetXTitle("1/mcpt");
270 fCYResol1PtTPC->SetYTitle("#DeltaY");
272 fCYResol1PtTPCITS = new TH2F("fCYResol1PtTPCITS","fCYResol1PtTPCITS",100, 0,10,200,-0.05,0.05);
273 fCYResol1PtTPCITS->SetXTitle("1/mcpt");
274 fCYResol1PtTPCITS->SetYTitle("#DeltaY");
276 fCZResol1PtTPC = new TH2F("fCZResol1PtTPC","fCZResol1PtTPC",100, 0,10,200,-1.0,1.0);
277 fCZResol1PtTPC->SetXTitle("1/mcpt");
278 fCZResol1PtTPC->SetYTitle("#DeltaZ");
280 fCZResol1PtTPCITS = new TH2F("fCZResol1PtTPCITS","fCZResol1PtTPCITS",100, 0,10,200,-0.05,0.05);
281 fCZResol1PtTPCITS->SetXTitle("1/mcpt");
282 fCZResol1PtTPCITS->SetYTitle("#DeltaZ");
284 fCPhiResol1PtTPC = new TH2F("fCPhiResol1PtTPC","fCPhiResol1PtTPC",100, 0,10,200,-0.025,0.025);
285 fCPhiResol1PtTPC->SetXTitle("1/mcpt");
286 fCPhiResol1PtTPC->SetYTitle("#Delta#phi");
288 fCPhiResol1PtTPCITS = new TH2F("fCPhiResol1PtTPCITS","fCPhiResol1PtTPCITS",100, 0,10,200,-0.01,0.01);
289 fCPhiResol1PtTPCITS->SetXTitle("1/mcpt");
290 fCPhiResol1PtTPCITS->SetYTitle("#Delta#phi");
292 fCThetaResol1PtTPC = new TH2F("fCThetaResol1PtTPC","fCThetaResol1PtTPC",100, 0,10,200,-0.025,0.025);
293 fCThetaResol1PtTPC->SetXTitle("1/mcpt");
294 fCThetaResol1PtTPC->SetYTitle("#Delta#theta");
296 fCThetaResol1PtTPCITS = new TH2F("fCThetaResol1PtTPCITS","fCThetaResol1PtTPCITS",100, 0,10,200,-0.01,0.01);
297 fCThetaResol1PtTPCITS->SetXTitle("1/mcpt");
298 fCThetaResol1PtTPCITS->SetYTitle("#Delta#theta");
301 //_____________________________________________________________________________
302 void AliComparisonRes::InitCuts()
306 AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object");
308 AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object");
311 //_____________________________________________________________________________
312 void AliComparisonRes::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
314 // Fill resolution comparison information
315 AliExternalTrackParam *track = 0;
316 Double_t kRadius = 3.0; // beam pipe radius
317 Double_t kMaxStep = 5.0; // max step
318 Double_t field = AliTracker::GetBz(); // nominal Bz field [kG]
319 Double_t kMaxD = 123456.0; // max distance
321 Int_t clusterITS[200];
322 Double_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
324 Float_t deltaPt, pullPt, deltaPhi, deltaTan, delta1Pt2, deltaY1Pt, deltaZ1Pt, deltaPhi1Pt, deltaTheta1Pt;
325 Float_t deltaPtTPC, pullPtTPC, deltaPhiTPC, deltaTanTPC, delta1Pt2TPC, deltaY1PtTPC, deltaZ1PtTPC, deltaPhi1PtTPC, deltaTheta1PtTPC;
327 Float_t mcpt = infoMC->GetParticle().Pt();
329 // distance to Prim. vertex
330 const Double_t* dv = infoMC->GetVDist();
331 Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();
333 // Check selection cuts
334 if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return;
336 //if (infoRC->GetStatus(1)==0) return;
337 if (infoRC->GetStatus(1)!=3) return; // TPC refit
338 if (!infoRC->GetESDtrack()) return;
339 if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;
341 // calculate and set prim. vertex
342 fVertex->SetXv( infoMC->GetParticle().Vx() - dv[0] );
343 fVertex->SetYv( infoMC->GetParticle().Vy() - dv[1] );
344 fVertex->SetZv( infoMC->GetParticle().Vz() - dv[2] );
346 deltaPt= (mcpt-infoRC->GetESDtrack()->Pt())/mcpt;
347 pullPt= (1/mcpt-infoRC->GetESDtrack()->OneOverPt())/TMath::Sqrt(infoRC->GetESDtrack()->GetSigma1Pt2());
348 deltaPhi = TMath::ATan2(infoRC->GetESDtrack()->Py(),infoRC->GetESDtrack()->Px())-
349 TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
351 deltaTan = TMath::ATan2(infoRC->GetESDtrack()->Pz(),infoRC->GetESDtrack()->Pt())-
352 TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
354 delta1Pt2 = (1/mcpt-infoRC->GetESDtrack()->OneOverPt())/TMath::Power(1+1/mcpt,2);
355 deltaY1Pt = (infoMC->GetParticle().Vy()-infoRC->GetESDtrack()->GetY()) / (0.2+1/mcpt);
356 deltaZ1Pt = (infoMC->GetParticle().Vz()-infoRC->GetESDtrack()->GetZ()) / (0.2+1/mcpt);
357 deltaPhi1Pt = deltaPhi / (0.1+1/mcpt);
358 deltaTheta1Pt = deltaTan / (0.1+1/mcpt);
360 //track parameters at the first measured point (TPC)
361 //Double_t param[5],x,alpha; // [0]-Y [cm],[1]-Z [cm],[2]-sin(phi),[3]-tan(theta),[4]-1/pt [1/GeV]
362 //infoRC->GetESDtrack()->GetInnerExternalParameters(alpha,x,param);
363 //const AliExternalTrackParam *innerTPC = infoRC->GetESDtrack()->GetInnerParam();
364 //const AliExternalTrackParam *innerTPC = infoRC->GetESDtrack()->GetTPCInnerParam();
367 // calculate track parameters at vertex
368 const AliExternalTrackParam *innerTPC = 0;
369 if ((innerTPC = infoRC->GetESDtrack()->GetTPCInnerParam()) != 0)
371 if ((track = new AliExternalTrackParam(*infoRC->GetESDtrack()->GetTPCInnerParam())) != 0 )
373 Bool_t bStatus = AliTracker::PropagateTrackTo(track,kRadius,infoMC->GetMass(),kMaxStep,kTRUE);
374 Bool_t bDCAStatus = track->PropagateToDCA(fVertex,field,kMaxD,dca,cov);
376 // Fill parametrisation histograms (only TPC track)
377 if(bStatus && bDCAStatus)
379 deltaPtTPC= (mcpt-innerTPC->Pt())/mcpt;
380 pullPtTPC= (1/mcpt-innerTPC->OneOverPt())/TMath::Sqrt(innerTPC->GetSigma1Pt2());
381 deltaPhiTPC = TMath::ATan2(innerTPC->Py(),innerTPC->Px())-
382 TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
384 deltaTanTPC = TMath::ATan2(innerTPC->Pz(),innerTPC->Pt())-
385 TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
387 delta1Pt2TPC = (1/mcpt-innerTPC->OneOverPt())/TMath::Power(1+1/mcpt,2);
388 deltaY1PtTPC= (infoMC->GetParticle().Vy()-innerTPC->GetY()) / (0.2+1/mcpt);
389 deltaZ1PtTPC = (infoMC->GetParticle().Vz()-innerTPC->GetZ()) / (0.2+1/mcpt);
390 deltaPhi1PtTPC = deltaPhiTPC / (0.1+1/mcpt);
391 deltaTheta1PtTPC = deltaTanTPC / (0.1+1/mcpt);
393 f1Pt2Resol1PtTPC->Fill(1/mcpt,delta1Pt2TPC);
394 fYResol1PtTPC->Fill(1/mcpt,deltaY1PtTPC);
395 fZResol1PtTPC->Fill(1/mcpt,deltaZ1PtTPC);
396 fPhiResol1PtTPC->Fill(1/mcpt,deltaPhi1PtTPC);
397 fThetaResol1PtTPC->Fill(1/mcpt,deltaTheta1PtTPC);
403 // TPC and ITS (nb. of clusters >2) in the system
404 if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)>2)
406 f1Pt2Resol1PtTPCITS->Fill(1/mcpt,delta1Pt2);
407 fYResol1PtTPCITS->Fill(1/mcpt,deltaY1Pt);
408 fZResol1PtTPCITS->Fill(1/mcpt,deltaZ1Pt);
409 fPhiResol1PtTPCITS->Fill(1/mcpt,deltaPhi1Pt);
410 fThetaResol1PtTPCITS->Fill(1/mcpt,deltaTheta1Pt);
414 fPtResolLPT->Fill(mcpt,deltaPt);
415 fPtResolHPT->Fill(mcpt,deltaPt);
416 fPtPullLPT->Fill(mcpt,pullPt);
417 fPtPullHPT->Fill(mcpt,pullPt);
420 //_____________________________________________________________________________
421 void AliComparisonRes::ProcessConstrained(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
423 // Fill resolution comparison information (constarained parameters)
425 AliExternalTrackParam *track = 0;
426 Double_t kRadius = 3.0; // beam pipe radius
427 Double_t kMaxStep = 5.0; // max step
428 Double_t field = AliTracker::GetBz(); // nominal Bz field [kG]
429 Double_t kMaxD = 123456.0; // max distance
431 Int_t clusterITS[200];
432 Double_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
434 Float_t deltaPt, pullPt, deltaPhi, pullPhi, deltaTan, pullTan, delta1Pt2, deltaY1Pt, deltaZ1Pt, deltaPhi1Pt, deltaTheta1Pt;
435 Float_t deltaPtTPC, pullPtTPC, deltaPhiTPC, deltaTanTPC, delta1Pt2TPC, deltaY1PtTPC, deltaZ1PtTPC, deltaPhi1PtTPC, deltaTheta1PtTPC;
437 Float_t mcpt = infoMC->GetParticle().Pt();
438 Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);
440 // distance to Prim. vertex
441 const Double_t* dv = infoMC->GetVDist();
442 Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();
444 // Check selection cuts
445 if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return;
447 if (infoRC->GetStatus(1)!=3) return;
448 if (!infoRC->GetESDtrack()) return;
449 if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;
450 if (!infoRC->GetESDtrack()->GetConstrainedParam()) return;
452 // calculate and set prim. vertex
453 fVertex->SetXv( infoMC->GetParticle().Vx() - dv[0] );
454 fVertex->SetYv( infoMC->GetParticle().Vy() - dv[1] );
455 fVertex->SetZv( infoMC->GetParticle().Vz() - dv[2] );
457 // constrained parameters resolution
458 const AliExternalTrackParam * cparam = infoRC->GetESDtrack()->GetConstrainedParam();
459 deltaPt= (mcpt-cparam->Pt())/mcpt;
460 pullPt= (1/mcpt-cparam->OneOverPt())/TMath::Sqrt(cparam->GetSigma1Pt2());
461 deltaPhi = TMath::ATan2(cparam->Py(),cparam->Px())-
462 TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
463 pullPhi = deltaPhi/TMath::Sqrt(cparam->GetSigmaSnp2());
464 deltaTan = TMath::ATan2(cparam->Pz(),cparam->Pt())-TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
465 pullTan = deltaPhi/TMath::Sqrt(cparam->GetSigmaSnp2());
468 delta1Pt2 = (1/mcpt-cparam->OneOverPt())/TMath::Power(1+1/mcpt,2);
470 deltaY1Pt = (infoMC->GetParticle().Vy()-cparam->GetY()) / (0.2+1/mcpt);
471 deltaZ1Pt = (infoMC->GetParticle().Vz()-cparam->GetZ()) / (0.2+1/mcpt);
472 deltaPhi1Pt = deltaPhi / (0.1+1/mcpt);
473 deltaTheta1Pt = deltaTan / (0.1+1/mcpt);
475 // calculate track parameters at vertex
476 const AliExternalTrackParam *innerTPC = 0;
477 if ((innerTPC = infoRC->GetESDtrack()->GetTPCInnerParam()) != 0)
479 if ((track = new AliExternalTrackParam(*infoRC->GetESDtrack()->GetTPCInnerParam())) != 0 )
481 Bool_t bStatus = AliTracker::PropagateTrackTo(track,kRadius,infoMC->GetMass(),kMaxStep,kTRUE);
482 Bool_t bDCAStatus = track->PropagateToDCA(fVertex,field,kMaxD,dca,cov);
484 // Fill parametrisation histograms (only TPC track)
485 if(bStatus && bDCAStatus)
487 deltaPtTPC= (mcpt-innerTPC->Pt())/mcpt;
488 pullPtTPC= (1/mcpt-innerTPC->OneOverPt())/TMath::Sqrt(innerTPC->GetSigma1Pt2());
489 deltaPhiTPC = TMath::ATan2(innerTPC->Py(),innerTPC->Px())-
490 TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
492 deltaTanTPC = TMath::ATan2(innerTPC->Pz(),innerTPC->Pt())-
493 TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
495 delta1Pt2TPC = (1/mcpt-innerTPC->OneOverPt())/TMath::Power(1+1/mcpt,2);
496 deltaY1PtTPC= (infoMC->GetParticle().Vy()-innerTPC->GetY()) / (0.2+1/mcpt);
497 deltaZ1PtTPC = (infoMC->GetParticle().Vz()-innerTPC->GetZ()) / (0.2+1/mcpt);
498 deltaPhi1PtTPC = deltaPhiTPC / (0.1+1/mcpt);
499 deltaTheta1PtTPC = deltaTanTPC / (0.1+1/mcpt);
501 fC1Pt2Resol1PtTPC->Fill(1/mcpt,delta1Pt2TPC);
502 fCYResol1PtTPC->Fill(1/mcpt,deltaY1PtTPC);
503 fCZResol1PtTPC->Fill(1/mcpt,deltaZ1PtTPC);
504 fCPhiResol1PtTPC->Fill(1/mcpt,deltaPhi1PtTPC);
505 fCThetaResol1PtTPC->Fill(1/mcpt,deltaTheta1PtTPC);
511 // TPC and ITS (nb. of clusters >2) in the system
512 if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)>2)
514 fC1Pt2Resol1PtTPCITS->Fill(1/mcpt,delta1Pt2);
515 fCYResol1PtTPCITS->Fill(1/mcpt,deltaY1Pt);
516 fCZResol1PtTPCITS->Fill(1/mcpt,deltaZ1Pt);
517 fCPhiResol1PtTPCITS->Fill(1/mcpt,deltaPhi1Pt);
518 fCThetaResol1PtTPCITS->Fill(1/mcpt,deltaTheta1Pt);
522 fCPtResolTan->Fill(tantheta,deltaPt);
523 fCPtPullTan->Fill(tantheta,pullPt);
524 fCPhiResolTan->Fill(tantheta,deltaPhi);
525 fCPhiPullTan->Fill(tantheta,pullPhi);
526 fCTanResolTan->Fill(tantheta,deltaTan);
527 fCTanPullTan->Fill(tantheta,pullTan);
530 //_____________________________________________________________________________
531 void AliComparisonRes::Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC){
533 // Process comparison information
534 Process(infoMC,infoRC);
535 ProcessConstrained(infoMC,infoRC);
538 //_____________________________________________________________________________
539 TH1F* AliComparisonRes::MakeResol(TH2F * his, Int_t integ, Bool_t type){
540 // Create resolution histograms
543 if (!gPad) new TCanvas;
544 hisr = AliTreeDraw::CreateResHistoI(his,&hism,integ);
545 if (type) return hism;
550 //_____________________________________________________________________________
551 void AliComparisonRes::Analyse(){
552 // Analyse comparison information and store output histograms
553 // in the "pictures_res.root" file
555 AliComparisonRes * comp=this;
558 TFile *fp = new TFile("pictures_res.root","recreate");
561 TCanvas * c = new TCanvas("Phi resol Tan","Phi resol Tan");
564 hiss = comp->MakeResol(comp->fCPtResolTan,1,0);
565 hiss->SetXTitle("Tan(#theta)");
566 hiss->SetYTitle("#sigmap_{t}/p_{t}");
568 hiss->Write("CptResolTan");
570 hiss = comp->MakeResol(comp->fCPhiResolTan,1,0);
571 hiss->SetXTitle("Tan(#theta)");
572 hiss->SetYTitle("#sigma#phi (rad)");
574 hiss->Write("PhiResolTan");
576 hiss = comp->MakeResol(comp->fCTanResolTan,1,0);
577 hiss->SetXTitle("Tan(#theta)");
578 hiss->SetYTitle("#sigma#theta (rad)");
580 hiss->Write("ThetaResolTan");
582 hiss = comp->MakeResol(comp->fCPtPullTan,1,0);
583 hiss->SetXTitle("Tan(#theta)");
584 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/#Sigma(1/p_{t})");
586 hiss->Write("CptPullTan");
588 hiss = comp->MakeResol(comp->fC1Pt2Resol1PtTPC,1,0);
589 hiss->SetXTitle("1/mcp_{t}");
590 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
592 hiss->Write("C1Pt2Resol1PtTPC");
593 fC1Pt2Resol1PtTPC->Write();
595 hiss = comp->MakeResol(comp->fC1Pt2Resol1PtTPCITS,1,0);
596 hiss->SetXTitle("1/mcp_{t}");
597 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
599 hiss->Write("C1Pt2Resol1PtTPCITS");
600 fC1Pt2Resol1PtTPCITS->Write();
602 hiss = comp->MakeResol(comp->fCYResol1PtTPC,1,0);
603 hiss->SetXTitle("1/mcp_{t}");
604 hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
606 hiss->Write("CYResol1PtTPC");
607 fCYResol1PtTPC->Write();
609 hiss = comp->MakeResol(comp->fCYResol1PtTPCITS,1,0);
610 hiss->SetXTitle("1/mcp_{t}");
611 hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
613 hiss->Write("CYResol1PtTPCITS");
614 fCYResol1PtTPCITS->Write();
616 hiss = comp->MakeResol(comp->fCZResol1PtTPC,1,0);
617 hiss->SetXTitle("1/mcp_{t}");
618 hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
620 hiss->Write("CZResol1PtTPC");
621 fCZResol1PtTPC->Write();
623 hiss = comp->MakeResol(comp->fCZResol1PtTPCITS,1,0);
624 hiss->SetXTitle("1/mcp_{t}");
625 hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
627 hiss->Write("CZResol1PtTPCITS");
628 fCZResol1PtTPCITS->Write();
630 hiss = comp->MakeResol(comp->fCPhiResol1PtTPC,1,0);
631 hiss->SetXTitle("1/mcp_{t}");
632 hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
634 hiss->Write("CPhiResol1PtTPC");
635 fCPhiResol1PtTPC->Write();
637 hiss = comp->MakeResol(comp->fCPhiResol1PtTPCITS,1,0);
638 hiss->SetXTitle("1/mcp_{t}");
639 hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
641 hiss->Write("CPhiResol1PtTPCITS");
642 fCPhiResol1PtTPCITS->Write();
644 hiss = comp->MakeResol(comp->fCThetaResol1PtTPC,1,0);
645 hiss->SetXTitle("1/mcp_{t}");
646 hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
648 hiss->Write("CThetaResol1PtTPC");
649 fCThetaResol1PtTPC->Write();
651 hiss = comp->MakeResol(comp->fCThetaResol1PtTPCITS,1,0);
652 hiss->SetXTitle("1/mcp_{t}");
653 hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
655 hiss->Write("CThetaResol1PtTPCITS");
656 fCThetaResol1PtTPCITS->Write();
659 hiss = comp->MakeResol(comp->f1Pt2Resol1PtTPC,1,0);
660 hiss->SetXTitle("1/mcp_{t}");
661 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
663 hiss->Write("OnePt2Resol1PtTPC");
664 f1Pt2Resol1PtTPC->Write();
666 hiss = comp->MakeResol(comp->f1Pt2Resol1PtTPCITS,1,0);
667 hiss->SetXTitle("1/mcp_{t}");
668 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
670 hiss->Write("OnePt2Resol1PtTPCITS");
671 f1Pt2Resol1PtTPCITS->Write();
673 hiss = comp->MakeResol(comp->fYResol1PtTPC,1,0);
674 hiss->SetXTitle("1/mcp_{t}");
675 hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
677 hiss->Write("YResol1PtTPC");
678 fYResol1PtTPC->Write();
680 hiss = comp->MakeResol(comp->fYResol1PtTPCITS,1,0);
681 hiss->SetXTitle("1/mcp_{t}");
682 hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
684 hiss->Write("YResol1PtTPCITS");
685 fYResol1PtTPCITS->Write();
687 hiss = comp->MakeResol(comp->fZResol1PtTPC,1,0);
688 hiss->SetXTitle("1/mcp_{t}");
689 hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
691 hiss->Write("ZResol1PtTPC");
692 fZResol1PtTPC->Write();
694 hiss = comp->MakeResol(comp->fZResol1PtTPCITS,1,0);
695 hiss->SetXTitle("1/mcp_{t}");
696 hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
698 hiss->Write("ZResol1PtTPCITS");
699 fZResol1PtTPCITS->Write();
701 hiss = comp->MakeResol(comp->fPhiResol1PtTPC,1,0);
702 hiss->SetXTitle("1/mcp_{t}");
703 hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
705 hiss->Write("PhiResol1PtTPC");
706 fPhiResol1PtTPC->Write();
708 hiss = comp->MakeResol(comp->fPhiResol1PtTPCITS,1,0);
709 hiss->SetXTitle("1/mcp_{t}");
710 hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
712 hiss->Write("PhiResol1PtTPCITS");
713 fPhiResol1PtTPCITS->Write();
715 hiss = comp->MakeResol(comp->fThetaResol1PtTPC,1,0);
716 hiss->SetXTitle("1/mcp_{t}");
717 hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
719 hiss->Write("ThetaResol1PtTPC");
720 fThetaResol1PtTPC->Write();
722 hiss = comp->MakeResol(comp->fThetaResol1PtTPCITS,1,0);
723 hiss->SetXTitle("1/mcp_{t}");
724 hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
726 hiss->Write("ThetaResol1PtTPCITS");
727 fThetaResol1PtTPCITS->Write();
732 //_____________________________________________________________________________
733 Long64_t AliComparisonRes::Merge(TCollection* list)
735 // Merge list of objects (needed by PROOF)
743 TIterator* iter = list->MakeIterator();
746 // collection of generated histograms
748 while((obj = iter->Next()) != 0)
750 AliComparisonRes* entry = dynamic_cast<AliComparisonRes*>(obj);
751 if (entry == 0) continue;
753 fPtResolLPT->Add(entry->fPtResolLPT);
754 fPtResolHPT->Add(entry->fPtResolHPT);
755 fPtPullLPT->Add(entry->fPtPullLPT);
756 fPtPullHPT->Add(entry->fPtPullHPT);
758 // Histograms for 1/pt parameterisation
759 f1Pt2Resol1PtTPC->Add(entry->f1Pt2Resol1PtTPC);
760 fYResol1PtTPC->Add(entry->fYResol1PtTPC);
761 fZResol1PtTPC->Add(entry->fZResol1PtTPC);
762 fPhiResol1PtTPC->Add(entry->fPhiResol1PtTPC);
763 fThetaResol1PtTPC->Add(entry->fThetaResol1PtTPC);
765 f1Pt2Resol1PtTPCITS->Add(entry->f1Pt2Resol1PtTPCITS);
766 fYResol1PtTPCITS->Add(entry->fYResol1PtTPCITS);
767 fZResol1PtTPCITS->Add(entry->fZResol1PtTPCITS);
768 fPhiResol1PtTPCITS->Add(entry->fPhiResol1PtTPCITS);
769 fThetaResol1PtTPCITS->Add(entry->fThetaResol1PtTPCITS);
771 // Resolution histograms (constrained param)
772 fCPhiResolTan->Add(entry->fCPhiResolTan);
773 fCTanResolTan->Add(entry->fCTanResolTan);
774 fCPtResolTan->Add(entry->fCPtResolTan);
775 fCPhiPullTan->Add(entry->fCPhiPullTan);
776 fCTanPullTan->Add(entry->fCTanPullTan);
777 fCPtPullTan->Add(entry->fCPtPullTan);
779 // Histograms for 1/pt parameterisation (constrained)
780 fC1Pt2Resol1PtTPC->Add(entry->fC1Pt2Resol1PtTPC);
781 fCYResol1PtTPC->Add(entry->fCYResol1PtTPC);
782 fCZResol1PtTPC->Add(entry->fCZResol1PtTPC);
783 fCPhiResol1PtTPC->Add(entry->fCPhiResol1PtTPC);
784 fCThetaResol1PtTPC->Add(entry->fCThetaResol1PtTPC);
786 fC1Pt2Resol1PtTPCITS->Add(entry->fC1Pt2Resol1PtTPCITS);
787 fCYResol1PtTPCITS->Add(entry->fCYResol1PtTPCITS);
788 fCZResol1PtTPCITS->Add(entry->fCZResol1PtTPCITS);
789 fCPhiResol1PtTPCITS->Add(entry->fCPhiResol1PtTPCITS);
790 fCThetaResol1PtTPCITS->Add(entry->fCThetaResol1PtTPCITS);