PandaRoot
PndCAPerformance.h
Go to the documentation of this file.
1 //-*- Mode: C++ -*-
2 // $Id: PndCAPerformance.h,v 1.9 2010/09/01 10:38:27 ikulakov Exp $
3 // ************************************************************************
4 // This file is property of and copyright by the ALICE HLT Project *
5 // ALICE Experiment at CERN, All rights reserved. *
6 // See cxx source for full Copyright notice *
7 // *
8 //*************************************************************************
9 #ifdef DO_TPCCATRACKER_EFF_PERFORMANCE
10 
11 #ifndef PNDCAPERFORMANCE_H
12 #define PNDCAPERFORMANCE_H
13 
14 #include "PndCAPerformanceBase.h"
15 
16 #include "PndCADef.h"
17 #include "PndCAMCTrack.h"
18 #include "PndCAMCPoint.h"
19 
20 #include <fstream>
21 #include <cstdio>
22 #include <map>
23 #include <string>
24 using std::string;
25 
26 class TObject;
27 class TParticle;
28 class PndCAHit;
29 class PndCAMCPoint;
30 class PndCAGBTracker;
31 class PndCATopoReconstructor;
32 class TDirectory;
33 class TH1D;
34 class TH2D;
35 class TProfile;
36 
46 class PndCAPerformance {
47  public:
48  typedef PndCAPerformanceBase::PndCAHitLabel PndCAHitLabel;
49 
50  PndCAPerformance();
51  virtual ~PndCAPerformance();
52 
54  bool SetNewEvent(PndCAGBTracker *const Tracker, string mcTracksFile, string mcPointsFile); // set info for new event
55  void InitSubPerformances();
56 
58  static PndCAPerformance &Instance();
59 
61  void ExecPerformance();
62 
64  const PndCAMCTrack &MCTrack(int i) const { return fMCTracks[i]; }
65  const PndCAHitLabel &HitLabel(int i) const { return fHitLabels[i]; }
66  const PndCAGBTracker *GetTracker() { return fTracker; };
67 
68  void SetTracker(PndCAGBTracker *const tracker) { fTracker = tracker; };
69  void SetTopoReconstructor(PndCATopoReconstructor *const tr) { fTopoReconstructor = tr; };
70  void SetMCTracks(vector<PndCAMCTrack> &mcTracks);
71  void SetMCPoints(vector<PndCALocalMCPoint> &mcPoints);
72  void SetHitLabels(vector<PndCAHitLabel> &hitLabels);
73 
74  vector<PndCAHitLabel> *GetHitLabels() { return &fHitLabels; } // array of hit MC labels
75  vector<PndCAMCTrack> *GetMCTracks() { return &fMCTracks; } // array of MC tracks
76  vector<PndCALocalMCPoint> *GetMCPoints() { return &fLocalMCPoints; } // array of MC points in slices CS
77 
78  PndCAPerformanceBase *GetSubPerformance(string name);
79 
80  const double *PV() const { return fPV; }
81 
82  bool CreateHistos(string name);
83  void WriteHistos();
84 
85  void SetOutputFile(TFile *oF) { fOutputFile = oF; }
86 
87  void SaveDataInFiles(string prefix) const; // Save all MC Data in txt files. @prefix - prefix for file name. Ex: "./data/ev1"
88  bool ReadDataFromFiles(string prefix); // @prefix - prefix for file name. Ex: "./data/ev1"
89 
90  void CombineHits(); // Rid of hits with same wires positions
91 
92  protected:
94  void CreateHistos();
95 
97  void ReadMCEvent(FILE *in);
98  void ReadLocalMCPoints(FILE *in);
99 
100  void WriteMCEvent(FILE *out) const;
101 
103  struct TSubPerformance {
104  PndCAPerformanceBase *perf;
105  string name;
106  bool IsGlobalPerf;
107 
108  TSubPerformance(){};
109  TSubPerformance(PndCAPerformanceBase *perf_, string name_, bool IsGlobalPerf_ = 1)
110  {
111  perf = perf_;
112  name = name_;
113  IsGlobalPerf = IsGlobalPerf_;
114  perf->SetHistoCreated(0);
115  };
116  // ~TSubPerformance(){if (perf) delete perf;};
117 
118  PndCAPerformanceBase &operator*() { return *perf; }
119  PndCAPerformanceBase *operator->() { return perf; }
120  };
121  vector<TSubPerformance> subPerformances;
122  // vector<PndCAPerformanceBase*> subPerformances;
123 
124  const PndCAGBTracker *fTracker; // pointer to the tracker
125  const PndCATopoReconstructor *fTopoReconstructor;
127  vector<PndCAHitLabel> fHitLabels; // array of hit MC labels
128  vector<PndCAMCTrack> fMCTracks; // array of MC tracks
129  vector<PndCALocalMCPoint> fLocalMCPoints; // array of MC points in slices CS
130 
131  double fPV[3]; // primary vertex position (x,y,z)
132 
133  int fStatNEvents; // n of events proceed
134 
135  TFile *fOutputFile;
136  TDirectory *fHistoDir; // ROOT directory with histogramms
137 
138  private:
139  void WriteDir2Current(TObject *obj);
140 
141  PndCAPerformance(const PndCAPerformance &);
142  PndCAPerformance &operator=(const PndCAPerformance &);
143 };
144 
145 #endif
146 #endif // DO_TPCCATRACKER_EFF_PERFORMANCE
unsigned int i
Definition: P4_F32vec4.h:21
friend F32vec4 operator*(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:20