PandaRoot
PndFTSPerformanceBase.h
Go to the documentation of this file.
1 //-*- Mode: C++ -*-
2 // ************************************************************************
3 // This file is property of and copyright by the ALICE HLT Project *
4 // ALICE Experiment at CERN, All rights reserved. *
5 // See cxx source for full Copyright notice *
6 // *
7 //*************************************************************************
8 #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE
9 
10 #ifndef PNDFTSPERFORMANCEBASE_H
11 #define PNDFTSPERFORMANCEBASE_H
12 
13 #include "PndFTSCounters.h"
14 
15 #include "PndFTSCADef.h"
16 #include "PndFTSArray.h"
17 #include "PndFTSCAMCTrack.h"
18 #include "PndFTSCAMCPoint.h"
19 #include <fstream>
20 #include <cstdio>
21 #include <map>
22 
23 #include <string>
24 using std::string;
25 
26 #include "TString.h"
27 
28 #include <iostream>
29 using std::istream;
30 using std::ostream;
31 
32 class TObject;
33 class TParticle;
34 class PndFTSCAMCPoint;
35 class PndFTSCAGBTracker;
36 class TDirectory;
37 class TH1;
38 
39 class TFile;
40 
44 class PndFTSPerformanceBase {
45  public:
46  struct PndFTSCAHitLabel {
47  int fLab[3]; //* array of 3 MC labels
48  friend ostream &operator<<(ostream &out, const PndFTSCAHitLabel &hl) { return out << hl.fLab[0] << " " << hl.fLab[1] << " " << hl.fLab[2] << " " << std::endl; }
49  friend istream &operator>>(istream &in, PndFTSCAHitLabel &hl) { return in >> hl.fLab[0] >> hl.fLab[1] >> hl.fLab[2]; }
50  };
51 
52  PndFTSPerformanceBase();
53  virtual ~PndFTSPerformanceBase();
54 
55  virtual void SetNewEvent(const PndFTSCAGBTracker *const Tracker, PndFTSResizableArray<PndFTSCAHitLabel> *hitLabels, PndFTSResizableArray<PndFTSCAMCTrack> *mcTracks,
57 
59  virtual void CreateHistos(string histoDir = "", TFile *outFile = 0) { UNUSED_PARAM2(histoDir, outFile); };
60 
62  virtual void Exec(bool print = false);
63 
64  virtual void PrintEfficiencyStatistic()
65  {
66  fEffStat.CalcEff();
67  fEffStat.Print();
68  };
69  virtual void PrintEfficiency()
70  {
71  fEff.CalcEff();
72  fEff.Print();
73  };
74 
75  virtual void Draw(){}; // draw diff things after performance
76 
78  PndFTSEfficiencies &GetEff() { return fEff; };
79  PndFTSEfficiencies &GetEffStat() { return fEffStat; };
80 
81  bool IsHistoCreated() { return fIsHistoCreated; }
82  void SetHistoCreated(bool v = 1) { fIsHistoCreated = v; }
83 
84  void SetHitLabels();
85  void SetMCTracks();
86  void SetMCPoints();
87 
88  vector<PndFTSCAPerformanceMCTrackData> &GetMCData() { return mcData; };
89  vector<PndFTSCAPerformanceRecoTrackData> &GetRecoData() { return recoData; };
90 
91  public:
92  virtual void FillHistos(){};
93  TH1 *GetHisto(const char *name);
94 
95  // Check if MC track is reconstructable. Calculate set of MC track. Etc.
96  virtual void CheckMCTracks(){}; // fill mcData.
97  // Find reco-MCTracks correspondence
98  virtual void MatchTracks(){}; // fill recoData.
99  // Calculate fEfficiencies
100  virtual void EfficiencyPerformance();
101  // Print fEfficiencies
102 
103  int fStatNEvents; //* n of events proceed
104 
106  PndFTSEfficiencies fEff;
107  PndFTSEfficiencies fEffStat;
108 
110  int NHisto;
111  struct THistoInfo {
112  THistoInfo(){};
113  THistoInfo(const char *name_, const char *title_, Int_t nx_, Double_t left_, Double_t right_, Int_t ny_ = 0, Double_t low_ = 0, Double_t up_ = 0, TString XAxisName_ = "",
114  TString YAxisName_ = "")
115  : name(name_), title(title_), nx(nx_), left(left_), right(right_), ny(ny_), low(low_), up(up_), XAxisName(XAxisName_), YAxisName(YAxisName_){};
116 
117  const char *name;
118  const char *title;
119  Int_t nx;
120  Double_t left, right;
121  Int_t ny;
122  Double_t low, up;
123  TString XAxisName, YAxisName;
124  };
125  TH1 **fHistos; // array of histos
126  THistoInfo *fHistosInfo; // array of histos parameters
127 
129  vector<PndFTSCAPerformanceMCTrackData> mcData; // iMCTrack to trackInfo map.
130  vector<PndFTSCAPerformanceRecoTrackData> recoData; // iRecoTrack to trackInfo map.
131 
133  const PndFTSCAGBTracker *fTracker; //* pointer to the tracker
134 
136  PndFTSResizableArray<PndFTSCAHitLabel> *fHitLabels; //* array of hit MC labels
137  PndFTSResizableArray<PndFTSCAMCTrack> *fMCTracks; //* array of MC tracks
138  PndFTSResizableArray<PndFTSCALocalMCPoint> *fLocalMCPoints; //* array of MC points in slices CS
139 
140  int nRecoTracks, nMCTracks;
141 
142  TDirectory *fHistoDir; //* ROOT directory with histogramm
143  bool fIsHistoCreated;
144 };
145 
146 #endif
147 #endif // DO_TPCCATRACKER_EFF_PERFORMANCE
basic_istream< char, char_traits< char > > istream
std::ostream & operator<<(std::ostream &o, const PndEventInfo &)
__m128 v
Definition: P4_F32vec4.h:3
std::istream & operator>>(std::istream &stream, RhoVector3Err &verr)
basic_ostream< char, char_traits< char > > ostream
void print(std::vector< ClassifierOutPuts > const &OutPutList)