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