]>
Commit | Line | Data |
---|---|---|
17929791 | 1 | // $Id$ |
2 | // Category: physics | |
3 | // | |
4 | // This class provides mapping between TDatabasePDG | |
5 | // and Geant4 particles. | |
6 | ||
7 | #ifndef TG4_PARTICLES_MANAGER_H | |
8 | #define TG4_PARTICLES_MANAGER_H | |
9 | ||
10 | #include "TG4Globals.h" | |
11 | #include "TG4NameMap.h" | |
12 | #include "TG4IntMap.h" | |
13 | ||
14 | #include <globals.hh> | |
15 | #include <G4ThreeVector.hh> | |
16 | ||
17 | #include <Rtypes.h> | |
18 | ||
19 | class G4DynamicParticle; | |
20 | class G4ParticleDefinition; | |
21 | ||
22 | class TParticle; | |
23 | class TClonesArray; | |
24 | ||
25 | class TG4ParticlesManager | |
26 | { | |
27 | public: | |
28 | TG4ParticlesManager(); | |
29 | // --> protected | |
30 | // TG4ParticlesManager(const TG4ParticlesManager& right); | |
31 | virtual ~TG4ParticlesManager(); | |
32 | ||
33 | // static access method | |
34 | static TG4ParticlesManager* Instance(); | |
35 | ||
36 | // methods | |
37 | void MapParticles(); | |
38 | ||
39 | // get methods | |
40 | // for G4 particle types | |
41 | G4int GetPDGEncodingFast(G4ParticleDefinition* particle); | |
42 | ||
43 | // for Root particle types; | |
44 | TParticle* GetParticle(const TClonesArray* particles, G4int index) const; | |
45 | G4ParticleDefinition* GetParticleDefinition( | |
46 | const TParticle* particle) const; | |
47 | G4DynamicParticle* CreateDynamicParticle( | |
48 | const TParticle* particle) const; | |
49 | G4ThreeVector GetParticlePosition( | |
50 | const TParticle* particle) const; | |
51 | G4ThreeVector GetParticleMomentum( | |
52 | const TParticle* particle) const; | |
53 | ||
54 | protected: | |
55 | TG4ParticlesManager(const TG4ParticlesManager& right); | |
56 | ||
57 | // operators | |
58 | TG4ParticlesManager& operator=(const TG4ParticlesManager& right); | |
59 | ||
60 | private: | |
61 | // methods | |
62 | G4int GetPDGEncoding(G4ParticleDefinition* particle); | |
63 | G4int GetPDGEncoding(G4String particleName); | |
64 | ||
65 | // static data members | |
66 | static TG4ParticlesManager* fgInstance; //this instance | |
67 | ||
68 | // data members | |
69 | TG4NameMap fParticleNameMap; //the mapping between G4 particle names | |
70 | //and TDatabasePDG names | |
71 | TG4IntMap fParticlePDGMap; //the mapping between G4 particle names | |
72 | //and TDatabasePDG codes | |
73 | }; | |
74 | ||
75 | // inline methods | |
76 | ||
77 | inline TG4ParticlesManager* TG4ParticlesManager::Instance() | |
78 | { return fgInstance; } | |
79 | ||
80 | #endif //TG4_PARTICLES_MANAGER_H | |
81 |