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
79 fPhiResolTan(0), //-> angular resolution
80 fTanResolTan(0), //-> angular resolution
81 fPhiPullTan(0), //-> angular resolution
82 fTanPullTan(0), //-> angular resolution
85 // Resolution constrained param
87 fCPhiResolTan(0), // angular resolution - constrained
88 fCTanResolTan(0), // angular resolution - constrained
89 fCPtResolTan(0), // pt resolution - constrained
90 fCPhiPullTan(0), // angular resolution - constrained
91 fCTanPullTan(0), // angular resolution - constrained
92 fCPtPullTan(0), // pt resolution - constrained
95 // Parametrisation histograms
99 f1Pt2ResolS1PtTPCITS(0),
101 fYResolS1PtTPCITS(0),
103 fZResolS1PtTPCITS(0),
105 fPhiResolS1PtTPCITS(0),
106 fThetaResolS1PtTPC(0),
107 fThetaResolS1PtTPCITS(0),
110 fC1Pt2ResolS1PtTPC(0),
111 fC1Pt2ResolS1PtTPCITS(0),
113 fCYResolS1PtTPCITS(0),
115 fCZResolS1PtTPCITS(0),
116 fCPhiResolS1PtTPC(0),
117 fCPhiResolS1PtTPCITS(0),
118 fCThetaResolS1PtTPC(0),
119 fCThetaResolS1PtTPCITS(0),
134 fVertex = new AliESDVertex();
140 //_____________________________________________________________________________
141 AliComparisonRes::~AliComparisonRes(){
143 // Resolution histograms
144 if(fPtResolLPT) delete fPtResolLPT; fPtResolLPT=0;
145 if(fPtResolHPT) delete fPtResolHPT; fPtResolHPT=0;
146 if(fPtPullLPT) delete fPtPullLPT; fPtPullLPT=0;
147 if(fPtPullHPT) delete fPtPullHPT; fPtPullHPT=0;
149 if(fPhiResolTan) delete fPhiResolTan; fPhiResolTan=0;
150 if(fTanResolTan) delete fTanResolTan; fTanResolTan=0;
151 if(fPhiPullTan) delete fPhiPullTan; fPhiPullTan=0;
152 if(fTanPullTan) delete fTanPullTan; fTanPullTan=0;
154 // Resolution histograms (constrained param)
155 if(fCPhiResolTan) delete fCPhiResolTan; fCPhiResolTan=0;
156 if(fCTanResolTan) delete fCTanResolTan; fCTanResolTan=0;
157 if(fCPtResolTan) delete fCPtResolTan; fCPtResolTan=0;
158 if(fCPhiPullTan) delete fCPhiPullTan; fCPhiPullTan=0;
159 if(fCTanPullTan) delete fCTanPullTan; fCTanPullTan=0;
160 if(fCPtPullTan) delete fCPtPullTan; fCPtPullTan=0;
162 // Parametrisation histograms
164 if(f1Pt2ResolS1PtTPC) delete f1Pt2ResolS1PtTPC; f1Pt2ResolS1PtTPC=0;
165 if(f1Pt2ResolS1PtTPCITS) delete f1Pt2ResolS1PtTPCITS; f1Pt2ResolS1PtTPCITS=0;
166 if(fYResolS1PtTPC) delete fYResolS1PtTPC; fYResolS1PtTPC=0;
167 if(fYResolS1PtTPCITS) delete fYResolS1PtTPCITS; fYResolS1PtTPCITS=0;
168 if(fZResolS1PtTPC) delete fZResolS1PtTPC; fZResolS1PtTPC=0;
169 if(fZResolS1PtTPCITS) delete fZResolS1PtTPCITS; fZResolS1PtTPCITS=0;
170 if(fPhiResolS1PtTPC) delete fPhiResolS1PtTPC; fPhiResolS1PtTPC=0;
171 if(fPhiResolS1PtTPCITS) delete fPhiResolS1PtTPCITS; fPhiResolS1PtTPCITS=0;
172 if(fThetaResolS1PtTPC) delete fThetaResolS1PtTPC; fThetaResolS1PtTPC=0;
173 if(fThetaResolS1PtTPCITS) delete fThetaResolS1PtTPCITS; fThetaResolS1PtTPCITS=0;
176 if(fC1Pt2ResolS1PtTPC) delete fC1Pt2ResolS1PtTPC; fC1Pt2ResolS1PtTPC=0;
177 if(fC1Pt2ResolS1PtTPCITS) delete fC1Pt2ResolS1PtTPCITS; fC1Pt2ResolS1PtTPCITS=0;
178 if(fCYResolS1PtTPC) delete fCYResolS1PtTPC; fCYResolS1PtTPC=0;
179 if(fCYResolS1PtTPCITS) delete fCYResolS1PtTPCITS; fCYResolS1PtTPCITS=0;
180 if(fCZResolS1PtTPC) delete fCZResolS1PtTPC; fCZResolS1PtTPC=0;
181 if(fCZResolS1PtTPCITS) delete fCZResolS1PtTPCITS; fCZResolS1PtTPCITS=0;
182 if(fCPhiResolS1PtTPC) delete fCPhiResolS1PtTPC; fCPhiResolS1PtTPC=0;
183 if(fCPhiResolS1PtTPCITS) delete fCPhiResolS1PtTPCITS; fCPhiResolS1PtTPCITS=0;
184 if(fCThetaResolS1PtTPC) delete fCThetaResolS1PtTPC; fCThetaResolS1PtTPC=0;
185 if(fCThetaResolS1PtTPCITS) delete fCThetaResolS1PtTPCITS; fCThetaResolS1PtTPCITS=0;
187 if(fVertex) delete fVertex; fVertex=0;
189 if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;
192 //_____________________________________________________________________________
193 void AliComparisonRes::Init(){
196 fCPhiResolTan = new TH2F("CPhiResolTan","CPhiResolTan",50, -2,2,200,-0.025,0.025);
197 fCPhiResolTan->SetXTitle("tan(#theta)");
198 fCPhiResolTan->SetYTitle("#Delta#phi");
200 fCTanResolTan = new TH2F("CTanResolTan","CTanResolTan",50, -2,2,200,-0.025,0.025);
201 fCTanResolTan->SetXTitle("tan(#theta)");
202 fCTanResolTan->SetYTitle("#Delta#theta");
204 fCPtResolTan=new TH2F("CPtResol","CPtResol",50, -2,2,200,-0.2,0.2);
205 fCPtResolTan->SetXTitle("Tan(#theta)");
206 fCPtResolTan->SetYTitle("#Deltap_{t}/p_{t}");
208 fCPhiPullTan = new TH2F("CPhiPullTan","CPhiPullTan",50, -2,2,200,-5,5);
209 fCPhiPullTan->SetXTitle("Tan(#theta)");
210 fCPhiPullTan->SetYTitle("#Delta#phi/#Sigma");
212 fCTanPullTan = new TH2F("CTanPullTan","CTanPullTan",50, -2,2,200,-5,5);
213 fCTanPullTan->SetXTitle("Tan(#theta)");
214 fCTanPullTan->SetYTitle("#Delta#theta/#Sigma");
216 fCPtPullTan=new TH2F("CPtPull","CPtPull",50, -2,2,200,-5,5);
217 fCPtPullTan->SetXTitle("Tan(#theta)");
218 fCPtPullTan->SetYTitle("(1/mcp_{t}-1/p_{t})/#Sigma");
220 fPtResolLPT = new TH2F("Pt_resol_lpt","pt resol",10, 0.1,3,200,-0.2,0.2);
221 fPtResolLPT->SetXTitle("p_{t}");
222 fPtResolLPT->SetYTitle("#Deltap_{t}/p_{t}");
224 fPtResolHPT = new TH2F("Pt_resol_hpt","pt resol",10, 2,100,200,-0.3,0.3);
225 fPtResolHPT->SetXTitle("p_{t}");
226 fPtResolHPT->SetYTitle("#Deltap_{t}/p_{t}");
228 fPtPullLPT = new TH2F("Pt_pull_lpt","pt pull",10, 0.1,3,200,-6,6);
229 fPtPullLPT->SetXTitle("p_{t}");
230 fPtPullLPT->SetYTitle("#Deltap_{t}/#Sigma");
232 fPtPullHPT = new TH2F("Pt_pull_hpt","pt pull",10,2,100,200,-6,6);
233 fPtPullHPT->SetXTitle("p_{t}");
234 fPtPullHPT->SetYTitle("#Deltap_{t}/#Sigma");
236 fPhiResolTan = new TH2F("PhiResolTan","PhiResolTan",50, -2,2,200,-0.025,0.025);
237 fPhiResolTan->SetXTitle("tan(#theta)");
238 fPhiResolTan->SetYTitle("#Delta#phi");
240 fTanResolTan = new TH2F("TanResolTan","TanResolTan",50, -2,2,200,-0.025,0.025);
241 fTanResolTan->SetXTitle("tan(#theta)");
242 fTanResolTan->SetYTitle("#Delta#theta");
244 fPhiPullTan = new TH2F("PhiPullTan","PhiPullTan",50, -2,2,200,-5,5);
245 fPhiPullTan->SetXTitle("Tan(#theta)");
246 fPhiPullTan->SetYTitle("#Delta#phi/#Sigma");
248 fTanPullTan = new TH2F("TanPullTan","TanPullTan",50, -2,2,200,-5,5);
249 fTanPullTan->SetXTitle("Tan(#theta)");
250 fTanPullTan->SetYTitle("#Delta#theta/#Sigma");
253 // Parametrisation histograms
256 f1Pt2ResolS1PtTPC = new TH2F("f1Pt2ResolS1PtTPC","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs sqrt(1/pt))",100,0,3,200,-0.010,0.010);
257 f1Pt2ResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
258 f1Pt2ResolS1PtTPC->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
260 f1Pt2ResolS1PtTPCITS = new TH2F("f1Pt2ResolS1PtTPCITS","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs sqrt(1/pt))",100,0,3,200,-0.010,0.010);
261 f1Pt2ResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
262 f1Pt2ResolS1PtTPCITS->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
264 fYResolS1PtTPC = new TH2F("fYResolS1PtTPC","fYResolS1PtTPC",100, 0,3,200,-1.0,1.0);
265 fYResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
266 fYResolS1PtTPC->SetYTitle("#DeltaY");
268 fYResolS1PtTPCITS = new TH2F("fYResolS1PtTPCITS","fYResolS1PtTPCITS",100, 0,3,200,-0.05,0.05);
269 fYResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
270 fYResolS1PtTPCITS->SetYTitle("#DeltaY");
272 fZResolS1PtTPC = new TH2F("fZResolS1PtTPC","fZResolS1PtTPC",100, 0,3,200,-1.0,1.0);
273 fZResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
274 fZResolS1PtTPC->SetYTitle("#DeltaZ");
276 fZResolS1PtTPCITS = new TH2F("fZResolS1PtTPCITS","fZResolS1PtTPCITS",100, 0,3,200,-0.05,0.05);
277 fZResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
278 fZResolS1PtTPCITS->SetYTitle("#DeltaZ");
280 fPhiResolS1PtTPC = new TH2F("fPhiResolS1PtTPC","fPhiResolS1PtTPC",100, 0,3,200,-0.025,0.025);
281 fPhiResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
282 fPhiResolS1PtTPC->SetYTitle("#Delta#phi");
284 fPhiResolS1PtTPCITS = new TH2F("fPhiResolS1PtTPCITS","fPhiResolS1PtTPCITS",100, 0,3,200,-0.01,0.01);
285 fPhiResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
286 fPhiResolS1PtTPCITS->SetYTitle("#Delta#phi");
288 fThetaResolS1PtTPC = new TH2F("fThetaResolS1PtTPC","fThetaResolS1PtTPC",100, 0,3,200,-0.025,0.025);
289 fThetaResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
290 fThetaResolS1PtTPC->SetYTitle("#Delta#theta");
292 fThetaResolS1PtTPCITS = new TH2F("fThetaResolS1PtTPCITS","fThetaResolS1PtTPCITS",100, 0,3,200,-0.01,0.01);
293 fThetaResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
294 fThetaResolS1PtTPCITS->SetYTitle("#Delta#theta");
297 fC1Pt2ResolS1PtTPC = new TH2F("fC1Pt2ResolS1PtTPC","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs 1/pt)",100,0,3,200,-0.010,0.010);
298 fC1Pt2ResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
299 fC1Pt2ResolS1PtTPC->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
301 fC1Pt2ResolS1PtTPCITS = new TH2F("fC1Pt2ResolS1PtTPCITS","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs 1/pt)",100,0,3,200,-0.010,0.010);
302 fC1Pt2ResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
303 fC1Pt2ResolS1PtTPCITS->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
305 fCYResolS1PtTPC = new TH2F("fCYResolS1PtTPC","fCYResolS1PtTPC",100, 0,3,200,-1.0,1.0);
306 fCYResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
307 fCYResolS1PtTPC->SetYTitle("#DeltaY");
309 fCYResolS1PtTPCITS = new TH2F("fCYResolS1PtTPCITS","fCYResolS1PtTPCITS",100, 0,3,200,-0.01,0.01);
310 fCYResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
311 fCYResolS1PtTPCITS->SetYTitle("#DeltaY");
313 fCZResolS1PtTPC = new TH2F("fCZResolS1PtTPC","fCZResolS1PtTPC",100, 0,3,200,-1.0,1.0);
314 fCZResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
315 fCZResolS1PtTPC->SetYTitle("#DeltaZ");
317 fCZResolS1PtTPCITS = new TH2F("fCZResolS1PtTPCITS","fCZResolS1PtTPCITS",100, 0,3,200,-0.025,0.025);
318 fCZResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
319 fCZResolS1PtTPCITS->SetYTitle("#DeltaZ");
321 fCPhiResolS1PtTPC = new TH2F("fCPhiResolS1PtTPC","fCPhiResolS1PtTPC",100, 0,3,200,-0.025,0.025);
322 fCPhiResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
323 fCPhiResolS1PtTPC->SetYTitle("#Delta#phi");
325 fCPhiResolS1PtTPCITS = new TH2F("fCPhiResolS1PtTPCITS","fCPhiResolS1PtTPCITS",100, 0,3,200,-0.003,0.003);
326 fCPhiResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
327 fCPhiResolS1PtTPCITS->SetYTitle("#Delta#phi");
329 fCThetaResolS1PtTPC = new TH2F("fCThetaResolS1PtTPC","fCThetaResolS1PtTPC",100, 0,3,200,-0.025,0.025);
330 fCThetaResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
331 fCThetaResolS1PtTPC->SetYTitle("#Delta#theta");
333 fCThetaResolS1PtTPCITS = new TH2F("fCThetaResolS1PtTPCITS","fCThetaResolS1PtTPCITS",100, 0,3,200,-0.005,0.005);
334 fCThetaResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
335 fCThetaResolS1PtTPCITS->SetYTitle("#Delta#theta");
339 AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object");
341 AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object");
344 fAnalysisFolder = CreateFolder("folderRes","Analysis Resolution Folder");
347 //_____________________________________________________________________________
348 void AliComparisonRes::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
350 // Fill resolution comparison information
351 AliExternalTrackParam *track = 0;
352 Double_t field = AliTracker::GetBz(); // nominal Bz field [kG]
353 Double_t kMaxD = 123456.0; // max distance
355 Int_t clusterITS[200];
356 Double_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
358 Float_t deltaPt, pullPt, deltaPhi,pullPhi, deltaTan, pullTan, delta1Pt2, deltaY1Pt, deltaZ1Pt, deltaPhi1Pt, deltaTheta1Pt;
359 Float_t deltaPtTPC, pullPtTPC, deltaPhiTPC, deltaTanTPC, delta1Pt2TPC, deltaY1PtTPC, deltaZ1PtTPC, deltaPhi1PtTPC, deltaTheta1PtTPC;
361 Float_t mcpt = infoMC->GetParticle().Pt();
362 Float_t s1mcpt = TMath::Sqrt(1./infoMC->GetParticle().Pt());
363 Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);
365 // distance to Prim. vertex
366 const Double_t* dv = infoMC->GetVDist();
367 Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();
369 // Check selection cuts
370 if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return;
372 if (infoRC->GetStatus(1)!=3) return; // TPC refit
373 if (!infoRC->GetESDtrack()) return;
374 if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;
376 // calculate and set prim. vertex
377 fVertex->SetXv( infoMC->GetParticle().Vx() - dv[0] );
378 fVertex->SetYv( infoMC->GetParticle().Vy() - dv[1] );
379 fVertex->SetZv( infoMC->GetParticle().Vz() - dv[2] );
381 deltaPt= (mcpt-infoRC->GetESDtrack()->Pt())/mcpt;
382 pullPt= (1/mcpt-infoRC->GetESDtrack()->OneOverPt())/TMath::Sqrt(infoRC->GetESDtrack()->GetSigma1Pt2());
383 deltaPhi = TMath::ATan2(infoRC->GetESDtrack()->Py(),infoRC->GetESDtrack()->Px())-
384 TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
385 pullPhi = deltaPhi/TMath::Sqrt(infoRC->GetESDtrack()->GetSigmaSnp2());
387 deltaTan = TMath::ATan2(infoRC->GetESDtrack()->Pz(),infoRC->GetESDtrack()->Pt())-
388 TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
389 pullTan = deltaPhi/TMath::Sqrt(infoRC->GetESDtrack()->GetSigmaSnp2());
391 delta1Pt2 = (1/mcpt-infoRC->GetESDtrack()->OneOverPt())/TMath::Power(1+1/mcpt,2);
392 deltaY1Pt = (infoMC->GetParticle().Vy()-infoRC->GetESDtrack()->GetY()) / (0.2+1/mcpt);
393 deltaZ1Pt = (infoMC->GetParticle().Vz()-infoRC->GetESDtrack()->GetZ()) / (0.2+1/mcpt);
394 deltaPhi1Pt = deltaPhi / (0.1+1/mcpt);
395 deltaTheta1Pt = deltaTan / (0.1+1/mcpt);
397 // calculate track parameters at vertex
398 const AliExternalTrackParam *innerTPC = 0;
399 if ((innerTPC = infoRC->GetESDtrack()->GetTPCInnerParam()) != 0)
401 if ((track = new AliExternalTrackParam(*infoRC->GetESDtrack()->GetTPCInnerParam())) != 0 )
403 Bool_t bDCAStatus = track->PropagateToDCA(fVertex,field,kMaxD,dca,cov);
405 // Fill parametrisation histograms (only TPC track)
408 deltaPtTPC= (mcpt-innerTPC->Pt())/mcpt;
409 pullPtTPC= (1/mcpt-innerTPC->OneOverPt())/TMath::Sqrt(innerTPC->GetSigma1Pt2());
410 deltaPhiTPC = TMath::ATan2(innerTPC->Py(),innerTPC->Px())-
411 TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
413 deltaTanTPC = TMath::ATan2(innerTPC->Pz(),innerTPC->Pt())-
414 TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
416 delta1Pt2TPC = (1/mcpt-innerTPC->OneOverPt())/TMath::Power(1+1/mcpt,2);
417 deltaY1PtTPC= (infoMC->GetParticle().Vy()-innerTPC->GetY()) / (0.2+1/mcpt);
418 deltaZ1PtTPC = (infoMC->GetParticle().Vz()-innerTPC->GetZ()) / (0.2+1/mcpt);
419 deltaPhi1PtTPC = deltaPhiTPC / (0.1+1/mcpt);
420 deltaTheta1PtTPC = deltaTanTPC / (0.1+1/mcpt);
422 f1Pt2ResolS1PtTPC->Fill(s1mcpt,delta1Pt2TPC);
423 fYResolS1PtTPC->Fill(s1mcpt,deltaY1PtTPC);
424 fZResolS1PtTPC->Fill(s1mcpt,deltaZ1PtTPC);
425 fPhiResolS1PtTPC->Fill(s1mcpt,deltaPhi1PtTPC);
426 fThetaResolS1PtTPC->Fill(s1mcpt,deltaTheta1PtTPC);
432 // TPC and ITS (nb. of clusters >2) in the system
433 if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)>2)
435 f1Pt2ResolS1PtTPCITS->Fill(s1mcpt,delta1Pt2);
436 fYResolS1PtTPCITS->Fill(s1mcpt,deltaY1Pt);
437 fZResolS1PtTPCITS->Fill(s1mcpt,deltaZ1Pt);
438 fPhiResolS1PtTPCITS->Fill(s1mcpt,deltaPhi1Pt);
439 fThetaResolS1PtTPCITS->Fill(s1mcpt,deltaTheta1Pt);
443 fPtResolLPT->Fill(mcpt,deltaPt);
444 fPtResolHPT->Fill(mcpt,deltaPt);
445 fPtPullLPT->Fill(mcpt,pullPt);
446 fPtPullHPT->Fill(mcpt,pullPt);
448 fPhiResolTan->Fill(tantheta,deltaPhi);
449 fPhiPullTan->Fill(tantheta,pullPhi);
450 fTanResolTan->Fill(tantheta,deltaTan);
451 fTanPullTan->Fill(tantheta,pullTan);
455 //_____________________________________________________________________________
456 void AliComparisonRes::ProcessConstrained(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
458 // Fill resolution comparison information (constarained parameters)
460 AliExternalTrackParam *track = 0;
461 Double_t field = AliTracker::GetBz(); // nominal Bz field [kG]
462 Double_t kMaxD = 123456.0; // max distance
464 Int_t clusterITS[200];
465 Double_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
467 Float_t deltaPt, pullPt, deltaPhi, pullPhi, deltaTan, pullTan, delta1Pt2, deltaY1Pt, deltaZ1Pt, deltaPhi1Pt, deltaTheta1Pt;
468 Float_t deltaPtTPC, pullPtTPC, deltaPhiTPC, deltaTanTPC, delta1Pt2TPC, deltaY1PtTPC, deltaZ1PtTPC, deltaPhi1PtTPC, deltaTheta1PtTPC;
470 Float_t mcpt = infoMC->GetParticle().Pt();
471 Float_t s1mcpt = TMath::Sqrt(1./infoMC->GetParticle().Pt());
472 Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);
474 // distance to Prim. vertex
475 const Double_t* dv = infoMC->GetVDist();
476 Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();
478 // Check selection cuts
479 if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return;
481 if (infoRC->GetStatus(1)!=3) return;
482 if (!infoRC->GetESDtrack()) return;
483 if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;
484 if (!infoRC->GetESDtrack()->GetConstrainedParam()) return;
486 // calculate and set prim. vertex
487 fVertex->SetXv( infoMC->GetParticle().Vx() - dv[0] );
488 fVertex->SetYv( infoMC->GetParticle().Vy() - dv[1] );
489 fVertex->SetZv( infoMC->GetParticle().Vz() - dv[2] );
491 // constrained parameters resolution
492 const AliExternalTrackParam * cparam = infoRC->GetESDtrack()->GetConstrainedParam();
493 deltaPt= (mcpt-cparam->Pt())/mcpt;
494 pullPt= (1/mcpt-cparam->OneOverPt())/TMath::Sqrt(cparam->GetSigma1Pt2());
495 deltaPhi = TMath::ATan2(cparam->Py(),cparam->Px())-
496 TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
497 pullPhi = deltaPhi/TMath::Sqrt(cparam->GetSigmaSnp2());
498 deltaTan = TMath::ATan2(cparam->Pz(),cparam->Pt())-TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
499 pullTan = deltaPhi/TMath::Sqrt(cparam->GetSigmaSnp2());
502 delta1Pt2 = (1/mcpt-cparam->OneOverPt())/TMath::Power(1+1/mcpt,2);
504 deltaY1Pt = (infoMC->GetParticle().Vy()-cparam->GetY()) / (0.2+1/mcpt);
505 deltaZ1Pt = (infoMC->GetParticle().Vz()-cparam->GetZ()) / (0.2+1/mcpt);
506 deltaPhi1Pt = deltaPhi / (0.1+1/mcpt);
507 deltaTheta1Pt = deltaTan / (0.1+1/mcpt);
509 // calculate track parameters at vertex
510 const AliExternalTrackParam *innerTPC = 0;
511 if ((innerTPC = infoRC->GetESDtrack()->GetTPCInnerParam()) != 0)
513 if ((track = new AliExternalTrackParam(*infoRC->GetESDtrack()->GetTPCInnerParam())) != 0 )
515 Bool_t bDCAStatus = track->PropagateToDCA(fVertex,field,kMaxD,dca,cov);
517 // Fill parametrisation histograms (only TPC track)
520 deltaPtTPC= (mcpt-innerTPC->Pt())/mcpt;
521 pullPtTPC= (1/mcpt-innerTPC->OneOverPt())/TMath::Sqrt(innerTPC->GetSigma1Pt2());
522 deltaPhiTPC = TMath::ATan2(innerTPC->Py(),innerTPC->Px())-
523 TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
525 deltaTanTPC = TMath::ATan2(innerTPC->Pz(),innerTPC->Pt())-
526 TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
528 delta1Pt2TPC = (1/mcpt-innerTPC->OneOverPt())/TMath::Power(1+1/mcpt,2);
529 deltaY1PtTPC= (infoMC->GetParticle().Vy()-innerTPC->GetY()) / (0.2+1/mcpt);
530 deltaZ1PtTPC = (infoMC->GetParticle().Vz()-innerTPC->GetZ()) / (0.2+1/mcpt);
531 deltaPhi1PtTPC = deltaPhiTPC / (0.1+1/mcpt);
532 deltaTheta1PtTPC = deltaTanTPC / (0.1+1/mcpt);
534 fC1Pt2ResolS1PtTPC->Fill(s1mcpt,delta1Pt2TPC);
535 fCYResolS1PtTPC->Fill(s1mcpt,deltaY1PtTPC);
536 fCZResolS1PtTPC->Fill(s1mcpt,deltaZ1PtTPC);
537 fCPhiResolS1PtTPC->Fill(s1mcpt,deltaPhi1PtTPC);
538 fCThetaResolS1PtTPC->Fill(s1mcpt,deltaTheta1PtTPC);
544 // TPC and ITS (nb. of clusters >2) in the system
545 if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)>2)
547 fC1Pt2ResolS1PtTPCITS->Fill(s1mcpt,delta1Pt2);
548 fCYResolS1PtTPCITS->Fill(s1mcpt,deltaY1Pt);
549 fCZResolS1PtTPCITS->Fill(s1mcpt,deltaZ1Pt);
550 fCPhiResolS1PtTPCITS->Fill(s1mcpt,deltaPhi1Pt);
551 fCThetaResolS1PtTPCITS->Fill(s1mcpt,deltaTheta1Pt);
555 fCPtResolTan->Fill(tantheta,deltaPt);
556 fCPtPullTan->Fill(tantheta,pullPt);
557 fCPhiResolTan->Fill(tantheta,deltaPhi);
558 fCPhiPullTan->Fill(tantheta,pullPhi);
559 fCTanResolTan->Fill(tantheta,deltaTan);
560 fCTanPullTan->Fill(tantheta,pullTan);
563 //_____________________________________________________________________________
564 void AliComparisonRes::Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC){
566 // Process comparison information
567 Process(infoMC,infoRC);
568 ProcessConstrained(infoMC,infoRC);
571 //_____________________________________________________________________________
572 TH1F* AliComparisonRes::MakeResol(TH2F * his, Int_t integ, Bool_t type){
573 // Create resolution histograms
576 if (!gPad) new TCanvas;
577 hisr = AliTreeDraw::CreateResHistoI(his,&hism,integ);
578 if (type) return hism;
583 //_____________________________________________________________________________
584 void AliComparisonRes::Analyse(){
585 // Analyse comparison information and store output histograms
586 // in the folder "folderRes"
589 TH1::AddDirectory(kFALSE);
591 AliComparisonRes * comp=this;
593 TObjArray *aFolderObj = new TObjArray;
595 // write results in the folder
597 TCanvas * c = new TCanvas("Phi resol Tan","Phi resol Tan");
600 hiss = comp->MakeResol(comp->fCPtResolTan,1,0);
601 hiss->SetXTitle("Tan(#theta)");
602 hiss->SetYTitle("#sigmap_{t}/p_{t}");
604 hiss->SetName("CptResolTan");
606 aFolderObj->Add(hiss);
609 hiss = comp->MakeResol(comp->fPtResolLPT,1,0);
610 hiss->SetXTitle("p_{t} (GeV)");
611 hiss->SetYTitle("#sigmap_{t}/p_{t}");
613 hiss->SetName("PtResolPt");
615 aFolderObj->Add(hiss);
618 hiss = comp->MakeResol(comp->fPtResolLPT,1,1);
619 hiss->SetXTitle("p_{t} (GeV)");
620 hiss->SetYTitle("mean #Deltap_{t}/p_{t}");
622 hiss->SetName("PtMeanPt");
624 aFolderObj->Add(hiss);
627 hiss = comp->MakeResol(comp->fPhiResolTan,1,0);
628 hiss->SetXTitle("Tan(#theta)");
629 hiss->SetYTitle("#sigma#phi (rad)");
631 hiss->SetName("PhiResolTan");
633 aFolderObj->Add(hiss);
635 hiss = comp->MakeResol(comp->fTanResolTan,1,0);
636 hiss->SetXTitle("Tan(#theta)");
637 hiss->SetYTitle("#sigma#theta (rad)");
639 hiss->SetName("ThetaResolTan");
641 aFolderObj->Add(hiss);
644 hiss = comp->MakeResol(comp->fPhiResolTan,1,1);
645 hiss->SetXTitle("Tan(#theta)");
646 hiss->SetYTitle("mean #Delta#phi (rad)");
648 hiss->SetName("PhiMeanTan");
650 aFolderObj->Add(hiss);
652 hiss = comp->MakeResol(comp->fTanResolTan,1,1);
653 hiss->SetXTitle("Tan(#theta)");
654 hiss->SetYTitle("mean #Delta#theta (rad)");
656 hiss->SetName("ThetaMeanTan");
658 aFolderObj->Add(hiss);
661 hiss = comp->MakeResol(comp->fCPhiResolTan,1,0);
662 hiss->SetXTitle("Tan(#theta)");
663 hiss->SetYTitle("#sigma#phi (rad)");
665 hiss->SetName("CPhiResolTan");
667 aFolderObj->Add(hiss);
669 hiss = comp->MakeResol(comp->fCTanResolTan,1,0);
670 hiss->SetXTitle("Tan(#theta)");
671 hiss->SetYTitle("#sigma#theta (rad)");
673 hiss->SetName("CThetaResolTan");
675 aFolderObj->Add(hiss);
677 hiss = comp->MakeResol(comp->fCPtPullTan,1,0);
678 hiss->SetXTitle("Tan(#theta)");
679 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/#Sigma(1/p_{t})");
681 hiss->SetName("CptPullTan");
683 aFolderObj->Add(hiss);
685 hiss = comp->MakeResol(comp->fC1Pt2ResolS1PtTPC,1,0);
686 hiss->SetXTitle("#sqrt(1/mcp_{t})");
687 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
689 hiss->SetName("C1Pt2ResolS1PtTPC");
691 aFolderObj->Add(hiss);
693 hiss = comp->MakeResol(comp->fC1Pt2ResolS1PtTPCITS,1,0);
694 hiss->SetXTitle("#sqrt(1/mcp_{t})");
695 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
697 hiss->SetName("C1Pt2ResolS1PtTPCITS");
699 aFolderObj->Add(hiss);
701 hiss = comp->MakeResol(comp->fCYResolS1PtTPC,1,0);
702 hiss->SetXTitle("#sqrt(1/mcp_{t})");
703 hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
705 hiss->SetName("CYResolS1PtTPC");
707 aFolderObj->Add(hiss);
709 hiss = comp->MakeResol(comp->fCYResolS1PtTPCITS,1,0);
710 hiss->SetXTitle("#sqrt(1/mcp_{t})");
711 hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
713 hiss->SetName("CYResolS1PtTPCITS");
715 aFolderObj->Add(hiss);
717 hiss = comp->MakeResol(comp->fCZResolS1PtTPC,1,0);
718 hiss->SetXTitle("#sqrt(1/mcp_{t})");
719 hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
721 hiss->SetName("CZResolS1PtTPC");
723 aFolderObj->Add(hiss);
725 hiss = comp->MakeResol(comp->fCZResolS1PtTPCITS,1,0);
726 hiss->SetXTitle("#sqrt(1/mcp_{t})");
727 hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
729 hiss->SetName("CZResolS1PtTPCITS");
731 aFolderObj->Add(hiss);
733 hiss = comp->MakeResol(comp->fCPhiResolS1PtTPC,1,0);
734 hiss->SetXTitle("#sqrt(1/mcp_{t})");
735 hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
737 hiss->SetName("CPhiResolS1PtTPC");
739 aFolderObj->Add(hiss);
741 hiss = comp->MakeResol(comp->fCPhiResolS1PtTPCITS,1,0);
742 hiss->SetXTitle("#sqrt(1/mcp_{t})");
743 hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
745 hiss->SetName("CPhiResolS1PtTPCITS");
747 aFolderObj->Add(hiss);
749 hiss = comp->MakeResol(comp->fCThetaResolS1PtTPC,1,0);
750 hiss->SetXTitle("#sqrt(1/mcp_{t})");
751 hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
753 hiss->SetName("CThetaResolS1PtTPC");
755 aFolderObj->Add(hiss);
757 hiss = comp->MakeResol(comp->fCThetaResolS1PtTPCITS,1,0);
758 hiss->SetXTitle("#sqrt(1/mcp_{t})");
759 hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
761 hiss->SetName("CThetaResolS1PtTPCITS");
763 aFolderObj->Add(hiss);
766 hiss = comp->MakeResol(comp->f1Pt2ResolS1PtTPC,1,0);
767 hiss->SetXTitle("#sqrt(1/mcp_{t})");
768 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
770 hiss->SetName("OnePt2ResolS1PtTPC");
772 aFolderObj->Add(hiss);
774 hiss = comp->MakeResol(comp->f1Pt2ResolS1PtTPCITS,1,0);
775 hiss->SetXTitle("#sqrt(1/mcp_{t})");
776 hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
778 hiss->SetName("OnePt2ResolS1PtTPCITS");
780 aFolderObj->Add(hiss);
782 hiss = comp->MakeResol(comp->fYResolS1PtTPC,1,0);
783 hiss->SetXTitle("#sqrt(1/mcp_{t})");
784 hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
786 hiss->SetName("YResolS1PtTPC");
788 aFolderObj->Add(hiss);
790 hiss = comp->MakeResol(comp->fYResolS1PtTPCITS,1,0);
791 hiss->SetXTitle("#sqrt(1/mcp_{t})");
792 hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
794 hiss->SetName("YResolS1PtTPCITS");
796 aFolderObj->Add(hiss);
798 hiss = comp->MakeResol(comp->fZResolS1PtTPC,1,0);
799 hiss->SetXTitle("#sqrt(1/mcp_{t})");
800 hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
802 hiss->SetName("ZResolS1PtTPC");
804 aFolderObj->Add(hiss);
806 hiss = comp->MakeResol(comp->fZResolS1PtTPCITS,1,0);
807 hiss->SetXTitle("#sqrt(1/mcp_{t})");
808 hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
810 hiss->SetName("ZResolS1PtTPCITS");
812 aFolderObj->Add(hiss);
814 hiss = comp->MakeResol(comp->fPhiResolS1PtTPC,1,0);
815 hiss->SetXTitle("#sqrt(1/mcp_{t})");
816 hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
818 hiss->SetName("PhiResolS1PtTPC");
820 aFolderObj->Add(hiss);
822 hiss = comp->MakeResol(comp->fPhiResolS1PtTPCITS,1,0);
823 hiss->SetXTitle("#sqrt(1/mcp_{t})");
824 hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
826 hiss->SetName("PhiResolS1PtTPCITS");
828 aFolderObj->Add(hiss);
830 hiss = comp->MakeResol(comp->fThetaResolS1PtTPC,1,0);
831 hiss->SetXTitle("#sqrt(1/mcp_{t})");
832 hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
834 hiss->SetName("ThetaResolS1PtTPC");
836 aFolderObj->Add(hiss);
838 hiss = comp->MakeResol(comp->fThetaResolS1PtTPCITS,1,0);
839 hiss->SetXTitle("#sqrt(1/mcp_{t})");
840 hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
842 hiss->SetName("ThetaResolS1PtTPCITS");
844 aFolderObj->Add(hiss);
846 // export objects to analysis folder
847 fAnalysisFolder = ExportToFolder(aFolderObj);
849 // delete only TObjArray
850 if(aFolderObj) delete aFolderObj;
853 //_____________________________________________________________________________
854 TFolder* AliComparisonRes::ExportToFolder(TObjArray * array)
856 // recreate folder avery time and export objects to new one
858 AliComparisonRes * comp=this;
859 TFolder *folder = comp->GetAnalysisFolder();
862 TFolder *newFolder = 0;
864 Int_t size = array->GetSize();
867 // get name and title from old folder
868 name = folder->GetName();
869 title = folder->GetTitle();
875 newFolder = CreateFolder(name.Data(),title.Data());
876 newFolder->SetOwner();
878 // add objects to folder
880 newFolder->Add(array->At(i));
888 //_____________________________________________________________________________
889 Long64_t AliComparisonRes::Merge(TCollection* list)
891 // Merge list of objects (needed by PROOF)
899 TIterator* iter = list->MakeIterator();
902 // collection of generated histograms
904 while((obj = iter->Next()) != 0)
906 AliComparisonRes* entry = dynamic_cast<AliComparisonRes*>(obj);
907 if (entry == 0) continue;
909 fPtResolLPT->Add(entry->fPtResolLPT);
910 fPtResolHPT->Add(entry->fPtResolHPT);
911 fPtPullLPT->Add(entry->fPtPullLPT);
912 fPtPullHPT->Add(entry->fPtPullHPT);
913 fPhiResolTan->Add(entry->fPhiResolTan);
914 fTanResolTan->Add(entry->fTanResolTan);
915 fPhiPullTan->Add(entry->fPhiPullTan);
916 fTanPullTan->Add(entry->fTanPullTan);
918 // Histograms for 1/pt parameterisation
919 f1Pt2ResolS1PtTPC->Add(entry->f1Pt2ResolS1PtTPC);
920 fYResolS1PtTPC->Add(entry->fYResolS1PtTPC);
921 fZResolS1PtTPC->Add(entry->fZResolS1PtTPC);
922 fPhiResolS1PtTPC->Add(entry->fPhiResolS1PtTPC);
923 fThetaResolS1PtTPC->Add(entry->fThetaResolS1PtTPC);
925 f1Pt2ResolS1PtTPCITS->Add(entry->f1Pt2ResolS1PtTPCITS);
926 fYResolS1PtTPCITS->Add(entry->fYResolS1PtTPCITS);
927 fZResolS1PtTPCITS->Add(entry->fZResolS1PtTPCITS);
928 fPhiResolS1PtTPCITS->Add(entry->fPhiResolS1PtTPCITS);
929 fThetaResolS1PtTPCITS->Add(entry->fThetaResolS1PtTPCITS);
931 // Resolution histograms (constrained param)
932 fCPhiResolTan->Add(entry->fCPhiResolTan);
933 fCTanResolTan->Add(entry->fCTanResolTan);
934 fCPtResolTan->Add(entry->fCPtResolTan);
935 fCPhiPullTan->Add(entry->fCPhiPullTan);
936 fCTanPullTan->Add(entry->fCTanPullTan);
937 fCPtPullTan->Add(entry->fCPtPullTan);
939 // Histograms for 1/pt parameterisation (constrained)
940 fC1Pt2ResolS1PtTPC->Add(entry->fC1Pt2ResolS1PtTPC);
941 fCYResolS1PtTPC->Add(entry->fCYResolS1PtTPC);
942 fCZResolS1PtTPC->Add(entry->fCZResolS1PtTPC);
943 fCPhiResolS1PtTPC->Add(entry->fCPhiResolS1PtTPC);
944 fCThetaResolS1PtTPC->Add(entry->fCThetaResolS1PtTPC);
946 fC1Pt2ResolS1PtTPCITS->Add(entry->fC1Pt2ResolS1PtTPCITS);
947 fCYResolS1PtTPCITS->Add(entry->fCYResolS1PtTPCITS);
948 fCZResolS1PtTPCITS->Add(entry->fCZResolS1PtTPCITS);
949 fCPhiResolS1PtTPCITS->Add(entry->fCPhiResolS1PtTPCITS);
950 fCThetaResolS1PtTPCITS->Add(entry->fCThetaResolS1PtTPCITS);
958 //_____________________________________________________________________________
959 TFolder* AliComparisonRes::CreateFolder(TString name,TString title) {
960 // create folder for analysed histograms
963 folder = new TFolder(name.Data(),title.Data());