Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // G4ProductionCuts << 27 // 23 // 28 // Class description: << 24 // $Id: G4ProductionCuts.hh,v 1.3 2004/06/07 13:47:34 gcosmo Exp $ >> 25 // GEANT4 tag $Name: geant4-07-00-patch-01 $ 29 // 26 // 30 // A G4ProductionCuts object must be created a << 27 // 31 // value desired for a given geometrical regio << 28 // ------------------------------------------------------------ 32 // Production cyts are applicable for gamma, p << 29 // GEANT 4 class header file 33 << 30 // 34 // Author: H.Kurashige, 17 September 2002 - Fi << 31 // 35 // ------------------------------------------- << 32 // Class Description 36 #ifndef G4ProductionCuts_hh << 33 // This class is 37 #define G4ProductionCuts_hh 1 << 34 // >> 35 // ------------------------------------------------------------ >> 36 // First Implementation 17 Sep. 2002 H.Kurahige >> 37 // ------------------------------------------------------------ 38 38 39 #include <vector> << 39 #ifndef G4ProductionCuts_h >> 40 #define G4ProductionCuts_h 1 40 41 41 #include "globals.hh" 42 #include "globals.hh" 42 #include "G4ios.hh" 43 #include "G4ios.hh" >> 44 #include <vector> 43 #include "G4ParticleDefinition.hh" 45 #include "G4ParticleDefinition.hh" 44 46 45 enum G4ProductionCutsIndex 47 enum G4ProductionCutsIndex 46 { 48 { 47 idxG4GammaCut = 0, << 49 idxG4GammaCut =0, 48 idxG4ElectronCut, 50 idxG4ElectronCut, 49 idxG4PositronCut, 51 idxG4PositronCut, 50 idxG4ProtonCut, // for proton << 51 52 52 NumberOfG4CutIndex 53 NumberOfG4CutIndex 53 }; 54 }; 54 55 55 class G4ProductionCuts 56 class G4ProductionCuts 56 { 57 { >> 58 public: // with description >> 59 // constructor >> 60 G4ProductionCuts(); >> 61 >> 62 // copy constructor >> 63 G4ProductionCuts(const G4ProductionCuts &right); >> 64 >> 65 G4ProductionCuts & operator=(const G4ProductionCuts &right); >> 66 >> 67 public: >> 68 // destructor >> 69 virtual ~G4ProductionCuts(); >> 70 >> 71 // equal opperators >> 72 G4int operator==(const G4ProductionCuts &right) const; >> 73 G4int operator!=(const G4ProductionCuts &right) const; >> 74 >> 75 public: // with description >> 76 // Set Cuts methods >> 77 void SetProductionCut(G4double cut, G4int index = -1); >> 78 void SetProductionCut(G4double cut, G4ParticleDefinition* ptcl); >> 79 void SetProductionCut(G4double cut, const G4String& pName); >> 80 // Set the productionCut in range with an index to particle type >> 81 // if index is omitted, the value is applied to all particles >> 82 >> 83 G4double GetProductionCut(G4int index) const; >> 84 // Get the productionCut in range with an index to particle type >> 85 >> 86 G4double GetProductionCut(const G4String& name) const; >> 87 // Get the productionCut in range with a name of particle type >> 88 >> 89 void SetProductionCuts(std::vector<G4double>&); >> 90 // Set the vector of production cuts in range for all particles >> 91 >> 92 const std::vector<G4double>& GetProductionCuts() const; >> 93 // Get the vector of production cuts in range for all particles >> 94 >> 95 G4bool IsModified() const; >> 96 // return true if any cut value has been modified >> 97 // after last calculation of PhysicsTable >> 98 >> 99 void PhysicsTableUpdated(); >> 100 // inform end of calculation of PhysicsTable to ProductionCut >> 101 57 public: 102 public: >> 103 static G4int GetIndex(const G4String& name); >> 104 static G4int GetIndex(const G4ParticleDefinition* ptcl); 58 105 59 G4ProductionCuts(); << 106 protected: 60 // Constructor << 107 std::vector<G4double> fRangeCuts; >> 108 G4bool isModified; 61 109 62 G4ProductionCuts(const G4ProductionCuts& r << 110 private: 63 // Copy constructor << 111 static const G4ParticleDefinition* gammaDef; >> 112 static const G4ParticleDefinition* electDef; >> 113 static const G4ParticleDefinition* positDef; >> 114 }; 64 115 65 virtual ~G4ProductionCuts(); << 66 // Destructor << 67 116 68 G4ProductionCuts& operator=(const G4Produc << 117 inline 69 // Assignment operator << 118 void G4ProductionCuts::SetProductionCut(G4double cut, G4int index) 70 << 119 { 71 G4bool operator==(const G4ProductionCuts& << 120 if (index<0) { 72 G4bool operator!=(const G4ProductionCuts& << 121 for(G4int i = 0; i < NumberOfG4CutIndex; i++) { 73 // Equality operators << 122 fRangeCuts[i] = cut; 74 << 123 } 75 void SetProductionCut(G4double cut, G4int << 124 isModified = true; 76 void SetProductionCut(G4double cut, G4Part << 125 77 void SetProductionCut(G4double cut, const << 126 } else if (index < NumberOfG4CutIndex) { 78 // Set the production cut in range for a << 127 fRangeCuts[index] = cut; 79 // and index, G4ParticleDefinition* or p << 128 isModified = true; 80 // particle is not a photon, e-, e+ or p << 129 } 81 // no effect. << 130 } 82 void SetProductionCut(G4double cut); << 83 // Set the production cut in range for p << 84 131 85 G4double GetProductionCut(G4int index) con << 132 inline 86 // Get the production cut in range with << 133 void G4ProductionCuts::SetProductionCut(G4double cut, G4ParticleDefinition* ptcl) >> 134 { >> 135 G4int idx = -1; >> 136 if(ptcl) idx = GetIndex(ptcl); >> 137 if(idx>=0) SetProductionCut(cut,idx); >> 138 } 87 139 88 G4double GetProductionCut(const G4String& << 140 inline 89 // Get the production cut in range with << 141 void G4ProductionCuts::SetProductionCut(G4double cut, const G4String& pName) 90 << 142 { 91 void SetProductionCuts(std::vector<G4doubl << 143 G4int idx = GetIndex(pName); 92 // Set the vector of production cuts in << 144 if(idx>=0) SetProductionCut(cut,idx); >> 145 } 93 146 94 const std::vector<G4double>& GetProduction << 147 inline 95 // Get the vector of production cuts in << 148 G4double G4ProductionCuts::GetProductionCut(G4int index) const >> 149 { >> 150 G4double cut=-1.0; >> 151 if ( (index>=0) && (index<NumberOfG4CutIndex) ) { >> 152 cut = fRangeCuts[index]; >> 153 } >> 154 return cut; >> 155 } 96 156 97 G4bool IsModified() const; << 157 inline 98 // Return true if any cut value has been << 158 G4double G4ProductionCuts::GetProductionCut(const G4String& name) const 99 // after last calculation of Physics Tab << 159 { >> 160 return GetProductionCut(GetIndex(name)); >> 161 } 100 162 101 void PhysicsTableUpdated(); << 163 inline 102 // Inform end of calculation of Physics << 164 void G4ProductionCuts::SetProductionCuts(std::vector<G4double>& cut) 103 << 165 { 104 static G4int GetIndex(const G4String& name << 166 for(G4int i = 0; (i<NumberOfG4CutIndex); i++) { 105 static G4int GetIndex(const G4ParticleDefi << 167 fRangeCuts[i] = cut[i]; >> 168 } >> 169 isModified = true; >> 170 } 106 171 107 protected: << 172 inline >> 173 const std::vector<G4double>& G4ProductionCuts::GetProductionCuts() const >> 174 { >> 175 return fRangeCuts; >> 176 } 108 177 109 std::vector<G4double> fRangeCuts; << 178 inline 110 G4bool isModified = true; << 179 G4bool G4ProductionCuts::IsModified() const 111 }; << 180 { >> 181 return isModified; >> 182 } >> 183 >> 184 inline >> 185 void G4ProductionCuts::PhysicsTableUpdated() >> 186 { >> 187 isModified = false; >> 188 } 112 189 113 #endif 190 #endif >> 191 >> 192 >> 193 >> 194 >> 195 >> 196 >> 197 >> 198 >> 199 >> 200 >> 201 114 202