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/graphs) are stored in the folder which is
8 // a data member of AliComparisonRes.
10 // Author: J.Otwinowski 04/02/2008
11 //------------------------------------------------------------------------------
15 // after running comparison task, read the file, and get component
16 gSystem->Load("libPWG1.so");
17 TFile f("Output.root");
18 AliComparisonRes * compObj = (AliComparisonRes*)f.Get("AliComparisonRes");
20 // analyse comparison data
23 // the output histograms/graphs will be stored in the folder "folderRes"
24 compObj->GetAnalysisFolder()->ls("*");
26 // user can save whole comparison object (or only folder with anlysed histograms)
27 // in the seperate output file (e.g.)
28 TFile fout("Analysed_Res.root","recreate");
29 compObj->Write(); // compObj->GetAnalysisFolder()->Write();
42 #include "TProfile2D.h"
47 #include "AliESDEvent.h"
49 #include "AliESDfriend.h"
50 #include "AliESDfriendTrack.h"
51 #include "AliESDVertex.h"
52 #include "AliRecInfoCuts.h"
53 #include "AliMCInfoCuts.h"
55 #include "AliTracker.h"
57 #include "AliMathBase.h"
58 #include "AliTreeDraw.h"
60 #include "AliMCInfo.h"
61 #include "AliESDRecInfo.h"
62 #include "AliComparisonRes.h"
66 ClassImp(AliComparisonRes)
68 //_____________________________________________________________________________
69 AliComparisonRes::AliComparisonRes():
70 AliComparisonObject("AliComparisonRes"),
73 fPtResolLPT(0), // pt resolution - low pt
74 fPtResolHPT(0), // pt resolution - high pt
75 fPtPullLPT(0), // pt resolution - low pt
76 fPtPullHPT(0), // pt resolution - high pt
78 // Resolution constrained param
80 fCPhiResolTan(0), // angular resolution - constrained
81 fCTanResolTan(0), // angular resolution - constrained
82 fCPtResolTan(0), // pt resolution - constrained
83 fCPhiPullTan(0), // angular resolution - constrained
84 fCTanPullTan(0), // angular resolution - constrained
85 fCPtPullTan(0), // pt resolution - constrained
88 // Parametrisation histograms
92 f1Pt2ResolS1PtTPCITS(0),
98 fPhiResolS1PtTPCITS(0),
99 fThetaResolS1PtTPC(0),
100 fThetaResolS1PtTPCITS(0),
103 fC1Pt2ResolS1PtTPC(0),
104 fC1Pt2ResolS1PtTPCITS(0),
106 fCYResolS1PtTPCITS(0),
108 fCZResolS1PtTPCITS(0),
109 fCPhiResolS1PtTPC(0),
110 fCPhiResolS1PtTPCITS(0),
111 fCThetaResolS1PtTPC(0),
112 fCThetaResolS1PtTPCITS(0),
127 fVertex = new AliESDVertex();
133 //_____________________________________________________________________________
134 AliComparisonRes::~AliComparisonRes(){
136 // Resolution histograms
137 if(fPtResolLPT) delete fPtResolLPT; fPtResolLPT=0;
138 if(fPtResolHPT) delete fPtResolHPT; fPtResolHPT=0;
139 if(fPtPullLPT) delete fPtPullLPT; fPtPullLPT=0;
140 if(fPtPullHPT) delete fPtPullHPT; fPtPullHPT=0;
142 // Resolution histograms (constrained param)
143 if(fCPhiResolTan) delete fCPhiResolTan; fCPhiResolTan=0;
144 if(fCTanResolTan) delete fCTanResolTan; fCTanResolTan=0;
145 if(fCPtResolTan) delete fCPtResolTan; fCPtResolTan=0;
146 if(fCPhiPullTan) delete fCPhiPullTan; fCPhiPullTan=0;
147 if(fCTanPullTan) delete fCTanPullTan; fCTanPullTan=0;
148 if(fCPtPullTan) delete fCPtPullTan; fCPtPullTan=0;
150 // Parametrisation histograms
152 if(f1Pt2ResolS1PtTPC) delete f1Pt2ResolS1PtTPC; f1Pt2ResolS1PtTPC=0;
153 if(f1Pt2ResolS1PtTPCITS) delete f1Pt2ResolS1PtTPCITS; f1Pt2ResolS1PtTPCITS=0;
154 if(fYResolS1PtTPC) delete fYResolS1PtTPC; fYResolS1PtTPC=0;
155 if(fYResolS1PtTPCITS) delete fYResolS1PtTPCITS; fYResolS1PtTPCITS=0;
156 if(fZResolS1PtTPC) delete fZResolS1PtTPC; fZResolS1PtTPC=0;
157 if(fZResolS1PtTPCITS) delete fZResolS1PtTPCITS; fZResolS1PtTPCITS=0;
158 if(fPhiResolS1PtTPC) delete fPhiResolS1PtTPC; fPhiResolS1PtTPC=0;
159 if(fPhiResolS1PtTPCITS) delete fPhiResolS1PtTPCITS; fPhiResolS1PtTPCITS=0;
160 if(fThetaResolS1PtTPC) delete fThetaResolS1PtTPC; fThetaResolS1PtTPC=0;
161 if(fThetaResolS1PtTPCITS) delete fThetaResolS1PtTPCITS; fThetaResolS1PtTPCITS=0;
164 if(fC1Pt2ResolS1PtTPC) delete fC1Pt2ResolS1PtTPC; fC1Pt2ResolS1PtTPC=0;
165 if(fC1Pt2ResolS1PtTPCITS) delete fC1Pt2ResolS1PtTPCITS; fC1Pt2ResolS1PtTPCITS=0;
166 if(fCYResolS1PtTPC) delete fCYResolS1PtTPC; fCYResolS1PtTPC=0;
167 if(fCYResolS1PtTPCITS) delete fCYResolS1PtTPCITS; fCYResolS1PtTPCITS=0;
168 if(fCZResolS1PtTPC) delete fCZResolS1PtTPC; fCZResolS1PtTPC=0;
169 if(fCZResolS1PtTPCITS) delete fCZResolS1PtTPCITS; fCZResolS1PtTPCITS=0;
170 if(fCPhiResolS1PtTPC) delete fCPhiResolS1PtTPC; fCPhiResolS1PtTPC=0;
171 if(fCPhiResolS1PtTPCITS) delete fCPhiResolS1PtTPCITS; fCPhiResolS1PtTPCITS=0;
172 if(fCThetaResolS1PtTPC) delete fCThetaResolS1PtTPC; fCThetaResolS1PtTPC=0;
173 if(fCThetaResolS1PtTPCITS) delete fCThetaResolS1PtTPCITS; fCThetaResolS1PtTPCITS=0;
175 if(fVertex) delete fVertex; fVertex=0;
177 if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;
180 //_____________________________________________________________________________
181 void AliComparisonRes::Init(){
184 fCPhiResolTan = new TH2F("CPhiResolTan","CPhiResolTan",50, -2,2,200,-0.025,0.025);
185 fCPhiResolTan->SetXTitle("tan(#theta)");
186 fCPhiResolTan->SetYTitle("#Delta#phi");
188 fCTanResolTan = new TH2F("CTanResolTan","CTanResolTan",50, -2,2,200,-0.025,0.025);
189 fCTanResolTan->SetXTitle("tan(#theta)");
190 fCTanResolTan->SetYTitle("#Delta#theta");
192 fCPtResolTan=new TH2F("CPtResol","CPtResol",50, -2,2,200,-0.2,0.2);
193 fCPtResolTan->SetXTitle("Tan(#theta)");
194 fCPtResolTan->SetYTitle("#Deltap_{t}/p_{t}");
196 fCPhiPullTan = new TH2F("CPhiPullTan","CPhiPullTan",50, -2,2,200,-5,5);
197 fCPhiPullTan->SetXTitle("Tan(#theta)");
198 fCPhiPullTan->SetYTitle("#Delta#phi/#Sigma");
200 fCTanPullTan = new TH2F("CTanPullTan","CTanPullTan",50, -2,2,200,-5,5);
201 fCTanPullTan->SetXTitle("Tan(#theta)");
202 fCTanPullTan->SetYTitle("#Delta#theta/#Sigma");
204 fCPtPullTan=new TH2F("CPtPull","CPtPull",50, -2,2,200,-5,5);
205 fCPtPullTan->SetXTitle("Tan(#theta)");
206 fCPtPullTan->SetYTitle("(1/mcp_{t}-1/p_{t})/#Sigma");
208 fPtResolLPT = new TH2F("Pt_resol_lpt","pt resol",10, 0.1,3,200,-0.2,0.2);
209 fPtResolLPT->SetXTitle("p_{t}");
210 fPtResolLPT->SetYTitle("#Deltap_{t}/p_{t}");
212 fPtResolHPT = new TH2F("Pt_resol_hpt","pt resol",10, 2,100,200,-0.3,0.3);
213 fPtResolHPT->SetXTitle("p_{t}");
214 fPtResolHPT->SetYTitle("#Deltap_{t}/p_{t}");
216 fPtPullLPT = new TH2F("Pt_pull_lpt","pt pull",10, 0.1,3,200,-6,6);
217 fPtPullLPT->SetXTitle("p_{t}");
218 fPtPullLPT->SetYTitle("#Deltap_{t}/#Sigma");
220 fPtPullHPT = new TH2F("Pt_pull_hpt","pt pull",10,2,100,200,-6,6);
221 fPtPullHPT->SetXTitle("p_{t}");
222 fPtPullHPT->SetYTitle("#Deltap_{t}/#Sigma");
225 // Parametrisation histograms
228 f1Pt2ResolS1PtTPC = new TH2F("f1Pt2ResolS1PtTPC","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs sqrt(1/pt))",100,0,3,200,-0.010,0.010);
229 f1Pt2ResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
230 f1Pt2ResolS1PtTPC->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
232 f1Pt2ResolS1PtTPCITS = new TH2F("f1Pt2ResolS1PtTPCITS","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs sqrt(1/pt))",100,0,3,200,-0.010,0.010);
233 f1Pt2ResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
234 f1Pt2ResolS1PtTPCITS->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
236 fYResolS1PtTPC = new TH2F("fYResolS1PtTPC","fYResolS1PtTPC",100, 0,3,200,-1.0,1.0);
237 fYResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
238 fYResolS1PtTPC->SetYTitle("#DeltaY");
240 fYResolS1PtTPCITS = new TH2F("fYResolS1PtTPCITS","fYResolS1PtTPCITS",100, 0,3,200,-0.05,0.05);
241 fYResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
242 fYResolS1PtTPCITS->SetYTitle("#DeltaY");
244 fZResolS1PtTPC = new TH2F("fZResolS1PtTPC","fZResolS1PtTPC",100, 0,3,200,-1.0,1.0);
245 fZResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
246 fZResolS1PtTPC->SetYTitle("#DeltaZ");
248 fZResolS1PtTPCITS = new TH2F("fZResolS1PtTPCITS","fZResolS1PtTPCITS",100, 0,3,200,-0.05,0.05);
249 fZResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
250 fZResolS1PtTPCITS->SetYTitle("#DeltaZ");
252 fPhiResolS1PtTPC = new TH2F("fPhiResolS1PtTPC","fPhiResolS1PtTPC",100, 0,3,200,-0.025,0.025);
253 fPhiResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
254 fPhiResolS1PtTPC->SetYTitle("#Delta#phi");
256 fPhiResolS1PtTPCITS = new TH2F("fPhiResolS1PtTPCITS","fPhiResolS1PtTPCITS",100, 0,3,200,-0.01,0.01);
257 fPhiResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
258 fPhiResolS1PtTPCITS->SetYTitle("#Delta#phi");
260 fThetaResolS1PtTPC = new TH2F("fThetaResolS1PtTPC","fThetaResolS1PtTPC",100, 0,3,200,-0.025,0.025);
261 fThetaResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
262 fThetaResolS1PtTPC->SetYTitle("#Delta#theta");
264 fThetaResolS1PtTPCITS = new TH2F("fThetaResolS1PtTPCITS","fThetaResolS1PtTPCITS",100, 0,3,200,-0.01,0.01);
265 fThetaResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
266 fThetaResolS1PtTPCITS->SetYTitle("#Delta#theta");
269 fC1Pt2ResolS1PtTPC = new TH2F("fC1Pt2ResolS1PtTPC","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs 1/pt)",100,0,3,200,-0.010,0.010);
270 fC1Pt2ResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
271 fC1Pt2ResolS1PtTPC->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
273 fC1Pt2ResolS1PtTPCITS = new TH2F("fC1Pt2ResolS1PtTPCITS","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs 1/pt)",100,0,3,200,-0.010,0.010);
274 fC1Pt2ResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
275 fC1Pt2ResolS1PtTPCITS->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
277 fCYResolS1PtTPC = new TH2F("fCYResolS1PtTPC","fCYResolS1PtTPC",100, 0,3,200,-1.0,1.0);
278 fCYResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
279 fCYResolS1PtTPC->SetYTitle("#DeltaY");
281 fCYResolS1PtTPCITS = new TH2F("fCYResolS1PtTPCITS","fCYResolS1PtTPCITS",100, 0,3,200,-0.01,0.01);
282 fCYResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
283 fCYResolS1PtTPCITS->SetYTitle("#DeltaY");
285 fCZResolS1PtTPC = new TH2F("fCZResolS1PtTPC","fCZResolS1PtTPC",100, 0,3,200,-1.0,1.0);
286 fCZResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
287 fCZResolS1PtTPC->SetYTitle("#DeltaZ");
289 fCZResolS1PtTPCITS = new TH2F("fCZResolS1PtTPCITS","fCZResolS1PtTPCITS",100, 0,3,200,-0.025,0.025);
290 fCZResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
291 fCZResolS1PtTPCITS->SetYTitle("#DeltaZ");
293 fCPhiResolS1PtTPC = new TH2F("fCPhiResolS1PtTPC","fCPhiResolS1PtTPC",100, 0,3,200,-0.025,0.025);
294 fCPhiResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
295 fCPhiResolS1PtTPC->SetYTitle("#Delta#phi");
297 fCPhiResolS1PtTPCITS = new TH2F("fCPhiResolS1PtTPCITS","fCPhiResolS1PtTPCITS",100, 0,3,200,-0.003,0.003);
298 fCPhiResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
299 fCPhiResolS1PtTPCITS->SetYTitle("#Delta#phi");
301 fCThetaResolS1PtTPC = new TH2F("fCThetaResolS1PtTPC","fCThetaResolS1PtTPC",100, 0,3,200,-0.025,0.025);
302 fCThetaResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
303 fCThetaResolS1PtTPC->SetYTitle("#Delta#theta");
305 fCThetaResolS1PtTPCITS = new TH2F("fCThetaResolS1PtTPCITS","fCThetaResolS1PtTPCITS",100, 0,3,200,-0.005,0.005);
306 fCThetaResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
307 fCThetaResolS1PtTPCITS->SetYTitle("#Delta#theta");
311 AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object");
313 AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object");
316 fAnalysisFolder = CreateFolder("folderRes","Analysis Resolution Folder");
319 //_____________________________________________________________________________
320 void AliComparisonRes::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
322 // Fill resolution comparison information
323 AliExternalTrackParam *track = 0;
324 Double_t field = AliTracker::GetBz(); // nominal Bz field [kG]
325 Double_t kMaxD = 123456.0; // max distance
327 Int_t clusterITS[200];
328 Double_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
330 Float_t deltaPt, pullPt, deltaPhi, deltaTan, delta1Pt2, deltaY1Pt, deltaZ1Pt, deltaPhi1Pt, deltaTheta1Pt;
331 Float_t deltaPtTPC, pullPtTPC, deltaPhiTPC, deltaTanTPC, delta1Pt2TPC, deltaY1PtTPC, deltaZ1PtTPC, deltaPhi1PtTPC, deltaTheta1PtTPC;
333 Float_t mcpt = infoMC->GetParticle().Pt();
334 Float_t s1mcpt = TMath::Sqrt(1./infoMC->GetParticle().Pt());
336 // distance to Prim. vertex
337 const Double_t* dv = infoMC->GetVDist();
338 Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();
340 // Check selection cuts
341 if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return;
343 if (infoRC->GetStatus(1)!=3) return; // TPC refit
344 if (!infoRC->GetESDtrack()) return;
345 if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;
347 // calculate and set prim. vertex
348 fVertex->SetXv( infoMC->GetParticle().Vx() - dv[0] );
349 fVertex->SetYv( infoMC->GetParticle().Vy() - dv[1] );
350 fVertex->SetZv( infoMC->GetParticle().Vz() - dv[2] );
352 deltaPt= (mcpt-infoRC->GetESDtrack()->Pt())/mcpt;
353 pullPt= (1/mcpt-infoRC->GetESDtrack()->OneOverPt())/TMath::Sqrt(infoRC->GetESDtrack()->GetSigma1Pt2());
354 deltaPhi = TMath::ATan2(infoRC->GetESDtrack()->Py(),infoRC->GetESDtrack()->Px())-
355 TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
357 deltaTan = TMath::ATan2(infoRC->GetESDtrack()->Pz(),infoRC->GetESDtrack()->Pt())-
358 TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
360 delta1Pt2 = (1/mcpt-infoRC->GetESDtrack()->OneOverPt())/TMath::Power(1+1/mcpt,2);
361 deltaY1Pt = (infoMC->GetParticle().Vy()-infoRC->GetESDtrack()->GetY()) / (0.2+1/mcpt);
362 deltaZ1Pt = (infoMC->GetParticle().Vz()-infoRC->GetESDtrack()->GetZ()) / (0.2+1/mcpt);
363 deltaPhi1Pt = deltaPhi / (0.1+1/mcpt);
364 deltaTheta1Pt = deltaTan / (0.1+1/mcpt);
366 // calculate track parameters at vertex
367 const AliExternalTrackParam *innerTPC = 0;
368 if ((innerTPC = infoRC->GetESDtrack()->GetTPCInnerParam()) != 0)
370 if ((track = new AliExternalTrackParam(*infoRC->GetESDtrack()->GetTPCInnerParam())) != 0 )
372 Bool_t bDCAStatus = track->PropagateToDCA(fVertex,field,kMaxD,dca,cov);
374 // Fill parametrisation histograms (only TPC track)
377 deltaPtTPC= (mcpt-innerTPC->Pt())/mcpt;
378 pullPtTPC= (1/mcpt-innerTPC->OneOverPt())/TMath::Sqrt(innerTPC->GetSigma1Pt2());
379 deltaPhiTPC = TMath::ATan2(innerTPC->Py(),innerTPC->Px())-
380 TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
382 deltaTanTPC = TMath::ATan2(innerTPC->Pz(),innerTPC->Pt())-
383 TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
385 delta1Pt2TPC = (1/mcpt-innerTPC->OneOverPt())/TMath::Power(1+1/mcpt,2);
386 deltaY1PtTPC= (infoMC->GetParticle().Vy()-innerTPC->GetY()) / (0.2+1/mcpt);
387 deltaZ1PtTPC = (infoMC->GetParticle().Vz()-innerTPC->GetZ()) / (0.2+1/mcpt);
388 deltaPhi1PtTPC = deltaPhiTPC / (0.1+1/mcpt);
389 deltaTheta1PtTPC = deltaTanTPC / (0.1+1/mcpt);
391 f1Pt2ResolS1PtTPC->Fill(s1mcpt,delta1Pt2TPC);
392 fYResolS1PtTPC->Fill(s1mcpt,deltaY1PtTPC);
393 fZResolS1PtTPC->Fill(s1mcpt,deltaZ1PtTPC);
394 fPhiResolS1PtTPC->Fill(s1mcpt,deltaPhi1PtTPC);
395 fThetaResolS1PtTPC->Fill(s1mcpt,deltaTheta1PtTPC);
401 // TPC and ITS (nb. of clusters >2) in the system
402 if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)>2)
404 f1Pt2ResolS1PtTPCITS->Fill(s1mcpt,delta1Pt2);
405 fYResolS1PtTPCITS->Fill(s1mcpt,deltaY1Pt);
406 fZResolS1PtTPCITS->Fill(s1mcpt,deltaZ1Pt);
407 fPhiResolS1PtTPCITS->Fill(s1mcpt,deltaPhi1Pt);
408 fThetaResolS1PtTPCITS->Fill(s1mcpt,deltaTheta1Pt);
412 fPtResolLPT->Fill(mcpt,deltaPt);
413 fPtResolHPT->Fill(mcpt,deltaPt);
414 fPtPullLPT->Fill(mcpt,pullPt);
415 fPtPullHPT->Fill(mcpt,pullPt);
418 //_____________________________________________________________________________
419 void AliComparisonRes::ProcessConstrained(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
421 // Fill resolution comparison information (constarained parameters)
423 AliExternalTrackParam *track = 0;
424 Double_t field = AliTracker::GetBz(); // nominal Bz field [kG]
425 Double_t kMaxD = 123456.0; // max distance
427 Int_t clusterITS[200];
428 Double_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
430 Float_t deltaPt, pullPt, deltaPhi, pullPhi, deltaTan, pullTan, delta1Pt2, deltaY1Pt, deltaZ1Pt, deltaPhi1Pt, deltaTheta1Pt;
431 Float_t deltaPtTPC, pullPtTPC, deltaPhiTPC, deltaTanTPC, delta1Pt2TPC, deltaY1PtTPC, deltaZ1PtTPC, deltaPhi1PtTPC, deltaTheta1PtTPC;
433 Float_t mcpt = infoMC->GetParticle().Pt();
434 Float_t s1mcpt = TMath::Sqrt(1./infoMC->GetParticle().Pt());
435 Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);
437 // distance to Prim. vertex
438 const Double_t* dv = infoMC->GetVDist();
439 Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();
441 // Check selection cuts
442 if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return;
444 if (infoRC->GetStatus(1)!=3) return;
445 if (!infoRC->GetESDtrack()) return;
446 if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;
447 if (!infoRC->GetESDtrack()->GetConstrainedParam()) return;
449 // calculate and set prim. vertex
450 fVertex->SetXv( infoMC->GetParticle().Vx() - dv[0] );
451 fVertex->SetYv( infoMC->GetParticle().Vy() - dv[1] );
452 fVertex->SetZv( infoMC->GetParticle().Vz() - dv[2] );
454 // constrained parameters resolution
455 const AliExternalTrackParam * cparam = infoRC->GetESDtrack()->GetConstrainedParam();
456 deltaPt= (mcpt-cparam->Pt())/mcpt;
457 pullPt= (1/mcpt-cparam->OneOverPt())/TMath::Sqrt(cparam->GetSigma1Pt2());
458 deltaPhi = TMath::ATan2(cparam->Py(),cparam->Px())-
459 TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
460 pullPhi = deltaPhi/TMath::Sqrt(cparam->GetSigmaSnp2());
461 deltaTan = TMath::ATan2(cparam->Pz(),cparam->Pt())-TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
462 pullTan = deltaPhi/TMath::Sqrt(cparam->GetSigmaSnp2());
465 delta1Pt2 = (1/mcpt-cparam->OneOverPt())/TMath::Power(1+1/mcpt,2);
467 deltaY1Pt = (infoMC->GetParticle().Vy()-cparam->GetY()) / (0.2+1/mcpt);
468 deltaZ1Pt = (infoMC->GetParticle().Vz()-cparam->GetZ()) / (0.2+1/mcpt);
469 deltaPhi1Pt = deltaPhi / (0.1+1/mcpt);
470 deltaTheta1Pt = deltaTan / (0.1+1/mcpt);
472 // calculate track parameters at vertex
473 const AliExternalTrackParam *innerTPC = 0;
474 if ((innerTPC = infoRC->GetESDtrack()->GetTPCInnerParam()) != 0)
476 if ((track = new AliExternalTrackParam(*infoRC->GetESDtrack()->GetTPCInnerParam())) != 0 )
478 Bool_t bDCAStatus = track->PropagateToDCA(fVertex,field,kMaxD,dca,cov);
480 // Fill parametrisation histograms (only TPC track)
483 deltaPtTPC= (mcpt-innerTPC->Pt())/mcpt;
484 pullPtTPC= (1/mcpt-innerTPC->OneOverPt())/TMath::Sqrt(innerTPC->GetSigma1Pt2());
485 deltaPhiTPC = TMath::ATan2(innerTPC->Py(),innerTPC->Px())-
486 TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
488 deltaTanTPC = TMath::ATan2(innerTPC->Pz(),innerTPC->Pt())-
489 TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
491 delta1Pt2TPC = (1/mcpt-innerTPC->OneOverPt())/TMath::Power(1+1/mcpt,2);
492 deltaY1PtTPC= (infoMC->GetParticle().Vy()-innerTPC->GetY()) / (0.2+1/mcpt);
493 deltaZ1PtTPC = (infoMC->GetParticle().Vz()-innerTPC->GetZ()) / (0.2+1/mcpt);
494 deltaPhi1PtTPC = deltaPhiTPC / (0.1+1/mcpt);
495 deltaTheta1PtTPC = deltaTanTPC / (0.1+1/mcpt);
497 fC1Pt2ResolS1PtTPC->Fill(s1mcpt,delta1Pt2TPC);
498 fCYResolS1PtTPC->Fill(s1mcpt,deltaY1PtTPC);
499 fCZResolS1PtTPC->Fill(s1mcpt,deltaZ1PtTPC);
500 fCPhiResolS1PtTPC->Fill(s1mcpt,deltaPhi1PtTPC);
501 fCThetaResolS1PtTPC->Fill(s1mcpt,deltaTheta1PtTPC);
507 // TPC and ITS (nb. of clusters >2) in the system
508 if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)>2)
510 fC1Pt2ResolS1PtTPCITS->Fill(s1mcpt,delta1Pt2);
511 fCYResolS1PtTPCITS->Fill(s1mcpt,deltaY1Pt);
512 fCZResolS1PtTPCITS->Fill(s1mcpt,deltaZ1Pt);
513 fCPhiResolS1PtTPCITS->Fill(s1mcpt,deltaPhi1Pt);
514 fCThetaResolS1PtTPCITS->Fill(s1mcpt,deltaTheta1Pt);
518 fCPtResolTan->Fill(tantheta,deltaPt);
519 fCPtPullTan->Fill(tantheta,pullPt);
520 fCPhiResolTan->Fill(tantheta,deltaPhi);
521 fCPhiPullTan->Fill(tantheta,pullPhi);
522 fCTanResolTan->Fill(tantheta,deltaTan);
523 fCTanPullTan->Fill(tantheta,pullTan);
526 //_____________________________________________________________________________
527 void AliComparisonRes::Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC){
529 // Process comparison information
530 Process(infoMC,infoRC);
531 ProcessConstrained(infoMC,infoRC);
534 //_____________________________________________________________________________
535 TH1F* AliComparisonRes::MakeResol(TH2F * his, Int_t integ, Bool_t type){
536 // Create resolution histograms
539 if (!gPad) new TCanvas;
540 hisr = AliTreeDraw::CreateResHistoI(his,&hism,integ);
541 if (type) return hism;
546 //_____________________________________________________________________________
547 void AliComparisonRes::Analyse(){
548 // Analyse comparison information and store output histograms
549 // in the folder "folderRes"
552 TH1::AddDirectory(kFALSE);
554 AliComparisonRes * comp=this;
555 //TFolder *folder = comp->GetAnalysisFolder();
557 TObjArray *aFolderObj = new TObjArray;
559 // write results in the folder
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->SetName("CptResolTan");
570 aFolderObj->Add(hiss);
573 hiss = comp->MakeResol(comp->fCPhiResolTan,1,0);
574 hiss->SetXTitle("Tan(#theta)");
575 hiss->SetYTitle("#sigma#phi (rad)");
577 hiss->SetName("PhiResolTan");
579 aFolderObj->Add(hiss);
581 hiss = comp->MakeResol(comp->fCTanResolTan,1,0);
582 hiss->SetXTitle("Tan(#theta)");
583 hiss->SetYTitle("#sigma#theta (rad)");
585 hiss->SetName("ThetaResolTan");
587 aFolderObj->Add(hiss);
589 hiss = comp->MakeResol(comp->fCPtPullTan,1,0);
590 hiss->SetXTitle("Tan(#theta)");
591 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/#Sigma(1/p_{t})");
593 hiss->SetName("CptPullTan");
595 aFolderObj->Add(hiss);
597 hiss = comp->MakeResol(comp->fC1Pt2ResolS1PtTPC,1,0);
598 hiss->SetXTitle("#sqrt(1/mcp_{t})");
599 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
601 hiss->SetName("C1Pt2ResolS1PtTPC");
603 aFolderObj->Add(hiss);
605 hiss = comp->MakeResol(comp->fC1Pt2ResolS1PtTPCITS,1,0);
606 hiss->SetXTitle("#sqrt(1/mcp_{t})");
607 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
609 hiss->SetName("C1Pt2ResolS1PtTPCITS");
611 aFolderObj->Add(hiss);
613 hiss = comp->MakeResol(comp->fCYResolS1PtTPC,1,0);
614 hiss->SetXTitle("#sqrt(1/mcp_{t})");
615 hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
617 hiss->SetName("CYResolS1PtTPC");
619 aFolderObj->Add(hiss);
621 hiss = comp->MakeResol(comp->fCYResolS1PtTPCITS,1,0);
622 hiss->SetXTitle("#sqrt(1/mcp_{t})");
623 hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
625 hiss->SetName("CYResolS1PtTPCITS");
627 aFolderObj->Add(hiss);
629 hiss = comp->MakeResol(comp->fCZResolS1PtTPC,1,0);
630 hiss->SetXTitle("#sqrt(1/mcp_{t})");
631 hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
633 hiss->SetName("CZResolS1PtTPC");
635 aFolderObj->Add(hiss);
637 hiss = comp->MakeResol(comp->fCZResolS1PtTPCITS,1,0);
638 hiss->SetXTitle("#sqrt(1/mcp_{t})");
639 hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
641 hiss->SetName("CZResolS1PtTPCITS");
643 aFolderObj->Add(hiss);
645 hiss = comp->MakeResol(comp->fCPhiResolS1PtTPC,1,0);
646 hiss->SetXTitle("#sqrt(1/mcp_{t})");
647 hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
649 hiss->SetName("CPhiResolS1PtTPC");
651 aFolderObj->Add(hiss);
653 hiss = comp->MakeResol(comp->fCPhiResolS1PtTPCITS,1,0);
654 hiss->SetXTitle("#sqrt(1/mcp_{t})");
655 hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
657 hiss->SetName("CPhiResolS1PtTPCITS");
659 aFolderObj->Add(hiss);
661 hiss = comp->MakeResol(comp->fCThetaResolS1PtTPC,1,0);
662 hiss->SetXTitle("#sqrt(1/mcp_{t})");
663 hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
665 hiss->SetName("CThetaResolS1PtTPC");
667 aFolderObj->Add(hiss);
669 hiss = comp->MakeResol(comp->fCThetaResolS1PtTPCITS,1,0);
670 hiss->SetXTitle("#sqrt(1/mcp_{t})");
671 hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
673 hiss->SetName("CThetaResolS1PtTPCITS");
675 aFolderObj->Add(hiss);
678 hiss = comp->MakeResol(comp->f1Pt2ResolS1PtTPC,1,0);
679 hiss->SetXTitle("#sqrt(1/mcp_{t})");
680 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
682 hiss->SetName("OnePt2ResolS1PtTPC");
684 aFolderObj->Add(hiss);
686 hiss = comp->MakeResol(comp->f1Pt2ResolS1PtTPCITS,1,0);
687 hiss->SetXTitle("#sqrt(1/mcp_{t})");
688 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
690 hiss->SetName("OnePt2ResolS1PtTPCITS");
692 aFolderObj->Add(hiss);
694 hiss = comp->MakeResol(comp->fYResolS1PtTPC,1,0);
695 hiss->SetXTitle("#sqrt(1/mcp_{t})");
696 hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
698 hiss->SetName("YResolS1PtTPC");
700 aFolderObj->Add(hiss);
702 hiss = comp->MakeResol(comp->fYResolS1PtTPCITS,1,0);
703 hiss->SetXTitle("#sqrt(1/mcp_{t})");
704 hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
706 hiss->SetName("YResolS1PtTPCITS");
708 aFolderObj->Add(hiss);
710 hiss = comp->MakeResol(comp->fZResolS1PtTPC,1,0);
711 hiss->SetXTitle("#sqrt(1/mcp_{t})");
712 hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
714 hiss->SetName("ZResolS1PtTPC");
716 aFolderObj->Add(hiss);
718 hiss = comp->MakeResol(comp->fZResolS1PtTPCITS,1,0);
719 hiss->SetXTitle("#sqrt(1/mcp_{t})");
720 hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
722 hiss->SetName("ZResolS1PtTPCITS");
724 aFolderObj->Add(hiss);
726 hiss = comp->MakeResol(comp->fPhiResolS1PtTPC,1,0);
727 hiss->SetXTitle("#sqrt(1/mcp_{t})");
728 hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
730 hiss->SetName("PhiResolS1PtTPC");
732 aFolderObj->Add(hiss);
734 hiss = comp->MakeResol(comp->fPhiResolS1PtTPCITS,1,0);
735 hiss->SetXTitle("#sqrt(1/mcp_{t})");
736 hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
738 hiss->SetName("PhiResolS1PtTPCITS");
740 aFolderObj->Add(hiss);
742 hiss = comp->MakeResol(comp->fThetaResolS1PtTPC,1,0);
743 hiss->SetXTitle("#sqrt(1/mcp_{t})");
744 hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
746 hiss->SetName("ThetaResolS1PtTPC");
748 aFolderObj->Add(hiss);
750 hiss = comp->MakeResol(comp->fThetaResolS1PtTPCITS,1,0);
751 hiss->SetXTitle("#sqrt(1/mcp_{t})");
752 hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
754 hiss->SetName("ThetaResolS1PtTPCITS");
756 aFolderObj->Add(hiss);
758 // export objects to analysis folder
759 fAnalysisFolder = ExportToFolder(aFolderObj);
761 // delete only TObjArray
762 if(aFolderObj) delete aFolderObj;
765 //_____________________________________________________________________________
766 TFolder* AliComparisonRes::ExportToFolder(TObjArray * array)
768 // recreate folder avery time and export objects to new one
770 AliComparisonRes * comp=this;
771 TFolder *folder = comp->GetAnalysisFolder();
774 TFolder *newFolder = 0;
776 Int_t size = array->GetSize();
779 // get name and title from old folder
780 name = folder->GetName();
781 title = folder->GetTitle();
787 newFolder = CreateFolder(name.Data(),title.Data());
788 newFolder->SetOwner();
790 // add objects to folder
792 newFolder->Add(array->At(i));
800 //_____________________________________________________________________________
801 Long64_t AliComparisonRes::Merge(TCollection* list)
803 // Merge list of objects (needed by PROOF)
811 TIterator* iter = list->MakeIterator();
814 // collection of generated histograms
816 while((obj = iter->Next()) != 0)
818 AliComparisonRes* entry = dynamic_cast<AliComparisonRes*>(obj);
819 if (entry == 0) continue;
821 fPtResolLPT->Add(entry->fPtResolLPT);
822 fPtResolHPT->Add(entry->fPtResolHPT);
823 fPtPullLPT->Add(entry->fPtPullLPT);
824 fPtPullHPT->Add(entry->fPtPullHPT);
826 // Histograms for 1/pt parameterisation
827 f1Pt2ResolS1PtTPC->Add(entry->f1Pt2ResolS1PtTPC);
828 fYResolS1PtTPC->Add(entry->fYResolS1PtTPC);
829 fZResolS1PtTPC->Add(entry->fZResolS1PtTPC);
830 fPhiResolS1PtTPC->Add(entry->fPhiResolS1PtTPC);
831 fThetaResolS1PtTPC->Add(entry->fThetaResolS1PtTPC);
833 f1Pt2ResolS1PtTPCITS->Add(entry->f1Pt2ResolS1PtTPCITS);
834 fYResolS1PtTPCITS->Add(entry->fYResolS1PtTPCITS);
835 fZResolS1PtTPCITS->Add(entry->fZResolS1PtTPCITS);
836 fPhiResolS1PtTPCITS->Add(entry->fPhiResolS1PtTPCITS);
837 fThetaResolS1PtTPCITS->Add(entry->fThetaResolS1PtTPCITS);
839 // Resolution histograms (constrained param)
840 fCPhiResolTan->Add(entry->fCPhiResolTan);
841 fCTanResolTan->Add(entry->fCTanResolTan);
842 fCPtResolTan->Add(entry->fCPtResolTan);
843 fCPhiPullTan->Add(entry->fCPhiPullTan);
844 fCTanPullTan->Add(entry->fCTanPullTan);
845 fCPtPullTan->Add(entry->fCPtPullTan);
847 // Histograms for 1/pt parameterisation (constrained)
848 fC1Pt2ResolS1PtTPC->Add(entry->fC1Pt2ResolS1PtTPC);
849 fCYResolS1PtTPC->Add(entry->fCYResolS1PtTPC);
850 fCZResolS1PtTPC->Add(entry->fCZResolS1PtTPC);
851 fCPhiResolS1PtTPC->Add(entry->fCPhiResolS1PtTPC);
852 fCThetaResolS1PtTPC->Add(entry->fCThetaResolS1PtTPC);
854 fC1Pt2ResolS1PtTPCITS->Add(entry->fC1Pt2ResolS1PtTPCITS);
855 fCYResolS1PtTPCITS->Add(entry->fCYResolS1PtTPCITS);
856 fCZResolS1PtTPCITS->Add(entry->fCZResolS1PtTPCITS);
857 fCPhiResolS1PtTPCITS->Add(entry->fCPhiResolS1PtTPCITS);
858 fCThetaResolS1PtTPCITS->Add(entry->fCThetaResolS1PtTPCITS);
866 //_____________________________________________________________________________
867 TFolder* AliComparisonRes::CreateFolder(TString name,TString title) {
868 // create folder for analysed histograms
871 folder = new TFolder(name.Data(),title.Data());