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  public:
49  typedef PndFTSPerformanceBase::PndFTSCAHitLabel PndFTSCAHitLabel;
50 
51  PndFTSCAPerformance();
52  virtual ~PndFTSCAPerformance();
53 
55  bool SetNewEvent(PndFTSCAGBTracker *const Tracker, string mcTracksFile, string mcPointsFile); // set info for new event
56  void InitSubPerformances();
57 
59  static PndFTSCAPerformance &Instance();
60 
62  void ExecPerformance();
63 
65  const PndFTSCAMCTrack &MCTrack(int i) const { return fMCTracks[i]; }
66  const PndFTSCAHitLabel &HitLabel(int i) const { return fHitLabels[i]; }
67  const PndFTSCAGBTracker *GetTracker() { return fTracker; };
68 
69  void SetTracker(PndFTSCAGBTracker *const tracker) { fTracker = tracker; };
70  void SetTopoReconstructor(PndFTSTopoReconstructor *const tr) { fTopoReconstructor = tr; };
71  void SetMCTracks(vector<PndFTSCAMCTrack> &mcTracks);
72  void SetMCPoints(vector<PndFTSCALocalMCPoint> &mcPoints);
73  void SetHitLabels(vector<PndFTSCAHitLabel> &hitLabels);
74 
75  PndFTSResizableArray<PndFTSCAHitLabel> *GetHitLabels() { return &fHitLabels; } // array of hit MC labels
76  PndFTSResizableArray<PndFTSCAMCTrack> *GetMCTracks() { return &fMCTracks; } // array of MC tracks
77  PndFTSResizableArray<PndFTSCALocalMCPoint> *GetMCPoints() { return &fLocalMCPoints; } // array of MC points in slices CS
78 
79  PndFTSPerformanceBase *GetSubPerformance(string name);
80 
81  const double *PV() const { return fPV; }
82 
83  bool CreateHistos(string name);
84  void WriteHistos();
85 
86  void SetOutputFile(TFile *oF) { fOutputFile = oF; }
87 
88  void SaveDataInFiles(string prefix) const; // Save all MC Data in txt files. @prefix - prefix for file name. Ex: "./data/ev1"
89  bool ReadData(vector<int> &labels, vector<PndFTSCALocalMCPoint> &mcpoints, vector<PndFTSCAMCTrack> &mctracks);
90 
91  int GetMCPoint(const PndFTSCAGBHit &hit) const;
92 
93  void ShiftHitsToMC(float errX = -1, float errY = -1); // Use spreaded MCposition instead of hits
94  void ResimulateHits(float errX = -1, float errY = -1); // Create new hits spreading MCPositions
95  void RematchHits(); // Match hits with closest MCPoint
96 #ifdef DRIFT_TUBES
97  void CombineHits(); // Rid of hits with same wires positions
98  void DivideHitsOnLR();
99 #endif
100 
102  void CreateHistos();
103 
104  protected:
106  void ReadMCEvent(FILE *in);
107  void ReadLocalMCPoints(FILE *in);
108 
109  void WriteMCEvent(FILE *out) const;
110 
112  struct TSubPerformance {
113  PndFTSPerformanceBase *perf;
114  string name;
115  bool IsGlobalPerf;
116 
117  TSubPerformance(){};
118  TSubPerformance(PndFTSPerformanceBase *perf_, string name_, bool IsGlobalPerf_ = 1)
119  {
120  perf = perf_;
121  name = name_;
122  IsGlobalPerf = IsGlobalPerf_;
123  perf->SetHistoCreated(0);
124  };
125  // ~TSubPerformance(){if (perf) delete perf;};
126 
127  PndFTSPerformanceBase &operator*() { return *perf; }
128  PndFTSPerformanceBase *operator->() { return perf; }
129  };
130  vector<TSubPerformance> subPerformances;
131  // vector<PndFTSCAPerformanceBase*> subPerformances;
132 
133  const PndFTSCAGBTracker *fTracker; // pointer to the tracker
134  const PndFTSTopoReconstructor *fTopoReconstructor;
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  double fPV[3]; // primary vertex position (x,y,z)
141 
142  int fStatNEvents; // n of events proceed
143 
144  TFile *fOutputFile;
145  TDirectory *fHistoDir; // ROOT directory with histogramms
146 
147  private:
148  void WriteDir2Current(TObject *obj);
149 
150  PndFTSCAPerformance(const PndFTSCAPerformance &);
151  PndFTSCAPerformance &operator=(const PndFTSCAPerformance &);
152 };
153 
154 #endif
155 #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