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