FairRoot/PandaRoot
PndFTSCAPerformance.h
Go to the documentation of this file.
1 //-*- Mode: C++ -*-
2 // $Id: PndFTSCAPerformance.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 PNDFTSCAPERFORMANCE_H
12 #define PNDFTSCAPERFORMANCE_H
13 
14 #include "PndFTSPerformanceBase.h"
15 
16 #include "PndFTSCADef.h"
17 #include "PndFTSArray.h"
18 #include "PndFTSCAMCTrack.h"
19 #include "PndFTSCAMCPoint.h"
20 
21 #include <fstream>
22 #include <cstdio>
23 #include <map>
24 #include <string>
25 using std::string;
26 
27 class TObject;
28 class TParticle;
29 class PndFTSCAGBHit;
30 class PndFTSCAMCPoint;
31 class PndFTSCAGBTracker;
33 class TDirectory;
34 class TH1D;
35 class TH2D;
36 class TProfile;
37 
47 class PndFTSCAPerformance
48 {
49  public:
50 
51  typedef PndFTSPerformanceBase::PndFTSCAHitLabel PndFTSCAHitLabel;
52 
53  PndFTSCAPerformance();
54  virtual ~PndFTSCAPerformance();
55 
57  bool SetNewEvent(PndFTSCAGBTracker* const Tracker, string mcTracksFile, string mcPointsFile); // set info for new event
58  void InitSubPerformances();
59 
61  static PndFTSCAPerformance &Instance();
62 
64  void ExecPerformance();
65 
67  const PndFTSCAMCTrack &MCTrack(int i) const { return fMCTracks[i]; }
68  const PndFTSCAHitLabel &HitLabel(int i) const { return fHitLabels[i]; }
69  const PndFTSCAGBTracker *GetTracker(){ return fTracker; };
70 
71 
72  void SetTracker( PndFTSCAGBTracker* const tracker ){ fTracker = tracker; };
73  void SetTopoReconstructor( PndFTSTopoReconstructor* const tr ){ fTopoReconstructor = tr; };
74  void SetMCTracks(vector<PndFTSCAMCTrack>& mcTracks);
75  void SetMCPoints(vector<PndFTSCALocalMCPoint>& mcPoints);
76  void SetHitLabels(vector<PndFTSCAHitLabel>& hitLabels);
77 
78  PndFTSResizableArray<PndFTSCAHitLabel> * GetHitLabels() { return &fHitLabels; } // array of hit MC labels
79  PndFTSResizableArray<PndFTSCAMCTrack> * GetMCTracks() { return &fMCTracks; } // array of MC tracks
80  PndFTSResizableArray<PndFTSCALocalMCPoint> * GetMCPoints() { return &fLocalMCPoints;} // array of MC points in slices CS
81 
82  PndFTSPerformanceBase* GetSubPerformance(string name);
83 
84  const double* PV() const { return fPV; }
85 
86 
87  bool CreateHistos(string name);
88  void WriteHistos();
89 
90  void SetOutputFile(TFile *oF) { fOutputFile = oF; }
91 
92  void SaveDataInFiles( string prefix ) const; // Save all MC Data in txt files. @prefix - prefix for file name. Ex: "./data/ev1"
93  bool ReadData( vector <int>& labels, vector <PndFTSCALocalMCPoint>& mcpoints, vector<PndFTSCAMCTrack>& mctracks );
94 
95  int GetMCPoint( const PndFTSCAGBHit& hit ) const;
96 
97  void ShiftHitsToMC( float errX = -1, float errY = -1 ); // Use spreaded MCposition instead of hits
98  void ResimulateHits( float errX = -1, float errY = -1 ); // Create new hits spreading MCPositions
99  void RematchHits();// Match hits with closest MCPoint
100 #ifdef DRIFT_TUBES
101  void CombineHits(); // Rid of hits with same wires positions
102  void DivideHitsOnLR();
103 #endif
104 
106  void CreateHistos();
107 
108  protected:
110  void ReadMCEvent( FILE *in );
111  void ReadLocalMCPoints( FILE *in );
112 
113  void WriteMCEvent( FILE *out ) const;
114 
116  struct TSubPerformance{
117  PndFTSPerformanceBase* perf;
118  string name;
119  bool IsGlobalPerf;
120 
121  TSubPerformance(){};
122  TSubPerformance(PndFTSPerformanceBase* perf_, string name_, bool IsGlobalPerf_ = 1){
123  perf = perf_;
124  name = name_;
125  IsGlobalPerf = IsGlobalPerf_;
126  perf->SetHistoCreated(0);
127  };
128 // ~TSubPerformance(){if (perf) delete perf;};
129 
130  PndFTSPerformanceBase& operator*(){return *perf;}
131  PndFTSPerformanceBase* operator->(){return perf;}
132  };
133  vector<TSubPerformance> subPerformances;
134 // vector<PndFTSCAPerformanceBase*> subPerformances;
135 
136  const PndFTSCAGBTracker *fTracker; // pointer to the tracker
137  const PndFTSTopoReconstructor* fTopoReconstructor;
139  PndFTSResizableArray<PndFTSCAHitLabel> fHitLabels; // array of hit MC labels
140  PndFTSResizableArray<PndFTSCAMCTrack> fMCTracks; // array of MC tracks
141  PndFTSResizableArray<PndFTSCALocalMCPoint> fLocalMCPoints; // array of MC points in slices CS
142 
143  double fPV[3]; // primary vertex position (x,y,z)
144 
145 
146  int fStatNEvents; // n of events proceed
147 
148  TFile *fOutputFile;
149  TDirectory *fHistoDir; // ROOT directory with histogramms
150 
151  private:
152  void WriteDir2Current( TObject *obj );
153 
154  PndFTSCAPerformance( const PndFTSCAPerformance& );
155  PndFTSCAPerformance &operator=( const PndFTSCAPerformance& );
156 
157 };
158 
159 #endif
160 #endif //DO_TPCCATRACKER_EFF_PERFORMANCE
Int_t i
Definition: run_full.C:25
std::vector< std::string > labels
RhoError operator*(Double_t t, const RhoError &m1)
Definition: RhoError.cxx:213
TFile * out
Definition: reco_muo.C:20
TString name
fRun SetOutputFile(outFile)
PndSdsMCPoint * hit
Definition: anasim.C:70