]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG1/TRD/AliTRDresolution.cxx
- adding AliHLTRecoParamHandler to link def
[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"
92d6d80c 73#include "AliLog.h"
92c40e64 74#include "AliESDtrack.h"
801d4d50 75#include "AliCDBManager.h"
76#include "AliCDBPath.h"
77#include "AliCDBEntry.h"
78#include "AliGeomManager.h"
068e2c00 79#include "AliMathBase.h"
1ee39b3a 80
81#include "AliTRDresolution.h"
82#include "AliTRDgeometry.h"
83#include "AliTRDpadPlane.h"
84#include "AliTRDcluster.h"
85#include "AliTRDseedV1.h"
86#include "AliTRDtrackV1.h"
87#include "AliTRDReconstructor.h"
88#include "AliTRDrecoParam.h"
92c40e64 89#include "AliTRDpidUtil.h"
1ee39b3a 90
91#include "info/AliTRDclusterInfo.h"
92
93ClassImp(AliTRDresolution)
94
92c40e64 95UChar_t const AliTRDresolution::fgNproj[kNviews] = {
a310e49b 96 2, 2, 5, 5, 5,
92d6d80c 97 2, 5, 11, 11, 11
1ee39b3a 98};
92c40e64 99Char_t const * AliTRDresolution::fgPerformanceName[kNviews] = {
1ee39b3a 100 "Charge"
101 ,"Cluster2Track"
102 ,"Tracklet2Track"
a310e49b 103 ,"Tracklet2TRDin"
104 ,"Tracklet2TRDout"
1ee39b3a 105 ,"Cluster2MC"
106 ,"Tracklet2MC"
92d6d80c 107 ,"TRDin2MC"
108 ,"TRDout2MC"
1ee39b3a 109 ,"TRD2MC"
110};
041d572e 111// Configure segmentation for y resolution/residuals
3ba3e0a4 112Int_t const AliTRDresolution::fgkNresYsegm[3] = {
113 AliTRDgeometry::kNsector
114 ,AliTRDgeometry::kNsector*AliTRDgeometry::kNstack
115 ,AliTRDgeometry::kNdet
116};
117Char_t const *AliTRDresolution::fgkResYsegmName[3] = {
118 "Sector", "Stack", "Detector"};
041d572e 119
1ee39b3a 120
121//________________________________________________________
122AliTRDresolution::AliTRDresolution()
f2e89a4c 123 :AliTRDrecoTask()
2589cf64 124 ,fSegmentLevel(0)
1ee39b3a 125 ,fIdxPlot(0)
92c40e64 126 ,fIdxFrame(0)
3ba3e0a4 127 ,fPtThreshold(1.)
b91fdd71 128 ,fReconstructor(NULL)
129 ,fGeo(NULL)
92c40e64 130 ,fDBPDG(NULL)
b91fdd71 131 ,fGraphS(NULL)
132 ,fGraphM(NULL)
133 ,fCl(NULL)
b91fdd71 134 ,fMCcl(NULL)
83b44483 135/* ,fTrklt(NULL)
136 ,fMCtrklt(NULL)*/
f8f46e4d 137{
138 //
139 // Default constructor
140 //
f2e89a4c 141 SetNameTitle("TRDresolution", "TRD spatial and momentum resolution");
2589cf64 142 SetSegmentationLevel();
f8f46e4d 143}
144
705f8b0a 145//________________________________________________________
f8f46e4d 146AliTRDresolution::AliTRDresolution(char* name)
f2e89a4c 147 :AliTRDrecoTask(name, "TRD spatial and momentum resolution")
2589cf64 148 ,fSegmentLevel(0)
f8f46e4d 149 ,fIdxPlot(0)
150 ,fIdxFrame(0)
3ba3e0a4 151 ,fPtThreshold(1.)
f8f46e4d 152 ,fReconstructor(NULL)
153 ,fGeo(NULL)
154 ,fDBPDG(NULL)
155 ,fGraphS(NULL)
156 ,fGraphM(NULL)
157 ,fCl(NULL)
f8f46e4d 158 ,fMCcl(NULL)
83b44483 159/* ,fTrklt(NULL)
160 ,fMCtrklt(NULL)*/
1ee39b3a 161{
162 //
163 // Default constructor
164 //
165
166 fReconstructor = new AliTRDReconstructor();
167 fReconstructor->SetRecoParam(AliTRDrecoParam::GetLowFluxParam());
168 fGeo = new AliTRDgeometry();
169
170 InitFunctorList();
2589cf64 171 SetSegmentationLevel();
1ee39b3a 172
705f8b0a 173 DefineOutput(kClToTrk, TObjArray::Class()); // cluster2track
705f8b0a 174 DefineOutput(kClToMC, TObjArray::Class()); // cluster2mc
83b44483 175/* DefineOutput(kTrkltToTrk, TObjArray::Class()); // tracklet2track
176 DefineOutput(kTrkltToMC, TObjArray::Class()); // tracklet2mc*/
1ee39b3a 177}
178
179//________________________________________________________
180AliTRDresolution::~AliTRDresolution()
181{
182 //
183 // Destructor
184 //
185
186 if(fGraphS){fGraphS->Delete(); delete fGraphS;}
187 if(fGraphM){fGraphM->Delete(); delete fGraphM;}
188 delete fGeo;
189 delete fReconstructor;
190 if(gGeoManager) delete gGeoManager;
191 if(fCl){fCl->Delete(); delete fCl;}
1ee39b3a 192 if(fMCcl){fMCcl->Delete(); delete fMCcl;}
83b44483 193/* if(fTrklt){fTrklt->Delete(); delete fTrklt;}
194 if(fMCtrklt){fMCtrklt->Delete(); delete fMCtrklt;}*/
1ee39b3a 195}
196
197
198//________________________________________________________
f8f46e4d 199void AliTRDresolution::UserCreateOutputObjects()
1ee39b3a 200{
201 // spatial resolution
5935a6da 202
fe1d1beb 203 if(!fReconstructor){
204 fReconstructor = new AliTRDReconstructor();
205 fReconstructor->SetRecoParam(AliTRDrecoParam::GetLowFluxParam());
206 }
fe1d1beb 207
068e2c00 208 AliTRDrecoTask::UserCreateOutputObjects();
83b44483 209 InitExchangeContainers();
210}
1ee39b3a 211
83b44483 212//________________________________________________________
213void AliTRDresolution::InitExchangeContainers()
214{
1ee39b3a 215 fCl = new TObjArray();
216 fCl->SetOwner(kTRUE);
1ee39b3a 217 fMCcl = new TObjArray();
218 fMCcl->SetOwner(kTRUE);
83b44483 219/* fTrklt = new TObjArray();
220 fTrklt->SetOwner(kTRUE);
1ee39b3a 221 fMCtrklt = new TObjArray();
83b44483 222 fMCtrklt->SetOwner(kTRUE);*/
e3147647 223 PostData(kClToTrk, fCl);
224 PostData(kClToMC, fMCcl);
225/* PostData(kTrkltToTrk, fTrklt);
226 PostData(kTrkltToMC, fMCtrklt);*/
1ee39b3a 227}
228
229//________________________________________________________
f8f46e4d 230void AliTRDresolution::UserExec(Option_t *opt)
1ee39b3a 231{
232 //
233 // Execution part
234 //
235
801d4d50 236 if(!IsInitGeom()){
237 // create geometry
238 AliCDBManager* ocdb = AliCDBManager::Instance();
239 AliCDBEntry* obj = ocdb->Get(AliCDBPath("GRP", "Geometry", "Data"));
240 AliGeomManager::SetGeometry((TGeoManager*)obj->GetObject());
241 AliGeomManager::GetNalignable("TRD");
242 AliGeomManager::ApplyAlignObjsFromCDB("TRD");
243 fGeo = new AliTRDgeometry();
244 SetInitGeom();
245 }
246
1ee39b3a 247 fCl->Delete();
1ee39b3a 248 fMCcl->Delete();
83b44483 249/* fTrklt->Delete();
250 fMCtrklt->Delete();*/
b4414720 251 AliTRDrecoTask::UserExec(opt);
1ee39b3a 252}
253
553528eb 254//________________________________________________________
255Bool_t AliTRDresolution::Pulls(Double_t dyz[2], Double_t cov[3], Double_t tilt)
256{
257// Helper function to calculate pulls in the yz plane
258// using proper tilt rotation
259// Uses functionality defined by AliTRDseedV1.
260
261 Double_t t2(tilt*tilt);
262
263 // rotate along pad
264 Double_t cc[3];
265 cc[0] = cov[0] - 2.*tilt*cov[1] + t2*cov[2];
266 cc[1] = cov[1]*(1.-t2) + tilt*(cov[0] - cov[2]);
267 cc[2] = t2*cov[0] + 2.*tilt*cov[1] + cov[2];
268 // do sqrt
269 Double_t sqr[3]={0., 0., 0.};
270 if(AliTRDseedV1::GetCovSqrt(cc, sqr)) return kFALSE;
271 Double_t invsqr[3]={0., 0., 0.};
272 if(AliTRDseedV1::GetCovInv(sqr, invsqr)<1.e-40) return kFALSE;
273 Double_t tmp(dyz[0]);
274 dyz[0] = invsqr[0]*tmp + invsqr[1]*dyz[1];
275 dyz[1] = invsqr[1]*tmp + invsqr[2]*dyz[1];
276 return kTRUE;
277}
278
1ee39b3a 279//________________________________________________________
280TH1* AliTRDresolution::PlotCharge(const AliTRDtrackV1 *track)
281{
282 //
283 // Plots the charge distribution
284 //
285
286 if(track) fkTrack = track;
287 if(!fkTrack){
3d2a3dff 288 AliDebug(4, "No Track defined.");
b91fdd71 289 return NULL;
1ee39b3a 290 }
b91fdd71 291 TObjArray *arr = NULL;
83b44483 292 if(!fContainer || !(arr = ((TObjArray*)fContainer->At(kCharge)))){
1ee39b3a 293 AliWarning("No output container defined.");
b91fdd71 294 return NULL;
1ee39b3a 295 }
b91fdd71 296 TH3S* h = NULL;
1ee39b3a 297
b91fdd71 298 AliTRDseedV1 *fTracklet = NULL;
299 AliTRDcluster *c = NULL;
1ee39b3a 300 for(Int_t ily=0; ily<AliTRDgeometry::kNlayer; ily++){
301 if(!(fTracklet = fkTrack->GetTracklet(ily))) continue;
302 if(!fTracklet->IsOK()) continue;
303 Float_t x0 = fTracklet->GetX0();
304 Float_t dq, dl;
305 for(Int_t itb=AliTRDseedV1::kNtb; itb--;){
306 if(!(c = fTracklet->GetClusters(itb))){
307 if(!(c = fTracklet->GetClusters(AliTRDseedV1::kNtb+itb))) continue;
308 }
309 dq = fTracklet->GetdQdl(itb, &dl);
310 dl /= 0.15; // dl/dl0, dl0 = 1.5 mm for nominal vd
311 (h = (TH3S*)arr->At(0))->Fill(dl, x0-c->GetX(), dq);
312 }
313
314// if(!HasMCdata()) continue;
315// UChar_t s;
316// Float_t pt0, y0, z0, dydx0, dzdx0;
317// if(!fMC->GetDirections(x0, y0, z0, dydx0, dzdx0, pt0, s)) continue;
318
319 }
320 return h;
321}
322
323
324//________________________________________________________
325TH1* AliTRDresolution::PlotCluster(const AliTRDtrackV1 *track)
326{
327 //
328 // Plot the cluster distributions
329 //
330
331 if(track) fkTrack = track;
332 if(!fkTrack){
3d2a3dff 333 AliDebug(4, "No Track defined.");
b91fdd71 334 return NULL;
1ee39b3a 335 }
b91fdd71 336 TObjArray *arr = NULL;
83b44483 337 if(!fContainer || !(arr = ((TObjArray*)fContainer->At(kCluster)))){
1ee39b3a 338 AliWarning("No output container defined.");
b91fdd71 339 return NULL;
1ee39b3a 340 }
05039659 341 ULong_t status = fkESD ? fkESD->GetStatus():0;
1ee39b3a 342
3ba3e0a4 343 Int_t sgm[3];
553528eb 344 Double_t covR[7], cov[3], dy[2], dz[2];
345 Float_t pt, x0, y0, z0, dydx, dzdx;
dfd7d48b 346 AliTRDseedV1 *fTracklet(NULL); TObjArray *clInfoArr(NULL);
1ee39b3a 347 for(Int_t ily=0; ily<AliTRDgeometry::kNlayer; ily++){
348 if(!(fTracklet = fkTrack->GetTracklet(ily))) continue;
349 if(!fTracklet->IsOK()) continue;
350 x0 = fTracklet->GetX0();
3d2a3dff 351 pt = fTracklet->GetPt();
3ba3e0a4 352 sgm[2] = fTracklet->GetDetector();
353 sgm[0] = AliTRDgeometry::GetSector(sgm[2]);
354 sgm[1] = sgm[0] * AliTRDgeometry::kNstack + AliTRDgeometry::GetStack(sgm[2]);
355
1ee39b3a 356 // retrive the track angle with the chamber
357 y0 = fTracklet->GetYref(0);
358 z0 = fTracklet->GetZref(0);
359 dydx = fTracklet->GetYref(1);
360 dzdx = fTracklet->GetZref(1);
31c8fa8a 361 fTracklet->GetCovRef(covR);
a47a87c5 362 Double_t tilt(fTracklet->GetTilt())
363 ,t2(tilt*tilt)
364 ,corr(1./(1. + t2))
6558fd69 365 ,cost(TMath::Sqrt(corr));
b91fdd71 366 AliTRDcluster *c = NULL;
1ee39b3a 367 fTracklet->ResetClusterIter(kFALSE);
368 while((c = fTracklet->PrevCluster())){
369 Float_t xc = c->GetX();
370 Float_t yc = c->GetY();
371 Float_t zc = c->GetZ();
372 Float_t dx = x0 - xc;
373 Float_t yt = y0 - dx*dydx;
374 Float_t zt = z0 - dx*dzdx;
a47a87c5 375 dy[0] = yc-yt; dz[0]= zc-zt;
376
553528eb 377 // rotate along pad
a47a87c5 378 dy[1] = cost*(dy[0] - dz[0]*tilt);
379 dz[1] = cost*(dz[0] + dy[0]*tilt);
83b44483 380 if(pt>fPtThreshold && c->IsInChamber()) ((TH3S*)arr->At(0))->Fill(dydx, dy[1], sgm[fSegmentLevel]);
31c8fa8a 381
553528eb 382 // tilt rotation of covariance for clusters
383 Double_t sy2(c->GetSigmaY2()), sz2(c->GetSigmaZ2());
a47a87c5 384 cov[0] = (sy2+t2*sz2)*corr;
385 cov[1] = tilt*(sz2 - sy2)*corr;
386 cov[2] = (t2*sy2+sz2)*corr;
553528eb 387 // sum with track covariance
a47a87c5 388 cov[0]+=covR[0]; cov[1]+=covR[1]; cov[2]+=covR[2];
553528eb 389 Double_t dyz[2]= {dy[1], dz[1]};
390 Pulls(dyz, cov, tilt);
2589cf64 391 ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], dyz[0], dyz[1]);
1ee39b3a 392
dfd7d48b 393 // Get z-position with respect to anode wire
394 Int_t istk = fGeo->GetStack(c->GetDetector());
395 AliTRDpadPlane *pp = fGeo->GetPadPlane(ily, istk);
396 Float_t row0 = pp->GetRow0();
397 Float_t d = row0 - zt + pp->GetAnodeWireOffset();
398 d -= ((Int_t)(2 * d)) / 2.0;
399 if (d > 0.25) d = 0.5 - d;
400
8ee59659 401 AliTRDclusterInfo *clInfo(NULL);
402 clInfo = new AliTRDclusterInfo;
dfd7d48b 403 clInfo->SetCluster(c);
404 Float_t covF[] = {cov[0], cov[1], cov[2]};
405 clInfo->SetGlobalPosition(yt, zt, dydx, dzdx, covF);
406 clInfo->SetResolution(dy[1]);
407 clInfo->SetAnisochronity(d);
408 clInfo->SetDriftLength(dx);
409 clInfo->SetTilt(tilt);
83b44483 410 if(fCl) fCl->Add(clInfo);
411 else AliDebug(1, "Cl exchange container missing. Activate by calling \"InitExchangeContainers()\"");
412
3ba3e0a4 413 if(DebugLevel()>=1){
d14a8ac2 414 if(!clInfoArr){
415 clInfoArr=new TObjArray(AliTRDseedV1::kNclusters);
416 clInfoArr->SetOwner(kFALSE);
417 }
dfd7d48b 418 clInfoArr->Add(clInfo);
df0514f6 419 }
1ee39b3a 420 }
3ba3e0a4 421 if(DebugLevel()>=1 && clInfoArr){
dfd7d48b 422 (*DebugStream()) << "cluster"
423 <<"status=" << status
424 <<"clInfo.=" << clInfoArr
425 << "\n";
d14a8ac2 426 clInfoArr->Clear();
dfd7d48b 427 }
1ee39b3a 428 }
d14a8ac2 429 if(clInfoArr) delete clInfoArr;
81979445 430 return (TH3S*)arr->At(0);
1ee39b3a 431}
432
433
434//________________________________________________________
435TH1* AliTRDresolution::PlotTracklet(const AliTRDtrackV1 *track)
436{
437// Plot normalized residuals for tracklets to track.
438//
439// We start from the result that if X=N(|m|, |Cov|)
440// BEGIN_LATEX
441// (Cov^{-1})^{1/2}X = N((Cov^{-1})^{1/2}*|m|, |1|)
442// END_LATEX
443// in our case X=(y_trklt - y_trk z_trklt - z_trk) and |Cov| = |Cov_trklt| + |Cov_trk| at the radial
444// reference position.
445 if(track) fkTrack = track;
446 if(!fkTrack){
3d2a3dff 447 AliDebug(4, "No Track defined.");
b91fdd71 448 return NULL;
1ee39b3a 449 }
b91fdd71 450 TObjArray *arr = NULL;
83b44483 451 if(!fContainer || !(arr = (TObjArray*)fContainer->At(kTrack ))){
1ee39b3a 452 AliWarning("No output container defined.");
b91fdd71 453 return NULL;
1ee39b3a 454 }
455
3ba3e0a4 456 Int_t sgm[3];
1ee39b3a 457 Double_t cov[3], covR[7]/*, sqr[3], inv[3]*/;
3ba3e0a4 458 Double_t pt, phi, tht, x, dx, dy[2], dz[2];
a47a87c5 459 AliTRDseedV1 *fTracklet(NULL);
3ba3e0a4 460 for(Int_t il(0); il<AliTRDgeometry::kNlayer; il++){
1ee39b3a 461 if(!(fTracklet = fkTrack->GetTracklet(il))) continue;
462 if(!fTracklet->IsOK()) continue;
3ba3e0a4 463 sgm[2] = fTracklet->GetDetector();
464 sgm[0] = AliTRDgeometry::GetSector(sgm[2]);
465 sgm[1] = sgm[0] * AliTRDgeometry::kNstack + AliTRDgeometry::GetStack(sgm[2]);
a47a87c5 466 x = fTracklet->GetX();
467 dx = fTracklet->GetX0() - x;
468 pt = fTracklet->GetPt();
3ba3e0a4 469 phi = fTracklet->GetYref(1);
470 tht = fTracklet->GetZref(1);
a47a87c5 471 // compute dy and dz
472 dy[0]= fTracklet->GetYref(0)-dx*fTracklet->GetYref(1) - fTracklet->GetY();
473 dz[0]= fTracklet->GetZref(0)-dx*fTracklet->GetZref(1) - fTracklet->GetZ();
474 Double_t tilt(fTracklet->GetTilt())
475 ,t2(tilt*tilt)
476 ,corr(1./(1. + t2))
6558fd69 477 ,cost(TMath::Sqrt(corr));
478 Bool_t rc(fTracklet->IsRowCross());
a47a87c5 479
480 // calculate residuals using tilt rotation
481 dy[1]= cost*(dy[0] - dz[0]*tilt);
482 dz[1]= cost*(dz[0] + dy[0]*tilt);
2589cf64 483 ((TH3S*)arr->At(0))->Fill(phi, dy[1], sgm[fSegmentLevel]+rc*fgkNresYsegm[fSegmentLevel]);
3ba3e0a4 484 ((TH3S*)arr->At(2))->Fill(tht, dz[1], rc);
a47a87c5 485
1ee39b3a 486 // compute covariance matrix
487 fTracklet->GetCovAt(x, cov);
488 fTracklet->GetCovRef(covR);
489 cov[0] += covR[0]; cov[1] += covR[1]; cov[2] += covR[2];
553528eb 490 Double_t dyz[2]= {dy[1], dz[1]};
81979445 491 Pulls(dyz, cov, tilt);
2589cf64 492 ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], dyz[0], dyz[1]);
3ba3e0a4 493 ((TH3S*)arr->At(3))->Fill(tht, dyz[1], rc);
a47a87c5 494
3ba3e0a4 495 Double_t dphi((phi-fTracklet->GetYfit(1))/(1-phi*fTracklet->GetYfit(1)));
496 Double_t dtht((tht-fTracklet->GetZfit(1))/(1-tht*fTracklet->GetZfit(1)));
497 ((TH2I*)arr->At(4))->Fill(phi, TMath::ATan(dphi));
dfd7d48b 498
499 if(DebugLevel()>=1){
500 UChar_t err(fTracklet->GetErrorMsg());
501 (*DebugStream()) << "tracklet"
3ba3e0a4 502 <<"pt=" << pt
503 <<"phi=" << phi
504 <<"tht=" << tht
505 <<"det=" << sgm[2]
506 <<"dy0=" << dy[0]
507 <<"dz0=" << dz[0]
dfd7d48b 508 <<"dy=" << dy[1]
509 <<"dz=" << dz[1]
510 <<"dphi="<< dphi
511 <<"dtht="<< dtht
512 <<"dyp=" << dyz[0]
513 <<"dzp=" << dyz[1]
514 <<"rc=" << rc
515 <<"err=" << err
516 << "\n";
517 }
1ee39b3a 518 }
519
520
521 return (TH2I*)arr->At(0);
522}
523
524
525//________________________________________________________
a310e49b 526TH1* AliTRDresolution::PlotTrackIn(const AliTRDtrackV1 *track)
1ee39b3a 527{
528// Store resolution/pulls of Kalman before updating with the TRD information
529// at the radial position of the first tracklet. The following points are used
530// for comparison
531// - the (y,z,snp) of the first TRD tracklet
532// - the (y, z, snp, tgl, pt) of the MC track reference
533//
534// Additionally the momentum resolution/pulls are calculated for usage in the
535// PID calculation.
536
537 if(track) fkTrack = track;
538 if(!fkTrack){
3d2a3dff 539 AliDebug(4, "No Track defined.");
b91fdd71 540 return NULL;
1ee39b3a 541 }
83b44483 542 TObjArray *arr = NULL;
543 if(!fContainer || !(arr = (TObjArray*)fContainer->At(kTrackIn))){
544 AliWarning("No output container defined.");
545 return NULL;
546 }
b91fdd71 547 AliExternalTrackParam *tin = NULL;
a310e49b 548 if(!(tin = fkTrack->GetTrackIn())){
1ee39b3a 549 AliWarning("Track did not entered TRD fiducial volume.");
b91fdd71 550 return NULL;
1ee39b3a 551 }
b91fdd71 552 TH1 *h = NULL;
1ee39b3a 553
554 Double_t x = tin->GetX();
6558fd69 555 AliTRDseedV1 *fTracklet = NULL;
1ee39b3a 556 for(Int_t ily=0; ily<AliTRDgeometry::kNlayer; ily++){
6558fd69 557 if(!(fTracklet = fkTrack->GetTracklet(ily))) continue;
1ee39b3a 558 break;
559 }
6558fd69 560 if(!fTracklet || TMath::Abs(x-fTracklet->GetX())>1.e-3){
a310e49b 561 AliWarning("Tracklet did not match Track.");
b91fdd71 562 return NULL;
1ee39b3a 563 }
3ba3e0a4 564 Int_t sgm[3];
565 sgm[2] = fTracklet->GetDetector();
566 sgm[0] = AliTRDgeometry::GetSector(sgm[2]);
567 sgm[1] = sgm[0] * AliTRDgeometry::kNstack + AliTRDgeometry::GetStack(sgm[2]);
6558fd69 568 Double_t tilt(fTracklet->GetTilt())
569 ,t2(tilt*tilt)
570 ,corr(1./(1. + t2))
571 ,cost(TMath::Sqrt(corr));
81979445 572 Bool_t rc(fTracklet->IsRowCross());
6558fd69 573
1ee39b3a 574 const Int_t kNPAR(5);
575 Double_t parR[kNPAR]; memcpy(parR, tin->GetParameter(), kNPAR*sizeof(Double_t));
576 Double_t covR[3*kNPAR]; memcpy(covR, tin->GetCovariance(), 3*kNPAR*sizeof(Double_t));
6558fd69 577 Double_t cov[3]; fTracklet->GetCovAt(x, cov);
1ee39b3a 578
579 // define sum covariances
580 TMatrixDSym COV(kNPAR); TVectorD PAR(kNPAR);
581 Double_t *pc = &covR[0], *pp = &parR[0];
582 for(Int_t ir=0; ir<kNPAR; ir++, pp++){
583 PAR(ir) = (*pp);
584 for(Int_t ic = 0; ic<=ir; ic++,pc++){
585 COV(ir,ic) = (*pc); COV(ic,ir) = (*pc);
586 }
587 }
588 PAR[4] = TMath::Abs(PAR[4]); // remove sign of pt !!
589 //COV.Print(); PAR.Print();
590
591 //TODO Double_t dydx = TMath::Sqrt(1.-parR[2]*parR[2])/parR[2];
553528eb 592 Double_t dy[2]={parR[0] - fTracklet->GetY(), 0.}
593 ,dz[2]={parR[1] - fTracklet->GetZ(), 0.}
6558fd69 594 ,dphi(TMath::ASin(PAR[2])-TMath::ATan(fTracklet->GetYfit(1)));
595 // calculate residuals using tilt rotation
596 dy[1] = cost*(dy[0] - dz[0]*tilt);
597 dz[1] = cost*(dz[0] + dy[0]*tilt);
598
2589cf64 599 if(1./PAR[4]>fPtThreshold) ((TH3S*)arr->At(0))->Fill(fTracklet->GetYref(1), dy[1], sgm[fSegmentLevel]+rc*fgkNresYsegm[fSegmentLevel]);
81979445 600 ((TH3S*)arr->At(2))->Fill(fTracklet->GetZref(1), dz[1], rc);
6558fd69 601 ((TH2I*)arr->At(4))->Fill(fTracklet->GetYref(1), dphi);
602
553528eb 603 Double_t dyz[2] = {dy[1], dz[1]};
604 Double_t cc[3] = {COV(0,0)+cov[0], COV(0,1)+cov[1], COV(1,1)+cov[2]};
605 Pulls(dyz, cc, tilt);
2589cf64 606 ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], dyz[0], dyz[1]);
81979445 607 ((TH3S*)arr->At(3))->Fill(fTracklet->GetZref(1), dyz[1], rc);
6558fd69 608
1ee39b3a 609
610
611 // register reference histo for mini-task
612 h = (TH2I*)arr->At(0);
613
3ba3e0a4 614 if(DebugLevel()>=2){
1ee39b3a 615 (*DebugStream()) << "trackIn"
616 << "x=" << x
617 << "P=" << &PAR
618 << "C=" << &COV
619 << "\n";
620
6558fd69 621 Double_t y = fTracklet->GetY();
622 Double_t z = fTracklet->GetZ();
1ee39b3a 623 (*DebugStream()) << "trackletIn"
624 << "y=" << y
625 << "z=" << z
626 << "Vy=" << cov[0]
627 << "Cyz=" << cov[1]
628 << "Vz=" << cov[2]
629 << "\n";
630 }
631
632
633 if(!HasMCdata()) return h;
634 UChar_t s;
6558fd69 635 Float_t dx, pt0, x0=fTracklet->GetX0(), y0, z0, dydx0, dzdx0;
1ee39b3a 636 if(!fkMC->GetDirections(x0, y0, z0, dydx0, dzdx0, pt0, s)) return h;
92c40e64 637 Int_t pdg = fkMC->GetPDG(),
638 sIdx(AliTRDpidUtil::Pdg2Pid(TMath::Abs(pdg))+1), // species index
639 sign(0);
640 if(!fDBPDG) fDBPDG=TDatabasePDG::Instance();
641 TParticlePDG *ppdg(fDBPDG->GetParticle(pdg));
642 if(ppdg) sign = ppdg->Charge() > 0. ? 1 : -1;
643
1ee39b3a 644 // translate to reference radial position
645 dx = x0 - x; y0 -= dx*dydx0; z0 -= dx*dzdx0;
646 Float_t norm = 1./TMath::Sqrt(1.+dydx0*dydx0); // 1/sqrt(1+tg^2(phi))
647 //Fill MC info
648 TVectorD PARMC(kNPAR);
649 PARMC[0]=y0; PARMC[1]=z0;
650 PARMC[2]=dydx0*norm; PARMC[3]=dzdx0*norm;
651 PARMC[4]=1./pt0;
652
653// TMatrixDSymEigen eigen(COV);
654// TVectorD evals = eigen.GetEigenValues();
655// TMatrixDSym evalsm(kNPAR);
656// for(Int_t ir=0; ir<kNPAR; ir++) for(Int_t ic=0; ic<kNPAR; ic++) evalsm(ir,ic) = (ir==ic ? evals(ir): 0.);
657// TMatrixD evecs = eigen.GetEigenVectors();
658// TMatrixD sqrcov(evecs, TMatrixD::kMult, TMatrixD(evalsm, TMatrixD::kMult, evecs.T()));
659
660 // fill histos
83b44483 661 if(!(arr = (TObjArray*)fContainer->At(kMCtrackIn))) {
662 AliWarning("No MC container defined.");
663 return h;
664 }
665
1ee39b3a 666 // y resolution/pulls
2589cf64 667 if(pt0>fPtThreshold) ((TH3S*)arr->At(0))->Fill(dydx0, PARMC[0]-PAR[0], sgm[fSegmentLevel]);
668 ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], (PARMC[0]-PAR[0])/TMath::Sqrt(COV(0,0)), (PARMC[1]-PAR[1])/TMath::Sqrt(COV(1,1)));
1ee39b3a 669 // z resolution/pulls
81979445 670 ((TH3S*)arr->At(2))->Fill(dzdx0, PARMC[1]-PAR[1], 0);
671 ((TH3S*)arr->At(3))->Fill(dzdx0, (PARMC[1]-PAR[1])/TMath::Sqrt(COV(1,1)), 0);
1ee39b3a 672 // phi resolution/snp pulls
673 ((TH2I*)arr->At(4))->Fill(dydx0, TMath::ASin(PARMC[2])-TMath::ASin(PAR[2]));
674 ((TH2I*)arr->At(5))->Fill(dydx0, (PARMC[2]-PAR[2])/TMath::Sqrt(COV(2,2)));
675 // theta resolution/tgl pulls
676 ((TH2I*)arr->At(6))->Fill(dzdx0, TMath::ATan((PARMC[3]-PAR[3])/(1-PARMC[3]*PAR[3])));
677 ((TH2I*)arr->At(7))->Fill(dzdx0, (PARMC[3]-PAR[3])/TMath::Sqrt(COV(3,3)));
678 // pt resolution\\1/pt pulls\\p resolution/pull
92c40e64 679 ((TH3S*)arr->At(8))->Fill(pt0, PARMC[4]/PAR[4]-1., sign*sIdx);
680 ((TH3S*)arr->At(9))->Fill(PARMC[4], (PARMC[4]-PAR[4])/TMath::Sqrt(COV(4,4)), sign*sIdx);
681
682 Double_t p0 = TMath::Sqrt(1.+ PARMC[3]*PARMC[3])*pt0, p;
4226db3e 683 p = TMath::Sqrt(1.+ PAR[3]*PAR[3])/PAR[4];
92c40e64 684 ((TH3S*)arr->At(10))->Fill(p0, p/p0-1., sign*sIdx);
afca20ef 685// Float_t sp =
686// p*p*PAR[4]*PAR[4]*COV(4,4)
687// +2.*PAR[3]*COV(3,4)/PAR[4]
688// +PAR[3]*PAR[3]*COV(3,3)/p/p/PAR[4]/PAR[4]/PAR[4]/PAR[4];
689// if(sp>0.) ((TH3S*)arr->At(11))->Fill(p0, (p0-p)/TMath::Sqrt(sp), sign*sIdx);
1ee39b3a 690
691 // fill debug for MC
3ba3e0a4 692 if(DebugLevel()>=3){
1ee39b3a 693 (*DebugStream()) << "trackInMC"
694 << "P=" << &PARMC
695 << "\n";
696 }
697 return h;
698}
699
a310e49b 700//________________________________________________________
701TH1* AliTRDresolution::PlotTrackOut(const AliTRDtrackV1 *track)
702{
703// Store resolution/pulls of Kalman after last update with the TRD information
704// at the radial position of the first tracklet. The following points are used
705// for comparison
706// - the (y,z,snp) of the first TRD tracklet
707// - the (y, z, snp, tgl, pt) of the MC track reference
708//
709// Additionally the momentum resolution/pulls are calculated for usage in the
710// PID calculation.
711
712 if(track) fkTrack = track;
713 if(!fkTrack){
714 AliDebug(4, "No Track defined.");
715 return NULL;
716 }
83b44483 717 TObjArray *arr = NULL;
718 if(!fContainer || !(arr = (TObjArray*)fContainer->At(kTrackOut))){
719 AliWarning("No output container defined.");
720 return NULL;
721 }
a310e49b 722 AliExternalTrackParam *tout = NULL;
723 if(!(tout = fkTrack->GetTrackOut())){
e9d62bd2 724 AliDebug(2, "Track did not exit TRD.");
a310e49b 725 return NULL;
726 }
727 TH1 *h(NULL);
728
729 Double_t x = tout->GetX();
6558fd69 730 AliTRDseedV1 *fTracklet(NULL);
a310e49b 731 for(Int_t ily=0; ily<AliTRDgeometry::kNlayer; ily++){
6558fd69 732 if(!(fTracklet = fkTrack->GetTracklet(ily))) continue;
a310e49b 733 break;
734 }
6558fd69 735 if(!fTracklet || TMath::Abs(x-fTracklet->GetX())>1.e-3){
a310e49b 736 AliWarning("Tracklet did not match Track position.");
737 return NULL;
738 }
3ba3e0a4 739 Int_t sgm[3];
740 sgm[2] = fTracklet->GetDetector();
741 sgm[0] = AliTRDgeometry::GetSector(sgm[2]);
742 sgm[1] = sgm[0] * AliTRDgeometry::kNstack + AliTRDgeometry::GetStack(sgm[2]);
6558fd69 743 Double_t tilt(fTracklet->GetTilt())
744 ,t2(tilt*tilt)
745 ,corr(1./(1. + t2))
746 ,cost(TMath::Sqrt(corr));
81979445 747 Bool_t rc(fTracklet->IsRowCross());
6558fd69 748
a310e49b 749 const Int_t kNPAR(5);
750 Double_t parR[kNPAR]; memcpy(parR, tout->GetParameter(), kNPAR*sizeof(Double_t));
751 Double_t covR[3*kNPAR]; memcpy(covR, tout->GetCovariance(), 3*kNPAR*sizeof(Double_t));
6558fd69 752 Double_t cov[3]; fTracklet->GetCovAt(x, cov);
a310e49b 753
754 // define sum covariances
755 TMatrixDSym COV(kNPAR); TVectorD PAR(kNPAR);
756 Double_t *pc = &covR[0], *pp = &parR[0];
757 for(Int_t ir=0; ir<kNPAR; ir++, pp++){
758 PAR(ir) = (*pp);
759 for(Int_t ic = 0; ic<=ir; ic++,pc++){
760 COV(ir,ic) = (*pc); COV(ic,ir) = (*pc);
761 }
762 }
763 PAR[4] = TMath::Abs(PAR[4]); // remove sign of pt !!
764 //COV.Print(); PAR.Print();
765
766 //TODO Double_t dydx = TMath::Sqrt(1.-parR[2]*parR[2])/parR[2];
6558fd69 767 Double_t dy[3]={parR[0] - fTracklet->GetY(), 0., 0.}
768 ,dz[3]={parR[1] - fTracklet->GetZ(), 0., 0.}
769 ,dphi(TMath::ASin(PAR[2])-TMath::ATan(fTracklet->GetYfit(1)));
770 // calculate residuals using tilt rotation
771 dy[1] = cost*(dy[0] - dz[0]*tilt);
772 dz[1] = cost*(dz[0] + dy[0]*tilt);
6558fd69 773
2589cf64 774 if(1./PAR[4]>fPtThreshold) ((TH3S*)arr->At(0))->Fill(fTracklet->GetYref(1), 1.e2*dy[1], sgm[fSegmentLevel]+rc*fgkNresYsegm[fSegmentLevel]); // scale to fit general residual range !!!
81979445 775 ((TH3S*)arr->At(2))->Fill(fTracklet->GetZref(1), dz[1], rc);
6558fd69 776 ((TH2I*)arr->At(4))->Fill(fTracklet->GetYref(1), dphi);
777
553528eb 778 Double_t dyz[2] = {dy[1], dz[1]};
779 Double_t cc[3] = {COV(0,0)+cov[0], COV(0,1)+cov[1], COV(1,1)+cov[2]};
780 Pulls(dyz, cc, tilt);
2589cf64 781 ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], dyz[0], dyz[1]);
81979445 782 ((TH3S*)arr->At(3))->Fill(fTracklet->GetZref(1), dyz[1], rc);
a310e49b 783
784 // register reference histo for mini-task
785 h = (TH2I*)arr->At(0);
786
3ba3e0a4 787 if(DebugLevel()>=2){
a310e49b 788 (*DebugStream()) << "trackOut"
789 << "x=" << x
790 << "P=" << &PAR
791 << "C=" << &COV
792 << "\n";
793
6558fd69 794 Double_t y = fTracklet->GetY();
795 Double_t z = fTracklet->GetZ();
a310e49b 796 (*DebugStream()) << "trackletOut"
797 << "y=" << y
798 << "z=" << z
799 << "Vy=" << cov[0]
800 << "Cyz=" << cov[1]
801 << "Vz=" << cov[2]
802 << "\n";
803 }
804
805
806 if(!HasMCdata()) return h;
807 UChar_t s;
6558fd69 808 Float_t dx, pt0, x0=fTracklet->GetX0(), y0, z0, dydx0, dzdx0;
a310e49b 809 if(!fkMC->GetDirections(x0, y0, z0, dydx0, dzdx0, pt0, s)) return h;
810 Int_t pdg = fkMC->GetPDG(),
811 sIdx(AliTRDpidUtil::Pdg2Pid(TMath::Abs(pdg))+1), // species index
812 sign(0);
813 if(!fDBPDG) fDBPDG=TDatabasePDG::Instance();
814 TParticlePDG *ppdg(fDBPDG->GetParticle(pdg));
815 if(ppdg) sign = ppdg->Charge() > 0. ? 1 : -1;
816
817 // translate to reference radial position
818 dx = x0 - x; y0 -= dx*dydx0; z0 -= dx*dzdx0;
819 Float_t norm = 1./TMath::Sqrt(1.+dydx0*dydx0); // 1/sqrt(1+tg^2(phi))
820 //Fill MC info
821 TVectorD PARMC(kNPAR);
822 PARMC[0]=y0; PARMC[1]=z0;
823 PARMC[2]=dydx0*norm; PARMC[3]=dzdx0*norm;
824 PARMC[4]=1./pt0;
825
826// TMatrixDSymEigen eigen(COV);
827// TVectorD evals = eigen.GetEigenValues();
828// TMatrixDSym evalsm(kNPAR);
829// for(Int_t ir=0; ir<kNPAR; ir++) for(Int_t ic=0; ic<kNPAR; ic++) evalsm(ir,ic) = (ir==ic ? evals(ir): 0.);
830// TMatrixD evecs = eigen.GetEigenVectors();
831// TMatrixD sqrcov(evecs, TMatrixD::kMult, TMatrixD(evalsm, TMatrixD::kMult, evecs.T()));
832
833 // fill histos
83b44483 834 if(!(arr = (TObjArray*)fContainer->At(kMCtrackOut))){
835 AliWarning("No MC container defined.");
836 return h;
837 }
a310e49b 838 // y resolution/pulls
2589cf64 839 if(pt0>fPtThreshold) ((TH3S*)arr->At(0))->Fill(dydx0, PARMC[0]-PAR[0], sgm[fSegmentLevel]);
840 ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], (PARMC[0]-PAR[0])/TMath::Sqrt(COV(0,0)), (PARMC[1]-PAR[1])/TMath::Sqrt(COV(1,1)));
a310e49b 841 // z resolution/pulls
81979445 842 ((TH3S*)arr->At(2))->Fill(dzdx0, PARMC[1]-PAR[1], 0);
843 ((TH3S*)arr->At(3))->Fill(dzdx0, (PARMC[1]-PAR[1])/TMath::Sqrt(COV(1,1)), 0);
a310e49b 844 // phi resolution/snp pulls
845 ((TH2I*)arr->At(4))->Fill(dydx0, TMath::ASin(PARMC[2])-TMath::ASin(PAR[2]));
846 ((TH2I*)arr->At(5))->Fill(dydx0, (PARMC[2]-PAR[2])/TMath::Sqrt(COV(2,2)));
847 // theta resolution/tgl pulls
848 ((TH2I*)arr->At(6))->Fill(dzdx0, TMath::ATan((PARMC[3]-PAR[3])/(1-PARMC[3]*PAR[3])));
849 ((TH2I*)arr->At(7))->Fill(dzdx0, (PARMC[3]-PAR[3])/TMath::Sqrt(COV(3,3)));
850 // pt resolution\\1/pt pulls\\p resolution/pull
851 ((TH3S*)arr->At(8))->Fill(pt0, PARMC[4]/PAR[4]-1., sign*sIdx);
852 ((TH3S*)arr->At(9))->Fill(PARMC[4], (PARMC[4]-PAR[4])/TMath::Sqrt(COV(4,4)), sign*sIdx);
853
854 Double_t p0 = TMath::Sqrt(1.+ PARMC[3]*PARMC[3])*pt0, p;
855 p = TMath::Sqrt(1.+ PAR[3]*PAR[3])/PAR[4];
856 ((TH3S*)arr->At(10))->Fill(p0, p/p0-1., sign*sIdx);
857// Float_t sp =
858// p*p*PAR[4]*PAR[4]*COV(4,4)
859// +2.*PAR[3]*COV(3,4)/PAR[4]
860// +PAR[3]*PAR[3]*COV(3,3)/p/p/PAR[4]/PAR[4]/PAR[4]/PAR[4];
861// if(sp>0.) ((TH3S*)arr->At(11))->Fill(p0, (p0-p)/TMath::Sqrt(sp), sign*sIdx);
862
863 // fill debug for MC
3ba3e0a4 864 if(DebugLevel()>=3){
a310e49b 865 (*DebugStream()) << "trackOutMC"
866 << "P=" << &PARMC
867 << "\n";
868 }
869 return h;
870}
871
1ee39b3a 872//________________________________________________________
873TH1* AliTRDresolution::PlotMC(const AliTRDtrackV1 *track)
874{
875 //
876 // Plot MC distributions
877 //
878
879 if(!HasMCdata()){
e9d62bd2 880 AliDebug(2, "No MC defined. Results will not be available.");
b91fdd71 881 return NULL;
1ee39b3a 882 }
883 if(track) fkTrack = track;
884 if(!fkTrack){
3d2a3dff 885 AliDebug(4, "No Track defined.");
b91fdd71 886 return NULL;
1ee39b3a 887 }
83b44483 888 if(!fContainer){
889 AliWarning("No output container defined.");
890 return NULL;
891 }
92c40e64 892 // retriev track characteristics
893 Int_t pdg = fkMC->GetPDG(),
894 sIdx(AliTRDpidUtil::Pdg2Pid(TMath::Abs(pdg))+1), // species index
895 sign(0),
3ba3e0a4 896 sgm[3],
92c40e64 897 label(fkMC->GetLabel());
898 if(!fDBPDG) fDBPDG=TDatabasePDG::Instance();
899 TParticlePDG *ppdg(fDBPDG->GetParticle(pdg));
900 if(ppdg) sign = ppdg->Charge() > 0. ? 1 : -1;
92c40e64 901
902 TObjArray *arr(NULL);TH1 *h(NULL);
1ee39b3a 903 UChar_t s;
1ee39b3a 904 Double_t xAnode, x, y, z, pt, dydx, dzdx, dzdl;
905 Float_t pt0, x0, y0, z0, dx, dy, dz, dydx0, dzdx0;
906 Double_t covR[7]/*, cov[3]*/;
907
3ba3e0a4 908 if(DebugLevel()>=3){
5066aa9a 909 TVectorD dX(12), dY(12), dZ(12), Pt(12), dPt(12), cCOV(12*15);
910 fkMC->PropagateKalman(&dX, &dY, &dZ, &Pt, &dPt, &cCOV);
1ee39b3a 911 (*DebugStream()) << "MCkalman"
4226db3e 912 << "pdg=" << pdg
913 << "dx=" << &dX
914 << "dy=" << &dY
915 << "dz=" << &dZ
5066aa9a 916 << "pt=" << &Pt
4226db3e 917 << "dpt=" << &dPt
918 << "cov=" << &cCOV
1ee39b3a 919 << "\n";
920 }
921
922 AliTRDReconstructor rec;
d43e2ad1 923 AliTRDseedV1 *fTracklet(NULL); TObjArray *clInfoArr(NULL);
1ee39b3a 924 for(Int_t ily=0; ily<AliTRDgeometry::kNlayer; ily++){
925 if(!(fTracklet = fkTrack->GetTracklet(ily)))/* ||
926 !fTracklet->IsOK())*/ continue;
927
3ba3e0a4 928 sgm[2] = fTracklet->GetDetector();
929 sgm[0] = AliTRDgeometry::GetSector(sgm[2]);
930 sgm[1] = sgm[0] * AliTRDgeometry::kNstack + AliTRDgeometry::GetStack(sgm[2]);
6558fd69 931 Double_t tilt(fTracklet->GetTilt())
932 ,t2(tilt*tilt)
933 ,corr(1./(1. + t2))
934 ,cost(TMath::Sqrt(corr));
1ee39b3a 935 x0 = fTracklet->GetX0();
936 //radial shift with respect to the MC reference (radial position of the pad plane)
937 x= fTracklet->GetX();
81979445 938 Bool_t rc(fTracklet->IsRowCross());
1ee39b3a 939 if(!fkMC->GetDirections(x0, y0, z0, dydx0, dzdx0, pt0, s)) continue;
940 xAnode = fTracklet->GetX0();
941
942 // MC track position at reference radial position
943 dx = x0 - x;
3ba3e0a4 944 if(DebugLevel()>=4){
1ee39b3a 945 (*DebugStream()) << "MC"
3ba3e0a4 946 << "det=" << sgm[2]
1ee39b3a 947 << "pdg=" << pdg
92c40e64 948 << "sgn=" << sign
1ee39b3a 949 << "pt=" << pt0
950 << "x=" << x0
951 << "y=" << y0
952 << "z=" << z0
953 << "dydx=" << dydx0
954 << "dzdx=" << dzdx0
955 << "\n";
956 }
957 Float_t ymc = y0 - dx*dydx0;
958 Float_t zmc = z0 - dx*dzdx0;
959 //p = pt0*TMath::Sqrt(1.+dzdx0*dzdx0); // pt -> p
960
961 // Kalman position at reference radial position
962 dx = xAnode - x;
963 dydx = fTracklet->GetYref(1);
964 dzdx = fTracklet->GetZref(1);
965 dzdl = fTracklet->GetTgl();
966 y = fTracklet->GetYref(0) - dx*dydx;
967 dy = y - ymc;
968 z = fTracklet->GetZref(0) - dx*dzdx;
969 dz = z - zmc;
970 pt = TMath::Abs(fTracklet->GetPt());
971 fTracklet->GetCovRef(covR);
972
92d6d80c 973 arr = (TObjArray*)((TObjArray*)fContainer->At(kMCtrack))->At(ily);
1ee39b3a 974 // y resolution/pulls
2589cf64 975 if(pt0>fPtThreshold) ((TH3S*)arr->At(0))->Fill(dydx0, dy, sgm[fSegmentLevel]);
976 ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], dy/TMath::Sqrt(covR[0]), dz/TMath::Sqrt(covR[2]));
1ee39b3a 977 // z resolution/pulls
81979445 978 ((TH3S*)arr->At(2))->Fill(dzdx0, dz, 0);
979 ((TH3S*)arr->At(3))->Fill(dzdx0, dz/TMath::Sqrt(covR[2]), 0);
1ee39b3a 980 // phi resolution/ snp pulls
981 Double_t dtgp = (dydx - dydx0)/(1.- dydx*dydx0);
982 ((TH2I*)arr->At(4))->Fill(dydx0, TMath::ATan(dtgp));
983 Double_t dsnp = dydx/TMath::Sqrt(1.+dydx*dydx) - dydx0/TMath::Sqrt(1.+dydx0*dydx0);
984 ((TH2I*)arr->At(5))->Fill(dydx0, dsnp/TMath::Sqrt(covR[3]));
985 // theta resolution/ tgl pulls
986 Double_t dzdl0 = dzdx0/TMath::Sqrt(1.+dydx0*dydx0),
987 dtgl = (dzdl - dzdl0)/(1.- dzdl*dzdl0);
988 ((TH2I*)arr->At(6))->Fill(dzdl0,
989 TMath::ATan(dtgl));
990 ((TH2I*)arr->At(7))->Fill(dzdl0, (dzdl - dzdl0)/TMath::Sqrt(covR[4]));
991 // pt resolution \\ 1/pt pulls \\ p resolution for PID
92c40e64 992 Double_t p0 = TMath::Sqrt(1.+ dzdl0*dzdl0)*pt0,
993 p = TMath::Sqrt(1.+ dzdl*dzdl)*pt;
afca20ef 994 ((TH3S*)((TObjArray*)arr->At(8)))->Fill(pt0, pt/pt0-1., sign*sIdx);
995 ((TH3S*)((TObjArray*)arr->At(9)))->Fill(1./pt0, (1./pt-1./pt0)/TMath::Sqrt(covR[6]), sign*sIdx);
996 ((TH3S*)((TObjArray*)arr->At(10)))->Fill(p0, p/p0-1., sign*sIdx);
1ee39b3a 997
998 // Fill Debug stream for Kalman track
3ba3e0a4 999 if(DebugLevel()>=4){
1ee39b3a 1000 (*DebugStream()) << "MCtrack"
1001 << "pt=" << pt
1002 << "x=" << x
1003 << "y=" << y
1004 << "z=" << z
1005 << "dydx=" << dydx
1006 << "dzdx=" << dzdx
1007 << "s2y=" << covR[0]
1008 << "s2z=" << covR[2]
1009 << "\n";
1010 }
1011
1012 // recalculate tracklet based on the MC info
1013 AliTRDseedV1 tt(*fTracklet);
1014 tt.SetZref(0, z0 - (x0-xAnode)*dzdx0);
1015 tt.SetZref(1, dzdx0);
1016 tt.SetReconstructor(&rec);
26e4e234 1017 tt.Fit(1);
1ee39b3a 1018 x= tt.GetX();y= tt.GetY();z= tt.GetZ();
1019 dydx = tt.GetYfit(1);
1020 dx = x0 - x;
1021 ymc = y0 - dx*dydx0;
1022 zmc = z0 - dx*dzdx0;
6558fd69 1023 dy = y-ymc;
1024 dz = z-zmc;
81979445 1025 Float_t dphi = (dydx - dydx0);
1026 dphi /= (1.- dydx*dydx0);
6558fd69 1027
1ee39b3a 1028 // add tracklet residuals for y and dydx
1029 arr = (TObjArray*)fContainer->At(kMCtracklet);
81979445 1030
2589cf64 1031 if(pt0>fPtThreshold) ((TH3S*)arr->At(0))->Fill(dydx0, dy, sgm[fSegmentLevel]);
1032 if(tt.GetS2Y()>0. && tt.GetS2Z()>0.) ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], dy/TMath::Sqrt(tt.GetS2Y()), dz/TMath::Sqrt(tt.GetS2Z()));
81979445 1033 ((TH3S*)arr->At(2))->Fill(dzdl0, dz, rc);
1034 if(tt.GetS2Z()>0.) ((TH3S*)arr->At(3))->Fill(dzdl0, dz/TMath::Sqrt(tt.GetS2Z()), rc);
1035 ((TH2I*)arr->At(4))->Fill(dydx0, TMath::ATan(dphi));
1ee39b3a 1036
1037 // Fill Debug stream for tracklet
3ba3e0a4 1038 if(DebugLevel()>=4){
1ee39b3a 1039 Float_t s2y = tt.GetS2Y();
1040 Float_t s2z = tt.GetS2Z();
1041 (*DebugStream()) << "MCtracklet"
1042 << "rc=" << rc
1043 << "x=" << x
1044 << "y=" << y
1045 << "z=" << z
1046 << "dydx=" << dydx
1047 << "s2y=" << s2y
1048 << "s2z=" << s2z
1049 << "\n";
1050 }
1051
3ba3e0a4 1052 AliTRDpadPlane *pp = fGeo->GetPadPlane(ily, AliTRDgeometry::GetStack(sgm[2]));
1ee39b3a 1053 Float_t zr0 = pp->GetRow0() + pp->GetAnodeWireOffset();
1ee39b3a 1054 //Double_t exb = AliTRDCommonParam::Instance()->GetOmegaTau(1.5);
1055
1056 arr = (TObjArray*)fContainer->At(kMCcluster);
b91fdd71 1057 AliTRDcluster *c = NULL;
83b44483 1058 tt.ResetClusterIter(kFALSE);
1059 while((c = tt.PrevCluster())){
1ee39b3a 1060 Float_t q = TMath::Abs(c->GetQ());
1061 x = c->GetX(); y = c->GetY();z = c->GetZ();
1062 dx = x0 - x;
1063 ymc= y0 - dx*dydx0;
1064 zmc= z0 - dx*dzdx0;
6558fd69 1065 dy = cost*(y - ymc - tilt*(z-zmc));
1066 dz = cost*(z - zmc + tilt*(y-ymc));
1067
1ee39b3a 1068 // Fill Histograms
83b44483 1069 if(q>20. && q<250. && pt0>fPtThreshold && c->IsInChamber()){
2589cf64 1070 ((TH3S*)arr->At(0))->Fill(dydx0, dy, sgm[fSegmentLevel]);
1071 ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], dy/TMath::Sqrt(c->GetSigmaY2()), dz/TMath::Sqrt(c->GetSigmaZ2()));
1ee39b3a 1072 }
1073
1074 // Fill calibration container
1075 Float_t d = zr0 - zmc;
1076 d -= ((Int_t)(2 * d)) / 2.0;
1077 if (d > 0.25) d = 0.5 - d;
1078 AliTRDclusterInfo *clInfo = new AliTRDclusterInfo;
1ee39b3a 1079 clInfo->SetCluster(c);
1080 clInfo->SetMC(pdg, label);
1081 clInfo->SetGlobalPosition(ymc, zmc, dydx0, dzdx0);
1082 clInfo->SetResolution(dy);
1083 clInfo->SetAnisochronity(d);
2589cf64 1084 clInfo->SetDriftLength(dx);
1ee39b3a 1085 clInfo->SetTilt(tilt);
83b44483 1086 if(fMCcl) fMCcl->Add(clInfo);
1087 else AliDebug(1, "MCcl exchange container missing. Activate by calling \"InitExchangeContainers()\"");
3ba3e0a4 1088 if(DebugLevel()>=5){
d14a8ac2 1089 if(!clInfoArr){
1090 clInfoArr=new TObjArray(AliTRDseedV1::kNclusters);
1091 clInfoArr->SetOwner(kFALSE);
1092 }
d43e2ad1 1093 clInfoArr->Add(clInfo);
1ee39b3a 1094 }
1095 }
d43e2ad1 1096 // Fill Debug Tree
3ba3e0a4 1097 if(DebugLevel()>=5 && clInfoArr){
d43e2ad1 1098 (*DebugStream()) << "MCcluster"
1099 <<"clInfo.=" << clInfoArr
1100 << "\n";
92c40e64 1101 clInfoArr->Clear();
d43e2ad1 1102 }
1ee39b3a 1103 }
92c40e64 1104 if(clInfoArr) delete clInfoArr;
1ee39b3a 1105 return h;
1106}
1107
1108
1109//________________________________________________________
1110Bool_t AliTRDresolution::GetRefFigure(Int_t ifig)
1111{
1112 //
1113 // Get the reference figures
1114 //
1115
1116 Float_t xy[4] = {0., 0., 0., 0.};
1117 if(!gPad){
1118 AliWarning("Please provide a canvas to draw results.");
1119 return kFALSE;
1120 }
041d572e 1121 Int_t selection[100], n(0), selStart(0); //
a310e49b 1122 Int_t ly0(0), dly(5);
1123 //Int_t ly0(1), dly(2); // used for SA
92d6d80c 1124 TList *l(NULL); TVirtualPad *pad(NULL);
1125 TGraphErrors *g(NULL);TGraphAsymmErrors *ga(NULL);
1ee39b3a 1126 switch(ifig){
a310e49b 1127 case 0: // charge resolution
1ee39b3a 1128 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1129 ((TVirtualPad*)l->At(0))->cd();
92d6d80c 1130 ga=((TGraphAsymmErrors*)((TObjArray*)fGraphM->At(kCharge))->At(0));
1131 if(ga->GetN()) ga->Draw("apl");
1ee39b3a 1132 ((TVirtualPad*)l->At(1))->cd();
92d6d80c 1133 g = ((TGraphErrors*)((TObjArray*)fGraphS->At(kCharge))->At(0));
1134 if(g->GetN()) g->Draw("apl");
1ee39b3a 1135 break;
a310e49b 1136 case 1: // cluster2track residuals
1ee39b3a 1137 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
6558fd69 1138 xy[0] = -.3; xy[1] = -100.; xy[2] = .3; xy[3] = 1000.;
a310e49b 1139 pad = (TVirtualPad*)l->At(0); pad->cd();
1140 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
2589cf64 1141 selStart=0; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
6558fd69 1142 if(!GetGraphArray(xy, kCluster, 0, 1, n, selection)) break;
1143 pad=(TVirtualPad*)l->At(1); pad->cd();
1144 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
2589cf64 1145 selStart=fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
6558fd69 1146 if(!GetGraphArray(xy, kCluster, 0, 1, n, selection)) break;
1147 return kTRUE;
1148 case 2: // cluster2track residuals
1149 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1150 xy[0] = -.3; xy[1] = -100.; xy[2] = .3; xy[3] = 1000.;
1151 pad = (TVirtualPad*)l->At(0); pad->cd();
1152 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
2589cf64 1153 selStart=2*fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
6558fd69 1154 if(!GetGraphArray(xy, kCluster, 0, 1, n, selection)) break;
2589cf64 1155 xy[0] = -.5; xy[1] = -0.5; xy[2] = fgkNresYsegm[fSegmentLevel]-0.5; xy[3] = 2.5;
a310e49b 1156 pad=(TVirtualPad*)l->At(1); pad->cd();
1157 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
81979445 1158 if(!GetGraphArray(xy, kCluster, 1, 1)) break;
1ee39b3a 1159 return kTRUE;
6558fd69 1160 case 3: // kTrack y
dfd7d48b 1161 gPad->Divide(3, 2, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
3ba3e0a4 1162 xy[0] = -.3; xy[1] = -20.; xy[2] = .3; xy[3] = 100.;
1ee39b3a 1163 ((TVirtualPad*)l->At(0))->cd();
2589cf64 1164 selStart=0; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
6558fd69 1165 if(!GetGraphArray(xy, kTrack, 0, 1, n, selection)) break;
dfd7d48b 1166
6558fd69 1167 ((TVirtualPad*)l->At(1))->cd();
2589cf64 1168 selStart=fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
6558fd69 1169 if(!GetGraphArray(xy, kTrack, 0, 1, n, selection)) break;
dfd7d48b 1170
1171 ((TVirtualPad*)l->At(2))->cd();
2589cf64 1172 selStart=2*fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
dfd7d48b 1173 if(!GetGraphArray(xy, kTrack, 0, 1, n, selection)) break;
1174
1175 ((TVirtualPad*)l->At(3))->cd();
2589cf64 1176 selStart=fgkNresYsegm[fSegmentLevel]; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
dfd7d48b 1177 if(!GetGraphArray(xy, kTrack, 0, 1, n, selection, "[RC]")) break;
1178
1179 ((TVirtualPad*)l->At(4))->cd();
2589cf64 1180 selStart=fgkNresYsegm[fSegmentLevel]/3+fgkNresYsegm[fSegmentLevel]; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
dfd7d48b 1181 if(!GetGraphArray(xy, kTrack, 0, 1, n, selection, "[RC]")) break;
1182
1183 ((TVirtualPad*)l->At(5))->cd();
2589cf64 1184 selStart=2*fgkNresYsegm[fSegmentLevel]/3+fgkNresYsegm[fSegmentLevel]; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
dfd7d48b 1185 if(!GetGraphArray(xy, kTrack, 0, 1, n, selection, "[RC]")) break;
6558fd69 1186 return kTRUE;
dfd7d48b 1187 case 4: // kTrack z
6558fd69 1188 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
dfd7d48b 1189
1190 xy[0] = -1.; xy[1] = -150.; xy[2] = 1.; xy[3] = 1000.;
6558fd69 1191 ((TVirtualPad*)l->At(0))->cd();
dfd7d48b 1192 selection[0]=1;
1193 if(!GetGraphArray(xy, kTrack, 2, 1, 1, selection)) break;
1194
1195 xy[0] = -1.; xy[1] = -1500.; xy[2] = 1.; xy[3] = 10000.;
1ee39b3a 1196 ((TVirtualPad*)l->At(1))->cd();
dfd7d48b 1197 selection[0]=0;
1198 if(!GetGraphArray(xy, kTrack, 2, 1, 1, selection)) break;
1199
1ee39b3a 1200 return kTRUE;
dfd7d48b 1201 case 5: // kTrack pulls
1ee39b3a 1202 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
dfd7d48b 1203
2589cf64 1204 xy[0] = -.5; xy[1] = -0.5; xy[2] = fgkNresYsegm[fSegmentLevel]-.5; xy[3] = 2.5;
1ee39b3a 1205 ((TVirtualPad*)l->At(0))->cd();
dfd7d48b 1206 if(!GetGraphArray(xy, kTrack, 1, 1)) break;
1207
1ee39b3a 1208 xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 2.5;
1209 ((TVirtualPad*)l->At(1))->cd();
81979445 1210 if(!GetGraphArray(xy, kTrack, 3, 1)) break;
1ee39b3a 1211 return kTRUE;
6558fd69 1212 case 6: // kTrack phi
1ee39b3a 1213 xy[0] = -.3; xy[1] = -5.; xy[2] = .3; xy[3] = 50.;
a310e49b 1214 if(GetGraph(&xy[0], kTrack , 4)) return kTRUE;
1ee39b3a 1215 break;
6558fd69 1216 case 7: // kTrackIn y
1ee39b3a 1217 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
a310e49b 1218 xy[0] = -.3; xy[1] = -1500.; xy[2] = .3; xy[3] = 5000.;
1ee39b3a 1219 pad = ((TVirtualPad*)l->At(0)); pad->cd();
1220 pad->SetMargin(0.1, 0.1, 0.1, 0.01);
2589cf64 1221 selStart=0; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
6558fd69 1222 if(!GetGraphArray(xy, kTrackIn, 0, 1, n, selection)) break;
1223 pad=((TVirtualPad*)l->At(1)); pad->cd();
1224 pad->SetMargin(0.1, 0.1, 0.1, 0.01);
2589cf64 1225 selStart=fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
6558fd69 1226 if(!GetGraphArray(xy, kTrackIn, 0, 1, n, selection)) break;
1227 return kTRUE;
1228 case 8: // kTrackIn y
1229 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1230 xy[0] = -.3; xy[1] = -1500.; xy[2] = .3; xy[3] = 5000.;
1231 pad = ((TVirtualPad*)l->At(0)); pad->cd();
1232 pad->SetMargin(0.1, 0.1, 0.1, 0.01);
2589cf64 1233 selStart=2*fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
6558fd69 1234 if(!GetGraphArray(xy, kTrackIn, 0, 1, n, selection)) break;
2589cf64 1235 xy[0] = -.5; xy[1] = -0.5; xy[2] = fgkNresYsegm[fSegmentLevel]-.5; xy[3] = 2.5;
1ee39b3a 1236 pad=((TVirtualPad*)l->At(1)); pad->cd();
1237 pad->SetMargin(0.1, 0.1, 0.1, 0.01);
81979445 1238 if(!GetGraphArray(xy, kTrackIn, 1, 1)) break;
1ee39b3a 1239 return kTRUE;
6558fd69 1240 case 9: // kTrackIn z
1ee39b3a 1241 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1242 xy[0] = -1.; xy[1] = -1000.; xy[2] = 1.; xy[3] = 4000.;
1243 pad = ((TVirtualPad*)l->At(0)); pad->cd();
1244 pad->SetMargin(0.1, 0.1, 0.1, 0.01);
dfd7d48b 1245 selection[0]=1;
1246 if(!GetGraphArray(xy, kTrackIn, 2, 1, 1, selection)) break;
1ee39b3a 1247 xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 2.5;
1248 pad = ((TVirtualPad*)l->At(1)); pad->cd();
1249 pad->SetMargin(0.1, 0.1, 0.1, 0.01);
81979445 1250 if(!GetGraphArray(xy, kTrackIn, 3, 1)) break;
1ee39b3a 1251 return kTRUE;
6558fd69 1252 case 10: // kTrackIn phi
1ee39b3a 1253 xy[0] = -.3; xy[1] = -5.; xy[2] = .3; xy[3] = 50.;
a310e49b 1254 if(GetGraph(&xy[0], kTrackIn, 4)) return kTRUE;
1255 break;
6558fd69 1256 case 11: // kTrackOut y
1257 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1258 xy[0] = -.3; xy[1] = -50.; xy[2] = .3; xy[3] = 150.;
1259 pad = ((TVirtualPad*)l->At(0)); pad->cd();
1260 pad->SetMargin(0.1, 0.1, 0.1, 0.01);
2589cf64 1261 selStart=0; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
6558fd69 1262 if(!GetGraphArray(xy, kTrackOut, 0, 1, n, selection)) break;
1263 pad=((TVirtualPad*)l->At(1)); pad->cd();
1264 pad->SetMargin(0.1, 0.1, 0.1, 0.01);
2589cf64 1265 selStart=fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
6558fd69 1266 if(!GetGraphArray(xy, kTrackOut, 0, 1, n, selection)) break;
1267 return kTRUE;
1268 case 12: // kTrackOut y
a310e49b 1269 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
6558fd69 1270 xy[0] = -.3; xy[1] = -50.; xy[2] = .3; xy[3] = 150.;
a310e49b 1271 pad = ((TVirtualPad*)l->At(0)); pad->cd();
1272 pad->SetMargin(0.1, 0.1, 0.1, 0.01);
2589cf64 1273 selStart=2*fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
6558fd69 1274 if(!GetGraphArray(xy, kTrackOut, 0, 1, n, selection)) break;
2589cf64 1275 xy[0] = -.5; xy[1] = -0.5; xy[2] = fgkNresYsegm[fSegmentLevel]-.5; xy[3] = 2.5;
a310e49b 1276 pad=((TVirtualPad*)l->At(1)); pad->cd();
1277 pad->SetMargin(0.1, 0.1, 0.1, 0.01);
81979445 1278 if(!GetGraphArray(xy, kTrackOut, 1, 1)) break;
a310e49b 1279 return kTRUE;
6558fd69 1280 case 13: // kTrackOut z
a310e49b 1281 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1282 xy[0] = -1.; xy[1] = -1000.; xy[2] = 1.; xy[3] = 4000.;
1283 pad = ((TVirtualPad*)l->At(0)); pad->cd();
1284 pad->SetMargin(0.1, 0.1, 0.1, 0.01);
81979445 1285 if(!GetGraphArray(xy, kTrackOut, 2, 1)) break;
a310e49b 1286 xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 2.5;
1287 pad = ((TVirtualPad*)l->At(1)); pad->cd();
1288 pad->SetMargin(0.1, 0.1, 0.1, 0.01);
81979445 1289 if(!GetGraphArray(xy, kTrackOut, 3, 1)) break;
a310e49b 1290 return kTRUE;
6558fd69 1291 case 14: // kTrackOut phi
a310e49b 1292 xy[0] = -.3; xy[1] = -5.; xy[2] = .3; xy[3] = 50.;
1293 if(GetGraph(&xy[0], kTrackOut, 4)) return kTRUE;
1ee39b3a 1294 break;
6558fd69 1295 case 15: // kMCcluster
92c40e64 1296 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1297 xy[0]=-.3; xy[1]=-50.; xy[2]=.3; xy[3]=650.;
1298 ((TVirtualPad*)l->At(0))->cd();
2589cf64 1299 selStart=0; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
6558fd69 1300 if(!GetGraphArray(xy, kMCcluster, 0, 1, n, selection)) break;
1301 ((TVirtualPad*)l->At(1))->cd();
2589cf64 1302 selStart=fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
6558fd69 1303 if(!GetGraphArray(xy, kMCcluster, 0, 1, n, selection)) break;
1304 return kTRUE;
1305 case 16: // kMCcluster
1306 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1307 xy[0]=-.3; xy[1]=-50.; xy[2]=.3; xy[3]=650.;
1308 ((TVirtualPad*)l->At(0))->cd();
2589cf64 1309 selStart=2*fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
6558fd69 1310 if(!GetGraphArray(xy, kMCcluster, 0, 1, n, selection)) break;
92c40e64 1311 ((TVirtualPad*)l->At(1))->cd();
2589cf64 1312 xy[0]=-.5; xy[1]=-0.5; xy[2]=fgkNresYsegm[fSegmentLevel]-.5; xy[3]=2.5;
81979445 1313 if(!GetGraphArray(xy, kMCcluster, 1, 1)) break;
92c40e64 1314 return kTRUE;
6558fd69 1315 case 17: //kMCtracklet [y]
1ee39b3a 1316 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
92d6d80c 1317 xy[0]=-.3; xy[1]=-50.; xy[2]=.3; xy[3] =500.;
1ee39b3a 1318 ((TVirtualPad*)l->At(0))->cd();
2589cf64 1319 selStart=0; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
d25116b6 1320 if(!GetGraphArray(xy, kMCtracklet, 0, 1, n, selection)) break;
1321 ((TVirtualPad*)l->At(1))->cd();
2589cf64 1322 selStart=fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
d25116b6 1323 if(!GetGraphArray(xy, kMCtracklet, 0, 1, n, selection)) break;
1324 return kTRUE;
1325 case 18: //kMCtracklet [y]
1326 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1327 xy[0]=-.3; xy[1]=-50.; xy[2]=.3; xy[3] =500.;
1328 ((TVirtualPad*)l->At(0))->cd();
2589cf64 1329 selStart=2*fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
d25116b6 1330 if(!GetGraphArray(xy, kMCtracklet, 0, 1, n, selection)) break;
1ee39b3a 1331 ((TVirtualPad*)l->At(1))->cd();
2589cf64 1332 xy[0]=-.5; xy[1]=-0.5; xy[2]=fgkNresYsegm[fSegmentLevel]-.5; xy[3]=2.5;
81979445 1333 if(!GetGraphArray(xy, kMCtracklet, 1, 1)) break;
1ee39b3a 1334 return kTRUE;
d25116b6 1335 case 19: //kMCtracklet [z]
92c40e64 1336 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1337 xy[0]=-1.; xy[1]=-100.; xy[2]=1.; xy[3] =2500.;
1338 ((TVirtualPad*)l->At(0))->cd();
81979445 1339 if(!GetGraphArray(xy, kMCtracklet, 2)) break;
92c40e64 1340 xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 2.5;
1341 ((TVirtualPad*)l->At(1))->cd();
81979445 1342 if(!GetGraphArray(xy, kMCtracklet, 3)) break;
92c40e64 1343 return kTRUE;
d25116b6 1344 case 20: //kMCtracklet [phi]
92c40e64 1345 xy[0]=-.3; xy[1]=-3.; xy[2]=.3; xy[3] =25.;
a310e49b 1346 if(!GetGraph(&xy[0], kMCtracklet, 4)) break;
1ee39b3a 1347 return kTRUE;
d25116b6 1348 case 21: //kMCtrack [y] ly [0]
1349 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1350 xy[0]=-.2; xy[1]=-50.; xy[2]=.2; xy[3] =400.;
1351 ((TVirtualPad*)l->At(0))->cd();
2589cf64 1352 selStart=Int_t(fgkNresYsegm[fSegmentLevel]*0.); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
d25116b6 1353 if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer1")) break;
1354 ((TVirtualPad*)l->At(1))->cd();
2589cf64 1355 selStart=Int_t(fgkNresYsegm[fSegmentLevel]*0.5); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
d25116b6 1356 if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer1")) break;
1357 return kTRUE;
1358 case 22: //kMCtrack [y] ly [1]
1ee39b3a 1359 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1295b37f 1360 xy[0]=-.2; xy[1]=-50.; xy[2]=.2; xy[3] =400.;
1ee39b3a 1361 ((TVirtualPad*)l->At(0))->cd();
2589cf64 1362 selStart=Int_t(fgkNresYsegm[fSegmentLevel]*1.); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
d25116b6 1363 if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer2")) break;
1364 ((TVirtualPad*)l->At(1))->cd();
2589cf64 1365 selStart=Int_t(fgkNresYsegm[fSegmentLevel]*1.5); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
d25116b6 1366 if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer2")) break;
1367 return kTRUE;
1368 case 23: //kMCtrack [y] ly [2]
1369 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1370 xy[0]=-.2; xy[1]=-50.; xy[2]=.2; xy[3] =400.;
1371 ((TVirtualPad*)l->At(0))->cd();
2589cf64 1372 selStart=Int_t(fgkNresYsegm[fSegmentLevel]*2.); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
d25116b6 1373 if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer3")) break;
1374 ((TVirtualPad*)l->At(1))->cd();
2589cf64 1375 selStart=Int_t(fgkNresYsegm[fSegmentLevel]*2.5); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
d25116b6 1376 if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer3")) break;
1377 return kTRUE;
1378 case 24: //kMCtrack [y] ly [3]
1379 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1380 xy[0]=-.2; xy[1]=-50.; xy[2]=.2; xy[3] =400.;
1381 ((TVirtualPad*)l->At(0))->cd();
2589cf64 1382 selStart=Int_t(fgkNresYsegm[fSegmentLevel]*3.); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
d25116b6 1383 if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer4")) break;
1384 ((TVirtualPad*)l->At(1))->cd();
2589cf64 1385 selStart=Int_t(fgkNresYsegm[fSegmentLevel]*3.5); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
d25116b6 1386 if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer4")) break;
1387 return kTRUE;
1388 case 25: //kMCtrack [y] ly [4]
1389 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1390 xy[0]=-.2; xy[1]=-50.; xy[2]=.2; xy[3] =400.;
1391 ((TVirtualPad*)l->At(0))->cd();
2589cf64 1392 selStart=Int_t(fgkNresYsegm[fSegmentLevel]*4.); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
d25116b6 1393 if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer5")) break;
1394 ((TVirtualPad*)l->At(1))->cd();
2589cf64 1395 selStart=Int_t(fgkNresYsegm[fSegmentLevel]*4.5); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
d25116b6 1396 if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer5")) break;
1397 return kTRUE;
1398 case 26: //kMCtrack [y] ly [5]
1399 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1400 xy[0]=-.2; xy[1]=-50.; xy[2]=.2; xy[3] =400.;
1401 ((TVirtualPad*)l->At(0))->cd();
2589cf64 1402 selStart=Int_t(fgkNresYsegm[fSegmentLevel]*5.); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
d25116b6 1403 if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer6")) break;
1404 ((TVirtualPad*)l->At(1))->cd();
2589cf64 1405 selStart=Int_t(fgkNresYsegm[fSegmentLevel]*5.5); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
d25116b6 1406 if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer6")) break;
1407 return kTRUE;
1408 case 27: //kMCtrack [y pulls]
1409 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
2589cf64 1410 xy[0] = -.5; xy[1] = -0.5; xy[2] = fgkNresYsegm[fSegmentLevel]-.5; xy[3] = 5.5;
d25116b6 1411 ((TVirtualPad*)l->At(0))->cd();
81979445 1412 selStart=0; for(n=0; n<6; n++) selection[n]=selStart+n;
d25116b6 1413 if(!GetGraphArray(xy, kMCtrack, 1, 1, n, selection)) break;
1ee39b3a 1414 ((TVirtualPad*)l->At(1))->cd();
81979445 1415 selStart=6; for(n=0; n<6; n++) selection[n]=selStart+n;
d25116b6 1416 if(!GetGraphArray(xy, kMCtrack, 1, 1, n, selection)) break;
1ee39b3a 1417 return kTRUE;
d25116b6 1418 case 28: //kMCtrack [z]
1ee39b3a 1419 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
a310e49b 1420 xy[0]=-1.; xy[1]=-1500.; xy[2]=1.; xy[3] =6000.;
1ee39b3a 1421 ((TVirtualPad*)l->At(0))->cd();
92d6d80c 1422 if(!GetGraphArray(xy, kMCtrack, 2)) break;
a310e49b 1423 xy[0] = -1.; xy[1] = -1.5; xy[2] = 1.; xy[3] = 5.;
1ee39b3a 1424 ((TVirtualPad*)l->At(1))->cd();
92d6d80c 1425 if(!GetGraphArray(xy, kMCtrack, 3)) break;
1ee39b3a 1426 return kTRUE;
d25116b6 1427 case 29: //kMCtrack [phi/snp]
1ee39b3a 1428 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
92d6d80c 1429 xy[0]=-.2; xy[1]=-0.5; xy[2]=.2; xy[3] =10.;
1ee39b3a 1430 ((TVirtualPad*)l->At(0))->cd();
92d6d80c 1431 if(!GetGraphArray(xy, kMCtrack, 4)) break;
a310e49b 1432 xy[0] = -.2; xy[1] = -1.5; xy[2] = .2; xy[3] = 5.;
1ee39b3a 1433 ((TVirtualPad*)l->At(1))->cd();
92d6d80c 1434 if(!GetGraphArray(xy, kMCtrack, 5)) break;
1ee39b3a 1435 return kTRUE;
d25116b6 1436 case 30: //kMCtrack [theta/tgl]
1ee39b3a 1437 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1438 xy[0]=-1.; xy[1]=-0.5; xy[2]=1.; xy[3] =5.;
1439 ((TVirtualPad*)l->At(0))->cd();
92d6d80c 1440 if(!GetGraphArray(xy, kMCtrack, 6)) break;
1ee39b3a 1441 xy[0] = -.2; xy[1] = -0.5; xy[2] = .2; xy[3] = 2.5;
1442 ((TVirtualPad*)l->At(1))->cd();
92d6d80c 1443 if(!GetGraphArray(xy, kMCtrack, 7)) break;
1ee39b3a 1444 return kTRUE;
d25116b6 1445 case 31: //kMCtrack [pt]
92c40e64 1446 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1447 pad = (TVirtualPad*)l->At(0); pad->cd();
1295b37f 1448 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
92d6d80c 1449 // pi selection
1450 n=0;
1451 for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
1452 selection[n++] = il*11 + 2; // pi-
1453 selection[n++] = il*11 + 8; // pi+
1454 }
a310e49b 1455 xy[0] = 0.2; xy[1] = -.7; xy[2] = 7.; xy[3] = 4.;
1456 //xy[0] = 0.2; xy[1] = -1.; xy[2] = 7.; xy[3] = 10.; // SA
92d6d80c 1457 if(!GetGraphArray(xy, kMCtrack, 8, kTRUE, n, selection, "#pi#pm")) break;
31c8fa8a 1458 pad->Modified(); pad->Update(); pad->SetLogx();
92c40e64 1459 pad = (TVirtualPad*)l->At(1); pad->cd();
1295b37f 1460 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
92d6d80c 1461 // mu selection
1462 n=0;
1463 for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
1464 selection[n++] = il*11 + 3; // mu-
1465 selection[n++] = il*11 + 7; // mu+
1466 }
1467 if(!GetGraphArray(xy, kMCtrack, 8, kTRUE, n, selection, "#mu#pm")) break;
31c8fa8a 1468 pad->Modified(); pad->Update(); pad->SetLogx();
92c40e64 1469 return kTRUE;
d25116b6 1470 case 32: //kMCtrack [pt]
92c40e64 1471 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1472 pad = (TVirtualPad*)l->At(0); pad->cd();
1295b37f 1473 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
92d6d80c 1474 // p selection
1475 n=0;
1476 for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
1477 selection[n++] = il*11 + 0; // p bar
1478 selection[n++] = il*11 + 10; // p
1479 }
a310e49b 1480 xy[0] = 0.2; xy[1] = -.7; xy[2] = 7.; xy[3] = 8.;
1481 //xy[0] = 0.2; xy[1] = -1.; xy[2] = 7.; xy[3] = 10.; // SA
92d6d80c 1482 if(!GetGraphArray(xy, kMCtrack, 8, kTRUE, n, selection, "p&p bar")) break;
1483 pad->Modified(); pad->Update(); pad->SetLogx();
92c40e64 1484 pad = (TVirtualPad*)l->At(1); pad->cd();
1295b37f 1485 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
92d6d80c 1486 // e selection
1487 n=0;
1488 for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
1489 selection[n++] = il*11 + 4; // e-
1490 selection[n++] = il*11 + 6; // e+
1491 }
a310e49b 1492 xy[0] = 0.2; xy[1] = -1.5; xy[2] = 7.; xy[3] = 12.;
1493 //xy[0] = 0.2; xy[1] = -1.5; xy[2] = 7.; xy[3] = 14.; // SA
92d6d80c 1494 if(!GetGraphArray(xy, kMCtrack, 8, kTRUE, n, selection, "e#pm")) break;
1495 pad->Modified(); pad->Update(); pad->SetLogx();
92c40e64 1496 return kTRUE;
d25116b6 1497 case 33: //kMCtrack [1/pt] pulls
a310e49b 1498 xy[0] = 0.; xy[1] = -1.; xy[2] = 2.; xy[3] = 3.5;
1499 //xy[0] = 0.; xy[1] = -1.; xy[2] = 2.; xy[3] = 4.5; // SA
92c40e64 1500 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1501 pad = (TVirtualPad*)l->At(0); pad->cd();
1295b37f 1502 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
92d6d80c 1503 // pi selection
1504 n=0;
1505 for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
1506 selection[n++] = il*11 + 2; // pi-
1507 selection[n++] = il*11 + 8; // pi+
1508 }
1509 if(!GetGraphArray(xy, kMCtrack, 9, kTRUE, n, selection, "#pi#pm")) break;
92c40e64 1510 pad = (TVirtualPad*)l->At(1); pad->cd();
1295b37f 1511 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
92d6d80c 1512 // mu selection
1513 n=0;
1514 for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
1515 selection[n++] = il*11 + 3; // mu-
1516 selection[n++] = il*11 + 7; // mu+
1517 }
1518 if(!GetGraphArray(xy, kMCtrack, 9, kTRUE, n, selection, "#mu#pm")) break;
92c40e64 1519 return kTRUE;
d25116b6 1520 case 34: //kMCtrack [1/pt] pulls
92c40e64 1521 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1522 pad = (TVirtualPad*)l->At(0); pad->cd();
1295b37f 1523 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
92d6d80c 1524 // p selection
1525 n=0;
1526 for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
1527 selection[n++] = il*11 + 0; // p bar
1528 selection[n++] = il*11 + 10; // p
1529 }
a310e49b 1530 xy[0] = 0.; xy[1] = -1.; xy[2] = 2.; xy[3] = 3.5;
1531 //xy[0] = 0.; xy[1] = -1.; xy[2] = 2.; xy[3] = 6.; // SA
92d6d80c 1532 if(!GetGraphArray(xy, kMCtrack, 9, kTRUE, n, selection, "p & p bar")) break;
92c40e64 1533 pad = (TVirtualPad*)l->At(1); pad->cd();
1295b37f 1534 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
92d6d80c 1535 // e selection
1536 n=0;
1537 for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
1538 selection[n++] = il*11 + 4; // e-
1539 selection[n++] = il*11 + 6; // e+
1540 }
a310e49b 1541 xy[0] = 0.; xy[1] = -2.; xy[2] = 2.; xy[3] = 4.5;
92d6d80c 1542 if(!GetGraphArray(xy, kMCtrack, 9, kTRUE, n, selection, "e#pm")) break;
1ee39b3a 1543 return kTRUE;
d25116b6 1544 case 35: //kMCtrack [p]
a310e49b 1545 xy[0] = 0.2; xy[1] = -.7; xy[2] = 7.; xy[3] = 4.;
1546 //xy[0] = 0.2; xy[1] = -1.5; xy[2] = 7.; xy[3] = 10.;
92c40e64 1547 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1548 pad = (TVirtualPad*)l->At(0); pad->cd();
1295b37f 1549 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
92d6d80c 1550 // pi selection
1551 n=0;
1552 for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
1553 selection[n++] = il*11 + 2; // pi-
1554 selection[n++] = il*11 + 8; // pi+
1555 }
1556 if(!GetGraphArray(xy, kMCtrack, 10, kTRUE, n, selection, "#pi#pm")) break;
1557 pad->Modified(); pad->Update(); pad->SetLogx();
92c40e64 1558 pad = (TVirtualPad*)l->At(1); pad->cd();
1295b37f 1559 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
92d6d80c 1560 // mu selection
1561 n=0;
1562 for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
1563 selection[n++] = il*11 + 3; // mu-
1564 selection[n++] = il*11 + 7; // mu+
1565 }
1566 if(!GetGraphArray(xy, kMCtrack, 10, kTRUE, n, selection, "#mu#pm")) break;
1567 pad->Modified(); pad->Update(); pad->SetLogx();
1ee39b3a 1568 return kTRUE;
d25116b6 1569 case 36: //kMCtrack [p]
92c40e64 1570 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1571 pad = (TVirtualPad*)l->At(0); pad->cd();
1295b37f 1572 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
92d6d80c 1573 // p selection
1574 n=0;
1575 for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
1576 selection[n++] = il*11 + 0; // p bar
1577 selection[n++] = il*11 + 10; // p
1578 }
a310e49b 1579 xy[0] = 0.2; xy[1] = -.7; xy[2] = 7.; xy[3] = 8.;
1580 //xy[0] = 0.2; xy[1] = -1.5; xy[2] = 7.; xy[3] = 12.; // SA
92d6d80c 1581 if(!GetGraphArray(xy, kMCtrack, 10, kTRUE, n, selection, "p & p bar")) break;
1582 pad->Modified(); pad->Update(); pad->SetLogx();
92c40e64 1583 pad = (TVirtualPad*)l->At(1); pad->cd();
1295b37f 1584 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
92d6d80c 1585 // e selection
1586 n=0;
1587 for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
1588 selection[n++] = il*11 + 4; // e-
1589 selection[n++] = il*11 + 6; // e+
1590 }
a310e49b 1591 xy[0] = 0.2; xy[1] = -1.5; xy[2] = 7.; xy[3] = 12.;
1592 //xy[0] = 0.2; xy[1] = -1.5; xy[2] = 7.; xy[3] = 14.; // SA
92d6d80c 1593 if(!GetGraphArray(xy, kMCtrack, 10, kTRUE, n, selection, "e#pm")) break;
1594 pad->Modified(); pad->Update(); pad->SetLogx();
1ee39b3a 1595 return kTRUE;
d25116b6 1596 case 37: // kMCtrackIn [y]
1ee39b3a 1597 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
a310e49b 1598 xy[0]=-.25; xy[1]=-1000.; xy[2]=.25; xy[3] =3000.;
1ee39b3a 1599 ((TVirtualPad*)l->At(0))->cd();
2589cf64 1600 selStart=0; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
a310e49b 1601 if(!GetGraphArray(xy, kMCtrackIn, 0, 1, n, selection)) break;
1602 ((TVirtualPad*)l->At(1))->cd();
2589cf64 1603 selStart=fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
a310e49b 1604 if(!GetGraphArray(&xy[0], kMCtrackIn, 0, 1, n, selection)) break;
1605 return kTRUE;
d25116b6 1606 case 38: // kMCtrackIn [y]
a310e49b 1607 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1608 xy[0]=-.25; xy[1]=-1000.; xy[2]=.25; xy[3] =3000.;
1609 ((TVirtualPad*)l->At(0))->cd();
2589cf64 1610 selStart=2*fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
a310e49b 1611 if(!GetGraphArray(xy, kMCtrackIn, 0, 1, n, selection)) break;
2589cf64 1612 xy[0] = -.5; xy[1] = -0.5; xy[2] = fgkNresYsegm[fSegmentLevel]-.5; xy[3] = 2.5;
1ee39b3a 1613 ((TVirtualPad*)l->At(1))->cd();
81979445 1614 if(!GetGraphArray(xy, kMCtrackIn, 1, 1)) break;
1ee39b3a 1615 return kTRUE;
d25116b6 1616 case 39: // kMCtrackIn [z]
1ee39b3a 1617 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1618 xy[0]=-1.; xy[1]=-500.; xy[2]=1.; xy[3] =800.;
1619 ((TVirtualPad*)l->At(0))->cd();
81979445 1620 if(!GetGraphArray(xy, kMCtrackIn, 2, 1)) break;
1ee39b3a 1621 xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 2.5;
1622 ((TVirtualPad*)l->At(1))->cd();
81979445 1623 if(!GetGraphArray(xy, kMCtrackIn, 3, 1)) break;
1ee39b3a 1624 return kTRUE;
d25116b6 1625 case 40: // kMCtrackIn [phi|snp]
1ee39b3a 1626 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1627 xy[0]=-.25; xy[1]=-0.5; xy[2]=.25; xy[3] =2.5;
1628 ((TVirtualPad*)l->At(0))->cd();
a310e49b 1629 if(!GetGraph(&xy[0], kMCtrackIn, 4)) break;
1ee39b3a 1630 xy[0] = -.25; xy[1] = -0.5; xy[2] = .25; xy[3] = 1.5;
1631 ((TVirtualPad*)l->At(1))->cd();
a310e49b 1632 if(!GetGraph(&xy[0], kMCtrackIn, 5)) break;
1ee39b3a 1633 return kTRUE;
d25116b6 1634 case 41: // kMCtrackIn [theta|tgl]
1ee39b3a 1635 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1636 xy[0]=-1.; xy[1]=-1.; xy[2]=1.; xy[3] =4.;
1637 ((TVirtualPad*)l->At(0))->cd();
a310e49b 1638 if(!GetGraph(&xy[0], kMCtrackIn, 6)) break;
1ee39b3a 1639 xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 1.5;
1640 ((TVirtualPad*)l->At(1))->cd();
a310e49b 1641 if(!GetGraph(&xy[0], kMCtrackIn, 7)) break;
1ee39b3a 1642 return kTRUE;
d25116b6 1643 case 42: // kMCtrackIn [pt]
92d6d80c 1644 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
a310e49b 1645 xy[0] = 0.2; xy[1] = -.8; xy[2] = 7.; xy[3] = 6.;
1646 //xy[0] = 0.2; xy[1] = -1.5; xy[2] = 7.; xy[3] = 10.; // SA
92d6d80c 1647 pad=(TVirtualPad*)l->At(0); pad->cd(); pad->SetLogx();
1648 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
1649 n=0; selection[n++]=2; selection[n++]=3; selection[n++]=7; selection[n++]=8;
1650 if(!GetGraphArray(xy, kMCtrackIn, 8, 1, n, selection)) break;
1651 pad = (TVirtualPad*)l->At(1); pad->cd(); pad->SetLogx();
1652 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
1653 n=0; selection[n++]=0; selection[n++]=4; selection[n++]=6; selection[n++]=10;
1654 if(!GetGraphArray(xy, kMCtrackIn, 8, 1, n, selection)) break;
1655 return kTRUE;
d25116b6 1656 case 43: //kMCtrackIn [1/pt] pulls
92d6d80c 1657 xy[0] = 0.; xy[1] = -1.; xy[2] = 2.; xy[3] = 3.5;
1658 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1659 pad = (TVirtualPad*)l->At(0); pad->cd();
1660 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
1661 n=0; selection[n++]=2; selection[n++]=3; selection[n++]=7; selection[n++]=8;
1662 if(!GetGraphArray(xy, kMCtrackIn, 9, 1, n, selection)) break;
1663 pad = (TVirtualPad*)l->At(1); pad->cd();
1664 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
1665 n=0; selection[n++]=0; selection[n++]=4; selection[n++]=6; selection[n++]=10;
1666 if(!GetGraphArray(xy, kMCtrackIn, 9, 1, n, selection)) break;
1667 return kTRUE;
d25116b6 1668 case 44: // kMCtrackIn [p]
a310e49b 1669 xy[0] = 0.2; xy[1] = -.8; xy[2] = 7.; xy[3] = 6.;
1670 //xy[0] = 0.2; xy[1] = -1.5; xy[2] = 7.; xy[3] = 10.;
92d6d80c 1671 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1672 pad = ((TVirtualPad*)l->At(0));pad->cd();pad->SetLogx();
1673 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
1674 n=0; selection[n++]=2; selection[n++]=3; selection[n++]=7; selection[n++]=8;
1675 if(!GetGraphArray(xy, kMCtrackIn, 10, 1, n, selection)) break;
1676 pad = ((TVirtualPad*)l->At(1)); pad->cd();pad->SetLogx();
1677 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
1678 n=0; selection[n++]=0; selection[n++]=4; selection[n++]=6; selection[n++]=10;
1679 if(!GetGraphArray(xy, kMCtrackIn, 10, 1, n, selection)) break;
1680 return kTRUE;
d25116b6 1681 case 45: // kMCtrackOut [y]
92d6d80c 1682 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
a310e49b 1683 xy[0]=-.3; xy[1]=-50.; xy[2]=.3; xy[3] =400.;
92d6d80c 1684 ((TVirtualPad*)l->At(0))->cd();
2589cf64 1685 selStart=0; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
a310e49b 1686 if(!GetGraphArray(xy, kMCtrackOut, 0, 1, n, selection)) break;
1687 ((TVirtualPad*)l->At(1))->cd();
2589cf64 1688 selStart=fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
a310e49b 1689 if(!GetGraphArray(&xy[0], kMCtrackOut, 0, 1, n, selection)) break;
1690 return kTRUE;
d25116b6 1691 case 46: // kMCtrackOut [y]
a310e49b 1692 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1693 xy[0]=-.3; xy[1]=-50.; xy[2]=.3; xy[3] =400.;
1694 ((TVirtualPad*)l->At(0))->cd();
2589cf64 1695 selStart=2*fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
a310e49b 1696 if(!GetGraphArray(xy, kMCtrackOut, 0, 1, n, selection)) break;
2589cf64 1697 xy[0] = -.5; xy[1] = -0.5; xy[2] = fgkNresYsegm[fSegmentLevel]-.5; xy[3] = 2.5;
92d6d80c 1698 ((TVirtualPad*)l->At(1))->cd();
81979445 1699 if(!GetGraphArray(xy, kMCtrackOut, 1, 1)) break;
92d6d80c 1700 return kTRUE;
d25116b6 1701 case 47: // kMCtrackOut [z]
92d6d80c 1702 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
a310e49b 1703 xy[0]=-1.; xy[1]=-500.; xy[2]=1.; xy[3] =1500.;
92d6d80c 1704 ((TVirtualPad*)l->At(0))->cd();
81979445 1705 if(!GetGraphArray(xy, kMCtrackOut, 2, 1)) break;
92d6d80c 1706 xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 2.5;
1707 ((TVirtualPad*)l->At(1))->cd();
81979445 1708 if(!GetGraphArray(xy, kMCtrackOut, 3, 1)) break;
92d6d80c 1709 return kTRUE;
d25116b6 1710 case 48: // kMCtrackOut [phi|snp]
92d6d80c 1711 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1712 xy[0]=-.25; xy[1]=-0.5; xy[2]=.25; xy[3] =2.5;
1713 ((TVirtualPad*)l->At(0))->cd();
a310e49b 1714 if(!GetGraph(&xy[0], kMCtrackOut, 4)) break;
92d6d80c 1715 xy[0] = -.25; xy[1] = -0.5; xy[2] = .25; xy[3] = 1.5;
1716 ((TVirtualPad*)l->At(1))->cd();
a310e49b 1717 if(!GetGraph(&xy[0], kMCtrackOut, 5)) break;
92d6d80c 1718 return kTRUE;
d25116b6 1719 case 49: // kMCtrackOut [theta|tgl]
92d6d80c 1720 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1721 xy[0]=-1.; xy[1]=-1.; xy[2]=1.; xy[3] =4.;
1722 ((TVirtualPad*)l->At(0))->cd();
a310e49b 1723 if(!GetGraph(&xy[0], kMCtrackOut, 6)) break;
1724 xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 15.;
92d6d80c 1725 ((TVirtualPad*)l->At(1))->cd();
a310e49b 1726 if(!GetGraph(&xy[0], kMCtrackOut, 7)) break;
92d6d80c 1727 return kTRUE;
d25116b6 1728 case 50: // kMCtrackOut [pt]
1ee39b3a 1729 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
db99a57a 1730 xy[0] = 0.2; xy[1] = -.8; xy[2] = 7.; xy[3] = 6.;
a310e49b 1731 pad=(TVirtualPad*)l->At(0); pad->cd(); pad->SetLogx();
1295b37f 1732 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
a310e49b 1733 n=0; selection[n++]=2; selection[n++]=3; selection[n++]=7; selection[n++]=8;
1734 if(!GetGraphArray(xy, kMCtrackOut, 8, 1, n, selection)) break;
1735 pad = (TVirtualPad*)l->At(1); pad->cd();pad->SetLogx();
1295b37f 1736 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
a310e49b 1737 n=0; selection[n++]=0; selection[n++]=4; selection[n++]=6; selection[n++]=10;
1738 if(!GetGraphArray(xy, kMCtrackOut, 8, 1, n, selection)) break;
1ee39b3a 1739 return kTRUE;
d25116b6 1740 case 51: //kMCtrackOut [1/pt] pulls
92d6d80c 1741 xy[0] = 0.; xy[1] = -1.; xy[2] = 2.; xy[3] = 3.5;
1742 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
1743 pad = (TVirtualPad*)l->At(0); pad->cd();
1744 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
a310e49b 1745 n=0; selection[n++]=2; selection[n++]=3; selection[n++]=7; selection[n++]=8;
1746 if(!GetGraphArray(xy, kMCtrackOut, 9, 1, n, selection)) break;
92d6d80c 1747 pad = (TVirtualPad*)l->At(1); pad->cd();
1748 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
a310e49b 1749 n=0; selection[n++]=0; selection[n++]=4; selection[n++]=6; selection[n++]=10;
1750 if(!GetGraphArray(xy, kMCtrackOut, 9, 1, n, selection)) break;
92d6d80c 1751 return kTRUE;
d25116b6 1752 case 52: // kMCtrackOut [p]
1ee39b3a 1753 gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
db99a57a 1754 xy[0] = 0.2; xy[1] = -.8; xy[2] = 7.; xy[3] = 6.;
a310e49b 1755 pad = ((TVirtualPad*)l->At(0));pad->cd();pad->SetLogx();
1295b37f 1756 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
a310e49b 1757 n=0; selection[n++]=2; selection[n++]=3; selection[n++]=7; selection[n++]=8;
1758 if(!GetGraphArray(xy, kMCtrackOut, 10, 1, n, selection)) break;
1759 pad = ((TVirtualPad*)l->At(1)); pad->cd();pad->SetLogx();
1295b37f 1760 pad->SetMargin(0.125, 0.015, 0.1, 0.015);
a310e49b 1761 n=0; selection[n++]=0; selection[n++]=4; selection[n++]=6; selection[n++]=10;
1762 if(!GetGraphArray(xy, kMCtrackOut, 10, 1, n, selection)) break;
1ee39b3a 1763 return kTRUE;
1764 }
1765 AliWarning(Form("Reference plot [%d] missing result", ifig));
1766 return kFALSE;
1767}
1768
00a3f7a4 1769//________________________________________________________
1770void AliTRDresolution::MakeSummary()
1771{
1772// Build summary plots
1773
1774 if(!fGraphS || !fGraphM){
1775 AliError("Missing results");
1776 return;
1777 }
1778 Float_t xy[4] = {0., 0., 0., 0.};
068e2c00 1779 Float_t range[2];
00a3f7a4 1780 TH2 *h2 = new TH2I("h2SF", "", 20, -.2, .2, fgkNresYsegm[fSegmentLevel], -0.5, fgkNresYsegm[fSegmentLevel]-0.5);
1781 h2->GetXaxis()->CenterTitle();
1782 h2->GetYaxis()->CenterTitle();
068e2c00 1783 h2->GetZaxis()->CenterTitle();h2->GetZaxis()->SetTitleOffset(1.4);
1784
1785 Int_t ih2(0), iSumPlot(0);
1786 TCanvas *cOut = new TCanvas(Form("TRDsummary%s_%d", GetName(), iSumPlot++), "Cluster & Tracklet Resolution", 1024, 768);
1787 cOut->Divide(3,2, 2.e-3, 2.e-3, kYellow-7);
1788 TVirtualPad *p(NULL);
1789
1790 p=cOut->cd(1);
1791 p->SetRightMargin(0.16);p->SetTopMargin(0.06);
1792 h2=(TH2I*)h2->Clone(Form("h2SF_%d", ih2++));
1793 h2->SetTitle(Form("Cluster-Track R-Phi Residuals;tg(#phi);%s;Sigma [#mum]", fgkResYsegmName[fSegmentLevel]));
1794 MakeSummaryPlot((TObjArray*) ((TObjArray*)fGraphS->At(kCluster))->At(0), h2);
1795 GetRange(h2, 1, range);
1796 h2->GetZaxis()->SetRangeUser(range[0], range[1]);
1797 h2->Draw("colz");
1798 h2->SetContour(7);
1799
1800 p=cOut->cd(2);
1801 p->SetRightMargin(0.16);p->SetTopMargin(0.06);
1802 h2=(TH2I*)h2->Clone(Form("h2SF_%d", ih2++));
1803 h2->SetTitle(Form("Cluster-Track R-Phi Systematics;tg(#phi);%s;Mean [#mum]", fgkResYsegmName[fSegmentLevel]));
1804 MakeSummaryPlot((TObjArray*) ((TObjArray*)fGraphM->At(kCluster))->At(0), h2);
1805 GetRange(h2, 0, range);
1806 h2->GetZaxis()->SetRangeUser(range[0], range[1]);
1807 h2->Draw("colz");
1808 h2->SetContour(7);
1809
1810 p=cOut->cd(3);
1811 p->SetRightMargin(0.06);p->SetTopMargin(0.06);
1812 xy[0]=-.5; xy[1]=-0.5; xy[2]=fgkNresYsegm[fSegmentLevel]-.5; xy[3]=2.5;
1813 GetGraphArray(xy, kCluster, 1, 1);
1814
1815 p=cOut->cd(4);
1816 p->SetRightMargin(0.16);p->SetTopMargin(0.06);
1817 h2=(TH2I*)h2->Clone(Form("h2SF_%d", ih2++));
1818 h2->SetTitle(Form("Tracklet-Track R-Phi Residuals;tg(#phi);%s;Sigma [#mum]", fgkResYsegmName[fSegmentLevel]));
1819 MakeSummaryPlot((TObjArray*) ((TObjArray*)fGraphS->At(kTrack))->At(0), h2);
1820 GetRange(h2, 1, range);
1821 h2->GetZaxis()->SetRangeUser(range[0], range[1]);
1822 h2->Draw("colz");
1823 h2->SetContour(7);
1824
1825 p=cOut->cd(5);
1826 p->SetRightMargin(0.16);p->SetTopMargin(0.06);
1827 h2=(TH2I*)h2->Clone(Form("h2SF_%d", ih2++));
1828 h2->SetTitle(Form("Tracklet-Track R-Phi Systematics;tg(#phi);%s;Mean [#mum]", fgkResYsegmName[fSegmentLevel]));
1829 MakeSummaryPlot((TObjArray*) ((TObjArray*)fGraphM->At(kTrack))->At(0), h2);
1830 GetRange(h2, 0, range);
1831 h2->GetZaxis()->SetRangeUser(range[0], range[1]);
1832 h2->Draw("colz");
1833 h2->SetContour(7);
1834
1835 p=cOut->cd(6);
1836 p->SetRightMargin(0.06);p->SetTopMargin(0.06);
1837 xy[0]=-.5; xy[1]=-0.5; xy[2]=fgkNresYsegm[fSegmentLevel]-.5; xy[3]=2.5;
1838 GetGraphArray(xy, kTrack, 1, 1);
1839
1840 cOut->SaveAs(Form("%s.gif", cOut->GetName()));
00a3f7a4 1841
068e2c00 1842 if(!HasMCdata()){
1843 delete cOut;
1844 return;
1845 }
1846 cOut->Clear(); cOut->SetName(Form("TRDsummary%s_%d", GetName(), iSumPlot++));
1847 cOut->Divide(3, 2, 2.e-3, 2.e-3, kBlue-10);
1848
1849 p=cOut->cd(1);
1850 p->SetRightMargin(0.16);p->SetTopMargin(0.06);
1851 h2=(TH2I*)h2->Clone(Form("h2SF_%d", ih2++));
1852 h2->SetTitle(Form("Cluster-MC R-Phi Resolution;tg(#phi);%s;Sigma [#mum]", fgkResYsegmName[fSegmentLevel]));
1853 MakeSummaryPlot((TObjArray*) ((TObjArray*)fGraphS->At(kMCcluster))->At(0), h2);
1854 GetRange(h2, 1, range);
1855 h2->GetZaxis()->SetRangeUser(range[0], range[1]);
1856 h2->Draw("colz");
1857 h2->SetContour(7);
1858
1859 p=cOut->cd(2);
1860 p->SetRightMargin(0.16);p->SetTopMargin(0.06);
1861 h2=(TH2I*)h2->Clone(Form("h2SF_%d", ih2++));
1862 h2->SetContour(7);
1863 h2->SetTitle(Form("Cluster-MC R-Phi Systematics;tg(#phi);%s;Mean [#mum]", fgkResYsegmName[fSegmentLevel]));
1864 MakeSummaryPlot((TObjArray*) ((TObjArray*)fGraphM->At(kMCcluster))->At(0), h2);
1865 GetRange(h2, 0, range);
1866 h2->GetZaxis()->SetRangeUser(range[0], range[1]);
1867 h2->Draw("colz");
1868 h2->SetContour(7);
1869
1870 p=cOut->cd(3);
1871 p->SetRightMargin(0.06);p->SetTopMargin(0.06);
00a3f7a4 1872 xy[0]=-.5; xy[1]=-0.5; xy[2]=fgkNresYsegm[fSegmentLevel]-.5; xy[3]=2.5;
1873 GetGraphArray(xy, kMCcluster, 1, 1);
1874
068e2c00 1875 p=cOut->cd(4);
1876 p->SetRightMargin(0.16);p->SetTopMargin(0.06);
1877 h2=(TH2I*)h2->Clone(Form("h2SF_%d", ih2++));
1878 h2->SetContour(7);
1879 h2->SetTitle(Form("Tracklet-MC R-Phi Resolution;tg(#phi);%s;Sigma [#mum]", fgkResYsegmName[fSegmentLevel]));
1880 MakeSummaryPlot((TObjArray*) ((TObjArray*)fGraphS->At(kMCtracklet))->At(0), h2);
1881 GetRange(h2, 1, range);
1882 h2->GetZaxis()->SetRangeUser(range[0], range[1]);
1883 h2->Draw("colz");
1884 h2->SetContour(7);
1885
1886 p=cOut->cd(5);
1887 p->SetRightMargin(0.16);p->SetTopMargin(0.06);
1888 h2=(TH2I*)h2->Clone(Form("h2SF_%d", ih2++));
1889 h2->SetContour(7);
1890 h2->SetTitle(Form("Tracklet-MC R-Phi Systematics;tg(#phi);%s;Mean [#mum]", fgkResYsegmName[fSegmentLevel]));
1891 MakeSummaryPlot((TObjArray*) ((TObjArray*)fGraphM->At(kMCtracklet))->At(0), h2);
1892 GetRange(h2, 0, range);
1893 h2->GetZaxis()->SetRangeUser(range[0], range[1]);
1894 h2->Draw("colz");
1895 h2->SetContour(7);
1896
1897 p=cOut->cd(6);
1898 p->SetRightMargin(0.06);p->SetTopMargin(0.06);
1899 xy[0]=-.5; xy[1]=-0.5; xy[2]=fgkNresYsegm[fSegmentLevel]-.5; xy[3]=2.5;
1900 GetGraphArray(xy, kMCtracklet, 1, 1);
1901
1902 cOut->SaveAs(Form("%s.gif", cOut->GetName()));
1903 delete cOut;
1904}
1905
1906//________________________________________________________
1907void AliTRDresolution::GetRange(TH2 *h2, Char_t mod, Float_t *range)
1908{
1909// Returns the range of the bulk of data in histogram h2. Removes outliers.
1910// The "range" vector should be initialized with 2 elements
1911// Option "mod" can be any of
1912// - 0 : gaussian like distribution
1913// - 1 : tailed distribution
1914
1915 Int_t nx(h2->GetNbinsX())
1916 , ny(h2->GetNbinsY())
1917 , n(nx*ny);
1918 Double_t *data=new Double_t[n];
1919 for(Int_t ix(1), in(0); ix<=nx; ix++){
1920 for(Int_t iy(1); iy<=ny; iy++)
1921 data[in++] = h2->GetBinContent(ix, iy);
00a3f7a4 1922 }
068e2c00 1923 Double_t mean, sigm;
1924 AliMathBase::EvaluateUni(n, data, mean, sigm, Int_t(n*.8));
1925
1926 range[0]=mean-3.*sigm; range[1]=mean+3.*sigm;
1927 if(mod==1) range[0]=TMath::Max(Float_t(1.e-3), range[0]);
1928 AliDebug(2, Form("h[%s] range0[%f %f]", h2->GetName(), range[0], range[1]));
1929 TH1S h1("h1SF0", "", 100, range[0], range[1]);
1930 h1.FillN(n,data,0);
1931 delete [] data;
1932
1933 switch(mod){
1934 case 0:// gaussian distribution
1935 {
1936 TF1 fg("fg", "gaus", mean-3.*sigm, mean+3.*sigm);
1937 h1.Fit(&fg, "QN");
1938 mean=fg.GetParameter(1); sigm=fg.GetParameter(2);
1939 range[0] = mean-2.5*sigm;range[1] = mean+2.5*sigm;
1940 AliDebug(2, Form(" rangeG[%f %f]", range[0], range[1]));
1941 break;
00a3f7a4 1942 }
068e2c00 1943 case 1:// tailed distribution
1944 {
1945 Int_t bmax(h1.GetMaximumBin());
1946 Int_t jBinMin(1), jBinMax(100);
1947 for(Int_t ibin(bmax); ibin--;){
1948 if(h1.GetBinContent(ibin)==0){
1949 jBinMin=ibin; break;
1950 }
1951 }
1952 for(Int_t ibin(bmax); ibin++;){
1953 if(h1.GetBinContent(ibin)==0){
1954 jBinMax=ibin; break;
1955 }
00a3f7a4 1956 }
068e2c00 1957 range[0]=h1.GetBinCenter(jBinMin); range[1]=h1.GetBinCenter(jBinMax);
1958 AliDebug(2, Form(" rangeT[%f %f]", range[0], range[1]));
1959 break;
1960 }
00a3f7a4 1961 }
00a3f7a4 1962
068e2c00 1963 return;
1964}
1965
1966//________________________________________________________
1967void AliTRDresolution::MakeSummaryPlot(TObjArray *a, TH2 *h2)
1968{
1969 h2->Reset();
1970 Double_t x,y;
1971 TGraphErrors *g(NULL); TAxis *ax(h2->GetXaxis());
00a3f7a4 1972 for(Int_t iseg(0); iseg<fgkNresYsegm[fSegmentLevel]; iseg++){
1973 g=(TGraphErrors*)a->At(iseg);
1974 for(Int_t in(0); in<g->GetN(); in++){
1975 g->GetPoint(in, x, y);
1976 h2->SetBinContent(ax->FindBin(x), iseg+1, y);
00a3f7a4 1977 }
1978 }
00a3f7a4 1979}
1980
068e2c00 1981
00a3f7a4 1982//________________________________________________________
92c40e64 1983Char_t const *fgParticle[11]={
1984 " p bar", " K -", " #pi -", " #mu -", " e -",
1985 " No PID",
1986 " e +", " #mu +", " #pi +", " K +", " p",
1987};
1295b37f 1988const Color_t fgColorS[11]={
1989kOrange, kOrange-3, kMagenta+1, kViolet, kRed,
31c8fa8a 1990kGray,
1295b37f 1991kRed, kViolet, kMagenta+1, kOrange-3, kOrange
1992};
1993const Color_t fgColorM[11]={
1994kCyan-5, kAzure-4, kBlue-7, kBlue+2, kViolet+10,
1995kBlack,
1996kViolet+10, kBlue+2, kBlue-7, kAzure-4, kCyan-5
31c8fa8a 1997};
1998const Marker_t fgMarker[11]={
199930, 30, 26, 25, 24,
200028,
200120, 21, 22, 29, 29
2002};
1ee39b3a 2003Bool_t AliTRDresolution::PostProcess()
2004{
2005 //fContainer = dynamic_cast<TObjArray*>(GetOutputData(0));
2006 if (!fContainer) {
2007 AliError("ERROR: list not available");
2008 return kFALSE;
2009 }
b91fdd71 2010 TGraph *gm= NULL, *gs= NULL;
1ee39b3a 2011 if(!fGraphS && !fGraphM){
31c8fa8a 2012 TObjArray *aM(NULL), *aS(NULL);
1ee39b3a 2013 Int_t n = fContainer->GetEntriesFast();
2014 fGraphS = new TObjArray(n); fGraphS->SetOwner();
2015 fGraphM = new TObjArray(n); fGraphM->SetOwner();
92d6d80c 2016 for(Int_t ig(0), nc(0); ig<n; ig++){
92c40e64 2017 fGraphM->AddAt(aM = new TObjArray(fgNproj[ig]), ig);
2018 fGraphS->AddAt(aS = new TObjArray(fgNproj[ig]), ig);
92d6d80c 2019
2020 for(Int_t ic=0; ic<fgNproj[ig]; ic++, nc++){
2589cf64 2021 AliDebug(2, Form("building G[%d] P[%d] N[%d]", ig, ic, fNcomp[nc]));
2022 if(fNcomp[nc]>1){
31c8fa8a 2023 TObjArray *agS(NULL), *agM(NULL);
2589cf64 2024 aS->AddAt(agS = new TObjArray(fNcomp[nc]), ic);
2025 aM->AddAt(agM = new TObjArray(fNcomp[nc]), ic);
2026 for(Int_t is=fNcomp[nc]; is--;){
31c8fa8a 2027 agS->AddAt(gs = new TGraphErrors(), is);
92d6d80c 2028 Int_t is0(is%11), il0(is/11);
31c8fa8a 2029 gs->SetMarkerStyle(fgMarker[is0]);
1295b37f 2030 gs->SetMarkerColor(fgColorS[is0]);
2031 gs->SetLineColor(fgColorS[is0]);
92d6d80c 2032 gs->SetLineStyle(il0);gs->SetLineWidth(2);
2589cf64 2033 gs->SetName(Form("s_%d_%02d_%02d", ig, ic, is));
31c8fa8a 2034
2035 agM->AddAt(gm = new TGraphErrors(), is);
2036 gm->SetMarkerStyle(fgMarker[is0]);
1295b37f 2037 gm->SetMarkerColor(fgColorM[is0]);
2038 gm->SetLineColor(fgColorM[is0]);
92d6d80c 2039 gm->SetLineStyle(il0);gm->SetLineWidth(2);
2589cf64 2040 gm->SetName(Form("m_%d_%02d_%02d", ig, ic, is));
a310e49b 2041 // this is important for labels in the legend
2042 if(ic==0) {
2589cf64 2043 gs->SetTitle(Form("%s %02d", fgkResYsegmName[fSegmentLevel], is%fgkNresYsegm[fSegmentLevel]));
2044 gm->SetTitle(Form("%s %02d", fgkResYsegmName[fSegmentLevel], is%fgkNresYsegm[fSegmentLevel]));
81979445 2045 } else if(ic==1) {
2046 gs->SetTitle(Form("%s Ly[%d]", is%2 ?"z":"y", is/2));
2047 gm->SetTitle(Form("%s Ly[%d]", is%2?"z":"y", is/2));
2048 } else if(ic==2||ic==3) {
2049 gs->SetTitle(Form("%s Ly[%d]", is%2 ?"RC":"no RC", is/2));
2050 gm->SetTitle(Form("%s Ly[%d]", is%2?"RC":"no RC", is/2));
a310e49b 2051 } else if(ic<=7) {
d25116b6 2052 gs->SetTitle(Form("Layer[%d]", is%AliTRDgeometry::kNlayer));
2053 gm->SetTitle(Form("Layer[%d]", is%AliTRDgeometry::kNlayer));
a310e49b 2054 } else {
2055 gs->SetTitle(Form("%s @ ly[%d]", fgParticle[is0], il0));
2056 gm->SetTitle(Form("%s @ ly[%d]", fgParticle[is0], il0));
2057 }
92c40e64 2058 }
2059 } else {
2060 aS->AddAt(gs = new TGraphErrors(), ic);
2061 gs->SetMarkerStyle(23);
2062 gs->SetMarkerColor(kRed);
2063 gs->SetLineColor(kRed);
2589cf64 2064 gs->SetNameTitle(Form("s_%d_%02d", ig, ic), "sigma");
92c40e64 2065
2066 aM->AddAt(gm = ig ? (TGraph*)new TGraphErrors() : (TGraph*)new TGraphAsymmErrors(), ic);
2067 gm->SetLineColor(kBlack);
2068 gm->SetMarkerStyle(7);
2069 gm->SetMarkerColor(kBlack);
2589cf64 2070 gm->SetNameTitle(Form("m_%d_%02d", ig, ic), "mean");
1ee39b3a 2071 }
1ee39b3a 2072 }
2073 }
2074 }
2075
2076/* printf("\n\n\n"); fGraphS->ls();
2077 printf("\n\n\n"); fGraphM->ls();*/
2078
2079
2080 // DEFINE MODELS
2081 // simple gauss
2082 TF1 fg("fGauss", "gaus", -.5, .5);
2083 // Landau for charge resolution
92c40e64 2084 TF1 fch("fClCh", "landau", 0., 1000.);
2085 // Landau for e+- pt resolution
2086 TF1 fpt("fPt", "landau", -0.1, 0.2);
1ee39b3a 2087
2088 //PROCESS EXPERIMENTAL DISTRIBUTIONS
2089 // Charge resolution
2090 //Process3DL(kCharge, 0, &fl);
2091 // Clusters residuals
92d6d80c 2092 Process3D(kCluster, 0, &fg, 1.e4);
81979445 2093 Process3Dlinked(kCluster, 1, &fg);
6558fd69 2094 fNRefFigures = 3;
1ee39b3a 2095 // Tracklet residual/pulls
6558fd69 2096 Process3D(kTrack , 0, &fg, 1.e4);
81979445 2097 Process3Dlinked(kTrack , 1, &fg);
2098 Process3D(kTrack , 2, &fg, 1.e4);
2099 Process3D(kTrack , 3, &fg);
92d6d80c 2100 Process2D(kTrack , 4, &fg, 1.e3);
6558fd69 2101 fNRefFigures = 7;
a310e49b 2102 // TRDin residual/pulls
92d6d80c 2103 Process3D(kTrackIn, 0, &fg, 1.e4);
81979445 2104 Process3Dlinked(kTrackIn, 1, &fg);
2105 Process3D(kTrackIn, 2, &fg, 1.e4);
2106 Process3D(kTrackIn, 3, &fg);
92d6d80c 2107 Process2D(kTrackIn, 4, &fg, 1.e3);
6558fd69 2108 fNRefFigures = 11;
a310e49b 2109 // TRDout residual/pulls
6558fd69 2110 Process3D(kTrackOut, 0, &fg, 1.e3); // scale to fit - see PlotTrackOut
81979445 2111 Process3Dlinked(kTrackOut, 1, &fg);
2112 Process3D(kTrackOut, 2, &fg, 1.e4);
2113 Process3D(kTrackOut, 3, &fg);
a310e49b 2114 Process2D(kTrackOut, 4, &fg, 1.e3);
6558fd69 2115 fNRefFigures = 15;
1ee39b3a 2116
2117 if(!HasMCdata()) return kTRUE;
2118
2119
2120 //PROCESS MC RESIDUAL DISTRIBUTIONS
2121
2122 // CLUSTER Y RESOLUTION/PULLS
92d6d80c 2123 Process3D(kMCcluster, 0, &fg, 1.e4);
81979445 2124 Process3Dlinked(kMCcluster, 1, &fg, 1.);
6558fd69 2125 fNRefFigures = 17;
1ee39b3a 2126
2127 // TRACKLET RESOLUTION/PULLS
92d6d80c 2128 Process3D(kMCtracklet, 0, &fg, 1.e4); // y
81979445 2129 Process3Dlinked(kMCtracklet, 1, &fg, 1.); // y pulls
2130 Process3D(kMCtracklet, 2, &fg, 1.e4); // z
2131 Process3D(kMCtracklet, 3, &fg, 1.); // z pulls
92d6d80c 2132 Process2D(kMCtracklet, 4, &fg, 1.e3); // phi
d25116b6 2133 fNRefFigures = 21;
1ee39b3a 2134
2135 // TRACK RESOLUTION/PULLS
92d6d80c 2136 Process3Darray(kMCtrack, 0, &fg, 1.e4); // y
81979445 2137 Process3DlinkedArray(kMCtrack, 1, &fg); // y PULL
2138 Process3Darray(kMCtrack, 2, &fg, 1.e4); // z
2139 Process3Darray(kMCtrack, 3, &fg); // z PULL
92d6d80c 2140 Process2Darray(kMCtrack, 4, &fg, 1.e3); // phi
2141 Process2Darray(kMCtrack, 5, &fg); // snp PULL
2142 Process2Darray(kMCtrack, 6, &fg, 1.e3); // theta
2143 Process2Darray(kMCtrack, 7, &fg); // tgl PULL
2144 Process3Darray(kMCtrack, 8, &fg, 1.e2); // pt resolution
2145 Process3Darray(kMCtrack, 9, &fg); // 1/pt pulls
2146 Process3Darray(kMCtrack, 10, &fg, 1.e2); // p resolution
d25116b6 2147 fNRefFigures+=16;
92d6d80c 2148
2149 // TRACK TRDin RESOLUTION/PULLS
2150 Process3D(kMCtrackIn, 0, &fg, 1.e4);// y resolution
81979445 2151 Process3Dlinked(kMCtrackIn, 1, &fg); // y pulls
2152 Process3D(kMCtrackIn, 2, &fg, 1.e4);// z resolution
2153 Process3D(kMCtrackIn, 3, &fg); // z pulls
92d6d80c 2154 Process2D(kMCtrackIn, 4, &fg, 1.e3);// phi resolution
2155 Process2D(kMCtrackIn, 5, &fg); // snp pulls
2156 Process2D(kMCtrackIn, 6, &fg, 1.e3);// theta resolution
2157 Process2D(kMCtrackIn, 7, &fg); // tgl pulls
2158 Process3D(kMCtrackIn, 8, &fg, 1.e2);// pt resolution
2159 Process3D(kMCtrackIn, 9, &fg); // 1/pt pulls
2160 Process3D(kMCtrackIn, 10, &fg, 1.e2);// p resolution
d25116b6 2161 fNRefFigures+=8;
92d6d80c 2162
2163 // TRACK TRDout RESOLUTION/PULLS
2164 Process3D(kMCtrackOut, 0, &fg, 1.e4);// y resolution
81979445 2165 Process3Dlinked(kMCtrackOut, 1, &fg); // y pulls
2166 Process3D(kMCtrackOut, 2, &fg, 1.e4);// z resolution
2167 Process3D(kMCtrackOut, 3, &fg); // z pulls
92d6d80c 2168 Process2D(kMCtrackOut, 4, &fg, 1.e3);// phi resolution
2169 Process2D(kMCtrackOut, 5, &fg); // snp pulls
2170 Process2D(kMCtrackOut, 6, &fg, 1.e3);// theta resolution
2171 Process2D(kMCtrackOut, 7, &fg); // tgl pulls
2172 Process3D(kMCtrackOut, 8, &fg, 1.e2);// pt resolution
2173 Process3D(kMCtrackOut, 9, &fg); // 1/pt pulls
2174 Process3D(kMCtrackOut, 10, &fg, 1.e2);// p resolution
d25116b6 2175 fNRefFigures+=8;
1ee39b3a 2176
2177 return kTRUE;
2178}
2179
2180
2181//________________________________________________________
2182void AliTRDresolution::Terminate(Option_t *opt)
2183{
2184 AliTRDrecoTask::Terminate(opt);
2185 if(HasPostProcess()) PostProcess();
2186}
2187
2188//________________________________________________________
2189void AliTRDresolution::AdjustF1(TH1 *h, TF1 *f)
2190{
2191// Helper function to avoid duplication of code
2192// Make first guesses on the fit parameters
2193
2194 // find the intial parameters of the fit !! (thanks George)
2195 Int_t nbinsy = Int_t(.5*h->GetNbinsX());
2196 Double_t sum = 0.;
2197 for(Int_t jbin=nbinsy-4; jbin<=nbinsy+4; jbin++) sum+=h->GetBinContent(jbin); sum/=9.;
2198 f->SetParLimits(0, 0., 3.*sum);
2199 f->SetParameter(0, .9*sum);
2200 Double_t rms = h->GetRMS();
2201 f->SetParLimits(1, -rms, rms);
2202 f->SetParameter(1, h->GetMean());
2203
2204 f->SetParLimits(2, 0., 2.*rms);
2205 f->SetParameter(2, rms);
2206 if(f->GetNpar() <= 4) return;
2207
2208 f->SetParLimits(3, 0., sum);
2209 f->SetParameter(3, .1*sum);
2210
2211 f->SetParLimits(4, -.3, .3);
2212 f->SetParameter(4, 0.);
2213
2214 f->SetParLimits(5, 0., 1.e2);
2215 f->SetParameter(5, 2.e-1);
2216}
2217
afca20ef 2218//________________________________________________________
2589cf64 2219TObjArray* AliTRDresolution::BuildMonitorContainerCluster(const char* name, Bool_t expand)
afca20ef 2220{
3d2a3dff 2221// Build performance histograms for AliTRDcluster.vs TRD track or MC
afca20ef 2222// - y reziduals/pulls
3d2a3dff 2223
2224 TObjArray *arr = new TObjArray(2);
afca20ef 2225 arr->SetName(name); arr->SetOwner();
2226 TH1 *h(NULL); char hname[100], htitle[300];
2227
2228 // tracklet resolution/pull in y direction
3d2a3dff 2229 sprintf(hname, "%s_%s_Y", GetNameId(), name);
2589cf64 2230 sprintf(htitle, "Y res for \"%s\" @ %s;tg(#phi);#Delta y [cm];%s", GetNameId(), name, fgkResYsegmName[fSegmentLevel]);
3d2a3dff 2231 if(!(h = (TH3S*)gROOT->FindObject(hname))){
2589cf64 2232 Int_t nybins=fgkNresYsegm[fSegmentLevel];
2233 if(expand) nybins*=2;
3d2a3dff 2234 h = new TH3S(hname, htitle,
e3147647 2235 48, -.48, .48, 60, -1.5, 1.5, nybins, -0.5, nybins-0.5);
afca20ef 2236 } else h->Reset();
2237 arr->AddAt(h, 0);
81979445 2238 sprintf(hname, "%s_%s_YZpull", GetNameId(), name);
2589cf64 2239 sprintf(htitle, "YZ pull for \"%s\" @ %s;%s;#Delta y / #sigma_{y};#Delta z / #sigma_{z}", GetNameId(), name, fgkResYsegmName[fSegmentLevel]);
81979445 2240 if(!(h = (TH3S*)gROOT->FindObject(hname))){
2589cf64 2241 h = new TH3S(hname, htitle, fgkNresYsegm[fSegmentLevel], -0.5, fgkNresYsegm[fSegmentLevel]-0.5, 100, -4.5, 4.5, 100, -4.5, 4.5);
afca20ef 2242 } else h->Reset();
2243 arr->AddAt(h, 1);
2244
3d2a3dff 2245 return arr;
2246}
2247
2248//________________________________________________________
2589cf64 2249TObjArray* AliTRDresolution::BuildMonitorContainerTracklet(const char* name, Bool_t expand)
3d2a3dff 2250{
2251// Build performance histograms for AliExternalTrackParam.vs TRD tracklet
2252// - y reziduals/pulls
2253// - z reziduals/pulls
2254// - phi reziduals
2589cf64 2255 TObjArray *arr = BuildMonitorContainerCluster(name, expand);
3d2a3dff 2256 arr->Expand(5);
2257 TH1 *h(NULL); char hname[100], htitle[300];
2258
afca20ef 2259 // tracklet resolution/pull in z direction
3d2a3dff 2260 sprintf(hname, "%s_%s_Z", GetNameId(), name);
81979445 2261 sprintf(htitle, "Z res for \"%s\" @ %s;tg(#theta);#Delta z [cm];row cross", GetNameId(), name);
2262 if(!(h = (TH3S*)gROOT->FindObject(hname))){
2263 h = new TH3S(hname, htitle, 50, -1., 1., 100, -1.5, 1.5, 2, -0.5, 1.5);
afca20ef 2264 } else h->Reset();
2265 arr->AddAt(h, 2);
3d2a3dff 2266 sprintf(hname, "%s_%s_Zpull", GetNameId(), name);
81979445 2267 sprintf(htitle, "Z pull for \"%s\" @ %s;tg(#theta);#Delta z / #sigma_{z};row cross", GetNameId(), name);
2268 if(!(h = (TH3S*)gROOT->FindObject(hname))){
2269 h = new TH3S(hname, htitle, 50, -1., 1., 100, -5.5, 5.5, 2, -0.5, 1.5);
dfd7d48b 2270 h->GetZaxis()->SetBinLabel(1, "no RC");
2271 h->GetZaxis()->SetBinLabel(2, "RC");
afca20ef 2272 } else h->Reset();
2273 arr->AddAt(h, 3);
2274
2275 // tracklet to track phi resolution
3d2a3dff 2276 sprintf(hname, "%s_%s_PHI", GetNameId(), name);
2277 sprintf(htitle, "#Phi res for \"%s\" @ %s;tg(#phi);#Delta #phi [rad];entries", GetNameId(), name);
afca20ef 2278 if(!(h = (TH2I*)gROOT->FindObject(hname))){
2279 h = new TH2I(hname, htitle, 21, -.33, .33, 100, -.5, .5);
2280 } else h->Reset();
2281 arr->AddAt(h, 4);
2282
2283 return arr;
2284}
2285
2286//________________________________________________________
2287TObjArray* AliTRDresolution::BuildMonitorContainerTrack(const char* name)
2288{
2289// Build performance histograms for AliExternalTrackParam.vs MC
2290// - y resolution/pulls
2291// - z resolution/pulls
2292// - phi resolution, snp pulls
2293// - theta resolution, tgl pulls
2294// - pt resolution, 1/pt pulls, p resolution
2295
afca20ef 2296 TObjArray *arr = BuildMonitorContainerTracklet(name);
2297 arr->Expand(11);
3d2a3dff 2298 TH1 *h(NULL); char hname[100], htitle[300];
a310e49b 2299 TAxis *ax(NULL);
3d2a3dff 2300
afca20ef 2301 // snp pulls
3d2a3dff 2302 sprintf(hname, "%s_%s_SNPpull", GetNameId(), name);
2303 sprintf(htitle, "SNP pull for \"%s\" @ %s;tg(#phi);#Delta snp / #sigma_{snp};entries", GetNameId(), name);
afca20ef 2304 if(!(h = (TH2I*)gROOT->FindObject(hname))){
2305 h = new TH2I(hname, htitle, 60, -.3, .3, 100, -4.5, 4.5);
2306 } else h->Reset();
2307 arr->AddAt(h, 5);
2308
2309 // theta resolution
3d2a3dff 2310 sprintf(hname, "%s_%s_THT", GetNameId(), name);
2311 sprintf(htitle, "#Theta res for \"%s\" @ %s;tg(#theta);#Delta #theta [rad];entries", GetNameId(), name);
afca20ef 2312 if(!(h = (TH2I*)gROOT->FindObject(hname))){
2313 h = new TH2I(hname, htitle, 100, -1., 1., 100, -5e-3, 5e-3);
2314 } else h->Reset();
2315 arr->AddAt(h, 6);
2316 // tgl pulls
3d2a3dff 2317 sprintf(hname, "%s_%s_TGLpull", GetNameId(), name);
2318 sprintf(htitle, "TGL pull for \"%s\" @ %s;tg(#theta);#Delta tgl / #sigma_{tgl};entries", GetNameId(), name);
afca20ef 2319 if(!(h = (TH2I*)gROOT->FindObject(hname))){
2320 h = new TH2I(hname, htitle, 100, -1., 1., 100, -4.5, 4.5);
2321 } else h->Reset();
2322 arr->AddAt(h, 7);
2323
2324 const Int_t kNpt(14);
2325 const Int_t kNdpt(150);
2326 const Int_t kNspc = 2*AliPID::kSPECIES+1;
2327 Float_t Pt=0.1, DPt=-.1, Spc=-5.5;
2328 Float_t binsPt[kNpt+1], binsSpc[kNspc+1], binsDPt[kNdpt+1];
2329 for(Int_t i=0;i<kNpt+1; i++,Pt=TMath::Exp(i*.15)-1.) binsPt[i]=Pt;
2330 for(Int_t i=0; i<kNspc+1; i++,Spc+=1.) binsSpc[i]=Spc;
2331 for(Int_t i=0; i<kNdpt+1; i++,DPt+=2.e-3) binsDPt[i]=DPt;
2332
2333 // Pt resolution
3d2a3dff 2334 sprintf(hname, "%s_%s_Pt", GetNameId(), name);
2335 sprintf(htitle, "P_{t} res for \"%s\" @ %s;p_{t} [GeV/c];#Delta p_{t}/p_{t}^{MC};SPECIES", GetNameId(), name);
afca20ef 2336 if(!(h = (TH3S*)gROOT->FindObject(hname))){
2337 h = new TH3S(hname, htitle,
2338 kNpt, binsPt, kNdpt, binsDPt, kNspc, binsSpc);
a310e49b 2339 ax = h->GetZaxis();
2340 for(Int_t ib(1); ib<=ax->GetNbins(); ib++) ax->SetBinLabel(ib, fgParticle[ib-1]);
afca20ef 2341 } else h->Reset();
2342 arr->AddAt(h, 8);
2343 // 1/Pt pulls
3d2a3dff 2344 sprintf(hname, "%s_%s_1Pt", GetNameId(), name);
2345 sprintf(htitle, "1/P_{t} pull for \"%s\" @ %s;1/p_{t}^{MC} [c/GeV];#Delta(1/p_{t})/#sigma(1/p_{t});SPECIES", GetNameId(), name);
afca20ef 2346 if(!(h = (TH3S*)gROOT->FindObject(hname))){
2347 h = new TH3S(hname, htitle,
2348 kNpt, 0., 2., 100, -4., 4., kNspc, -5.5, 5.5);
a310e49b 2349 ax = h->GetZaxis();
2350 for(Int_t ib(1); ib<=ax->GetNbins(); ib++) ax->SetBinLabel(ib, fgParticle[ib-1]);
afca20ef 2351 } else h->Reset();
2352 arr->AddAt(h, 9);
2353 // P resolution
3d2a3dff 2354 sprintf(hname, "%s_%s_P", GetNameId(), name);
2355 sprintf(htitle, "P res for \"%s\" @ %s;p [GeV/c];#Delta p/p^{MC};SPECIES", GetNameId(), name);
afca20ef 2356 if(!(h = (TH3S*)gROOT->FindObject(hname))){
2357 h = new TH3S(hname, htitle,
2358 kNpt, binsPt, kNdpt, binsDPt, kNspc, binsSpc);
a310e49b 2359 ax = h->GetZaxis();
2360 for(Int_t ib(1); ib<=ax->GetNbins(); ib++) ax->SetBinLabel(ib, fgParticle[ib-1]);
afca20ef 2361 } else h->Reset();
2362 arr->AddAt(h, 10);
2363
2364 return arr;
2365}
2366
2367
1ee39b3a 2368//________________________________________________________
2369TObjArray* AliTRDresolution::Histos()
2370{
2371 //
2372 // Define histograms
2373 //
2374
2375 if(fContainer) return fContainer;
2376
92c40e64 2377 fContainer = new TObjArray(kNviews);
1ee39b3a 2378 //fContainer->SetOwner(kTRUE);
31c8fa8a 2379 TH1 *h(NULL);
2380 TObjArray *arr(NULL);
1ee39b3a 2381
31c8fa8a 2382 // binnings for plots containing momentum or pt
2383 const Int_t kNpt(14), kNphi(48), kNdy(60);
2384 Float_t Phi=-.48, Dy=-.3, Pt=0.1;
2385 Float_t binsPhi[kNphi+1], binsDy[kNdy+1], binsPt[kNpt+1];
2386 for(Int_t i=0; i<kNphi+1; i++,Phi+=.02) binsPhi[i]=Phi;
2387 for(Int_t i=0; i<kNdy+1; i++,Dy+=.01) binsDy[i]=Dy;
2388 for(Int_t i=0;i<kNpt+1; i++,Pt=TMath::Exp(i*.15)-1.) binsPt[i]=Pt;
df0514f6 2389
1ee39b3a 2390 // cluster to track residuals/pulls
92d6d80c 2391 fContainer->AddAt(arr = new TObjArray(2), kCharge);
1ee39b3a 2392 arr->SetName("Charge");
2393 if(!(h = (TH3S*)gROOT->FindObject("hCharge"))){
2394 h = new TH3S("hCharge", "Charge Resolution", 20, 1., 2., 24, 0., 3.6, 100, 0., 500.);
2395 h->GetXaxis()->SetTitle("dx/dx_{0}");
2396 h->GetYaxis()->SetTitle("x_{d} [cm]");
2397 h->GetZaxis()->SetTitle("dq/dx [ADC/cm]");
2398 } else h->Reset();
2399 arr->AddAt(h, 0);
2400
2401 // cluster to track residuals/pulls
3d2a3dff 2402 fContainer->AddAt(BuildMonitorContainerCluster("Cl"), kCluster);
afca20ef 2403 // tracklet to TRD track
2589cf64 2404 fContainer->AddAt(BuildMonitorContainerTracklet("Trk", kTRUE), kTrack);
afca20ef 2405 // tracklet to TRDin
2589cf64 2406 fContainer->AddAt(BuildMonitorContainerTracklet("TrkIN", kTRUE), kTrackIn);
a310e49b 2407 // tracklet to TRDout
2408 fContainer->AddAt(BuildMonitorContainerTracklet("TrkOUT"), kTrackOut);
1ee39b3a 2409
2410
2411 // Resolution histos
2412 if(!HasMCdata()) return fContainer;
2413
3d2a3dff 2414 // cluster resolution
2415 fContainer->AddAt(BuildMonitorContainerCluster("MCcl"), kMCcluster);
1ee39b3a 2416
3d2a3dff 2417 // tracklet resolution
2418 fContainer->AddAt(BuildMonitorContainerTracklet("MCtracklet"), kMCtracklet);
1ee39b3a 2419
3d2a3dff 2420 // track resolution
92d6d80c 2421 fContainer->AddAt(arr = new TObjArray(AliTRDgeometry::kNlayer), kMCtrack);
3d2a3dff 2422 arr->SetName("MCtrk");
2423 for(Int_t il(0); il<AliTRDgeometry::kNlayer; il++) arr->AddAt(BuildMonitorContainerTrack(Form("MCtrk_Ly%d", il)), il);
31c8fa8a 2424
afca20ef 2425 // TRDin TRACK RESOLUTION
92d6d80c 2426 fContainer->AddAt(BuildMonitorContainerTrack("MCtrkIN"), kMCtrackIn);
1ee39b3a 2427
afca20ef 2428 // TRDout TRACK RESOLUTION
92d6d80c 2429 fContainer->AddAt(BuildMonitorContainerTrack("MCtrkOUT"), kMCtrackOut);
1ee39b3a 2430
2431 return fContainer;
2432}
2433
2589cf64 2434//________________________________________________________
fe1d1beb 2435Bool_t AliTRDresolution::Load(const Char_t *file, const Char_t *dir)
2589cf64 2436{
2437// Custom load function. Used to guess the segmentation level of the data.
2438
fe1d1beb 2439 if(!AliTRDrecoTask::Load(file, dir)) return kFALSE;
2589cf64 2440
2441 // look for cluster residual plot - always available
2442 TH3S* h3((TH3S*)((TObjArray*)fContainer->At(kClToTrk))->At(0));
2443 Int_t segmentation(h3->GetNbinsZ()/2);
2444 if(segmentation==fgkNresYsegm[0]){ // default segmentation. Nothing to do
2445 return kTRUE;
2446 } else if(segmentation==fgkNresYsegm[1]){ // stack segmentation.
2447 SetSegmentationLevel(1);
2448 } else if(segmentation==fgkNresYsegm[2]){ // detector segmentation.
2449 SetSegmentationLevel(2);
2450 } else {
2451 AliError(Form("Unknown segmentation [%d].", h3->GetNbinsZ()));
2452 return kFALSE;
2453 }
2454
2455 AliDebug(2, Form("Segmentation set to level \"%s\"", fgkResYsegmName[fSegmentLevel]));
2456 return kTRUE;
2457}
2458
2459
1ee39b3a 2460//________________________________________________________
2461Bool_t AliTRDresolution::Process(TH2 * const h2, TF1 *f, Float_t k, TGraphErrors **g)
2462{
2463 //
2464 // Do the processing
2465 //
2466
92c40e64 2467 Char_t pn[10]; sprintf(pn, "p%03d", fIdxPlot);
1ee39b3a 2468 Int_t n = 0;
2469 if((n=g[0]->GetN())) for(;n--;) g[0]->RemovePoint(n);
2470 if((n=g[1]->GetN())) for(;n--;) g[1]->RemovePoint(n);
2589cf64 2471 if(Int_t(h2->GetEntries())){
2472 AliDebug(4, Form("%s: g[%s %s]", pn, g[0]->GetName(), g[0]->GetTitle()));
2473 } else {
2474 AliDebug(2, Form("%s: g[%s %s]: Missing entries.", pn, g[0]->GetName(), g[0]->GetTitle()));
2475 fIdxPlot++;
2476 return kTRUE;
2477 }
1ee39b3a 2478
dfd7d48b 2479 const Int_t kINTEGRAL=1;
2480 for(Int_t ibin = 0; ibin < Int_t(h2->GetNbinsX()/kINTEGRAL); ibin++){
2481 Int_t abin(ibin*kINTEGRAL+1),bbin(abin+kINTEGRAL-1),mbin(abin+Int_t(kINTEGRAL/2));
2482 Double_t x = h2->GetXaxis()->GetBinCenter(mbin);
2483 TH1D *h = h2->ProjectionY(pn, abin, bbin);
068e2c00 2484 if((n=(Int_t)h->GetEntries())<150){
2589cf64 2485 AliDebug(4, Form(" x[%f] range[%d %d] stat[%d] low statistics !", x, abin, bbin, n));
2486 continue;
2487 }
1ee39b3a 2488 h->Fit(f, "QN");
1ee39b3a 2489 Int_t ip = g[0]->GetN();
2589cf64 2490 AliDebug(4, Form(" x_%d[%f] range[%d %d] stat[%d] M[%f] Sgm[%f]", ip, x, abin, bbin, n, f->GetParameter(1), f->GetParameter(2)));
1ee39b3a 2491 g[0]->SetPoint(ip, x, k*f->GetParameter(1));
2492 g[0]->SetPointError(ip, 0., k*f->GetParError(1));
2493 g[1]->SetPoint(ip, x, k*f->GetParameter(2));
2494 g[1]->SetPointError(ip, 0., k*f->GetParError(2));
1ee39b3a 2495/*
2496 g[0]->SetPoint(ip, x, k*h->GetMean());
2497 g[0]->SetPointError(ip, 0., k*h->GetMeanError());
2498 g[1]->SetPoint(ip, x, k*h->GetRMS());
2499 g[1]->SetPointError(ip, 0., k*h->GetRMSError());*/
2500 }
2501 fIdxPlot++;
2502 return kTRUE;
2503}
2504
2505//________________________________________________________
92c40e64 2506Bool_t AliTRDresolution::Process2D(ETRDresolutionPlot plot, Int_t idx, TF1 *f, Float_t k, Int_t gidx)
1ee39b3a 2507{
2508 //
2509 // Do the processing
2510 //
2511
2512 if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
2513
2514 // retrive containers
a310e49b 2515 TH2I *h2(NULL);
2516 if(idx<0){
2517 if(!(h2= (TH2I*)(fContainer->At(plot)))) return kFALSE;
2518 } else{
2519 TObjArray *a0(NULL);
2520 if(!(a0=(TObjArray*)(fContainer->At(plot)))) return kFALSE;
2521 if(!(h2=(TH2I*)a0->At(idx))) return kFALSE;
2522 }
2589cf64 2523 if(Int_t(h2->GetEntries())){
2524 AliDebug(2, Form("p[%d] idx[%d] : h[%s] %s", plot, idx, h2->GetName(), h2->GetTitle()));
2525 } else {
2526 AliDebug(2, Form("p[%d] idx[%d] : Missing entries.", plot, idx));
2527 return kFALSE;
2528 }
92c40e64 2529
1ee39b3a 2530 TGraphErrors *g[2];
92c40e64 2531 if(gidx<0) gidx=idx;
2532 if(!(g[0] = gidx<0 ? (TGraphErrors*)fGraphM->At(plot) : (TGraphErrors*)((TObjArray*)(fGraphM->At(plot)))->At(gidx))) return kFALSE;
1ee39b3a 2533
92c40e64 2534 if(!(g[1] = gidx<0 ? (TGraphErrors*)fGraphS->At(plot) : (TGraphErrors*)((TObjArray*)(fGraphS->At(plot)))->At(gidx))) return kFALSE;
1ee39b3a 2535
2536 return Process(h2, f, k, g);
2537}
2538
2539//________________________________________________________
2540Bool_t AliTRDresolution::Process3D(ETRDresolutionPlot plot, Int_t idx, TF1 *f, Float_t k)
2541{
2542 //
2543 // Do the processing
2544 //
2545
2546 if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
2547
2548 // retrive containers
a310e49b 2549 TH3S *h3(NULL);
2550 if(idx<0){
2551 if(!(h3= (TH3S*)(fContainer->At(plot)))) return kFALSE;
2552 } else{
2553 TObjArray *a0(NULL);
2554 if(!(a0=(TObjArray*)(fContainer->At(plot)))) return kFALSE;
2555 if(!(h3=(TH3S*)a0->At(idx))) return kFALSE;
2556 }
2589cf64 2557 if(Int_t(h3->GetEntries())){
2558 AliDebug(2, Form("p[%d] idx[%d] h[%s] %s", plot, idx, h3->GetName(), h3->GetTitle()));
2559 } else {
2560 AliDebug(2, Form("p[%d] idx[%d] : Missing entries.", plot, idx));
2561 return kFALSE;
2562 }
1ee39b3a 2563
2564 TObjArray *gm, *gs;
2565 if(!(gm = (TObjArray*)((TObjArray*)(fGraphM->At(plot)))->At(idx))) return kFALSE;
2566 if(!(gs = (TObjArray*)((TObjArray*)(fGraphS->At(plot)))->At(idx))) return kFALSE;
2567 TGraphErrors *g[2];
2568
2569 TAxis *az = h3->GetZaxis();
dfd7d48b 2570 for(Int_t iz(0); iz<gm->GetEntriesFast(); iz++){
2571 if(!(g[0] = (TGraphErrors*)gm->At(iz))) return kFALSE;
2572 if(!(g[1] = (TGraphErrors*)gs->At(iz))) return kFALSE;
2573 az->SetRange(iz+1, iz+1);
1ee39b3a 2574 if(!Process((TH2*)h3->Project3D("yx"), f, k, g)) return kFALSE;
2575 }
2576
2577 return kTRUE;
2578}
2579
92c40e64 2580
81979445 2581//________________________________________________________
2582Bool_t AliTRDresolution::Process3Dlinked(ETRDresolutionPlot plot, Int_t idx, TF1 *f, Float_t k)
2583{
2584 //
2585 // Do the processing
2586 //
2587
2588 if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
2589
2590 // retrive containers
2591 TH3S *h3(NULL);
2592 if(idx<0){
2593 if(!(h3= (TH3S*)(fContainer->At(plot)))) return kFALSE;
2594 } else{
2595 TObjArray *a0(NULL);
2596 if(!(a0=(TObjArray*)(fContainer->At(plot)))) return kFALSE;
2597 if(!(h3=(TH3S*)a0->At(idx))) return kFALSE;
2598 }
2589cf64 2599 if(Int_t(h3->GetEntries())){
2600 AliDebug(2, Form("p[%d] idx[%d] h[%s] %s", plot, idx, h3->GetName(), h3->GetTitle()));
2601 } else {
2602 AliDebug(2, Form("p[%d] idx[%d] : Missing entries.", plot, idx));
2603 return kFALSE;
2604 }
81979445 2605
2606 TObjArray *gm, *gs;
2607 if(!(gm = (TObjArray*)((TObjArray*)(fGraphM->At(plot)))->At(idx))) return kFALSE;
2608 if(!(gs = (TObjArray*)((TObjArray*)(fGraphS->At(plot)))->At(idx))) return kFALSE;
2609 TGraphErrors *g[2];
2610
2611 if(!(g[0] = (TGraphErrors*)gm->At(0))) return kFALSE;
2612 if(!(g[1] = (TGraphErrors*)gs->At(0))) return kFALSE;
2613 if(!Process((TH2*)h3->Project3D("yx"), f, k, g)) return kFALSE;
2614
2615 if(!(g[0] = (TGraphErrors*)gm->At(1))) return kFALSE;
2616 if(!(g[1] = (TGraphErrors*)gs->At(1))) return kFALSE;
2617 if(!Process((TH2*)h3->Project3D("zx"), f, k, g)) return kFALSE;
2618
2619 return kTRUE;
2620}
2621
2622
1ee39b3a 2623//________________________________________________________
2624Bool_t AliTRDresolution::Process3DL(ETRDresolutionPlot plot, Int_t idx, TF1 *f, Float_t k)
2625{
2626 //
2627 // Do the processing
2628 //
2629
2630 if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
2631
2632 // retrive containers
2633 TH3S *h3 = (TH3S*)((TObjArray*)fContainer->At(plot))->At(idx);
2634 if(!h3) return kFALSE;
92d6d80c 2635 AliDebug(2, Form("p[%d] idx[%d] h[%s] %s", plot, idx, h3->GetName(), h3->GetTitle()));
1ee39b3a 2636
2637 TGraphAsymmErrors *gm;
2638 TGraphErrors *gs;
2639 if(!(gm = (TGraphAsymmErrors*)((TObjArray*)fGraphM->At(plot))->At(0))) return kFALSE;
2640 if(!(gs = (TGraphErrors*)((TObjArray*)fGraphS->At(plot)))) return kFALSE;
2641
2642 Float_t x, r, mpv, xM, xm;
2643 TAxis *ay = h3->GetYaxis();
2644 for(Int_t iy=1; iy<=h3->GetNbinsY(); iy++){
2645 ay->SetRange(iy, iy);
2646 x = ay->GetBinCenter(iy);
2647 TH2F *h2=(TH2F*)h3->Project3D("zx");
2648 TAxis *ax = h2->GetXaxis();
2649 for(Int_t ix=1; ix<=h2->GetNbinsX(); ix++){
2650 r = ax->GetBinCenter(ix);
2651 TH1D *h1 = h2->ProjectionY("py", ix, ix);
2652 if(h1->Integral()<50) continue;
2653 h1->Fit(f, "QN");
2654
2655 GetLandauMpvFwhm(f, mpv, xm, xM);
2656 Int_t ip = gm->GetN();
2657 gm->SetPoint(ip, x, k*mpv);
2658 gm->SetPointError(ip, 0., 0., k*xm, k*xM);
2659 gs->SetPoint(ip, r, k*(xM-xm)/mpv);
2660 gs->SetPointError(ip, 0., 0.);
2661 }
2662 }
2663
2664 return kTRUE;
2665}
2666
2667//________________________________________________________
92d6d80c 2668Bool_t AliTRDresolution::Process2Darray(ETRDresolutionPlot plot, Int_t idx, TF1 *f, Float_t k)
2669{
2670 //
2671 // Do the processing
2672 //
2673
2674 if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
2675
2676 // retrive containers
2677 TObjArray *arr = (TObjArray*)(fContainer->At(plot));
2678 if(!arr) return kFALSE;
2679 AliDebug(2, Form("p[%d] idx[%d] arr[%s]", plot, idx, arr->GetName()));
2680
2681 TObjArray *gm, *gs;
2682 if(!(gm = (TObjArray*)((TObjArray*)(fGraphM->At(plot)))->At(idx))) return kFALSE;
2683 if(!(gs = (TObjArray*)((TObjArray*)(fGraphS->At(plot)))->At(idx))) return kFALSE;
2684
2685 TGraphErrors *g[2]; TH2I *h2(NULL); TObjArray *a0(NULL);
2686 for(Int_t ia(0); ia<arr->GetEntriesFast(); ia++){
2687 if(!(a0 = (TObjArray*)arr->At(ia))) continue;
2688
2689 if(!(h2 = (TH2I*)a0->At(idx))) return kFALSE;
2589cf64 2690 if(Int_t(h2->GetEntries())){
2691 AliDebug(4, Form(" idx[%d] h[%s] %s", ia, h2->GetName(), h2->GetTitle()));
2692 } else {
2693 AliDebug(2, Form(" idx[%d] : Missing entries.", ia));
2694 continue;
2695 }
92d6d80c 2696
2697 if(!(g[0] = (TGraphErrors*)gm->At(ia))) return kFALSE;
2698 if(!(g[1] = (TGraphErrors*)gs->At(ia))) return kFALSE;
2699 if(!Process(h2, f, k, g)) return kFALSE;
2700 }
2701
2702 return kTRUE;
2703}
2704
2705//________________________________________________________
2706Bool_t AliTRDresolution::Process3Darray(ETRDresolutionPlot plot, Int_t idx, TF1 *f, Float_t k)
1ee39b3a 2707{
2708 //
2709 // Do the processing
2710 //
2711
2712 if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
92c40e64 2713 //printf("Process4D : processing plot[%d] idx[%d]\n", plot, idx);
1ee39b3a 2714
2715 // retrive containers
92d6d80c 2716 TObjArray *arr = (TObjArray*)(fContainer->At(plot));
1ee39b3a 2717 if(!arr) return kFALSE;
92d6d80c 2718 AliDebug(2, Form("p[%d] idx[%d] arr[%s]", plot, idx, arr->GetName()));
1ee39b3a 2719
92c40e64 2720 TObjArray *gm, *gs;
2721 if(!(gm = (TObjArray*)((TObjArray*)(fGraphM->At(plot)))->At(idx))) return kFALSE;
2722 if(!(gs = (TObjArray*)((TObjArray*)(fGraphS->At(plot)))->At(idx))) return kFALSE;
1ee39b3a 2723
92d6d80c 2724 TGraphErrors *g[2]; TH3S *h3(NULL); TObjArray *a0(NULL);
2725 Int_t in(0);
2726 for(Int_t ia(0); ia<arr->GetEntriesFast(); ia++){
2727 if(!(a0 = (TObjArray*)arr->At(ia))) continue;
1ee39b3a 2728
92d6d80c 2729 if(!(h3 = (TH3S*)a0->At(idx))) return kFALSE;
2589cf64 2730 if(Int_t(h3->GetEntries())){
2731 AliDebug(4, Form(" idx[%d] h[%s] %s", ia, h3->GetName(), h3->GetTitle()));
2732 } else {
2733 AliDebug(2, Form(" idx[%d] : Missing entries.", ia));
2734 continue;
2735 }
1ee39b3a 2736 TAxis *az = h3->GetZaxis();
92c40e64 2737 for(Int_t iz=1; iz<=az->GetNbins(); iz++, in++){
dfd7d48b 2738 if(in >= gm->GetEntriesFast()) break;
92c40e64 2739 if(!(g[0] = (TGraphErrors*)gm->At(in))) return kFALSE;
2740 if(!(g[1] = (TGraphErrors*)gs->At(in))) return kFALSE;
1ee39b3a 2741 az->SetRange(iz, iz);
2742 if(!Process((TH2*)h3->Project3D("yx"), f, k, g)) return kFALSE;
2743 }
2744 }
92d6d80c 2745 AliDebug(2, Form("Projections [%d] from [%d]", in, gs->GetEntriesFast()));
1ee39b3a 2746
2747 return kTRUE;
2748}
2749
81979445 2750//________________________________________________________
2751Bool_t AliTRDresolution::Process3DlinkedArray(ETRDresolutionPlot plot, Int_t idx, TF1 *f, Float_t k)
2752{
2753 //
2754 // Do the processing
2755 //
2756
2757 if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
2758 //printf("Process4D : processing plot[%d] idx[%d]\n", plot, idx);
2759
2760 // retrive containers
2761 TObjArray *arr = (TObjArray*)(fContainer->At(plot));
2762 if(!arr) return kFALSE;
2763 AliDebug(2, Form("p[%d] idx[%d] arr[%s]", plot, idx, arr->GetName()));
2764
2765 TObjArray *gm, *gs;
2766 if(!(gm = (TObjArray*)((TObjArray*)(fGraphM->At(plot)))->At(idx))) return kFALSE;
2767 if(!(gs = (TObjArray*)((TObjArray*)(fGraphS->At(plot)))->At(idx))) return kFALSE;
2768
2769 TGraphErrors *g[2]; TH3S *h3(NULL); TObjArray *a0(NULL);
2770 Int_t in(0);
2771 for(Int_t ia(0); ia<arr->GetEntriesFast(); ia++){
2772 if(!(a0 = (TObjArray*)arr->At(ia))) continue;
2773 if(!(h3 = (TH3S*)a0->At(idx))) return kFALSE;
2589cf64 2774 if(Int_t(h3->GetEntries())){
2775 AliDebug(4, Form(" idx[%d] h[%s] %s", ia, h3->GetName(), h3->GetTitle()));
2776 } else {
2777 AliDebug(2, Form(" idx[%d] : Missing entries.", ia));
2778 continue;
2779 }
81979445 2780 if(!(g[0] = (TGraphErrors*)gm->At(in))) return kFALSE;
2781 if(!(g[1] = (TGraphErrors*)gs->At(in))) return kFALSE;
2782 if(!Process((TH2*)h3->Project3D("yx"), f, k, g)) return kFALSE;
2783 in++;
2784
2785 if(!(g[0] = (TGraphErrors*)gm->At(in))) return kFALSE;
2786 if(!(g[1] = (TGraphErrors*)gs->At(in))) return kFALSE;
2787 if(!Process((TH2*)h3->Project3D("zx"), f, k, g)) return kFALSE;
2788 in++;
2789 }
2790 AliDebug(2, Form("Projections [%d] from [%d]", in, gs->GetEntriesFast()));
2791
2792 return kTRUE;
2793}
2794
1ee39b3a 2795//________________________________________________________
a310e49b 2796Bool_t AliTRDresolution::GetGraph(Float_t *bb, ETRDresolutionPlot ip, Int_t idx, Bool_t kLEG, const Char_t *explain)
1ee39b3a 2797{
2798 //
2799 // Get the graphs
2800 //
2801
2802 if(!fGraphS || !fGraphM) return kFALSE;
a310e49b 2803 // axis titles look up
1ee39b3a 2804 Int_t nref = 0;
92c40e64 2805 for(Int_t jp=0; jp<(Int_t)ip; jp++) nref+=fgNproj[jp];
1ee39b3a 2806 UChar_t jdx = idx<0?0:idx;
92c40e64 2807 for(Int_t jc=0; jc<TMath::Min(jdx,fgNproj[ip]-1); jc++) nref++;
2589cf64 2808 Char_t **at = fAxTitle[nref];
1ee39b3a 2809
a310e49b 2810 // build legends if requiered
2811 TLegend *leg(NULL);
2812 if(kLEG){
2813 leg=new TLegend(.65, .6, .95, .9);
2814 leg->SetBorderSize(0);
2815 leg->SetFillStyle(0);
2816 }
2817 // build frame
2818 TH1S *h1(NULL);
2819 h1 = new TH1S(Form("h1TF_%02d", fIdxFrame++), Form("%s %s;%s;%s", at[0], explain?explain:"", at[1], at[2]), 2, bb[0], bb[2]);
2820 h1->SetMinimum(bb[1]);h1->SetMaximum(bb[3]);
2821 h1->SetLineColor(kBlack); h1->SetLineWidth(1);h1->SetLineStyle(2);
2822 // axis range
2823 TAxis *ax = h1->GetXaxis();
2824 ax->CenterTitle();ax->SetMoreLogLabels();ax->SetTitleOffset(1.2);
2825 ax = h1->GetYaxis();
2826 ax->SetRangeUser(bb[1], bb[3]);
2827 ax->CenterTitle(); ax->SetTitleOffset(1.4);
2828 h1->Draw();
2829 // bounding box
2830 TBox *b = new TBox(-.15, bb[1], .15, bb[3]);
2831 b->SetFillStyle(3002);b->SetLineColor(0);
2832 b->SetFillColor(ip<=Int_t(kMCcluster)?kGreen:kBlue);
2833 b->Draw();
2834
2835 TGraphErrors *gm = idx<0 ? (TGraphErrors*)fGraphM->At(ip) : (TGraphErrors*)((TObjArray*)(fGraphM->At(ip)))->At(idx);
2836 if(!gm) return kFALSE;
2837 TGraphErrors *gs = idx<0 ? (TGraphErrors*)fGraphS->At(ip) : (TGraphErrors*)((TObjArray*)(fGraphS->At(ip)))->At(idx);
2838 if(!gs) return kFALSE;
2839
2840 Int_t n(0), nPlots(0);
1ee39b3a 2841 if((n=gm->GetN())) {
a310e49b 2842 nPlots++;
2843 gm->Draw("pl"); if(leg) leg->AddEntry(gm, gm->GetTitle(), "pl");
1ee39b3a 2844 PutTrendValue(Form("%s_%s", fgPerformanceName[ip], at[0]), gm->GetMean(2));
2845 PutTrendValue(Form("%s_%sRMS", fgPerformanceName[ip], at[0]), gm->GetRMS(2));
2846 }
2847
2848 if((n=gs->GetN())){
a310e49b 2849 nPlots++;
2850 gs->Draw("pl"); if(leg) leg->AddEntry(gs, gs->GetTitle(), "pl");
1ee39b3a 2851 gs->Sort(&TGraph::CompareY);
2852 PutTrendValue(Form("%s_%sSigMin", fgPerformanceName[ip], at[0]), gs->GetY()[0]);
2853 PutTrendValue(Form("%s_%sSigMax", fgPerformanceName[ip], at[0]), gs->GetY()[n-1]);
2854 gs->Sort(&TGraph::CompareX);
2855 }
a310e49b 2856 if(!nPlots) return kFALSE;
2857 if(leg) leg->Draw();
1ee39b3a 2858 return kTRUE;
2859}
2860
1ee39b3a 2861//________________________________________________________
92d6d80c 2862Bool_t AliTRDresolution::GetGraphArray(Float_t *bb, ETRDresolutionPlot ip, Int_t idx, Bool_t kLEG, Int_t n, Int_t *sel, const Char_t *explain)
1ee39b3a 2863{
2864 //
2865 // Get the graphs
2866 //
2867
2868 if(!fGraphS || !fGraphM) return kFALSE;
2869
2870 // axis titles look up
92c40e64 2871 Int_t nref(0);
92d6d80c 2872 for(Int_t jp(0); jp<ip; jp++) nref+=fgNproj[jp];
92c40e64 2873 nref+=idx;
2589cf64 2874 Char_t **at = fAxTitle[nref];
92c40e64 2875
92d6d80c 2876 // build legends if requiered
31c8fa8a 2877 TLegend *legM(NULL), *legS(NULL);
92c40e64 2878 if(kLEG){
1295b37f 2879 legM=new TLegend(.35, .6, .65, .9);
31c8fa8a 2880 legM->SetHeader("Mean");
92d6d80c 2881 legM->SetBorderSize(0);
2882 legM->SetFillStyle(0);
1295b37f 2883 legS=new TLegend(.65, .6, .95, .9);
31c8fa8a 2884 legS->SetHeader("Sigma");
92d6d80c 2885 legS->SetBorderSize(0);
2886 legS->SetFillStyle(0);
1ee39b3a 2887 }
92d6d80c 2888 // build frame
92c40e64 2889 TH1S *h1(NULL);
92d6d80c 2890 h1 = new TH1S(Form("h1TF_%02d", fIdxFrame++), Form("%s %s;%s;%s", at[0], explain?explain:"", at[1], at[2]), 2, bb[0], bb[2]);
92c40e64 2891 h1->SetMinimum(bb[1]);h1->SetMaximum(bb[3]);
2892 h1->SetLineColor(kBlack); h1->SetLineWidth(1);h1->SetLineStyle(2);
1ee39b3a 2893 // axis range
92c40e64 2894 TAxis *ax = h1->GetXaxis();
1295b37f 2895 ax->CenterTitle();ax->SetMoreLogLabels();ax->SetTitleOffset(1.2);
92c40e64 2896 ax = h1->GetYaxis();
1ee39b3a 2897 ax->SetRangeUser(bb[1], bb[3]);
1295b37f 2898 ax->CenterTitle(); ax->SetTitleOffset(1.4);
92c40e64 2899 h1->Draw();
92d6d80c 2900
2901 TGraphErrors *gm(NULL), *gs(NULL);
2902 TObjArray *a0(NULL), *a1(NULL);
2903 a0 = (TObjArray*)((TObjArray*)fGraphM->At(ip))->At(idx);
2904 a1 = (TObjArray*)((TObjArray*)fGraphS->At(ip))->At(idx);
2905 if(!n) n=a0->GetEntriesFast();
2906 AliDebug(4, Form("Graph : Ref[%d] Title[%s] Limits{x[%f %f] y[%f %f]} Comp[%d] Selection[%c]", nref, at[0], bb[0], bb[2], bb[1], bb[3], n, sel ? 'y' : 'n'));
2907 Int_t nn(0), nPlots(0);
2908 for(Int_t is(0), is0(0); is<n; is++){
2909 is0 = sel ? sel[is] : is;
2910 if(!(gs = (TGraphErrors*)a1->At(is0))) return kFALSE;
2911 if(!(gm = (TGraphErrors*)a0->At(is0))) return kFALSE;
1ee39b3a 2912
92c40e64 2913 if((nn=gs->GetN())){
92d6d80c 2914 nPlots++;
a310e49b 2915 gs->Draw("pc");
2916 if(legS){
2917 //printf("LegEntry %s [%s]%s\n", at[0], gs->GetName(), gs->GetTitle());
2918 legS->AddEntry(gs, gs->GetTitle(), "pl");
2919 }
92c40e64 2920 gs->Sort(&TGraph::CompareY);
92d6d80c 2921 PutTrendValue(Form("%s_%sSigMin", fgPerformanceName[kMCtrack], at[0]), gs->GetY()[0]);
2922 PutTrendValue(Form("%s_%sSigMax", fgPerformanceName[kMCtrack], at[0]), gs->GetY()[nn-1]);
92c40e64 2923 gs->Sort(&TGraph::CompareX);
2924 }
2925 if(gm->GetN()){
92d6d80c 2926 nPlots++;
a310e49b 2927 gm->Draw("pc");
2928 if(legM){
2929 //printf("LegEntry %s [%s]%s\n", at[0], gm->GetName(), gm->GetTitle());
2930 legM->AddEntry(gm, gm->GetTitle(), "pl");
2931 }
92d6d80c 2932 PutTrendValue(Form("%s_%s", fgPerformanceName[kMCtrack], at[0]), gm->GetMean(2));
2933 PutTrendValue(Form("%s_%sRMS", fgPerformanceName[kMCtrack], at[0]), gm->GetRMS(2));
92c40e64 2934 }
2935 }
92d6d80c 2936 if(!nPlots) return kFALSE;
92c40e64 2937 if(kLEG){
92d6d80c 2938 legM->Draw();
2939 legS->Draw();
1ee39b3a 2940 }
1ee39b3a 2941 return kTRUE;
2942}
2943
2944//________________________________________________________
2945void AliTRDresolution::GetLandauMpvFwhm(TF1 * const f, Float_t &mpv, Float_t &xm, Float_t &xM)
2946{
2947 //
2948 // Get the most probable value and the full width half mean
2949 // of a Landau distribution
2950 //
2951
2952 const Float_t dx = 1.;
2953 mpv = f->GetParameter(1);
2954 Float_t fx, max = f->Eval(mpv);
2955
2956 xm = mpv - dx;
2957 while((fx = f->Eval(xm))>.5*max){
2958 if(fx>max){
2959 max = fx;
2960 mpv = xm;
2961 }
2962 xm -= dx;
2963 }
2964
2965 xM += 2*(mpv - xm);
2966 while((fx = f->Eval(xM))>.5*max) xM += dx;
2967}
2968
2969
2970//________________________________________________________
2971void AliTRDresolution::SetRecoParam(AliTRDrecoParam *r)
2972{
2973
2974 fReconstructor->SetRecoParam(r);
2975}
2589cf64 2976
2977
2978//________________________________________________________
2979void AliTRDresolution::SetSegmentationLevel(Int_t l)
2980{
2981// Setting the segmentation level to "l"
2982 fSegmentLevel = l;
2983
2984 UShort_t const lNcomp[kNprojs] = {
2985 1, 1, //2,
2986 fgkNresYsegm[fSegmentLevel], 2, //2,
2987 2*fgkNresYsegm[fSegmentLevel], 2, 2, 2, 1, //5,
2988 2*fgkNresYsegm[fSegmentLevel], 2, 2, 2, 1, //5,
2989 2*fgkNresYsegm[fSegmentLevel], 2, 2, 2, 1, //5,
2990 // MC
2991 fgkNresYsegm[fSegmentLevel], 2, //2,
2992 fgkNresYsegm[fSegmentLevel], 2, 2, 2, 1, //5,
2993 fgkNresYsegm[fSegmentLevel], 2, 2, 2, 1, 1, 1, 1, 11, 11, 11, //11
2994 fgkNresYsegm[fSegmentLevel], 2, 2, 2, 1, 1, 1, 1, 11, 11, 11, //11
2995 6*fgkNresYsegm[fSegmentLevel], 6*2, 6*2, 6*2, 6, 6, 6, 6, 6*11, 6*11, 6*11 //11
2996 };
2997 memcpy(fNcomp, lNcomp, kNprojs*sizeof(UShort_t));
2998
2999 Char_t const *lAxTitle[kNprojs][4] = {
3000 // Charge
3001 {"Impv", "x [cm]", "I_{mpv}", "x/x_{0}"}
3002 ,{"dI/Impv", "x/x_{0}", "#delta I/I_{mpv}", "x[cm]"}
3003 // Clusters to Kalman
3004 ,{"Cluster2Track residuals", "tg(#phi)", "y [#mum]", "#sigma_{y} [#mum]"}
3005 ,{"Cluster2Track YZ pulls", fgkResYsegmName[fSegmentLevel], "y / z", "#sigma_{y}"}
3006 // TRD tracklet to Kalman fit
3007 ,{"Tracklet2Track Y residuals", "tg(#phi)", "y [#mum]", "#sigma_{y} [#mum]"}
3008 ,{"Tracklet2Track YZ pulls", fgkResYsegmName[fSegmentLevel], "y / z", "#sigma_{y}"}
3009 ,{"Tracklet2Track Z residuals", "tg(#theta)", "z [#mum]", "#sigma_{z} [#mum]"}
3010 ,{"Tracklet2Track Z pulls", "tg(#theta)", "z", "#sigma_{z}"}
3011 ,{"Tracklet2Track Phi residuals", "tg(#phi)", "#phi [mrad]", "#sigma_{#phi} [mrad]"}
3012 // TRDin 2 first TRD tracklet
3013 ,{"Tracklet2Track Y residuals @ TRDin", "tg(#phi)", "y [#mum]", "#sigma_{y} [#mum]"}
3014 ,{"Tracklet2Track YZ pulls @ TRDin", fgkResYsegmName[fSegmentLevel], "y / z", "#sigma_{y}"}
3015 ,{"Tracklet2Track Z residuals @ TRDin", "tg(#theta)", "z [#mum]", "#sigma_{z} [#mum]"}
3016 ,{"Tracklet2Track Z pulls @ TRDin", "tg(#theta)", "z", "#sigma_{z}"}
3017 ,{"Tracklet2Track Phi residuals @ TRDin", "tg(#phi)", "#phi [mrad]", "#sigma_{#phi} [mrad]"}
3018 // TRDout 2 first TRD tracklet
3019 ,{"Tracklet2Track Y residuals @ TRDout", "tg(#phi)", "y [#mum]", "#sigma_{y} [#mum]"}
3020 ,{"Tracklet2Track YZ pulls @ TRDout", fgkResYsegmName[fSegmentLevel], "y / z", "#sigma_{y}"}
3021 ,{"Tracklet2Track Z residuals @ TRDout", "tg(#theta)", "z [#mum]", "#sigma_{z} [#mum]"}
3022 ,{"Tracklet2Track Z pulls @ TRDout", "tg(#theta)", "z", "#sigma_{z}"}
3023 ,{"Tracklet2Track Phi residuals @ TRDout", "tg(#phi)", "#phi [mrad]", "#sigma_{#phi} [mrad]"}
3024 // MC cluster
3025 ,{"MC Cluster Y resolution", "tg(#phi)", "y [#mum]", "#sigma_{y} [#mum]"}
3026 ,{"MC Cluster YZ pulls", fgkResYsegmName[fSegmentLevel], "y / z", "#sigma_{y}"}
3027 // MC tracklet
3028 ,{"MC Tracklet Y resolution", "tg(#phi)", "y [#mum]", "#sigma_{y}[#mum]"}
3029 ,{"MC Tracklet YZ pulls", fgkResYsegmName[fSegmentLevel], "y / z", "#sigma_{y}"}
3030 ,{"MC Tracklet Z resolution", "tg(#theta)", "z [#mum]", "#sigma_{z} [#mum]"}
3031 ,{"MC Tracklet Z pulls", "tg(#theta)", "z", "#sigma_{z}"}
3032 ,{"MC Tracklet Phi resolution", "tg(#phi)", "#phi [mrad]", "#sigma_{#phi} [mrad]"}
3033 // MC track TRDin
3034 ,{"MC Y resolution @ TRDin", "tg(#phi)", "y [#mum]", "#sigma_{y}[#mum]"}
3035 ,{"MC YZ pulls @ TRDin", fgkResYsegmName[fSegmentLevel], "y / z", "#sigma_{y}"}
3036 ,{"MC Z resolution @ TRDin", "tg(#theta)", "z [#mum]", "#sigma_{z} [#mum]"}
3037 ,{"MC Z pulls @ TRDin", "tg(#theta)", "z", "#sigma_{z}"}
3038 ,{"MC #Phi resolution @ TRDin", "tg(#phi)", "#phi [mrad]", "#sigma_{#phi} [mrad]"}
3039 ,{"MC SNP pulls @ TRDin", "tg(#phi)", "SNP", "#sigma_{snp}"}
3040 ,{"MC #Theta resolution @ TRDin", "tg(#theta)", "#theta [mrad]", "#sigma_{#theta} [mrad]"}
3041 ,{"MC TGL pulls @ TRDin", "tg(#theta)", "TGL", "#sigma_{tgl}"}
3042 ,{"MC P_{t} resolution @ TRDin", "p_{t}^{MC} [GeV/c]", "(p_{t}^{REC}-p_{t}^{MC})/p_{t}^{MC} [%]", "MC: #sigma^{TPC}(#Deltap_{t}/p_{t}^{MC}) [%]"}
3043 ,{"MC 1/P_{t} pulls @ TRDin", "1/p_{t}^{MC} [c/GeV]", "1/p_{t}^{REC}-1/p_{t}^{MC}", "MC PULL: #sigma_{1/p_{t}}^{TPC}"}
3044 ,{"MC P resolution @ TRDin", "p^{MC} [GeV/c]", "(p^{REC}-p^{MC})/p^{MC} [%]", "MC: #sigma^{TPC}(#Deltap/p^{MC}) [%]"}
3045 // MC track TRDout
3046 ,{"MC Y resolution @ TRDout", "tg(#phi)", "y [#mum]", "#sigma_{y}[#mum]"}
3047 ,{"MC YZ pulls @ TRDout", fgkResYsegmName[fSegmentLevel], "y / z", "#sigma_{y}"}
3048 ,{"MC Z resolution @ TRDout", "tg(#theta)", "z [#mum]", "#sigma_{z} [#mum]"}
3049 ,{"MC Z pulls @ TRDout", "tg(#theta)", "z", "#sigma_{z}"}
3050 ,{"MC #Phi resolution @ TRDout", "tg(#phi)", "#phi [mrad]", "#sigma_{#phi} [mrad]"}
3051 ,{"MC SNP pulls @ TRDout", "tg(#phi)", "SNP", "#sigma_{snp}"}
3052 ,{"MC #Theta resolution @ TRDout", "tg(#theta)", "#theta [mrad]", "#sigma_{#theta} [mrad]"}
3053 ,{"MC TGL pulls @ TRDout", "tg(#theta)", "TGL", "#sigma_{tgl}"}
3054 ,{"MC P_{t} resolution @ TRDout", "p_{t}^{MC} [GeV/c]", "(p_{t}^{REC}-p_{t}^{MC})/p_{t}^{MC} [%]", "MC: #sigma^{TPC}(#Deltap_{t}/p_{t}^{MC}) [%]"}
3055 ,{"MC 1/P_{t} pulls @ TRDout", "1/p_{t}^{MC} [c/GeV]", "1/p_{t}^{REC}-1/p_{t}^{MC}", "MC PULL: #sigma_{1/p_{t}}^{TPC}"}
3056 ,{"MC P resolution @ TRDout", "p^{MC} [GeV/c]", "(p^{REC}-p^{MC})/p^{MC} [%]", "MC: #sigma^{TPC}(#Deltap/p^{MC}) [%]"}
3057 // MC track in TRD
3058 ,{"MC Track Y resolution", "tg(#phi)", "y [#mum]", "#sigma_{y} [#mum]"}
3059 ,{"MC Track YZ pulls", fgkResYsegmName[fSegmentLevel], "y / z", "#sigma_{y}"}
3060 ,{"MC Track Z resolution", "tg(#theta)", "z [#mum]", "#sigma_{z} [#mum]"}
3061 ,{"MC Track Z pulls", "tg(#theta)", "z", "#sigma_{z}"}
3062 ,{"MC Track #Phi resolution", "tg(#phi)", "#phi [mrad]", "#sigma_{#phi} [mrad]"}
3063 ,{"MC Track SNP pulls", "tg(#phi)", "SNP", "#sigma_{snp}"}
3064 ,{"MC Track #Theta resolution", "tg(#theta)", "#theta [mrad]", "#sigma_{#theta} [mrad]"}
3065 ,{"MC Track TGL pulls", "tg(#theta)", "TGL", "#sigma_{tgl}"}
3066 ,{"MC P_{t} resolution", "p_{t} [GeV/c]", "(p_{t}^{REC}-p_{t}^{MC})/p_{t}^{MC} [%]", "#sigma(#Deltap_{t}/p_{t}^{MC}) [%]"}
3067 ,{"MC 1/P_{t} pulls", "1/p_{t}^{MC} [c/GeV]", "1/p_{t}^{REC} - 1/p_{t}^{MC}", "#sigma_{1/p_{t}}"}
3068 ,{"MC P resolution", "p [GeV/c]", "(p^{REC}-p^{MC})/p^{MC} [%]", "#sigma(#Deltap/p^{MC}) [%]"}
3069 };
3070 memcpy(fAxTitle, lAxTitle, 4*kNprojs*sizeof(Char_t*));
3071}