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 */
12 #ifndef ROOT_TStopwatch
13 #include "TStopwatch.h"
16 // Class that can be plugged in the simulation to monitor transport timing per
17 // particle for each geometry volume.
19 // andrei.gheata@cern.ch
24 //______________________________________________________________________________
25 class AliTransportMonitor : public TObject {
27 //________________________________________________________________
28 class AliTransportMonitorVol : public TNamed {
30 //___________________________________________________
33 Int_t fPDG; // particle PDG
34 Double_t fEdt; // Energy * dt integral
35 Double_t fTime; // Total transport time for the particle in this volume
36 AliPMonData() : fPDG(0), fEdt(0), fTime(0) {}
37 virtual ~AliPMonData() {}
38 ClassDef(AliPMonData, 1) // Basic monitoring info structure
40 //___________________________________________________
41 AliTransportMonitorVol();
42 virtual ~AliTransportMonitorVol();
44 Int_t GetNtypes() const {return fNtypes;}
45 void StepInfo(Int_t pdg,
48 Double_t x, Double_t y, Double_t z);
49 Double_t GetTotalTime() const {return fTotalTime;}
50 Double_t GetTime(Int_t itype) const {return fPData[itype].fTime;}
51 Double_t GetEmed(Int_t itype) const {return (fTotalTime>0)?fPData[itype].fEdt/fTotalTime : 0.;}
52 Int_t GetPDG(Int_t itype) const {return fPData[itype].fPDG;}
53 TH2F *GetHistogram() const {return fTimeRZ;}
55 AliPMonData &GetPMonData(Int_t pdg);
56 AliTransportMonitorVol(const AliTransportMonitorVol& other) : TNamed(other), fNtypes(0), fTotalTime(0), fPData(0), fTimeRZ(0), fParticles() {}
57 AliTransportMonitorVol &operator=(const AliTransportMonitorVol&) {return *this;}
59 Int_t fNtypes; // Number of different particle types
60 Double_t fTotalTime; // Total time spent in this volume
61 AliPMonData *fPData; //[fNtypes] Array of particle data
62 TH2F *fTimeRZ; // Timing R-Z histogram per volume
63 typedef std::map<Int_t, Int_t> ParticleMap_t;
64 typedef ParticleMap_t::iterator ParticleMapIt_t;
65 ParticleMap_t fParticles; //! Map of stored particla data
67 ClassDef(AliTransportMonitorVol,1) // Helper to hold particle info per volume
69 //________________________________________________________________
71 AliTransportMonitor(const AliTransportMonitor&other) : TObject(other), fTotalTime(0), fTimer(), fVolumeMon(0) {}
72 AliTransportMonitor &operator=(const AliTransportMonitor&) {return *this;}
74 AliTransportMonitor();
75 AliTransportMonitor(Int_t nvolumes);
76 virtual ~AliTransportMonitor();
78 void StepInfo(Int_t volId,
81 Double_t x, Double_t y, Double_t z);
82 void Print(Option_t *volName="") const;
86 void Export(const char *fname);
87 static AliTransportMonitor *Import(const char *fname);
89 Double_t fTotalTime; // Total simulation time
90 TStopwatch fTimer; //! Global timer
91 TObjArray *fVolumeMon; // Array of monitoring objects per volume
93 ClassDef(AliTransportMonitor,1) // Class to monitor timing per volume
95 //______________________________________________________________________________
98 #endif //ALI_TRANSPORTMONITOR__H