Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // G4tgrSolid implementation 27 // 28 // Author: P.Arce, CIEMAT (November 2007) 29 // ------------------------------------------- 30 31 #include <map> 32 #include <set> 33 34 #include "G4tgrSolid.hh" 35 36 #include "G4SystemOfUnits.hh" 37 #include "G4tgrUtils.hh" 38 #include "G4tgrMessenger.hh" 39 #include "G4tgrVolumeMgr.hh" 40 41 // ------------------------------------------- 42 G4tgrSolid::G4tgrSolid() 43 { 44 } 45 46 // ------------------------------------------- 47 G4tgrSolid::~G4tgrSolid() 48 { 49 } 50 51 // ------------------------------------------- 52 G4tgrSolid::G4tgrSolid(const std::vector<G4Str 53 { 54 //---------- set name 55 theName = G4tgrUtils::GetString(wl[1]); 56 57 //---------- set solid type 58 theType = G4tgrUtils::GetString(wl[2]); 59 60 //---------- create only vector<double> of t 61 FillSolidParams(wl); 62 63 G4tgrVolumeMgr::GetInstance()->RegisterMe(th 64 65 #ifdef G4VERBOSE 66 if(G4tgrMessenger::GetVerboseLevel() >= 1) 67 { 68 G4cout << " Created " << *this << G4endl; 69 } 70 #endif 71 } 72 73 // ------------------------------------------- 74 const std::vector<std::vector<G4double>*> G4tg 75 { 76 return theSolidParams; 77 } 78 79 // ------------------------------------------- 80 const G4String& G4tgrSolid::GetRelativeRotMatN 81 { 82 return theName; // Dummy ... 83 } 84 85 // ------------------------------------------- 86 G4ThreeVector G4tgrSolid::GetRelativePlace() c 87 { 88 return G4ThreeVector(0, 0, 0); // Dummy... 89 } 90 91 // ------------------------------------------- 92 void G4tgrSolid::FillSolidParams(const std::ve 93 { 94 //---- Setting which are angle parameters (f 95 std::map<G4String, std::set<G4int>> anglePar 96 std::set<G4int> apar; 97 apar.clear(); 98 apar.insert(3); 99 apar.insert(4); 100 angleParams["TUBS"] = apar; 101 apar.clear(); 102 apar.insert(5); 103 apar.insert(6); 104 angleParams["CONS"] = apar; 105 apar.clear(); 106 apar.insert(3); 107 apar.insert(4); 108 apar.insert(5); 109 angleParams["PARA"] = apar; 110 apar.clear(); 111 apar.insert(1); 112 apar.insert(2); 113 apar.insert(6); 114 apar.insert(10); 115 angleParams["TRAP"] = apar; 116 apar.clear(); 117 apar.insert(2); 118 apar.insert(3); 119 apar.insert(4); 120 apar.insert(5); 121 angleParams["SPHERE"] = apar; 122 apar.clear(); 123 apar.insert(3); 124 apar.insert(4); 125 angleParams["TORUS"] = apar; 126 apar.clear(); 127 apar.insert(0); 128 apar.insert(1); 129 angleParams["POLYCONE"] = apar; 130 apar.clear(); 131 apar.insert(0); 132 apar.insert(1); 133 angleParams["POLYHEDRA"] = apar; 134 apar.clear(); 135 apar.insert(2); 136 apar.insert(3); 137 angleParams["HYPE"] = apar; 138 apar.clear(); 139 apar.insert(0); 140 angleParams["TWISTED_BOX"] = apar; 141 apar.clear(); 142 apar.insert(0); 143 apar.insert(2); 144 apar.insert(3); 145 apar.insert(10); 146 angleParams["TWISTED_TRAP"] = apar; 147 apar.clear(); 148 apar.insert(5); 149 angleParams["TWISTED_TRD"] = apar; 150 apar.clear(); 151 apar.insert(0); 152 apar.insert(4); 153 angleParams["TWISTED_TUBS"] = std::move(apar 154 155 std::vector<G4double>* vd = new std::vector< 156 theSolidParams.push_back(vd); 157 std::size_t noParRead = wl.size() - 3; 158 159 G4String solidType = wl[2]; 160 //--- Default unit (mm) if length, deg if an 161 for(G4int ii = 0; ii < (G4int)noParRead; ++i 162 { 163 G4bool isAngle = 0; 164 std::map<G4String, std::set<G4int>>::const 165 angleParams.find(solidType); 166 if(ite != angleParams.cend()) 167 { 168 std::set<G4int> apar2 = (*ite).second; 169 if(apar2.find(ii) != apar2.cend()) 170 { 171 isAngle = 1; 172 vd->push_back(G4tgrUtils::GetDouble(wl 173 #ifdef G4VERBOSE 174 if(G4tgrMessenger::GetVerboseLevel() > 175 { 176 G4cout << " G4tgrSolid::FillSolidPar 177 << solidType << " " << ii << 178 } 179 #endif 180 } 181 } 182 if(!isAngle) 183 { 184 vd->push_back(G4tgrUtils::GetDouble(wl[3 185 } 186 } 187 } 188 189 // ------------------------------------------- 190 std::ostream& operator<<(std::ostream& os, con 191 { 192 os << "G4tgrSolid= " << sol.theName << " of 193 << " PARAMS: "; 194 if(sol.theSolidParams.size() != 0) 195 { 196 std::vector<G4double> solpar = *(sol.theSo 197 for(std::size_t ii = 0; ii < solpar.size() 198 { 199 os << solpar[ii] << " "; 200 } 201 } 202 os << G4endl; 203 204 return os; 205 } 206