FairRoot/PandaRoot
PndCAPerformanceBase.cxx
Go to the documentation of this file.
1 // $Id: PndCAPerformanceBase.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 "PndCACounters.h"
25 
26 #include "PndCAPerformanceBase.h"
27 #include "PndCAMCTrack.h"
28 #ifndef HLTCA_STANDALONE
29 #include "PndCAMCPoint.h"
30 #endif
31 #include "PndCAGBTrack.h"
32 #include "PndCAGBTracker.h"
33 
34 
35 
36 #include "TMath.h"
37 #include "TROOT.h"
38 #include "Riostream.h"
39 #include "TFile.h"
40 #include "TH1.h"
41 #include "TH2.h"
42 #include "TProfile.h"
43 #include "TStyle.h"
44 
45 #include <string>
46 using std::string;
47 
48 
49 void PndCAPerformanceBase::SetNewEvent( const PndCAGBTracker * const tracker,
50  vector<PndCAHitLabel> *hitLabels,
51  vector<PndCAMCTrack> *mcTracks,
52  vector<PndCALocalMCPoint> *localMCPoints)
53 {
54  fTracker = tracker;
55 
56  fHitLabels = hitLabels;
57  fMCTracks = mcTracks;
58  fLocalMCPoints = localMCPoints;
59 
60  nMCTracks = (*fMCTracks).size();
61 
62  fEff = PndCAEfficiencies();
63  mcData.resize(0);
64  recoData.resize(0);
65 } // void PndCAPerformanceBase::SetNewEvent
66 
67 PndCAPerformanceBase::PndCAPerformanceBase():
68  fStatNEvents(0),NHisto(0),fTracker(0),fHitLabels(0),fMCTracks(0),fLocalMCPoints(0),nRecoTracks(0),nMCTracks(0),fHistoDir(0)
69 {
70 
71 }
72 
73 PndCAPerformanceBase::~PndCAPerformanceBase()
74 {
75  if (fHistoDir == 0) // don't write in file
76  for( int i = 0; i < NHisto; i++ ){
77  if (fHistos[i]) delete fHistos[i];
78  }
79 }
80 
81 
82 void PndCAPerformanceBase::Exec( bool PrintFlag )
83 {
84  assert( fTracker != 0 );
85 
86  // Efficiency
87  CheckMCTracks();
88  MatchTracks();
89  EfficiencyPerformance();
90  if (PrintFlag) PrintEfficiency();
91 
92  // Histos
93  FillHistos();
94 
95  fStatNEvents++;
96 } // Exec
97 
98 
99 void PndCAPerformanceBase::EfficiencyPerformance() // TODO add common parts of code
100 {
101  fEff.IncNEvents();
102  fEffStat += fEff;
103 }
104 
105 
106 TH1 *PndCAPerformanceBase::GetHisto(const char* name)
107 {
108  int iHisto;
109  for (iHisto = 0; iHisto < NHisto; iHisto++){
110  if (string(fHistosInfo[iHisto].name) == string(name)){
111  break;
112  };
113  }
114 
115  assert ( (iHisto != NHisto) || (string("") == string(" wrong histo name ")) );
116  if (iHisto == NHisto){
117  cout << "ERROR: wrong histo name: " << name << endl;
118  exit(1);
119  }
120 
121  return fHistos[iHisto];
122 }
123 
124 #endif //DO_TPCCATRACKER_EFF_PERFORMANCE
125 
Int_t i
Definition: run_full.C:25
exit(0)
TString name