| 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 | //
|
|---|
| 27 | // $Id: G4VDecayChannel.hh,v 1.12 2006/06/29 19:24:50 gunter Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-02-ref-02 $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // ------------------------------------------------------------
|
|---|
| 32 | // GEANT 4 class header file
|
|---|
| 33 | //
|
|---|
| 34 | // History: first implementation, based on object model of
|
|---|
| 35 | // 27 July 1996 H.Kurashige
|
|---|
| 36 | // 30 May 1997 H.Kurashige
|
|---|
| 37 | // 23 Mar. 2000 H.Weber : add GetAngularMomentum()
|
|---|
| 38 | // ------------------------------------------------------------
|
|---|
| 39 | #ifndef G4VDecayChannel_h
|
|---|
| 40 | #define G4VDecayChannel_h 1
|
|---|
| 41 |
|
|---|
| 42 | #include "G4ios.hh"
|
|---|
| 43 | #include "globals.hh"
|
|---|
| 44 | #include <cmath>
|
|---|
| 45 |
|
|---|
| 46 | class G4ParticleDefinition;
|
|---|
| 47 | class G4DecayProducts;
|
|---|
| 48 | class G4ParticleTable;
|
|---|
| 49 |
|
|---|
| 50 | class G4VDecayChannel
|
|---|
| 51 | {
|
|---|
| 52 | // Class Description
|
|---|
| 53 | // This class is a abstract class to describe decay kinematics
|
|---|
| 54 | //
|
|---|
| 55 |
|
|---|
| 56 | public:
|
|---|
| 57 | //Constructors
|
|---|
| 58 | G4VDecayChannel(const G4String &aName, G4int Verbose = 1);
|
|---|
| 59 | G4VDecayChannel(const G4String &aName,
|
|---|
| 60 | const G4String& theParentName,
|
|---|
| 61 | G4double theBR,
|
|---|
| 62 | G4int theNumberOfDaughters,
|
|---|
| 63 | const G4String& theDaughterName1,
|
|---|
| 64 | const G4String& theDaughterName2 = "",
|
|---|
| 65 | const G4String& theDaughterName3 = "",
|
|---|
| 66 | const G4String& theDaughterName4 = "" );
|
|---|
| 67 |
|
|---|
| 68 | // Destructor
|
|---|
| 69 | virtual ~G4VDecayChannel();
|
|---|
| 70 |
|
|---|
| 71 | private:
|
|---|
| 72 | // copy constructor and assignment operatotr
|
|---|
| 73 | G4VDecayChannel(const G4VDecayChannel &);
|
|---|
| 74 | G4VDecayChannel & operator=(const G4VDecayChannel &);
|
|---|
| 75 |
|
|---|
| 76 | public:
|
|---|
| 77 | // equality operators
|
|---|
| 78 | G4int operator==(const G4VDecayChannel &right) const {return (this == &right);};
|
|---|
| 79 | G4int operator!=(const G4VDecayChannel &right) const {return (this != &right);};
|
|---|
| 80 |
|
|---|
| 81 | // less-than operator is defined for G4DecayTable
|
|---|
| 82 | G4int operator<(const G4VDecayChannel &right) const;
|
|---|
| 83 |
|
|---|
| 84 | public: // With Description
|
|---|
| 85 | virtual G4DecayProducts* DecayIt(G4double parentMass = -1.0) = 0;
|
|---|
| 86 |
|
|---|
| 87 | public: // With Description
|
|---|
| 88 | //get kinematics name
|
|---|
| 89 | G4String GetKinematicsName() const;
|
|---|
| 90 | //get branching ratio
|
|---|
| 91 | G4double GetBR() const;
|
|---|
| 92 | //get number of daughter particles
|
|---|
| 93 | G4int GetNumberOfDaughters() const;
|
|---|
| 94 |
|
|---|
| 95 | //get the pointer to the parent particle
|
|---|
| 96 | G4ParticleDefinition * GetParent();
|
|---|
| 97 | //get the pointer to a daughter particle
|
|---|
| 98 | G4ParticleDefinition * GetDaughter(G4int anIndex);
|
|---|
| 99 |
|
|---|
| 100 | //get the angular momentum of the decay
|
|---|
| 101 | G4int GetAngularMomentum();
|
|---|
| 102 | //get the name of the parent particle
|
|---|
| 103 | const G4String& GetParentName() const;
|
|---|
| 104 | //get the name of a daughter particle
|
|---|
| 105 | const G4String& GetDaughterName(G4int anIndex) const;
|
|---|
| 106 |
|
|---|
| 107 | // get mass of parent
|
|---|
| 108 | G4double GetParentMass() const;
|
|---|
| 109 | G4double GetDaughterMass(G4int anIndex) const;
|
|---|
| 110 |
|
|---|
| 111 | //set the parent particle (by name or by pointer)
|
|---|
| 112 | void SetParent(const G4ParticleDefinition * particle_type);
|
|---|
| 113 | void SetParent(const G4String &particle_name);
|
|---|
| 114 | //set branching ratio
|
|---|
| 115 | void SetBR(G4double value);
|
|---|
| 116 | //set number of daughter particles
|
|---|
| 117 | void SetNumberOfDaughters(G4int value);
|
|---|
| 118 | //set a daughter particle (by name or by pointer)
|
|---|
| 119 | void SetDaughter(G4int anIndex,
|
|---|
| 120 | const G4ParticleDefinition * particle_type);
|
|---|
| 121 | void SetDaughter(G4int anIndex,
|
|---|
| 122 | const G4String &particle_name);
|
|---|
| 123 |
|
|---|
| 124 | protected:
|
|---|
| 125 | // kinematics name
|
|---|
| 126 | G4String kinematics_name;
|
|---|
| 127 | // branching ratio [0.0 - 1.0]
|
|---|
| 128 | G4double rbranch;
|
|---|
| 129 | // number of daughters
|
|---|
| 130 | G4int numberOfDaughters;
|
|---|
| 131 | // parent particle
|
|---|
| 132 | G4String* parent_name;
|
|---|
| 133 | //daughter particles
|
|---|
| 134 | G4String** daughters_name;
|
|---|
| 135 |
|
|---|
| 136 | protected: // With Description
|
|---|
| 137 | // celar daughters array
|
|---|
| 138 | void ClearDaughtersName();
|
|---|
| 139 |
|
|---|
| 140 | protected:
|
|---|
| 141 | // pointer to particle table
|
|---|
| 142 | G4ParticleTable* particletable;
|
|---|
| 143 |
|
|---|
| 144 | // temporary buffers of pointers to G4ParticleDefinition
|
|---|
| 145 | G4ParticleDefinition* parent;
|
|---|
| 146 | G4ParticleDefinition** daughters;
|
|---|
| 147 |
|
|---|
| 148 | // parent mass
|
|---|
| 149 | G4double parent_mass;
|
|---|
| 150 | G4double* daughters_mass;
|
|---|
| 151 |
|
|---|
| 152 |
|
|---|
| 153 | // fill daughters array
|
|---|
| 154 | void FillDaughters();
|
|---|
| 155 | // fill parent
|
|---|
| 156 | void FillParent();
|
|---|
| 157 |
|
|---|
| 158 | public: // With Description
|
|---|
| 159 | void SetVerboseLevel(G4int value);
|
|---|
| 160 | G4int GetVerboseLevel() const;
|
|---|
| 161 | void DumpInfo();
|
|---|
| 162 |
|
|---|
| 163 | private:
|
|---|
| 164 | const G4String& GetNoName() const;
|
|---|
| 165 |
|
|---|
| 166 | private:
|
|---|
| 167 | // controle flag for output message
|
|---|
| 168 | G4int verboseLevel;
|
|---|
| 169 | // 0: Silent
|
|---|
| 170 | // 1: Warning message
|
|---|
| 171 | // 2: More
|
|---|
| 172 |
|
|---|
| 173 | static const G4String noName;
|
|---|
| 174 | };
|
|---|
| 175 |
|
|---|
| 176 | inline
|
|---|
| 177 | G4int G4VDecayChannel::operator<(const G4VDecayChannel &right) const
|
|---|
| 178 | {
|
|---|
| 179 | return (this->rbranch < right.rbranch);
|
|---|
| 180 | }
|
|---|
| 181 |
|
|---|
| 182 | inline
|
|---|
| 183 | G4ParticleDefinition* G4VDecayChannel::GetDaughter(G4int anIndex)
|
|---|
| 184 | {
|
|---|
| 185 | //pointers to daughter particles are filled, if they are not set yet
|
|---|
| 186 | if (daughters == 0) FillDaughters();
|
|---|
| 187 |
|
|---|
| 188 | //get the pointer to a daughter particle
|
|---|
| 189 | if ( (anIndex>=0) && (anIndex<numberOfDaughters) ) {
|
|---|
| 190 | return daughters[anIndex];
|
|---|
| 191 | } else {
|
|---|
| 192 | if (verboseLevel>0)
|
|---|
| 193 | G4cout << "G4VDecayChannel::GetDaughter index out of range "<<anIndex<<G4endl;
|
|---|
| 194 | return 0;
|
|---|
| 195 | }
|
|---|
| 196 | }
|
|---|
| 197 |
|
|---|
| 198 | inline
|
|---|
| 199 | const G4String& G4VDecayChannel::GetDaughterName(G4int anIndex) const
|
|---|
| 200 | {
|
|---|
| 201 | if ( (anIndex>=0) && (anIndex<numberOfDaughters) ) {
|
|---|
| 202 | return *daughters_name[anIndex];
|
|---|
| 203 | } else {
|
|---|
| 204 | if (verboseLevel>0){
|
|---|
| 205 | G4cout << "G4VDecayChannel::GetDaughterName ";
|
|---|
| 206 | G4cout << "index out of range " << anIndex << G4endl;
|
|---|
| 207 | }
|
|---|
| 208 | return GetNoName();
|
|---|
| 209 | }
|
|---|
| 210 | }
|
|---|
| 211 |
|
|---|
| 212 | inline
|
|---|
| 213 | G4double G4VDecayChannel::GetDaughterMass(G4int anIndex) const
|
|---|
| 214 | {
|
|---|
| 215 | if ( (anIndex>=0) && (anIndex<numberOfDaughters) ) {
|
|---|
| 216 | return daughters_mass[anIndex];
|
|---|
| 217 | } else {
|
|---|
| 218 | if (verboseLevel>0){
|
|---|
| 219 | G4cout << "G4VDecayChannel::GetDaughterMass ";
|
|---|
| 220 | G4cout << "index out of range " << anIndex << G4endl;
|
|---|
| 221 | }
|
|---|
| 222 | return 0.0;
|
|---|
| 223 | }
|
|---|
| 224 | }
|
|---|
| 225 |
|
|---|
| 226 | inline
|
|---|
| 227 | G4ParticleDefinition* G4VDecayChannel::GetParent()
|
|---|
| 228 | {
|
|---|
| 229 | //the pointer to the parent particle is filled, if it is not set yet
|
|---|
| 230 | if (parent == 0) FillParent();
|
|---|
| 231 | //get the pointer to the parent particle
|
|---|
| 232 | return parent;
|
|---|
| 233 | }
|
|---|
| 234 |
|
|---|
| 235 | inline
|
|---|
| 236 | const G4String& G4VDecayChannel::GetParentName() const
|
|---|
| 237 | {
|
|---|
| 238 | return *parent_name;
|
|---|
| 239 | }
|
|---|
| 240 |
|
|---|
| 241 | inline
|
|---|
| 242 | G4double G4VDecayChannel::GetParentMass() const
|
|---|
| 243 | {
|
|---|
| 244 | return parent_mass;
|
|---|
| 245 | }
|
|---|
| 246 |
|
|---|
| 247 |
|
|---|
| 248 | inline
|
|---|
| 249 | void G4VDecayChannel::SetParent(const G4String &particle_name)
|
|---|
| 250 | {
|
|---|
| 251 | if (parent_name != 0) delete parent_name;
|
|---|
| 252 | parent_name = new G4String(particle_name);
|
|---|
| 253 | parent = 0;
|
|---|
| 254 | }
|
|---|
| 255 |
|
|---|
| 256 | inline
|
|---|
| 257 | G4int G4VDecayChannel::GetNumberOfDaughters() const
|
|---|
| 258 | {
|
|---|
| 259 | return numberOfDaughters;
|
|---|
| 260 | }
|
|---|
| 261 |
|
|---|
| 262 | inline
|
|---|
| 263 | G4String G4VDecayChannel::GetKinematicsName() const { return kinematics_name; }
|
|---|
| 264 |
|
|---|
| 265 | inline
|
|---|
| 266 | void G4VDecayChannel::SetBR(G4double value){ rbranch = value; }
|
|---|
| 267 |
|
|---|
| 268 | inline
|
|---|
| 269 | G4double G4VDecayChannel::GetBR() const { return rbranch; }
|
|---|
| 270 |
|
|---|
| 271 | inline
|
|---|
| 272 | void G4VDecayChannel::SetVerboseLevel(G4int value){ verboseLevel = value; }
|
|---|
| 273 |
|
|---|
| 274 | inline
|
|---|
| 275 | G4int G4VDecayChannel::GetVerboseLevel() const { return verboseLevel; }
|
|---|
| 276 |
|
|---|
| 277 |
|
|---|
| 278 |
|
|---|
| 279 | #endif
|
|---|
| 280 |
|
|---|
| 281 |
|
|---|
| 282 |
|
|---|
| 283 |
|
|---|
| 284 |
|
|---|
| 285 |
|
|---|