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