Logo ROOT   6.14/05
Reference Guide
TGDMLParse.cxx
Go to the documentation of this file.
1 /* @(#)root/gdml:$Id$ */
2 // Author: Ben Lloyd 09/11/06
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 
13 /** \class TGDMLParse
14 \ingroup Geometry_gdml
15 
16  This class contains the implementation of the GDML parser associated to
17  all the supported GDML elements. User should never need to explicitly
18  instaciate this class. It is internally used by the TGeoManager.
19 
20  Each element process has a 'Binding' to ROOT. The 'binding' is specific
21  mapping of GDML elements (materials, solids, etc) to specific objects which
22  should be instanciated by the converted. In the present case (ROOT) the
23  binding is implemented at the near the end of each process function. Most
24  bindings follow similar format, dependent on what is being added to the
25  geometry.
26 
27  This file also contains the implementation of the TGDMLRefl class. This is
28  just a small helper class used internally by the 'reflection' method (for
29  reflected solids).
30 
31  The presently supported list of TGeo classes is the following:
32 
33 #### Materials:
34  - TGeoElement
35  - TGeoMaterial
36  - TGeoMixture
37 
38 #### Solids:
39  - TGeoBBox
40  - TGeoArb8
41  - TGeoTubeSeg
42  - TGeoConeSeg
43  - TGeoCtub
44  - TGeoPcon
45  - TGeoTrap
46  - TGeoGtra
47  - TGeoTrd2
48  - TGeoSphere
49  - TGeoPara
50  - TGeoTorus
51  - TGeoHype
52  - TGeoPgon
53  - TGeoXtru
54  - TGeoEltu
55  - TGeoParaboloid
56  - TGeoCompositeShape (subtraction, union, intersection)
57 
58 #### Approximated Solids:
59  - Ellipsoid (approximated to a TGeoBBox)
60  - Elliptical cone (approximated to a TGeoCone)
61 
62 #### Geometry:
63  - TGeoVolume
64  - TGeoVolumeAssembly
65  - divisions
66  - reflection
67 
68 When most solids or volumes are added to the geometry they
69 
70 
71  Whenever a new element is added to GDML schema, this class needs to be extended.
72  The appropriate method (process) needs to be implemented, as well as the new
73  element process then needs to be linked thru the function TGDMLParse
74 
75  For any question or remarks concerning this code, please send an email to
76  ben.lloyd@cern.ch
77 
78 */
79 
80 #include "TGeoManager.h"
81 #include "TGeoMatrix.h"
82 #include "TXMLEngine.h"
83 #include "TGeoVolume.h"
84 #include "TGeoBBox.h"
85 #include "TGeoParaboloid.h"
86 #include "TGeoArb8.h"
87 #include "TGeoTube.h"
88 #include "TGeoCone.h"
89 #include "TGeoTrd2.h"
90 #include "TGeoPcon.h"
91 #include "TGeoPgon.h"
92 #include "TGeoSphere.h"
93 #include "TGeoTorus.h"
94 #include "TGeoPara.h"
95 #include "TGeoHype.h"
96 #include "TGeoEltu.h"
97 #include "TGeoXtru.h"
98 #include "TGeoScaledShape.h"
99 #include "TGeoVolume.h"
100 #include "TROOT.h"
101 #include "TMath.h"
102 #include "TMap.h"
103 #include "TObjString.h"
104 #include "TGeoExtension.h"
105 #include "TGeoMaterial.h"
106 #include "TGeoBoolNode.h"
107 #include "TGeoMedium.h"
108 #include "TGeoElement.h"
109 #include "TGeoShape.h"
110 #include "TGeoCompositeShape.h"
111 #include "TGeoRegion.h"
112 #include "TGDMLParse.h"
113 #include <stdlib.h>
114 #include <string>
115 #include <locale>
116 
118 
119 ////////////////////////////////////////////////////////////////////////////////
120 /// Creates the new instance of the XMLEngine called 'gdml', using the filename >>
121 /// then parses the file and creates the DOM tree. Then passes the DOM to the
122 /// next function to translate it.
123 
124 TGeoVolume* TGDMLParse::GDMLReadFile(const char* filename)
125 {
126  // First create engine
127  TXMLEngine* gdml = new TXMLEngine;
128  gdml->SetSkipComments(kTRUE);
129 
130  // Now try to parse xml file
131  XMLDocPointer_t gdmldoc = gdml->ParseFile(filename);
132  if (gdmldoc == 0) {
133  delete gdml;
134  return 0;
135  } else {
136 
137  // take access to main node
138  XMLNodePointer_t mainnode = gdml->DocGetRootElement(gdmldoc);
139 
140  fFileEngine[fFILENO] = gdml;
141  fStartFile = filename;
142  fCurrentFile = filename;
143 
144  // display recursively all nodes and subnodes
145  ParseGDML(gdml, mainnode);
146 
147  // Release memory before exit
148  gdml->FreeDoc(gdmldoc);
149  delete gdml;
150 
151  }
152  return fWorld;
153 
154 }
155 
156 ////////////////////////////////////////////////////////////////////////////////
157 /// This function recursively moves thru the DOM tree of the GDML file. It checks for
158 /// key words along the way and if a key word is found it calls the corresponding
159 /// function to interpret the node.
160 
162 {
163  XMLAttrPointer_t attr = gdml->GetFirstAttr(node);
164  const char* name = gdml->GetNodeName(node);
165  XMLNodePointer_t parentn = gdml->GetParent(node);
166  const char* parent = gdml->GetNodeName(parentn);
167  XMLNodePointer_t childtmp = 0;
168 
169  const char* posistr = "position";
170  const char* setustr = "setup";
171  const char* consstr = "constant";
172  const char* varistr = "variable";
173  const char* rotastr = "rotation";
174  const char* scalstr = "scale";
175  const char* elemstr = "element";
176  const char* istpstr = "isotope";
177  const char* matestr = "material";
178  const char* volustr = "volume";
179  const char* assestr = "assembly";
180  const char* twtrstr = "twistedtrap"; //name changed according to schema
181  const char* cutTstr = "cutTube";
182  const char* bboxstr = "box";
183  const char* xtrustr = "xtru";
184  const char* arb8str = "arb8";
185  const char* tubestr = "tube";
186  const char* conestr = "cone";
187  const char* polystr = "polycone";
188  const char* hypestr = "hype";
189  const char* trapstr = "trap";
190  const char* trdstr = "trd";
191  const char* sphestr = "sphere";
192  const char* orbstr = "orb";
193  const char* parastr = "para";
194  const char* torustr = "torus";
195  const char* hedrstr = "polyhedra";
196  const char* eltustr = "eltube";
197  const char* subtstr = "subtraction";
198  const char* uniostr = "union";
199  const char* parbstr = "paraboloid";
200  const char* intestr = "intersection";
201  const char* reflstr = "reflectedSolid";
202  const char* ellistr = "ellipsoid";
203  const char* elcnstr = "elcone";
204  const char* usrstr = "userinfo";
205  Bool_t hasIsotopes;
206  Bool_t hasIsotopesExtended;
207 
208  if ((strcmp(name, posistr)) == 0) {
209  node = PosProcess(gdml, node, attr);
210  } else if ((strcmp(name, rotastr)) == 0) {
211  node = RotProcess(gdml, node, attr);
212  } else if ((strcmp(name, scalstr)) == 0) {
213  node = SclProcess(gdml, node, attr);
214  } else if ((strcmp(name, setustr)) == 0) {
215  node = TopProcess(gdml, node);
216  } else if ((strcmp(name, consstr)) == 0) {
217  node = ConProcess(gdml, node, attr);
218  } else if ((strcmp(name, varistr)) == 0) {
219  node = ConProcess(gdml, node, attr);
220  }
221  //*************eleprocess********************************
222 
223  else if (((strcmp(name, "atom")) == 0) && ((strcmp(parent, elemstr)) == 0)) {
224  hasIsotopes = kFALSE;
225  hasIsotopesExtended = kFALSE;
226  node = EleProcess(gdml, node, parentn, hasIsotopes, hasIsotopesExtended);
227  }
228  else if ((strcmp(name, elemstr) == 0) && !gdml->HasAttr(node, "Z")) {
229  hasIsotopes = kTRUE;
230  hasIsotopesExtended = kFALSE;
231  node = EleProcess(gdml, node, parentn, hasIsotopes, hasIsotopesExtended);
232  }
233 
234  else if ((strcmp(name, elemstr) == 0) && gdml->HasAttr(node, "Z")) {
235  childtmp = gdml->GetChild(node);
236  if ((strcmp(gdml->GetNodeName(childtmp), "fraction") == 0) ){
237  hasIsotopes = kFALSE;
238  hasIsotopesExtended = kTRUE;
239  node = EleProcess(gdml, node, parentn, hasIsotopes, hasIsotopesExtended);}
240  }
241 
242  //********isoprocess******************************
243 
244  else if (((strcmp(name, "atom")) == 0) && ((strcmp(parent, istpstr)) == 0)) {
245  node = IsoProcess(gdml, node, parentn);
246  }
247 
248  //********matprocess***********************************
249  else if ((strcmp(name, matestr)) == 0 && gdml->HasAttr(node, "Z")) {
250  childtmp = gdml->GetChild(node);
251 // if ((strcmp(gdml->GetNodeName(childtmp), "fraction") == 0) || (strcmp(gdml->GetNodeName(childtmp), "D") == 0)){
252  // Bool_t frac = kFALSE;
253  Bool_t atom = kFALSE;
254  while(childtmp) {
255  // frac = strcmp(gdml->GetNodeName(childtmp),"fraction")==0;
256  atom = strcmp(gdml->GetNodeName(childtmp),"atom")==0;
257  gdml->ShiftToNext(childtmp);
258  }
259  int z = (atom) ? 1 : 0;
260  node = MatProcess(gdml, node, attr, z);
261  }
262  else if ((strcmp(name, matestr)) == 0 && !gdml->HasAttr(node, "Z")) {
263  int z = 0;
264  node = MatProcess(gdml, node, attr, z);
265  }
266 
267  //*********************************************
268  else if ((strcmp(name, volustr)) == 0) {
269  node = VolProcess(gdml, node);
270  } else if ((strcmp(name, bboxstr)) == 0) {
271  node = Box(gdml, node, attr);
272  } else if ((strcmp(name, ellistr)) == 0) {
273  node = Ellipsoid(gdml, node, attr);
274  } else if ((strcmp(name, elcnstr)) == 0) {
275  node = ElCone(gdml, node, attr);
276  } else if ((strcmp(name, cutTstr)) == 0) {
277  node = CutTube(gdml, node, attr);
278  } else if ((strcmp(name, arb8str)) == 0) {
279  node = Arb8(gdml, node, attr);
280  } else if ((strcmp(name, tubestr)) == 0) {
281  node = Tube(gdml, node, attr);
282  } else if ((strcmp(name, conestr)) == 0) {
283  node = Cone(gdml, node, attr);
284  } else if ((strcmp(name, polystr)) == 0) {
285  node = Polycone(gdml, node, attr);
286  } else if ((strcmp(name, trapstr)) == 0) {
287  node = Trap(gdml, node, attr);
288  } else if ((strcmp(name, trdstr)) == 0) {
289  node = Trd(gdml, node, attr);
290  } else if ((strcmp(name, sphestr)) == 0) {
291  node = Sphere(gdml, node, attr);
292  } else if ((strcmp(name, xtrustr)) == 0) {
293  node = Xtru(gdml, node, attr);
294  } else if ((strcmp(name, twtrstr)) == 0) {
295  node = TwistTrap(gdml, node, attr);
296  } else if ((strcmp(name, hypestr)) == 0) {
297  node = Hype(gdml, node, attr);
298  } else if ((strcmp(name, orbstr)) == 0) {
299  node = Orb(gdml, node, attr);
300  } else if ((strcmp(name, parastr)) == 0) {
301  node = Para(gdml, node, attr);
302  } else if ((strcmp(name, torustr)) == 0) {
303  node = Torus(gdml, node, attr);
304  } else if ((strcmp(name, eltustr)) == 0) {
305  node = ElTube(gdml, node, attr);
306  } else if ((strcmp(name, hedrstr)) == 0) {
307  node = Polyhedra(gdml, node, attr);
308  } else if ((strcmp(name, parbstr)) == 0) {
309  node = Paraboloid(gdml, node, attr);
310  } else if ((strcmp(name, subtstr)) == 0) {
311  node = BooSolid(gdml, node, attr, 1);
312  } else if ((strcmp(name, intestr)) == 0) {
313  node = BooSolid(gdml, node, attr, 2);
314  } else if ((strcmp(name, uniostr)) == 0) {
315  node = BooSolid(gdml, node, attr, 3);
316  } else if ((strcmp(name, reflstr)) == 0) {
317  node = Reflection(gdml, node, attr);
318  } else if ((strcmp(name, assestr)) == 0) {
319  node = AssProcess(gdml, node);
320  } else if ((strcmp(name, usrstr)) == 0) {
321  node = UsrProcess(gdml, node);
322  //CHECK FOR TAGS NOT SUPPORTED
323  } else if (((strcmp(name, "gdml")) != 0) && ((strcmp(name, "define")) != 0) &&
324  ((strcmp(name, "element")) != 0) && ((strcmp(name, "materials")) != 0) &&
325  ((strcmp(name, "solids")) != 0) && ((strcmp(name, "structure")) != 0) &&
326  ((strcmp(name, "zplane")) != 0) && ((strcmp(name, "first")) != 0) &&
327  ((strcmp(name, "second")) != 0) && ((strcmp(name, "twoDimVertex")) != 0) &&
328  ((strcmp(name, "firstposition")) != 0) && ((strcmp(name, "firstpositionref")) != 0) &&
329  ((strcmp(name, "firstrotation")) != 0) && ((strcmp(name, "firstrotationref")) != 0) &&
330  ((strcmp(name, "section")) != 0) && ((strcmp(name, "world")) != 0) &&
331  ((strcmp(name, "isotope")) != 0)) {
332  std::cout << "Error: Unsupported GDML Tag Used :" << name << ". Please Check Geometry/Schema." << std::endl;
333  }
334 
335  // Check for Child node - if present call this funct. recursively until no more
336 
337  XMLNodePointer_t child = gdml->GetChild(node);
338  while (child != 0) {
339  ParseGDML(gdml, child);
340  child = gdml->GetNext(child);
341  }
342 
343  return fWorldName;
344 
345 }
346 
347 ////////////////////////////////////////////////////////////////////////////////
348 /// Takes a string containing a mathematical expression and returns the value of
349 /// the expression
350 
351 double TGDMLParse::Evaluate(const char* evalline)
352 {
353 
354  return TFormula("TFormula", evalline).Eval(0);
355 }
356 
357 ////////////////////////////////////////////////////////////////////////////////
358 /// When using the 'divide' process in the geometry this function
359 /// sets the variable 'axis' depending on what is specified.
360 
361 Int_t TGDMLParse::SetAxis(const char* axisString)
362 {
363  Int_t axis = 0;
364 
365  if ((strcmp(axisString, "kXAxis")) == 0) {
366  axis = 1;
367  } else if ((strcmp(axisString, "kYAxis")) == 0) {
368  axis = 2;
369  } else if ((strcmp(axisString, "kZAxis")) == 0) {
370  axis = 3;
371  } else if ((strcmp(axisString, "kRho")) == 0) {
372  axis = 1;
373  } else if ((strcmp(axisString, "kPhi")) == 0) {
374  axis = 2;
375  }
376 
377  return axis;
378 }
379 
380 ////////////////////////////////////////////////////////////////////////////////
381 /// This function looks thru a string for the chars '0x' next to
382 /// each other, when it finds this, it calls another function to strip
383 /// the hex address. It does this recursively until the end of the
384 /// string is reached, returning a string without any hex addresses.
385 
386 const char* TGDMLParse::NameShort(const char* name)
387 {
388  static TString stripped;
389  stripped = name;
390  Int_t index = stripped.Index("0x");
391  if (index >= 0) stripped = stripped(0, index);
392  return stripped.Data();
393 }
394 
395 ////////////////////////////////////////////////////////////////////////////////
396 /// In the define section of the GDML file, constants can be declared.
397 /// when the constant keyword is found, this function is called, and the
398 /// name and value of the constant is stored in the "fformvec" vector as
399 /// a TFormula class, representing a constant function
400 
402 {
403  TString name = "";
404  TString value = "";
405  TString tempattr;
406 
407  while (attr != 0) {
408  tempattr = gdml->GetAttrName(attr);
409  tempattr.ToLower();
410 
411  if (tempattr == "name") {
412  name = gdml->GetAttrValue(attr);
413  }
414  if (tempattr == "value") {
415  value = gdml->GetAttrValue(attr);
416  }
417  attr = gdml->GetNextAttr(attr);
418  }
419 
420  //if ((strcmp(fCurrentFile, fStartFile)) != 0) {
421  // name = TString::Format("%s_%s", name.Data(), fCurrentFile);
422  //}
423 
424  fconsts[name.Data()] = Value(value);
425 
426  return node;
427 }
428 ////////////////////////////////////////////////////////////////////////////////
429 /// Throughout the GDML file, a unit can de specified. Whether it be
430 /// angular or linear, values can be used as well as abbreviations such as
431 /// 'mm' or 'deg'. This function is passed the specified unit and if it is
432 /// found, replaces it with the appropriate value.
433 
434 TString TGDMLParse::GetScale(const char* unit)
435 {
436  TString retunit = "";
437 
438  if (strcmp(unit, "mm") == 0) {
439  retunit = "0.1";
440  } else if (strcmp(unit, "milimeter") == 0) {
441  retunit = "0.1";
442  } else if (strcmp(unit, "cm") == 0) {
443  retunit = "1.0";
444  } else if (strcmp(unit, "centimeter") == 0) {
445  retunit = "1.0";
446  } else if (strcmp(unit, "m") == 0) {
447  retunit = "100.0";
448  } else if (strcmp(unit, "meter") == 0) {
449  retunit = "100.0";
450  } else if (strcmp(unit, "km") == 0) {
451  retunit = "100000.0";
452  } else if (strcmp(unit, "kilometer") == 0) {
453  retunit = "100000.0";
454  } else if (strcmp(unit, "rad") == 0) {
455  retunit = TString::Format("%.12f", TMath::RadToDeg());
456  } else if (strcmp(unit, "radian") == 0) {
457  retunit = TString::Format("%.12f", TMath::RadToDeg());
458  } else if (strcmp(unit, "deg") == 0) {
459  retunit = "1.0";
460  } else if (strcmp(unit, "degree") == 0) {
461  retunit = "1.0";
462  } else if (strcmp(unit, "pi") == 0) {
463  retunit = "pi";
464  } else if (strcmp(unit, "avogadro") == 0) {
465  retunit = TString::Format("%.12g", TMath::Na());
466  } else {
467  Fatal("GetScale", "Unit <%s> not known", unit);
468  retunit = "0";
469  }
470  return retunit;
471 
472 }
473 
474 ////////////////////////////////////////////////////////////////////////////////
475 /// Throughout the GDML file, a unit can de specified. Whether it be
476 /// angular or linear, values can be used as well as abbreviations such as
477 /// 'mm' or 'deg'. This function is passed the specified unit and if it is
478 /// found, replaces it with the appropriate value.
479 
481 {
482  Double_t retunit = 0.;
483  TString unit(sunit);
484  unit.ToLower();
485 
486  if ((unit == "mm") || (unit == "milimeter")) {
487  retunit = 0.1;
488  } else if ((unit == "cm") || (unit == "centimeter")) {
489  retunit = 1.0;
490  } else if ((unit == "m") || (unit == "meter")) {
491  retunit = 100.0;
492  } else if ((unit == "km") || (unit == "kilometer")) {
493  retunit = 100000.0;
494  } else if ((unit == "rad") || (unit == "radian")) {
495  retunit = TMath::RadToDeg();
496  } else if ((unit == "deg") || (unit == "degree")) {
497  retunit = 1.0;
498  } else if ((unit == "ev") || (unit == "electronvolt")) {
499  retunit = 0.000000001;
500  } else if ((unit == "kev") || (unit == "kiloelectronvolt")) {
501  retunit = 0.000001;
502  } else if ((unit == "mev") || (unit == "megaelectronvolt")) {
503  retunit = 0.001;
504  } else if ((unit == "gev") || (unit == "gigaelectronvolt")) {
505  retunit = 1;
506  } else if (unit == "pi") {
507  retunit = TMath::Pi();
508  } else if (unit == "avogadro") {
509  retunit = TMath::Na();
510  } else {
511  Fatal("GetScaleVal", "Unit <%s> not known", sunit);
512  retunit = 0;
513  }
514  return retunit;
515 }
516 
517 ////////////////////////////////////////////////////////////////////////////////
518 /// Convert number in string format to double value.
519 
520 Double_t TGDMLParse::Value(const char *svalue) const
521 {
522  char *end;
523  double val = strtod(svalue, &end);
524 
525  // ignore white spaces.
526  while( *end != 0 && isspace(*end) ) ++end;
527 
528  // Successfully parsed all the characters up to the ending NULL, so svalue
529  // was a simple number.
530  if (*end == 0) return val;
531 
532  // Otherwise we'll use TFormula to evaluate the string, having first found
533  // all the GDML variable names in it and marked them with [] so that
534  // TFormula will recognize them as parameters.
535 
536  std::string expanded;
537  expanded.reserve(strlen(svalue) * 2);
538 
539  // Be careful about locale so we always mean the same thing by
540  // "alphanumeric"
541  const std::locale &loc = std::locale::classic(); // "C" locale
542 
543  // Walk through the string inserting '[' and ']' where necessary
544  const char *p = svalue;
545  while (*p) {
546  // Find a site for a '['. Just before the first alphabetic character
547  for (; *p != 0; ++p) {
548  if (std::isalpha(*p, loc) || *p == '_') {
549  expanded += '[';
550  break;
551  }
552  expanded += *p;
553  }
554  // If we reached the end of the string while looking for the start of a
555  // token then we're done
556  if (*p == 0) break;
557 
558  // Now look for the position of the following ']'. Straight before the
559  // first non-alphanumeric character
560  for (; *p != 0; ++p) {
561  if (!isalnum(*p, loc) && *p != '_') {
562  expanded += ']';
563  break;
564  }
565  expanded += *p;
566  }
567  // If we reached the end of the string while looking for a position for a
568  // ']' then it goes here
569  if (*p == 0) expanded += ']';
570  } // end loop over svalue
571 
572  TFormula f("TFormula", expanded.c_str());
573 
574  // Tell the TFormula about every parameter we know about
575  for (auto it: fconsts) f.SetParameter(it.first.c_str(), it.second);
576 
577  val = f.Eval(0);
578 
579  if (std::isnan(val) || std::isinf(val)) {
580  Fatal("Value", "Got bad value %lf from string '%s'", val, svalue);
581  }
582 
583  return val;
584 }
585 
586 ////////////////////////////////////////////////////////////////////////////////
587 /// In the define section of the GDML file, positions can be declared.
588 /// when the position keyword is found, this function is called, and the
589 /// name and values of the position are converted into type TGeoPosition
590 /// and stored in fposmap map using the name as its key. This function
591 /// can also be called when declaring solids.
592 
594 {
595  TString lunit = "mm";
596  TString xpos = "0";
597  TString ypos = "0";
598  TString zpos = "0";
599  TString name = "0";
600  TString tempattr;
601 
602  while (attr != 0) {
603 
604  tempattr = gdml->GetAttrName(attr);
605  tempattr.ToLower();
606 
607  if (tempattr == "name") {
608  name = gdml->GetAttrValue(attr);
609  } else if (tempattr == "x") {
610  xpos = gdml->GetAttrValue(attr);
611  } else if (tempattr == "y") {
612  ypos = gdml->GetAttrValue(attr);
613  } else if (tempattr == "z") {
614  zpos = gdml->GetAttrValue(attr);
615  } else if (tempattr == "unit") {
616  lunit = gdml->GetAttrValue(attr);
617  }
618 
619  attr = gdml->GetNextAttr(attr);
620  }
621 
622  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
623  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
624  }
625 
626  Double_t retunit = GetScaleVal(lunit);
627  Double_t xline = Value(xpos)*retunit;
628  Double_t yline = Value(ypos)*retunit;
629  Double_t zline = Value(zpos)*retunit;
630 
631  TGeoTranslation* pos = new TGeoTranslation(xline, yline, zline);
632 
633  fposmap[name.Data()] = pos;
634 
635  return node;
636 
637 }
638 
639 ////////////////////////////////////////////////////////////////////////////////
640 /// In the define section of the GDML file, rotations can be declared.
641 /// when the rotation keyword is found, this function is called, and the
642 /// name and values of the rotation are converted into type TGeoRotation
643 /// and stored in frotmap map using the name as its key. This function
644 /// can also be called when declaring solids.
645 
647 {
648  TString aunit = "rad";
649  TString xpos = "0";
650  TString ypos = "0";
651  TString zpos = "0";
652  TString name = "";
653  TString tempattr;
654 
655  while (attr != 0) {
656 
657  tempattr = gdml->GetAttrName(attr);
658  tempattr.ToLower();
659 
660  if (tempattr == "name") {
661  name = gdml->GetAttrValue(attr);
662  } else if (tempattr == "x") {
663  xpos = gdml->GetAttrValue(attr);
664  } else if (tempattr == "y") {
665  ypos = gdml->GetAttrValue(attr);
666  } else if (tempattr == "z") {
667  zpos = gdml->GetAttrValue(attr);
668  } else if (tempattr == "unit") {
669  aunit = gdml->GetAttrValue(attr);
670  }
671 
672  attr = gdml->GetNextAttr(attr);
673  }
674 
675  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
676  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
677  }
678 
679  Double_t retunit = GetScaleVal(aunit);
680 
681  Double_t xline = Value(xpos)*retunit;
682  Double_t yline = Value(ypos)*retunit;
683  Double_t zline = Value(zpos)*retunit;
684 
685  TGeoRotation* rot = new TGeoRotation();
686 
687  rot->RotateZ(-zline);
688  rot->RotateY(-yline);
689  rot->RotateX(-xline);
690 
691  frotmap[name.Data()] = rot;
692 
693  return node;
694 
695 }
696 
697 ////////////////////////////////////////////////////////////////////////////////
698 /// In the define section of the GDML file, rotations can be declared.
699 /// when the scale keyword is found, this function is called, and the
700 /// name and values of the scale are converted into type TGeoScale
701 /// and stored in fsclmap map using the name as its key. This function
702 /// can also be called when declaring solids.
703 
705 {
706  TString xpos = "0";
707  TString ypos = "0";
708  TString zpos = "0";
709  TString name = "";
710  TString tempattr;
711 
712  while (attr != 0) {
713 
714  tempattr = gdml->GetAttrName(attr);
715  tempattr.ToLower();
716 
717  if (tempattr == "name") {
718  name = gdml->GetAttrValue(attr);
719  } else if (tempattr == "x") {
720  xpos = gdml->GetAttrValue(attr);
721  } else if (tempattr == "y") {
722  ypos = gdml->GetAttrValue(attr);
723  } else if (tempattr == "z") {
724  zpos = gdml->GetAttrValue(attr);
725  }
726 
727  attr = gdml->GetNextAttr(attr);
728  }
729 
730  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
731  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
732  }
733 
734  TGeoScale* scl = new TGeoScale(Value(xpos), Value(ypos), Value(zpos));
735 
736  fsclmap[name.Data()] = scl;
737 
738  return node;
739 }
740 
741 ////////////////////////////////////////////////////////////////////////////////
742 /// In the material section of the GDML file, an isotope may be declared.
743 /// when the isotope keyword is found, this function is called, and the
744 /// required parameters are taken and stored, these are then bound and
745 /// converted to type TGeoIsotope and stored in fisomap map using the name
746 /// as its key.
747 
749 {
750  TString z = "0";
751  TString name = "";
752  TString n = "0";
753  TString atom = "0";
754  TString tempattr;
755 
756  //obtain attributes for the element
757 
758  XMLAttrPointer_t attr = gdml->GetFirstAttr(parentn);
759 
760  while (attr != 0) {
761 
762  tempattr = gdml->GetAttrName(attr);
763  tempattr.ToLower();
764 
765  if (tempattr == "name") {
766  name = gdml->GetAttrValue(attr);
767  } else if (tempattr == "z") {
768  z = gdml->GetAttrValue(attr);
769  } else if (tempattr == "n") {
770  n = gdml->GetAttrValue(attr);
771  }
772 
773  attr = gdml->GetNextAttr(attr);
774  }
775 
776  //get the atom value for the element
777 
778  attr = gdml->GetFirstAttr(node);
779 
780  while (attr != 0) {
781 
782  tempattr = gdml->GetAttrName(attr);
783 
784  if (tempattr == "value") {
785  atom = gdml->GetAttrValue(attr);
786  }
787 
788  attr = gdml->GetNextAttr(attr);
789  }
790 
791  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
792  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
793  }
794 
795  Int_t z2 = (Int_t)Value(z);
796  Int_t n2 = (Int_t)Value(n);
797  Double_t atom2 = Value(atom);
798 
799  TGeoManager* mgr = gGeoManager;
800  TString iso_name = NameShort(name);
801  TGeoElementTable* tab = mgr->GetElementTable();
802  TGeoIsotope* iso = tab->FindIsotope(iso_name);
803  if ( !iso ) {
804  iso = new TGeoIsotope(iso_name, z2 , n2, atom2);
805  }
806  else if ( gDebug >= 2 ) {
807  Info("TGDMLParse","Re-use existing isotope: %s",iso->GetName());
808  }
809  fisomap[name.Data()] = iso;
810 
811  return node;
812 
813 }
814 
815 ////////////////////////////////////////////////////////////////////////////////
816 /// When the element keyword is found, this function is called, and the
817 /// name and values of the element are converted into type TGeoElement and
818 /// stored in felemap map using the name as its key.
819 
820 XMLNodePointer_t TGDMLParse::EleProcess(TXMLEngine* gdml, XMLNodePointer_t node, XMLNodePointer_t parentn, Bool_t hasIsotopes, Bool_t hasIsotopesExtended)
821 
822 {
823  TString z = "0";
824  TString name = "";
825  TString formula = "";
826  TString atom = "0";
827  TString tempattr;
828  Int_t ncompo = 0;
829  TGeoManager* mgr = gGeoManager;
830  TGeoElementTable* tab = mgr->GetElementTable();
831  typedef FracMap::iterator fractions;
832  FracMap fracmap;
833 
834  XMLNodePointer_t child = 0;
835 
836  //obtain attributes for the element
837 
838  XMLAttrPointer_t attr = gdml->GetFirstAttr(node);
839 
840  if (hasIsotopes) {
841 
842  // Get the name of the element
843  while (attr != 0) {
844  tempattr = gdml->GetAttrName(attr);
845  if (tempattr == "name") {
846  name = gdml->GetAttrValue(attr);
847 
848  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
849  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
850  }
851  break;
852  }
853  attr = gdml->GetNextAttr(attr);
854  }
855  // Get component isotopes. Loop all children.
856  child = gdml->GetChild(node);
857  while (child != 0) {
858 
859  // Check for fraction node name
860  if ((strcmp(gdml->GetNodeName(child), "fraction")) == 0) {
861  Double_t n = 0;
862  TString ref = "";
863  ncompo = ncompo + 1;
864  attr = gdml->GetFirstAttr(child);
865  while (attr != 0) {
866  tempattr = gdml->GetAttrName(attr);
867  tempattr.ToLower();
868  if (tempattr == "n") {
869  n = Value(gdml->GetAttrValue(attr));
870  } else if (tempattr == "ref") {
871  ref = gdml->GetAttrValue(attr);
872  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
873  ref = TString::Format("%s_%s", ref.Data(), fCurrentFile);
874  }
875  }
876  attr = gdml->GetNextAttr(attr);
877  } // loop on child attributes
878  fracmap[ref.Data()] = n;
879  }
880  child = gdml->GetNext(child);
881  } // loop on children
882  // Create TGeoElement - note: Object(name, title) corresponds to Element(formula, name)
883  TGeoElement* ele = tab->FindElement(NameShort(name));
884  // We cannot use elements with Z = 0, so we expect a user definition
885  if (ele && ele->Z() == 0)
886  ele = nullptr;
887  if ( !ele ) {
888  ele = new TGeoElement(NameShort(name), NameShort(name), ncompo);
889  for (fractions f = fracmap.begin(); f != fracmap.end(); ++f) {
890  if (fisomap.find(f->first) != fisomap.end()) {
891  ele->AddIsotope((TGeoIsotope*)fisomap[f->first], f->second);
892  }
893  }
894  }
895  else if ( gDebug >= 2 ) {
896  Info("TGDMLParse","Re-use existing element: %s",ele->GetName());
897  }
898  felemap[name.Data()] = ele;
899  return child;
900  } // hasisotopes end loop
901 
902  //*************************
903 
904 
905  if (hasIsotopesExtended) {
906 
907  while (attr != 0) {
908  tempattr = gdml->GetAttrName(attr);
909 
910  if (tempattr == "name") {
911  name = gdml->GetAttrValue(attr);
912 
913  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
914  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
915  }
916  break;
917  }
918  attr = gdml->GetNextAttr(attr);
919  }
920  // Get component isotopes. Loop all children.
921  child = gdml->GetChild(node);
922  while (child != 0) {
923 
924  // Check for fraction node name
925  if ((strcmp(gdml->GetNodeName(child), "fraction")) == 0) {
926  Double_t n = 0;
927  TString ref = "";
928  ncompo = ncompo + 1;
929  attr = gdml->GetFirstAttr(child);
930  while (attr != 0) {
931  tempattr = gdml->GetAttrName(attr);
932  tempattr.ToLower();
933  if (tempattr == "n") {
934  n = Value(gdml->GetAttrValue(attr));
935  } else if (tempattr == "ref") {
936  ref = gdml->GetAttrValue(attr);
937  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
938  ref = TString::Format("%s_%s", ref.Data(), fCurrentFile);
939  }
940  }
941  attr = gdml->GetNextAttr(attr);
942  } // loop on child attributes
943  fracmap[ref.Data()] = n;
944  }
945  child = gdml->GetNext(child);
946  } // loop on children
947  // Create TGeoElement - note: Object(name, title) corresponds to Element(formula, name)
948  TGeoElement* ele = tab->FindElement(NameShort(name));
949  // We cannot use elements with Z = 0, so we expect a user definition
950  if (ele && ele->Z() == 0)
951  ele = nullptr;
952  if ( !ele ) {
953  ele = new TGeoElement(NameShort(name), NameShort(name), ncompo);
954  for (fractions f = fracmap.begin(); f != fracmap.end(); ++f) {
955  if (fisomap.find(f->first) != fisomap.end()) {
956  ele->AddIsotope((TGeoIsotope*)fisomap[f->first], f->second);
957  }
958  }
959  }
960  else if ( gDebug >= 2 ) {
961  Info("TGDMLParse","Re-use existing element: %s",ele->GetName());
962  }
963  felemap[name.Data()] = ele;
964  return child;
965  } // hasisotopesExtended end loop
966 
967  //***************************
968 
969  attr = gdml->GetFirstAttr(parentn);
970  while (attr != 0) {
971 
972  tempattr = gdml->GetAttrName(attr);
973  tempattr.ToLower();
974 
975  if (tempattr == "name") {
976  name = gdml->GetAttrValue(attr);
977 
978  } else if (tempattr == "z") {
979  z = gdml->GetAttrValue(attr);
980  } else if (tempattr == "formula") {
981  formula = gdml->GetAttrValue(attr);
982  }
983 
984  attr = gdml->GetNextAttr(attr);
985  }
986 
987  //get the atom value for the element
988 
989  attr = gdml->GetFirstAttr(node);
990 
991  while (attr != 0) {
992 
993  tempattr = gdml->GetAttrName(attr);
994  tempattr.ToLower();
995 
996  if (tempattr == "value") {
997  atom = gdml->GetAttrValue(attr);
998  }
999 
1000  attr = gdml->GetNextAttr(attr);
1001  }
1002 
1003  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1004  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
1005  }
1006 
1007  Int_t z2 = (Int_t)Value(z);
1008  Double_t atom2 = Value(atom);
1009  TGeoElement* ele = tab->FindElement(formula);
1010  // We cannot use elements with Z = 0, so we expect a user definition
1011  if (ele && ele->Z() == 0)
1012  ele = nullptr;
1013 
1014  if ( !ele ) {
1015  ele = new TGeoElement(formula, NameShort(name), z2 , atom2);
1016  }
1017  else if ( gDebug >= 2 ) {
1018  Info("TGDMLParse","Re-use existing element: %s",ele->GetName());
1019  }
1020  felemap[name.Data()] = ele;
1021  return node;
1022 
1023 }
1024 
1025 ////////////////////////////////////////////////////////////////////////////////
1026 /// In the materials section of the GDML file, materials can be declared.
1027 /// when the material keyword is found, this function is called, and the
1028 /// name and values of the material are converted into type TGeoMaterial
1029 /// and stored in fmatmap map using the name as its key. Mixtures can also
1030 /// be declared, and they are converted to TGeoMixture and stored in
1031 /// fmixmap. These mixtures and materials are then all converted into one
1032 /// common type - TGeoMedium. The map fmedmap is then built up of all the
1033 /// mixtures and materials.
1034 
1036 {
1037  //!Map to hold fractions while being processed
1038  typedef FracMap::iterator fractions;
1039 // typedef FracMap::iterator i;
1040  FracMap fracmap;
1041 
1042  TGeoManager* mgr = gGeoManager;
1043  TGeoElementTable* tab_ele = mgr->GetElementTable();
1044  // We have to assume the media are monotonic increasing starting with 1
1045  static int medid = mgr->GetListOfMedia()->GetSize()+1;
1046  XMLNodePointer_t child = gdml->GetChild(node);
1047  TString tempattr = "";
1048  Int_t ncompo = 0, mixflag = 2;
1049  Double_t density = 0;
1050  TString name = "";
1051  TGeoMixture* mix = 0;
1052  TGeoMaterial* mat = 0;
1053  TString tempconst = "";
1054  TString matname;
1055  Bool_t composite = kFALSE;
1056 
1057  if (z == 1) {
1058  Double_t a = 0;
1059  Double_t d = 0;
1060 
1061  while (child != 0) {
1062  attr = gdml->GetFirstAttr(child);
1063 
1064  if ((strcmp(gdml->GetNodeName(child), "atom")) == 0) {
1065  while (attr != 0) {
1066  tempattr = gdml->GetAttrName(attr);
1067  tempattr.ToLower();
1068 
1069  if (tempattr == "value") {
1070  a = Value(gdml->GetAttrValue(attr));
1071  }
1072  attr = gdml->GetNextAttr(attr);
1073  }
1074  }
1075 
1076  if ((strcmp(gdml->GetNodeName(child), "D")) == 0) {
1077  while (attr != 0) {
1078  tempattr = gdml->GetAttrName(attr);
1079  tempattr.ToLower();
1080 
1081  if (tempattr == "value") {
1082  d = Value(gdml->GetAttrValue(attr));
1083  }
1084  attr = gdml->GetNextAttr(attr);
1085  }
1086  }
1087  child = gdml->GetNext(child);
1088  }
1089  //still in the is Z else...but not in the while..
1090 
1091  name = gdml->GetAttr(node, "name");
1092 
1093  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1094  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
1095  }
1096 
1097  //CHECK FOR CONSTANTS
1098  tempconst = gdml->GetAttr(node, "Z");
1099 
1100  Double_t valZ = Value(tempconst);
1101 
1102  TString tmpname = name;
1103  //deal with special case - Z of vacuum is always 0
1104  tmpname.ToLower();
1105  if (tmpname == "vacuum") {
1106  valZ = 0;
1107  }
1108  TString mat_name = NameShort(name);
1109  mat = mgr->GetMaterial(mat_name);
1110  if ( !mat ) {
1111  mat = new TGeoMaterial(mat_name, a, valZ, d);
1112  }
1113  else {
1114  Info("TGDMLParse","Re-use existing material: %s",mat->GetName());
1115  }
1116  mixflag = 0;
1117  //Note: Object(name, title) corresponds to Element(formula, name)
1118  TGeoElement* mat_ele = tab_ele->FindElement(mat_name);
1119  // We cannot use elements with Z = 0, so we expect a user definition
1120  if (mat_ele && mat_ele->Z() == 0)
1121  mat_ele = nullptr;
1122 
1123  if ( !mat_ele ) {
1124  mat_ele = new TGeoElement(mat_name, mat_name, atoi(tempconst), a);
1125  }
1126  else if ( gDebug >= 2 ) {
1127  Info("TGDMLParse","Re-use existing material-element: %s",mat_ele->GetName());
1128  }
1129  felemap[name.Data()] = mat_ele;
1130  }
1131 
1132  else if (z == 0) {
1133  while (child != 0) {
1134  attr = gdml->GetFirstAttr(child);
1135 
1136  if ((strcmp(gdml->GetNodeName(child), "fraction")) == 0) {
1137  Double_t n = 0;
1138  TString ref = "";
1139  ncompo = ncompo + 1;
1140 
1141  while (attr != 0) {
1142  tempattr = gdml->GetAttrName(attr);
1143  tempattr.ToLower();
1144 
1145  if (tempattr == "n") {
1146  n = Value(gdml->GetAttrValue(attr));
1147  } else if (tempattr == "ref") {
1148  ref = gdml->GetAttrValue(attr);
1149  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1150  ref = TString::Format("%s_%s", ref.Data(), fCurrentFile);
1151  }
1152 
1153  }
1154 
1155  attr = gdml->GetNextAttr(attr);
1156  }
1157  fracmap[ref.Data()] = n;
1158 
1159  }
1160 
1161  else if ((strcmp(gdml->GetNodeName(child), "composite")) == 0) {
1162  composite = kTRUE;
1163  Double_t n = 0;
1164  TString ref = "";
1165  ncompo = ncompo + 1;
1166 
1167  while (attr != 0) {
1168  tempattr = gdml->GetAttrName(attr);
1169  tempattr.ToLower();
1170 
1171  if (tempattr == "n") {
1172  n = Value(gdml->GetAttrValue(attr));
1173  } else if (tempattr == "ref") {
1174  ref = gdml->GetAttrValue(attr);
1175  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1176  ref = TString::Format("%s_%s", ref.Data(), fCurrentFile);
1177  }
1178  }
1179 
1180  attr = gdml->GetNextAttr(attr);
1181  }
1182 
1183  fracmap[ref.Data()] = n;
1184 
1185  }
1186  else if ((strcmp(gdml->GetNodeName(child), "D")) == 0) {
1187  while (attr != 0) {
1188  tempattr = gdml->GetAttrName(attr);
1189  tempattr.ToLower();
1190 
1191  if (tempattr == "value") {
1192  density = Value(gdml->GetAttrValue(attr));
1193  }
1194 
1195  attr = gdml->GetNextAttr(attr);
1196  }
1197  }
1198 
1199  child = gdml->GetNext(child);
1200  }
1201  //still in the not Z else...but not in the while..
1202 
1203  name = gdml->GetAttr(node, "name");
1204  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1205  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
1206  }
1207  //mix = new TGeoMixture(NameShort(name), 0 /*ncompo*/, density);
1208  mixflag = 1;
1209  TString mat_name = NameShort(name);
1210  mat = mgr->GetMaterial(mat_name);
1211  if ( !mat ) {
1212  mix = new TGeoMixture(mat_name, ncompo, density);
1213  }
1214  else if ( mat->IsMixture() ) {
1215  mix = (TGeoMixture*)mat;
1216  if ( gDebug >= 2 )
1217  Info("TGDMLParse","Re-use existing material-mixture: %s",mix->GetName());
1218  }
1219  else {
1220  Error("TGDMLParse","WARNING! Inconsistent material definitions between GDML and TGeoManager");
1221  }
1222  Int_t natoms;
1223  Double_t weight;
1224 
1225  for (fractions f = fracmap.begin(); f != fracmap.end(); ++f) {
1226  matname = f->first;
1227  matname = NameShort(matname);
1228 
1230 
1231  if (mattmp || (felemap.find(f->first) != felemap.end())) {
1232  if (composite) {
1233  natoms = (Int_t)f->second;
1234 
1235  mix->AddElement(felemap[f->first], natoms);
1236 
1237  }
1238 
1239  else {
1240  weight = f->second;
1241  if (mattmp){
1242 
1243  mix->AddElement(mattmp, weight);
1244  }
1245  else {
1246 
1247  mix->AddElement(felemap[f->first], weight);
1248  }
1249  }
1250  }
1251  }
1252 
1253  }//end of not Z else
1254 
1255  medid = medid + 1;
1256 
1257  TGeoMedium* med = mgr->GetMedium(NameShort(name));
1258  if ( !med ) {
1259  if (mixflag == 1) {
1260  fmixmap[name.Data()] = mix;
1261  med = new TGeoMedium(NameShort(name), medid, mix);
1262  } else if (mixflag == 0) {
1263  fmatmap[name.Data()] = mat;
1264  med = new TGeoMedium(NameShort(name), medid, mat);
1265  }
1266  }
1267  else if ( gDebug >= 2 ) {
1268  Info("TGDMLParse","Re-use existing medium: %s",med->GetName());
1269  }
1270  fmedmap[name.Data()] = med;
1271 
1272  return child;
1273 
1274 }
1275 
1276 ////////////////////////////////////////////////////////////////////////////////
1277 /// In the structure section of the GDML file, volumes can be declared.
1278 /// when the volume keyword is found, this function is called, and the
1279 /// name and values of the volume are converted into type TGeoVolume and
1280 /// stored in fvolmap map using the name as its key. Volumes reference to
1281 /// a solid declared higher up in the solids section of the GDML file.
1282 /// Some volumes reference to other physical volumes to contain inside
1283 /// that volume, declaring positions and rotations within that volume.
1284 /// when each 'physvol' is declared, a matrix for its rotation and
1285 /// translation is built and the 'physvol node' is added to the original
1286 /// volume using TGeoVolume->AddNode.
1287 /// volume division is also declared within the volume node, and once the
1288 /// values for the division have been collected, using TGeoVolume->divide,
1289 /// the division can be applied.
1290 
1292 {
1293  XMLAttrPointer_t attr;
1294  XMLNodePointer_t subchild;
1295  XMLNodePointer_t subsubchild;
1296 
1297  XMLNodePointer_t child = gdml->GetChild(node);
1298  TString name;
1299  TString solidname = "";
1300  TString tempattr = "";
1301  TGeoShape* solid = 0;
1302  TGeoMedium* medium = 0;
1303  TGeoVolume* vol = 0;
1304  TGeoVolume* lv = 0;
1305  TGeoShape* reflex = 0;
1306  const Double_t* parentrot = 0;
1307  int yesrefl = 0;
1308  TString reftemp = "";
1309  TMap *auxmap = 0;
1310 
1311  while (child != 0) {
1312  if ((strcmp(gdml->GetNodeName(child), "solidref")) == 0) {
1313 
1314  reftemp = gdml->GetAttr(child, "ref");
1315  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1316  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1317  }
1318  if (fsolmap.find(reftemp.Data()) != fsolmap.end()) {
1319  solid = fsolmap[reftemp.Data()];
1320  } else if (freflectmap.find(reftemp.Data()) != freflectmap.end()) {
1321  solidname = reftemp;
1322  reflex = fsolmap[freflectmap[reftemp.Data()]];
1323  } else {
1324  printf("Solid: %s, Not Yet Defined!\n", reftemp.Data());
1325  }
1326  }
1327 
1328  if ((strcmp(gdml->GetNodeName(child), "materialref")) == 0) {
1329  reftemp = gdml->GetAttr(child, "ref");
1330  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1331  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1332  }
1333  if (fmedmap.find(reftemp.Data()) != fmedmap.end()) {
1334  medium = fmedmap[reftemp.Data()];
1335  } else {
1336  printf("Medium: %s, Not Yet Defined!\n", gdml->GetAttr(child, "ref"));
1337  }
1338  }
1339 
1340  child = gdml->GetNext(child);
1341  }
1342 
1343  name = gdml->GetAttr(node, "name");
1344 
1345  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1346  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
1347  }
1348 
1349  if (reflex == 0) {
1350  vol = new TGeoVolume(NameShort(name), solid, medium);
1351  } else {
1352  vol = new TGeoVolume(NameShort(name), reflex, medium);
1353  freflvolmap[name.Data()] = solidname;
1354  TGDMLRefl* parentrefl = freflsolidmap[solidname.Data()];
1355  parentrot = parentrefl->GetMatrix()->GetRotationMatrix();
1356  yesrefl = 1;
1357  }
1358 
1359  fvolmap[name.Data()] = vol;
1360 
1361  //PHYSVOL - run through child nodes of VOLUME again..
1362 
1363  child = gdml->GetChild(node);
1364 
1365  while (child != 0) {
1366  if ((strcmp(gdml->GetNodeName(child), "physvol")) == 0) {
1367 
1368  TString volref = "";
1369 
1370  TGeoTranslation* pos = 0;
1371  TGeoRotation* rot = 0;
1372  TGeoScale* scl = 0;
1373  TString pnodename = gdml->GetAttr(child, "name");
1374  TString scopynum = gdml->GetAttr(child, "copynumber");
1375  Int_t copynum = (scopynum.IsNull()) ? 0 : (Int_t)Value(scopynum);
1376 
1377  subchild = gdml->GetChild(child);
1378 
1379  while (subchild != 0) {
1380  tempattr = gdml->GetNodeName(subchild);
1381  tempattr.ToLower();
1382 
1383  if (tempattr == "volumeref") {
1384  reftemp = gdml->GetAttr(subchild, "ref");
1385  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1386  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1387  }
1388  lv = fvolmap[reftemp.Data()];
1389  volref = reftemp;
1390  }
1391  else if (tempattr == "file") {
1392  const char* filevol;
1393  const char* prevfile = fCurrentFile;
1394 
1395  fCurrentFile = gdml->GetAttr(subchild, "name");
1396  filevol = gdml->GetAttr(subchild, "volname");
1397 
1398  TXMLEngine* gdml2 = new TXMLEngine;
1399  gdml2->SetSkipComments(kTRUE);
1400  XMLDocPointer_t filedoc1 = gdml2->ParseFile(fCurrentFile);
1401  if (filedoc1 == 0) {
1402  Fatal("VolProcess", "Bad filename given %s", fCurrentFile);
1403  }
1404  // take access to main node
1405  XMLNodePointer_t mainnode2 = gdml2->DocGetRootElement(filedoc1);
1406  //increase depth counter + add DOM pointer
1407  fFILENO = fFILENO + 1;
1408  fFileEngine[fFILENO] = gdml2;
1409 
1410  if (ffilemap.find(fCurrentFile) != ffilemap.end()) {
1411  volref = ffilemap[fCurrentFile];
1412  } else {
1413  volref = ParseGDML(gdml2, mainnode2);
1414  ffilemap[fCurrentFile] = volref;
1415  }
1416 
1417  if (filevol) {
1418  volref = filevol;
1419  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1420  volref = TString::Format("%s_%s", volref.Data(), fCurrentFile);
1421  }
1422  }
1423 
1424  fFILENO = fFILENO - 1;
1425  gdml = fFileEngine[fFILENO];
1426  fCurrentFile = prevfile;
1427 
1428  lv = fvolmap[volref.Data()];
1429  //File tree complete - Release memory before exit
1430 
1431  gdml->FreeDoc(filedoc1);
1432  delete gdml2;
1433  }
1434  else if (tempattr == "position") {
1435  attr = gdml->GetFirstAttr(subchild);
1436  PosProcess(gdml, subchild, attr);
1437  reftemp = gdml->GetAttr(subchild, "name");
1438  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1439  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1440  }
1441  pos = fposmap[reftemp.Data()];
1442  } else if (tempattr == "positionref") {
1443  reftemp = gdml->GetAttr(subchild, "ref");
1444  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1445  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1446  }
1447  if (fposmap.find(reftemp.Data()) != fposmap.end()) pos = fposmap[reftemp.Data()];
1448  else std::cout << "ERROR! Physvol's position " << reftemp << " not found!" << std::endl;
1449  } else if (tempattr == "rotation") {
1450  attr = gdml->GetFirstAttr(subchild);
1451  RotProcess(gdml, subchild, attr);
1452  reftemp = gdml->GetAttr(subchild, "name");
1453  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1454  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1455  }
1456  rot = frotmap[reftemp.Data()];
1457  } else if (tempattr == "rotationref") {
1458  reftemp = gdml->GetAttr(subchild, "ref");
1459  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1460  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1461  }
1462  if (frotmap.find(reftemp.Data()) != frotmap.end()) rot = frotmap[reftemp.Data()];
1463  else std::cout << "ERROR! Physvol's rotation " << reftemp << " not found!" << std::endl;
1464  } else if (tempattr == "scale") {
1465  attr = gdml->GetFirstAttr(subchild);
1466  SclProcess(gdml, subchild, attr);
1467  reftemp = gdml->GetAttr(subchild, "name");
1468  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1469  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1470  }
1471  scl = fsclmap[reftemp.Data()];
1472  } else if (tempattr == "scaleref") {
1473  reftemp = gdml->GetAttr(subchild, "ref");
1474  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1475  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1476  }
1477  if (fsclmap.find(reftemp.Data()) != fsclmap.end()) scl = fsclmap[reftemp.Data()];
1478  else std::cout << "ERROR! Physvol's scale " << reftemp << " not found!" << std::endl;
1479  }
1480 
1481  subchild = gdml->GetNext(subchild);
1482  }
1483 
1484  //ADD PHYSVOL TO GEOMETRY
1485  fVolID = fVolID + 1;
1486 
1487  TGeoHMatrix *transform = new TGeoHMatrix();
1488 
1489  if (pos != 0) transform->SetTranslation(pos->GetTranslation());
1490  if (rot != 0) transform->SetRotation(rot->GetRotationMatrix());
1491 
1492  if (scl != 0) { // Scaling must be added to the rotation matrix!
1493 
1494  Double_t scale3x3[9];
1495  memset(scale3x3, 0, 9 * sizeof(Double_t));
1496  const Double_t *diagonal = scl->GetScale();
1497 
1498  scale3x3[0] = diagonal[0];
1499  scale3x3[4] = diagonal[1];
1500  scale3x3[8] = diagonal[2];
1501 
1502  TGeoRotation scaleMatrix;
1503  scaleMatrix.SetMatrix(scale3x3);
1504  transform->Multiply(&scaleMatrix);
1505  }
1506 
1507 // BEGIN: reflectedSolid. Remove lines between if reflectedSolid will be removed from GDML!!!
1508 
1509  if (freflvolmap.find(volref.Data()) != freflvolmap.end()) {
1510  // if the volume is a reflected volume the matrix needs to be CHANGED
1511  TGDMLRefl* temprefl = freflsolidmap[freflvolmap[volref.Data()]];
1512  transform->Multiply(temprefl->GetMatrix());
1513  }
1514 
1515  if (yesrefl == 1) {
1516  // reflection is done per solid so that we cancel it if exists in mother volume!!!
1517  TGeoRotation prot;
1518  prot.SetMatrix(parentrot);
1519  transform->MultiplyLeft(&prot);
1520  }
1521 
1522 // END: reflectedSolid
1523 
1524  vol->AddNode(lv, copynum, transform);
1525  if (!pnodename.IsNull())
1526  ((TNamed*)vol->GetNodes()->Last())->SetName(pnodename);
1527  } else if ((strcmp(gdml->GetNodeName(child), "divisionvol")) == 0) {
1528 
1529  TString divVolref = "";
1530  Int_t axis = 0;
1531  TString number = "";
1532  TString width = "";
1533  TString offset = "";
1534  TString lunit = "mm";
1535 
1536  attr = gdml->GetFirstAttr(child);
1537 
1538  while (attr != 0) {
1539 
1540  tempattr = gdml->GetAttrName(attr);
1541  tempattr.ToLower();
1542 
1543  if (tempattr == "axis") {
1544  axis = SetAxis(gdml->GetAttrValue(attr));
1545  } else if (tempattr == "number") {
1546  number = gdml->GetAttrValue(attr);
1547  } else if (tempattr == "width") {
1548  width = gdml->GetAttrValue(attr);
1549  } else if (tempattr == "offset") {
1550  offset = gdml->GetAttrValue(attr);
1551  } else if (tempattr == "unit") {
1552  lunit = gdml->GetAttrValue(attr);
1553  }
1554 
1555  attr = gdml->GetNextAttr(attr);
1556 
1557  }
1558 
1559  subchild = gdml->GetChild(child);
1560 
1561  while (subchild != 0) {
1562  tempattr = gdml->GetNodeName(subchild);
1563  tempattr.ToLower();
1564 
1565  if (tempattr == "volumeref") {
1566  reftemp = gdml->GetAttr(subchild, "ref");
1567  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1568  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1569  }
1570  divVolref = reftemp;
1571  }
1572 
1573  subchild = gdml->GetNext(subchild);
1574  }
1575 
1576 
1577  Double_t numberline = Value(number);
1578  Double_t retunit = GetScaleVal(lunit);
1579  Double_t step = Value(width) * retunit;
1580  Double_t offsetline = Value(offset) * retunit;
1581 
1582  fVolID = fVolID + 1;
1583  Double_t xlo, xhi;
1584  vol->GetShape()->GetAxisRange(axis, xlo, xhi);
1585 
1586  Int_t ndiv = (Int_t)numberline;
1587  Double_t start = xlo + offsetline;
1588 
1589  Int_t numed = 0;
1590  TGeoVolume *old = fvolmap[NameShort(reftemp)];
1591  if (old) {
1592  // We need to recreate the content of the divided volume
1593  old = fvolmap[NameShort(reftemp)];
1594  // medium id
1595  numed = old->GetMedium()->GetId();
1596  }
1597  TGeoVolume *divvol = vol->Divide(NameShort(reftemp), axis, ndiv, start, step, numed);
1598  if (!divvol) {
1599  Fatal("VolProcess", "Cannot divide volume %s", vol->GetName());
1600  return child;
1601  }
1602  if (old && old->GetNdaughters()) {
1603  divvol->ReplayCreation(old);
1604  }
1605  fvolmap[NameShort(reftemp)] = divvol;
1606 
1607  }//end of Division else if
1608 
1609 
1610  else if ((strcmp(gdml->GetNodeName(child), "replicavol")) == 0) {
1611 
1612  TString divVolref = "";
1613  Int_t axis = 0;
1614  TString number = "";
1615  TString width = "";
1616  TString offset = "";
1617  TString wunit = "mm";
1618  TString ounit = "mm";
1619  Double_t wvalue = 0;
1620  Double_t ovalue = 0;
1621 
1622 
1623  attr = gdml->GetFirstAttr(child);
1624 
1625  while (attr != 0) {
1626 
1627  tempattr = gdml->GetAttrName(attr);
1628  tempattr.ToLower();
1629 
1630  if (tempattr == "number") {
1631  number = gdml->GetAttrValue(attr);
1632  }
1633  attr = gdml->GetNextAttr(attr);
1634  }
1635 
1636  subchild = gdml->GetChild(child);
1637 
1638  while (subchild != 0) {
1639  tempattr = gdml->GetNodeName(subchild);
1640  tempattr.ToLower();
1641 
1642  if (tempattr == "volumeref") {
1643  reftemp = gdml->GetAttr(subchild, "ref");
1644  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1645  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1646  }
1647  divVolref = reftemp;
1648  }
1649 
1650  if (tempattr == "replicate_along_axis") {
1651  subsubchild = gdml->GetChild(subchild);
1652 
1653  while (subsubchild != 0) {
1654  if ((strcmp(gdml->GetNodeName(subsubchild), "width")) == 0) {
1655  attr = gdml->GetFirstAttr(subsubchild);
1656  while (attr != 0) {
1657  tempattr = gdml->GetAttrName(attr);
1658  tempattr.ToLower();
1659  if (tempattr == "value") {
1660  wvalue = Value(gdml->GetAttrValue(attr));
1661  }
1662  else if (tempattr == "unit"){
1663  wunit = gdml->GetAttrValue(attr);
1664  }
1665 
1666  attr = gdml->GetNextAttr(attr);
1667  }
1668  }
1669  else if ((strcmp(gdml->GetNodeName(subsubchild), "offset")) == 0) {
1670  attr = gdml->GetFirstAttr(subsubchild);
1671  while (attr != 0) {
1672  tempattr = gdml->GetAttrName(attr);
1673  tempattr.ToLower();
1674  if (tempattr == "value") {
1675  ovalue = Value(gdml->GetAttrValue(attr));
1676  }
1677  else if (tempattr == "unit"){
1678  ounit = gdml->GetAttrValue(attr);
1679  }
1680  attr = gdml->GetNextAttr(attr);
1681  }
1682  }
1683  else if ((strcmp(gdml->GetNodeName(subsubchild), "direction")) == 0) {
1684  attr = gdml->GetFirstAttr(subsubchild);
1685  while (attr != 0) {
1686  tempattr = gdml->GetAttrName(attr);
1687  tempattr.ToLower();
1688  if (tempattr == "x") {
1689  axis = 1;
1690  }
1691  else if (tempattr == "y"){
1692  axis = 2;
1693  }
1694  else if (tempattr == "z"){
1695  axis = 3;
1696  }
1697  else if (tempattr == "rho"){
1698  axis = 1;
1699  }
1700  else if (tempattr == "phi"){
1701  axis = 2;
1702  }
1703 
1704  attr = gdml->GetNextAttr(attr);
1705  }
1706  }
1707 
1708  subsubchild = gdml->GetNext(subsubchild);
1709  }
1710 
1711  }
1712 
1713  subchild = gdml->GetNext(subchild);
1714  }
1715 
1716 
1717  Double_t retwunit = GetScaleVal(wunit);
1718  Double_t retounit = GetScaleVal(ounit);
1719 
1720  Double_t numberline = Value(number);
1721  Double_t widthline = wvalue*retwunit;
1722  Double_t offsetline = ovalue*retounit;
1723 
1724  fVolID = fVolID + 1;
1725  Double_t xlo, xhi;
1726  vol->GetShape()->GetAxisRange(axis, xlo, xhi);
1727 
1728  Int_t ndiv = (Int_t)numberline;
1729  Double_t start = xlo + offsetline;
1730 
1731  Double_t step = widthline;
1732  Int_t numed = 0;
1733  TGeoVolume *old = fvolmap[NameShort(reftemp)];
1734  if (old) {
1735  // We need to recreate the content of the divided volume
1736  old = fvolmap[NameShort(reftemp)];
1737  // medium id
1738  numed = old->GetMedium()->GetId();
1739  }
1740  TGeoVolume *divvol = vol->Divide(NameShort(reftemp), axis, ndiv, start, step, numed);
1741  if (!divvol) {
1742  Fatal("VolProcess", "Cannot divide volume %s", vol->GetName());
1743  return child;
1744  }
1745  if (old && old->GetNdaughters()) {
1746  divvol->ReplayCreation(old);
1747  }
1748  fvolmap[NameShort(reftemp)] = divvol;
1749 
1750  } //End of replicavol
1751  else if (strcmp(gdml->GetNodeName(child), "auxiliary") == 0) {
1752  TString auxType, auxUnit, auxValue;
1753  if(!auxmap) {
1754  printf("Auxiliary values for volume %s\n",vol->GetName());
1755  auxmap = new TMap();
1756  vol->SetUserExtension(new TGeoRCExtension(auxmap));
1757  }
1758  attr = gdml->GetFirstAttr(child);
1759  while(attr) {
1760  if (!strcmp(gdml->GetAttrName(attr),"auxtype")) auxType = gdml->GetAttrValue(attr);
1761  else if (!strcmp(gdml->GetAttrName(attr),"auxvalue")) auxValue = gdml->GetAttrValue(attr);
1762  else if (!strcmp(gdml->GetAttrName(attr),"auxunit")) auxUnit = gdml->GetAttrValue(attr);
1763  attr = gdml->GetNextAttr(attr);
1764  }
1765  if (!auxUnit.IsNull()) auxValue = TString::Format("%s*%s", auxValue.Data(), auxUnit.Data());
1766  auxmap->Add(new TObjString(auxType),new TObjString(auxValue));
1767  printf(" %s: %s\n", auxType.Data(), auxValue.Data());
1768  }
1769 
1770  child = gdml->GetNext(child);
1771  }
1772 
1773  return child;
1774 
1775 }
1776 
1777 ////////////////////////////////////////////////////////////////////////////////
1778 /// In the solid section of the GDML file, boolean solids can be
1779 /// declared. when the subtraction, intersection or union keyword
1780 /// is found, this function is called, and the values (rotation and
1781 /// translation) of the solid are converted into type TGeoCompositeShape
1782 /// and stored in fsolmap map using the name as its key.
1783 ///
1784 /// - 1 = SUBTRACTION
1785 /// - 2 = INTERSECTION
1786 /// - 3 = UNION
1787 
1789 {
1790  TString reftemp = "";
1791  TString tempattr = "";
1792  XMLNodePointer_t child = gdml->GetChild(node);
1793 
1794  TGeoShape* first = 0;
1795  TGeoShape* second = 0;
1796 
1797  TGeoTranslation* firstPos = new TGeoTranslation(0, 0, 0);
1798  TGeoTranslation* secondPos = new TGeoTranslation(0, 0, 0);
1799 
1800  TGeoRotation* firstRot = new TGeoRotation();
1801  TGeoRotation* secondRot = new TGeoRotation();
1802 
1803  firstRot->RotateZ(0);
1804  firstRot->RotateY(0);
1805  firstRot->RotateX(0);
1806 
1807  secondRot->RotateZ(0);
1808  secondRot->RotateY(0);
1809  secondRot->RotateX(0);
1810 
1811  TString name = gdml->GetAttr(node, "name");
1812 
1813  if ((strcmp(fCurrentFile, fStartFile)) != 0)
1814  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
1815 
1816  while (child != 0) {
1817  tempattr = gdml->GetNodeName(child);
1818  tempattr.ToLower();
1819 
1820  if (tempattr == "first") {
1821  reftemp = gdml->GetAttr(child, "ref");
1822  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1823  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1824  }
1825  if (fsolmap.find(reftemp.Data()) != fsolmap.end()) {
1826  first = fsolmap[reftemp.Data()];
1827  }
1828  } else if (tempattr == "second") {
1829  reftemp = gdml->GetAttr(child, "ref");
1830  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1831  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1832  }
1833  if (fsolmap.find(reftemp.Data()) != fsolmap.end()) {
1834  second = fsolmap[reftemp.Data()];
1835  }
1836  } else if (tempattr == "position") {
1837  attr = gdml->GetFirstAttr(child);
1838  PosProcess(gdml, child, attr);
1839  reftemp = gdml->GetAttr(child, "name");
1840  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1841  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1842  }
1843  secondPos = fposmap[reftemp.Data()];
1844  } else if (tempattr == "positionref") {
1845  reftemp = gdml->GetAttr(child, "ref");
1846  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1847  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1848  }
1849  if (fposmap.find(reftemp.Data()) != fposmap.end()) {
1850  secondPos = fposmap[reftemp.Data()];
1851  }
1852  } else if (tempattr == "rotation") {
1853  attr = gdml->GetFirstAttr(child);
1854  RotProcess(gdml, child, attr);
1855  reftemp = gdml->GetAttr(child, "name");
1856  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1857  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1858  }
1859  secondRot = frotmap[reftemp.Data()];
1860  } else if (tempattr == "rotationref") {
1861  reftemp = gdml->GetAttr(child, "ref");
1862  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1863  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1864  }
1865  if (frotmap.find(reftemp.Data()) != frotmap.end()) {
1866  secondRot = frotmap[reftemp.Data()];
1867  }
1868  } else if (tempattr == "firstposition") {
1869  attr = gdml->GetFirstAttr(child);
1870  PosProcess(gdml, child, attr);
1871  reftemp = gdml->GetAttr(child, "name");
1872  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1873  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1874  }
1875  firstPos = fposmap[reftemp.Data()];
1876  } else if (tempattr == "firstpositionref") {
1877  reftemp = gdml->GetAttr(child, "ref");
1878  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1879  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1880  }
1881  if (fposmap.find(reftemp.Data()) != fposmap.end()) {
1882  firstPos = fposmap[reftemp.Data()];
1883  }
1884  } else if (tempattr == "firstrotation") {
1885  attr = gdml->GetFirstAttr(child);
1886  RotProcess(gdml, child, attr);
1887  reftemp = gdml->GetAttr(child, "name");
1888  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1889  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1890  }
1891  firstRot = frotmap[reftemp.Data()];
1892  } else if (tempattr == "firstrotationref") {
1893  reftemp = gdml->GetAttr(child, "ref");
1894  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1895  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
1896  }
1897  if (frotmap.find(reftemp.Data()) != frotmap.end()) {
1898  firstRot = frotmap[reftemp.Data()];
1899  }
1900  }
1901  child = gdml->GetNext(child);
1902  }
1903 
1904  TGeoMatrix* firstMatrix = new TGeoCombiTrans(*firstPos, firstRot->Inverse());
1905  TGeoMatrix* secondMatrix = new TGeoCombiTrans(*secondPos, secondRot->Inverse());
1906 
1907  TGeoCompositeShape* boolean = 0;
1908  if (!first || !second) {
1909  Fatal("BooSolid", "Incomplete solid %s, missing shape components", name.Data());
1910  return child;
1911  }
1912  switch (num) {
1913  case 1:
1914  boolean = new TGeoCompositeShape(NameShort(name), new TGeoSubtraction(first, second, firstMatrix, secondMatrix));
1915  break; // SUBTRACTION
1916  case 2:
1917  boolean = new TGeoCompositeShape(NameShort(name), new TGeoIntersection(first, second, firstMatrix, secondMatrix));
1918  break; // INTERSECTION
1919  case 3:
1920  boolean = new TGeoCompositeShape(NameShort(name), new TGeoUnion(first, second, firstMatrix, secondMatrix));
1921  break; // UNION
1922  default:
1923  break;
1924  }
1925 
1926  fsolmap[name.Data()] = boolean;
1927 
1928  return child;
1929 }
1930 
1931 ////////////////////////////////////////////////////////////////////////////////
1932 /// User data to be processed.
1933 
1935 {
1936  XMLNodePointer_t child = gdml->GetChild(node);
1937  TString nodename, auxtype, auxtypec, auxvalue, auxvaluec, auxunit, auxunitc;
1938  double value = 0.;
1939  TGeoRegion *region;
1940  while (child) {
1941  region = nullptr;
1942  nodename = gdml->GetNodeName(child);
1943  if (nodename == "auxiliary") {
1944  auxtype = gdml->GetAttr(child, "auxtype");
1945  auxvalue = gdml->GetAttr(child, "auxvalue");
1946  if (auxtype == "Region") {
1947  auxvalue = NameShort(auxvalue);
1948  region = new TGeoRegion(auxvalue);
1949  }
1950  }
1951  XMLNodePointer_t subchild = gdml->GetChild(child);
1952  while (subchild) {
1953  auxtypec = gdml->GetAttr(subchild, "auxtype");
1954  auxvaluec = gdml->GetAttr(subchild, "auxvalue");
1955  auxunitc = gdml->GetAttr(subchild, "auxunit");
1956  if (auxtypec == "volume") {
1957  auxvaluec = NameShort(auxvaluec);
1958  if (region) region->AddVolume(auxvaluec);
1959  }
1960  if (auxtypec.Contains("cut")) {
1961  value = Value(auxvaluec) * GetScaleVal(auxunitc);
1962  if (region) region->AddCut(auxtypec, value);
1963  }
1964  subchild = gdml->GetNext(subchild);
1965  }
1966  if (region) {
1967  gGeoManager->AddRegion(region);
1968  // region->Print();
1969  }
1970  child = gdml->GetNext(child);
1971  }
1972  return child;
1973 }
1974 
1975 ////////////////////////////////////////////////////////////////////////////////
1976 /// In the structure section of the GDML file, assembly volumes can be
1977 /// declared. when the assembly keyword is found, this function is called,
1978 /// and the name is converted into type TGeoVolumeAssembly and
1979 /// stored in fvolmap map using the name as its key. Some assembly volumes
1980 /// reference to other physical volumes to contain inside that assembly,
1981 /// declaring positions and rotations within that volume. When each 'physvol'
1982 /// is declared, a matrix for its rotation and translation is built and the
1983 /// 'physvol node' is added to the original assembly using TGeoVolume->AddNode.
1984 
1986 {
1987  TString name = gdml->GetAttr(node, "name");
1988  TString reftemp = "";
1989 
1990  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1991  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
1992  }
1993 
1994  XMLAttrPointer_t attr;
1995  XMLNodePointer_t subchild;
1996  XMLNodePointer_t child = gdml->GetChild(node);
1997  TString tempattr = "";
1998  TGeoVolume* lv = 0;
1999  TGeoTranslation* pos = 0;
2000  TGeoRotation* rot = 0;
2001  TGeoCombiTrans* matr;
2002 
2003  TGeoVolumeAssembly* assem = new TGeoVolumeAssembly(NameShort(name));
2004 
2005 
2006  //PHYSVOL - run through child nodes of VOLUME again..
2007 
2008 // child = gdml->GetChild(node);
2009 
2010  while (child != 0) {
2011  if ((strcmp(gdml->GetNodeName(child), "physvol")) == 0) {
2012  TString pnodename = gdml->GetAttr(child, "name");
2013  TString scopynum = gdml->GetAttr(child, "copynumber");
2014  Int_t copynum = (scopynum.IsNull()) ? 0 : (Int_t)Value(scopynum);
2015 
2016  subchild = gdml->GetChild(child);
2017  pos = new TGeoTranslation(0, 0, 0);
2018  rot = new TGeoRotation();
2019 
2020  while (subchild != 0) {
2021  tempattr = gdml->GetNodeName(subchild);
2022  tempattr.ToLower();
2023 
2024  if (tempattr == "volumeref") {
2025  reftemp = gdml->GetAttr(subchild, "ref");
2026  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2027  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
2028  }
2029  lv = fvolmap[reftemp.Data()];
2030  } else if (tempattr == "positionref") {
2031  reftemp = gdml->GetAttr(subchild, "ref");
2032  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2033  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
2034  }
2035  if (fposmap.find(reftemp.Data()) != fposmap.end()) {
2036  pos = fposmap[reftemp.Data()];
2037  }
2038  } else if (tempattr == "position") {
2039  attr = gdml->GetFirstAttr(subchild);
2040  PosProcess(gdml, subchild, attr);
2041  reftemp = gdml->GetAttr(subchild, "name");
2042  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2043  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
2044  }
2045  pos = fposmap[reftemp.Data()];
2046  } else if (tempattr == "rotationref") {
2047  reftemp = gdml->GetAttr(subchild, "ref");
2048  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2049  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
2050  }
2051  if (frotmap.find(reftemp.Data()) != frotmap.end()) {
2052  rot = frotmap[reftemp.Data()];
2053  }
2054  } else if (tempattr == "rotation") {
2055  attr = gdml->GetFirstAttr(subchild);
2056  RotProcess(gdml, subchild, attr);
2057  reftemp = gdml->GetAttr(subchild, "name");
2058  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2059  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
2060  }
2061  rot = frotmap[reftemp.Data()];
2062  }
2063 
2064  subchild = gdml->GetNext(subchild);
2065  }
2066 
2067  //ADD PHYSVOL TO GEOMETRY
2068  fVolID = fVolID + 1;
2069  matr = new TGeoCombiTrans(*pos, *rot);
2070  assem->AddNode(lv, copynum, matr);
2071  if (!pnodename.IsNull())
2072  ((TNamed*)assem->GetNodes()->Last())->SetName(pnodename);
2073 
2074  }
2075  child = gdml->GetNext(child);
2076  }
2077 
2078  fvolmap[name.Data()] = assem;
2079  return child;
2080 }
2081 
2082 ////////////////////////////////////////////////////////////////////////////////
2083 /// In the setup section of the GDML file, the top volume need to be
2084 /// declared. when the setup keyword is found, this function is called,
2085 /// and the top volume ref is taken and 'world' is set
2086 
2088 {
2089  const char* name = gdml->GetAttr(node, "name");
2090  gGeoManager->SetName(name);
2091  XMLNodePointer_t child = gdml->GetChild(node);
2092  TString reftemp = "";
2093 
2094  while (child != 0) {
2095 
2096  if ((strcmp(gdml->GetNodeName(child), "world") == 0)) {
2097  //const char* reftemp;
2098  //TString reftemp = "";
2099  reftemp = gdml->GetAttr(child, "ref");
2100 
2101 
2102  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2103  reftemp = TString::Format("%s_%s", reftemp.Data(), fCurrentFile);
2104 
2105  }
2106  fWorld = fvolmap[reftemp.Data()];
2107  fWorldName = reftemp.Data();
2108 
2109  }
2110  child = gdml->GetNext(child);
2111  }
2112  return node;
2113 }
2114 
2115 ////////////////////////////////////////////////////////////////////////////////
2116 /// In the solids section of the GDML file, a box may be declared.
2117 /// when the box keyword is found, this function is called, and the
2118 /// dimensions required are taken and stored, these are then bound and
2119 /// converted to type TGeoBBox and stored in fsolmap map using the name
2120 /// as its key.
2121 
2123 {
2124  TString lunit = "mm";
2125  TString xpos = "0";
2126  TString ypos = "0";
2127  TString zpos = "0";
2128  TString name = "";
2129  TString tempattr;
2130 
2131  while (attr != 0) {
2132 
2133  tempattr = gdml->GetAttrName(attr);
2134  tempattr.ToLower();
2135 
2136  if (tempattr == "name") {
2137  name = gdml->GetAttrValue(attr);
2138  } else if (tempattr == "x") {
2139  xpos = gdml->GetAttrValue(attr);
2140  } else if (tempattr == "y") {
2141  ypos = gdml->GetAttrValue(attr);
2142  } else if (tempattr == "z") {
2143  zpos = gdml->GetAttrValue(attr);
2144  } else if (tempattr == "lunit") {
2145  lunit = gdml->GetAttrValue(attr);
2146  }
2147 
2148  attr = gdml->GetNextAttr(attr);
2149  }
2150 
2151  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2152  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
2153  }
2154 
2155  Double_t retunit = GetScaleVal(lunit);
2156 
2157  Double_t xline = 0.5*Value(xpos)*retunit;
2158  Double_t yline = 0.5*Value(ypos)*retunit;
2159  Double_t zline = 0.5*Value(zpos)*retunit;
2160 
2161 
2162  TGeoBBox* box = new TGeoBBox(NameShort(name), xline, yline, zline);
2163 
2164  fsolmap[name.Data()] = box;
2165 
2166  return node;
2167 
2168 }
2169 
2170 ////////////////////////////////////////////////////////////////////////////////
2171 /// In the solids section of the GDML file, an ellipsoid may be declared.
2172 /// Unfortunately, the ellipsoid is not supported under ROOT so,
2173 /// when the ellipsoid keyword is found, this function is called
2174 /// to convert it to a simple box with similar dimensions, and the
2175 /// dimensions required are taken and stored, these are then bound and
2176 /// converted to type TGeoBBox and stored in fsolmap map using the name
2177 /// as its key.
2178 
2180 {
2181  TString lunit = "mm";
2182  TString ax = "0";
2183  TString by = "0";
2184  TString cz = "0";
2185  //initialization to empty string
2186  TString zcut1 = "";
2187  TString zcut2 = "";
2188  TString name = "";
2189  TString tempattr;
2190 
2191  while (attr != 0) {
2192 
2193  tempattr = gdml->GetAttrName(attr);
2194  tempattr.ToLower();
2195 
2196  if (tempattr == "name") {
2197  name = gdml->GetAttrValue(attr);
2198  } else if (tempattr == "ax") {
2199  ax = gdml->GetAttrValue(attr);
2200  } else if (tempattr == "by") {
2201  by = gdml->GetAttrValue(attr);
2202  } else if (tempattr == "cz") {
2203  cz = gdml->GetAttrValue(attr);
2204  } else if (tempattr == "zcut1") {
2205  zcut1 = gdml->GetAttrValue(attr);
2206  } else if (tempattr == "zcut2") {
2207  zcut2 = gdml->GetAttrValue(attr);
2208  } else if (tempattr == "lunit") {
2209  lunit = gdml->GetAttrValue(attr);
2210  }
2211 
2212  attr = gdml->GetNextAttr(attr);
2213  }
2214 
2215  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2216  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
2217  }
2218 
2219  Double_t retunit = GetScaleVal(lunit);
2220 
2221  Double_t dx = Value(ax)*retunit;
2222  Double_t dy = Value(by)*retunit;
2223  Double_t radius = Value(cz)*retunit;
2224  Double_t sx = dx / radius;
2225  Double_t sy = dy / radius;
2226  Double_t sz = 1.;
2227  Double_t z1, z2;
2228  //Initialization of cutting
2229  if (zcut1 == "") {
2230  z1 = -radius;
2231  } else {
2232  z1 = Value(zcut1)*retunit;
2233  }
2234  if (zcut2 == "") {
2235  z2 = radius;
2236  } else {
2237  z2 = Value(zcut2)*retunit;
2238  }
2239 
2240  TGeoSphere *sph = new TGeoSphere(0, radius);
2241  TGeoScale *scl = new TGeoScale("", sx, sy, sz);
2242  TGeoScaledShape *shape = new TGeoScaledShape(NameShort(name), sph, scl);
2243 
2244  Double_t origin[3] = {0., 0., 0.};
2245  origin[2] = 0.5 * (z1 + z2);
2246  Double_t dz = 0.5 * (z2 - z1);
2247  TGeoBBox *pCutBox = new TGeoBBox("cutBox", dx, dy, dz, origin);
2248  TGeoBoolNode *pBoolNode = new TGeoIntersection(shape, pCutBox, 0, 0);
2249  TGeoCompositeShape *cs = new TGeoCompositeShape(NameShort(name), pBoolNode);
2250  fsolmap[name.Data()] = cs;
2251 
2252  return node;
2253 
2254 }
2255 
2256 ////////////////////////////////////////////////////////////////////////////////
2257 /// In the solids section of the GDML file, an elliptical cone may be declared.
2258 /// Unfortunately, the elliptical cone is not supported under ROOT so,
2259 /// when the elcone keyword is found, this function is called
2260 /// to convert it to a simple box with similar dimensions, and the
2261 /// dimensions required are taken and stored, these are then bound and
2262 /// converted to type TGeoBBox and stored in fsolmap map using the name
2263 /// as its key.
2264 
2266 {
2267  TString lunit = "mm";
2268  TString dx = "0";
2269  TString dy = "0";
2270  TString zmax = "0";
2271  TString zcut = "0";
2272  TString name = "";
2273  TString tempattr;
2274 
2275  while (attr != 0) {
2276 
2277  tempattr = gdml->GetAttrName(attr);
2278  tempattr.ToLower();
2279 
2280  if (tempattr == "name") {
2281  name = gdml->GetAttrValue(attr);
2282  } else if (tempattr == "dx") {
2283  dx = gdml->GetAttrValue(attr);
2284  } else if (tempattr == "dy") {
2285  dy = gdml->GetAttrValue(attr);
2286  } else if (tempattr == "zmax") {
2287  zmax = gdml->GetAttrValue(attr);
2288  } else if (tempattr == "zcut") {
2289  zcut = gdml->GetAttrValue(attr);
2290  } else if (tempattr == "lunit") {
2291  lunit = gdml->GetAttrValue(attr);
2292  }
2293 
2294  attr = gdml->GetNextAttr(attr);
2295  }
2296 
2297  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2298  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
2299  }
2300 
2301  //semiaxises of elliptical cone (elcone) are different then ellipsoid
2302 
2303  Double_t retunit = GetScaleVal(lunit);
2304 
2305  //dxline and dyline are without units because they are as a ration
2306  Double_t dxratio = Value(dx);
2307  Double_t dyratio = Value(dy);
2308  Double_t z = Value(zmax)*retunit;
2309  Double_t z1 = Value(zcut)*retunit;
2310 
2311  if (z1 <= 0) {
2312  Info("ElCone", "ERROR! Parameter zcut = %.12g is not set properly, elcone will not be imported.", z1);
2313  return node;
2314  }
2315  if (z1 > z){
2316  z1 = z;
2317  }
2318  Double_t rx1 = (z + z1) * dxratio;
2319  Double_t ry1 = (z + z1) * dyratio;
2320  Double_t rx2 = (z - z1) * dxratio;
2321  Double_t sx = 1.;
2322  Double_t sy = ry1 / rx1;
2323  Double_t sz = 1.;
2324 
2325  TGeoCone *con = new TGeoCone(z1, 0, rx1, 0, rx2);
2326  TGeoScale *scl = new TGeoScale("", sx, sy, sz);
2327  TGeoScaledShape *shape = new TGeoScaledShape(NameShort(name), con, scl);
2328 
2329  fsolmap[name.Data()] = shape;
2330 
2331  return node;
2332 
2333 }
2334 
2335 ////////////////////////////////////////////////////////////////////////////////
2336 /// In the solids section of the GDML file, a Paraboloid may be declared.
2337 /// when the paraboloid keyword is found, this function is called, and the
2338 /// dimensions required are taken and stored, these are then bound and
2339 /// converted to type TGeoParaboloid and stored in fsolmap map using the name
2340 /// as its key.
2341 
2343 {
2344  TString lunit = "mm";
2345  TString rlopos = "0";
2346  TString rhipos = "0";
2347  TString dzpos = "0";
2348  TString name = "";
2349  TString tempattr;
2350 
2351  while (attr != 0) {
2352 
2353  tempattr = gdml->GetAttrName(attr);
2354  tempattr.ToLower();
2355 
2356  if (tempattr == "name") {
2357  name = gdml->GetAttrValue(attr);
2358  } else if (tempattr == "rlo") {
2359  rlopos = gdml->GetAttrValue(attr);
2360  } else if (tempattr == "rhi") {
2361  rhipos = gdml->GetAttrValue(attr);
2362  } else if (tempattr == "dz") {
2363  dzpos = gdml->GetAttrValue(attr);
2364  } else if (tempattr == "lunit") {
2365  lunit = gdml->GetAttrValue(attr);
2366  }
2367 
2368  attr = gdml->GetNextAttr(attr);
2369  }
2370 
2371  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2372  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
2373  }
2374 
2375  Double_t retunit = GetScaleVal(lunit);
2376 
2377  Double_t rlo = Value(rlopos)*retunit;
2378  Double_t rhi = Value(rhipos)*retunit;
2379  Double_t dz = Value(dzpos)*retunit;
2380 
2381  TGeoParaboloid* paraboloid = new TGeoParaboloid(NameShort(name), rlo, rhi, dz);
2382 
2383  fsolmap[name.Data()] = paraboloid;
2384 
2385  return node;
2386 
2387 }
2388 
2389 ////////////////////////////////////////////////////////////////////////////////
2390 /// In the solids section of the GDML file, an Arb8 may be declared.
2391 /// when the arb8 keyword is found, this function is called, and the
2392 /// dimensions required are taken and stored, these are then bound and
2393 /// converted to type TGeoArb8 and stored in fsolmap map using the name
2394 /// as its key.
2395 
2397 {
2398  TString lunit = "mm";
2399  TString v1xpos = "0";
2400  TString v1ypos = "0";
2401  TString v2xpos = "0";
2402  TString v2ypos = "0";
2403  TString v3xpos = "0";
2404  TString v3ypos = "0";
2405  TString v4xpos = "0";
2406  TString v4ypos = "0";
2407  TString v5xpos = "0";
2408  TString v5ypos = "0";
2409  TString v6xpos = "0";
2410  TString v6ypos = "0";
2411  TString v7xpos = "0";
2412  TString v7ypos = "0";
2413  TString v8xpos = "0";
2414  TString v8ypos = "0";
2415  TString dzpos = "0";
2416  TString name = "";
2417  TString tempattr;
2418 
2419  while (attr != 0) {
2420 
2421  tempattr = gdml->GetAttrName(attr);
2422  tempattr.ToLower();
2423 
2424  if (tempattr == "name") {
2425  name = gdml->GetAttrValue(attr);
2426  } else if (tempattr == "v1x") {
2427  v1xpos = gdml->GetAttrValue(attr);
2428  } else if (tempattr == "v1y") {
2429  v1ypos = gdml->GetAttrValue(attr);
2430  } else if (tempattr == "v2x") {
2431  v2xpos = gdml->GetAttrValue(attr);
2432  } else if (tempattr == "v2y") {
2433  v2ypos = gdml->GetAttrValue(attr);
2434  } else if (tempattr == "v3x") {
2435  v3xpos = gdml->GetAttrValue(attr);
2436  } else if (tempattr == "v3y") {
2437  v3ypos = gdml->GetAttrValue(attr);
2438  } else if (tempattr == "v4x") {
2439  v4xpos = gdml->GetAttrValue(attr);
2440  } else if (tempattr == "v4y") {
2441  v4ypos = gdml->GetAttrValue(attr);
2442  } else if (tempattr == "v5x") {
2443  v5xpos = gdml->GetAttrValue(attr);
2444  } else if (tempattr == "v5y") {
2445  v5ypos = gdml->GetAttrValue(attr);
2446  } else if (tempattr == "v6x") {
2447  v6xpos = gdml->GetAttrValue(attr);
2448  } else if (tempattr == "v6y") {
2449  v6ypos = gdml->GetAttrValue(attr);
2450  } else if (tempattr == "v7x") {
2451  v7xpos = gdml->GetAttrValue(attr);
2452  } else if (tempattr == "v7y") {
2453  v7ypos = gdml->GetAttrValue(attr);
2454  } else if (tempattr == "v8x") {
2455  v8xpos = gdml->GetAttrValue(attr);
2456  } else if (tempattr == "v8y") {
2457  v8ypos = gdml->GetAttrValue(attr);
2458  } else if (tempattr == "dz") {
2459  dzpos = gdml->GetAttrValue(attr);
2460  } else if (tempattr == "lunit") {
2461  lunit = gdml->GetAttrValue(attr);
2462  }
2463 
2464  attr = gdml->GetNextAttr(attr);
2465  }
2466 
2467  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2468  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
2469  }
2470 
2471  Double_t retunit = GetScaleVal(lunit);
2472 
2473  Double_t v1x = Value(v1xpos)*retunit;
2474  Double_t v1y = Value(v1ypos)*retunit;
2475  Double_t v2x = Value(v2xpos)*retunit;
2476  Double_t v2y = Value(v2ypos)*retunit;
2477  Double_t v3x = Value(v3xpos)*retunit;
2478  Double_t v3y = Value(v3ypos)*retunit;
2479  Double_t v4x = Value(v4xpos)*retunit;
2480  Double_t v4y = Value(v4ypos)*retunit;
2481  Double_t v5x = Value(v5xpos)*retunit;
2482  Double_t v5y = Value(v5ypos)*retunit;
2483  Double_t v6x = Value(v6xpos)*retunit;
2484  Double_t v6y = Value(v6ypos)*retunit;
2485  Double_t v7x = Value(v7xpos)*retunit;
2486  Double_t v7y = Value(v7ypos)*retunit;
2487  Double_t v8x = Value(v8xpos)*retunit;
2488  Double_t v8y = Value(v8ypos)*retunit;
2489  Double_t dz = Value(dzpos)*retunit;
2490 
2491 
2492  TGeoArb8* arb8 = new TGeoArb8(NameShort(name), dz);
2493 
2494  arb8->SetVertex(0, v1x, v1y);
2495  arb8->SetVertex(1, v2x, v2y);
2496  arb8->SetVertex(2, v3x, v3y);
2497  arb8->SetVertex(3, v4x, v4y);
2498  arb8->SetVertex(4, v5x, v5y);
2499  arb8->SetVertex(5, v6x, v6y);
2500  arb8->SetVertex(6, v7x, v7y);
2501  arb8->SetVertex(7, v8x, v8y);
2502 
2503  fsolmap[name.Data()] = arb8;
2504 
2505  return node;
2506 
2507 }
2508 
2509 ////////////////////////////////////////////////////////////////////////////////
2510 /// In the solids section of the GDML file, a Tube may be declared.
2511 /// when the tube keyword is found, this function is called, and the
2512 /// dimensions required are taken and stored, these are then bound and
2513 /// converted to type TGeoTubeSeg and stored in fsolmap map using the name
2514 /// as its key.
2515 
2517 {
2518  TString lunit = "mm";
2519  TString aunit = "rad";
2520  TString rmin = "0";
2521  TString rmax = "0";
2522  TString z = "0";
2523  TString startphi = "0";
2524  TString deltaphi = "0";
2525  TString name = "";
2526  TString tempattr;
2527 
2528  while (attr != 0) {
2529 
2530  tempattr = gdml->GetAttrName(attr);
2531  tempattr.ToLower();
2532 
2533  if (tempattr == "name") {
2534  name = gdml->GetAttrValue(attr);
2535  } else if (tempattr == "rmin") {
2536  rmin = gdml->GetAttrValue(attr);
2537  } else if (tempattr == "rmax") {
2538  rmax = gdml->GetAttrValue(attr);
2539  } else if (tempattr == "z") {
2540  z = gdml->GetAttrValue(attr);
2541  } else if (tempattr == "lunit") {
2542  lunit = gdml->GetAttrValue(attr);
2543  } else if (tempattr == "aunit") {
2544  aunit = gdml->GetAttrValue(attr);
2545  } else if (tempattr == "startphi") {
2546  startphi = gdml->GetAttrValue(attr);
2547  } else if (tempattr == "deltaphi") {
2548  deltaphi = gdml->GetAttrValue(attr);
2549  }
2550 
2551  attr = gdml->GetNextAttr(attr);
2552  }
2553 
2554  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2555  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
2556  }
2557 
2558  Double_t retlunit = GetScaleVal(lunit);
2559  Double_t retaunit = GetScaleVal(aunit);
2560 
2561  Double_t rminline = Value(rmin)*retlunit;
2562  Double_t rmaxline = Value(rmax)*retlunit;
2563  Double_t zline = Value(z)*retlunit;
2564  Double_t startphideg = Value(startphi)*retaunit;
2565  Double_t deltaphideg = Value(deltaphi)*retaunit;
2566  Double_t endphideg = startphideg + deltaphideg;
2567 
2568  TGeoShape *tube = 0;
2569  if (deltaphideg < 360.)
2570  tube = new TGeoTubeSeg(NameShort(name), rminline,
2571  rmaxline,
2572  zline / 2,
2573  startphideg,
2574  endphideg);
2575  else
2576  tube = new TGeoTube(NameShort(name), rminline,
2577  rmaxline,
2578  zline / 2);
2579  fsolmap[name.Data()] = tube;
2580 
2581  return node;
2582 
2583 }
2584 
2585 ////////////////////////////////////////////////////////////////////////////////
2586 /// In the solids section of the GDML file, a Cut Tube may be declared.
2587 /// when the cutTube keyword is found, this function is called, and the
2588 /// dimensions required are taken and stored, these are then bound and
2589 /// converted to type TGeoCtub and stored in fsolmap map using the name
2590 /// as its key.
2591 
2593 {
2594  TString lunit = "mm";
2595  TString aunit = "rad";
2596  TString rmin = "0";
2597  TString rmax = "0";
2598  TString z = "0";
2599  TString startphi = "0";
2600  TString deltaphi = "0";
2601  TString lowX = "0";
2602  TString lowY = "0";
2603  TString lowZ = "0";
2604  TString highX = "0";
2605  TString highY = "0";
2606  TString highZ = "0";
2607  TString name = "";
2608  TString tempattr;
2609 
2610  while (attr != 0) {
2611 
2612  tempattr = gdml->GetAttrName(attr);
2613  tempattr.ToLower();
2614 
2615  if (tempattr == "name") {
2616  name = gdml->GetAttrValue(attr);
2617  } else if (tempattr == "rmin") {
2618  rmin = gdml->GetAttrValue(attr);
2619  } else if (tempattr == "rmax") {
2620  rmax = gdml->GetAttrValue(attr);
2621  } else if (tempattr == "z") {
2622  z = gdml->GetAttrValue(attr);
2623  } else if (tempattr == "lunit") {
2624  lunit = gdml->GetAttrValue(attr);
2625  } else if (tempattr == "aunit") {
2626  aunit = gdml->GetAttrValue(attr);
2627  } else if (tempattr == "startphi") {
2628  startphi = gdml->GetAttrValue(attr);
2629  } else if (tempattr == "deltaphi") {
2630  deltaphi = gdml->GetAttrValue(attr);
2631  } else if (tempattr == "lowx") {
2632  lowX = gdml->GetAttrValue(attr);
2633  } else if (tempattr == "lowy") {
2634  lowY = gdml->GetAttrValue(attr);
2635  } else if (tempattr == "lowz") {
2636  lowZ = gdml->GetAttrValue(attr);
2637  } else if (tempattr == "highx") {
2638  highX = gdml->GetAttrValue(attr);
2639  } else if (tempattr == "highy") {
2640  highY = gdml->GetAttrValue(attr);
2641  } else if (tempattr == "highz") {
2642  highZ = gdml->GetAttrValue(attr);
2643  }
2644 
2645  attr = gdml->GetNextAttr(attr);
2646  }
2647 
2648  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2649  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
2650  }
2651 
2652  Double_t retlunit = GetScaleVal(lunit);
2653  Double_t retaunit = GetScaleVal(aunit);
2654 
2655  Double_t rminline = Value(rmin)*retlunit;
2656  Double_t rmaxline = Value(rmax)*retlunit;
2657  Double_t zline = Value(z)*retlunit;
2658  Double_t startphiline = Value(startphi)*retaunit;
2659  Double_t deltaphiline = Value(deltaphi)*retaunit + startphiline;
2660  Double_t lowXline = Value(lowX)*retlunit;
2661  Double_t lowYline = Value(lowY)*retlunit;
2662  Double_t lowZline = Value(lowZ)*retlunit;
2663  Double_t highXline = Value(highX)*retlunit;
2664  Double_t highYline = Value(highY)*retlunit;
2665  Double_t highZline = Value(highZ)*retlunit;
2666 
2667 
2668  TGeoCtub* cuttube = new TGeoCtub(NameShort(name), rminline,
2669  rmaxline,
2670  zline / 2,
2671  startphiline,
2672  deltaphiline,
2673  lowXline,
2674  lowYline,
2675  lowZline,
2676  highXline,
2677  highYline,
2678  highZline);
2679 
2680 
2681  fsolmap[name.Data()] = cuttube;
2682 
2683  return node;
2684 
2685 }
2686 
2687 ////////////////////////////////////////////////////////////////////////////////
2688 /// In the solids section of the GDML file, a cone may be declared.
2689 /// when the cone keyword is found, this function is called, and the
2690 /// dimensions required are taken and stored, these are then bound and
2691 /// converted to type TGeoConSeg and stored in fsolmap map using the name
2692 /// as its key.
2693 
2695 {
2696  TString lunit = "mm";
2697  TString aunit = "rad";
2698  TString rmin1 = "0";
2699  TString rmax1 = "0";
2700  TString rmin2 = "0";
2701  TString rmax2 = "0";
2702  TString z = "0";
2703  TString startphi = "0";
2704  TString deltaphi = "0";
2705  TString name = "";
2706  TString tempattr;
2707 
2708  while (attr != 0) {
2709 
2710  tempattr = gdml->GetAttrName(attr);
2711  tempattr.ToLower();
2712 
2713  if (tempattr == "name") {
2714  name = gdml->GetAttrValue(attr);
2715  } else if (tempattr == "rmin1") {
2716  rmin1 = gdml->GetAttrValue(attr);
2717  } else if (tempattr == "rmax1") {
2718  rmax1 = gdml->GetAttrValue(attr);
2719  } else if (tempattr == "rmin2") {
2720  rmin2 = gdml->GetAttrValue(attr);
2721  } else if (tempattr == "rmax2") {
2722  rmax2 = gdml->GetAttrValue(attr);
2723  } else if (tempattr == "z") {
2724  z = gdml->GetAttrValue(attr);
2725  } else if (tempattr == "lunit") {
2726  lunit = gdml->GetAttrValue(attr);
2727  } else if (tempattr == "aunit") {
2728  aunit = gdml->GetAttrValue(attr);
2729  } else if (tempattr == "startphi") {
2730  startphi = gdml->GetAttrValue(attr);
2731  } else if (tempattr == "deltaphi") {
2732  deltaphi = gdml->GetAttrValue(attr);
2733  }
2734 
2735  attr = gdml->GetNextAttr(attr);
2736  }
2737 
2738  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2739  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
2740  }
2741 
2742  Double_t retlunit = GetScaleVal(lunit);
2743  Double_t retaunit = GetScaleVal(aunit);
2744 
2745  Double_t rmin1line = Value(rmin1)*retlunit;
2746  Double_t rmax1line = Value(rmax1)*retlunit;
2747  Double_t rmin2line = Value(rmin2)*retlunit;
2748  Double_t rmax2line = Value(rmax2)*retlunit;
2749  Double_t zline = Value(z)*retlunit;
2750  Double_t sphi = Value(startphi)*retaunit;
2751  Double_t dphi = Value(deltaphi)*retaunit;
2752  Double_t ephi = sphi + dphi;
2753 
2754  TGeoShape *cone = 0;
2755  if (dphi < 360.)
2756  cone = new TGeoConeSeg(NameShort(name), zline / 2,
2757  rmin1line,
2758  rmax1line,
2759  rmin2line,
2760  rmax2line,
2761  sphi, ephi);
2762  else
2763  cone = new TGeoCone(NameShort(name), zline / 2,
2764  rmin1line,
2765  rmax1line,
2766  rmin2line,
2767  rmax2line);
2768 
2769  fsolmap[name.Data()] = cone;
2770 
2771  return node;
2772 
2773 }
2774 
2775 ////////////////////////////////////////////////////////////////////////////////
2776 /// In the solids section of the GDML file, a Trap may be declared.
2777 /// when the trap keyword is found, this function is called, and the
2778 /// dimensions required are taken and stored, these are then bound and
2779 /// converted to type TGeoTrap and stored in fsolmap map using the name
2780 /// as its key.
2781 
2783 {
2784  TString lunit = "mm";
2785  TString aunit = "rad";
2786  TString x1 = "0";
2787  TString x2 = "0";
2788  TString x3 = "0";
2789  TString x4 = "0";
2790  TString y1 = "0";
2791  TString y2 = "0";
2792  TString z = "0";
2793  TString phi = "0";
2794  TString theta = "0";
2795  TString alpha1 = "0";
2796  TString alpha2 = "0";
2797  TString name = "";
2798  TString tempattr;
2799 
2800  while (attr != 0) {
2801 
2802  tempattr = gdml->GetAttrName(attr);
2803  tempattr.ToLower();
2804 
2805  if (tempattr == "name") {
2806  name = gdml->GetAttrValue(attr);
2807  } else if (tempattr == "x1") {
2808  x1 = gdml->GetAttrValue(attr);
2809  } else if (tempattr == "x2") {
2810  x2 = gdml->GetAttrValue(attr);
2811  } else if (tempattr == "x3") {
2812  x3 = gdml->GetAttrValue(attr);
2813  } else if (tempattr == "x4") {
2814  x4 = gdml->GetAttrValue(attr);
2815  } else if (tempattr == "y1") {
2816  y1 = gdml->GetAttrValue(attr);
2817  } else if (tempattr == "y2") {
2818  y2 = gdml->GetAttrValue(attr);
2819  } else if (tempattr == "z") {
2820  z = gdml->GetAttrValue(attr);
2821  } else if (tempattr == "lunit") {
2822  lunit = gdml->GetAttrValue(attr);
2823  } else if (tempattr == "aunit") {
2824  aunit = gdml->GetAttrValue(attr);
2825  } else if (tempattr == "phi") {
2826  phi = gdml->GetAttrValue(attr);
2827  } else if (tempattr == "theta") {
2828  theta = gdml->GetAttrValue(attr);
2829  } else if (tempattr == "alpha1") {
2830  alpha1 = gdml->GetAttrValue(attr);
2831  } else if (tempattr == "alpha2") {
2832  alpha2 = gdml->GetAttrValue(attr);
2833  }
2834 
2835  attr = gdml->GetNextAttr(attr);
2836  }
2837 
2838  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2839  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
2840  }
2841 
2842  Double_t retlunit = GetScaleVal(lunit);
2843  Double_t retaunit = GetScaleVal(aunit);
2844 
2845  Double_t x1line = Value(x1)*retlunit;
2846  Double_t x2line = Value(x2)*retlunit;
2847  Double_t x3line = Value(x3)*retlunit;
2848  Double_t x4line = Value(x4)*retlunit;
2849  Double_t y1line = Value(y1)*retlunit;
2850  Double_t y2line = Value(y2)*retlunit;
2851  Double_t zline = Value(z)*retlunit;
2852  Double_t philine = Value(phi)*retaunit;
2853  Double_t thetaline = Value(theta)*retaunit;
2854  Double_t alpha1line = Value(alpha1)*retaunit;
2855  Double_t alpha2line = Value(alpha2)*retaunit;
2856 
2857  TGeoTrap* trap = new TGeoTrap(NameShort(name), zline / 2,
2858  thetaline,
2859  philine,
2860  y1line / 2,
2861  x1line / 2,
2862  x2line / 2,
2863  alpha1line,
2864  y2line / 2,
2865  x3line / 2,
2866  x4line / 2,
2867  alpha2line);
2868 
2869  fsolmap[name.Data()] = trap;
2870 
2871  return node;
2872 
2873 }
2874 
2875 ////////////////////////////////////////////////////////////////////////////////
2876 /// In the solids section of the GDML file, a Trd may be declared.
2877 /// when the trd keyword is found, this function is called, and the
2878 /// dimensions required are taken and stored, these are then bound and
2879 /// converted to type TGeoTrd2 and stored in fsolmap map using the name
2880 /// as its key.
2881 
2883 {
2884  TString lunit = "mm";
2885  TString x1 = "0";
2886  TString x2 = "0";
2887  TString y1 = "0";
2888  TString y2 = "0";
2889  TString z = "0";
2890  TString name = "";
2891  TString tempattr;
2892 
2893  while (attr != 0) {
2894 
2895  tempattr = gdml->GetAttrName(attr);
2896  tempattr.ToLower();
2897 
2898  if (tempattr == "name") {
2899  name = gdml->GetAttrValue(attr);
2900  } else if (tempattr == "x1") {
2901  x1 = gdml->GetAttrValue(attr);
2902  } else if (tempattr == "x2") {
2903  x2 = gdml->GetAttrValue(attr);
2904  } else if (tempattr == "y1") {
2905  y1 = gdml->GetAttrValue(attr);
2906  } else if (tempattr == "y2") {
2907  y2 = gdml->GetAttrValue(attr);
2908  } else if (tempattr == "z") {
2909  z = gdml->GetAttrValue(attr);
2910  } else if (tempattr == "lunit") {
2911  lunit = gdml->GetAttrValue(attr);
2912  }
2913 
2914  attr = gdml->GetNextAttr(attr);
2915  }
2916 
2917  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2918  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
2919  }
2920 
2921  Double_t retlunit = GetScaleVal(lunit);
2922 
2923  Double_t x1line = Value(x1)*retlunit;
2924  Double_t x2line = Value(x2)*retlunit;
2925  Double_t y1line = Value(y1)*retlunit;
2926  Double_t y2line = Value(y2)*retlunit;
2927  Double_t zline = Value(z)*retlunit;
2928 
2929  TGeoTrd2* trd = new TGeoTrd2(NameShort(name),
2930  x1line / 2,
2931  x2line / 2,
2932  y1line / 2,
2933  y2line / 2,
2934  zline / 2);
2935 
2936  fsolmap[name.Data()] = trd;
2937 
2938  return node;
2939 
2940 }
2941 
2942 ////////////////////////////////////////////////////////////////////////////////
2943 /// In the solids section of the GDML file, a Polycone may be declared.
2944 /// when the polycone keyword is found, this function is called, and the
2945 /// dimensions required are taken and stored, these are then bound and
2946 /// converted to type TGeoPCon and stored in fsolmap map using the name
2947 /// as its key. Polycone has Zplanes, planes along the z axis specifying
2948 /// the rmin, rmax dimensions at that point along z.
2949 
2951 {
2952  TString lunit = "mm";
2953  TString aunit = "rad";
2954  TString rmin = "0";
2955  TString rmax = "0";
2956  TString z = "0";
2957  TString startphi = "0";
2958  TString deltaphi = "0";
2959  TString name = "";
2960  TString tempattr;
2961 
2962  while (attr != 0) {
2963 
2964  tempattr = gdml->GetAttrName(attr);
2965  tempattr.ToLower();
2966 
2967  if (tempattr == "name") {
2968  name = gdml->GetAttrValue(attr);
2969  } else if (tempattr == "lunit") {
2970  lunit = gdml->GetAttrValue(attr);
2971  } else if (tempattr == "aunit") {
2972  aunit = gdml->GetAttrValue(attr);
2973  } else if (tempattr == "startphi") {
2974  startphi = gdml->GetAttrValue(attr);
2975  } else if (tempattr == "deltaphi") {
2976  deltaphi = gdml->GetAttrValue(attr);
2977  }
2978  attr = gdml->GetNextAttr(attr);
2979  }
2980 
2981  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2982  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
2983  }
2984 
2985  Double_t retlunit = GetScaleVal(lunit);
2986  Double_t retaunit = GetScaleVal(aunit);
2987 
2988  //START TO LOOK THRU CHILD (ZPLANE) NODES...
2989 
2990  XMLNodePointer_t child = gdml->GetChild(node);
2991  int numplanes = 0;
2992 
2993  while (child != 0) {
2994  numplanes = numplanes + 1;
2995  child = gdml->GetNext(child);
2996  }
2997 
2998  int cols;
2999  int i;
3000  cols = 3;
3001  double ** table = new double*[numplanes];
3002  for (i = 0; i < numplanes; i++) {
3003  table[i] = new double[cols];
3004  }
3005 
3006  child = gdml->GetChild(node);
3007  int planeno = 0;
3008 
3009  while (child != 0) {
3010  if (strcmp(gdml->GetNodeName(child), "zplane") == 0) {
3011  //removed original dec
3012  Double_t rminline = 0;
3013  Double_t rmaxline = 0;
3014  Double_t zline = 0;
3015 
3016  attr = gdml->GetFirstAttr(child);
3017 
3018  while (attr != 0) {
3019  tempattr = gdml->GetAttrName(attr);
3020  tempattr.ToLower();
3021 
3022  if (tempattr == "rmin") {
3023  rmin = gdml->GetAttrValue(attr);
3024  rminline = Value(rmin)*retlunit;
3025  table[planeno][0] = rminline;
3026  } else if (tempattr == "rmax") {
3027  rmax = gdml->GetAttrValue(attr);
3028  rmaxline = Value(rmax)*retlunit;
3029  table[planeno][1] = rmaxline;
3030  } else if (tempattr == "z") {
3031  z = gdml->GetAttrValue(attr);
3032  zline = Value(z)*retlunit;
3033  table[planeno][2] = zline;
3034  }
3035  attr = gdml->GetNextAttr(attr);
3036  }
3037  }
3038  planeno = planeno + 1;
3039  child = gdml->GetNext(child);
3040  }
3041 
3042  Double_t startphiline = Value(startphi)*retaunit;
3043  Double_t deltaphiline = Value(deltaphi)*retaunit;
3044 
3045  TGeoPcon* poly = new TGeoPcon(NameShort(name),
3046  startphiline,
3047  deltaphiline,
3048  numplanes);
3049  Int_t zno = 0;
3050 
3051  for (int j = 0; j < numplanes; j++) {
3052  poly->DefineSection(zno, table[j][2], table[j][0], table[j][1]);
3053  zno = zno + 1;
3054  }
3055 
3056  fsolmap[name.Data()] = poly;
3057  for (i = 0; i < numplanes; i++) {
3058  delete [] table[i];
3059  }
3060  delete [] table;
3061 
3062  return node;
3063 }
3064 
3065 ////////////////////////////////////////////////////////////////////////////////
3066 /// In the solids section of the GDML file, a Polyhedra may be declared.
3067 /// when the polyhedra keyword is found, this function is called, and the
3068 /// dimensions required are taken and stored, these are then bound and
3069 /// converted to type TGeoPgon and stored in fsolmap map using the name
3070 /// as its key. Polycone has Zplanes, planes along the z axis specifying
3071 /// the rmin, rmax dimensions at that point along z.
3072 
3074 {
3075  TString lunit = "mm";
3076  TString aunit = "rad";
3077  TString rmin = "0";
3078  TString rmax = "0";
3079  TString z = "0";
3080  TString startphi = "0";
3081  TString deltaphi = "0";
3082  TString numsides = "1";
3083  TString name = "";
3084  TString tempattr;
3085 
3086  while (attr != 0) {
3087 
3088  tempattr = gdml->GetAttrName(attr);
3089  tempattr.ToLower();
3090 
3091  if (tempattr == "name") {
3092  name = gdml->GetAttrValue(attr);
3093  } else if (tempattr == "lunit") {
3094  lunit = gdml->GetAttrValue(attr);
3095  } else if (tempattr == "aunit") {
3096  aunit = gdml->GetAttrValue(attr);
3097  } else if (tempattr == "startphi") {
3098  startphi = gdml->GetAttrValue(attr);
3099  } else if (tempattr == "deltaphi") {
3100  deltaphi = gdml->GetAttrValue(attr);
3101  } else if (tempattr == "numsides") {
3102  numsides = gdml->GetAttrValue(attr);
3103  }
3104 
3105  attr = gdml->GetNextAttr(attr);
3106  }
3107 
3108  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3109  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
3110  }
3111 
3112  Double_t retlunit = GetScaleVal(lunit);
3113  Double_t retaunit = GetScaleVal(aunit);
3114 
3115  //START TO LOOK THRU CHILD (ZPLANE) NODES...
3116 
3117  XMLNodePointer_t child = gdml->GetChild(node);
3118  int numplanes = 0;
3119 
3120  while (child != 0) {
3121  numplanes = numplanes + 1;
3122  child = gdml->GetNext(child);
3123  }
3124 
3125  int cols;
3126  int i;
3127  cols = 3;
3128  double ** table = new double*[numplanes];
3129  for (i = 0; i < numplanes; i++) {
3130  table[i] = new double[cols];
3131  }
3132 
3133  child = gdml->GetChild(node);
3134  int planeno = 0;
3135 
3136  while (child != 0) {
3137  if (strcmp(gdml->GetNodeName(child), "zplane") == 0) {
3138 
3139  Double_t rminline = 0;
3140  Double_t rmaxline = 0;
3141  Double_t zline = 0;
3142  attr = gdml->GetFirstAttr(child);
3143 
3144  while (attr != 0) {
3145  tempattr = gdml->GetAttrName(attr);
3146  tempattr.ToLower();
3147 
3148  if (tempattr == "rmin") {
3149  rmin = gdml->GetAttrValue(attr);
3150  rminline = Value(rmin)*retlunit;
3151  table[planeno][0] = rminline;
3152  } else if (tempattr == "rmax") {
3153  rmax = gdml->GetAttrValue(attr);
3154  rmaxline = Value(rmax)*retlunit;
3155  table[planeno][1] = rmaxline;
3156  } else if (tempattr == "z") {
3157  z = gdml->GetAttrValue(attr);
3158  zline = Value(z)*retlunit;
3159  table[planeno][2] = zline;
3160  }
3161 
3162  attr = gdml->GetNextAttr(attr);
3163  }
3164  }
3165  planeno = planeno + 1;
3166  child = gdml->GetNext(child);
3167  }
3168 
3169  Double_t startphiline = Value(startphi)*retaunit;
3170  Double_t deltaphiline = Value(deltaphi)*retaunit;
3171  Int_t numsidesline = (int)Value(numsides);
3172 
3173  TGeoPgon* polyg = new TGeoPgon(NameShort(name),
3174  startphiline,
3175  deltaphiline,
3176  numsidesline,
3177  numplanes);
3178  Int_t zno = 0;
3179 
3180  for (int j = 0; j < numplanes; j++) {
3181  polyg->DefineSection(zno, table[j][2], table[j][0], table[j][1]);
3182  zno = zno + 1;
3183  }
3184 
3185  fsolmap[name.Data()] = polyg;
3186  for (i = 0; i < numplanes; i++) {
3187  delete [] table[i];
3188  }
3189  delete [] table;
3190 
3191  return node;
3192 
3193 }
3194 
3195 ////////////////////////////////////////////////////////////////////////////////
3196 /// In the solids section of the GDML file, a Sphere may be declared.
3197 /// when the sphere keyword is found, this function is called, and the
3198 /// dimensions required are taken and stored, these are then bound and
3199 /// converted to type TGeoSphere and stored in fsolmap map using the name
3200 /// as its key.
3201 
3203 {
3204  TString lunit = "mm";
3205  TString aunit = "rad";
3206  TString rmin = "0";
3207  TString rmax = "0";
3208  TString startphi = "0";
3209  TString deltaphi = "0";
3210  TString starttheta = "0";
3211  TString deltatheta = "0";
3212  TString name = "";
3213  TString tempattr;
3214 
3215  while (attr != 0) {
3216  tempattr = gdml->GetAttrName(attr);
3217  tempattr.ToLower();
3218 
3219  if (tempattr == "name") {
3220  name = gdml->GetAttrValue(attr);
3221  } else if (tempattr == "rmin") {
3222  rmin = gdml->GetAttrValue(attr);
3223  } else if (tempattr == "rmax") {
3224  rmax = gdml->GetAttrValue(attr);
3225  } else if (tempattr == "lunit") {
3226  lunit = gdml->GetAttrValue(attr);
3227  } else if (tempattr == "aunit") {
3228  aunit = gdml->GetAttrValue(attr);
3229  } else if (tempattr == "startphi") {
3230  startphi = gdml->GetAttrValue(attr);
3231  } else if (tempattr == "deltaphi") {
3232  deltaphi = gdml->GetAttrValue(attr);
3233  } else if (tempattr == "starttheta") {
3234  starttheta = gdml->GetAttrValue(attr);
3235  } else if (tempattr == "deltatheta") {
3236  deltatheta = gdml->GetAttrValue(attr);
3237  }
3238 
3239  attr = gdml->GetNextAttr(attr);
3240  }
3241 
3242  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3243  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
3244  }
3245 
3246  Double_t retlunit = GetScaleVal(lunit);
3247  Double_t retaunit = GetScaleVal(aunit);
3248 
3249  Double_t rminline = Value(rmin)*retlunit;
3250  Double_t rmaxline = Value(rmax)*retlunit;
3251  Double_t startphiline = Value(startphi)*retaunit;
3252  Double_t deltaphiline = startphiline+ Value(deltaphi)*retaunit;
3253  Double_t startthetaline = Value(starttheta)*retaunit;
3254  Double_t deltathetaline = startthetaline + Value(deltatheta)*retaunit;
3255 
3256  TGeoSphere* sphere = new TGeoSphere(NameShort(name),
3257  rminline,
3258  rmaxline,
3259  startthetaline,
3260  deltathetaline,
3261  startphiline,
3262  deltaphiline);
3263 
3264  fsolmap[name.Data()] = sphere;
3265 
3266  return node;
3267 
3268 }
3269 
3270 ////////////////////////////////////////////////////////////////////////////////
3271 /// In the solids section of the GDML file, a Torus may be declared.
3272 /// when the torus keyword is found, this function is called, and the
3273 /// dimensions required are taken and stored, these are then bound and
3274 /// converted to type TGeoTorus and stored in fsolmap map using the name
3275 /// as its key.
3276 
3278 {
3279  TString lunit = "mm";
3280  TString aunit = "rad";
3281  TString rmin = "0";
3282  TString rmax = "0";
3283  TString rtor = "0";
3284  TString startphi = "0";
3285  TString deltaphi = "0";
3286  TString name = "";
3287  TString tempattr;
3288 
3289  while (attr != 0) {
3290 
3291  tempattr = gdml->GetAttrName(attr);
3292  tempattr.ToLower();
3293 
3294  if (tempattr == "name") {
3295  name = gdml->GetAttrValue(attr);
3296  } else if (tempattr == "rmin") {
3297  rmin = gdml->GetAttrValue(attr);
3298  } else if (tempattr == "rmax") {
3299  rmax = gdml->GetAttrValue(attr);
3300  } else if (tempattr == "rtor") {
3301  rtor = gdml->GetAttrValue(attr);
3302  } else if (tempattr == "lunit") {
3303  lunit = gdml->GetAttrValue(attr);
3304  } else if (tempattr == "aunit") {
3305  aunit = gdml->GetAttrValue(attr);
3306  } else if (tempattr == "startphi") {
3307  startphi = gdml->GetAttrValue(attr);
3308  } else if (tempattr == "deltaphi") {
3309  deltaphi = gdml->GetAttrValue(attr);
3310  }
3311 
3312  attr = gdml->GetNextAttr(attr);
3313  }
3314 
3315  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3316  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
3317  }
3318 
3319  Double_t retlunit = GetScaleVal(lunit);
3320  Double_t retaunit = GetScaleVal(aunit);
3321 
3322  Double_t rminline = Value(rmin)*retlunit;
3323  Double_t rmaxline = Value(rmax)*retlunit;
3324  Double_t rtorline = Value(rtor)*retlunit;
3325  Double_t startphiline = Value(startphi)*retaunit;
3326  Double_t deltaphiline = Value(deltaphi)*retaunit;
3327 
3328 
3329  TGeoTorus* torus = new TGeoTorus(NameShort(name), rtorline,
3330  rminline,
3331  rmaxline,
3332  startphiline,
3333  deltaphiline);
3334 
3335  fsolmap[name.Data()] = torus;
3336 
3337  return node;
3338 
3339 }
3340 
3341 ////////////////////////////////////////////////////////////////////////////////
3342 /// In the solids section of the GDML file, a Hype may be declared.
3343 /// when the hype keyword is found, this function is called, and the
3344 /// dimensions required are taken and stored, these are then bound and
3345 /// converted to type TGeoHype and stored in fsolmap map using the name
3346 /// as its key.
3347 
3349 {
3350  TString lunit = "mm";
3351  TString aunit = "rad";
3352  TString rmin = "0";
3353  TString rmax = "0";
3354  TString z = "0";
3355  TString inst = "0";
3356  TString outst = "0";
3357  TString name = "";
3358  TString tempattr;
3359 
3360  while (attr != 0) {
3361  tempattr = gdml->GetAttrName(attr);
3362  tempattr.ToLower();
3363 
3364  if (tempattr == "name") {
3365  name = gdml->GetAttrValue(attr);
3366  } else if (tempattr == "rmin") {
3367  rmin = gdml->GetAttrValue(attr);
3368  } else if (tempattr == "rmax") {
3369  rmax = gdml->GetAttrValue(attr);
3370  } else if (tempattr == "z") {
3371  z = gdml->GetAttrValue(attr);
3372  } else if (tempattr == "lunit") {
3373  lunit = gdml->GetAttrValue(attr);
3374  } else if (tempattr == "aunit") {
3375  aunit = gdml->GetAttrValue(attr);
3376  } else if (tempattr == "inst") {
3377  inst = gdml->GetAttrValue(attr);
3378  } else if (tempattr == "outst") {
3379  outst = gdml->GetAttrValue(attr);
3380  }
3381 
3382  attr = gdml->GetNextAttr(attr);
3383  }
3384 
3385  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3386  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
3387  }
3388 
3389  Double_t retlunit = GetScaleVal(lunit);
3390  Double_t retaunit = GetScaleVal(aunit);
3391 
3392  Double_t rminline = Value(rmin)*retlunit;
3393  Double_t rmaxline = Value(rmax)*retlunit;
3394  Double_t zline = Value(z)*retlunit;
3395  Double_t instline = Value(inst)*retaunit;
3396  Double_t outstline = Value(outst)*retaunit;
3397 
3398 
3399  TGeoHype* hype = new TGeoHype(NameShort(name),
3400  rminline,
3401  instline,
3402  rmaxline,
3403  outstline,
3404  zline / 2);
3405 
3406  fsolmap[name.Data()] = hype;
3407 
3408  return node;
3409 
3410 }
3411 
3412 ////////////////////////////////////////////////////////////////////////////////
3413 /// In the solids section of the GDML file, a Para may be declared.
3414 /// when the para keyword is found, this function is called, and the
3415 /// dimensions required are taken and stored, these are then bound and
3416 /// converted to type TGeoPara and stored in fsolmap map using the name
3417 /// as its key.
3418 
3420 {
3421  TString lunit = "mm";
3422  TString aunit = "rad";
3423  TString x = "0";
3424  TString y = "0";
3425  TString z = "0";
3426  TString phi = "0";
3427  TString theta = "0";
3428  TString alpha = "0";
3429  TString name = "";
3430  TString tempattr;
3431 
3432  while (attr != 0) {
3433 
3434  tempattr = gdml->GetAttrName(attr);
3435  tempattr.ToLower();
3436 
3437  if (tempattr == "name") {
3438  name = gdml->GetAttrValue(attr);
3439  } else if (tempattr == "x") {
3440  x = gdml->GetAttrValue(attr);
3441  } else if (tempattr == "y") {
3442  y = gdml->GetAttrValue(attr);
3443  } else if (tempattr == "z") {
3444  z = gdml->GetAttrValue(attr);
3445  } else if (tempattr == "lunit") {
3446  lunit = gdml->GetAttrValue(attr);
3447  } else if (tempattr == "aunit") {
3448  aunit = gdml->GetAttrValue(attr);
3449  } else if (tempattr == "phi") {
3450  phi = gdml->GetAttrValue(attr);
3451  } else if (tempattr == "theta") {
3452  theta = gdml->GetAttrValue(attr);
3453  } else if (tempattr == "alpha") {
3454  alpha = gdml->GetAttrValue(attr);
3455  }
3456 
3457  attr = gdml->GetNextAttr(attr);
3458  }
3459 
3460  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3461  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
3462  }
3463 
3464  Double_t retlunit = GetScaleVal(lunit);
3465  Double_t retaunit = GetScaleVal(aunit);
3466 
3467  Double_t xline = Value(x)*retlunit;
3468  Double_t yline = Value(y)*retlunit;
3469  Double_t zline = Value(z)*retlunit;
3470  Double_t philine = Value(phi)*retaunit;
3471  Double_t alphaline = Value(alpha)*retaunit;
3472  Double_t thetaline = Value(theta)*retaunit;
3473 
3474 
3475  TGeoPara* para = new TGeoPara(NameShort(name),
3476  xline / 2,
3477  yline / 2,
3478  zline / 2,
3479  alphaline,
3480  thetaline,
3481  philine);
3482 
3483  fsolmap[name.Data()] = para;
3484 
3485  return node;
3486 
3487 }
3488 
3489 ////////////////////////////////////////////////////////////////////////////////
3490 /// In the solids section of the GDML file, a TwistTrap may be declared.
3491 /// when the twistedtrap keyword is found, this function is called, and the
3492 /// dimensions required are taken and stored, these are then bound and
3493 /// converted to type TGeoGTra and stored in fsolmap map using the name
3494 /// as its key.
3495 
3497 {
3498  TString lunit = "mm";
3499  TString aunit = "rad";
3500  TString x1 = "0";
3501  TString x2 = "0";
3502  TString x3 = "0";
3503  TString x4 = "0";
3504  TString y1 = "0";
3505  TString y2 = "0";
3506  TString z = "0";
3507  TString phi = "0";
3508  TString theta = "0";
3509  TString alpha1 = "0";
3510  TString alpha2 = "0";
3511  TString twist = "0";
3512  TString name = "";
3513  TString tempattr;
3514 
3515  while (attr != 0) {
3516 
3517  tempattr = gdml->GetAttrName(attr);
3518  tempattr.ToLower();
3519 
3520  if (tempattr == "name") {
3521  name = gdml->GetAttrValue(attr);
3522  } else if (tempattr == "x1") {
3523  x1 = gdml->GetAttrValue(attr);
3524  } else if (tempattr == "x2") {
3525  x2 = gdml->GetAttrValue(attr);
3526  } else if (tempattr == "x3") {
3527  x3 = gdml->GetAttrValue(attr);
3528  } else if (tempattr == "x4") {
3529  x4 = gdml->GetAttrValue(attr);
3530  } else if (tempattr == "y1") {
3531  y1 = gdml->GetAttrValue(attr);
3532  } else if (tempattr == "y2") {
3533  y2 = gdml->GetAttrValue(attr);
3534  } else if (tempattr == "z") {
3535  z = gdml->GetAttrValue(attr);
3536  } else if (tempattr == "lunit") {
3537  lunit = gdml->GetAttrValue(attr);
3538  } else if (tempattr == "aunit") {
3539  aunit = gdml->GetAttrValue(attr);
3540  } else if (tempattr == "phi") {
3541  phi = gdml->GetAttrValue(attr);
3542  } else if (tempattr == "theta") {
3543  theta = gdml->GetAttrValue(attr);
3544  } else if (tempattr == "alph") { //gdml schema knows only alph attribute
3545  alpha1 = gdml->GetAttrValue(attr);
3546  alpha2 = alpha1;
3547  //} else if (tempattr == "alpha2") {
3548  // alpha2 = gdml->GetAttrValue(attr);
3549  } else if (tempattr == "phitwist") {
3550  twist = gdml->GetAttrValue(attr);
3551  }
3552 
3553  attr = gdml->GetNextAttr(attr);
3554  }
3555 
3556  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3557  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
3558  }
3559 
3560  Double_t retlunit = GetScaleVal(lunit);
3561  Double_t retaunit = GetScaleVal(aunit);
3562 
3563  Double_t x1line = Value(x1)*retlunit;
3564  Double_t x2line = Value(x2)*retlunit;
3565  Double_t x3line = Value(x3)*retlunit;
3566  Double_t x4line = Value(x4)*retlunit;
3567  Double_t y1line = Value(y1)*retlunit;
3568  Double_t y2line = Value(y2)*retlunit;
3569  Double_t zline = Value(z)*retlunit;
3570  Double_t philine = Value(phi)*retaunit;
3571  Double_t thetaline = Value(theta)*retaunit;
3572  Double_t alpha1line = Value(alpha1)*retaunit;
3573  Double_t alpha2line = Value(alpha2)*retaunit;
3574  Double_t twistline = Value(twist)*retaunit;
3575 
3576 
3577  TGeoGtra* twtrap = new TGeoGtra(NameShort(name), zline / 2,
3578  thetaline,
3579  philine,
3580  twistline,
3581  y1line / 2,
3582  x1line / 2,
3583  x2line / 2,
3584  alpha1line,
3585  y2line / 2,
3586  x3line / 2,
3587  x4line / 2,
3588  alpha2line);
3589 
3590  fsolmap[name.Data()] = twtrap;
3591 
3592  return node;
3593 
3594 }
3595 
3596 
3597 ////////////////////////////////////////////////////////////////////////////////
3598 /// In the solids section of the GDML file, a ElTube may be declared.
3599 /// when the eltube keyword is found, this function is called, and the
3600 /// dimensions required are taken and stored, these are then bound and
3601 /// converted to type TGeoEltu and stored in fsolmap map using the name
3602 /// as its key.
3603 
3605 {
3606  TString lunit = "mm";
3607  TString xpos = "0";
3608  TString ypos = "0";
3609  TString zpos = "0";
3610  TString name = "";
3611  TString tempattr;
3612 
3613  while (attr != 0) {
3614 
3615  tempattr = gdml->GetAttrName(attr);
3616  tempattr.ToLower();
3617 
3618  if (tempattr == "name") {
3619  name = gdml->GetAttrValue(attr);
3620  } else if (tempattr == "dx") {
3621  xpos = gdml->GetAttrValue(attr);
3622  } else if (tempattr == "dy") {
3623  ypos = gdml->GetAttrValue(attr);
3624  } else if (tempattr == "dz") {
3625  zpos = gdml->GetAttrValue(attr);
3626  } else if (tempattr == "lunit") {
3627  lunit = gdml->GetAttrValue(attr);
3628  }
3629 
3630  attr = gdml->GetNextAttr(attr);
3631  }
3632 
3633  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3634  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
3635  }
3636 
3637  Double_t retunit = GetScaleVal(lunit);
3638 
3639  Double_t xline = Value(xpos)*retunit;
3640  Double_t yline = Value(ypos)*retunit;
3641  Double_t zline = Value(zpos)*retunit;
3642 
3643  TGeoEltu* eltu = new TGeoEltu(NameShort(name), xline,
3644  yline,
3645  zline);
3646 
3647  fsolmap[name.Data()] = eltu;
3648 
3649  return node;
3650 
3651 }
3652 ////////////////////////////////////////////////////////////////////////////////
3653 /// In the solids section of the GDML file, an Orb may be declared.
3654 /// when the orb keyword is found, this function is called, and the
3655 /// dimensions required are taken and stored, these are then bound and
3656 /// converted to type TGeoSphere and stored in fsolmap map using the name
3657 /// as its key.
3658 
3660 {
3661  TString lunit = "mm";
3662  TString r = "0";
3663  TString name = "";
3664  TString tempattr;
3665 
3666  while (attr != 0) {
3667 
3668  tempattr = gdml->GetAttrName(attr);
3669  tempattr.ToLower();
3670 
3671  if (tempattr == "name") {
3672  name = gdml->GetAttrValue(attr);
3673  } else if (tempattr == "r") {
3674  r = gdml->GetAttrValue(attr);
3675  } else if (tempattr == "lunit") {
3676  lunit = gdml->GetAttrValue(attr);
3677  }
3678 
3679  attr = gdml->GetNextAttr(attr);
3680  }
3681 
3682  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3683  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
3684  }
3685 
3686  Double_t retunit = GetScaleVal(lunit);
3687 
3688  Double_t rline = Value(r)*retunit;
3689 
3690  TGeoSphere* orb = new TGeoSphere(NameShort(name), 0, rline, 0, 180, 0, 360);
3691 
3692  fsolmap[name.Data()] = orb;
3693 
3694  return node;
3695 
3696 }
3697 
3698 
3699 ////////////////////////////////////////////////////////////////////////////////
3700 /// In the solids section of the GDML file, an Xtru may be declared.
3701 /// when the xtru keyword is found, this function is called, and the
3702 /// dimensions required are taken and stored, these are then bound and
3703 /// converted to type TGeoXtru and stored in fsolmap map using the name
3704 /// as its key. The xtru has child nodes of either 'twoDimVertex'or
3705 /// 'section'. These two nodes define the real structure of the shape.
3706 /// The twoDimVertex's define the x,y sizes of a vertice. The section links
3707 /// the vertice to a position within the xtru.
3708 
3710 {
3711  TString lunit = "mm";
3712 // TString aunit = "rad";
3713  TString x = "0";
3714  TString y = "0";
3715  TString zorder = "0";
3716  TString zpos = "0";
3717  TString xoff = "0";
3718  TString yoff = "0";
3719  TString scale = "0";
3720  TString name = "";
3721  TString tempattr;
3722 
3723  while (attr != 0) {
3724 
3725  tempattr = gdml->GetAttrName(attr);
3726  tempattr.ToLower();
3727 
3728  if (tempattr == "name") {
3729  name = gdml->GetAttrValue(attr);
3730  } else if (tempattr == "lunit") {
3731  lunit = gdml->GetAttrValue(attr);
3732  }
3733 
3734  attr = gdml->GetNextAttr(attr);
3735  }
3736 
3737  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3738  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
3739  }
3740 
3741  Double_t retlunit = GetScaleVal(lunit);
3742 
3743  //START TO LOOK THRU CHILD NODES...
3744 
3745  XMLNodePointer_t child = gdml->GetChild(node);
3746  int nosects = 0;
3747  int noverts = 0;
3748 
3749  while (child != 0) {
3750  tempattr = gdml->GetNodeName(child);
3751 
3752  if (tempattr == "twoDimVertex") {
3753  noverts = noverts + 1;
3754  } else if (tempattr == "section") {
3755  nosects = nosects + 1;
3756  }
3757 
3758  child = gdml->GetNext(child);
3759  }
3760 
3761  //Build the dynamic arrays..
3762  int cols;
3763  int i;
3764  double *vertx = new double[noverts];
3765  double *verty = new double[noverts];
3766  cols = 5;
3767  double ** section = new double*[nosects];
3768  for (i = 0; i < nosects; i++) {
3769  section[i] = new double[cols];
3770  }
3771 
3772  child = gdml->GetChild(node);
3773  int sect = 0;
3774  int vert = 0;
3775 
3776  while (child != 0) {
3777  if (strcmp(gdml->GetNodeName(child), "twoDimVertex") == 0) {
3778  Double_t xline = 0;
3779  Double_t yline = 0;
3780 
3781  attr = gdml->GetFirstAttr(child);
3782 
3783  while (attr != 0) {
3784  tempattr = gdml->GetAttrName(attr);
3785 
3786  if (tempattr == "x") {
3787  x = gdml->GetAttrValue(attr);
3788  xline = Value(x)*retlunit;
3789  vertx[vert] = xline;
3790  } else if (tempattr == "y") {
3791  y = gdml->GetAttrValue(attr);
3792  yline = Value(y)*retlunit;
3793  verty[vert] = yline;
3794  }
3795 
3796  attr = gdml->GetNextAttr(attr);
3797  }
3798 
3799  vert = vert + 1;
3800  }
3801 
3802  else if (strcmp(gdml->GetNodeName(child), "section") == 0) {
3803 
3804  Double_t zposline = 0;
3805  Double_t xoffline = 0;
3806  Double_t yoffline = 0;
3807 
3808  attr = gdml->GetFirstAttr(child);
3809 
3810  while (attr != 0) {
3811  tempattr = gdml->GetAttrName(attr);
3812 
3813  if (tempattr == "zOrder") {
3814  zorder = gdml->GetAttrValue(attr);
3815  section[sect][0] = Value(zorder);
3816  } else if (tempattr == "zPosition") {
3817  zpos = gdml->GetAttrValue(attr);
3818  zposline = Value(zpos)*retlunit;
3819  section[sect][1] = zposline;
3820  } else if (tempattr == "xOffset") {
3821  xoff = gdml->GetAttrValue(attr);
3822  xoffline = Value(xoff)*retlunit;
3823  section[sect][2] = xoffline;
3824  } else if (tempattr == "yOffset") {
3825  yoff = gdml->GetAttrValue(attr);
3826  yoffline = Value(yoff)*retlunit;
3827  section[sect][3] = yoffline;
3828  } else if (tempattr == "scalingFactor") {
3829  scale = gdml->GetAttrValue(attr);
3830  section[sect][4] = Value(scale);
3831  }
3832 
3833  attr = gdml->GetNextAttr(attr);
3834  }
3835 
3836  sect = sect + 1;
3837  }
3838  child = gdml->GetNext(child);
3839  }
3840 
3841  TGeoXtru* xtru = new TGeoXtru(nosects);
3842  xtru->SetName(NameShort(name));
3843  xtru->DefinePolygon(vert, vertx, verty);
3844 
3845  for (int j = 0; j < sect; j++) {
3846  xtru->DefineSection((int)section[j][0], section[j][1], section[j][2], section[j][3], section[j][4]);
3847  }
3848 
3849  fsolmap[name.Data()] = xtru;
3850  delete [] vertx;
3851  delete [] verty;
3852  for (i = 0; i < nosects; i++) {
3853  delete [] section[i];
3854  }
3855  delete [] section;
3856  return node;
3857 }
3858 
3859 ////////////////////////////////////////////////////////////////////////////////
3860 /// In the solids section of the GDML file, a Reflected Solid may be
3861 /// declared when the ReflectedSolid keyword is found, this function
3862 /// is called. The rotation, position and scale for the reflection are
3863 /// applied to a matrix that is then stored in the class object
3864 /// TGDMLRefl. This is then stored in the map freflsolidmap, with
3865 /// the reflection name as a reference. also the name of the solid to
3866 /// be reflected is stored in a map called freflectmap with the reflection
3867 /// name as a reference.
3868 
3870 {
3871  std::cout << "WARNING! The reflectedSolid is obsolete! Use scale transformation instead!" << std::endl;
3872 
3873  TString sx = "0";
3874  TString sy = "0";
3875  TString sz = "0";
3876  TString rx = "0";
3877  TString ry = "0";
3878  TString rz = "0";
3879  TString dx = "0";
3880  TString dy = "0";
3881  TString dz = "0";
3882  TString name = "0";
3883  TString solid = "0";
3884  TString tempattr;
3885 
3886  while (attr != 0) {
3887 
3888  tempattr = gdml->GetAttrName(attr);
3889  tempattr.ToLower();
3890 
3891  if (tempattr == "name") {
3892  name = gdml->GetAttrValue(attr);
3893  } else if (tempattr == "sx") {
3894  sx = gdml->GetAttrValue(attr);
3895  } else if (tempattr == "sy") {
3896  sy = gdml->GetAttrValue(attr);
3897  } else if (tempattr == "sz") {
3898  sz = gdml->GetAttrValue(attr);
3899  } else if (tempattr == "rx") {
3900  rx = gdml->GetAttrValue(attr);
3901  } else if (tempattr == "ry") {
3902  ry = gdml->GetAttrValue(attr);
3903  } else if (tempattr == "rz") {
3904  rz = gdml->GetAttrValue(attr);
3905  } else if (tempattr == "dx") {
3906  dx = gdml->GetAttrValue(attr);
3907  } else if (tempattr == "dy") {
3908  dy = gdml->GetAttrValue(attr);
3909  } else if (tempattr == "dz") {
3910  dz = gdml->GetAttrValue(attr);
3911  } else if (tempattr == "solid") {
3912  solid = gdml->GetAttrValue(attr);
3913  }
3914  attr = gdml->GetNextAttr(attr);
3915  }
3916 
3917  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3918  name = TString::Format("%s_%s", name.Data(), fCurrentFile);
3919  }
3920  if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3921  solid = TString::Format("%s_%s", solid.Data(), fCurrentFile);
3922  }
3923 
3924  TGeoRotation* rot = new TGeoRotation();
3925  rot->RotateZ(-(Value(rz)));
3926  rot->RotateY(-(Value(ry)));
3927  rot->RotateX(-(Value(rx)));
3928 
3929  if (atoi(sx) == -1) {
3930  rot->ReflectX(kTRUE);
3931  }
3932  if (atoi(sy) == -1) {
3933  rot->ReflectY(kTRUE);
3934  }
3935  if (atoi(sz) == -1) {
3936  rot->ReflectZ(kTRUE);
3937  }
3938 
3939  TGeoCombiTrans* relf_matx = new TGeoCombiTrans(Value(dx), Value(dy), Value(dz), rot);
3940 
3941  TGDMLRefl* reflsol = new TGDMLRefl(NameShort(name), solid, relf_matx);
3942  freflsolidmap[name.Data()] = reflsol;
3943  freflectmap[name.Data()] = solid;
3944 
3945  return node;
3946 }
3947 
3948 /** \class TGDMLRefl
3949 \ingroup Geometry_gdml
3950 
3951 This class is a helper class for TGDMLParse. It assists in the
3952 reflection process. This process takes a previously defined solid
3953 and can reflect the matrix of it. This class stores the name of the
3954 reflected solid, along with the name of the solid that is being
3955 reflected, and finally the reflected solid's matrix. This is then
3956 recalled when the volume is used in the structure part of the gdml
3957 file.
3958 
3959 */
3960 
3962 
3963 ////////////////////////////////////////////////////////////////////////////////
3964 /// This constructor method stores the values brought in as params.
3965 
3966 TGDMLRefl::TGDMLRefl(const char* name, const char* solid, TGeoMatrix* matrix)
3967 {
3968  fNameS = name;
3969  fSolid = solid;
3970  fMatrix = matrix;
3971 }
3972 
3973 ////////////////////////////////////////////////////////////////////////////////
3974 /// This accessor method returns the matrix.
3975 
3977 {
3978  return fMatrix;
3979 }
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
XMLNodePointer_t UsrProcess(TXMLEngine *gdml, XMLNodePointer_t node)
User data to be processed.
XMLNodePointer_t ConProcess(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the define section of the GDML file, constants can be declared.
Definition: TGDMLParse.cxx:401
Mixtures of elements.
Definition: TGeoMaterial.h:134
Spherical shell class.
Definition: TGeoSphere.h:17
Cylindrical tube class.
Definition: TGeoTube.h:17
XMLNodePointer_t TwistTrap(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, a TwistTrap may be declared.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:854
Double_t Eval(Double_t x) const
Sets first variable (e.g. x) and evaluate formula.
Definition: TFormula.cxx:3170
The manager class for any TGeo geometry.
Definition: TGeoManager.h:38
RotMap frotmap
Map containing position names and the TGeoTranslation for it.
Definition: TGDMLParse.h:202
Box class.
Definition: TGeoBBox.h:17
Volume assemblies.
Definition: TGeoVolume.h:307
XMLNodePointer_t Trd(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, a Trd may be declared.
Table of elements.
Definition: TGeoElement.h:369
MatMap fmatmap
Map containing element names and the TGeoElement for it.
Definition: TGDMLParse.h:206
TGeoVolume * fWorld
Definition: TGDMLParse.h:100
Collectable string class.
Definition: TObjString.h:28
void MultiplyLeft(const TGeoMatrix *left)
multiply to the left with an other transformation if right is identity matrix, just return ...
Gtra is a twisted trapezoid.
Definition: TGeoArb8.h:143
Geometrical transformation package.
Definition: TGeoMatrix.h:40
XMLNodePointer_t Paraboloid(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, a Paraboloid may be declared.
image html pict1_TGaxis_012 png width
Define new text attributes for the label number "labNum".
Definition: TGaxis.cxx:2551
Int_t Z() const
Definition: TGeoElement.h:73
XMLNodePointer_t Xtru(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, an Xtru may be declared.
A polycone.
Definition: TGeoPcon.h:17
virtual const Double_t * GetRotationMatrix() const =0
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
A polygone.
Definition: TGeoPgon.h:19
XMLNodePointer_t Reflection(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, a Reflected Solid may be declared when the ReflectedSolid key...
EleMap felemap
Map containing isotope names and the TGeoIsotope for it.
Definition: TGDMLParse.h:205
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:48
TGeoElementTable * GetElementTable()
Returns material table. Creates it if not existing.
virtual void RotateX(Double_t angle)
Rotate about X axis of the master frame with angle expressed in degrees.
XMLNodePointer_t Cone(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, a cone may be declared.
void SetTranslation(const Double_t *vect)
Definition: TGeoMatrix.h:462
void Add(TObject *obj)
This function may not be used (but we need to provide it since it is a pure virtual in TCollection)...
Definition: TMap.cxx:53
Torus segment class.
Definition: TGeoTorus.h:17
Class describing translations.
Definition: TGeoMatrix.h:121
virtual void DefineSection(Int_t snum, Double_t z, Double_t x0=0., Double_t y0=0., Double_t scale=1.)
defines z position of a section plane, rmin and rmax at this z.
Definition: TGeoXtru.cxx:731
Int_t AddRegion(TGeoRegion *region)
Add a new region of volumes.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:634
Int_t GetId() const
Definition: TGeoMedium.h:48
TString GetScale(const char *unit)
Throughout the GDML file, a unit can de specified.
Definition: TGDMLParse.cxx:434
XMLNodePointer_t GetNext(XMLNodePointer_t xmlnode, Bool_t realnode=kTRUE)
return next to xmlnode node if realnode==kTRUE, any special nodes in between will be skipped ...
Basic string class.
Definition: TString.h:131
Matrix class used for computing global transformations Should NOT be used for node definition...
Definition: TGeoMatrix.h:420
Base class describing materials.
Definition: TGeoMaterial.h:29
void Multiply(const TGeoMatrix *right)
multiply to the right with an other transformation if right is identity matrix, just return ...
XMLNodePointer_t IsoProcess(TXMLEngine *gdml, XMLNodePointer_t node, XMLNodePointer_t parentn)
In the material section of the GDML file, an isotope may be declared.
Definition: TGDMLParse.cxx:748
#define f(i)
Definition: RSha256.hxx:104
XMLNodePointer_t Polycone(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, a Polycone may be declared.
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1100
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void SetSkipComments(Bool_t on=kTRUE)
Definition: TXMLEngine.h:48
void ReplayCreation(const TGeoVolume *other)
Recreate the content of the other volume without pointer copying.
TGeoIsotope * FindIsotope(const char *name) const
Find existing isotope by name. Not optimized for a big number of isotopes.
A shape scaled by a TGeoScale transformation.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition: fillpatterns.C:1
virtual const Double_t * GetScale() const
Definition: TGeoMatrix.h:279
XMLAttrPointer_t GetNextAttr(XMLAttrPointer_t xmlattr)
return next attribute in the list
Definition: TXMLEngine.cxx:673
TGeoHMatrix Inverse() const
Return a temporary inverse of this.
Definition: TGeoMatrix.cxx:976
void FreeDoc(XMLDocPointer_t xmldoc)
frees allocated document data and deletes document itself
Paraboloid class.
double GetScaleVal(const char *unit)
Throughout the GDML file, a unit can de specified.
Definition: TGDMLParse.cxx:480
TList * GetListOfMaterials() const
Definition: TGeoManager.h:466
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
Definition: TList.cxx:574
TObjArray * GetNodes()
Definition: TGeoVolume.h:170
ReflectionsMap freflectmap
Map containing volume names and the TGeoVolume for it.
Definition: TGDMLParse.h:211
Int_t GetNdaughters() const
Definition: TGeoVolume.h:350
TGeoMaterial * GetMaterial(const char *matname) const
Search for a named material. All trailing blanks stripped.
TList * GetListOfMedia() const
Definition: TGeoManager.h:467
const char * fCurrentFile
Definition: TGDMLParse.h:105
XMLNodePointer_t SclProcess(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the define section of the GDML file, rotations can be declared.
Definition: TGDMLParse.cxx:704
This class contains the implementation of the GDML parser associated to all the supported GDML elemen...
Definition: TGDMLParse.h:96
TObject * Last() const
Return the object in the last filled slot. Returns 0 if no entries.
Definition: TObjArray.cxx:505
static const double x2[5]
XMLNodePointer_t BooSolid(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr, int num)
In the solid section of the GDML file, boolean solids can be declared.
Double_t x[n]
Definition: legend1.C:17
double Evaluate(const char *evalline)
Takes a string containing a mathematical expression and returns the value of the expression.
Definition: TGDMLParse.cxx:351
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
Definition: TString.cxx:2286
A phi segment of a conical tube.
Definition: TGeoCone.h:98
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
void * XMLDocPointer_t
Definition: TXMLEngine.h:20
TGeoMatrix * GetMatrix()
This accessor method returns the matrix.
TCanvas * fractions()
Definition: fractions.C:1
TGeoVolume * GDMLReadFile(const char *filename="test.gdml")
Creates the new instance of the XMLEngine called &#39;gdml&#39;, using the filename >> then parses the file a...
Definition: TGDMLParse.cxx:124
void AddIsotope(TGeoIsotope *isotope, Double_t relativeAbundance)
Add an isotope for this element. All isotopes have to be isotopes of the same element.
Base class for chemical elements.
Definition: TGeoElement.h:36
static const double x4[22]
XMLNodePointer_t Arb8(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, an Arb8 may be declared.
TGeoMedium * GetMedium() const
Definition: TGeoVolume.h:176
double Value(const char *svalue) const
Convert number in string format to double value.
Definition: TGDMLParse.cxx:520
virtual void SetVertex(Int_t vnum, Double_t x, Double_t y)
Set values for a given vertex.
Definition: TGeoArb8.cxx:1248
TRAP is a general trapezoid, i.e.
Definition: TGeoArb8.h:89
virtual void RotateY(Double_t angle)
Rotate about Y axis of the master frame with angle expressed in degrees.
FileMap ffilemap
Map containing reflected volume names and the solid ref for it.
Definition: TGDMLParse.h:214
constexpr Double_t Pi()
Definition: TMath.h:38
ConstMap fconsts
Map containing files parsed during entire parsing, with their world volume name.
Definition: TGDMLParse.h:215
virtual const Double_t * GetTranslation() const
Definition: TGeoMatrix.h:160
static constexpr double second
virtual TGeoVolume * Divide(const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step, Int_t numed=0, Option_t *option="")
Division a la G3.
auto * lv
Definition: textalign.C:5
This class is a helper class for TGDMLParse.
Definition: TGDMLParse.h:31
const char * GetNodeName(XMLNodePointer_t xmlnode)
returns name of xmlnode
XMLNodePointer_t CutTube(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, a Cut Tube may be declared.
virtual void AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=0, Option_t *option="")
Add a TGeoNode to the list of nodes.
Definition: TGeoVolume.cxx:984
XMLNodePointer_t Sphere(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, a Sphere may be declared.
virtual const Double_t * GetRotationMatrix() const
Definition: TGeoMatrix.h:230
XMLNodePointer_t Orb(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, an Orb may be declared.
Class handling Boolean composition of shapes.
void AddElement(Double_t a, Double_t z, Double_t weight)
add an element to the mixture using fraction by weight Check if the element is already defined ...
A trapezoid with both x and y lengths varying with z.
Definition: TGeoTrd2.h:17
XMLNodePointer_t PosProcess(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the define section of the GDML file, positions can be declared.
Definition: TGDMLParse.cxx:593
Parallelepiped class.
Definition: TGeoPara.h:17
XMLNodePointer_t Torus(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, a Torus may be declared.
int isnan(double)
XMLNodePointer_t Box(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, a box may be declared.
XMLNodePointer_t Ellipsoid(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, an ellipsoid may be declared.
Base abstract class for all shapes.
Definition: TGeoShape.h:25
void ShiftToNext(XMLNodePointer_t &xmlnode, Bool_t realnode=kTRUE)
shifts specified node to next if realnode==kTRUE, any special nodes in between will be skipped ...
ROOT::R::TRInterface & r
Definition: Object.C:4
std::map< std::string, double > FracMap
Definition: TGDMLParse.h:198
Class describing rotation + translation.
Definition: TGeoMatrix.h:291
XMLNodePointer_t Para(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, a Para may be declared.
XMLNodePointer_t Trap(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, a Trap may be declared.
auto * a
Definition: textangle.C:12
const char * fStartFile
Definition: TGDMLParse.h:104
The Formula class.
Definition: TFormula.h:83
Regions are groups of volumes having a common set of user tracking cuts.
Definition: TGeoRegion.h:36
Hyperboloid class defined by 5 parameters.
Definition: TGeoHype.h:17
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
const char * GetAttrValue(XMLAttrPointer_t xmlattr)
return value of attribute
Definition: TXMLEngine.cxx:695
TGeoElement * FindElement(const char *name) const
Search an element by symbol or full name Exact matching.
XMLNodePointer_t RotProcess(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the define section of the GDML file, rotations can be declared.
Definition: TGDMLParse.cxx:646
XMLAttrPointer_t GetFirstAttr(XMLNodePointer_t xmlnode)
return first attribute in the list, namespace (if exists) will be skipped
Definition: TXMLEngine.cxx:657
TXMLEngine * fFileEngine[20]
Definition: TGDMLParse.h:103
XMLNodePointer_t Hype(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, a Hype may be declared.
void * XMLNodePointer_t
Definition: TXMLEngine.h:17
IsoMap fisomap
Map containing scale names and the TGeoScale for it.
Definition: TGDMLParse.h:204
constexpr Double_t Na()
Avogadro constant (Avogadro&#39;s Number) in .
Definition: TMath.h:283
virtual void AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=0, Option_t *option="")
Add a component to the assembly.
void SetUserExtension(TGeoExtension *ext)
Connect user-defined extension to the volume.
virtual void RotateZ(Double_t angle)
Rotate about Z axis of the master frame with angle expressed in degrees.
XMLNodePointer_t TopProcess(TXMLEngine *gdml, XMLNodePointer_t node)
In the setup section of the GDML file, the top volume need to be declared.
Class describing rotations.
Definition: TGeoMatrix.h:174
const Bool_t kFALSE
Definition: RtypesCore.h:88
Bool_t HasAttr(XMLNodePointer_t xmlnode, const char *name)
checks if node has attribute of specified name
Definition: TXMLEngine.cxx:531
TGeoMedium * GetMedium(const char *medium) const
Search for a named tracking medium. All trailing blanks stripped.
A tube segment cut with 2 planes.
Definition: TGeoTube.h:168
#define d(i)
Definition: RSha256.hxx:102
XMLDocPointer_t ParseFile(const char *filename, Int_t maxbuf=100000)
Parses content of file and tries to produce xml structures.
An extrusion with fixed outline shape in x-y and a sequence of z extents (segments).
Definition: TGeoXtru.h:21
void * XMLAttrPointer_t
Definition: TXMLEngine.h:19
Class describing scale transformations.
Definition: TGeoMatrix.h:244
static const double x1[5]
XMLNodePointer_t Polyhedra(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, a Polyhedra may be declared.
#define ClassImp(name)
Definition: Rtypes.h:359
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:562
virtual Bool_t IsMixture() const
Definition: TGeoMaterial.h:108
double Double_t
Definition: RtypesCore.h:55
const char * GetAttr(XMLNodePointer_t xmlnode, const char *name)
returns value of attribute for xmlnode
Definition: TXMLEngine.cxx:547
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:40
Conical tube class.
Definition: TGeoCone.h:17
MixMap fmixmap
Map containing medium names and the TGeoMedium for it.
Definition: TGDMLParse.h:208
Double_t y[n]
Definition: legend1.C:17
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:619
void AddVolume(TGeoVolume *vol)
Definition: TGeoRegion.h:49
Reference counted extension which has a pointer to and owns a user defined TObject.
Definition: TGeoExtension.h:36
Int_t SetAxis(const char *axisString)
When using the &#39;divide&#39; process in the geometry this function sets the variable &#39;axis&#39; depending on w...
Definition: TGDMLParse.cxx:361
An arbitrary trapezoid with less than 8 vertices standing on two parallel planes perpendicular to Z a...
Definition: TGeoArb8.h:17
Media are used to store properties related to tracking and which are useful only when using geometry ...
Definition: TGeoMedium.h:23
Bool_t IsNull() const
Definition: TString.h:402
const char * NameShort(const char *name)
This function looks thru a string for the chars &#39;0x&#39; next to each other, when it finds this...
Definition: TGDMLParse.cxx:386
void SetMatrix(const Double_t *rot)
Definition: TGeoMatrix.h:225
MedMap fmedmap
Map containing material names and the TGeoMaterial for it.
Definition: TGDMLParse.h:207
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
constexpr Double_t RadToDeg()
Conversion from radian to degree: .
Definition: TMath.h:74
SclMap fsclmap
Map containing rotation names and the TGeoRotation for it.
Definition: TGDMLParse.h:203
SolMap fsolmap
Map containing mixture names and the TGeoMixture for it.
Definition: TGDMLParse.h:209
const char * ParseGDML(TXMLEngine *gdml, XMLNodePointer_t node)
This function recursively moves thru the DOM tree of the GDML file.
Definition: TGDMLParse.cxx:161
ReflVolMap freflvolmap
Map containing reflection names and the TGDMLRefl for it - containing refl matrix.
Definition: TGDMLParse.h:213
VolMap fvolmap
Map containing solid names and the TGeoShape for it.
Definition: TGDMLParse.h:210
XMLNodePointer_t GetChild(XMLNodePointer_t xmlnode, Bool_t realnode=kTRUE)
returns first child of xmlnode
Base class for Boolean operations between two shapes.
Definition: TGeoBoolNode.h:24
Elliptical tube class.
Definition: TGeoEltu.h:17
XMLNodePointer_t GetParent(XMLNodePointer_t xmlnode)
returns parent of xmlnode
void SetRotation(const Double_t *matrix)
Definition: TGeoMatrix.h:463
XMLNodePointer_t DocGetRootElement(XMLDocPointer_t xmldoc)
returns root node of document
XMLNodePointer_t ElTube(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, a ElTube may be declared.
virtual void DefineSection(Int_t snum, Double_t z, Double_t rmin, Double_t rmax)
Defines z position of a section plane, rmin and rmax at this z.
Definition: TGeoPcon.cxx:618
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const =0
R__EXTERN Int_t gDebug
Definition: Rtypes.h:86
ReflSolidMap freflsolidmap
Map containing reflection names and the Solid name ir references to.
Definition: TGDMLParse.h:212
Definition: first.py:1
XMLNodePointer_t MatProcess(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr, int z)
In the materials section of the GDML file, materials can be declared.
XMLNodePointer_t EleProcess(TXMLEngine *gdml, XMLNodePointer_t node, XMLNodePointer_t parentn, Bool_t hasIsotopes, Bool_t hasIsotopesExtended)
When the element keyword is found, this function is called, and the name and values of the element ar...
Definition: TGDMLParse.cxx:820
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition: TObject.cxx:908
TGeoShape * GetShape() const
Definition: TGeoVolume.h:191
XMLNodePointer_t Tube(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, a Tube may be declared.
void AddCut(const char *name, Double_t cut)
Add cut to the region.
Definition: TGeoRegion.cxx:75
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
XMLNodePointer_t AssProcess(TXMLEngine *gdml, XMLNodePointer_t node)
In the structure section of the GDML file, assembly volumes can be declared.
XMLNodePointer_t VolProcess(TXMLEngine *gdml, XMLNodePointer_t node)
In the structure section of the GDML file, volumes can be declared.
const char * GetAttrName(XMLAttrPointer_t xmlattr)
return name of the attribute
Definition: TXMLEngine.cxx:684
const Bool_t kTRUE
Definition: RtypesCore.h:87
const Int_t n
Definition: legend1.C:16
TString fWorldName
Definition: TGDMLParse.h:99
gr SetName("gr")
char name[80]
Definition: TGX11.cxx:109
XMLNodePointer_t ElCone(TXMLEngine *gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
In the solids section of the GDML file, an elliptical cone may be declared.
Bool_t DefinePolygon(Int_t nvert, const Double_t *xv, const Double_t *yv)
Creates the polygon representing the blueprint of any Xtru section.
Definition: TGeoXtru.cxx:698
PosMap fposmap
Definition: TGDMLParse.h:201
static const double x3[11]
const char * Data() const
Definition: TString.h:364
A phi segment of a tube.
Definition: TGeoTube.h:88