| [987] | 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 | // $Id: G4GDMLReadParamvol.cc,v 1.11 2009/01/22 11:02:07 gcosmo Exp $
|
|---|
| 27 | // GEANT4 tag $Name: geant4-09-02-ref-02 $
|
|---|
| 28 | //
|
|---|
| 29 | // class G4GDMLReadParamvol Implementation
|
|---|
| 30 | //
|
|---|
| 31 | // History:
|
|---|
| 32 | // - Created. Zoltan Torzsok, November 2007
|
|---|
| 33 | // -------------------------------------------------------------------------
|
|---|
| 34 |
|
|---|
| 35 | #include "G4GDMLReadParamvol.hh"
|
|---|
| 36 |
|
|---|
| 37 | void G4GDMLReadParamvol::
|
|---|
| 38 | Box_dimensionsRead( const xercesc::DOMElement* const element,
|
|---|
| 39 | G4GDMLParameterisation::PARAMETER& parameter )
|
|---|
| 40 | {
|
|---|
| 41 | G4double lunit = 1.0;
|
|---|
| 42 |
|
|---|
| 43 | const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
|
|---|
| 44 | XMLSize_t attributeCount = attributes->getLength();
|
|---|
| 45 |
|
|---|
| 46 | for (XMLSize_t attribute_index=0;
|
|---|
| 47 | attribute_index<attributeCount; attribute_index++)
|
|---|
| 48 | {
|
|---|
| 49 | xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
|
|---|
| 50 |
|
|---|
| 51 | if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
|
|---|
| 52 | { continue; }
|
|---|
| 53 |
|
|---|
| 54 | const xercesc::DOMAttr* const attribute
|
|---|
| 55 | = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
|
|---|
| 56 | const G4String attName = Transcode(attribute->getName());
|
|---|
| 57 | const G4String attValue = Transcode(attribute->getValue());
|
|---|
| 58 |
|
|---|
| 59 | if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else
|
|---|
| 60 | if (attName=="x") { parameter.dimension[0] = eval.Evaluate(attValue); } else
|
|---|
| 61 | if (attName=="y") { parameter.dimension[1] = eval.Evaluate(attValue); } else
|
|---|
| 62 | if (attName=="z") { parameter.dimension[2] = eval.Evaluate(attValue); }
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | parameter.dimension[0] *= 0.5*lunit;
|
|---|
| 66 | parameter.dimension[1] *= 0.5*lunit;
|
|---|
| 67 | parameter.dimension[2] *= 0.5*lunit;
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | void G4GDMLReadParamvol::
|
|---|
| 71 | Trd_dimensionsRead( const xercesc::DOMElement* const element,
|
|---|
| 72 | G4GDMLParameterisation::PARAMETER& parameter )
|
|---|
| 73 | {
|
|---|
| 74 | G4double lunit = 1.0;
|
|---|
| 75 |
|
|---|
| 76 | const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
|
|---|
| 77 | XMLSize_t attributeCount = attributes->getLength();
|
|---|
| 78 |
|
|---|
| 79 | for (XMLSize_t attribute_index=0;
|
|---|
| 80 | attribute_index<attributeCount; attribute_index++)
|
|---|
| 81 | {
|
|---|
| 82 | xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
|
|---|
| 83 |
|
|---|
| 84 | if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
|
|---|
| 85 | { continue; }
|
|---|
| 86 |
|
|---|
| 87 | const xercesc::DOMAttr* const attribute
|
|---|
| 88 | = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
|
|---|
| 89 | const G4String attName = Transcode(attribute->getName());
|
|---|
| 90 | const G4String attValue = Transcode(attribute->getValue());
|
|---|
| 91 |
|
|---|
| 92 | if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else
|
|---|
| 93 | if (attName=="x1") { parameter.dimension[0]=eval.Evaluate(attValue); } else
|
|---|
| 94 | if (attName=="x2") { parameter.dimension[1]=eval.Evaluate(attValue); } else
|
|---|
| 95 | if (attName=="y1") { parameter.dimension[2]=eval.Evaluate(attValue); } else
|
|---|
| 96 | if (attName=="y2") { parameter.dimension[3]=eval.Evaluate(attValue); } else
|
|---|
| 97 | if (attName=="z") { parameter.dimension[4]=eval.Evaluate(attValue); }
|
|---|
| 98 | }
|
|---|
| 99 |
|
|---|
| 100 | parameter.dimension[0] *= 0.5*lunit;
|
|---|
| 101 | parameter.dimension[1] *= 0.5*lunit;
|
|---|
| 102 | parameter.dimension[2] *= 0.5*lunit;
|
|---|
| 103 | parameter.dimension[3] *= 0.5*lunit;
|
|---|
| 104 | parameter.dimension[4] *= 0.5*lunit;
|
|---|
| 105 | }
|
|---|
| 106 |
|
|---|
| 107 | void G4GDMLReadParamvol::
|
|---|
| 108 | Trap_dimensionsRead( const xercesc::DOMElement* const element,
|
|---|
| 109 | G4GDMLParameterisation::PARAMETER& parameter )
|
|---|
| 110 | {
|
|---|
| 111 | G4double lunit = 1.0;
|
|---|
| 112 | G4double aunit = 1.0;
|
|---|
| 113 |
|
|---|
| 114 | const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
|
|---|
| 115 | XMLSize_t attributeCount = attributes->getLength();
|
|---|
| 116 |
|
|---|
| 117 | for (XMLSize_t attribute_index=0;
|
|---|
| 118 | attribute_index<attributeCount; attribute_index++)
|
|---|
| 119 | {
|
|---|
| 120 | xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
|
|---|
| 121 |
|
|---|
| 122 | if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
|
|---|
| 123 | { continue; }
|
|---|
| 124 |
|
|---|
| 125 | const xercesc::DOMAttr* const attribute
|
|---|
| 126 | = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
|
|---|
| 127 | const G4String attName = Transcode(attribute->getName());
|
|---|
| 128 | const G4String attValue = Transcode(attribute->getValue());
|
|---|
| 129 |
|
|---|
| 130 | if (attName=="lunit")
|
|---|
| 131 | { lunit = eval.Evaluate(attValue); } else
|
|---|
| 132 | if (attName=="aunit")
|
|---|
| 133 | { aunit = eval.Evaluate(attValue); } else
|
|---|
| 134 | if (attName=="z")
|
|---|
| 135 | { parameter.dimension[0] = eval.Evaluate(attValue); } else
|
|---|
| 136 | if (attName=="theta")
|
|---|
| 137 | { parameter.dimension[1] = eval.Evaluate(attValue); } else
|
|---|
| 138 | if (attName=="phi")
|
|---|
| 139 | { parameter.dimension[2] = eval.Evaluate(attValue); } else
|
|---|
| 140 | if (attName=="y1")
|
|---|
| 141 | { parameter.dimension[3] = eval.Evaluate(attValue); } else
|
|---|
| 142 | if (attName=="x1")
|
|---|
| 143 | { parameter.dimension[4] = eval.Evaluate(attValue); } else
|
|---|
| 144 | if (attName=="x2")
|
|---|
| 145 | { parameter.dimension[5] = eval.Evaluate(attValue); } else
|
|---|
| 146 | if (attName=="alpha1")
|
|---|
| 147 | { parameter.dimension[6] = eval.Evaluate(attValue); } else
|
|---|
| 148 | if (attName=="y2")
|
|---|
| 149 | { parameter.dimension[7] = eval.Evaluate(attValue); } else
|
|---|
| 150 | if (attName=="x3")
|
|---|
| 151 | { parameter.dimension[8] = eval.Evaluate(attValue); } else
|
|---|
| 152 | if (attName=="x4")
|
|---|
| 153 | { parameter.dimension[9] = eval.Evaluate(attValue); } else
|
|---|
| 154 | if (attName=="alpha2")
|
|---|
| 155 | { parameter.dimension[10] = eval.Evaluate(attValue); }
|
|---|
| 156 | }
|
|---|
| 157 |
|
|---|
| 158 | parameter.dimension[0] *= 0.5*lunit;
|
|---|
| 159 | parameter.dimension[1] *= aunit;
|
|---|
| 160 | parameter.dimension[2] *= aunit;
|
|---|
| 161 | parameter.dimension[3] *= 0.5*lunit;
|
|---|
| 162 | parameter.dimension[4] *= 0.5*lunit;
|
|---|
| 163 | parameter.dimension[5] *= 0.5*lunit;
|
|---|
| 164 | parameter.dimension[6] *= aunit;
|
|---|
| 165 | parameter.dimension[7] *= 0.5*lunit;
|
|---|
| 166 | parameter.dimension[8] *= 0.5*lunit;
|
|---|
| 167 | parameter.dimension[9] *= 0.5*lunit;
|
|---|
| 168 | parameter.dimension[10] *= aunit;
|
|---|
| 169 | }
|
|---|
| 170 |
|
|---|
| 171 | void G4GDMLReadParamvol::
|
|---|
| 172 | Tube_dimensionsRead( const xercesc::DOMElement* const element,
|
|---|
| 173 | G4GDMLParameterisation::PARAMETER& parameter )
|
|---|
| 174 | {
|
|---|
| 175 | G4double lunit = 1.0;
|
|---|
| 176 | G4double aunit = 1.0;
|
|---|
| 177 |
|
|---|
| 178 | const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
|
|---|
| 179 | XMLSize_t attributeCount = attributes->getLength();
|
|---|
| 180 |
|
|---|
| 181 | for (XMLSize_t attribute_index=0;
|
|---|
| 182 | attribute_index<attributeCount; attribute_index++)
|
|---|
| 183 | {
|
|---|
| 184 | xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
|
|---|
| 185 |
|
|---|
| 186 | if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
|
|---|
| 187 | { continue; }
|
|---|
| 188 |
|
|---|
| 189 | const xercesc::DOMAttr* const attribute
|
|---|
| 190 | = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
|
|---|
| 191 | const G4String attName = Transcode(attribute->getName());
|
|---|
| 192 | const G4String attValue = Transcode(attribute->getValue());
|
|---|
| 193 |
|
|---|
| 194 | if (attName=="lunit")
|
|---|
| 195 | { lunit = eval.Evaluate(attValue); } else
|
|---|
| 196 | if (attName=="aunit")
|
|---|
| 197 | { aunit = eval.Evaluate(attValue); } else
|
|---|
| 198 | if (attName=="InR")
|
|---|
| 199 | { parameter.dimension[0] = eval.Evaluate(attValue); } else
|
|---|
| 200 | if (attName=="OutR")
|
|---|
| 201 | { parameter.dimension[1] = eval.Evaluate(attValue); } else
|
|---|
| 202 | if (attName=="hz")
|
|---|
| 203 | { parameter.dimension[2] = eval.Evaluate(attValue); } else
|
|---|
| 204 | if (attName=="StartPhi")
|
|---|
| 205 | { parameter.dimension[3] = eval.Evaluate(attValue); } else
|
|---|
| 206 | if (attName=="DeltaPhi")
|
|---|
| 207 | { parameter.dimension[4] = eval.Evaluate(attValue); }
|
|---|
| 208 | }
|
|---|
| 209 |
|
|---|
| 210 | parameter.dimension[0] *= lunit;
|
|---|
| 211 | parameter.dimension[1] *= lunit;
|
|---|
| 212 | parameter.dimension[2] *= 0.5*lunit;
|
|---|
| 213 | parameter.dimension[3] *= aunit;
|
|---|
| 214 | parameter.dimension[4] *= aunit;
|
|---|
| 215 | }
|
|---|
| 216 |
|
|---|
| 217 | void G4GDMLReadParamvol::
|
|---|
| 218 | Cone_dimensionsRead( const xercesc::DOMElement* const element,
|
|---|
| 219 | G4GDMLParameterisation::PARAMETER& parameter )
|
|---|
| 220 | {
|
|---|
| 221 | G4double lunit = 1.0;
|
|---|
| 222 | G4double aunit = 1.0;
|
|---|
| 223 |
|
|---|
| 224 | const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
|
|---|
| 225 | XMLSize_t attributeCount = attributes->getLength();
|
|---|
| 226 |
|
|---|
| 227 | for (XMLSize_t attribute_index=0;
|
|---|
| 228 | attribute_index<attributeCount; attribute_index++)
|
|---|
| 229 | {
|
|---|
| 230 | xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
|
|---|
| 231 |
|
|---|
| 232 | if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
|
|---|
| 233 | { continue; }
|
|---|
| 234 |
|
|---|
| 235 | const xercesc::DOMAttr* const attribute
|
|---|
| 236 | = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
|
|---|
| 237 | const G4String attName = Transcode(attribute->getName());
|
|---|
| 238 | const G4String attValue = Transcode(attribute->getValue());
|
|---|
| 239 |
|
|---|
| 240 | if (attName=="lunit")
|
|---|
| 241 | { lunit = eval.Evaluate(attValue); } else
|
|---|
| 242 | if (attName=="aunit")
|
|---|
| 243 | { aunit = eval.Evaluate(attValue); } else
|
|---|
| 244 | if (attName=="rmin1")
|
|---|
| 245 | { parameter.dimension[0] = eval.Evaluate(attValue); } else
|
|---|
| 246 | if (attName=="rmax1")
|
|---|
| 247 | { parameter.dimension[1] = eval.Evaluate(attValue); } else
|
|---|
| 248 | if (attName=="rmin2")
|
|---|
| 249 | { parameter.dimension[2] = eval.Evaluate(attValue); } else
|
|---|
| 250 | if (attName=="rmax2")
|
|---|
| 251 | { parameter.dimension[3] = eval.Evaluate(attValue); } else
|
|---|
| 252 | if (attName=="z")
|
|---|
| 253 | { parameter.dimension[4] = eval.Evaluate(attValue); } else
|
|---|
| 254 | if (attName=="startphi")
|
|---|
| 255 | { parameter.dimension[5] = eval.Evaluate(attValue); } else
|
|---|
| 256 | if (attName=="deltaphi")
|
|---|
| 257 | { parameter.dimension[6] = eval.Evaluate(attValue); }
|
|---|
| 258 | }
|
|---|
| 259 |
|
|---|
| 260 | parameter.dimension[0] *= lunit;
|
|---|
| 261 | parameter.dimension[1] *= lunit;
|
|---|
| 262 | parameter.dimension[2] *= lunit;
|
|---|
| 263 | parameter.dimension[3] *= lunit;
|
|---|
| 264 | parameter.dimension[4] *= 0.5*lunit;
|
|---|
| 265 | parameter.dimension[5] *= aunit;
|
|---|
| 266 | parameter.dimension[6] *= aunit;
|
|---|
| 267 | }
|
|---|
| 268 |
|
|---|
| 269 | void G4GDMLReadParamvol::
|
|---|
| 270 | Sphere_dimensionsRead( const xercesc::DOMElement* const element,
|
|---|
| 271 | G4GDMLParameterisation::PARAMETER& parameter )
|
|---|
| 272 | {
|
|---|
| 273 | G4double lunit = 1.0;
|
|---|
| 274 | G4double aunit = 1.0;
|
|---|
| 275 |
|
|---|
| 276 | const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
|
|---|
| 277 | XMLSize_t attributeCount = attributes->getLength();
|
|---|
| 278 |
|
|---|
| 279 | for (XMLSize_t attribute_index=0;
|
|---|
| 280 | attribute_index<attributeCount; attribute_index++)
|
|---|
| 281 | {
|
|---|
| 282 | xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
|
|---|
| 283 |
|
|---|
| 284 | if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
|
|---|
| 285 | { continue; }
|
|---|
| 286 |
|
|---|
| 287 | const xercesc::DOMAttr* const attribute
|
|---|
| 288 | = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
|
|---|
| 289 | const G4String attName = Transcode(attribute->getName());
|
|---|
| 290 | const G4String attValue = Transcode(attribute->getValue());
|
|---|
| 291 |
|
|---|
| 292 | if (attName=="lunit")
|
|---|
| 293 | { lunit = eval.Evaluate(attValue); } else
|
|---|
| 294 | if (attName=="aunit")
|
|---|
| 295 | { aunit = eval.Evaluate(attValue); } else
|
|---|
| 296 | if (attName=="rmin")
|
|---|
| 297 | { parameter.dimension[0] = eval.Evaluate(attValue); } else
|
|---|
| 298 | if (attName=="rmax")
|
|---|
| 299 | { parameter.dimension[1] = eval.Evaluate(attValue); } else
|
|---|
| 300 | if (attName=="startphi")
|
|---|
| 301 | { parameter.dimension[2] = eval.Evaluate(attValue); } else
|
|---|
| 302 | if (attName=="deltaphi")
|
|---|
| 303 | { parameter.dimension[3] = eval.Evaluate(attValue); } else
|
|---|
| 304 | if (attName=="starttheta")
|
|---|
| 305 | { parameter.dimension[4] = eval.Evaluate(attValue); } else
|
|---|
| 306 | if (attName=="deltatheta")
|
|---|
| 307 | { parameter.dimension[5] = eval.Evaluate(attValue); }
|
|---|
| 308 | }
|
|---|
| 309 |
|
|---|
| 310 | parameter.dimension[0] *= lunit;
|
|---|
| 311 | parameter.dimension[1] *= lunit;
|
|---|
| 312 | parameter.dimension[2] *= aunit;
|
|---|
| 313 | parameter.dimension[3] *= aunit;
|
|---|
| 314 | parameter.dimension[4] *= aunit;
|
|---|
| 315 | parameter.dimension[5] *= aunit;
|
|---|
| 316 | }
|
|---|
| 317 |
|
|---|
| 318 | void G4GDMLReadParamvol::
|
|---|
| 319 | Orb_dimensionsRead( const xercesc::DOMElement* const element,
|
|---|
| 320 | G4GDMLParameterisation::PARAMETER& parameter )
|
|---|
| 321 | {
|
|---|
| 322 | G4double lunit = 1.0;
|
|---|
| 323 |
|
|---|
| 324 | const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
|
|---|
| 325 | XMLSize_t attributeCount = attributes->getLength();
|
|---|
| 326 |
|
|---|
| 327 | for (XMLSize_t attribute_index=0;
|
|---|
| 328 | attribute_index<attributeCount; attribute_index++)
|
|---|
| 329 | {
|
|---|
| 330 | xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
|
|---|
| 331 |
|
|---|
| 332 | if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
|
|---|
| 333 | { continue; }
|
|---|
| 334 |
|
|---|
| 335 | const xercesc::DOMAttr* const attribute
|
|---|
| 336 | = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
|
|---|
| 337 | const G4String attName = Transcode(attribute->getName());
|
|---|
| 338 | const G4String attValue = Transcode(attribute->getValue());
|
|---|
| 339 |
|
|---|
| 340 | if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else
|
|---|
| 341 | if (attName=="r") { parameter.dimension[0] = eval.Evaluate(attValue); }
|
|---|
| 342 | }
|
|---|
| 343 |
|
|---|
| 344 | parameter.dimension[0] *= lunit;
|
|---|
| 345 | }
|
|---|
| 346 |
|
|---|
| 347 | void G4GDMLReadParamvol::
|
|---|
| 348 | Torus_dimensionsRead( const xercesc::DOMElement* const element,
|
|---|
| 349 | G4GDMLParameterisation::PARAMETER& parameter )
|
|---|
| 350 | {
|
|---|
| 351 | G4double lunit = 1.0;
|
|---|
| 352 | G4double aunit = 1.0;
|
|---|
| 353 |
|
|---|
| 354 | const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
|
|---|
| 355 | XMLSize_t attributeCount = attributes->getLength();
|
|---|
| 356 |
|
|---|
| 357 | for (XMLSize_t attribute_index=0;
|
|---|
| 358 | attribute_index<attributeCount; attribute_index++)
|
|---|
| 359 | {
|
|---|
| 360 | xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
|
|---|
| 361 |
|
|---|
| 362 | if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
|
|---|
| 363 | { continue; }
|
|---|
| 364 |
|
|---|
| 365 | const xercesc::DOMAttr* const attribute
|
|---|
| 366 | = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
|
|---|
| 367 | const G4String attName = Transcode(attribute->getName());
|
|---|
| 368 | const G4String attValue = Transcode(attribute->getValue());
|
|---|
| 369 |
|
|---|
| 370 | if (attName=="lunit")
|
|---|
| 371 | { lunit = eval.Evaluate(attValue); } else
|
|---|
| 372 | if (attName=="aunit")
|
|---|
| 373 | { aunit = eval.Evaluate(attValue); } else
|
|---|
| 374 | if (attName=="rmin")
|
|---|
| 375 | { parameter.dimension[0] = eval.Evaluate(attValue); } else
|
|---|
| 376 | if (attName=="rmax")
|
|---|
| 377 | { parameter.dimension[1] = eval.Evaluate(attValue); } else
|
|---|
| 378 | if (attName=="rtor")
|
|---|
| 379 | { parameter.dimension[2] = eval.Evaluate(attValue); } else
|
|---|
| 380 | if (attName=="startphi")
|
|---|
| 381 | { parameter.dimension[3] = eval.Evaluate(attValue); } else
|
|---|
| 382 | if (attName=="deltaphi")
|
|---|
| 383 | { parameter.dimension[4] = eval.Evaluate(attValue); }
|
|---|
| 384 | }
|
|---|
| 385 |
|
|---|
| 386 | parameter.dimension[0] *= lunit;
|
|---|
| 387 | parameter.dimension[1] *= lunit;
|
|---|
| 388 | parameter.dimension[2] *= lunit;
|
|---|
| 389 | parameter.dimension[3] *= aunit;
|
|---|
| 390 | parameter.dimension[4] *= aunit;
|
|---|
| 391 | }
|
|---|
| 392 |
|
|---|
| 393 | void G4GDMLReadParamvol::
|
|---|
| 394 | Para_dimensionsRead( const xercesc::DOMElement* const element,
|
|---|
| 395 | G4GDMLParameterisation::PARAMETER& parameter )
|
|---|
| 396 | {
|
|---|
| 397 | G4double lunit = 1.0;
|
|---|
| 398 | G4double aunit = 1.0;
|
|---|
| 399 |
|
|---|
| 400 | const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
|
|---|
| 401 | XMLSize_t attributeCount = attributes->getLength();
|
|---|
| 402 |
|
|---|
| 403 | for (XMLSize_t attribute_index=0;
|
|---|
| 404 | attribute_index<attributeCount; attribute_index++)
|
|---|
| 405 | {
|
|---|
| 406 | xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
|
|---|
| 407 |
|
|---|
| 408 | if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
|
|---|
| 409 | { continue; }
|
|---|
| 410 |
|
|---|
| 411 | const xercesc::DOMAttr* const attribute
|
|---|
| 412 | = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
|
|---|
| 413 | const G4String attName = Transcode(attribute->getName());
|
|---|
| 414 | const G4String attValue = Transcode(attribute->getValue());
|
|---|
| 415 |
|
|---|
| 416 | if (attName=="lunit")
|
|---|
| 417 | { lunit = eval.Evaluate(attValue); } else
|
|---|
| 418 | if (attName=="aunit")
|
|---|
| 419 | { aunit = eval.Evaluate(attValue); } else
|
|---|
| 420 | if (attName=="x")
|
|---|
| 421 | { parameter.dimension[0] = eval.Evaluate(attValue); } else
|
|---|
| 422 | if (attName=="y")
|
|---|
| 423 | { parameter.dimension[1] = eval.Evaluate(attValue); } else
|
|---|
| 424 | if (attName=="z")
|
|---|
| 425 | { parameter.dimension[2] = eval.Evaluate(attValue); } else
|
|---|
| 426 | if (attName=="alpha")
|
|---|
| 427 | { parameter.dimension[3] = eval.Evaluate(attValue); } else
|
|---|
| 428 | if (attName=="theta")
|
|---|
| 429 | { parameter.dimension[4] = eval.Evaluate(attValue); } else
|
|---|
| 430 | if (attName=="phi")
|
|---|
| 431 | { parameter.dimension[5] = eval.Evaluate(attValue); }
|
|---|
| 432 | }
|
|---|
| 433 |
|
|---|
| 434 | parameter.dimension[0] = 0.5*lunit;
|
|---|
| 435 | parameter.dimension[1] = 0.5*lunit;
|
|---|
| 436 | parameter.dimension[2] = 0.5*lunit;
|
|---|
| 437 | parameter.dimension[3] = aunit;
|
|---|
| 438 | parameter.dimension[4] = aunit;
|
|---|
| 439 | parameter.dimension[5] = aunit;
|
|---|
| 440 | }
|
|---|
| 441 |
|
|---|
| 442 | void G4GDMLReadParamvol::
|
|---|
| 443 | Hype_dimensionsRead( const xercesc::DOMElement* const element,
|
|---|
| 444 | G4GDMLParameterisation::PARAMETER& parameter )
|
|---|
| 445 | {
|
|---|
| 446 | G4double lunit = 1.0;
|
|---|
| 447 | G4double aunit = 1.0;
|
|---|
| 448 |
|
|---|
| 449 | const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
|
|---|
| 450 | XMLSize_t attributeCount = attributes->getLength();
|
|---|
| 451 |
|
|---|
| 452 | for (XMLSize_t attribute_index=0;
|
|---|
| 453 | attribute_index<attributeCount; attribute_index++)
|
|---|
| 454 | {
|
|---|
| 455 | xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
|
|---|
| 456 |
|
|---|
| 457 | if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
|
|---|
| 458 | { continue; }
|
|---|
| 459 |
|
|---|
| 460 | const xercesc::DOMAttr* const attribute
|
|---|
| 461 | = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
|
|---|
| 462 | const G4String attName = Transcode(attribute->getName());
|
|---|
| 463 | const G4String attValue = Transcode(attribute->getValue());
|
|---|
| 464 |
|
|---|
| 465 | if (attName=="lunit")
|
|---|
| 466 | { lunit = eval.Evaluate(attValue); } else
|
|---|
| 467 | if (attName=="aunit")
|
|---|
| 468 | { aunit = eval.Evaluate(attValue); } else
|
|---|
| 469 | if (attName=="rmin")
|
|---|
| 470 | { parameter.dimension[0] = eval.Evaluate(attValue); } else
|
|---|
| 471 | if (attName=="rmax")
|
|---|
| 472 | { parameter.dimension[1] = eval.Evaluate(attValue); } else
|
|---|
| 473 | if (attName=="inst")
|
|---|
| 474 | { parameter.dimension[2] = eval.Evaluate(attValue); } else
|
|---|
| 475 | if (attName=="outst")
|
|---|
| 476 | { parameter.dimension[3] = eval.Evaluate(attValue); } else
|
|---|
| 477 | if (attName=="z")
|
|---|
| 478 | { parameter.dimension[4] = eval.Evaluate(attValue); }
|
|---|
| 479 | }
|
|---|
| 480 |
|
|---|
| 481 | parameter.dimension[0] = lunit;
|
|---|
| 482 | parameter.dimension[1] = lunit;
|
|---|
| 483 | parameter.dimension[2] = aunit;
|
|---|
| 484 | parameter.dimension[3] = aunit;
|
|---|
| 485 | parameter.dimension[4] = 0.5*lunit;
|
|---|
| 486 | }
|
|---|
| 487 |
|
|---|
| 488 | void G4GDMLReadParamvol::
|
|---|
| 489 | ParametersRead(const xercesc::DOMElement* const element) {
|
|---|
| 490 |
|
|---|
| 491 | G4ThreeVector rotation(0.0,0.0,0.0);
|
|---|
| 492 | G4ThreeVector position(0.0,0.0,0.0);
|
|---|
| 493 |
|
|---|
| 494 | G4GDMLParameterisation::PARAMETER parameter;
|
|---|
| 495 |
|
|---|
| 496 | for (xercesc::DOMNode* iter = element->getFirstChild();
|
|---|
| 497 | iter != 0; iter = iter->getNextSibling())
|
|---|
| 498 | {
|
|---|
| 499 | if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
|
|---|
| 500 |
|
|---|
| 501 | const xercesc::DOMElement* const child
|
|---|
| 502 | = dynamic_cast<xercesc::DOMElement*>(iter);
|
|---|
| 503 | const G4String tag = Transcode(child->getTagName());
|
|---|
| 504 | if (tag=="rotation") { VectorRead(child,rotation); } else
|
|---|
| 505 | if (tag=="position") { VectorRead(child,position); } else
|
|---|
| 506 | if (tag=="positionref")
|
|---|
| 507 | { position = GetPosition(GenerateName(RefRead(child))); } else
|
|---|
| 508 | if (tag=="rotationref")
|
|---|
| 509 | { rotation = GetRotation(GenerateName(RefRead(child))); } else
|
|---|
| 510 | if (tag=="box_dimensions") { Box_dimensionsRead(child,parameter); } else
|
|---|
| 511 | if (tag=="trd_dimensions") { Trd_dimensionsRead(child,parameter); } else
|
|---|
| 512 | if (tag=="trap_dimensions") { Trap_dimensionsRead(child,parameter); } else
|
|---|
| 513 | if (tag=="tube_dimensions") { Tube_dimensionsRead(child,parameter); } else
|
|---|
| 514 | if (tag=="cone_dimensions") { Cone_dimensionsRead(child,parameter); } else
|
|---|
| 515 | if (tag=="sphere_dimensions") { Cone_dimensionsRead(child,parameter); } else
|
|---|
| 516 | if (tag=="orb_dimensions") { Cone_dimensionsRead(child,parameter); } else
|
|---|
| 517 | if (tag=="torus_dimensions") { Cone_dimensionsRead(child,parameter); } else
|
|---|
| 518 | if (tag=="para_dimensions") { Cone_dimensionsRead(child,parameter); } else
|
|---|
| 519 | if (tag=="hype_dimensions") { Hype_dimensionsRead(child,parameter); }
|
|---|
| 520 | else
|
|---|
| 521 | {
|
|---|
| 522 | G4String error_msg = "Unknown tag in parameters: " + tag;
|
|---|
| 523 | G4Exception("G4GDMLReadParamvol::ParametersRead()", "ReadError",
|
|---|
| 524 | FatalException, error_msg);
|
|---|
| 525 | }
|
|---|
| 526 | }
|
|---|
| 527 |
|
|---|
| 528 | parameter.pRot = new G4RotationMatrix();
|
|---|
| 529 |
|
|---|
| 530 | parameter.pRot->rotateX(rotation.x());
|
|---|
| 531 | parameter.pRot->rotateY(rotation.y());
|
|---|
| 532 | parameter.pRot->rotateZ(rotation.z());
|
|---|
| 533 |
|
|---|
| 534 | parameter.position = position;
|
|---|
| 535 |
|
|---|
| 536 | parameterisation->AddParameter(parameter);
|
|---|
| 537 | }
|
|---|
| 538 |
|
|---|
| 539 | void G4GDMLReadParamvol::
|
|---|
| 540 | ParameterisedRead(const xercesc::DOMElement* const element)
|
|---|
| 541 | {
|
|---|
| 542 | for (xercesc::DOMNode* iter = element->getFirstChild();
|
|---|
| 543 | iter != 0; iter = iter->getNextSibling())
|
|---|
| 544 | {
|
|---|
| 545 | if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
|
|---|
| 546 |
|
|---|
| 547 | const xercesc::DOMElement* const child
|
|---|
| 548 | = dynamic_cast<xercesc::DOMElement*>(iter);
|
|---|
| 549 | const G4String tag = Transcode(child->getTagName());
|
|---|
| 550 |
|
|---|
| 551 | if (tag=="parameters")
|
|---|
| 552 | {
|
|---|
| 553 | G4double number = 1;
|
|---|
| 554 | const xercesc::DOMNamedNodeMap* const attributes
|
|---|
| 555 | = element->getAttributes();
|
|---|
| 556 | XMLSize_t attributeCount = attributes->getLength();
|
|---|
| 557 | for (XMLSize_t attribute_index=0;
|
|---|
| 558 | attribute_index<attributeCount; attribute_index++)
|
|---|
| 559 | {
|
|---|
| 560 | xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
|
|---|
| 561 |
|
|---|
| 562 | if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
|
|---|
| 563 | { continue; }
|
|---|
| 564 |
|
|---|
| 565 | const xercesc::DOMAttr* const attribute
|
|---|
| 566 | = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
|
|---|
| 567 | const G4String attName = Transcode(attribute->getName());
|
|---|
| 568 | const G4String attValue = Transcode(attribute->getValue());
|
|---|
| 569 |
|
|---|
| 570 | if (attName=="number") { number = eval.Evaluate(attValue); }
|
|---|
| 571 | }
|
|---|
| 572 | ParametersRead(child);
|
|---|
| 573 | }
|
|---|
| 574 | else
|
|---|
| 575 | {
|
|---|
| 576 | if (tag=="loop") { LoopRead(child,&G4GDMLRead::Paramvol_contentRead); }
|
|---|
| 577 | }
|
|---|
| 578 | }
|
|---|
| 579 | }
|
|---|
| 580 |
|
|---|
| 581 | void G4GDMLReadParamvol::
|
|---|
| 582 | Paramvol_contentRead(const xercesc::DOMElement* const element)
|
|---|
| 583 | {
|
|---|
| 584 | for (xercesc::DOMNode* iter = element->getFirstChild();
|
|---|
| 585 | iter != 0; iter = iter->getNextSibling())
|
|---|
| 586 | {
|
|---|
| 587 | if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
|
|---|
| 588 |
|
|---|
| 589 | const xercesc::DOMElement* const child
|
|---|
| 590 | = dynamic_cast<xercesc::DOMElement*>(iter);
|
|---|
| 591 | const G4String tag = Transcode(child->getTagName());
|
|---|
| 592 | if (tag=="parameterised_position_size") { ParameterisedRead(child); }else
|
|---|
| 593 | if (tag=="loop") { LoopRead(child,&G4GDMLRead::Paramvol_contentRead); }
|
|---|
| 594 | }
|
|---|
| 595 | }
|
|---|
| 596 |
|
|---|
| 597 | void G4GDMLReadParamvol::
|
|---|
| 598 | ParamvolRead(const xercesc::DOMElement* const element, G4LogicalVolume* mother)
|
|---|
| 599 | {
|
|---|
| 600 | G4String volumeref;
|
|---|
| 601 |
|
|---|
| 602 | parameterisation = new G4GDMLParameterisation();
|
|---|
| 603 |
|
|---|
| 604 | for (xercesc::DOMNode* iter = element->getFirstChild();
|
|---|
| 605 | iter != 0; iter = iter->getNextSibling())
|
|---|
| 606 | {
|
|---|
| 607 | if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
|
|---|
| 608 |
|
|---|
| 609 | const xercesc::DOMElement* const child
|
|---|
| 610 | = dynamic_cast<xercesc::DOMElement*>(iter);
|
|---|
| 611 | const G4String tag = Transcode(child->getTagName());
|
|---|
| 612 |
|
|---|
| 613 | if (tag=="volumeref") { volumeref = RefRead(child); }
|
|---|
| 614 |
|
|---|
| 615 | }
|
|---|
| 616 |
|
|---|
| 617 | Paramvol_contentRead(element);
|
|---|
| 618 |
|
|---|
| 619 | G4LogicalVolume* logvol = GetVolume(GenerateName(volumeref));
|
|---|
| 620 |
|
|---|
| 621 | if (parameterisation->GetSize()==0)
|
|---|
| 622 | {
|
|---|
| 623 | G4Exception("G4GDMLReadParamvol::ParamvolRead()",
|
|---|
| 624 | "ReadError", FatalException,
|
|---|
| 625 | "No parameters are defined in parameterised volume!");
|
|---|
| 626 | }
|
|---|
| 627 | G4String pv_name = logvol->GetName() + "_param";
|
|---|
| 628 | new G4PVParameterised(pv_name, logvol, mother, kUndefined,
|
|---|
| 629 | parameterisation->GetSize(), parameterisation, check);
|
|---|
| 630 | }
|
|---|