| [818] | 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | // G4MCTSimParticle.hh
|
|---|
| 27 | //
|
|---|
| 28 | // ====================================================================
|
|---|
| 29 | #ifndef MCT_SIM_PARTICLE_H
|
|---|
| 30 | #define MCT_SIM_PARTICLE_H
|
|---|
| 31 |
|
|---|
| 32 | #include "G4Types.hh"
|
|---|
| 33 | #include <vector>
|
|---|
| 34 | #include <string>
|
|---|
| 35 | #include <iostream>
|
|---|
| 36 | #include "G4LorentzVector.hh"
|
|---|
| 37 |
|
|---|
| 38 | // ====================================================================
|
|---|
| 39 | //
|
|---|
| 40 | // class definition
|
|---|
| 41 | //
|
|---|
| 42 | // ====================================================================
|
|---|
| 43 | class G4MCTSimVertex;
|
|---|
| 44 | class G4MCTSimParticle;
|
|---|
| 45 |
|
|---|
| 46 | typedef std::vector<G4MCTSimParticle*> SimParticleList;
|
|---|
| 47 |
|
|---|
| 48 | class G4MCTSimParticle {
|
|---|
| 49 | protected:
|
|---|
| 50 | G4MCTSimParticle* parentParticle;
|
|---|
| 51 | std::vector<G4MCTSimParticle*> associatedParticleList;
|
|---|
| 52 |
|
|---|
| 53 | std::string name;
|
|---|
| 54 | int pdgID;
|
|---|
| 55 | int trackID;
|
|---|
| 56 | int parentTrackID;
|
|---|
| 57 | G4bool primaryFlag;
|
|---|
| 58 | G4LorentzVector momentumAtVertex;
|
|---|
| 59 | G4MCTSimVertex* vertex;
|
|---|
| 60 | G4bool storeFlag;
|
|---|
| 61 |
|
|---|
| 62 | public:
|
|---|
| 63 | G4MCTSimParticle();
|
|---|
| 64 | G4MCTSimParticle(std::string aname, int apcode, int atid, int ptid,
|
|---|
| 65 | const G4LorentzVector& p);
|
|---|
| 66 | G4MCTSimParticle(std::string aname, int apcode, int atid, int ptid,
|
|---|
| 67 | const G4LorentzVector& p, const G4MCTSimVertex* v);
|
|---|
| 68 | virtual ~G4MCTSimParticle();
|
|---|
| 69 |
|
|---|
| 70 | // copy constructor and assignment operator
|
|---|
| 71 | G4MCTSimParticle(const G4MCTSimParticle& right);
|
|---|
| 72 | const G4MCTSimParticle& operator=(const G4MCTSimParticle& right);
|
|---|
| 73 |
|
|---|
| 74 | // set/get functions
|
|---|
| 75 | void SetParentParticle(const G4MCTSimParticle* p);
|
|---|
| 76 | G4MCTSimParticle* GetParentParticle() const;
|
|---|
| 77 |
|
|---|
| 78 | void SetParticleName(std::string aname);
|
|---|
| 79 | const std::string& GetParticleName() const;
|
|---|
| 80 |
|
|---|
| 81 | void SetPdgID(int id);
|
|---|
| 82 | int GetPdgID() const;
|
|---|
| 83 |
|
|---|
| 84 | void SetTrackID(int id);
|
|---|
| 85 | int GetTrackID() const;
|
|---|
| 86 |
|
|---|
| 87 | void SetParentTrackID(int id);
|
|---|
| 88 | int GetParentTrackID() const;
|
|---|
| 89 |
|
|---|
| 90 | void SetPrimaryFlag(G4bool q);
|
|---|
| 91 | G4bool GetPrimaryFlag() const;
|
|---|
| 92 |
|
|---|
| 93 | void SetMomentumAtVertex(const G4LorentzVector& p);
|
|---|
| 94 | const G4LorentzVector& GetMomentumAtVertex() const;
|
|---|
| 95 |
|
|---|
| 96 | void SetVertex(const G4MCTSimVertex* v);
|
|---|
| 97 | G4MCTSimVertex* GetVertex() const;
|
|---|
| 98 |
|
|---|
| 99 | void SetStoreFlag(G4bool q);
|
|---|
| 100 | G4bool GetStoreFlag() const;
|
|---|
| 101 |
|
|---|
| 102 | // methods...
|
|---|
| 103 | int AssociateParticle(G4MCTSimParticle* p);
|
|---|
| 104 | int GetNofAssociatedParticles() const;
|
|---|
| 105 | G4MCTSimParticle* GetAssociatedParticle(int i) const;
|
|---|
| 106 | int GetTreeLevel() const;
|
|---|
| 107 | void SetStoreFlagToParentTree(G4bool q=true);
|
|---|
| 108 |
|
|---|
| 109 | void Print(std::ostream& ostr= std::cout, G4bool qrevorder=false) const;
|
|---|
| 110 | void PrintSingle(std::ostream& ostr= std::cout) const;
|
|---|
| 111 | };
|
|---|
| 112 |
|
|---|
| 113 | // ====================================================================
|
|---|
| 114 | // inline functions
|
|---|
| 115 | // ====================================================================
|
|---|
| 116 | inline G4MCTSimParticle::G4MCTSimParticle(const G4MCTSimParticle& right)
|
|---|
| 117 | {
|
|---|
| 118 | *this= right;
|
|---|
| 119 | }
|
|---|
| 120 |
|
|---|
| 121 | inline const G4MCTSimParticle&
|
|---|
| 122 | G4MCTSimParticle::operator=(const G4MCTSimParticle& right)
|
|---|
| 123 | {
|
|---|
| 124 | parentParticle= right.parentParticle;
|
|---|
| 125 | associatedParticleList= right.associatedParticleList; // shallow copy
|
|---|
| 126 |
|
|---|
| 127 | name= right.name;
|
|---|
| 128 | pdgID= right.pdgID;
|
|---|
| 129 | trackID= right.trackID;
|
|---|
| 130 | parentTrackID= right.parentTrackID;
|
|---|
| 131 | primaryFlag= right.primaryFlag;
|
|---|
| 132 | momentumAtVertex= right.momentumAtVertex;
|
|---|
| 133 | vertex= right.vertex;
|
|---|
| 134 |
|
|---|
| 135 | return *this;
|
|---|
| 136 | }
|
|---|
| 137 |
|
|---|
| 138 | inline void G4MCTSimParticle::SetParentParticle(const G4MCTSimParticle* p)
|
|---|
| 139 | { parentParticle= const_cast<G4MCTSimParticle*>(p); }
|
|---|
| 140 |
|
|---|
| 141 | inline G4MCTSimParticle* G4MCTSimParticle::GetParentParticle() const
|
|---|
| 142 | { return parentParticle; }
|
|---|
| 143 |
|
|---|
| 144 | inline void G4MCTSimParticle::SetParticleName(std::string aname)
|
|---|
| 145 | { name= aname; }
|
|---|
| 146 |
|
|---|
| 147 | inline const std::string& G4MCTSimParticle::GetParticleName() const
|
|---|
| 148 | { return name; }
|
|---|
| 149 |
|
|---|
| 150 | inline void G4MCTSimParticle::SetPdgID(int id) { pdgID= id; }
|
|---|
| 151 |
|
|---|
| 152 | inline int G4MCTSimParticle::GetPdgID() const { return pdgID; }
|
|---|
| 153 |
|
|---|
| 154 | inline void G4MCTSimParticle::SetTrackID(int id) { trackID= id; }
|
|---|
| 155 |
|
|---|
| 156 | inline int G4MCTSimParticle::GetTrackID() const { return trackID; }
|
|---|
| 157 |
|
|---|
| 158 | inline void G4MCTSimParticle::SetPrimaryFlag(G4bool q) { primaryFlag= q; }
|
|---|
| 159 |
|
|---|
| 160 | inline G4bool G4MCTSimParticle::GetPrimaryFlag() const { return primaryFlag; }
|
|---|
| 161 |
|
|---|
| 162 | inline void G4MCTSimParticle::SetParentTrackID(int id)
|
|---|
| 163 | { parentTrackID= id; }
|
|---|
| 164 |
|
|---|
| 165 | inline int G4MCTSimParticle::GetParentTrackID() const
|
|---|
| 166 | { return parentTrackID; }
|
|---|
| 167 |
|
|---|
| 168 | inline void G4MCTSimParticle::SetMomentumAtVertex(const G4LorentzVector& p)
|
|---|
| 169 | { momentumAtVertex= p; }
|
|---|
| 170 |
|
|---|
| 171 | inline const G4LorentzVector& G4MCTSimParticle::GetMomentumAtVertex() const
|
|---|
| 172 | { return momentumAtVertex; }
|
|---|
| 173 |
|
|---|
| 174 | inline void G4MCTSimParticle::SetVertex(const G4MCTSimVertex* v)
|
|---|
| 175 | { vertex= const_cast<G4MCTSimVertex*>(v); }
|
|---|
| 176 |
|
|---|
| 177 | inline G4MCTSimVertex* G4MCTSimParticle::GetVertex() const
|
|---|
| 178 | { return vertex; }
|
|---|
| 179 |
|
|---|
| 180 | inline void G4MCTSimParticle::SetStoreFlag(G4bool q) { storeFlag= q; }
|
|---|
| 181 |
|
|---|
| 182 | inline G4bool G4MCTSimParticle::GetStoreFlag() const { return storeFlag; }
|
|---|
| 183 |
|
|---|
| 184 | #endif
|
|---|