AliRoot Core  3dc7879 (3dc7879)
AliTransportMonitor.h
Go to the documentation of this file.
1 #ifndef ALI_TRANSPORTMONITOR__H
2 #define ALI_TRANSPORTMONITOR__H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice */
5 
6 #ifndef ROOT_TNamed
7 #include "TNamed.h"
8 #endif
9 
10 #include <map>
11 
12 #ifndef ROOT_TStopwatch
13 #include "TStopwatch.h"
14 #endif
15 
16 #ifndef ROOT_TH2F
17 #include "TH2F.h"
18 #endif
19 
20 // Class that can be plugged in the simulation to monitor transport timing per
21 // particle for each geometry volume.
22 //
23 // andrei.gheata@cern.ch
24 
25 
26 
27 //______________________________________________________________________________
28 class AliTransportMonitor : public TObject {
29 public:
30  //________________________________________________________________
31  class AliTransportMonitorVol : public TNamed {
32  public:
33  //___________________________________________________
34  class AliPMonData {
35  public:
36  Int_t fPDG; // particle PDG
37  Double_t fEdt; // Energy * dt integral
38  Double_t fTime; // Total transport time for the particle in this volume
39  AliPMonData() : fPDG(0), fEdt(0), fTime(0) {}
40  virtual ~AliPMonData() {}
41  ClassDef(AliPMonData, 1) // Basic monitoring info structure
42  };
43  //___________________________________________________
45  virtual ~AliTransportMonitorVol();
46 
47  Int_t GetNtypes() const {return fNtypes;}
48  void StepInfo(Int_t pdg,
49  Double_t energy,
50  Double_t dt,
51  Double_t x, Double_t y, Double_t z);
52  Double_t GetTotalTime() const {return fTotalTime;}
53  Double_t GetTime(Int_t itype) const {return fPData[itype].fTime;}
54  Double_t GetEmed(Int_t itype) const {return (fTotalTime>0)?fPData[itype].fEdt/fTotalTime : 0.;}
55  Int_t GetPDG(Int_t itype) const {return fPData[itype].fPDG;}
56  Double_t GetNSteps() const {return fNSteps;}
57  TH2F *GetHistogram() const {return fTimeRZ;}
58  AliPMonData *GetPMonData(Int_t itype) const {return &(fPData[itype]);}
59  void Merge(AliTransportMonitorVol* volM);
60  private:
61  AliPMonData &GetPMonData(Int_t pdg);
62  AliTransportMonitorVol(const AliTransportMonitorVol& other) : TNamed(other), fNtypes(0), fTotalTime(0), fNSteps(0), fPData(0), fTimeRZ(0), fParticles() {}
64  private:
65  Int_t fNtypes; // Number of different particle types
66  Double_t fTotalTime; // Total time spent in this volume
67  Double_t fNSteps; // Total number of steps
68  AliPMonData *fPData; //[fNtypes] Array of particle data
69  TH2F *fTimeRZ; // Timing R-Z histogram per volume
70  typedef std::map<Int_t, Int_t> ParticleMap_t;
71  typedef ParticleMap_t::iterator ParticleMapIt_t;
72  ParticleMap_t fParticles;
73 
74  ClassDef(AliTransportMonitorVol,2) // Helper to hold particle info per volume
75  };
76  //________________________________________________________________
77 private:
78  AliTransportMonitor(const AliTransportMonitor&other) : TObject(other), fTotalTime(0), fTimer(), fVolumeMon(0) {}
80 public:
82  AliTransportMonitor(Int_t nvolumes);
83  virtual ~AliTransportMonitor();
84 
85  void StepInfo(Int_t volId,
86  Int_t pdg,
87  Double_t energy,
88  Double_t x, Double_t y, Double_t z);
89  void Print(Option_t *volName="") const;
90  void DummyStep();
91  void Start();
92  void Stop();
93  void Export(const char *fname);
94  TObjArray* GetVolumes() const {return fVolumeMon;}
95  void Merge(AliTransportMonitor* mergeMon);
96  static AliTransportMonitor *Import(const char *fname);
97 private:
98  Double_t fTotalTime; // Total simulation time
99  TStopwatch fTimer;
100  TObjArray *fVolumeMon; // Array of monitoring objects per volume
101 
102 ClassDef(AliTransportMonitor,1) // Class to monitor timing per volume
103 };
104 //______________________________________________________________________________
105 
106 
107 #endif //ALI_TRANSPORTMONITOR__H
TDatime dt
Definition: pdc06_config.C:130
TObjArray * GetVolumes() const
AliTransportMonitorVol & operator=(const AliTransportMonitorVol &)
#define TObjArray
void StepInfo(Int_t pdg, Double_t energy, Double_t dt, Double_t x, Double_t y, Double_t z)
AliTransportMonitorVol(const AliTransportMonitorVol &other)
void Print(Option_t *volName="") const
TObjArray * fVolumeMon
Global timer.
AliPMonData * GetPMonData(Int_t itype) const
static AliTransportMonitor * Import(const char *fname)
AliTransportMonitor & operator=(const AliTransportMonitor &)
void Export(const char *fname)
AliTransportMonitor(const AliTransportMonitor &other)
char * fname
void Merge(AliTransportMonitorVol *volM)