AliRoot Core  edcc906 (edcc906)
Go to the documentation of this file.
1 #ifndef ALIMC_H
2 #define ALIMC_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice */
6 /* $Id$ */
8 //
9 // This is the ALICE implementation of TVirtualMCApplication
10 // for simulation with different implementations
11 // of the Virtual MonteCarlo
12 //
14 #include <TArrayF.h>
15 #include <TArrayI.h>
16 #include <TClonesArray.h>
17 #include <TList.h>
18 #include <TMCProcess.h>
19 #include <TVirtualMCApplication.h>
21 class TParticle;
22 class TFile;
23 class TTree;
24 class TVirtualMC;
26 class AliGenerator;
27 class AliTrackReference;
30 class AliMC : public TVirtualMCApplication {
31 public:
32  AliMC();
33  AliMC(const char *name, const char *title);
34  virtual ~AliMC();
36 //
37 // MC Application
38 //
39  virtual void ConstructGeometry();
40  virtual Bool_t MisalignGeometry();
41  virtual void ConstructOpGeometry();
42  virtual void AddParticles();
43  virtual void InitGeometry();
44  virtual void SetAllAlignableVolumes();
45  virtual void GeneratePrimaries();
46  virtual void BeginEvent();
47  virtual void BeginPrimary();
48  virtual void PreTrack();
49  virtual void Stepping();
50  virtual void PostTrack();
51  virtual void FinishPrimary();
52  virtual void FinishEvent();
53  virtual Double_t TrackingZmax() const {return fTrZmax;}
54  virtual Double_t TrackingRmax() const {return fTrRmax;}
55  virtual Int_t DetFromMate(Int_t i) const { return (*fImedia)[i];}
56 //
58  virtual AliGenerator* Generator() const {return fGenerator;}
59  virtual void SetGenerator(AliGenerator *generator);
60  virtual void ResetGenerator(AliGenerator *generator);
62 //
63  virtual void ReadTransPar();
64  virtual void MediaTable();
65  virtual void EnergySummary();
66  virtual void FinishRun();
67  void AddEnergyDeposit(Int_t id, Float_t edep)
68  {fEventEnergy[id]+=edep;}
69  virtual void ResetHits();
70  virtual void ResetDigits();
71  virtual void ResetSDigits();
72  virtual void TrackingLimits( Float_t rmax=1.e10, Float_t zmax=1.e10)
73  {fTrRmax=rmax; fTrZmax=zmax;}
74  virtual void DecayLimits( Float_t rmin = -1., Float_t rmax = -1., Int_t pdg = 0)
75  {fRDecayMin = rmin; fRDecayMax = rmax; fDecayPdg = pdg;}
76  virtual void PurifyLimits( Float_t rmax=-1., Float_t zmax=-1.)
77  {fPuRmax = rmax; fPuZmax = zmax;}
78  virtual void Init();
79  virtual void SetTransPar(const char *filename="$(ALICE_ROOT)/data/galice.cuts");
80  //PH
81  virtual void AddHit(Int_t id, Int_t track, Int_t *vol, Float_t *hits) const;
82  virtual void AddDigit(Int_t id, Int_t *tracks, Int_t *digits) const;
83  virtual void AddHitList(TCollection *hitList) {if (hitList) fHitLists->Add(hitList);}
84  Int_t GetCurrentTrackNumber() const;
85  virtual void DumpPart (Int_t i) const;
86  virtual void DumpPStack () const;
87  TList* GetHitLists() const {return fHitLists ;}
88  Int_t GetNtrack() const;
89  virtual Int_t GetPrimary(Int_t track) const;
90  const TObjArray* Particles() const;
91  TParticle *Particle(Int_t i) const;
92  virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg,
93  const Float_t *pmom, const Float_t *vpos, const Float_t *polar,
94  Float_t tof, TMCProcess mech, Int_t &ntr,
95  Float_t weight = 1, Int_t is = 0) const;
96  virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg,
97  Double_t px, Double_t py, Double_t pz, Double_t e,
98  Double_t vx, Double_t vy, Double_t vz, Double_t tof,
99  Double_t polx, Double_t poly, Double_t polz,
100  TMCProcess mech, Int_t &ntr, Float_t weight=1,
101  Int_t is = 0) const;
102  virtual void SetHighWaterMark(Int_t nt) const;
104  virtual void KeepTrack(Int_t itra) const;
105  virtual void FlagTrack(Int_t track) const;
106  virtual void SetCurrentTrack(Int_t track) const;
107 // Track reference related
108  AliTrackReference* AddTrackReference(Int_t label, Int_t id = -999);
109  // const TClonesArray* TrackReferences() const {return &fTrackReferences;}
110  virtual void RemapTrackReferencesIDs(const Int_t *map); //remaping track references MI
111  virtual void ResetTrackReferences();
112  virtual void FixParticleDecaytime();
113 // Geometry related
114  void SetGeometryFromCDB();
115  Bool_t IsGeometryFromCDB() const;
116 // Monitor transport
117  void SetUseMonitoring(Bool_t flag=kTRUE) { fUseMonitoring = flag; }
119 // Random number generator status
120  void SetSaveRndmStatus(Bool_t value) { fSaveRndmStatus = value; }
121  void SetSaveRndmStatusPerEvent(Bool_t value) { fSaveRndmEventStatus = value; }
122  void SetReadRndmStatus(Bool_t value) { fReadRndmStatus = value; };
123  void SetRndmFileName(const TString& fileName) { fRndmFileName = fileName; };
125  private:
126  AliMC(const AliMC&); // Not implemented
127  AliMC& operator= (const AliMC&); // Not implemented
128  void MakeTmpTrackRefsTree();
129  void ReorderAndExpandTreeTR();
130  void CacheVMCInstance(); // Cache pointer to VMC object (to avoid _tls_ penalties)
132  private:
133  void RemapHits();
134  TVirtualMC *fMC;
135  AliGenerator *fGenerator; // Generator used in the MC
139  Bool_t fUseMonitoring;
140  TString fRndmFileName;
141  TArrayF fEventEnergy;
142  TArrayF fSummEnergy;
143  TArrayF fSum2Energy;
144  Float_t fTrRmax; // Maximum radius for tracking
145  Float_t fTrZmax; // Maximu z for tracking
146  Float_t fPuRmax; // Maximum radius for purify disabled
147  Float_t fPuZmax; // Maximu z for purify disabled
148  Float_t fRDecayMax; // Maximum radius for decay
149  Float_t fRDecayMin; // Minimum radius for decay
150  Int_t fDecayPdg; // PDG code of particle with forced decay length
151  TArrayI *fImedia;
152  TString fTransParName; // Name of the transport parameters file
154  TList *fHitLists;
155  //Temporary Track Reference tree related
156  TTree *fTmpTreeTR;
157  TFile *fTmpFileTR;
158  TClonesArray fTrackReferences;
159  TClonesArray fTmpTrackReferences;
160  ClassDef(AliMC, 4)
161 };
164 #endif
TList * GetHitLists() const
Definition: AliMC.h:87
virtual void AddHit(Int_t id, Int_t track, Int_t *vol, Float_t *hits) const
Definition: AliMC.cxx:1826
void MakeTmpTrackRefsTree()
Definition: AliMC.cxx:2096
virtual Double_t TrackingRmax() const
Definition: AliMC.h:54
virtual void FinishEvent()
Definition: AliMC.cxx:1553
virtual ~AliMC()
Definition: AliMC.cxx:135
const Int_t nt
Definition: pdfIO.C:2
virtual Int_t GetPrimary(Int_t track) const
Definition: AliMC.cxx:1888
TArrayF fSummEnergy
Energy deposit for current event.
Definition: AliMC.h:142
Bool_t IsGeometryFromCDB() const
Definition: AliMC.cxx:1091
Definition: AliMC.cxx:65
#define TObjArray
virtual void ResetTrackReferences()
Definition: AliMC.cxx:2015
virtual void PreTrack()
Definition: AliMC.cxx:1181
void CacheVMCInstance()
Definition: AliMC.cxx:146
Float_t fPuZmax
Definition: AliMC.h:147
virtual void DumpPStack() const
Definition: AliMC.cxx:1865
Float_t fRDecayMax
Definition: AliMC.h:148
virtual void PurifyLimits(Float_t rmax=-1., Float_t zmax=-1.)
Definition: AliMC.h:76
TTree * fTmpTreeTR
Lists of hits to be remapped by PurifyKine.
Definition: AliMC.h:156
TString fTransParName
Array of correspondence between media and detectors.
Definition: AliMC.h:152
virtual void FlagTrack(Int_t track) const
Definition: AliMC.cxx:1978
Int_t fDecayPdg
Definition: AliMC.h:150
virtual void BeginPrimary()
Definition: AliMC.cxx:1169
Bool_t fReadRndmStatus
Options to save random engine status for each event.
Definition: AliMC.h:138
void SetGeometryFromCDB()
Definition: AliMC.cxx:1079
AliTPCfastTrack * track
virtual void ResetDigits()
Definition: AliMC.cxx:1445
TString fRndmFileName
Activate monitoring.
Definition: AliMC.h:140
virtual void PostTrack()
Definition: AliMC.cxx:1471
TVectorD vz
Definition: driftITSTPC.C:87
void ReorderAndExpandTreeTR()
Definition: AliMC.cxx:2106
AliMC & operator=(const AliMC &)
void AddEnergyDeposit(Int_t id, Float_t edep)
Definition: AliMC.h:67
Float_t fTrRmax
Energy squared per event in each volume.
Definition: AliMC.h:144
TVirtualMC * fMC
Definition: AliMC.h:134
virtual void SetCurrentTrack(Int_t track) const
Definition: AliMC.cxx:1989
TString fileName(const char *dir, int runNumber, const char *da, int i, const char *type)
virtual void FinishPrimary()
Definition: AliMC.cxx:1484
virtual void EnergySummary()
Definition: AliMC.cxx:1262
virtual void GeneratePrimaries()
Definition: AliMC.cxx:1113
void SetRndmFileName(const TString &fileName)
Definition: AliMC.h:123
AliTransportMonitor * fMonitor
Definition: AliMC.h:153
virtual Int_t DetFromMate(Int_t i) const
Definition: AliMC.h:55
virtual void KeepTrack(Int_t itra) const
Definition: AliMC.cxx:1966
virtual void InitGeometry()
Definition: AliMC.cxx:1060
TArrayF fSum2Energy
Energy per event in each volume.
Definition: AliMC.h:143
const TObjArray * Particles() const
Definition: AliMC.cxx:1913
virtual void Init()
Definition: AliMC.cxx:1624
void SetUseMonitoring(Bool_t flag=kTRUE)
Definition: AliMC.h:117
virtual void AddDigit(Int_t id, Int_t *tracks, Int_t *digits) const
Definition: AliMC.cxx:1836
TClonesArray fTrackReferences
Temporary track reference file.
Definition: AliMC.h:158
virtual void RemapTrackReferencesIDs(const Int_t *map)
Definition: AliMC.cxx:2024
virtual void SetTransPar(const char *filename="$(ALICE_ROOT)/data/galice.cuts")
Definition: AliMC.cxx:1817
virtual AliGenerator * Generator() const
Definition: AliMC.h:58
virtual void TrackingLimits(Float_t rmax=1.e10, Float_t zmax=1.e10)
Definition: AliMC.h:72
virtual void ConstructOpGeometry()
Definition: AliMC.cxx:233
void polar()
Definition: polar.C:2
Int_t GetCurrentTrackNumber() const
Definition: AliMC.cxx:1846
TArrayI * fImedia
Definition: AliMC.h:151
void RemapHits()
Definition: AliMC.cxx:1517
AliTrackReference * AddTrackReference(Int_t label, Int_t id=-999)
Definition: AliMC.cxx:2001
Float_t fPuRmax
Definition: AliMC.h:146
virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg, const Float_t *pmom, const Float_t *vpos, const Float_t *polar, Float_t tof, TMCProcess mech, Int_t &ntr, Float_t weight=1, Int_t is=0) const
Definition: AliMC.cxx:1925
virtual Bool_t MisalignGeometry()
Definition: AliMC.cxx:215
virtual void SetHighWaterMark(Int_t nt) const
Definition: AliMC.cxx:1955
Definition: AliMC.h:30
virtual void MediaTable()
Definition: AliMC.cxx:1656
virtual void ResetSDigits()
Definition: AliMC.cxx:1458
void SetSaveRndmStatus(Bool_t value)
Definition: AliMC.h:120
void SetReadRndmStatus(Bool_t value)
Definition: AliMC.h:122
virtual void ConstructGeometry()
Definition: AliMC.cxx:165
virtual void Stepping()
Definition: AliMC.cxx:1196
virtual void SetGenerator(AliGenerator *generator)
Definition: AliMC.cxx:1123
TClonesArray fTmpTrackReferences
List of track references - for one primary track only.
Definition: AliMC.h:159
virtual void FinishRun()
Definition: AliMC.cxx:1151
virtual void AddParticles()
Definition: AliMC.cxx:252
virtual void BeginEvent()
Definition: AliMC.cxx:1328
virtual void FixParticleDecaytime()
Definition: AliMC.cxx:2047
TFile * fTmpFileTR
Temporary track reference tree.
Definition: AliMC.h:157
Float_t fRDecayMin
Definition: AliMC.h:149
TList * fHitLists
Transport monitoring tool.
Definition: AliMC.h:154
Int_t GetNtrack() const
Definition: AliMC.cxx:1876
void SetSaveRndmStatusPerEvent(Bool_t value)
Definition: AliMC.h:121
virtual void DumpPart(Int_t i) const
Definition: AliMC.cxx:1854
virtual void ResetHits()
Definition: AliMC.cxx:1432
Bool_t fUseMonitoring
Options to read random engine status.
Definition: AliMC.h:139
Bool_t fSaveRndmStatus
Definition: AliMC.h:136
Bool_t fSaveRndmEventStatus
Options to save random engine status.
Definition: AliMC.h:137
AliGenerator * fGenerator
cached MC instance (to avoid calls to thread_local gMC=TVirtualMC::GetMC())
Definition: AliMC.h:135
virtual void ReadTransPar()
Definition: AliMC.cxx:1718
virtual void DecayLimits(Float_t rmin=-1., Float_t rmax=-1., Int_t pdg=0)
Definition: AliMC.h:74
Float_t fTrZmax
Definition: AliMC.h:145
virtual void AddHitList(TCollection *hitList)
Definition: AliMC.h:83
virtual Double_t TrackingZmax() const
Definition: AliMC.h:53
AliTransportMonitor * GetTransportMonitor() const
Definition: AliMC.h:118
TArrayF fEventEnergy
The file name of random engine status to be read in.
Definition: AliMC.h:141
TParticle * Particle(Int_t i) const
Definition: AliMC.cxx:1901
virtual void ResetGenerator(AliGenerator *generator)
Definition: AliMC.cxx:1132
virtual void SetAllAlignableVolumes()
Definition: AliMC.cxx:1097