FairRoot/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 {
48  public:
49 
50  typedef PndCAPerformanceBase::PndCAHitLabel PndCAHitLabel;
51 
52  PndCAPerformance();
53  virtual ~PndCAPerformance();
54 
56  bool SetNewEvent(PndCAGBTracker* const Tracker, string mcTracksFile, string mcPointsFile); // set info for new event
57  void InitSubPerformances();
58 
60  static PndCAPerformance &Instance();
61 
63  void ExecPerformance();
64 
66  const PndCAMCTrack &MCTrack(int i) const { return fMCTracks[i]; }
67  const PndCAHitLabel &HitLabel(int i) const { return fHitLabels[i]; }
68  const PndCAGBTracker *GetTracker(){ return fTracker; };
69 
70 
71  void SetTracker( PndCAGBTracker* const tracker ){ fTracker = tracker; };
72  void SetTopoReconstructor( PndCATopoReconstructor* const tr ){ fTopoReconstructor = tr; };
73  void SetMCTracks(vector<PndCAMCTrack>& mcTracks);
74  void SetMCPoints(vector<PndCALocalMCPoint>& mcPoints);
75  void SetHitLabels(vector<PndCAHitLabel>& hitLabels);
76 
77  vector<PndCAHitLabel> * GetHitLabels() { return &fHitLabels; } // array of hit MC labels
78  vector<PndCAMCTrack> * GetMCTracks() { return &fMCTracks; } // array of MC tracks
79  vector<PndCALocalMCPoint> * GetMCPoints() { return &fLocalMCPoints;} // array of MC points in slices CS
80 
81  PndCAPerformanceBase* GetSubPerformance(string name);
82 
83  const double* PV() const { return fPV; }
84 
85 
86  bool CreateHistos(string name);
87  void WriteHistos();
88 
89  void SetOutputFile(TFile *oF) { fOutputFile = oF; }
90 
91  void SaveDataInFiles( string prefix ) const; // Save all MC Data in txt files. @prefix - prefix for file name. Ex: "./data/ev1"
92  bool ReadDataFromFiles( string prefix ); // @prefix - prefix for file name. Ex: "./data/ev1"
93 
94 
95  void CombineHits(); // Rid of hits with same wires positions
96 
97  protected:
98 
100  void CreateHistos();
101 
103  void ReadMCEvent( FILE *in );
104  void ReadLocalMCPoints( FILE *in );
105 
106  void WriteMCEvent( FILE *out ) const;
107 
109  struct TSubPerformance{
110  PndCAPerformanceBase* perf;
111  string name;
112  bool IsGlobalPerf;
113 
114  TSubPerformance(){};
115  TSubPerformance(PndCAPerformanceBase* perf_, string name_, bool IsGlobalPerf_ = 1){
116  perf = perf_;
117  name = name_;
118  IsGlobalPerf = IsGlobalPerf_;
119  perf->SetHistoCreated(0);
120  };
121 // ~TSubPerformance(){if (perf) delete perf;};
122 
123  PndCAPerformanceBase& operator*(){return *perf;}
124  PndCAPerformanceBase* operator->(){return perf;}
125  };
126  vector<TSubPerformance> subPerformances;
127 // vector<PndCAPerformanceBase*> subPerformances;
128 
129  const PndCAGBTracker *fTracker; // pointer to the tracker
130  const PndCATopoReconstructor* fTopoReconstructor;
132  vector<PndCAHitLabel> fHitLabels; // array of hit MC labels
133  vector<PndCAMCTrack> fMCTracks; // array of MC tracks
134  vector<PndCALocalMCPoint> fLocalMCPoints; // array of MC points in slices CS
135 
136  double fPV[3]; // primary vertex position (x,y,z)
137 
138 
139  int fStatNEvents; // n of events proceed
140 
141  TFile *fOutputFile;
142  TDirectory *fHistoDir; // ROOT directory with histogramms
143 
144  private:
145  void WriteDir2Current( TObject *obj );
146 
147  PndCAPerformance( const PndCAPerformance& );
148  PndCAPerformance &operator=( const PndCAPerformance& );
149 
150 };
151 
152 #endif
153 #endif //DO_TPCCATRACKER_EFF_PERFORMANCE
Int_t i
Definition: run_full.C:25
RhoError operator*(Double_t t, const RhoError &m1)
Definition: RhoError.cxx:213
TFile * out
Definition: reco_muo.C:20
TString name
fRun SetOutputFile(outFile)
PndAnaPidSelector *& obj