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 gROOT->LoadMacro("$ALICE_ROOT/PWG1/Macros/LoadMyLibs.C");
19 TFile f("Output.root");
20 AliComparisonRes * compObj = (AliComparisonRes*)f.Get("AliComparisonRes");
22 // analyse comparison data
25 // the output histograms/graphs will be stored in the folder "folderRes"
26 compObj->GetAnalysisFolder()->ls("*");
28 // user can save whole comparison object (or only folder with anlysed histograms)
29 // in the seperate output file (e.g.)
30 TFile fout("Analysed_Res.root","recreate");
31 compObj->Write(); // compObj->GetAnalysisFolder()->Write();
44 #include "TProfile2D.h"
49 #include "AliESDEvent.h"
51 #include "AliESDfriend.h"
52 #include "AliESDfriendTrack.h"
53 #include "AliESDVertex.h"
54 #include "AliRecInfoCuts.h"
55 #include "AliMCInfoCuts.h"
57 #include "AliTracker.h"
59 #include "AliMathBase.h"
60 #include "AliTreeDraw.h"
62 #include "AliMCInfo.h"
63 #include "AliESDRecInfo.h"
64 #include "AliComparisonRes.h"
68 ClassImp(AliComparisonRes)
70 //_____________________________________________________________________________
71 AliComparisonRes::AliComparisonRes():
72 AliComparisonObject("AliComparisonRes"),
75 fPtResolLPT(0), // pt resolution - low pt
76 fPtResolHPT(0), // pt resolution - high pt
77 fPtPullLPT(0), // pt resolution - low pt
78 fPtPullHPT(0), // pt resolution - high pt
80 // Resolution constrained param
82 fCPhiResolTan(0), // angular resolution - constrained
83 fCTanResolTan(0), // angular resolution - constrained
84 fCPtResolTan(0), // pt resolution - constrained
85 fCPhiPullTan(0), // angular resolution - constrained
86 fCTanPullTan(0), // angular resolution - constrained
87 fCPtPullTan(0), // pt resolution - constrained
90 // Parametrisation histograms
94 f1Pt2ResolS1PtTPCITS(0),
100 fPhiResolS1PtTPCITS(0),
101 fThetaResolS1PtTPC(0),
102 fThetaResolS1PtTPCITS(0),
105 fC1Pt2ResolS1PtTPC(0),
106 fC1Pt2ResolS1PtTPCITS(0),
108 fCYResolS1PtTPCITS(0),
110 fCZResolS1PtTPCITS(0),
111 fCPhiResolS1PtTPC(0),
112 fCPhiResolS1PtTPCITS(0),
113 fCThetaResolS1PtTPC(0),
114 fCThetaResolS1PtTPCITS(0),
129 fVertex = new AliESDVertex();
135 //_____________________________________________________________________________
136 AliComparisonRes::~AliComparisonRes(){
138 // Resolution histograms
139 if(fPtResolLPT) delete fPtResolLPT; fPtResolLPT=0;
140 if(fPtResolHPT) delete fPtResolHPT; fPtResolHPT=0;
141 if(fPtPullLPT) delete fPtPullLPT; fPtPullLPT=0;
142 if(fPtPullHPT) delete fPtPullHPT; fPtPullHPT=0;
144 // Resolution histograms (constrained param)
145 if(fCPhiResolTan) delete fCPhiResolTan; fCPhiResolTan=0;
146 if(fCTanResolTan) delete fCTanResolTan; fCTanResolTan=0;
147 if(fCPtResolTan) delete fCPtResolTan; fCPtResolTan=0;
148 if(fCPhiPullTan) delete fCPhiPullTan; fCPhiPullTan=0;
149 if(fCTanPullTan) delete fCTanPullTan; fCTanPullTan=0;
150 if(fCPtPullTan) delete fCPtPullTan; fCPtPullTan=0;
152 // Parametrisation histograms
154 if(f1Pt2ResolS1PtTPC) delete f1Pt2ResolS1PtTPC; f1Pt2ResolS1PtTPC=0;
155 if(f1Pt2ResolS1PtTPCITS) delete f1Pt2ResolS1PtTPCITS; f1Pt2ResolS1PtTPCITS=0;
156 if(fYResolS1PtTPC) delete fYResolS1PtTPC; fYResolS1PtTPC=0;
157 if(fYResolS1PtTPCITS) delete fYResolS1PtTPCITS; fYResolS1PtTPCITS=0;
158 if(fZResolS1PtTPC) delete fZResolS1PtTPC; fZResolS1PtTPC=0;
159 if(fZResolS1PtTPCITS) delete fZResolS1PtTPCITS; fZResolS1PtTPCITS=0;
160 if(fPhiResolS1PtTPC) delete fPhiResolS1PtTPC; fPhiResolS1PtTPC=0;
161 if(fPhiResolS1PtTPCITS) delete fPhiResolS1PtTPCITS; fPhiResolS1PtTPCITS=0;
162 if(fThetaResolS1PtTPC) delete fThetaResolS1PtTPC; fThetaResolS1PtTPC=0;
163 if(fThetaResolS1PtTPCITS) delete fThetaResolS1PtTPCITS; fThetaResolS1PtTPCITS=0;
166 if(fC1Pt2ResolS1PtTPC) delete fC1Pt2ResolS1PtTPC; fC1Pt2ResolS1PtTPC=0;
167 if(fC1Pt2ResolS1PtTPCITS) delete fC1Pt2ResolS1PtTPCITS; fC1Pt2ResolS1PtTPCITS=0;
168 if(fCYResolS1PtTPC) delete fCYResolS1PtTPC; fCYResolS1PtTPC=0;
169 if(fCYResolS1PtTPCITS) delete fCYResolS1PtTPCITS; fCYResolS1PtTPCITS=0;
170 if(fCZResolS1PtTPC) delete fCZResolS1PtTPC; fCZResolS1PtTPC=0;
171 if(fCZResolS1PtTPCITS) delete fCZResolS1PtTPCITS; fCZResolS1PtTPCITS=0;
172 if(fCPhiResolS1PtTPC) delete fCPhiResolS1PtTPC; fCPhiResolS1PtTPC=0;
173 if(fCPhiResolS1PtTPCITS) delete fCPhiResolS1PtTPCITS; fCPhiResolS1PtTPCITS=0;
174 if(fCThetaResolS1PtTPC) delete fCThetaResolS1PtTPC; fCThetaResolS1PtTPC=0;
175 if(fCThetaResolS1PtTPCITS) delete fCThetaResolS1PtTPCITS; fCThetaResolS1PtTPCITS=0;
177 if(fVertex) delete fVertex; fVertex=0;
179 if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;
182 //_____________________________________________________________________________
183 void AliComparisonRes::Init(){
186 fCPhiResolTan = new TH2F("CPhiResolTan","CPhiResolTan",50, -2,2,200,-0.025,0.025);
187 fCPhiResolTan->SetXTitle("tan(#theta)");
188 fCPhiResolTan->SetYTitle("#Delta#phi");
190 fCTanResolTan = new TH2F("CTanResolTan","CTanResolTan",50, -2,2,200,-0.025,0.025);
191 fCTanResolTan->SetXTitle("tan(#theta)");
192 fCTanResolTan->SetYTitle("#Delta#theta");
194 fCPtResolTan=new TH2F("CPtResol","CPtResol",50, -2,2,200,-0.2,0.2);
195 fCPtResolTan->SetXTitle("Tan(#theta)");
196 fCPtResolTan->SetYTitle("#Deltap_{t}/p_{t}");
198 fCPhiPullTan = new TH2F("CPhiPullTan","CPhiPullTan",50, -2,2,200,-5,5);
199 fCPhiPullTan->SetXTitle("Tan(#theta)");
200 fCPhiPullTan->SetYTitle("#Delta#phi/#Sigma");
202 fCTanPullTan = new TH2F("CTanPullTan","CTanPullTan",50, -2,2,200,-5,5);
203 fCTanPullTan->SetXTitle("Tan(#theta)");
204 fCTanPullTan->SetYTitle("#Delta#theta/#Sigma");
206 fCPtPullTan=new TH2F("CPtPull","CPtPull",50, -2,2,200,-5,5);
207 fCPtPullTan->SetXTitle("Tan(#theta)");
208 fCPtPullTan->SetYTitle("(1/mcp_{t}-1/p_{t})/#Sigma");
210 fPtResolLPT = new TH2F("Pt_resol_lpt","pt resol",10, 0.1,3,200,-0.2,0.2);
211 fPtResolLPT->SetXTitle("p_{t}");
212 fPtResolLPT->SetYTitle("#Deltap_{t}/p_{t}");
214 fPtResolHPT = new TH2F("Pt_resol_hpt","pt resol",10, 2,100,200,-0.3,0.3);
215 fPtResolHPT->SetXTitle("p_{t}");
216 fPtResolHPT->SetYTitle("#Deltap_{t}/p_{t}");
218 fPtPullLPT = new TH2F("Pt_pull_lpt","pt pull",10, 0.1,3,200,-6,6);
219 fPtPullLPT->SetXTitle("p_{t}");
220 fPtPullLPT->SetYTitle("#Deltap_{t}/#Sigma");
222 fPtPullHPT = new TH2F("Pt_pull_hpt","pt pull",10,2,100,200,-6,6);
223 fPtPullHPT->SetXTitle("p_{t}");
224 fPtPullHPT->SetYTitle("#Deltap_{t}/#Sigma");
227 // Parametrisation histograms
230 f1Pt2ResolS1PtTPC = new TH2F("f1Pt2ResolS1PtTPC","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs sqrt(1/pt))",100,0,3,200,-0.010,0.010);
231 f1Pt2ResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
232 f1Pt2ResolS1PtTPC->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
234 f1Pt2ResolS1PtTPCITS = new TH2F("f1Pt2ResolS1PtTPCITS","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs sqrt(1/pt))",100,0,3,200,-0.010,0.010);
235 f1Pt2ResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
236 f1Pt2ResolS1PtTPCITS->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
238 fYResolS1PtTPC = new TH2F("fYResolS1PtTPC","fYResolS1PtTPC",100, 0,3,200,-1.0,1.0);
239 fYResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
240 fYResolS1PtTPC->SetYTitle("#DeltaY");
242 fYResolS1PtTPCITS = new TH2F("fYResolS1PtTPCITS","fYResolS1PtTPCITS",100, 0,3,200,-0.05,0.05);
243 fYResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
244 fYResolS1PtTPCITS->SetYTitle("#DeltaY");
246 fZResolS1PtTPC = new TH2F("fZResolS1PtTPC","fZResolS1PtTPC",100, 0,3,200,-1.0,1.0);
247 fZResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
248 fZResolS1PtTPC->SetYTitle("#DeltaZ");
250 fZResolS1PtTPCITS = new TH2F("fZResolS1PtTPCITS","fZResolS1PtTPCITS",100, 0,3,200,-0.05,0.05);
251 fZResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
252 fZResolS1PtTPCITS->SetYTitle("#DeltaZ");
254 fPhiResolS1PtTPC = new TH2F("fPhiResolS1PtTPC","fPhiResolS1PtTPC",100, 0,3,200,-0.025,0.025);
255 fPhiResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
256 fPhiResolS1PtTPC->SetYTitle("#Delta#phi");
258 fPhiResolS1PtTPCITS = new TH2F("fPhiResolS1PtTPCITS","fPhiResolS1PtTPCITS",100, 0,3,200,-0.01,0.01);
259 fPhiResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
260 fPhiResolS1PtTPCITS->SetYTitle("#Delta#phi");
262 fThetaResolS1PtTPC = new TH2F("fThetaResolS1PtTPC","fThetaResolS1PtTPC",100, 0,3,200,-0.025,0.025);
263 fThetaResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
264 fThetaResolS1PtTPC->SetYTitle("#Delta#theta");
266 fThetaResolS1PtTPCITS = new TH2F("fThetaResolS1PtTPCITS","fThetaResolS1PtTPCITS",100, 0,3,200,-0.01,0.01);
267 fThetaResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
268 fThetaResolS1PtTPCITS->SetYTitle("#Delta#theta");
271 fC1Pt2ResolS1PtTPC = new TH2F("fC1Pt2ResolS1PtTPC","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs 1/pt)",100,0,3,200,-0.010,0.010);
272 fC1Pt2ResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
273 fC1Pt2ResolS1PtTPC->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
275 fC1Pt2ResolS1PtTPCITS = new TH2F("fC1Pt2ResolS1PtTPCITS","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs 1/pt)",100,0,3,200,-0.010,0.010);
276 fC1Pt2ResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
277 fC1Pt2ResolS1PtTPCITS->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
279 fCYResolS1PtTPC = new TH2F("fCYResolS1PtTPC","fCYResolS1PtTPC",100, 0,3,200,-1.0,1.0);
280 fCYResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
281 fCYResolS1PtTPC->SetYTitle("#DeltaY");
283 fCYResolS1PtTPCITS = new TH2F("fCYResolS1PtTPCITS","fCYResolS1PtTPCITS",100, 0,3,200,-0.01,0.01);
284 fCYResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
285 fCYResolS1PtTPCITS->SetYTitle("#DeltaY");
287 fCZResolS1PtTPC = new TH2F("fCZResolS1PtTPC","fCZResolS1PtTPC",100, 0,3,200,-1.0,1.0);
288 fCZResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
289 fCZResolS1PtTPC->SetYTitle("#DeltaZ");
291 fCZResolS1PtTPCITS = new TH2F("fCZResolS1PtTPCITS","fCZResolS1PtTPCITS",100, 0,3,200,-0.025,0.025);
292 fCZResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
293 fCZResolS1PtTPCITS->SetYTitle("#DeltaZ");
295 fCPhiResolS1PtTPC = new TH2F("fCPhiResolS1PtTPC","fCPhiResolS1PtTPC",100, 0,3,200,-0.025,0.025);
296 fCPhiResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
297 fCPhiResolS1PtTPC->SetYTitle("#Delta#phi");
299 fCPhiResolS1PtTPCITS = new TH2F("fCPhiResolS1PtTPCITS","fCPhiResolS1PtTPCITS",100, 0,3,200,-0.003,0.003);
300 fCPhiResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
301 fCPhiResolS1PtTPCITS->SetYTitle("#Delta#phi");
303 fCThetaResolS1PtTPC = new TH2F("fCThetaResolS1PtTPC","fCThetaResolS1PtTPC",100, 0,3,200,-0.025,0.025);
304 fCThetaResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
305 fCThetaResolS1PtTPC->SetYTitle("#Delta#theta");
307 fCThetaResolS1PtTPCITS = new TH2F("fCThetaResolS1PtTPCITS","fCThetaResolS1PtTPCITS",100, 0,3,200,-0.005,0.005);
308 fCThetaResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
309 fCThetaResolS1PtTPCITS->SetYTitle("#Delta#theta");
313 AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object");
315 AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object");
318 fAnalysisFolder = CreateFolder("folderRes","Analysis Resolution Folder");
321 //_____________________________________________________________________________
322 void AliComparisonRes::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
324 // Fill resolution comparison information
325 AliExternalTrackParam *track = 0;
326 Double_t field = AliTracker::GetBz(); // nominal Bz field [kG]
327 Double_t kMaxD = 123456.0; // max distance
329 Int_t clusterITS[200];
330 Double_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
332 Float_t deltaPt, pullPt, deltaPhi, deltaTan, delta1Pt2, deltaY1Pt, deltaZ1Pt, deltaPhi1Pt, deltaTheta1Pt;
333 Float_t deltaPtTPC, pullPtTPC, deltaPhiTPC, deltaTanTPC, delta1Pt2TPC, deltaY1PtTPC, deltaZ1PtTPC, deltaPhi1PtTPC, deltaTheta1PtTPC;
335 Float_t mcpt = infoMC->GetParticle().Pt();
336 Float_t s1mcpt = TMath::Sqrt(1./infoMC->GetParticle().Pt());
338 // distance to Prim. vertex
339 const Double_t* dv = infoMC->GetVDist();
340 Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();
342 // Check selection cuts
343 if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return;
345 if (infoRC->GetStatus(1)!=3) return; // TPC refit
346 if (!infoRC->GetESDtrack()) return;
347 if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;
349 // calculate and set prim. vertex
350 fVertex->SetXv( infoMC->GetParticle().Vx() - dv[0] );
351 fVertex->SetYv( infoMC->GetParticle().Vy() - dv[1] );
352 fVertex->SetZv( infoMC->GetParticle().Vz() - dv[2] );
354 deltaPt= (mcpt-infoRC->GetESDtrack()->Pt())/mcpt;
355 pullPt= (1/mcpt-infoRC->GetESDtrack()->OneOverPt())/TMath::Sqrt(infoRC->GetESDtrack()->GetSigma1Pt2());
356 deltaPhi = TMath::ATan2(infoRC->GetESDtrack()->Py(),infoRC->GetESDtrack()->Px())-
357 TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
359 deltaTan = TMath::ATan2(infoRC->GetESDtrack()->Pz(),infoRC->GetESDtrack()->Pt())-
360 TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
362 delta1Pt2 = (1/mcpt-infoRC->GetESDtrack()->OneOverPt())/TMath::Power(1+1/mcpt,2);
363 deltaY1Pt = (infoMC->GetParticle().Vy()-infoRC->GetESDtrack()->GetY()) / (0.2+1/mcpt);
364 deltaZ1Pt = (infoMC->GetParticle().Vz()-infoRC->GetESDtrack()->GetZ()) / (0.2+1/mcpt);
365 deltaPhi1Pt = deltaPhi / (0.1+1/mcpt);
366 deltaTheta1Pt = deltaTan / (0.1+1/mcpt);
368 // calculate track parameters at vertex
369 const AliExternalTrackParam *innerTPC = 0;
370 if ((innerTPC = infoRC->GetESDtrack()->GetTPCInnerParam()) != 0)
372 if ((track = new AliExternalTrackParam(*infoRC->GetESDtrack()->GetTPCInnerParam())) != 0 )
374 Bool_t bDCAStatus = track->PropagateToDCA(fVertex,field,kMaxD,dca,cov);
376 // Fill parametrisation histograms (only TPC track)
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 f1Pt2ResolS1PtTPC->Fill(s1mcpt,delta1Pt2TPC);
394 fYResolS1PtTPC->Fill(s1mcpt,deltaY1PtTPC);
395 fZResolS1PtTPC->Fill(s1mcpt,deltaZ1PtTPC);
396 fPhiResolS1PtTPC->Fill(s1mcpt,deltaPhi1PtTPC);
397 fThetaResolS1PtTPC->Fill(s1mcpt,deltaTheta1PtTPC);
403 // TPC and ITS (nb. of clusters >2) in the system
404 if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)>2)
406 f1Pt2ResolS1PtTPCITS->Fill(s1mcpt,delta1Pt2);
407 fYResolS1PtTPCITS->Fill(s1mcpt,deltaY1Pt);
408 fZResolS1PtTPCITS->Fill(s1mcpt,deltaZ1Pt);
409 fPhiResolS1PtTPCITS->Fill(s1mcpt,deltaPhi1Pt);
410 fThetaResolS1PtTPCITS->Fill(s1mcpt,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 field = AliTracker::GetBz(); // nominal Bz field [kG]
427 Double_t kMaxD = 123456.0; // max distance
429 Int_t clusterITS[200];
430 Double_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
432 Float_t deltaPt, pullPt, deltaPhi, pullPhi, deltaTan, pullTan, delta1Pt2, deltaY1Pt, deltaZ1Pt, deltaPhi1Pt, deltaTheta1Pt;
433 Float_t deltaPtTPC, pullPtTPC, deltaPhiTPC, deltaTanTPC, delta1Pt2TPC, deltaY1PtTPC, deltaZ1PtTPC, deltaPhi1PtTPC, deltaTheta1PtTPC;
435 Float_t mcpt = infoMC->GetParticle().Pt();
436 Float_t s1mcpt = TMath::Sqrt(1./infoMC->GetParticle().Pt());
437 Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);
439 // distance to Prim. vertex
440 const Double_t* dv = infoMC->GetVDist();
441 Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();
443 // Check selection cuts
444 if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return;
446 if (infoRC->GetStatus(1)!=3) return;
447 if (!infoRC->GetESDtrack()) return;
448 if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;
449 if (!infoRC->GetESDtrack()->GetConstrainedParam()) return;
451 // calculate and set prim. vertex
452 fVertex->SetXv( infoMC->GetParticle().Vx() - dv[0] );
453 fVertex->SetYv( infoMC->GetParticle().Vy() - dv[1] );
454 fVertex->SetZv( infoMC->GetParticle().Vz() - dv[2] );
456 // constrained parameters resolution
457 const AliExternalTrackParam * cparam = infoRC->GetESDtrack()->GetConstrainedParam();
458 deltaPt= (mcpt-cparam->Pt())/mcpt;
459 pullPt= (1/mcpt-cparam->OneOverPt())/TMath::Sqrt(cparam->GetSigma1Pt2());
460 deltaPhi = TMath::ATan2(cparam->Py(),cparam->Px())-
461 TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
462 pullPhi = deltaPhi/TMath::Sqrt(cparam->GetSigmaSnp2());
463 deltaTan = TMath::ATan2(cparam->Pz(),cparam->Pt())-TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
464 pullTan = deltaPhi/TMath::Sqrt(cparam->GetSigmaSnp2());
467 delta1Pt2 = (1/mcpt-cparam->OneOverPt())/TMath::Power(1+1/mcpt,2);
469 deltaY1Pt = (infoMC->GetParticle().Vy()-cparam->GetY()) / (0.2+1/mcpt);
470 deltaZ1Pt = (infoMC->GetParticle().Vz()-cparam->GetZ()) / (0.2+1/mcpt);
471 deltaPhi1Pt = deltaPhi / (0.1+1/mcpt);
472 deltaTheta1Pt = deltaTan / (0.1+1/mcpt);
474 // calculate track parameters at vertex
475 const AliExternalTrackParam *innerTPC = 0;
476 if ((innerTPC = infoRC->GetESDtrack()->GetTPCInnerParam()) != 0)
478 if ((track = new AliExternalTrackParam(*infoRC->GetESDtrack()->GetTPCInnerParam())) != 0 )
480 Bool_t bDCAStatus = track->PropagateToDCA(fVertex,field,kMaxD,dca,cov);
482 // Fill parametrisation histograms (only TPC track)
485 deltaPtTPC= (mcpt-innerTPC->Pt())/mcpt;
486 pullPtTPC= (1/mcpt-innerTPC->OneOverPt())/TMath::Sqrt(innerTPC->GetSigma1Pt2());
487 deltaPhiTPC = TMath::ATan2(innerTPC->Py(),innerTPC->Px())-
488 TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
490 deltaTanTPC = TMath::ATan2(innerTPC->Pz(),innerTPC->Pt())-
491 TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
493 delta1Pt2TPC = (1/mcpt-innerTPC->OneOverPt())/TMath::Power(1+1/mcpt,2);
494 deltaY1PtTPC= (infoMC->GetParticle().Vy()-innerTPC->GetY()) / (0.2+1/mcpt);
495 deltaZ1PtTPC = (infoMC->GetParticle().Vz()-innerTPC->GetZ()) / (0.2+1/mcpt);
496 deltaPhi1PtTPC = deltaPhiTPC / (0.1+1/mcpt);
497 deltaTheta1PtTPC = deltaTanTPC / (0.1+1/mcpt);
499 fC1Pt2ResolS1PtTPC->Fill(s1mcpt,delta1Pt2TPC);
500 fCYResolS1PtTPC->Fill(s1mcpt,deltaY1PtTPC);
501 fCZResolS1PtTPC->Fill(s1mcpt,deltaZ1PtTPC);
502 fCPhiResolS1PtTPC->Fill(s1mcpt,deltaPhi1PtTPC);
503 fCThetaResolS1PtTPC->Fill(s1mcpt,deltaTheta1PtTPC);
509 // TPC and ITS (nb. of clusters >2) in the system
510 if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)>2)
512 fC1Pt2ResolS1PtTPCITS->Fill(s1mcpt,delta1Pt2);
513 fCYResolS1PtTPCITS->Fill(s1mcpt,deltaY1Pt);
514 fCZResolS1PtTPCITS->Fill(s1mcpt,deltaZ1Pt);
515 fCPhiResolS1PtTPCITS->Fill(s1mcpt,deltaPhi1Pt);
516 fCThetaResolS1PtTPCITS->Fill(s1mcpt,deltaTheta1Pt);
520 fCPtResolTan->Fill(tantheta,deltaPt);
521 fCPtPullTan->Fill(tantheta,pullPt);
522 fCPhiResolTan->Fill(tantheta,deltaPhi);
523 fCPhiPullTan->Fill(tantheta,pullPhi);
524 fCTanResolTan->Fill(tantheta,deltaTan);
525 fCTanPullTan->Fill(tantheta,pullTan);
528 //_____________________________________________________________________________
529 void AliComparisonRes::Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC){
531 // Process comparison information
532 Process(infoMC,infoRC);
533 ProcessConstrained(infoMC,infoRC);
536 //_____________________________________________________________________________
537 TH1F* AliComparisonRes::MakeResol(TH2F * his, Int_t integ, Bool_t type){
538 // Create resolution histograms
541 if (!gPad) new TCanvas;
542 hisr = AliTreeDraw::CreateResHistoI(his,&hism,integ);
543 if (type) return hism;
548 //_____________________________________________________________________________
549 void AliComparisonRes::Analyse(){
550 // Analyse comparison information and store output histograms
551 // in the folder "folderRes"
554 TH1::AddDirectory(kFALSE);
556 AliComparisonRes * comp=this;
557 //TFolder *folder = comp->GetAnalysisFolder();
559 TObjArray *aFolderObj = new TObjArray;
561 // write results in the folder
563 TCanvas * c = new TCanvas("Phi resol Tan","Phi resol Tan");
566 hiss = comp->MakeResol(comp->fCPtResolTan,1,0);
567 hiss->SetXTitle("Tan(#theta)");
568 hiss->SetYTitle("#sigmap_{t}/p_{t}");
570 hiss->SetName("CptResolTan");
572 aFolderObj->Add(hiss);
575 hiss = comp->MakeResol(comp->fCPhiResolTan,1,0);
576 hiss->SetXTitle("Tan(#theta)");
577 hiss->SetYTitle("#sigma#phi (rad)");
579 hiss->SetName("PhiResolTan");
581 aFolderObj->Add(hiss);
583 hiss = comp->MakeResol(comp->fCTanResolTan,1,0);
584 hiss->SetXTitle("Tan(#theta)");
585 hiss->SetYTitle("#sigma#theta (rad)");
587 hiss->SetName("ThetaResolTan");
589 aFolderObj->Add(hiss);
591 hiss = comp->MakeResol(comp->fCPtPullTan,1,0);
592 hiss->SetXTitle("Tan(#theta)");
593 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/#Sigma(1/p_{t})");
595 hiss->SetName("CptPullTan");
597 aFolderObj->Add(hiss);
599 hiss = comp->MakeResol(comp->fC1Pt2ResolS1PtTPC,1,0);
600 hiss->SetXTitle("#sqrt(1/mcp_{t})");
601 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
603 hiss->SetName("C1Pt2ResolS1PtTPC");
605 aFolderObj->Add(hiss);
607 hiss = comp->MakeResol(comp->fC1Pt2ResolS1PtTPCITS,1,0);
608 hiss->SetXTitle("#sqrt(1/mcp_{t})");
609 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
611 hiss->SetName("C1Pt2ResolS1PtTPCITS");
613 aFolderObj->Add(hiss);
615 hiss = comp->MakeResol(comp->fCYResolS1PtTPC,1,0);
616 hiss->SetXTitle("#sqrt(1/mcp_{t})");
617 hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
619 hiss->SetName("CYResolS1PtTPC");
621 aFolderObj->Add(hiss);
623 hiss = comp->MakeResol(comp->fCYResolS1PtTPCITS,1,0);
624 hiss->SetXTitle("#sqrt(1/mcp_{t})");
625 hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
627 hiss->SetName("CYResolS1PtTPCITS");
629 aFolderObj->Add(hiss);
631 hiss = comp->MakeResol(comp->fCZResolS1PtTPC,1,0);
632 hiss->SetXTitle("#sqrt(1/mcp_{t})");
633 hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
635 hiss->SetName("CZResolS1PtTPC");
637 aFolderObj->Add(hiss);
639 hiss = comp->MakeResol(comp->fCZResolS1PtTPCITS,1,0);
640 hiss->SetXTitle("#sqrt(1/mcp_{t})");
641 hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
643 hiss->SetName("CZResolS1PtTPCITS");
645 aFolderObj->Add(hiss);
647 hiss = comp->MakeResol(comp->fCPhiResolS1PtTPC,1,0);
648 hiss->SetXTitle("#sqrt(1/mcp_{t})");
649 hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
651 hiss->SetName("CPhiResolS1PtTPC");
653 aFolderObj->Add(hiss);
655 hiss = comp->MakeResol(comp->fCPhiResolS1PtTPCITS,1,0);
656 hiss->SetXTitle("#sqrt(1/mcp_{t})");
657 hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
659 hiss->SetName("CPhiResolS1PtTPCITS");
661 aFolderObj->Add(hiss);
663 hiss = comp->MakeResol(comp->fCThetaResolS1PtTPC,1,0);
664 hiss->SetXTitle("#sqrt(1/mcp_{t})");
665 hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
667 hiss->SetName("CThetaResolS1PtTPC");
669 aFolderObj->Add(hiss);
671 hiss = comp->MakeResol(comp->fCThetaResolS1PtTPCITS,1,0);
672 hiss->SetXTitle("#sqrt(1/mcp_{t})");
673 hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
675 hiss->SetName("CThetaResolS1PtTPCITS");
677 aFolderObj->Add(hiss);
680 hiss = comp->MakeResol(comp->f1Pt2ResolS1PtTPC,1,0);
681 hiss->SetXTitle("#sqrt(1/mcp_{t})");
682 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
684 hiss->SetName("OnePt2ResolS1PtTPC");
686 aFolderObj->Add(hiss);
688 hiss = comp->MakeResol(comp->f1Pt2ResolS1PtTPCITS,1,0);
689 hiss->SetXTitle("#sqrt(1/mcp_{t})");
690 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
692 hiss->SetName("OnePt2ResolS1PtTPCITS");
694 aFolderObj->Add(hiss);
696 hiss = comp->MakeResol(comp->fYResolS1PtTPC,1,0);
697 hiss->SetXTitle("#sqrt(1/mcp_{t})");
698 hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
700 hiss->SetName("YResolS1PtTPC");
702 aFolderObj->Add(hiss);
704 hiss = comp->MakeResol(comp->fYResolS1PtTPCITS,1,0);
705 hiss->SetXTitle("#sqrt(1/mcp_{t})");
706 hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
708 hiss->SetName("YResolS1PtTPCITS");
710 aFolderObj->Add(hiss);
712 hiss = comp->MakeResol(comp->fZResolS1PtTPC,1,0);
713 hiss->SetXTitle("#sqrt(1/mcp_{t})");
714 hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
716 hiss->SetName("ZResolS1PtTPC");
718 aFolderObj->Add(hiss);
720 hiss = comp->MakeResol(comp->fZResolS1PtTPCITS,1,0);
721 hiss->SetXTitle("#sqrt(1/mcp_{t})");
722 hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
724 hiss->SetName("ZResolS1PtTPCITS");
726 aFolderObj->Add(hiss);
728 hiss = comp->MakeResol(comp->fPhiResolS1PtTPC,1,0);
729 hiss->SetXTitle("#sqrt(1/mcp_{t})");
730 hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
732 hiss->SetName("PhiResolS1PtTPC");
734 aFolderObj->Add(hiss);
736 hiss = comp->MakeResol(comp->fPhiResolS1PtTPCITS,1,0);
737 hiss->SetXTitle("#sqrt(1/mcp_{t})");
738 hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
740 hiss->SetName("PhiResolS1PtTPCITS");
742 aFolderObj->Add(hiss);
744 hiss = comp->MakeResol(comp->fThetaResolS1PtTPC,1,0);
745 hiss->SetXTitle("#sqrt(1/mcp_{t})");
746 hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
748 hiss->SetName("ThetaResolS1PtTPC");
750 aFolderObj->Add(hiss);
752 hiss = comp->MakeResol(comp->fThetaResolS1PtTPCITS,1,0);
753 hiss->SetXTitle("#sqrt(1/mcp_{t})");
754 hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
756 hiss->SetName("ThetaResolS1PtTPCITS");
758 aFolderObj->Add(hiss);
760 // export objects to analysis folder
761 fAnalysisFolder = ExportToFolder(aFolderObj);
763 // delete only TObjArray
764 if(aFolderObj) delete aFolderObj;
767 //_____________________________________________________________________________
768 TFolder* AliComparisonRes::ExportToFolder(TObjArray * array)
770 // recreate folder avery time and export objects to new one
772 AliComparisonRes * comp=this;
773 TFolder *folder = comp->GetAnalysisFolder();
776 TFolder *newFolder = 0;
778 Int_t size = array->GetSize();
781 // get name and title from old folder
782 name = folder->GetName();
783 title = folder->GetTitle();
789 newFolder = CreateFolder(name.Data(),title.Data());
790 newFolder->SetOwner();
792 // add objects to folder
794 newFolder->Add(array->At(i));
802 //_____________________________________________________________________________
803 Long64_t AliComparisonRes::Merge(TCollection* list)
805 // Merge list of objects (needed by PROOF)
813 TIterator* iter = list->MakeIterator();
816 // collection of generated histograms
818 while((obj = iter->Next()) != 0)
820 AliComparisonRes* entry = dynamic_cast<AliComparisonRes*>(obj);
821 if (entry == 0) continue;
823 fPtResolLPT->Add(entry->fPtResolLPT);
824 fPtResolHPT->Add(entry->fPtResolHPT);
825 fPtPullLPT->Add(entry->fPtPullLPT);
826 fPtPullHPT->Add(entry->fPtPullHPT);
828 // Histograms for 1/pt parameterisation
829 f1Pt2ResolS1PtTPC->Add(entry->f1Pt2ResolS1PtTPC);
830 fYResolS1PtTPC->Add(entry->fYResolS1PtTPC);
831 fZResolS1PtTPC->Add(entry->fZResolS1PtTPC);
832 fPhiResolS1PtTPC->Add(entry->fPhiResolS1PtTPC);
833 fThetaResolS1PtTPC->Add(entry->fThetaResolS1PtTPC);
835 f1Pt2ResolS1PtTPCITS->Add(entry->f1Pt2ResolS1PtTPCITS);
836 fYResolS1PtTPCITS->Add(entry->fYResolS1PtTPCITS);
837 fZResolS1PtTPCITS->Add(entry->fZResolS1PtTPCITS);
838 fPhiResolS1PtTPCITS->Add(entry->fPhiResolS1PtTPCITS);
839 fThetaResolS1PtTPCITS->Add(entry->fThetaResolS1PtTPCITS);
841 // Resolution histograms (constrained param)
842 fCPhiResolTan->Add(entry->fCPhiResolTan);
843 fCTanResolTan->Add(entry->fCTanResolTan);
844 fCPtResolTan->Add(entry->fCPtResolTan);
845 fCPhiPullTan->Add(entry->fCPhiPullTan);
846 fCTanPullTan->Add(entry->fCTanPullTan);
847 fCPtPullTan->Add(entry->fCPtPullTan);
849 // Histograms for 1/pt parameterisation (constrained)
850 fC1Pt2ResolS1PtTPC->Add(entry->fC1Pt2ResolS1PtTPC);
851 fCYResolS1PtTPC->Add(entry->fCYResolS1PtTPC);
852 fCZResolS1PtTPC->Add(entry->fCZResolS1PtTPC);
853 fCPhiResolS1PtTPC->Add(entry->fCPhiResolS1PtTPC);
854 fCThetaResolS1PtTPC->Add(entry->fCThetaResolS1PtTPC);
856 fC1Pt2ResolS1PtTPCITS->Add(entry->fC1Pt2ResolS1PtTPCITS);
857 fCYResolS1PtTPCITS->Add(entry->fCYResolS1PtTPCITS);
858 fCZResolS1PtTPCITS->Add(entry->fCZResolS1PtTPCITS);
859 fCPhiResolS1PtTPCITS->Add(entry->fCPhiResolS1PtTPCITS);
860 fCThetaResolS1PtTPCITS->Add(entry->fCThetaResolS1PtTPCITS);
868 //_____________________________________________________________________________
869 TFolder* AliComparisonRes::CreateFolder(TString name,TString title) {
870 // create folder for analysed histograms
873 folder = new TFolder(name.Data(),title.Data());