]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG1/TRD/AliTRDresolution.cxx
Error in ADCch2Phe called by Raw2SDigits method
[u/mrichter/AliRoot.git] / PWG1 / TRD / AliTRDresolution.cxx
CommitLineData
1ee39b3a 1/**************************************************************************
2* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
7* Permission to use, copy, modify and distribute this software and its *
8* documentation strictly for non-commercialf purposes is hereby granted *
9* without fee, provided that the above copyright notice appears in all *
10* copies and that both the copyright notice and this permission notice *
11* appear in the supporting documentation. The authors make no claims *
12* about the suitability of this software for any purpose. It is *
13* provided "as is" without express or implied warranty. *
14**************************************************************************/
15
16/* $Id: AliTRDresolution.cxx 27496 2008-07-22 08:35:45Z cblume $ */
17
18////////////////////////////////////////////////////////////////////////////
19// //
20// TRD tracking resolution //
21//
22// The class performs resolution and residual studies
23// of the TRD tracks for the following quantities :
24// - spatial position (y, [z])
25// - angular (phi) tracklet
26// - momentum at the track level
27//
28// The class has to be used for regular detector performance checks using the official macros:
29// - $ALICE_ROOT/TRD/qaRec/run.C
30// - $ALICE_ROOT/TRD/qaRec/makeResults.C
31//
32// For stand alone usage please refer to the following example:
33// {
34// gSystem->Load("libANALYSIS.so");
35// gSystem->Load("libTRDqaRec.so");
36// AliTRDresolution *res = new AliTRDresolution();
37// //res->SetMCdata();
38// //res->SetVerbose();
39// //res->SetVisual();
40// res->Load();
41// if(!res->PostProcess()) return;
42// res->GetRefFigure(0);
43// }
44//
45// Authors: //
46// Alexandru Bercuci <A.Bercuci@gsi.de> //
47// Markus Fasel <M.Fasel@gsi.de> //
48// //
49////////////////////////////////////////////////////////////////////////////
50
92c40e64 51#include <TSystem.h>
52
1ee39b3a 53#include <TROOT.h>
54#include <TObjArray.h>
55#include <TH3.h>
56#include <TH2.h>
57#include <TH1.h>
58#include <TF1.h>
59#include <TCanvas.h>
60#include <TGaxis.h>
61#include <TBox.h>
92c40e64 62#include <TLegend.h>
1ee39b3a 63#include <TGraphErrors.h>
64#include <TGraphAsymmErrors.h>
65#include <TMath.h>
66#include <TMatrixT.h>
67#include <TVectorT.h>
68#include <TTreeStream.h>
69#include <TGeoManager.h>
92c40e64 70#include <TDatabasePDG.h>
1ee39b3a 71
72#include "AliPID.h"
92c40e64 73#include "AliESDtrack.h"
1ee39b3a 74
75#include "AliTRDresolution.h"
76#include "AliTRDgeometry.h"
77#include "AliTRDpadPlane.h"
78#include "AliTRDcluster.h"
79#include "AliTRDseedV1.h"
80#include "AliTRDtrackV1.h"
81#include "AliTRDReconstructor.h"
82#include "AliTRDrecoParam.h"
92c40e64 83#include "AliTRDpidUtil.h"
1ee39b3a 84
85#include "info/AliTRDclusterInfo.h"
86
87ClassImp(AliTRDresolution)
88
92c40e64 89UChar_t const AliTRDresolution::fgNhistos[kNviews] = {
90 2, 2, 5, 5,
91 2, 5, 12, 2, 14
92};
93UChar_t const AliTRDresolution::fgNproj[kNviews] = {
1ee39b3a 94 2, 2, 5, 5,
92c40e64 95 4, 7, 12, 2, 14
1ee39b3a 96};
92c40e64 97Char_t const * AliTRDresolution::fgPerformanceName[kNviews] = {
1ee39b3a 98 "Charge"
99 ,"Cluster2Track"
100 ,"Tracklet2Track"
101 ,"Tracklet2TPC"
102 ,"Cluster2MC"
103 ,"Tracklet2MC"
104 ,"TPC2MC"
105 ,"TOF/HMPID2MC"
106 ,"TRD2MC"
107};
92c40e64 108UChar_t const AliTRDresolution::fgNcomp[kNprojs] = {
109 1, 1, //2,
110 1, 1, //2,
111 1, 1, 1, 1, 1, //5,
112 1, 1, 1, 1, 1, 1, 1, //5,
113// MC
114 1, 1, 1, 1, //4,
115 1, 1, 1, 1, 1, //5,
116 1, 1, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, //12,
117 1, 1, //2,
118 1, 1, 1, 1, 1, 1, 1, 1, 66, 66, 66, 66, 66, 66 //14
119};
120Char_t const *AliTRDresolution::fgAxTitle[kNprojs][4] = {
1ee39b3a 121 // Charge
122 {"Impv", "x [cm]", "I_{mpv}", "x/x_{0}"}
123 ,{"dI/Impv", "x/x_{0}", "#delta I/I_{mpv}", "x[cm]"}
124 // Clusters to Kalman
125 ,{"Pos", "tg(#phi)", "#mu_{y}^{cl} [#mum]", "#sigma_{y}^{cl} [#mum]"}
126 ,{"Pulls", "tg(#phi)", "PULL: #mu_{y}^{cl}", "PULL: #sigma_{y}^{cl}"}
127 // TRD tracklet to Kalman fit
128 ,{"PosY", "tg(#phi)", "#mu_{y}^{trklt} [#mum]", "#sigma_{y}^{trklt} [#mum]"}
129 ,{"PullsY", "tg(#phi)", "PULL: #mu_{y}^{trklt}", "PULL: #sigma_{y}^{trklt}"}
130 ,{"PosZ", "tg(#theta)", "#mu_{z}^{trklt} [#mum]", "#sigma_{z}^{trklt} [#mum]"}
131 ,{"PullsZ", "tg(#theta)", "PULL: #mu_{z}^{trklt}", "PULL: #sigma_{z}^{trklt}"}
132 ,{"Phi", "tg(#phi)", "#mu_{#phi}^{trklt} [mrad]", "#sigma_{#phi}^{trklt} [mrad]"}
133 // TPC track 2 first TRD tracklet
134 ,{"PosY", "tg(#phi)", "#mu_{y}^{TPC trklt} [#mum]", "#sigma_{y}^{TPC trklt} [#mum]"}
135 ,{"PullsY", "tg(#phi)", "PULL: #mu_{y}^{TPC trklt}", "PULL: #sigma_{y}^{TPC trklt}"}
136 ,{"PosZ", "tg(#theta)", "#mu_{z}^{TPC trklt} [#mum]", "#sigma_{z}^{TPC trklt} [#mum]"}
137 ,{"PullsZ", "tg(#theta)", "PULL: #mu_{z}^{TPC trklt}", "PULL: #sigma_{z}^{TPC trklt}"}
138 ,{"Phi", "tg(#phi)", "#mu_{#phi}^{TPC trklt} [mrad]", "#sigma_{#phi}^{TPC trklt} [mrad]"}
139 // MC cluster
92c40e64 140 ,{"Pos1", "tg(#phi)", "MC cluster (p_{t}<1 GeV/c): #mu_{y}[#mum]", "#sigma_{y}[#mum]"}
141 ,{"Pos2", "tg(#phi)", "MC cluster (p_{t}<2 GeV/c): #mu_{y} [#mum]", "#sigma_{y} [#mum]"}
142 ,{"Pos3", "tg(#phi)", "MC cluster (p_{t}>3 GeV/c): #mu_{y} [#mum]", "#sigma_{y}[#mum]"}
143 ,{"Pulls", "tg(#phi)", "MC cluster PULL: #mu_{y}", "#sigma_{y}"}
1ee39b3a 144 // MC tracklet
92c40e64 145 ,{"PosY", "tg(#phi)", "MC tracklet (p_{t}<1 GeV/c): #mu_{y}[#mum]", "#sigma_{y}[#mum]"}
146 ,{"PosY1", "tg(#phi)", "MC tracklet (p_{t}<2 GeV/c): #mu_{y}[#mum]", "#sigma_{y}[#mum]"}
147 ,{"PosY2", "tg(#phi)", "MC tracklet (p_{t}>3 GeV/c): #mu_{y}[#mum]", "#sigma_{y}[#mum]"}
148 ,{"PullsY", "tg(#phi)", "MC tracklet PULL: #mu_{y}", "MC PULL: #sigma_{y}"}
149 ,{"PosZ", "tg(#theta)", "MC tracklet: #mu_{z}[#mum]", "#sigma_{z}[#mum]"}
150 ,{"PullsZ", "tg(#theta)", "MC tracklet PULL: #mu_{z}", "#sigma_{z}"}
151 ,{"Phi", "tg(#phi)", "MC tracklet: #mu_{#phi}[mrad]", "#sigma_{#phi}[mrad]"}
1ee39b3a 152 // MC track TPC
92c40e64 153 ,{"PosY", "tg(#phi)", "MC TPC2TRD0: #mu_{y}[#mum]", "#sigma_{y}[#mum]"}
154 ,{"PullsY", "tg(#phi)", "MC TPC2TRD0 PULL: #mu_{y}", "#sigma_{y}"}
155 ,{"PosZ", "tg(#theta)", "MC TPC2TRD0: #mu_{z}[#mum]", "#sigma_{z}[#mum]"}
156 ,{"PullsZ", "tg(#theta)", "MC TPC2TRD0 PULL: #mu_{z}", "#sigma_{z}"}
1ee39b3a 157 ,{"Phi", "tg(#phi)", "MC: #mu_{#phi}^{TPC} [mrad]", "MC: #sigma_{#phi}^{TPC} [mrad]"}
158 ,{"PullsSNP", "tg(#phi)", "MC PULL: #mu_{snp}^{TPC}", "MC PULL: #sigma_{snp}^{TPC}"}
159 ,{"Theta", "tg(#theta)", "MC: #mu_{#theta}^{TPC} [mrad]", "MC: #sigma_{#theta}^{TPC} [mrad]"}
160 ,{"PullsTGL", "tg(#theta)", "MC PULL: #mu_{tgl}^{TPC}", "MC PULL: #sigma_{tgl}^{TPC}"}
161 ,{"Pt", "p_{t}^{MC} [GeV/c]", "MC: #mu^{TPC}(#Deltap_{t}/p_{t}^{MC}) [%]", "MC: #sigma^{TPC}(#Deltap_{t}/p_{t}^{MC}) [%]"}
162 ,{"Pulls1Pt", "1/p_{t}^{MC} [c/GeV]", "MC PULL: #mu_{1/p_{t}}^{TPC}", "MC PULL: #sigma_{1/p_{t}}^{TPC}"}
163 ,{"P", "p^{MC} [GeV/c]", "MC: #mu^{TPC}(#Deltap/p^{MC}) [%]", "MC: #sigma^{TPC}(#Deltap/p^{MC}) [%]"}
164 ,{"PullsP", "p^{MC} [GeV/c]", "MC PULL: #mu^{TPC}(#Deltap/#sigma_{p})", "MC PULL: #sigma^{TPC}(#Deltap/#sigma_{p})"}
165 // MC track TOF
166 ,{"PosZ", "tg(#theta)", "MC: #mu_{z}^{TOF} [#mum]", "MC: #sigma_{z}^{TOF} [#mum]"}
167 ,{"PullsZ", "tg(#theta)", "MC PULL: #mu_{z}^{TOF}", "MC PULL: #sigma_{z}^{TOF}"}
168 // MC track in TRD
169 ,{"PosY", "tg(#phi)", "MC: #mu_{y}^{Trk} [#mum]", "MC: #sigma_{y}^{Trk} [#mum]"}
170 ,{"PullsY", "tg(#phi)", "MC PULL: #mu_{y}^{Trk}", "MC PULL: #sigma_{y}^{Trk}"}
171 ,{"PosZ", "tg(#theta)", "MC: #mu_{z}^{Trk} [#mum]", "MC: #sigma_{z}^{Trk} [#mum]"}
172 ,{"PullsZ", "tg(#theta)", "MC PULL: #mu_{z}^{Trk}", "MC PULL: #sigma_{z}^{Trk}"}
173 ,{"Phi", "tg(#phi)", "MC: #mu_{#phi}^{Trk} [mrad]", "MC: #sigma_{#phi}^{Trk} [mrad]"}
174 ,{"PullsSNP", "tg(#phi)", "MC PULL: #mu_{snp}^{Trk}", "MC PULL: #sigma_{snp}^{Trk}"}
175 ,{"Theta", "tg(#theta)", "MC: #mu_{#theta}^{Trk} [mrad]", "MC: #sigma_{#theta}^{Trk} [mrad]"}
176 ,{"PullsTGL", "tg(#theta)", "MC PULL: #mu_{tgl}^{Trk}", "MC PULL: #sigma_{tgl}^{Trk}"}
92c40e64 177 ,{"MC Pt Layer", "p_{t} [GeV/c]", "#mu(#Deltap_{t}/p_{t}^{MC}) [%]", "#sigma(#Deltap_{t}/p_{t}^{MC}) [%]"}
178 ,{"MC Pulls1Pt Layer", "1/p_{t} [c/GeV]", "#mu_{1/p_{t}}", "#sigma_{1/p_{t}}"}
179 ,{"MC P Layer", "p [GeV/c]", "#mu(#Deltap/p^{MC}) [%]", "#sigma(#Deltap/p^{MC}) [%]"}
180 ,{"Pt - SA", "p_{t}^{MC} [GeV/c]", "MC: #mu^{Trk}(#Deltap_{t}/p_{t}^{MC}) [%]", "MC: #sigma^{Trk}(#Deltap_{t}/p_{t}^{MC}) [%]"}
181 ,{"Pulls1Pt - SA", "1/p_{t}^{MC} [c/GeV]", "MC PULL: #mu_{1/p_{t}}^{Trk}", "MC PULL: #sigma_{1/p_{t}}^{Trk}"}
182 ,{"P - SA", "p^{MC} [GeV/c]", "MC: #mu^{Trk}(#Deltap/p^{MC}) [%]", "MC: #sigma^{Trk}(#Deltap/p^{MC}) [%]"}
1ee39b3a 183};
184
185//________________________________________________________
186AliTRDresolution::AliTRDresolution()
187 :AliTRDrecoTask("resolution", "Spatial and momentum TRD resolution checker")
188 ,fStatus(0)
189 ,fIdxPlot(0)
92c40e64 190 ,fIdxFrame(0)
b91fdd71 191 ,fReconstructor(NULL)
192 ,fGeo(NULL)
92c40e64 193 ,fDBPDG(NULL)
b91fdd71 194 ,fGraphS(NULL)
195 ,fGraphM(NULL)
196 ,fCl(NULL)
197 ,fTrklt(NULL)
198 ,fMCcl(NULL)
199 ,fMCtrklt(NULL)
1ee39b3a 200{
201 //
202 // Default constructor
203 //
204
205 fReconstructor = new AliTRDReconstructor();
206 fReconstructor->SetRecoParam(AliTRDrecoParam::GetLowFluxParam());
207 fGeo = new AliTRDgeometry();
208
209 InitFunctorList();
210
211 DefineOutput(1, TObjArray::Class()); // cluster2track
212 DefineOutput(2, TObjArray::Class()); // tracklet2track
213 DefineOutput(3, TObjArray::Class()); // cluster2mc
214 DefineOutput(4, TObjArray::Class()); // tracklet2mc
215}
216
217//________________________________________________________
218AliTRDresolution::~AliTRDresolution()
219{
220 //
221 // Destructor
222 //
223
224 if(fGraphS){fGraphS->Delete(); delete fGraphS;}
225 if(fGraphM){fGraphM->Delete(); delete fGraphM;}
226 delete fGeo;
227 delete fReconstructor;
228 if(gGeoManager) delete gGeoManager;
229 if(fCl){fCl->Delete(); delete fCl;}
230 if(fTrklt){fTrklt->Delete(); delete fTrklt;}
231 if(fMCcl){fMCcl->Delete(); delete fMCcl;}
232 if(fMCtrklt){fMCtrklt->Delete(); delete fMCtrklt;}
233}
234
235
236//________________________________________________________
237void AliTRDresolution::CreateOutputObjects()
238{
239 // spatial resolution
240 OpenFile(0, "RECREATE");
241
242 fContainer = Histos();
243
244 fCl = new TObjArray();
245 fCl->SetOwner(kTRUE);
246 fTrklt = new TObjArray();
247 fTrklt->SetOwner(kTRUE);
248 fMCcl = new TObjArray();
249 fMCcl->SetOwner(kTRUE);
250 fMCtrklt = new TObjArray();
251 fMCtrklt->SetOwner(kTRUE);
252}
253
254//________________________________________________________
255void AliTRDresolution::Exec(Option_t *opt)
256{
257 //
258 // Execution part
259 //
260
261 fCl->Delete();
262 fTrklt->Delete();
263 fMCcl->Delete();
264 fMCtrklt->Delete();
265
266 AliTRDrecoTask::Exec(opt);
267
268 PostData(1, fCl);
269 PostData(2, fTrklt);
270 PostData(3, fMCcl);
271 PostData(4, fMCtrklt);
272}
273
274//________________________________________________________
275TH1* AliTRDresolution::PlotCharge(const AliTRDtrackV1 *track)
276{
277 //
278 // Plots the charge distribution
279 //
280
281 if(track) fkTrack = track;
282 if(!fkTrack){
92c40e64 283 AliDebug(2, "No Track defined.");
b91fdd71 284 return NULL;
1ee39b3a 285 }
b91fdd71 286 TObjArray *arr = NULL;
1ee39b3a 287 if(!(arr = ((TObjArray*)fContainer->At(kCharge)))){
288 AliWarning("No output container defined.");
b91fdd71 289 return NULL;
1ee39b3a 290 }
b91fdd71 291 TH3S* h = NULL;
1ee39b3a 292
b91fdd71 293 AliTRDseedV1 *fTracklet = NULL;
294 AliTRDcluster *c = NULL;
1ee39b3a 295 for(Int_t ily=0; ily<AliTRDgeometry::kNlayer; ily++){
296 if(!(fTracklet = fkTrack->GetTracklet(ily))) continue;
297 if(!fTracklet->IsOK()) continue;
298 Float_t x0 = fTracklet->GetX0();
299 Float_t dq, dl;
300 for(Int_t itb=AliTRDseedV1::kNtb; itb--;){
301 if(!(c = fTracklet->GetClusters(itb))){
302 if(!(c = fTracklet->GetClusters(AliTRDseedV1::kNtb+itb))) continue;
303 }
304 dq = fTracklet->GetdQdl(itb, &dl);
305 dl /= 0.15; // dl/dl0, dl0 = 1.5 mm for nominal vd
306 (h = (TH3S*)arr->At(0))->Fill(dl, x0-c->GetX(), dq);
307 }
308
309// if(!HasMCdata()) continue;
310// UChar_t s;
311// Float_t pt0, y0, z0, dydx0, dzdx0;
312// if(!fMC->GetDirections(x0, y0, z0, dydx0, dzdx0, pt0, s)) continue;
313
314 }
315 return h;
316}
317
318
319//________________________________________________________
320TH1* AliTRDresolution::PlotCluster(const AliTRDtrackV1 *track)
321{
322 //
323 // Plot the cluster distributions
324 //
325
326 if(track) fkTrack = track;
327 if(!fkTrack){
92c40e64 328 AliDebug(2, "No Track defined.");
b91fdd71 329 return NULL;
1ee39b3a 330 }
b91fdd71 331 TObjArray *arr = NULL;
1ee39b3a 332 if(!(arr = ((TObjArray*)fContainer->At(kCluster)))){
333 AliWarning("No output container defined.");
b91fdd71 334 return NULL;
1ee39b3a 335 }
05039659 336 ULong_t status = fkESD ? fkESD->GetStatus():0;
1ee39b3a 337
338 Double_t cov[7];
339 Float_t x0, y0, z0, dy, dydx, dzdx;
b91fdd71 340 AliTRDseedV1 *fTracklet = NULL;
1ee39b3a 341 for(Int_t ily=0; ily<AliTRDgeometry::kNlayer; ily++){
342 if(!(fTracklet = fkTrack->GetTracklet(ily))) continue;
343 if(!fTracklet->IsOK()) continue;
344 x0 = fTracklet->GetX0();
345
346 // retrive the track angle with the chamber
347 y0 = fTracklet->GetYref(0);
348 z0 = fTracklet->GetZref(0);
349 dydx = fTracklet->GetYref(1);
350 dzdx = fTracklet->GetZref(1);
351 fTracklet->GetCovRef(cov);
352 Float_t tilt = fTracklet->GetTilt();
b91fdd71 353 AliTRDcluster *c = NULL;
1ee39b3a 354 fTracklet->ResetClusterIter(kFALSE);
355 while((c = fTracklet->PrevCluster())){
356 Float_t xc = c->GetX();
357 Float_t yc = c->GetY();
358 Float_t zc = c->GetZ();
359 Float_t dx = x0 - xc;
360 Float_t yt = y0 - dx*dydx;
361 Float_t zt = z0 - dx*dzdx;
362 yc -= tilt*(zc-zt); // tilt correction
363 dy = yt - yc;
364
365 //Float_t sx2 = dydx*c->GetSX(c->GetLocalTimeBin()); sx2*=sx2;
366 Float_t sy2 = c->GetSigmaY2();
367 if(sy2<=0.) continue;
368 ((TH2I*)arr->At(0))->Fill(dydx, dy);
369 ((TH2I*)arr->At(1))->Fill(dydx, dy/TMath::Sqrt(cov[0] /*+ sx2*/ + sy2));
370
df0514f6 371 if(DebugLevel()>=2){
1ee39b3a 372 // Get z-position with respect to anode wire
1ee39b3a 373 Int_t istk = fGeo->GetStack(c->GetDetector());
374 AliTRDpadPlane *pp = fGeo->GetPadPlane(ily, istk);
375 Float_t row0 = pp->GetRow0();
376 Float_t d = row0 - zt + pp->GetAnodeWireOffset();
377 d -= ((Int_t)(2 * d)) / 2.0;
378 if (d > 0.25) d = 0.5 - d;
379
380 AliTRDclusterInfo *clInfo = new AliTRDclusterInfo;
381 fCl->Add(clInfo);
382 clInfo->SetCluster(c);
05039659 383 Float_t covR[] = {cov[0], cov[1], cov[2]};
384 clInfo->SetGlobalPosition(yt, zt, dydx, dzdx, covR);
1ee39b3a 385 clInfo->SetResolution(dy);
386 clInfo->SetAnisochronity(d);
387 clInfo->SetDriftLength(dx);
df0514f6 388 (*DebugStream()) << "ClusterREC"
05039659 389 <<"status=" << status
1ee39b3a 390 <<"clInfo.=" << clInfo
391 << "\n";
df0514f6 392 }
1ee39b3a 393 }
394 }
395 return (TH2I*)arr->At(0);
396}
397
398
399//________________________________________________________
400TH1* AliTRDresolution::PlotTracklet(const AliTRDtrackV1 *track)
401{
402// Plot normalized residuals for tracklets to track.
403//
404// We start from the result that if X=N(|m|, |Cov|)
405// BEGIN_LATEX
406// (Cov^{-1})^{1/2}X = N((Cov^{-1})^{1/2}*|m|, |1|)
407// END_LATEX
408// in our case X=(y_trklt - y_trk z_trklt - z_trk) and |Cov| = |Cov_trklt| + |Cov_trk| at the radial
409// reference position.
410 if(track) fkTrack = track;
411 if(!fkTrack){
92c40e64 412 AliDebug(2, "No Track defined.");
b91fdd71 413 return NULL;
1ee39b3a 414 }
b91fdd71 415 TObjArray *arr = NULL;
1ee39b3a 416 if(!(arr = (TObjArray*)fContainer->At(kTrackTRD ))){
417 AliWarning("No output container defined.");
b91fdd71 418 return NULL;
1ee39b3a 419 }
420
421 Double_t cov[3], covR[7]/*, sqr[3], inv[3]*/;
422 Float_t x, dx, dy, dz;
b91fdd71 423 AliTRDseedV1 *fTracklet = NULL;
1ee39b3a 424 for(Int_t il=AliTRDgeometry::kNlayer; il--;){
425 if(!(fTracklet = fkTrack->GetTracklet(il))) continue;
426 if(!fTracklet->IsOK()) continue;
427 x = fTracklet->GetX();
428 dx = fTracklet->GetX0() - x;
429 // compute dy^2 and dz^2
430 dy = fTracklet->GetYref(0)-dx*fTracklet->GetYref(1) - fTracklet->GetY();
431 dz = fTracklet->GetZref(0)-dx*fTracklet->GetZref(1) - fTracklet->GetZ();
432 // compute covariance matrix
433 fTracklet->GetCovAt(x, cov);
434 fTracklet->GetCovRef(covR);
435 cov[0] += covR[0]; cov[1] += covR[1]; cov[2] += covR[2];
436/* // Correct PULL calculation by considering off
437 // diagonal elements in the covariance matrix
438 // compute square root matrix
439 if(AliTRDseedV1::GetCovInv(cov, inv)==0.) continue;
440 if(AliTRDseedV1::GetCovSqrt(inv, sqr)<0.) continue;
441 Double_t y = sqr[0]*dy+sqr[1]*dz;
442 Double_t z = sqr[1]*dy+sqr[2]*dz;
443 ((TH3*)h)->Fill(y, z, fTracklet->GetYref(1));*/
444
445 ((TH2I*)arr->At(0))->Fill(fTracklet->GetYref(1), dy);
446 ((TH2I*)arr->At(1))->Fill(fTracklet->GetYref(1), dy/TMath::Sqrt(cov[0]));
447 ((TH2I*)arr->At(4))->Fill(fTracklet->GetYref(1), TMath::ATan((fTracklet->GetYref(1)-fTracklet->GetYfit(1))/(1-fTracklet->GetYref(1)*fTracklet->GetYfit(1))));
448 if(!fTracklet->IsRowCross()) continue;
449 ((TH2I*)arr->At(2))->Fill(fTracklet->GetZref(1), dz);
450 ((TH2I*)arr->At(3))->Fill(fTracklet->GetZref(1), dz/TMath::Sqrt(cov[2]));
451 }
452
453
454 return (TH2I*)arr->At(0);
455}
456
457
458//________________________________________________________
459TH1* AliTRDresolution::PlotTrackTPC(const AliTRDtrackV1 *track)
460{
461// Store resolution/pulls of Kalman before updating with the TRD information
462// at the radial position of the first tracklet. The following points are used
463// for comparison
464// - the (y,z,snp) of the first TRD tracklet
465// - the (y, z, snp, tgl, pt) of the MC track reference
466//
467// Additionally the momentum resolution/pulls are calculated for usage in the
468// PID calculation.
469
470 if(track) fkTrack = track;
471 if(!fkTrack){
92c40e64 472 AliDebug(2, "No Track defined.");
b91fdd71 473 return NULL;
1ee39b3a 474 }
b91fdd71 475 AliExternalTrackParam *tin = NULL;
1ee39b3a 476 if(!(tin = fkTrack->GetTrackLow())){
477 AliWarning("Track did not entered TRD fiducial volume.");
b91fdd71 478 return NULL;
1ee39b3a 479 }
b91fdd71 480 TH1 *h = NULL;
1ee39b3a 481
482 Double_t x = tin->GetX();
b91fdd71 483 AliTRDseedV1 *tracklet = NULL;
1ee39b3a 484 for(Int_t ily=0; ily<AliTRDgeometry::kNlayer; ily++){
485 if(!(tracklet = fkTrack->GetTracklet(ily))) continue;
486 break;
487 }
488 if(!tracklet || TMath::Abs(x-tracklet->GetX())>1.e-3){
489 AliWarning("Tracklet did not match TRD entrance.");
b91fdd71 490 return NULL;
1ee39b3a 491 }
492 const Int_t kNPAR(5);
493 Double_t parR[kNPAR]; memcpy(parR, tin->GetParameter(), kNPAR*sizeof(Double_t));
494 Double_t covR[3*kNPAR]; memcpy(covR, tin->GetCovariance(), 3*kNPAR*sizeof(Double_t));
495 Double_t cov[3]; tracklet->GetCovAt(x, cov);
496
497 // define sum covariances
498 TMatrixDSym COV(kNPAR); TVectorD PAR(kNPAR);
499 Double_t *pc = &covR[0], *pp = &parR[0];
500 for(Int_t ir=0; ir<kNPAR; ir++, pp++){
501 PAR(ir) = (*pp);
502 for(Int_t ic = 0; ic<=ir; ic++,pc++){
503 COV(ir,ic) = (*pc); COV(ic,ir) = (*pc);
504 }
505 }
506 PAR[4] = TMath::Abs(PAR[4]); // remove sign of pt !!
507 //COV.Print(); PAR.Print();
508
509 //TODO Double_t dydx = TMath::Sqrt(1.-parR[2]*parR[2])/parR[2];
510 Double_t dy = parR[0] - tracklet->GetY();
511 TObjArray *arr = (TObjArray*)fContainer->At(kTrackTPC);
512 ((TH2I*)arr->At(0))->Fill(tracklet->GetYref(1), dy);
513 ((TH2I*)arr->At(1))->Fill(tracklet->GetYref(1), dy/TMath::Sqrt(COV(0,0)+cov[0]));
514 if(tracklet->IsRowCross()){
515 Double_t dz = parR[1] - tracklet->GetZ();
516 ((TH2I*)arr->At(2))->Fill(tracklet->GetZref(1), dz);
517 ((TH2I*)arr->At(3))->Fill(tracklet->GetZref(1), dz/TMath::Sqrt(COV(1,1)+cov[2]));
518 }
519 Double_t dphi = TMath::ASin(PAR[2])-TMath::ATan(tracklet->GetYfit(1)); ((TH2I*)arr->At(4))->Fill(tracklet->GetYref(1), dphi);
520
521
522 // register reference histo for mini-task
523 h = (TH2I*)arr->At(0);
524
525 if(DebugLevel()>=1){
526 (*DebugStream()) << "trackIn"
527 << "x=" << x
528 << "P=" << &PAR
529 << "C=" << &COV
530 << "\n";
531
532 Double_t y = tracklet->GetY();
533 Double_t z = tracklet->GetZ();
534 (*DebugStream()) << "trackletIn"
535 << "y=" << y
536 << "z=" << z
537 << "Vy=" << cov[0]
538 << "Cyz=" << cov[1]
539 << "Vz=" << cov[2]
540 << "\n";
541 }
542
543
544 if(!HasMCdata()) return h;
545 UChar_t s;
546 Float_t dx, pt0, x0=tracklet->GetX0(), y0, z0, dydx0, dzdx0;
547 if(!fkMC->GetDirections(x0, y0, z0, dydx0, dzdx0, pt0, s)) return h;
92c40e64 548 Int_t pdg = fkMC->GetPDG(),
549 sIdx(AliTRDpidUtil::Pdg2Pid(TMath::Abs(pdg))+1), // species index
550 sign(0);
551 if(!fDBPDG) fDBPDG=TDatabasePDG::Instance();
552 TParticlePDG *ppdg(fDBPDG->GetParticle(pdg));
553 if(ppdg) sign = ppdg->Charge() > 0. ? 1 : -1;
554
1ee39b3a 555 // translate to reference radial position
556 dx = x0 - x; y0 -= dx*dydx0; z0 -= dx*dzdx0;
557 Float_t norm = 1./TMath::Sqrt(1.+dydx0*dydx0); // 1/sqrt(1+tg^2(phi))
558 //Fill MC info
559 TVectorD PARMC(kNPAR);
560 PARMC[0]=y0; PARMC[1]=z0;
561 PARMC[2]=dydx0*norm; PARMC[3]=dzdx0*norm;
562 PARMC[4]=1./pt0;
563
564// TMatrixDSymEigen eigen(COV);
565// TVectorD evals = eigen.GetEigenValues();
566// TMatrixDSym evalsm(kNPAR);
567// for(Int_t ir=0; ir<kNPAR; ir++) for(Int_t ic=0; ic<kNPAR; ic++) evalsm(ir,ic) = (ir==ic ? evals(ir): 0.);
568// TMatrixD evecs = eigen.GetEigenVectors();
569// TMatrixD sqrcov(evecs, TMatrixD::kMult, TMatrixD(evalsm, TMatrixD::kMult, evecs.T()));
570
571 // fill histos
572 arr = (TObjArray*)fContainer->At(kMCtrackTPC);
573 // y resolution/pulls
574 ((TH2I*)arr->At(0))->Fill(dydx0, PARMC[0]-PAR[0]);
575 ((TH2I*)arr->At(1))->Fill(dydx0, (PARMC[0]-PAR[0])/TMath::Sqrt(COV(0,0)));
576 // z resolution/pulls
577 ((TH2I*)arr->At(2))->Fill(dzdx0, PARMC[1]-PAR[1]);
578 ((TH2I*)arr->At(3))->Fill(dzdx0, (PARMC[1]-PAR[1])/TMath::Sqrt(COV(1,1)));
579 // phi resolution/snp pulls
580 ((TH2I*)arr->At(4))->Fill(dydx0, TMath::ASin(PARMC[2])-TMath::ASin(PAR[2]));
581 ((TH2I*)arr->At(5))->Fill(dydx0, (PARMC[2]-PAR[2])/TMath::Sqrt(COV(2,2)));
582 // theta resolution/tgl pulls
583 ((TH2I*)arr->At(6))->Fill(dzdx0, TMath::ATan((PARMC[3]-PAR[3])/(1-PARMC[3]*PAR[3])));
584 ((TH2I*)arr->At(7))->Fill(dzdx0, (PARMC[3]-PAR[3])/TMath::Sqrt(COV(3,3)));
585 // pt resolution\\1/pt pulls\\p resolution/pull
92c40e64 586 ((TH3S*)arr->At(8))->Fill(pt0, PARMC[4]/PAR[4]-1., sign*sIdx);
587 ((TH3S*)arr->At(9))->Fill(PARMC[4], (PARMC[4]-PAR[4])/TMath::Sqrt(COV(4,4)), sign*sIdx);
588
589 Double_t p0 = TMath::Sqrt(1.+ PARMC[3]*PARMC[3])*pt0, p;
4226db3e 590 p = TMath::Sqrt(1.+ PAR[3]*PAR[3])/PAR[4];
92c40e64 591 Float_t sp =
4226db3e 592 p*p*PAR[4]*PAR[4]*COV(4,4)
593 +2.*PAR[3]*COV(3,4)/PAR[4]
594 +PAR[3]*PAR[3]*COV(3,3)/p/p/PAR[4]/PAR[4]/PAR[4]/PAR[4];
92c40e64 595 ((TH3S*)arr->At(10))->Fill(p0, p/p0-1., sign*sIdx);
596 if(sp>0.) ((TH3S*)arr->At(11))->Fill(p0, (p0-p)/TMath::Sqrt(sp), sign*sIdx);
1ee39b3a 597
598 // fill debug for MC
599 if(DebugLevel()>=1){
600 (*DebugStream()) << "trackInMC"
601 << "P=" << &PARMC
602 << "\n";
603 }
604 return h;
605}
606
607//________________________________________________________
608TH1* AliTRDresolution::PlotMC(const AliTRDtrackV1 *track)
609{
610 //
611 // Plot MC distributions
612 //
613
614 if(!HasMCdata()){
615 AliWarning("No MC defined. Results will not be available.");
b91fdd71 616 return NULL;
1ee39b3a 617 }
618 if(track) fkTrack = track;
619 if(!fkTrack){
92c40e64 620 AliDebug(2, "No Track defined.");
b91fdd71 621 return NULL;
1ee39b3a 622 }
92c40e64 623 // retriev track characteristics
624 Int_t pdg = fkMC->GetPDG(),
625 sIdx(AliTRDpidUtil::Pdg2Pid(TMath::Abs(pdg))+1), // species index
626 sign(0),
627 det(-1),
628 label(fkMC->GetLabel());
629 if(!fDBPDG) fDBPDG=TDatabasePDG::Instance();
630 TParticlePDG *ppdg(fDBPDG->GetParticle(pdg));
631 if(ppdg) sign = ppdg->Charge() > 0. ? 1 : -1;
632 Bool_t kBarrel = Bool_t(fkESD->GetStatus() & AliESDtrack::kTRDin);
633
634 TObjArray *arr(NULL);TH1 *h(NULL);
1ee39b3a 635 UChar_t s;
1ee39b3a 636 Double_t xAnode, x, y, z, pt, dydx, dzdx, dzdl;
637 Float_t pt0, x0, y0, z0, dx, dy, dz, dydx0, dzdx0;
638 Double_t covR[7]/*, cov[3]*/;
639
640 if(DebugLevel()>=1){
5066aa9a 641 TVectorD dX(12), dY(12), dZ(12), Pt(12), dPt(12), cCOV(12*15);
642 fkMC->PropagateKalman(&dX, &dY, &dZ, &Pt, &dPt, &cCOV);
1ee39b3a 643 (*DebugStream()) << "MCkalman"
4226db3e 644 << "pdg=" << pdg
645 << "dx=" << &dX
646 << "dy=" << &dY
647 << "dz=" << &dZ
5066aa9a 648 << "pt=" << &Pt
4226db3e 649 << "dpt=" << &dPt
650 << "cov=" << &cCOV
1ee39b3a 651 << "\n";
652 }
653
654 AliTRDReconstructor rec;
d43e2ad1 655 AliTRDseedV1 *fTracklet(NULL); TObjArray *clInfoArr(NULL);
1ee39b3a 656 for(Int_t ily=0; ily<AliTRDgeometry::kNlayer; ily++){
657 if(!(fTracklet = fkTrack->GetTracklet(ily)))/* ||
658 !fTracklet->IsOK())*/ continue;
659
660 det = fTracklet->GetDetector();
661 x0 = fTracklet->GetX0();
662 //radial shift with respect to the MC reference (radial position of the pad plane)
663 x= fTracklet->GetX();
664 if(!fkMC->GetDirections(x0, y0, z0, dydx0, dzdx0, pt0, s)) continue;
665 xAnode = fTracklet->GetX0();
666
667 // MC track position at reference radial position
668 dx = x0 - x;
669 if(DebugLevel()>=1){
670 (*DebugStream()) << "MC"
671 << "det=" << det
672 << "pdg=" << pdg
92c40e64 673 << "sgn=" << sign
4226db3e 674 << "barrel=" << kBarrel
1ee39b3a 675 << "pt=" << pt0
676 << "x=" << x0
677 << "y=" << y0
678 << "z=" << z0
679 << "dydx=" << dydx0
680 << "dzdx=" << dzdx0
681 << "\n";
682 }
683 Float_t ymc = y0 - dx*dydx0;
684 Float_t zmc = z0 - dx*dzdx0;
685 //p = pt0*TMath::Sqrt(1.+dzdx0*dzdx0); // pt -> p
686
687 // Kalman position at reference radial position
688 dx = xAnode - x;
689 dydx = fTracklet->GetYref(1);
690 dzdx = fTracklet->GetZref(1);
691 dzdl = fTracklet->GetTgl();
692 y = fTracklet->GetYref(0) - dx*dydx;
693 dy = y - ymc;
694 z = fTracklet->GetZref(0) - dx*dzdx;
695 dz = z - zmc;
696 pt = TMath::Abs(fTracklet->GetPt());
697 fTracklet->GetCovRef(covR);
698
699 arr = (TObjArray*)fContainer->At(kMCtrackTRD);
700 // y resolution/pulls
701 ((TH2I*)arr->At(0))->Fill(dydx0, dy);
702 ((TH2I*)arr->At(1))->Fill(dydx0, dy/TMath::Sqrt(covR[0]));
703 // z resolution/pulls
704 ((TH2I*)arr->At(2))->Fill(dzdx0, dz);
705 ((TH2I*)arr->At(3))->Fill(dzdx0, dz/TMath::Sqrt(covR[2]));
706 // phi resolution/ snp pulls
707 Double_t dtgp = (dydx - dydx0)/(1.- dydx*dydx0);
708 ((TH2I*)arr->At(4))->Fill(dydx0, TMath::ATan(dtgp));
709 Double_t dsnp = dydx/TMath::Sqrt(1.+dydx*dydx) - dydx0/TMath::Sqrt(1.+dydx0*dydx0);
710 ((TH2I*)arr->At(5))->Fill(dydx0, dsnp/TMath::Sqrt(covR[3]));
711 // theta resolution/ tgl pulls
712 Double_t dzdl0 = dzdx0/TMath::Sqrt(1.+dydx0*dydx0),
713 dtgl = (dzdl - dzdl0)/(1.- dzdl*dzdl0);
714 ((TH2I*)arr->At(6))->Fill(dzdl0,
715 TMath::ATan(dtgl));
716 ((TH2I*)arr->At(7))->Fill(dzdl0, (dzdl - dzdl0)/TMath::Sqrt(covR[4]));
717 // pt resolution \\ 1/pt pulls \\ p resolution for PID
92c40e64 718 Double_t p0 = TMath::Sqrt(1.+ dzdl0*dzdl0)*pt0,
719 p = TMath::Sqrt(1.+ dzdl*dzdl)*pt;
720 if(kBarrel){
721 ((TH3S*)((TObjArray*)arr->At(8))->At(ily))->Fill(pt0, pt/pt0-1., sign*sIdx);
722 ((TH3S*)((TObjArray*)arr->At(9))->At(ily))->Fill(1./pt0, (1./pt-1./pt0)/TMath::Sqrt(covR[6]), sign*sIdx);
723 ((TH3S*)((TObjArray*)arr->At(10))->At(ily))->Fill(p0, p/p0-1., sign*sIdx);
724 } else {
725 ((TH3S*)((TObjArray*)arr->At(11))->At(ily))->Fill(pt0, pt/pt0-1., sign*sIdx);
726 ((TH3S*)((TObjArray*)arr->At(12))->At(ily))->Fill(1./pt0, (1./pt-1./pt0)/TMath::Sqrt(covR[6]), sign*sIdx);
727 ((TH3S*)((TObjArray*)arr->At(13))->At(ily))->Fill(p0, p/p0-1., sign*sIdx);
1ee39b3a 728 }
729
730 // Fill Debug stream for Kalman track
731 if(DebugLevel()>=1){
732 (*DebugStream()) << "MCtrack"
733 << "pt=" << pt
734 << "x=" << x
735 << "y=" << y
736 << "z=" << z
737 << "dydx=" << dydx
738 << "dzdx=" << dzdx
739 << "s2y=" << covR[0]
740 << "s2z=" << covR[2]
741 << "\n";
742 }
743
744 // recalculate tracklet based on the MC info
745 AliTRDseedV1 tt(*fTracklet);
746 tt.SetZref(0, z0 - (x0-xAnode)*dzdx0);
747 tt.SetZref(1, dzdx0);
748 tt.SetReconstructor(&rec);
749 tt.Fit(kTRUE, kTRUE);
750 x= tt.GetX();y= tt.GetY();z= tt.GetZ();
751 dydx = tt.GetYfit(1);
752 dx = x0 - x;
753 ymc = y0 - dx*dydx0;
754 zmc = z0 - dx*dzdx0;
755 Bool_t rc = tt.IsRowCross();
756
757 // add tracklet residuals for y and dydx
758 arr = (TObjArray*)fContainer->At(kMCtracklet);
759 if(!rc){
760 dy = y-ymc;
761
762 Float_t dphi = (dydx - dydx0);
763 dphi /= (1.- dydx*dydx0);
764
92c40e64 765 ((TH3S*)arr->At(0))->Fill(dydx0, dy, pt0);
1ee39b3a 766 if(tt.GetS2Y()>0.) ((TH2I*)arr->At(1))->Fill(dydx0, dy/TMath::Sqrt(tt.GetS2Y()));
767 ((TH2I*)arr->At(4))->Fill(dydx0, TMath::ATan(dphi));
768 } else {
769 // add tracklet residuals for z
770 dz = z-zmc;
771 ((TH2I*)arr->At(2))->Fill(dzdl0, dz);
772 if(tt.GetS2Z()>0.) ((TH2I*)arr->At(3))->Fill(dzdl0, dz/TMath::Sqrt(tt.GetS2Z()));
773 }
774
775 // Fill Debug stream for tracklet
776 if(DebugLevel()>=1){
777 Float_t s2y = tt.GetS2Y();
778 Float_t s2z = tt.GetS2Z();
779 (*DebugStream()) << "MCtracklet"
780 << "rc=" << rc
781 << "x=" << x
782 << "y=" << y
783 << "z=" << z
784 << "dydx=" << dydx
785 << "s2y=" << s2y
786 << "s2z=" << s2z
787 << "\n";
788 }
789
790 Int_t istk = AliTRDgeometry::GetStack(det);
791 AliTRDpadPlane *pp = fGeo->GetPadPlane(ily, istk);
792 Float_t zr0 = pp->GetRow0() + pp->GetAnodeWireOffset();
793 Float_t tilt = fTracklet->GetTilt();
794 //Double_t exb = AliTRDCommonParam::Instance()->GetOmegaTau(1.5);
795
796 arr = (TObjArray*)fContainer->At(kMCcluster);
b91fdd71 797 AliTRDcluster *c = NULL;
1ee39b3a 798 fTracklet->ResetClusterIter(kFALSE);
799 while((c = fTracklet->PrevCluster())){
800 Float_t q = TMath::Abs(c->GetQ());
801 x = c->GetX(); y = c->GetY();z = c->GetZ();
802 dx = x0 - x;
803 ymc= y0 - dx*dydx0;
804 zmc= z0 - dx*dzdx0;
df0514f6 805 dy = (y - tilt*(z-zmc)) - ymc;
1ee39b3a 806 // Fill Histograms
807 if(q>20. && q<250.){
92c40e64 808 ((TH3S*)arr->At(0))->Fill(dydx0, dy, pt0);
1ee39b3a 809 ((TH2I*)arr->At(1))->Fill(dydx0, dy/TMath::Sqrt(c->GetSigmaY2()));
810 }
811
812 // Fill calibration container
813 Float_t d = zr0 - zmc;
814 d -= ((Int_t)(2 * d)) / 2.0;
815 if (d > 0.25) d = 0.5 - d;
816 AliTRDclusterInfo *clInfo = new AliTRDclusterInfo;
1ee39b3a 817 clInfo->SetCluster(c);
818 clInfo->SetMC(pdg, label);
819 clInfo->SetGlobalPosition(ymc, zmc, dydx0, dzdx0);
820 clInfo->SetResolution(dy);
821 clInfo->SetAnisochronity(d);
d43e2ad1 822 clInfo->SetDriftLength(dx-.5*AliTRDgeometry::CamHght());
1ee39b3a 823 clInfo->SetTilt(tilt);
d43e2ad1 824 fMCcl->Add(clInfo);
825 if(DebugLevel()>=2){
826 if(!clInfoArr) clInfoArr=new TObjArray(AliTRDseedV1::kNclusters);
827 clInfoArr->Add(clInfo);
1ee39b3a 828 }
829 }
d43e2ad1 830 // Fill Debug Tree
831 if(DebugLevel()>=2 && clInfoArr){
832 (*DebugStream()) << "MCcluster"
833 <<"clInfo.=" << clInfoArr
834 << "\n";
92c40e64 835 clInfoArr->Clear();
d43e2ad1 836 }
1ee39b3a 837 }
92c40e64 838 if(clInfoArr) delete clInfoArr;
1ee39b3a 839 return h;
840}
841
842
843//________________________________________________________
844Bool_t AliTRDresolution::GetRefFigure(Int_t ifig)
845{
846 //
847 // Get the reference figures
848 //
849
850 Float_t xy[4] = {0., 0., 0., 0.};
851 if(!gPad){
852 AliWarning("Please provide a canvas to draw results.");
853 return kFALSE;
854 }
b91fdd71 855 TList *l = NULL; TVirtualPad *pad=NULL;
1ee39b3a 856 switch(ifig){
857 case kCharge:
858 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
859 ((TVirtualPad*)l->At(0))->cd();
860 ((TGraphAsymmErrors*)((TObjArray*)fGraphM->At(kCharge))->At(0))->Draw("apl");
861 ((TVirtualPad*)l->At(1))->cd();
862 ((TGraphErrors*)((TObjArray*)fGraphS->At(kCharge))->At(0))->Draw("apl");
863 break;
864 case kCluster:
865 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
866 xy[0] = -.3; xy[1] = -200.; xy[2] = .3; xy[3] = 1000.;
867 ((TVirtualPad*)l->At(0))->cd();
868 if(!GetGraphPlot(&xy[0], kCluster, 0)) break;
869 xy[0] = -.3; xy[1] = -0.5; xy[2] = .3; xy[3] = 2.5;
870 ((TVirtualPad*)l->At(1))->cd();
871 if(!GetGraphPlot(&xy[0], kCluster, 1)) break;
872 return kTRUE;
873 case kTrackTRD :
874 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
875 xy[0] = -.3; xy[1] = -500.; xy[2] = .3; xy[3] = 1500.;
876 ((TVirtualPad*)l->At(0))->cd();
877 if(!GetGraphPlot(&xy[0], kTrackTRD , 0)) break;
878 xy[0] = -.3; xy[1] = -0.5; xy[2] = .3; xy[3] = 2.5;
879 ((TVirtualPad*)l->At(1))->cd();
880 if(!GetGraphPlot(&xy[0], kTrackTRD , 1)) break;
881 return kTRUE;
882 case 3: // kTrackTRD z
883 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
884 xy[0] = -1.; xy[1] = -1000.; xy[2] = 1.; xy[3] = 4000.;
885 ((TVirtualPad*)l->At(0))->cd();
886 if(!GetGraphPlot(&xy[0], kTrackTRD , 2)) break;
887 xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 2.5;
888 ((TVirtualPad*)l->At(1))->cd();
889 if(!GetGraphPlot(&xy[0], kTrackTRD , 3)) break;
890 return kTRUE;
891 case 4: // kTrackTRD phi
892 xy[0] = -.3; xy[1] = -5.; xy[2] = .3; xy[3] = 50.;
893 if(GetGraphPlot(&xy[0], kTrackTRD , 4)) return kTRUE;
894 break;
895 case 5: // kTrackTPC y
896 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
897 xy[0] = -.3; xy[1] = -500.; xy[2] = .3; xy[3] = 1500.;
898 pad = ((TVirtualPad*)l->At(0)); pad->cd();
899 pad->SetMargin(0.1, 0.1, 0.1, 0.01);
900 if(!GetGraphPlot(&xy[0], kTrackTPC, 0)) break;
901 xy[0] = -.3; xy[1] = -0.5; xy[2] = .3; xy[3] = 2.5;
902 pad=((TVirtualPad*)l->At(1)); pad->cd();
903 pad->SetMargin(0.1, 0.1, 0.1, 0.01);
904 if(!GetGraphPlot(&xy[0], kTrackTPC, 1)) break;
905 return kTRUE;
906 case 6: // kTrackTPC z
907 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
908 xy[0] = -1.; xy[1] = -1000.; xy[2] = 1.; xy[3] = 4000.;
909 pad = ((TVirtualPad*)l->At(0)); pad->cd();
910 pad->SetMargin(0.1, 0.1, 0.1, 0.01);
911 if(!GetGraphPlot(&xy[0], kTrackTPC, 2)) break;
912 xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 2.5;
913 pad = ((TVirtualPad*)l->At(1)); pad->cd();
914 pad->SetMargin(0.1, 0.1, 0.1, 0.01);
915 if(!GetGraphPlot(&xy[0], kTrackTPC, 3)) break;
916 return kTRUE;
917 case 7: // kTrackTPC phi
918 xy[0] = -.3; xy[1] = -5.; xy[2] = .3; xy[3] = 50.;
919 if(GetGraphPlot(&xy[0], kTrackTPC, 4)) return kTRUE;
920 break;
92c40e64 921 case 8: // kMCcluster pt <2 GeV/c
1ee39b3a 922 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
923 xy[0]=-.3; xy[1]=-50.; xy[2]=.3; xy[3]=650.;
924 ((TVirtualPad*)l->At(0))->cd();
925 if(!GetGraphPlot(&xy[0], kMCcluster, 0)) break;
1ee39b3a 926 ((TVirtualPad*)l->At(1))->cd();
927 if(!GetGraphPlot(&xy[0], kMCcluster, 1)) break;
928 return kTRUE;
92c40e64 929 case 9: // kMCcluster pt > 3 GeV/c
930 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
931 xy[0]=-.3; xy[1]=-50.; xy[2]=.3; xy[3]=650.;
932 ((TVirtualPad*)l->At(0))->cd();
933 if(!GetGraphPlot(&xy[0], kMCcluster, 2)) break;
934 xy[0] = -.3; xy[1] = -0.5; xy[2] = .3; xy[3] = 2.5;
935 ((TVirtualPad*)l->At(1))->cd();
936 if(!GetGraphPlot(&xy[0], kMCcluster, 3)) break;
937 return kTRUE;
938 case 10: //kMCtracklet [y] pt < 3 GeV/c
1ee39b3a 939 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
940 xy[0]=-.2; xy[1]=-50.; xy[2]=.2; xy[3] =250.;
941 ((TVirtualPad*)l->At(0))->cd();
942 if(!GetGraphPlot(&xy[0], kMCtracklet, 0)) break;
1ee39b3a 943 ((TVirtualPad*)l->At(1))->cd();
944 if(!GetGraphPlot(&xy[0], kMCtracklet, 1)) break;
945 return kTRUE;
92c40e64 946 case 11: //kMCtracklet [y] pt > 3 GeV/c
1ee39b3a 947 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
92c40e64 948 xy[0]=-.2; xy[1]=-50.; xy[2]=.2; xy[3] =250.;
1ee39b3a 949 ((TVirtualPad*)l->At(0))->cd();
950 if(!GetGraphPlot(&xy[0], kMCtracklet, 2)) break;
92c40e64 951 xy[0] = -.2; xy[1] = -0.5; xy[2] = .2; xy[3] = 2.5;
1ee39b3a 952 ((TVirtualPad*)l->At(1))->cd();
953 if(!GetGraphPlot(&xy[0], kMCtracklet, 3)) break;
954 return kTRUE;
92c40e64 955 case 12: //kMCtracklet [z]
956 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
957 xy[0]=-1.; xy[1]=-100.; xy[2]=1.; xy[3] =2500.;
958 ((TVirtualPad*)l->At(0))->cd();
1ee39b3a 959 if(!GetGraphPlot(&xy[0], kMCtracklet, 4)) break;
92c40e64 960 xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 2.5;
961 ((TVirtualPad*)l->At(1))->cd();
962 if(!GetGraphPlot(&xy[0], kMCtracklet, 5)) break;
963 return kTRUE;
964 case 13: //kMCtracklet [phi]
965 xy[0]=-.3; xy[1]=-3.; xy[2]=.3; xy[3] =25.;
966 if(!GetGraphPlot(&xy[0], kMCtracklet, 6)) break;
1ee39b3a 967 return kTRUE;
92c40e64 968 case 14: //kMCtrackTRD [y]
1ee39b3a 969 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
970 xy[0]=-.2; xy[1]=-50.; xy[2]=.2; xy[3] =200.;
971 ((TVirtualPad*)l->At(0))->cd();
972 if(!GetGraphPlot(&xy[0], kMCtrackTRD, 0)) break;
973 xy[0] = -.2; xy[1] = -0.5; xy[2] = .2; xy[3] = 2.5;
974 ((TVirtualPad*)l->At(1))->cd();
975 if(!GetGraphPlot(&xy[0], kMCtrackTRD, 1)) break;
976 return kTRUE;
92c40e64 977 case 15: //kMCtrackTRD [z]
1ee39b3a 978 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
979 xy[0]=-1.; xy[1]=-700.; xy[2]=1.; xy[3] =1500.;
980 ((TVirtualPad*)l->At(0))->cd();
981 if(!GetGraphPlot(&xy[0], kMCtrackTRD, 2)) break;
982 xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 2.5;
983 ((TVirtualPad*)l->At(1))->cd();
984 if(!GetGraphPlot(&xy[0], kMCtrackTRD, 3)) break;
985 return kTRUE;
92c40e64 986 case 16: //kMCtrackTRD [phi/snp]
1ee39b3a 987 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
988 xy[0]=-.2; xy[1]=-0.2; xy[2]=.2; xy[3] =2.;
989 ((TVirtualPad*)l->At(0))->cd();
990 if(!GetGraphPlot(&xy[0], kMCtrackTRD, 4)) break;
991 xy[0] = -.2; xy[1] = -0.5; xy[2] = .2; xy[3] = 2.5;
992 ((TVirtualPad*)l->At(1))->cd();
993 if(!GetGraphPlot(&xy[0], kMCtrackTRD, 5)) break;
994 return kTRUE;
92c40e64 995 case 17: //kMCtrackTRD [theta/tgl]
1ee39b3a 996 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
997 xy[0]=-1.; xy[1]=-0.5; xy[2]=1.; xy[3] =5.;
998 ((TVirtualPad*)l->At(0))->cd();
999 if(!GetGraphPlot(&xy[0], kMCtrackTRD, 6)) break;
1000 xy[0] = -.2; xy[1] = -0.5; xy[2] = .2; xy[3] = 2.5;
1001 ((TVirtualPad*)l->At(1))->cd();
1002 if(!GetGraphPlot(&xy[0], kMCtrackTRD, 7)) break;
1003 return kTRUE;
92c40e64 1004 case 18: //kMCtrackTRD [pt]
1005 xy[0] = 0.4; xy[1] = -.7; xy[2] = 12.; xy[3] = 4.;
1006 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1007 pad = (TVirtualPad*)l->At(0); pad->cd();
1008 pad->SetMargin(0.07, 0.07, 0.1, 0.1);
1009 if(!GetGraphTrack(&xy[0], 8, 2, 7)) break;
1010 pad->Modified(); pad->SetLogx();
1011 pad = (TVirtualPad*)l->At(1); pad->cd();
1012 pad->SetMargin(0.07, 0.07, 0.1, 0.1);
1013 if(!GetGraphTrack(&xy[0], 8, 55+2, 7, kTRUE)) break;
1014 pad->Modified(); pad->SetLogx();
1015 return kTRUE;
1016 case 19: //kMCtrackTRD [1/pt] pulls
1017 xy[0] = 0.; xy[1] = -1.5; xy[2] = 2.; xy[3] = 2.;
1018 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1019 pad = (TVirtualPad*)l->At(0); pad->cd();
1020 pad->SetMargin(0.07, 0.07, 0.1, 0.1);
1021 if(!GetGraphTrack(&xy[0], 9, 2, 7)) break;
1022 pad = (TVirtualPad*)l->At(1); pad->cd();
1023 pad->SetMargin(0.07, 0.07, 0.1, 0.1);
1024 if(!GetGraphTrack(&xy[0], 9, 55+2, 7, kTRUE)) break;
1025 return kTRUE;
1026 case 20: //kMCtrackTRD [p]
1027 xy[0] = 0.4; xy[1] = -.7; xy[2] = 12.; xy[3] = 4.;
1028 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1029 pad = (TVirtualPad*)l->At(0); pad->cd();
1030 pad->SetMargin(0.07, 0.07, 0.1, 0.1);
1031 if(!GetGraphTrack(&xy[0], 10, 2, 7)) break;
1032 pad->SetLogx();
1033 pad = (TVirtualPad*)l->At(1); pad->cd();
1034 pad->SetMargin(0.07, 0.07, 0.1, 0.1);
1035 if(!GetGraphTrack(&xy[0], 10, 55+2, 7, kTRUE)) break;
1036 pad->SetLogx();
1037 return kTRUE;
1038 case 21: //kMCtrackTRD - SA [pt]
1ee39b3a 1039 xy[0] = 0.; xy[1] = -5.; xy[2] = 12.; xy[3] = 7.;
92c40e64 1040 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1041 pad = (TVirtualPad*)l->At(0); pad->cd();
1042 pad->SetMargin(0.07, 0.07, 0.1, 0.1);
1043 if(!GetGraphTrack(&xy[0], 11, 2, 7)) break;
1044 pad->SetLogx();
1045 pad = (TVirtualPad*)l->At(1); pad->cd();
1046 pad->SetMargin(0.07, 0.07, 0.1, 0.1);
1047 if(!GetGraphTrack(&xy[0], 11, 55+2, 7, kTRUE)) break;
1048 pad->SetLogx();
1ee39b3a 1049 return kTRUE;
92c40e64 1050 case 22: //kMCtrackTRD - SA [1/pt] pulls
1ee39b3a 1051 xy[0] = 0.; xy[1] = -1.5; xy[2] = 2.; xy[3] = 2.;
92c40e64 1052 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1053 pad = (TVirtualPad*)l->At(0); pad->cd();
1054 pad->SetMargin(0.07, 0.07, 0.1, 0.1);
1055 if(!GetGraphTrack(&xy[0], 12, 2, 7)) break;
1056 pad = (TVirtualPad*)l->At(1); pad->cd();
1057 pad->SetMargin(0.07, 0.07, 0.1, 0.1);
1058 if(!GetGraphTrack(&xy[0], 12, 55+2, 7, kTRUE)) break;
1ee39b3a 1059 return kTRUE;
92c40e64 1060 case 23: //kMCtrackTRD - SA [p]
1ee39b3a 1061 xy[0] = 0.; xy[1] = -7.5; xy[2] = 12.; xy[3] = 10.5;
92c40e64 1062 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1063 pad = (TVirtualPad*)l->At(0); pad->cd();
1064 pad->SetMargin(0.07, 0.07, 0.1, 0.1);
1065 if(!GetGraphTrack(&xy[0], 13, 2, 7)) break;
1066 pad->SetLogx();
1067 pad = (TVirtualPad*)l->At(1); pad->cd();
1068 pad->SetMargin(0.07, 0.07, 0.1, 0.1);
1069 if(!GetGraphTrack(&xy[0], 13, 55+2, 7, kTRUE)) break;
1070 pad->SetLogx();
1ee39b3a 1071 return kTRUE;
92c40e64 1072 case 24: // kMCtrackTPC [y]
1ee39b3a 1073 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1074 xy[0]=-.25; xy[1]=-50.; xy[2]=.25; xy[3] =800.;
1075 ((TVirtualPad*)l->At(0))->cd();
1076 if(!GetGraphPlot(&xy[0], kMCtrackTPC, 0)) break;
1077 xy[0] = -.25; xy[1] = -0.5; xy[2] = .25; xy[3] = 2.5;
1078 ((TVirtualPad*)l->At(1))->cd();
1079 if(!GetGraphPlot(&xy[0], kMCtrackTPC, 1)) break;
1080 return kTRUE;
92c40e64 1081 case 25: // kMCtrackTPC [z]
1ee39b3a 1082 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1083 xy[0]=-1.; xy[1]=-500.; xy[2]=1.; xy[3] =800.;
1084 ((TVirtualPad*)l->At(0))->cd();
1085 if(!GetGraphPlot(&xy[0], kMCtrackTPC, 2)) break;
1086 xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 2.5;
1087 ((TVirtualPad*)l->At(1))->cd();
1088 if(!GetGraphPlot(&xy[0], kMCtrackTPC, 3)) break;
1089 return kTRUE;
92c40e64 1090 case 26: // kMCtrackTPC [phi|snp]
1ee39b3a 1091 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1092 xy[0]=-.25; xy[1]=-0.5; xy[2]=.25; xy[3] =2.5;
1093 ((TVirtualPad*)l->At(0))->cd();
1094 if(!GetGraphPlot(&xy[0], kMCtrackTPC, 4)) break;
1095 xy[0] = -.25; xy[1] = -0.5; xy[2] = .25; xy[3] = 1.5;
1096 ((TVirtualPad*)l->At(1))->cd();
1097 if(!GetGraphPlot(&xy[0], kMCtrackTPC, 5)) break;
1098 return kTRUE;
92c40e64 1099 case 27: // kMCtrackTPC [theta|tgl]
1ee39b3a 1100 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1101 xy[0]=-1.; xy[1]=-1.; xy[2]=1.; xy[3] =4.;
1102 ((TVirtualPad*)l->At(0))->cd();
1103 if(!GetGraphPlot(&xy[0], kMCtrackTPC, 6)) break;
1104 xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 1.5;
1105 ((TVirtualPad*)l->At(1))->cd();
1106 if(!GetGraphPlot(&xy[0], kMCtrackTPC, 7)) break;
1107 return kTRUE;
92c40e64 1108 case 28: // kMCtrackTPC [pt]
1ee39b3a 1109 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
92c40e64 1110 xy[0] = 0.4; xy[1] = -.8; xy[2] = 12.; xy[3] = 6.;
1111 pad=(TVirtualPad*)l->At(0); pad->cd();
1112 if(!GetGraphTrackTPC(xy, 8, 2, 7)) break;
1113 pad->SetLogx();
1ee39b3a 1114 xy[0]=0.; xy[1]=-0.5; xy[2]=2.; xy[3] =2.5;
1115 ((TVirtualPad*)l->At(1))->cd();
92c40e64 1116 if(!GetGraphTrackTPC(xy, 9, 2, 7, kTRUE)) break;
1ee39b3a 1117 return kTRUE;
92c40e64 1118 case 29: // kMCtrackTPC [p]
1ee39b3a 1119 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
92c40e64 1120 xy[0] = 0.4; xy[1] = -.8; xy[2] = 12.; xy[3] = 6.;
1ee39b3a 1121 pad = ((TVirtualPad*)l->At(0));pad->cd();
1122 pad->SetMargin(0.12, 0.12, 0.1, 0.04);
92c40e64 1123 if(!GetGraphTrackTPC(xy, 10, 2, 7)) break;
1124 pad->SetLogx();
1ee39b3a 1125 xy[0]=0.; xy[1]=-1.5; xy[2]=12.; xy[3] =2.5;
1126 pad = ((TVirtualPad*)l->At(1)); pad->cd();
1127 pad->SetMargin(0.12, 0.12, 0.1, 0.04);
92c40e64 1128 if(!GetGraphTrackTPC(xy, 11, 2, 7, kTRUE)) break;
1ee39b3a 1129 return kTRUE;
92c40e64 1130 case 30: // kMCtrackTOF [z]
1ee39b3a 1131 return kTRUE;
1132 }
1133 AliWarning(Form("Reference plot [%d] missing result", ifig));
1134 return kFALSE;
1135}
1136
92c40e64 1137Char_t const *fgParticle[11]={
1138 " p bar", " K -", " #pi -", " #mu -", " e -",
1139 " No PID",
1140 " e +", " #mu +", " #pi +", " K +", " p",
1141};
1ee39b3a 1142//________________________________________________________
1143Bool_t AliTRDresolution::PostProcess()
1144{
1145 //fContainer = dynamic_cast<TObjArray*>(GetOutputData(0));
1146 if (!fContainer) {
1147 AliError("ERROR: list not available");
1148 return kFALSE;
1149 }
92c40e64 1150 Int_t nc(0);
b91fdd71 1151 TGraph *gm= NULL, *gs= NULL;
1ee39b3a 1152 if(!fGraphS && !fGraphM){
b91fdd71 1153 TObjArray *aM(NULL), *aS(NULL), *a(NULL);
1ee39b3a 1154 Int_t n = fContainer->GetEntriesFast();
1155 fGraphS = new TObjArray(n); fGraphS->SetOwner();
1156 fGraphM = new TObjArray(n); fGraphM->SetOwner();
1157 for(Int_t ig=0; ig<n; ig++){
92c40e64 1158 fGraphM->AddAt(aM = new TObjArray(fgNproj[ig]), ig);
1159 fGraphS->AddAt(aS = new TObjArray(fgNproj[ig]), ig);
1160
1161 for(Int_t ic=0; ic<fgNproj[ig]; ic++){
1162 //printf("g[%d] c[%d] n[%d]\n", ig, ic, fgNcomp[nc]);
1163 if(fgNcomp[nc]>1){
1164 aS->AddAt(a = new TObjArray(fgNcomp[nc]), ic);
1165 for(Int_t is=fgNcomp[nc]; is--;){
1ee39b3a 1166 a->AddAt(gs = new TGraphErrors(), is);
92c40e64 1167 if(is%11 == 4){
1168 gs->SetMarkerStyle(20);
1169 gs->SetMarkerColor(kMagenta);
1170 gs->SetLineColor(kMagenta);
1171 } else if(is%11 == 6){
1172 gs->SetMarkerStyle(4);
1173 gs->SetMarkerColor(kMagenta);
1174 gs->SetLineColor(kMagenta);
1175 } else {
1176 gs->SetMarkerStyle(7);
1177 gs->SetMarkerColor(kRed);
1178 gs->SetLineColor(kRed);
1179 gs->SetLineStyle(2);
1180 }
1181 gs->SetNameTitle(Form("s_%d%02d%02d", ig, ic, is), fgParticle[is%11]);
1ee39b3a 1182 }
92c40e64 1183 aM->AddAt(a = new TObjArray(fgNcomp[nc]), ic);
1184 for(Int_t is=fgNcomp[nc]; is--;){
1ee39b3a 1185 a->AddAt(gm = new TGraphErrors(), is);
92c40e64 1186 if(is%11 == 4){
1187 gm->SetMarkerStyle(20);
1188 gm->SetMarkerColor(kBlue);
1189 gm->SetLineColor(kBlue);
1190 } else if(is%11 == 6){
1191 gm->SetMarkerStyle(4);
1192 gm->SetMarkerColor(kBlue);
1193 gm->SetLineColor(kBlue);
1194 } else {
1ee39b3a 1195 gm->SetMarkerStyle(7);
92c40e64 1196 gm->SetMarkerColor(kBlack);
1197 gm->SetLineColor(kBlack);
1198 gm->SetLineStyle(2);
1ee39b3a 1199 }
92c40e64 1200 gm->SetNameTitle(Form("m_%d%02d%02d", ig, ic, is), "");
1201 }
1202 } else {
1203 aS->AddAt(gs = new TGraphErrors(), ic);
1204 gs->SetMarkerStyle(23);
1205 gs->SetMarkerColor(kRed);
1206 gs->SetLineColor(kRed);
1207 gs->SetNameTitle(Form("s_%d%02d", ig, ic), "");
1208
1209 aM->AddAt(gm = ig ? (TGraph*)new TGraphErrors() : (TGraph*)new TGraphAsymmErrors(), ic);
1210 gm->SetLineColor(kBlack);
1211 gm->SetMarkerStyle(7);
1212 gm->SetMarkerColor(kBlack);
1213 gm->SetNameTitle(Form("m_%d%02d", ig, ic), "");
1ee39b3a 1214 }
92c40e64 1215 nc+=fgNcomp[ic];
1ee39b3a 1216 }
1217 }
1218 }
1219
1220/* printf("\n\n\n"); fGraphS->ls();
1221 printf("\n\n\n"); fGraphM->ls();*/
1222
1223
1224 // DEFINE MODELS
1225 // simple gauss
1226 TF1 fg("fGauss", "gaus", -.5, .5);
1227 // Landau for charge resolution
92c40e64 1228 TF1 fch("fClCh", "landau", 0., 1000.);
1229 // Landau for e+- pt resolution
1230 TF1 fpt("fPt", "landau", -0.1, 0.2);
1ee39b3a 1231
1232 //PROCESS EXPERIMENTAL DISTRIBUTIONS
1233 // Charge resolution
1234 //Process3DL(kCharge, 0, &fl);
1235 // Clusters residuals
1236 Process2D(kCluster, 0, &fg, 1.e4);
1237 Process2D(kCluster, 1, &fg);
1238 fNRefFigures = 1;
1239 // Tracklet residual/pulls
1240 Process2D(kTrackTRD , 0, &fg, 1.e4);
1241 Process2D(kTrackTRD , 1, &fg);
1242 Process2D(kTrackTRD , 2, &fg, 1.e4);
1243 Process2D(kTrackTRD , 3, &fg);
1244 Process2D(kTrackTRD , 4, &fg, 1.e3);
1245 fNRefFigures = 4;
1246 // TPC track residual/pulls
1247 Process2D(kTrackTPC, 0, &fg, 1.e4);
1248 Process2D(kTrackTPC, 1, &fg);
1249 Process2D(kTrackTPC, 2, &fg, 1.e4);
1250 Process2D(kTrackTPC, 3, &fg);
1251 Process2D(kTrackTPC, 4, &fg, 1.e3);
1252 fNRefFigures = 7;
1253
1254 if(!HasMCdata()) return kTRUE;
1255
1256
1257 //PROCESS MC RESIDUAL DISTRIBUTIONS
1258
1259 // CLUSTER Y RESOLUTION/PULLS
92c40e64 1260 Process3Drange(kMCcluster, 0, 0, &fg, 1.e4, 1, 1);
1261 Process3Drange(kMCcluster, 0, 1, &fg, 1.e4, 2, 2);
1262 Process3Drange(kMCcluster, 0, 2, &fg, 1.e4, 3, 12);
1263 Process2D(kMCcluster, 1, &fg, 1., 3);
1264 fNRefFigures = 10;
1ee39b3a 1265
1266 // TRACKLET RESOLUTION/PULLS
92c40e64 1267 Process3Drange(kMCtracklet, 0, 0, &fg, 1.e4, 1, 1); // y
1268 Process3Drange(kMCtracklet, 0, 1, &fg, 1.e4, 2, 2); // y
1269 Process3Drange(kMCtracklet, 0, 2, &fg, 1.e4, 3, 12); // y
1270 Process2D(kMCtracklet, 1, &fg, 1., 3); // y pulls
1271 Process2D(kMCtracklet, 2, &fg, 1.e4, 4); // z
1272 Process2D(kMCtracklet, 3, &fg, 1., 5); // z pulls
1273 Process2D(kMCtracklet, 4, &fg, 1.e3, 6); // phi
1274 fNRefFigures = 14;
1ee39b3a 1275
1276 // TRACK RESOLUTION/PULLS
1277 Process2D(kMCtrackTRD, 0, &fg, 1.e4); // y
1278 Process2D(kMCtrackTRD, 1, &fg); // y PULL
1279 Process2D(kMCtrackTRD, 2, &fg, 1.e4); // z
1280 Process2D(kMCtrackTRD, 3, &fg); // z PULL
1281 Process2D(kMCtrackTRD, 4, &fg, 1.e3); // phi
1282 Process2D(kMCtrackTRD, 5, &fg); // snp PULL
1283 Process2D(kMCtrackTRD, 6, &fg, 1.e3); // theta
1284 Process2D(kMCtrackTRD, 7, &fg); // tgl PULL
1285 Process4D(kMCtrackTRD, 8, &fg, 1.e2); // pt resolution
92c40e64 1286 Process4D(kMCtrackTRD, 8, &fpt, 1.e2, 4);// pt resolution e1- @ L0
1287 Process4D(kMCtrackTRD, 8, &fpt, 1.e2, 6);// pt resolution e1+ @ L0
1288 Process4D(kMCtrackTRD, 8, &fpt, 1.e2, 55+4);// pt resolution e1- @ L5
1289 Process4D(kMCtrackTRD, 8, &fpt, 1.e2, 55+6);// pt resolution e1+ @ L5
1ee39b3a 1290 Process4D(kMCtrackTRD, 9, &fg); // 1/pt pulls
1291 Process4D(kMCtrackTRD, 10, &fg, 1.e2); // p resolution
92c40e64 1292 Process4D(kMCtrackTRD, 10, &fpt, 1.e2, 4);// p resolution e1- @ L0
1293 Process4D(kMCtrackTRD, 10, &fpt, 1.e2, 6);// p resolution e1+ @ L0
1294 Process4D(kMCtrackTRD, 10, &fpt, 1.e2, 55+4);// p resolution e1- @ L5
1295 Process4D(kMCtrackTRD, 10, &fpt, 1.e2, 55+6);// p resolution e1+ @ L5
1296 Process4D(kMCtrackTRD, 11, &fg, 1.e2); // pt resolution stand alone
1297 Process4D(kMCtrackTRD, 12, &fg); // 1/pt pulls stand alone
1298 Process4D(kMCtrackTRD, 13, &fg, 1.e2); // p resolution stand alone
1299 fNRefFigures = 24;
1ee39b3a 1300
1301 // TRACK TPC RESOLUTION/PULLS
1302 Process2D(kMCtrackTPC, 0, &fg, 1.e4);// y resolution
1303 Process2D(kMCtrackTPC, 1, &fg); // y pulls
1304 Process2D(kMCtrackTPC, 2, &fg, 1.e4);// z resolution
1305 Process2D(kMCtrackTPC, 3, &fg); // z pulls
1306 Process2D(kMCtrackTPC, 4, &fg, 1.e3);// phi resolution
1307 Process2D(kMCtrackTPC, 5, &fg); // snp pulls
1308 Process2D(kMCtrackTPC, 6, &fg, 1.e3);// theta resolution
1309 Process2D(kMCtrackTPC, 7, &fg); // tgl pulls
1310 Process3D(kMCtrackTPC, 8, &fg, 1.e2);// pt resolution
1311 Process3D(kMCtrackTPC, 9, &fg); // 1/pt pulls
1312 Process3D(kMCtrackTPC, 10, &fg, 1.e2);// p resolution
1313 Process3D(kMCtrackTPC, 11, &fg); // p pulls
92c40e64 1314 fNRefFigures = 30;
1ee39b3a 1315
1316 // TRACK HMPID RESOLUTION/PULLS
1317 Process2D(kMCtrackTOF, 0, &fg, 1.e4); // z towards TOF
1318 Process2D(kMCtrackTOF, 1, &fg); // z towards TOF
92c40e64 1319 fNRefFigures = 31;
1ee39b3a 1320
1321 return kTRUE;
1322}
1323
1324
1325//________________________________________________________
1326void AliTRDresolution::Terminate(Option_t *opt)
1327{
1328 AliTRDrecoTask::Terminate(opt);
1329 if(HasPostProcess()) PostProcess();
1330}
1331
1332//________________________________________________________
1333void AliTRDresolution::AdjustF1(TH1 *h, TF1 *f)
1334{
1335// Helper function to avoid duplication of code
1336// Make first guesses on the fit parameters
1337
1338 // find the intial parameters of the fit !! (thanks George)
1339 Int_t nbinsy = Int_t(.5*h->GetNbinsX());
1340 Double_t sum = 0.;
1341 for(Int_t jbin=nbinsy-4; jbin<=nbinsy+4; jbin++) sum+=h->GetBinContent(jbin); sum/=9.;
1342 f->SetParLimits(0, 0., 3.*sum);
1343 f->SetParameter(0, .9*sum);
1344 Double_t rms = h->GetRMS();
1345 f->SetParLimits(1, -rms, rms);
1346 f->SetParameter(1, h->GetMean());
1347
1348 f->SetParLimits(2, 0., 2.*rms);
1349 f->SetParameter(2, rms);
1350 if(f->GetNpar() <= 4) return;
1351
1352 f->SetParLimits(3, 0., sum);
1353 f->SetParameter(3, .1*sum);
1354
1355 f->SetParLimits(4, -.3, .3);
1356 f->SetParameter(4, 0.);
1357
1358 f->SetParLimits(5, 0., 1.e2);
1359 f->SetParameter(5, 2.e-1);
1360}
1361
1362//________________________________________________________
1363TObjArray* AliTRDresolution::Histos()
1364{
1365 //
1366 // Define histograms
1367 //
1368
1369 if(fContainer) return fContainer;
1370
92c40e64 1371 fContainer = new TObjArray(kNviews);
1ee39b3a 1372 //fContainer->SetOwner(kTRUE);
b91fdd71 1373 TH1 *h = NULL;
1374 TObjArray *arr = NULL;
1ee39b3a 1375
df0514f6 1376 const Int_t kPbins(12); // binning in momentum range should depend on the statistics analyzed
1377
1ee39b3a 1378 // cluster to track residuals/pulls
92c40e64 1379 fContainer->AddAt(arr = new TObjArray(fgNhistos[kCharge]), kCharge);
1ee39b3a 1380 arr->SetName("Charge");
1381 if(!(h = (TH3S*)gROOT->FindObject("hCharge"))){
1382 h = new TH3S("hCharge", "Charge Resolution", 20, 1., 2., 24, 0., 3.6, 100, 0., 500.);
1383 h->GetXaxis()->SetTitle("dx/dx_{0}");
1384 h->GetYaxis()->SetTitle("x_{d} [cm]");
1385 h->GetZaxis()->SetTitle("dq/dx [ADC/cm]");
1386 } else h->Reset();
1387 arr->AddAt(h, 0);
1388
1389 // cluster to track residuals/pulls
92c40e64 1390 fContainer->AddAt(arr = new TObjArray(fgNhistos[kCluster]), kCluster);
1ee39b3a 1391 arr->SetName("Cl");
1392 if(!(h = (TH2I*)gROOT->FindObject("hCl"))){
1393 h = new TH2I("hCl", "Cluster Residuals", 21, -.33, .33, 100, -.5, .5);
1394 h->GetXaxis()->SetTitle("tg(#phi)");
1395 h->GetYaxis()->SetTitle("#Delta y [cm]");
1396 h->GetZaxis()->SetTitle("entries");
1397 } else h->Reset();
1398 arr->AddAt(h, 0);
1399 if(!(h = (TH2I*)gROOT->FindObject("hClpull"))){
1400 h = new TH2I("hClpull", "Cluster Pulls", 21, -.33, .33, 100, -4.5, 4.5);
1401 h->GetXaxis()->SetTitle("tg(#phi)");
1402 h->GetYaxis()->SetTitle("#Delta y/#sigma_{y}");
1403 h->GetZaxis()->SetTitle("entries");
1404 } else h->Reset();
1405 arr->AddAt(h, 1);
1406
1407 // tracklet to track residuals/pulls in y direction
92c40e64 1408 fContainer->AddAt(arr = new TObjArray(fgNhistos[kTrackTRD ]), kTrackTRD );
1ee39b3a 1409 arr->SetName("Trklt");
1410 if(!(h = (TH2I*)gROOT->FindObject("hTrkltY"))){
1411 h = new TH2I("hTrkltY", "Tracklet Y Residuals", 21, -.33, .33, 100, -.5, .5);
1412 h->GetXaxis()->SetTitle("#tg(#phi)");
1413 h->GetYaxis()->SetTitle("#Delta y [cm]");
1414 h->GetZaxis()->SetTitle("entries");
1415 } else h->Reset();
1416 arr->AddAt(h, 0);
1417 if(!(h = (TH2I*)gROOT->FindObject("hTrkltYpull"))){
1418 h = new TH2I("hTrkltYpull", "Tracklet Y Pulls", 21, -.33, .33, 100, -4.5, 4.5);
1419 h->GetXaxis()->SetTitle("#tg(#phi)");
1420 h->GetYaxis()->SetTitle("#Delta y/#sigma_{y}");
1421 h->GetZaxis()->SetTitle("entries");
1422 } else h->Reset();
1423 arr->AddAt(h, 1);
1424 // tracklet to track residuals/pulls in z direction
1425 if(!(h = (TH2I*)gROOT->FindObject("hTrkltZ"))){
1426 h = new TH2I("hTrkltZ", "Tracklet Z Residuals", 50, -1., 1., 100, -1.5, 1.5);
1427 h->GetXaxis()->SetTitle("#tg(#theta)");
1428 h->GetYaxis()->SetTitle("#Delta z [cm]");
1429 h->GetZaxis()->SetTitle("entries");
1430 } else h->Reset();
1431 arr->AddAt(h, 2);
1432 if(!(h = (TH2I*)gROOT->FindObject("hTrkltZpull"))){
1433 h = new TH2I("hTrkltZpull", "Tracklet Z Pulls", 50, -1., 1., 100, -5.5, 5.5);
1434 h->GetXaxis()->SetTitle("#tg(#theta)");
1435 h->GetYaxis()->SetTitle("#Delta z/#sigma_{z}");
1436 h->GetZaxis()->SetTitle("entries");
1437 } else h->Reset();
1438 arr->AddAt(h, 3);
1439 // tracklet to track phi residuals
1440 if(!(h = (TH2I*)gROOT->FindObject("hTrkltPhi"))){
1441 h = new TH2I("hTrkltPhi", "Tracklet #phi Residuals", 21, -.33, .33, 100, -.5, .5);
1442 h->GetXaxis()->SetTitle("tg(#phi)");
1443 h->GetYaxis()->SetTitle("#Delta phi [rad]");
1444 h->GetZaxis()->SetTitle("entries");
1445 } else h->Reset();
1446 arr->AddAt(h, 4);
1447
1448
1449 // tracklet to TPC track residuals/pulls in y direction
92c40e64 1450 fContainer->AddAt(arr = new TObjArray(fgNhistos[kTrackTPC]), kTrackTPC);
1ee39b3a 1451 arr->SetName("TrkTPC");
1452 if(!(h = (TH2I*)gROOT->FindObject("hTrkTPCY"))){
1453 h = new TH2I("hTrkTPCY", "Track[TPC] Y Residuals", 21, -.33, .33, 100, -.5, .5);
1454 h->GetXaxis()->SetTitle("#tg(#phi)");
1455 h->GetYaxis()->SetTitle("#Delta y [cm]");
1456 h->GetZaxis()->SetTitle("entries");
1457 } else h->Reset();
1458 arr->AddAt(h, 0);
1459 if(!(h = (TH2I*)gROOT->FindObject("hTrkTPCYpull"))){
1460 h = new TH2I("hTrkTPCYpull", "Track[TPC] Y Pulls", 21, -.33, .33, 100, -4.5, 4.5);
1461 h->GetXaxis()->SetTitle("#tg(#phi)");
1462 h->GetYaxis()->SetTitle("#Delta y/#sigma_{y}");
1463 h->GetZaxis()->SetTitle("entries");
1464 } else h->Reset();
1465 arr->AddAt(h, 1);
1466 // tracklet to TPC track residuals/pulls in z direction
1467 if(!(h = (TH2I*)gROOT->FindObject("hTrkTPCZ"))){
1468 h = new TH2I("hTrkTPCZ", "Track[TPC] Z Residuals", 50, -1., 1., 100, -1.5, 1.5);
1469 h->GetXaxis()->SetTitle("#tg(#theta)");
1470 h->GetYaxis()->SetTitle("#Delta z [cm]");
1471 h->GetZaxis()->SetTitle("entries");
1472 } else h->Reset();
1473 arr->AddAt(h, 2);
1474 if(!(h = (TH2I*)gROOT->FindObject("hTrkTPCZpull"))){
1475 h = new TH2I("hTrkTPCZpull", "Track[TPC] Z Pulls", 50, -1., 1., 100, -5.5, 5.5);
1476 h->GetXaxis()->SetTitle("#tg(#theta)");
1477 h->GetYaxis()->SetTitle("#Delta z/#sigma_{z}");
1478 h->GetZaxis()->SetTitle("entries");
1479 } else h->Reset();
1480 arr->AddAt(h, 3);
1481 // tracklet to TPC track phi residuals
1482 if(!(h = (TH2I*)gROOT->FindObject("hTrkTPCPhi"))){
1483 h = new TH2I("hTrkTPCPhi", "Track[TPC] #phi Residuals", 21, -.33, .33, 100, -.5, .5);
1484 h->GetXaxis()->SetTitle("tg(#phi)");
1485 h->GetYaxis()->SetTitle("#Delta phi [rad]");
1486 h->GetZaxis()->SetTitle("entries");
1487 } else h->Reset();
1488 arr->AddAt(h, 4);
1489
1490
1491 // Resolution histos
1492 if(!HasMCdata()) return fContainer;
1493
1494 // cluster y resolution [0]
92c40e64 1495 fContainer->AddAt(arr = new TObjArray(fgNhistos[kMCcluster]), kMCcluster);
1ee39b3a 1496 arr->SetName("McCl");
92c40e64 1497 if(!(h = (TH3S*)gROOT->FindObject("hMcCl"))){
1498 h = new TH3S("hMcCl", "Cluster Resolution", 48, -.48, .48, 100, -.3, .3, kPbins, 0., 12.);
1ee39b3a 1499 h->GetXaxis()->SetTitle("tg(#phi)");
1500 h->GetYaxis()->SetTitle("#Delta y [cm]");
92c40e64 1501 h->GetZaxis()->SetTitle("p_{t} [GeV/c]");
1ee39b3a 1502 } else h->Reset();
1503 arr->AddAt(h, 0);
1504 if(!(h = (TH2I*)gROOT->FindObject("hMcClPull"))){
1505 h = new TH2I("hMcClPull", "Cluster Pulls", 48, -.48, .48, 100, -4.5, 4.5);
1506 h->GetXaxis()->SetTitle("tg(#phi)");
1507 h->GetYaxis()->SetTitle("#Deltay/#sigma_{y}");
92c40e64 1508 h->GetZaxis()->SetTitle("p_{t} [GeV/c]");
1ee39b3a 1509 } else h->Reset();
1510 arr->AddAt(h, 1);
1511
1512
1513 // TRACKLET RESOLUTION
92c40e64 1514 fContainer->AddAt(arr = new TObjArray(fgNhistos[kMCtracklet]), kMCtracklet);
1ee39b3a 1515 arr->SetName("McTrklt");
1516 // tracklet y resolution
92c40e64 1517 if(!(h = (TH3S*)gROOT->FindObject("hMcTrkltY"))){
1518 h = new TH3S("hMcTrkltY", "Tracklet Resolution (Y)", 48, -.48, .48, 100, -.2, .2, kPbins, 0., 12.);
1ee39b3a 1519 h->GetXaxis()->SetTitle("tg(#phi)");
1520 h->GetYaxis()->SetTitle("#Delta y [cm]");
1521 h->GetZaxis()->SetTitle("entries");
1522 } else h->Reset();
1523 arr->AddAt(h, 0);
1524 // tracklet y pulls
1525 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkltYPull"))){
1526 h = new TH2I("hMcTrkltYPull", "Tracklet Pulls (Y)", 48, -.48, .48, 100, -4.5, 4.5);
1527 h->GetXaxis()->SetTitle("tg(#phi)");
1528 h->GetYaxis()->SetTitle("#Delta y / #sigma_{y}");
1529 h->GetZaxis()->SetTitle("entries");
1530 } else h->Reset();
1531 arr->AddAt(h, 1);
1532 // tracklet z resolution
1533 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkltZ"))){
1534 h = new TH2I("hMcTrkltZ", "Tracklet Resolution (Z)", 100, -1., 1., 100, -1., 1.);
1535 h->GetXaxis()->SetTitle("tg(#theta)");
1536 h->GetYaxis()->SetTitle("#Delta z [cm]");
1537 h->GetZaxis()->SetTitle("entries");
1538 } else h->Reset();
1539 arr->AddAt(h, 2);
1540 // tracklet z pulls
1541 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkltZPull"))){
1542 h = new TH2I("hMcTrkltZPull", "Tracklet Pulls (Z)", 100, -1., 1., 100, -3.5, 3.5);
1543 h->GetXaxis()->SetTitle("tg(#theta)");
1544 h->GetYaxis()->SetTitle("#Delta z / #sigma_{z}");
1545 h->GetZaxis()->SetTitle("entries");
1546 } else h->Reset();
1547 arr->AddAt(h, 3);
1548 // tracklet phi resolution
1549 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkltPhi"))){
1550 h = new TH2I("hMcTrkltPhi", "Tracklet Resolution (#Phi)", 48, -.48, .48, 100, -.15, .15);
1551 h->GetXaxis()->SetTitle("tg(#phi)");
1552 h->GetYaxis()->SetTitle("#Delta #phi [rad]");
1553 h->GetZaxis()->SetTitle("entries");
1554 } else h->Reset();
1555 arr->AddAt(h, 4);
1556
1557
1558 // KALMAN TRACK RESOLUTION
92c40e64 1559 fContainer->AddAt(arr = new TObjArray(fgNhistos[kMCtrackTRD]), kMCtrackTRD);
1ee39b3a 1560 arr->SetName("McTrkTRD");
1561 // Kalman track y resolution
1562 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkY"))){
1563 h = new TH2I("hMcTrkY", "Track Y Resolution", 48, -.48, .48, 100, -.2, .2);
1564 h->GetXaxis()->SetTitle("tg(#phi)");
1565 h->GetYaxis()->SetTitle("#Delta y [cm]");
1566 h->GetZaxis()->SetTitle("entries");
1567 } else h->Reset();
1568 arr->AddAt(h, 0);
1569 // Kalman track y pulls
1570 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkYPull"))){
1571 h = new TH2I("hMcTrkYPull", "Track Y Pulls", 48, -.48, .48, 100, -4., 4.);
1572 h->GetXaxis()->SetTitle("tg(#phi)");
1573 h->GetYaxis()->SetTitle("#Delta y / #sigma_{y}");
1574 h->GetZaxis()->SetTitle("entries");
1575 } else h->Reset();
1576 arr->AddAt(h, 1);
1577 // Kalman track Z
1578 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkZ"))){
1579 h = new TH2I("hMcTrkZ", "Track Z Resolution", 100, -1., 1., 100, -1., 1.);
1580 h->GetXaxis()->SetTitle("tg(#theta)");
1581 h->GetYaxis()->SetTitle("#Delta z [cm]");
1582 h->GetZaxis()->SetTitle("entries");
1583 } else h->Reset();
1584 arr->AddAt(h, 2);
1585 // Kalman track Z pulls
1586 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkZPull"))){
1587 h = new TH2I("hMcTrkZPull", "Track Z Pulls", 100, -1., 1., 100, -4.5, 4.5);
1588 h->GetXaxis()->SetTitle("tg(#theta)");
1589 h->GetYaxis()->SetTitle("#Delta z / #sigma_{z}");
1590 h->GetZaxis()->SetTitle("entries");
1591 } else h->Reset();
1592 arr->AddAt(h, 3);
1593 // Kalman track SNP
1594 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkSNP"))){
1595 h = new TH2I("hMcTrkSNP", "Track Phi Resolution", 60, -.3, .3, 100, -5e-3, 5e-3);
1596 h->GetXaxis()->SetTitle("tg(#phi)");
1597 h->GetYaxis()->SetTitle("#Delta #phi [rad]");
1598 h->GetZaxis()->SetTitle("entries");
1599 } else h->Reset();
1600 arr->AddAt(h, 4);
1601 // Kalman track SNP pulls
1602 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkSNPPull"))){
1603 h = new TH2I("hMcTrkSNPPull", "Track SNP Pulls", 60, -.3, .3, 100, -4.5, 4.5);
1604 h->GetXaxis()->SetTitle("tg(#phi)");
1605 h->GetYaxis()->SetTitle("#Delta(sin(#phi)) / #sigma_{sin(#phi)}");
1606 h->GetZaxis()->SetTitle("entries");
1607 } else h->Reset();
1608 arr->AddAt(h, 5);
1609 // Kalman track TGL
1610 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkTGL"))){
1611 h = new TH2I("hMcTrkTGL", "Track Theta Resolution", 100, -1., 1., 100, -5e-3, 5e-3);
1612 h->GetXaxis()->SetTitle("tg(#theta)");
1613 h->GetYaxis()->SetTitle("#Delta#theta [rad]");
1614 h->GetZaxis()->SetTitle("entries");
1615 } else h->Reset();
1616 arr->AddAt(h, 6);
1617 // Kalman track TGL pulls
1618 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkTGLPull"))){
1619 h = new TH2I("hMcTrkTGLPull", "Track TGL Pulls", 100, -1., 1., 100, -4.5, 4.5);
1620 h->GetXaxis()->SetTitle("tg(#theta)");
1621 h->GetYaxis()->SetTitle("#Delta(tg(#theta)) / #sigma_{tg(#theta)}");
1622 h->GetZaxis()->SetTitle("entries");
1623 } else h->Reset();
1624 arr->AddAt(h, 7);
92c40e64 1625 const Int_t n = 2*AliPID::kSPECIES+1;
b91fdd71 1626 TObjArray *arr2 = NULL; TH3S* h3=NULL;
92c40e64 1627 // Kalman track Pt resolution
1ee39b3a 1628 arr->AddAt(arr2 = new TObjArray(AliTRDgeometry::kNlayer), 8);
92c40e64 1629 arr2->SetName("Pt Resolution");
1ee39b3a 1630 for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){
1631 if(!(h3 = (TH3S*)gROOT->FindObject(Form("hMcTrkPt%d", il)))){
92c40e64 1632 h3 = new TH3S(Form("hMcTrkPt%d", il), "Track Pt Resolution", kPbins, 0., 12., 150, -.1, .2, n, -5.5, 5.5);
1ee39b3a 1633 h3->GetXaxis()->SetTitle("p_{t} [GeV/c]");
1634 h3->GetYaxis()->SetTitle("#Delta p_{t}/p_{t}^{MC}");
1635 h3->GetZaxis()->SetTitle("SPECIES");
1636 } else h3->Reset();
1637 arr2->AddAt(h3, il);
1638 }
1639 // Kalman track Pt pulls
1640 arr->AddAt(arr2 = new TObjArray(AliTRDgeometry::kNlayer), 9);
92c40e64 1641 arr2->SetName("1/Pt Pulls");
1ee39b3a 1642 for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){
1643 if(!(h3 = (TH3S*)gROOT->FindObject(Form("hMcTrkPtPulls%d", il)))){
92c40e64 1644 h3 = new TH3S(Form("hMcTrkPtPulls%d", il), "Track 1/Pt Pulls", kPbins, 0., 2., 100, -4., 4., n, -5.5, 5.5);
1ee39b3a 1645 h3->GetXaxis()->SetTitle("1/p_{t}^{MC} [c/GeV]");
1646 h3->GetYaxis()->SetTitle("#Delta(1/p_{t})/#sigma(1/p_{t}) ");
1647 h3->GetZaxis()->SetTitle("SPECIES");
1648 } else h3->Reset();
1649 arr2->AddAt(h3, il);
1650 }
1651 // Kalman track P resolution
1652 arr->AddAt(arr2 = new TObjArray(AliTRDgeometry::kNlayer), 10);
92c40e64 1653 arr2->SetName("P Resolution");
1ee39b3a 1654 for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){
1655 if(!(h3 = (TH3S*)gROOT->FindObject(Form("hMcTrkP%d", il)))){
92c40e64 1656 h3 = new TH3S(Form("hMcTrkP%d", il), "Track P Resolution", kPbins, 0., 12., 150, -.15, .35, n, -5.5, 5.5);
1657 h3->GetXaxis()->SetTitle("p [GeV/c]");
1658 h3->GetYaxis()->SetTitle("#Delta p/p^{MC}");
1659 h3->GetZaxis()->SetTitle("SPECIES");
1660 } else h3->Reset();
1661 arr2->AddAt(h3, il);
1662 }
1663 // TRD stand-alone track Pt resolution
1664 arr->AddAt(arr2 = new TObjArray(AliTRDgeometry::kNlayer), 11);
1665 arr2->SetName("Pt Resolution [SA]");
1666 for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){
1667 if(!(h3 = (TH3S*)gROOT->FindObject(Form("hMcSATrkPt%d", il)))){
4226db3e 1668 h3 = new TH3S(Form("hMcSATrkPt%d", il), "Track Pt Resolution", kPbins, 0., 12., 150, -10., 1., n, -5.5, 5.5);
92c40e64 1669 h3->GetXaxis()->SetTitle("p_{t} [GeV/c]");
1670 h3->GetYaxis()->SetTitle("#Delta p_{t}/p_{t}^{MC}");
1671 h3->GetZaxis()->SetTitle("SPECIES");
1672 } else h3->Reset();
1673 arr2->AddAt(h3, il);
1674 }
1675 // TRD stand-alone track Pt pulls
1676 arr->AddAt(arr2 = new TObjArray(AliTRDgeometry::kNlayer), 12);
1677 arr2->SetName("1/Pt Pulls [SA]");
1678 for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){
1679 if(!(h3 = (TH3S*)gROOT->FindObject(Form("hMcSATrkPtPulls%d", il)))){
1680 h3 = new TH3S(Form("hMcSATrkPtPulls%d", il), "Track 1/Pt Pulls", kPbins, 0., 2., 100, -4., 4., n, -5.5, 5.5);
1681 h3->GetXaxis()->SetTitle("1/p_{t}^{MC} [c/GeV]");
1682 h3->GetYaxis()->SetTitle("#Delta(1/p_{t})/#sigma(1/p_{t}) ");
1683 h3->GetZaxis()->SetTitle("SPECIES");
1684 } else h3->Reset();
1685 arr2->AddAt(h3, il);
1686 }
1687 // TRD stand-alone track P resolution
1688 arr->AddAt(arr2 = new TObjArray(AliTRDgeometry::kNlayer), 13);
1689 arr2->SetName("P Resolution [SA]");
1690 for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){
1691 if(!(h3 = (TH3S*)gROOT->FindObject(Form("hMcSATrkP%d", il)))){
1692 h3 = new TH3S(Form("hMcSATrkP%d", il), "Track P Resolution", kPbins, 0., 12., 150, -1.5, 3.5, n, -5.5, 5.5);
1ee39b3a 1693 h3->GetXaxis()->SetTitle("p [GeV/c]");
1694 h3->GetYaxis()->SetTitle("#Delta p/p^{MC}");
1695 h3->GetZaxis()->SetTitle("SPECIES");
1696 } else h3->Reset();
1697 arr2->AddAt(h3, il);
1698 }
1699
1700 // TPC TRACK RESOLUTION
92c40e64 1701 fContainer->AddAt(arr = new TObjArray(fgNhistos[kMCtrackTPC]), kMCtrackTPC);
1ee39b3a 1702 arr->SetName("McTrkTPC");
1703 // Kalman track Y
1704 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkTPCY"))){
1705 h = new TH2I("hMcTrkTPCY", "Track[TPC] Y Resolution", 60, -.3, .3, 100, -.5, .5);
1706 h->GetXaxis()->SetTitle("tg(#phi)");
1707 h->GetYaxis()->SetTitle("#Delta y [cm]");
1708 h->GetZaxis()->SetTitle("entries");
1709 } else h->Reset();
1710 arr->AddAt(h, 0);
1711 // Kalman track Y pulls
1712 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkTPCYPull"))){
1713 h = new TH2I("hMcTrkTPCYPull", "Track[TPC] Y Pulls", 60, -.3, .3, 100, -4.5, 4.5);
1714 h->GetXaxis()->SetTitle("tg(#phi)");
1715 h->GetYaxis()->SetTitle("#Delta y / #sigma_{y}");
1716 h->GetZaxis()->SetTitle("entries");
1717 } else h->Reset();
1718 arr->AddAt(h, 1);
1719 // Kalman track Z
1720 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkTPCZ"))){
1721 h = new TH2I("hMcTrkTPCZ", "Track[TPC] Z Resolution", 100, -1., 1., 100, -1., 1.);
1722 h->GetXaxis()->SetTitle("tg(#theta)");
1723 h->GetYaxis()->SetTitle("#Delta z [cm]");
1724 h->GetZaxis()->SetTitle("entries");
1725 } else h->Reset();
1726 arr->AddAt(h, 2);
1727 // Kalman track Z pulls
1728 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkTPCZPull"))){
1729 h = new TH2I("hMcTrkTPCZPull", "Track[TPC] Z Pulls", 100, -1., 1., 100, -4.5, 4.5);
1730 h->GetXaxis()->SetTitle("tg(#theta)");
1731 h->GetYaxis()->SetTitle("#Delta z / #sigma_{z}");
1732 h->GetZaxis()->SetTitle("entries");
1733 } else h->Reset();
1734 arr->AddAt(h, 3);
1735 // Kalman track SNP
1736 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkTPCSNP"))){
1737 h = new TH2I("hMcTrkTPCSNP", "Track[TPC] Phi Resolution", 60, -.3, .3, 100, -5e-3, 5e-3);
1738 h->GetXaxis()->SetTitle("tg(#phi)");
1739 h->GetYaxis()->SetTitle("#Delta #phi [rad]");
1740 h->GetZaxis()->SetTitle("entries");
1741 } else h->Reset();
1742 arr->AddAt(h, 4);
1743 // Kalman track SNP pulls
1744 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkTPCSNPPull"))){
1745 h = new TH2I("hMcTrkTPCSNPPull", "Track[TPC] SNP Pulls", 60, -.3, .3, 100, -4.5, 4.5);
1746 h->GetXaxis()->SetTitle("tg(#phi)");
1747 h->GetYaxis()->SetTitle("#Delta(sin(#phi)) / #sigma_{sin(#phi)}");
1748 h->GetZaxis()->SetTitle("entries");
1749 } else h->Reset();
1750 arr->AddAt(h, 5);
1751 // Kalman track TGL
1752 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkTPCTGL"))){
1753 h = new TH2I("hMcTrkTPCTGL", "Track[TPC] Theta Resolution", 100, -1., 1., 100, -5e-3, 5e-3);
1754 h->GetXaxis()->SetTitle("tg(#theta)");
1755 h->GetYaxis()->SetTitle("#Delta#theta [rad]");
1756 h->GetZaxis()->SetTitle("entries");
1757 } else h->Reset();
1758 arr->AddAt(h, 6);
1759 // Kalman track TGL pulls
1760 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkTPCTGLPull"))){
1761 h = new TH2I("hMcTrkTPCTGLPull", "Track[TPC] TGL Pulls", 100, -1., 1., 100, -4.5, 4.5);
1762 h->GetXaxis()->SetTitle("tg(#theta)");
1763 h->GetYaxis()->SetTitle("#Delta(tg(#theta)) / #sigma_{tg(#theta)}");
1764 h->GetZaxis()->SetTitle("entries");
1765 } else h->Reset();
1766 arr->AddAt(h, 7);
1767 // Kalman track Pt resolution
1768 if(!(h3 = (TH3S*)gROOT->FindObject("hMcTrkTPCPt"))){
92c40e64 1769 h3 = new TH3S("hMcTrkTPCPt", "Track[TPC] Pt Resolution", kPbins, 0., 12., 100, -.1, .2, n, -5.5, 5.5);
1ee39b3a 1770 h3->GetXaxis()->SetTitle("p_{t} [GeV/c]");
1771 h3->GetYaxis()->SetTitle("#Delta p_{t}/p_{t}^{MC}");
1772 h3->GetZaxis()->SetTitle("SPECIES");
1773 } else h3->Reset();
1774 arr->AddAt(h3, 8);
1775 // Kalman track Pt pulls
1776 if(!(h3 = (TH3S*)gROOT->FindObject("hMcTrkTPCPtPulls"))){
92c40e64 1777 h3 = new TH3S("hMcTrkTPCPtPulls", "Track[TPC] 1/Pt Pulls", kPbins, 0., 2., 100, -4., 4., n, -5.5, 5.5);
1ee39b3a 1778 h3->GetXaxis()->SetTitle("1/p_{t}^{MC} [c/GeV]");
1779 h3->GetYaxis()->SetTitle("#Delta(1/p_{t})/#sigma(1/p_{t}) ");
1780 h3->GetZaxis()->SetTitle("SPECIES");
1781 } else h3->Reset();
1782 arr->AddAt(h3, 9);
1783 // Kalman track P resolution
1784 if(!(h3 = (TH3S*)gROOT->FindObject("hMcTrkTPCP"))){
92c40e64 1785 h3 = new TH3S("hMcTrkTPCP", "Track[TPC] P Resolution", kPbins, 0., 12., 100, -.15, .35, n, -5.5, 5.5);
1ee39b3a 1786 h3->GetXaxis()->SetTitle("p [GeV/c]");
1787 h3->GetYaxis()->SetTitle("#Delta p/p^{MC}");
1788 h3->GetZaxis()->SetTitle("SPECIES");
1789 } else h3->Reset();
1790 arr->AddAt(h3, 10);
92c40e64 1791 // Kalman track P pulls
1ee39b3a 1792 if(!(h3 = (TH3S*)gROOT->FindObject("hMcTrkTPCPPulls"))){
92c40e64 1793 h3 = new TH3S("hMcTrkTPCPPulls", "Track[TPC] P Pulls", kPbins, 0., 12., 100, -5., 5., n, -5.5, 5.5);
1ee39b3a 1794 h3->GetXaxis()->SetTitle("p^{MC} [GeV/c]");
1795 h3->GetYaxis()->SetTitle("#Deltap/#sigma_{p}");
1796 h3->GetZaxis()->SetTitle("SPECIES");
1797 } else h3->Reset();
1798 arr->AddAt(h3, 11);
1799
1800
1801
1802 // Kalman track Z resolution [TOF]
92c40e64 1803 fContainer->AddAt(arr = new TObjArray(fgNhistos[kMCtrackTOF]), kMCtrackTOF);
1ee39b3a 1804 arr->SetName("McTrkTOF");
1805 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkTOFZ"))){
1806 h = new TH2I("hMcTrkTOFZ", "Track[TOF] Z Resolution", 100, -1., 1., 100, -1., 1.);
1807 h->GetXaxis()->SetTitle("tg(#theta)");
1808 h->GetYaxis()->SetTitle("#Delta z [cm]");
1809 h->GetZaxis()->SetTitle("entries");
1810 } else h->Reset();
1811 arr->AddAt(h, 0);
1812 // Kalman track Z pulls
1813 if(!(h = (TH2I*)gROOT->FindObject("hMcTrkTOFZPull"))){
1814 h = new TH2I("hMcTrkTOFZPull", "Track[TOF] Z Pulls", 100, -1., 1., 100, -4.5, 4.5);
1815 h->GetXaxis()->SetTitle("tg(#theta)");
1816 h->GetYaxis()->SetTitle("#Delta z / #sigma_{z}");
1817 h->GetZaxis()->SetTitle("entries");
1818 } else h->Reset();
1819 arr->AddAt(h, 1);
1820
1821 return fContainer;
1822}
1823
1824//________________________________________________________
1825Bool_t AliTRDresolution::Process(TH2 * const h2, TF1 *f, Float_t k, TGraphErrors **g)
1826{
1827 //
1828 // Do the processing
1829 //
1830
92c40e64 1831 Char_t pn[10]; sprintf(pn, "p%03d", fIdxPlot);
1ee39b3a 1832 Int_t n = 0;
1833 if((n=g[0]->GetN())) for(;n--;) g[0]->RemovePoint(n);
1834 if((n=g[1]->GetN())) for(;n--;) g[1]->RemovePoint(n);
1835
1836 for(Int_t ibin = 1; ibin <= h2->GetNbinsX(); ibin++){
1837 Double_t x = h2->GetXaxis()->GetBinCenter(ibin);
1838 TH1D *h = h2->ProjectionY(pn, ibin, ibin);
1839 if(h->GetEntries()<100) continue;
1840 //AdjustF1(h, f);
1841
1842 h->Fit(f, "QN");
1843
1844 Int_t ip = g[0]->GetN();
1845 g[0]->SetPoint(ip, x, k*f->GetParameter(1));
1846 g[0]->SetPointError(ip, 0., k*f->GetParError(1));
1847 g[1]->SetPoint(ip, x, k*f->GetParameter(2));
1848 g[1]->SetPointError(ip, 0., k*f->GetParError(2));
1849
1850/*
1851 g[0]->SetPoint(ip, x, k*h->GetMean());
1852 g[0]->SetPointError(ip, 0., k*h->GetMeanError());
1853 g[1]->SetPoint(ip, x, k*h->GetRMS());
1854 g[1]->SetPointError(ip, 0., k*h->GetRMSError());*/
1855 }
1856 fIdxPlot++;
1857 return kTRUE;
1858}
1859
1860//________________________________________________________
92c40e64 1861Bool_t AliTRDresolution::Process2D(ETRDresolutionPlot plot, Int_t idx, TF1 *f, Float_t k, Int_t gidx)
1ee39b3a 1862{
1863 //
1864 // Do the processing
1865 //
1866
1867 if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
1868
1869 // retrive containers
1870 TH2I *h2 = idx<0 ? (TH2I*)(fContainer->At(plot)) : (TH2I*)((TObjArray*)(fContainer->At(plot)))->At(idx);
1871 if(!h2) return kFALSE;
92c40e64 1872
1ee39b3a 1873 TGraphErrors *g[2];
92c40e64 1874 if(gidx<0) gidx=idx;
1875 if(!(g[0] = gidx<0 ? (TGraphErrors*)fGraphM->At(plot) : (TGraphErrors*)((TObjArray*)(fGraphM->At(plot)))->At(gidx))) return kFALSE;
1ee39b3a 1876
92c40e64 1877 if(!(g[1] = gidx<0 ? (TGraphErrors*)fGraphS->At(plot) : (TGraphErrors*)((TObjArray*)(fGraphS->At(plot)))->At(gidx))) return kFALSE;
1ee39b3a 1878
1879 return Process(h2, f, k, g);
1880}
1881
1882//________________________________________________________
1883Bool_t AliTRDresolution::Process3D(ETRDresolutionPlot plot, Int_t idx, TF1 *f, Float_t k)
1884{
1885 //
1886 // Do the processing
1887 //
1888
1889 if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
1890
1891 // retrive containers
1892 TH3S *h3 = idx<0 ? (TH3S*)(fContainer->At(plot)) : (TH3S*)((TObjArray*)(fContainer->At(plot)))->At(idx);
1893 if(!h3) return kFALSE;
1894
1895 TObjArray *gm, *gs;
1896 if(!(gm = (TObjArray*)((TObjArray*)(fGraphM->At(plot)))->At(idx))) return kFALSE;
1897 if(!(gs = (TObjArray*)((TObjArray*)(fGraphS->At(plot)))->At(idx))) return kFALSE;
1898 TGraphErrors *g[2];
1899
1900 TAxis *az = h3->GetZaxis();
1901 for(Int_t iz=1; iz<=az->GetNbins(); iz++){
1902 if(!(g[0] = (TGraphErrors*)gm->At(iz-1))) return kFALSE;
1903 if(!(g[1] = (TGraphErrors*)gs->At(iz-1))) return kFALSE;
1904 az->SetRange(iz, iz);
1905 if(!Process((TH2*)h3->Project3D("yx"), f, k, g)) return kFALSE;
1906 }
1907
1908 return kTRUE;
1909}
1910
92c40e64 1911//________________________________________________________
1912Bool_t AliTRDresolution::Process3Drange(ETRDresolutionPlot plot, Int_t hidx, Int_t gidx, TF1 *f, Float_t k, Int_t zbin0, Int_t zbin1)
1913{
1914 //
1915 // Do the processing
1916 //
1917
1918 if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
1919
1920 // retrive containers
1921 TH3S *h3 = hidx<0 ? (TH3S*)(fContainer->At(plot)) : (TH3S*)((TObjArray*)(fContainer->At(plot)))->At(hidx);
1922 if(!h3) return kFALSE;
1923
1924 TGraphErrors *g[2];
1925 if(!(g[0] = (TGraphErrors*)((TObjArray*)(fGraphM->At(plot)))->At(gidx))) return kFALSE;
1926 if(!(g[1] = (TGraphErrors*)((TObjArray*)(fGraphS->At(plot)))->At(gidx))) return kFALSE;
1927
1928 TAxis *az = h3->GetZaxis();
1929 az->SetRange(zbin0, zbin1);
1930 if(!Process((TH2*)h3->Project3D("yx"), f, k, g)) return kFALSE;
1931 return kTRUE;
1932}
1933
1ee39b3a 1934//________________________________________________________
1935Bool_t AliTRDresolution::Process3DL(ETRDresolutionPlot plot, Int_t idx, TF1 *f, Float_t k)
1936{
1937 //
1938 // Do the processing
1939 //
1940
1941 if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
1942
1943 // retrive containers
1944 TH3S *h3 = (TH3S*)((TObjArray*)fContainer->At(plot))->At(idx);
1945 if(!h3) return kFALSE;
1946
1947 TGraphAsymmErrors *gm;
1948 TGraphErrors *gs;
1949 if(!(gm = (TGraphAsymmErrors*)((TObjArray*)fGraphM->At(plot))->At(0))) return kFALSE;
1950 if(!(gs = (TGraphErrors*)((TObjArray*)fGraphS->At(plot)))) return kFALSE;
1951
1952 Float_t x, r, mpv, xM, xm;
1953 TAxis *ay = h3->GetYaxis();
1954 for(Int_t iy=1; iy<=h3->GetNbinsY(); iy++){
1955 ay->SetRange(iy, iy);
1956 x = ay->GetBinCenter(iy);
1957 TH2F *h2=(TH2F*)h3->Project3D("zx");
1958 TAxis *ax = h2->GetXaxis();
1959 for(Int_t ix=1; ix<=h2->GetNbinsX(); ix++){
1960 r = ax->GetBinCenter(ix);
1961 TH1D *h1 = h2->ProjectionY("py", ix, ix);
1962 if(h1->Integral()<50) continue;
1963 h1->Fit(f, "QN");
1964
1965 GetLandauMpvFwhm(f, mpv, xm, xM);
1966 Int_t ip = gm->GetN();
1967 gm->SetPoint(ip, x, k*mpv);
1968 gm->SetPointError(ip, 0., 0., k*xm, k*xM);
1969 gs->SetPoint(ip, r, k*(xM-xm)/mpv);
1970 gs->SetPointError(ip, 0., 0.);
1971 }
1972 }
1973
1974 return kTRUE;
1975}
1976
1977//________________________________________________________
92c40e64 1978Bool_t AliTRDresolution::Process4D(ETRDresolutionPlot plot, Int_t idx, TF1 *f, Float_t k, Int_t n)
1ee39b3a 1979{
1980 //
1981 // Do the processing
1982 //
1983
1984 if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
92c40e64 1985 //printf("Process4D : processing plot[%d] idx[%d]\n", plot, idx);
1ee39b3a 1986
1987 // retrive containers
1988 TObjArray *arr = (TObjArray*)((TObjArray*)(fContainer->At(plot)))->At(idx);
1989 if(!arr) return kFALSE;
1990
92c40e64 1991 TObjArray *gm, *gs;
1992 if(!(gm = (TObjArray*)((TObjArray*)(fGraphM->At(plot)))->At(idx))) return kFALSE;
1993 if(!(gs = (TObjArray*)((TObjArray*)(fGraphS->At(plot)))->At(idx))) return kFALSE;
1ee39b3a 1994
1995 TGraphErrors *g[2];
1996
92c40e64 1997 TH3S *h3(NULL);
1998 for(Int_t ix=0, in=0; ix<arr->GetEntriesFast(); ix++){
1ee39b3a 1999 if(!(h3 = (TH3S*)arr->At(ix))) return kFALSE;
1ee39b3a 2000 TAxis *az = h3->GetZaxis();
92c40e64 2001 //printf(" process ix[%d] bins[%d] in[%d]\n", ix, az->GetNbins(), in);
2002 for(Int_t iz=1; iz<=az->GetNbins(); iz++, in++){
2003 if(n>=0 && n!=in) continue;
2004 if(!(g[0] = (TGraphErrors*)gm->At(in))) return kFALSE;
2005 if(!(g[1] = (TGraphErrors*)gs->At(in))) return kFALSE;
2006 //printf(" g0[%s] g1[%s]\n", g[0]->GetName(), g[1]->GetName());
1ee39b3a 2007 az->SetRange(iz, iz);
2008 if(!Process((TH2*)h3->Project3D("yx"), f, k, g)) return kFALSE;
2009 }
2010 }
2011
2012 return kTRUE;
2013}
2014
2015//________________________________________________________
2016Bool_t AliTRDresolution::GetGraphPlot(Float_t *bb, ETRDresolutionPlot ip, Int_t idx)
2017{
2018 //
2019 // Get the graphs
2020 //
2021
2022 if(!fGraphS || !fGraphM) return kFALSE;
92c40e64 2023
2024 //printf("plotting task[%d] gidx[%d]\n", ip, idx);
1ee39b3a 2025 TGraphErrors *gm = idx<0 ? (TGraphErrors*)fGraphM->At(ip) : (TGraphErrors*)((TObjArray*)(fGraphM->At(ip)))->At(idx);
2026 if(!gm) return kFALSE;
2027 TGraphErrors *gs = idx<0 ? (TGraphErrors*)fGraphS->At(ip) : (TGraphErrors*)((TObjArray*)(fGraphS->At(ip)))->At(idx);
2028 if(!gs) return kFALSE;
92c40e64 2029 //printf("gs[%s] gm[%s]\n", gs->GetName(), gm->GetName());
1ee39b3a 2030 gs->Draw("apl"); gm->Draw("pl");
92c40e64 2031 //return kTRUE;
1ee39b3a 2032 // titles look up
2033 Int_t nref = 0;
92c40e64 2034 for(Int_t jp=0; jp<(Int_t)ip; jp++) nref+=fgNproj[jp];
1ee39b3a 2035 UChar_t jdx = idx<0?0:idx;
92c40e64 2036 for(Int_t jc=0; jc<TMath::Min(jdx,fgNproj[ip]-1); jc++) nref++;
1ee39b3a 2037 const Char_t **at = fgAxTitle[nref];
2038
2039 Int_t n(0);
2040 if((n=gm->GetN())) {
2041 PutTrendValue(Form("%s_%s", fgPerformanceName[ip], at[0]), gm->GetMean(2));
2042 PutTrendValue(Form("%s_%sRMS", fgPerformanceName[ip], at[0]), gm->GetRMS(2));
2043 }
2044
2045 if((n=gs->GetN())){
2046 gs->Sort(&TGraph::CompareY);
2047 PutTrendValue(Form("%s_%sSigMin", fgPerformanceName[ip], at[0]), gs->GetY()[0]);
2048 PutTrendValue(Form("%s_%sSigMax", fgPerformanceName[ip], at[0]), gs->GetY()[n-1]);
2049 gs->Sort(&TGraph::CompareX);
2050 }
2051
2052 // axis range
b91fdd71 2053 TAxis *ax = NULL;
1ee39b3a 2054 ax = gs->GetHistogram()->GetXaxis();
2055 ax->SetRangeUser(bb[0], bb[2]);
2056 ax->SetTitle(at[1]);ax->CenterTitle();
2057
2058 ax = gs->GetHistogram()->GetYaxis();
2059 ax->SetRangeUser(bb[1], bb[3]);
2060 ax->SetTitleOffset(1.1);
2061 ax->SetTitle(at[2]);ax->CenterTitle();
2062
b91fdd71 2063 TGaxis *gax = NULL;
1ee39b3a 2064 gax = new TGaxis(bb[2], bb[1], bb[2], bb[3], bb[1], bb[3], 510, "+U");
2065 gax->SetLineColor(kRed);gax->SetLineWidth(2);gax->SetTextColor(kRed);
2066 //gax->SetVertical();
2067 gax->CenterTitle(); gax->SetTitleOffset(.7);
2068 gax->SetTitle(at[3]); gax->Draw();
2069
2070 // bounding box
2071 TBox *b = new TBox(-.15, bb[1], .15, bb[3]);
2072 b->SetFillStyle(3002);b->SetLineColor(0);
2073 b->SetFillColor(ip<=Int_t(kMCcluster)?kGreen:kBlue);
2074 b->Draw();
2075 return kTRUE;
2076}
2077
92c40e64 2078Char_t const *fgLegHeader[6]={
2079 "Layer 0","Layer 1","Layer 2","Layer 3","Layer 4","Layer 5"
2080};
1ee39b3a 2081//________________________________________________________
92c40e64 2082Bool_t AliTRDresolution::GetGraphTrack(Float_t *bb, Int_t idx, Int_t il, Int_t n, Bool_t kLEG)
1ee39b3a 2083{
2084 //
2085 // Get the graphs
2086 //
2087
2088 if(!fGraphS || !fGraphM) return kFALSE;
2089
2090 // axis titles look up
92c40e64 2091 Int_t nref(0);
2092 for(Int_t jp=0; jp<Int_t(kMCtrackTRD); jp++) nref+=fgNproj[jp];
2093 nref+=idx;
1ee39b3a 2094 const Char_t **at = fgAxTitle[nref];
92c40e64 2095 printf("nref[%d] ax[%s] x[%f %f] y[%f %f]\n", nref, at[0], bb[0], bb[2], bb[1], bb[3]);
2096
2097 TLegend *leg(NULL);
2098 if(kLEG){
2099 leg=new TLegend(.65, .7, .95, .99);
2100 leg->SetHeader("Species");
2101 leg->SetBorderSize(1);
2102 leg->SetFillColor(0);
1ee39b3a 2103 }
92c40e64 2104 TH1S *h1(NULL);
2105 h1 = new TH1S(Form("h1TF_%d", fIdxFrame++), at[0], 2, bb[0], bb[2]);
2106 h1->SetMinimum(bb[1]);h1->SetMaximum(bb[3]);
2107 h1->SetLineColor(kBlack); h1->SetLineWidth(1);h1->SetLineStyle(2);
1ee39b3a 2108 // axis range
92c40e64 2109 TAxis *ax = h1->GetXaxis();
2110 ax->SetTitle(at[1]);ax->CenterTitle();ax->SetMoreLogLabels();
2111 ax = h1->GetYaxis();
1ee39b3a 2112 ax->SetRangeUser(bb[1], bb[3]);
92c40e64 2113 ax->SetTitleOffset(.5);//ax->SetTitleSize(.06);
1ee39b3a 2114 ax->SetTitle(at[2]);ax->CenterTitle();
92c40e64 2115 h1->Draw();
b91fdd71 2116 TGaxis *gax = NULL;
1ee39b3a 2117 gax = new TGaxis(bb[2], bb[1], bb[2], bb[3], bb[1], bb[3], 510, "+U");
2118 gax->SetLineColor(kRed);gax->SetLineWidth(2);gax->SetTextColor(kRed);
2119 //gax->SetVertical();
92c40e64 2120 gax->CenterTitle(); //gax->SetTitleOffset(.5);gax->SetTitleSize(.06);
1ee39b3a 2121 gax->SetTitle(at[3]); gax->Draw();
2122
92c40e64 2123 TGraphErrors *gm = NULL, *gs = NULL;
2124 TObjArray *a0 = NULL, *a1 = NULL;
2125 a0 = (TObjArray*)((TObjArray*)fGraphM->At(kMCtrackTRD))->At(idx);
2126 a1 = (TObjArray*)((TObjArray*)fGraphS->At(kMCtrackTRD))->At(idx);
2127 Int_t nn(0);
2128 for(Int_t is=il, is0=0; is<il+n; is++, is0++){
2129 if(is0==3) continue;
2130 if(!(gs = (TGraphErrors*)a1->At(is))) return kFALSE;
1ee39b3a 2131 if(!(gm = (TGraphErrors*)a0->At(is))) return kFALSE;
1ee39b3a 2132
92c40e64 2133 if((nn=gs->GetN())){
2134 gs->Draw("pl");
2135 if(leg) leg->AddEntry(gs, gs->GetTitle(), "p");
2136 //printf("entry[%d]=%s\n", il+is, gs->GetTitle());
2137 gs->Sort(&TGraph::CompareY);
2138 PutTrendValue(Form("%s_%sSigMin%s", fgPerformanceName[kMCtrackTRD], at[0], AliPID::ParticleShortName(is0)), gs->GetY()[0]);
2139 PutTrendValue(Form("%s_%sSigMax%s", fgPerformanceName[kMCtrackTRD], at[0], AliPID::ParticleShortName(is0)), gs->GetY()[nn-1]);
2140 gs->Sort(&TGraph::CompareX);
2141 }
2142 if(gm->GetN()){
2143 gm->Draw("pl");
2144 PutTrendValue(Form("%s_%s_%s", fgPerformanceName[kMCtrackTRD], at[0], AliPID::ParticleShortName(is0)), gm->GetMean(2));
2145 PutTrendValue(Form("%s_%s_%sRMS", fgPerformanceName[kMCtrackTRD], at[0], AliPID::ParticleShortName(is0)), gm->GetRMS(2));
2146 }
2147 }
2148 if(leg) leg->Draw();
1ee39b3a 2149 return kTRUE;
2150}
2151
2152
2153//________________________________________________________
92c40e64 2154Bool_t AliTRDresolution::GetGraphTrackTPC(Float_t *bb, Int_t idx, Int_t ist, Int_t n, Bool_t kLEG)
1ee39b3a 2155{
2156 //
2157 // Get the graphs
2158 //
2159
2160 if(!fGraphS || !fGraphM) return kFALSE;
2161
2162 // axis titles look up
2163 Int_t nref = 0;
92c40e64 2164 for(Int_t jp=0; jp<Int_t(kMCtrackTPC); jp++) nref+=fgNproj[jp];
2165 nref+=idx;
1ee39b3a 2166 const Char_t **at = fgAxTitle[nref];
2167
92c40e64 2168 TLegend *leg(NULL);
2169 if(kLEG){
2170 leg=new TLegend(.65, .7, .95, .99);
2171 leg->SetHeader("Species");
2172 leg->SetBorderSize(1);
2173 leg->SetFillColor(0);
1ee39b3a 2174 }
92c40e64 2175 TH1S *h1(NULL);
2176 h1 = new TH1S(Form("h1TF_%d", fIdxFrame++), at[0], 2, bb[0], bb[2]);
2177 h1->SetMinimum(bb[1]);h1->SetMaximum(bb[3]);
2178 h1->SetLineColor(kBlack); h1->SetLineWidth(1);h1->SetLineStyle(2);
1ee39b3a 2179 // axis range
92c40e64 2180 TAxis *ax = h1->GetXaxis();
2181 ax->SetTitle(at[1]);ax->CenterTitle();ax->SetMoreLogLabels();
2182 ax = h1->GetYaxis();
1ee39b3a 2183 ax->SetRangeUser(bb[1], bb[3]);
92c40e64 2184 ax->SetTitleOffset(.5);//ax->SetTitleSize(.06);
1ee39b3a 2185 ax->SetTitle(at[2]);ax->CenterTitle();
92c40e64 2186 h1->Draw();
b91fdd71 2187 TGaxis *gax = NULL;
1ee39b3a 2188 gax = new TGaxis(bb[2], bb[1], bb[2], bb[3], bb[1], bb[3], 510, "+U");
2189 gax->SetLineColor(kRed);gax->SetLineWidth(2);gax->SetTextColor(kRed);
2190 //gax->SetVertical();
92c40e64 2191 gax->CenterTitle(); //gax->SetTitleOffset(.5);gax->SetTitleSize(.06);
1ee39b3a 2192 gax->SetTitle(at[3]); gax->Draw();
2193
92c40e64 2194 Int_t nn(0);
2195 TGraphErrors *gm = NULL, *gs = NULL;
2196 TObjArray *a0 = NULL, *a1 = NULL;
2197 a0 = (TObjArray*)((TObjArray*)fGraphM->At(kMCtrackTPC))->At(idx);
2198 a1 = (TObjArray*)((TObjArray*)fGraphS->At(kMCtrackTPC))->At(idx);
2199 for(Int_t is=ist, is0=0; is<ist+n; is++, is0++){
2200 if(is0==3) continue;
2201 if(!(gs = (TGraphErrors*)a1->At(is))) return kFALSE;
1ee39b3a 2202 if(!(gm = (TGraphErrors*)a0->At(is))) return kFALSE;
92c40e64 2203 if((nn=gs->GetN())){
2204 gs->Draw("pl");if(leg) leg->AddEntry(gs, gs->GetTitle(), "p");
2205 gs->Sort(&TGraph::CompareY);
2206 PutTrendValue(Form("%s_%sSigMin%s", fgPerformanceName[kMCtrackTPC], at[0], AliPID::ParticleShortName(is0)), gs->GetY()[0]);
2207 PutTrendValue(Form("%s_%sSigMax%s", fgPerformanceName[kMCtrackTPC], at[0], AliPID::ParticleShortName(is0)), gs->GetY()[nn-1]);
2208 gs->Sort(&TGraph::CompareX);
2209 }
2210 if(gm->GetN()){
2211 gm->Draw("pl");
2212 PutTrendValue(Form("%s_%s_%s", fgPerformanceName[kMCtrackTPC], at[0], AliPID::ParticleShortName(is0)), gm->GetMean(2));
2213 PutTrendValue(Form("%s_%s_%sRMS", fgPerformanceName[kMCtrackTPC], at[0], AliPID::ParticleShortName(is0)), gm->GetRMS(2));
2214 }
1ee39b3a 2215 }
92c40e64 2216 if(leg) leg->Draw();
1ee39b3a 2217 return kTRUE;
2218}
2219
2220//________________________________________________________
2221void AliTRDresolution::GetLandauMpvFwhm(TF1 * const f, Float_t &mpv, Float_t &xm, Float_t &xM)
2222{
2223 //
2224 // Get the most probable value and the full width half mean
2225 // of a Landau distribution
2226 //
2227
2228 const Float_t dx = 1.;
2229 mpv = f->GetParameter(1);
2230 Float_t fx, max = f->Eval(mpv);
2231
2232 xm = mpv - dx;
2233 while((fx = f->Eval(xm))>.5*max){
2234 if(fx>max){
2235 max = fx;
2236 mpv = xm;
2237 }
2238 xm -= dx;
2239 }
2240
2241 xM += 2*(mpv - xm);
2242 while((fx = f->Eval(xM))>.5*max) xM += dx;
2243}
2244
2245
2246//________________________________________________________
2247void AliTRDresolution::SetRecoParam(AliTRDrecoParam *r)
2248{
2249
2250 fReconstructor->SetRecoParam(r);
2251}