FairRoot/PandaRoot
PndFTSParticlePerformanceBase.cxx
Go to the documentation of this file.
1 // $Id: PndFTSCAPerformanceBase.cxx,v 1.11 2010/08/26 15:05:50 ikulakov Exp $
2 // **************************************************************************
3 // This file is property of and copyright by the ALICE HLT Project *
4 // ALICE Experiment at CERN, All rights reserved. *
5 // *
6 // Primary Authors: Sergey Gorbunov <sergey.gorbunov@kip.uni-heidelberg.de> *
7 // Ivan Kisel <kisel@kip.uni-heidelberg.de> *
8 // for The ALICE HLT Project. *
9 // *
10 // Developed by: Igor Kulakov <I.Kulakov@gsi.de> *
11 // Maksym Zyzak <M.Zyzak@gsi.de> *
12 // *
13 // Permission to use, copy, modify and distribute this software and its *
14 // documentation strictly for non-commercial purposes is hereby granted *
15 // without fee, provided that the above copyright notice appears in all *
16 // copies and that both the copyright notice and this permission notice *
17 // appear in the supporting documentation. The authors make no claims *
18 // about the suitability of this software for any purpose. It is *
19 // provided "as is" without express or implied warranty. *
20 // *
21 //***************************************************************************
22 #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE
23 
24 #include "PndFTSCounters.h"
25 
27 #include "PndFTSPerformanceBase.h"
28 
29 #include "PndFTSCAGBHit.h"
30 #include "PndFTSCAMCTrack.h"
31 #ifndef HLTCA_STANDALONE
32 #include "PndFTSCAMCPoint.h"
33 #endif
34 
35 #include "PndFTSCAGBTrack.h"
36 #include "PndFTSCAGBTracker.h"
37 
38 #include "PndFTSCADisplay.h"
39 
40 
41 #include "TMath.h"
42 #include "TROOT.h"
43 #include "Riostream.h"
44 #include "TFile.h"
45 #include "TH1.h"
46 #include "TH2.h"
47 #include "TProfile.h"
48 #include "TStyle.h"
49 
50 
51 PndFTSParticlePerformanceBase::PndFTSParticlePerformanceBase()
52 {
53  const int NHisto_tmp = NTrackPulls + NTrackPullsAtProdVertex + NVertexPulls;
54 
55  NHisto = NHisto_tmp;
56  fHistosInfo = new THistoInfo[NHisto];
57  fHistos = new TH1*[NHisto];
58 
59  const float coeff1 = 10;
60  const THistoInfo tmp[NHisto_tmp]=
61  {
62  THistoInfo( "resX", "track X resolution [cm]", 30, -0.25, 0.25 ),
63  THistoInfo( "resY", "track Y resolution [cm]", 30, -0.25, 0.25 ),
64  THistoInfo( "resZ", "track Z resolution [cm]", 30, -0.7, 0.7 ),
65  THistoInfo( "resPx", "track Px resolution", 30, -0.3, 0.3 ),
66  THistoInfo( "resPy", "track Py resolution", 30, -0.3, 0.3 ),
67  THistoInfo( "resPz", "track Pz resolution", 30, -0.3, 0.3 ),
68  THistoInfo( "pullX", "track X pull", 30, -7., 7. ),
69  THistoInfo( "pullY", "track Y pull", 30, -7., 7. ),
70  THistoInfo( "pullZ", "track Z pull", 30, -7., 7. ),
71  THistoInfo( "pullPx", "track Px pull", 30, -7., 7. ),
72  THistoInfo( "pullPy", "track Py pull", 30, -7., 7. ),
73  THistoInfo( "pullPz", "track Pz pull", 30, -7., 7. ),
74 
75  THistoInfo( "resAtProdPointX", "track X resolution at prodaction point [cm]", 30, -0.25*coeff1, 0.25*coeff1 ),
76  THistoInfo( "resAtProdPointY", "track Y resolution at prodaction point [cm]", 30, -0.25*coeff1, 0.25*coeff1 ),
77  THistoInfo( "resAtProdPointZ", "track Z resolution at prodaction point [cm]", 30, -0.7*coeff1, 0.7*coeff1 ),
78  THistoInfo( "resAtProdPointPx", "track Px resolution at prodaction point", 30, -0.3, 0.3 ),
79  THistoInfo( "resAtProdPointPy", "track Py resolution at prodaction point", 30, -0.3, 0.3 ),
80  THistoInfo( "resAtProdPointPz", "track Pz resolution at prodaction point", 30, -0.3, 0.3 ),
81  THistoInfo( "pullAtProdPointX", "track X pull at prodaction point", 30, -7., 7. ),
82  THistoInfo( "pullAtProdPointY", "track Y pull at prodaction point", 30, -7., 7. ),
83  THistoInfo( "pullAtProdPointZ", "track Z pull at prodaction point", 30, -7., 7. ),
84  THistoInfo( "pullAtProdPointPx", "track Px pull at prodaction point", 30, -7., 7. ),
85  THistoInfo( "pullAtProdPointPy", "track Py pull at prodaction point", 30, -7., 7. ),
86  THistoInfo( "pullAtProdPointPz", "track Pz pull at prodaction point", 30, -7., 7. ),
87 
88  THistoInfo( "resVertexX", "vertex X resolution [cm]", 30, -0.25, 0.25 ),
89  THistoInfo( "resVertexY", "vertex Y resolution [cm]", 30, -0.25, 0.25 ),
90  THistoInfo( "resVertexZ", "vertex Z resolution [cm]", 30, -0.7, 0.7 ),
91  THistoInfo( "pullVertexX", "vertex X pull", 30, -7., 7. ),
92  THistoInfo( "pullVertexY", "vertex Y pull", 30, -7., 7. ),
93  THistoInfo( "pullVertexZ", "vertex Z pull", 30, -7., 7. )
94  };
95 
96  for (int iHisto = 0; iHisto < NHisto; iHisto++){
97  fHistosInfo[iHisto] = tmp[iHisto];
98  }
99 
100  for( int i=0; i < NHisto; i++ ){
101  fHistos[i] = 0;
102  }
103 }
104 
105 
106 void PndFTSParticlePerformanceBase::CreateHistos(string histoDir, TFile* outFile)
107 {
108  TDirectory *curdir = gDirectory;
109  if ( (histoDir != "") && outFile) { // create in file
110  outFile->cd();
111  fHistoDir = outFile->mkdir( TString(histoDir) );
112  fHistoDir->cd();
113  gDirectory->mkdir( "TrackInput" );
114  gDirectory->cd( "TrackInput" );
115 
116  int ih = 0; // i of Histo
117  for( int i = 0; i < NTrackPulls; i++, ih++ ){
118  fHistos[ih] = new TH1D(fHistosInfo[ih].name, fHistosInfo[ih].title, fHistosInfo[ih].nx, fHistosInfo[ih].left, fHistosInfo[ih].right);
119  }
120 
121  gDirectory->cd( ".." );
122  gDirectory->mkdir( "TrackAtVertex" );
123  gDirectory->cd( "TrackAtVertex" );
124 
125  for( int i = 0; i < NTrackPullsAtProdVertex; i++, ih++ ){
126  fHistos[ih] = new TH1D(fHistosInfo[ih].name, fHistosInfo[ih].title, fHistosInfo[ih].nx, fHistosInfo[ih].left, fHistosInfo[ih].right);
127  }
128 
129  gDirectory->cd( ".." );
130  gDirectory->mkdir( "Vertex" );
131  gDirectory->cd( "Vertex" );
132 
133  for( int i = 0; i < NVertexPulls; i++, ih++ ){
134  fHistos[ih] = new TH1D(fHistosInfo[ih].name, fHistosInfo[ih].title, fHistosInfo[ih].nx, fHistosInfo[ih].left, fHistosInfo[ih].right);
135  }
136 
137  gDirectory->cd( ".." );
138 
139 
140  gDirectory->mkdir("KFParticlesFinder");
141  gDirectory->cd("KFParticlesFinder");
142  histodir = gDirectory;
143  gDirectory->mkdir("Particles");
144  gDirectory->cd("Particles");
145  {
146  for(int iPart=0; iPart<fParteff.nParticles; ++iPart)
147  {
148  gDirectory->mkdir(fParteff.partName[iPart].Data());
149  gDirectory->cd(fParteff.partName[iPart].Data());
150  {
151  TString res = "res";
152  TString pull = "pull";
153 
154  gDirectory->mkdir("DaughtersQA");
155  gDirectory->cd("DaughtersQA");
156  {
157  TString parName[nFitQA/2] = {"X","Y","Z","Px","Py","Pz","E","M"};
158  int nBins = 100;
159 // float xMax[nFitQA/2] = {0.15,0.15,0.03,0.01,0.01,0.06,0.06,0.01};
160  float xMax[nFitQA/2] = {2.,2.,5.,0.3,0.3,0.3,0.03,0.03};
161 
162  for( int iH=0; iH<nFitQA/2; iH++ ){
163  hFitDaughtersQA[iPart][iH] = new TH1F((res+parName[iH]).Data(),
164  (res+parName[iH]).Data(),
165  nBins, -xMax[iH],xMax[iH]);
166  hFitDaughtersQA[iPart][iH+8] = new TH1F((pull+parName[iH]).Data(),
167  (pull+parName[iH]).Data(),
168  nBins, -6,6);
169  }
170  }
171  gDirectory->cd(".."); //particle directory
172 
173  gDirectory->mkdir("FitQA");
174  gDirectory->cd("FitQA");
175  {
176  TString parName[nFitQA/2] = {"X","Y","Z","Px","Py","Pz","E","M"};
177  int nBins = 50;
178 // float xMax[nFitQA/2] = {0.15,0.15,1.2,0.02,0.02,0.15,0.15,0.006};
179  float xMax[nFitQA/2] = {2.,2.,5.,0.3,0.3,0.3,0.03,0.03};
180 
181  for( int iH=0; iH<nFitQA/2; iH++ ){
182  hFitQA[iPart][iH] = new TH1F((res+parName[iH]).Data(),
183  (res+parName[iH]).Data(),
184  nBins, -xMax[iH],xMax[iH]);
185  hFitQA[iPart][iH+8] = new TH1F((pull+parName[iH]).Data(),
186  (pull+parName[iH]).Data(),
187  nBins, -6,6);
188  }
189  }
190  gDirectory->cd(".."); //particle directory
191 
192  gDirectory->mkdir("Parameters");
193  gDirectory->cd("Parameters");
194  {
195  TString parName[nHistoPartParam] = {"M","p","p_{t}","y","DL","c#tau","chi2ndf","prob","#theta","phi","z","l/dl"};
196  TString parAxisName[nHistoPartParam] = {"m [GeV/c^{2}]","p [GeV/c]","p_{t} [GeV/c]",
197  "y","Decay length [cm]","Life time c#tau [cm]",
198  "chi2/ndf","prob","#theta [rad]",
199  "phi [rad]","z [cm]", "l/dl"};
200  int nBins[nHistoPartParam] = {1000,100,100,100,100,100,100,100,100,100,100,1000};
201  float xMin[nHistoPartParam] = {fParteff.partMHistoMin[iPart], 0., 0., 0., -5., 0., 0., 0., -2., -2., -5., -1.};
202  float xMax[nHistoPartParam] = {fParteff.partMHistoMax[iPart], 10., 3., 6., 55., 30., 20., 1., 2., 2., 55., 35.};
203 
204  for(int iH=0; iH<nHistoPartParam; iH++)
205  {
206  hPartParam[iPart][iH] = new TH1F(parName[iH].Data(),parName[iH].Data(),
207  nBins[iH],xMin[iH],xMax[iH]);
208  hPartParam[iPart][iH]->GetXaxis()->SetTitle(parAxisName[iH].Data());
209  }
210 
211  hPartParam2D[iPart][0] = new TH2F("y-p_{t}","y-p_{t}",
212  nBins[3],xMin[3],xMax[3],
213  nBins[2],xMin[2],xMax[2]);
214  hPartParam2D[iPart][0]->GetXaxis()->SetTitle("y");
215  hPartParam2D[iPart][0]->GetYaxis()->SetTitle("p_{t} [GeV/c]");
216 
217  gDirectory->mkdir("Signal");
218  gDirectory->cd("Signal");
219  {
220  for(int iH=0; iH<nHistoPartParam; iH++)
221  {
222  hPartParamSignal[iPart][iH] = new TH1F((parName[iH]).Data(),(parName[iH]).Data(),
223  nBins[iH],xMin[iH],xMax[iH]);
224  hPartParamSignal[iPart][iH]->GetXaxis()->SetTitle(parAxisName[iH].Data());
225  }
226 
227  hPartParam2DSignal[iPart][0] = new TH2F("y-p_{t}","y-p_{t}",
228  nBins[3],xMin[3],xMax[3],
229  nBins[2],xMin[2],xMax[2]);
230  hPartParam2DSignal[iPart][0]->GetXaxis()->SetTitle("y");
231  hPartParam2DSignal[iPart][0]->GetYaxis()->SetTitle("p_{t} [GeV/c]");
232 
233  gDirectory->mkdir("QA");
234  gDirectory->cd("QA");
235  {
236  int nBinsQA = 50;
237  float xMaxQA[nHistoPartParamQA] = {0.01,0.001,0.001};
238  for( int iH=0; iH<nHistoPartParamQA; iH++ ){
239  hPartParamQA[iPart][iH] =
240  new TH1F((res+parName[iH]).Data(), (res+parName[iH]).Data(), nBinsQA, -xMaxQA[iH],xMaxQA[iH]);
241  hPartParamQA[iPart][iH+nHistoPartParamQA] =
242  new TH1F((pull+parName[iH]).Data(), (pull+parName[iH]).Data(), nBinsQA, -6,6);
243  }
244  }
245  gDirectory->cd(".."); // particle directory / Parameters / Signal
246  }
247  gDirectory->cd(".."); // particle directory / Parameters
248  gDirectory->mkdir("Background");
249  gDirectory->cd("Background");
250  {
251  for(int iH=0; iH<nHistoPartParam; iH++)
252  {
253  hPartParamBG[iPart][iH] = new TH1F((parName[iH]).Data(),(parName[iH]).Data(),
254  nBins[iH],xMin[iH],xMax[iH]);
255  hPartParamBG[iPart][iH]->GetXaxis()->SetTitle(parAxisName[iH].Data());
256  }
257 
258  hPartParam2DBG[iPart][0] = new TH2F("y-p_{t}","y-p_{t}",
259  nBins[3],xMin[3],xMax[3],
260  nBins[2],xMin[2],xMax[2]);
261  hPartParam2DBG[iPart][0]->GetXaxis()->SetTitle("y");
262  hPartParam2DBG[iPart][0]->GetYaxis()->SetTitle("p_{t} [GeV/c]");
263  }
264  // gDirectory->cd(".."); // particle directory
265  // gDirectory->mkdir("CorrBG");
266  // gDirectory->cd("CorrBG");
267  // {
268  // for(int iH=0; iH<nHistoPartParam; iH++)
269  // {
270  // hPartParamCorrBG[iPart][iH] = new TH1F((parName[iH]).Data(),(parName[iH]).Data(),
271  // nBins[iH],xMin[iH],xMax[iH]);
272  // hPartParamCorrBG[iPart][iH]->GetXaxis()->SetTitle(parAxisName[iH].Data());
273  // }
274  //
275  // hPartParam2DCorrBG[iPart][0] = new TH2F("y-p_{t}","y-p_{t}",
276  // nBins[3],xMin[3],xMax[3],
277  // nBins[2],xMin[2],xMax[2]);
278  // hPartParam2DCorrBG[iPart][0]->GetXaxis()->SetTitle("y");
279  // hPartParam2DCorrBG[iPart][0]->GetYaxis()->SetTitle("p_{t} [GeV/c]");
280  // }
281  gDirectory->cd(".."); // particle directory
282  gDirectory->mkdir("Ghost");
283  gDirectory->cd("Ghost");
284  {
285  for(int iH=0; iH<nHistoPartParam; iH++)
286  {
287  hPartParamGhost[iPart][iH] = new TH1F((parName[iH]).Data(),(parName[iH]).Data(),
288  nBins[iH],xMin[iH],xMax[iH]);
289  hPartParamGhost[iPart][iH]->GetXaxis()->SetTitle(parAxisName[iH].Data());
290  }
291 
292  hPartParam2DGhost[iPart][0] = new TH2F("y-p_{t}","y-p_{t}",
293  nBins[3],xMin[3],xMax[3],
294  nBins[2],xMin[2],xMax[2]);
295  hPartParam2DGhost[iPart][0]->GetXaxis()->SetTitle("y");
296  hPartParam2DGhost[iPart][0]->GetYaxis()->SetTitle("p_{t} [GeV/c]");
297  }
298  gDirectory->cd(".."); // particle directory
299  }
300  gDirectory->cd(".."); //particle directory
301  }
302  gDirectory->cd(".."); //Particles
303  }
304  }
305  gDirectory->cd(".."); //L1
306  gDirectory->mkdir("PrimaryVertexQA");
307  gDirectory->cd("PrimaryVertexQA");
308  {
309  struct {
310  string name;
311  string title;
312  Int_t n;
313  Double_t l,r;
314  } Table[nHistosPV]=
315  {
316  {"PVResX", "x_{rec}-x_{mc}, cm", 100, -0.2f, 0.2f},
317  {"PVResY", "y_{rec}-y_{mc}, cm", 100, -0.2f, 0.2f},
318  {"PVResZ", "z_{rec}-z_{mc}, cm", 100, -0.2f, 0.2f},
319  {"PVPullX", "Pull X", 100, -6.f, 6.f},
320  {"PVPullY", "Pull Y", 100, -6.f, 6.f},
321  {"PVPullZ", "Pull Z", 100, -6.f, 6.f}
322  };
323  for(int iHPV=0; iHPV<nHistosPV; ++iHPV){
324  hPVFitQa[iHPV] = new TH1F(Table[iHPV].name.data(),Table[iHPV].title.data(),
325  Table[iHPV].n, Table[iHPV].l, Table[iHPV].r);
326  }
327  }
328  gDirectory->cd(".."); //L1
329  gDirectory->mkdir("TrackParameters");
330  gDirectory->cd("TrackParameters");
331  {
332  TString chi2Name = "Chi2Prim";
333  for(int iPart=0; iPart < KFPartEfficiencies::nParticles; iPart++)
334  {
335  TString chi2NamePart = "Chi2Prim";
336  chi2NamePart += "_";
337  chi2NamePart += fParteff.partName[iPart].Data();
338  hTrackParameters[iPart] = new TH1F(chi2NamePart.Data(), chi2NamePart.Data(), 1000, 0, 100);
339 
340  }
341  hTrackParameters[KFPartEfficiencies::nParticles] = new TH1F("Chi2Prim", "Chi2Prim", 1000, 0, 100);
342  }
343  gDirectory->cd(".."); //particle directory
344 
345 
346  curdir->cd();
347 
348  }
349  else{ // create not in file
350  static int iaddName = 0; // haven't any subfolders so create with different names
351  TString addName = TString(iaddName);
352  int ih = 0; // i of Histo
353  for( int i = 0; i < NTrackPulls + NTrackPullsAtProdVertex + NVertexPulls; i++, ih++, addName = TString(iaddName++) ){
354  fHistos[ih] = new TH1D(fHistosInfo[ih].name+addName, fHistosInfo[ih].title, fHistosInfo[ih].nx, fHistosInfo[ih].left, fHistosInfo[ih].right);
355  }
356 
357  for( int i = 0; i < NHisto; i++ ){
358  fHistos[i]->SetDirectory(0);
359  }
360  }
361  SetHistoCreated();
362 }
363 
364 
365 void PndFTSParticlePerformanceBase::FillHistos()
366 {
367 
368 } // void PndFTSParticlePerformanceBase::FillHistos()
369 #endif //DO_TPCCATRACKER_EFF_PERFORMANCE
370 
double r
Definition: RiemannTest.C:14
Int_t res
Definition: anadigi.C:166
Int_t i
Definition: run_full.C:25
TString outFile
Definition: hit_dirc.C:17
int n
Double_t
TString name
static const int nParticles