123 ClassImp(TGDMLParse);
128 TGDMLParse::TGDMLParse()
134 for (Int_t i=0; i<20; i++) fFileEngine[i] = 0;
137 auto def_units = TGeoManager::GetDefaultUnits();
139 case TGeoManager::kG4Units:
140 fDefault_lunit =
"mm";
141 fDefault_aunit =
"rad";
143 case TGeoManager::kRootUnits:
144 fDefault_lunit =
"cm";
145 fDefault_aunit =
"deg";
148 fDefault_lunit =
"mm";
149 fDefault_aunit =
"rad";
158 TGeoVolume* TGDMLParse::GDMLReadFile(
const char* filename)
161 TXMLEngine* gdml =
new TXMLEngine;
162 gdml->SetSkipComments(kTRUE);
165 XMLDocPointer_t gdmldoc = gdml->ParseFile(filename);
172 XMLNodePointer_t mainnode = gdml->DocGetRootElement(gdmldoc);
174 fFileEngine[fFILENO] = gdml;
175 fStartFile = filename;
176 fCurrentFile = filename;
179 ParseGDML(gdml, mainnode);
182 gdml->FreeDoc(gdmldoc);
195 const char* TGDMLParse::ParseGDML(TXMLEngine* gdml, XMLNodePointer_t node)
198 XMLAttrPointer_t attr = gdml->GetFirstAttr(node);
199 const char* name = gdml->GetNodeName(node);
200 XMLNodePointer_t parentn = gdml->GetParent(node);
201 const char* parent = gdml->GetNodeName(parentn);
202 XMLNodePointer_t childtmp = 0;
204 const char* posistr =
"position";
205 const char* setustr =
"setup";
206 const char* consstr =
"constant";
207 const char* varistr =
"variable";
208 const char* quanstr =
"quantity";
209 const char* matrstr =
"matrix";
210 const char* rotastr =
"rotation";
211 const char* scalstr =
"scale";
212 const char* elemstr =
"element";
213 const char* istpstr =
"isotope";
214 const char* matestr =
"material";
215 const char* volustr =
"volume";
216 const char* assestr =
"assembly";
217 const char* twtrstr =
"twistedtrap";
218 const char* cutTstr =
"cutTube";
219 const char* bboxstr =
"box";
220 const char* xtrustr =
"xtru";
221 const char* arb8str =
"arb8";
222 const char* tubestr =
"tube";
223 const char* conestr =
"cone";
224 const char* polystr =
"polycone";
225 const char* hypestr =
"hype";
226 const char* trapstr =
"trap";
227 const char* trdstr =
"trd";
228 const char* sphestr =
"sphere";
229 const char* orbstr =
"orb";
230 const char* parastr =
"para";
231 const char* torustr =
"torus";
232 const char* hedrstr =
"polyhedra";
233 const char* eltustr =
"eltube";
234 const char* subtstr =
"subtraction";
235 const char* uniostr =
"union";
236 const char* parbstr =
"paraboloid";
237 const char* intestr =
"intersection";
238 const char* reflstr =
"reflectedSolid";
239 const char* ellistr =
"ellipsoid";
240 const char* elcnstr =
"elcone";
241 const char* optsstr =
"opticalsurface";
242 const char* skinstr =
"skinsurface";
243 const char* bordstr =
"bordersurface";
244 const char* usrstr =
"userinfo";
246 Bool_t hasIsotopesExtended;
248 if ((strcmp(name, posistr)) == 0) {
249 node = PosProcess(gdml, node, attr);
250 }
else if ((strcmp(name, rotastr)) == 0) {
251 node = RotProcess(gdml, node, attr);
252 }
else if ((strcmp(name, scalstr)) == 0) {
253 node = SclProcess(gdml, node, attr);
254 }
else if ((strcmp(name, setustr)) == 0) {
255 node = TopProcess(gdml, node);
256 }
else if ((strcmp(name, consstr)) == 0) {
257 node = ConProcess(gdml, node, attr);
258 }
else if ((strcmp(name, varistr)) == 0) {
259 node = ConProcess(gdml, node, attr);
260 }
else if ((strcmp(name, quanstr)) == 0) {
261 node = QuantityProcess(gdml, node, attr);
262 }
else if ((strcmp(name, matrstr)) == 0) {
263 node = MatrixProcess(gdml, node, attr);
264 }
else if ((strcmp(name, optsstr)) == 0) {
265 node = OpticalSurfaceProcess(gdml, node, attr);
266 }
else if ((strcmp(name, skinstr)) == 0) {
267 node = SkinSurfaceProcess(gdml, node, attr);
268 }
else if ((strcmp(name, bordstr)) == 0) {
269 node = BorderSurfaceProcess(gdml, node, attr);
273 else if (((strcmp(name,
"atom")) == 0) && ((strcmp(parent, elemstr)) == 0)) {
274 hasIsotopes = kFALSE;
275 hasIsotopesExtended = kFALSE;
276 node = EleProcess(gdml, node, parentn, hasIsotopes, hasIsotopesExtended);
278 else if ((strcmp(name, elemstr) == 0) && !gdml->HasAttr(node,
"Z")) {
280 hasIsotopesExtended = kFALSE;
281 node = EleProcess(gdml, node, parentn, hasIsotopes, hasIsotopesExtended);
284 else if ((strcmp(name, elemstr) == 0) && gdml->HasAttr(node,
"Z")) {
285 childtmp = gdml->GetChild(node);
286 if ((strcmp(gdml->GetNodeName(childtmp),
"fraction") == 0) ){
287 hasIsotopes = kFALSE;
288 hasIsotopesExtended = kTRUE;
289 node = EleProcess(gdml, node, parentn, hasIsotopes, hasIsotopesExtended);}
294 else if (((strcmp(name,
"atom")) == 0) && ((strcmp(parent, istpstr)) == 0)) {
295 node = IsoProcess(gdml, node, parentn);
299 else if ((strcmp(name, matestr)) == 0 && gdml->HasAttr(node,
"Z")) {
300 childtmp = gdml->GetChild(node);
303 Bool_t atom = kFALSE;
306 atom = strcmp(gdml->GetNodeName(childtmp),
"atom")==0;
307 gdml->ShiftToNext(childtmp);
309 int z = (atom) ? 1 : 0;
310 node = MatProcess(gdml, node, attr, z);
312 else if ((strcmp(name, matestr)) == 0 && !gdml->HasAttr(node,
"Z")) {
314 node = MatProcess(gdml, node, attr, z);
318 else if ((strcmp(name, volustr)) == 0) {
319 node = VolProcess(gdml, node);
320 }
else if ((strcmp(name, bboxstr)) == 0) {
321 node = Box(gdml, node, attr);
322 }
else if ((strcmp(name, ellistr)) == 0) {
323 node = Ellipsoid(gdml, node, attr);
324 }
else if ((strcmp(name, elcnstr)) == 0) {
325 node = ElCone(gdml, node, attr);
326 }
else if ((strcmp(name, cutTstr)) == 0) {
327 node = CutTube(gdml, node, attr);
328 }
else if ((strcmp(name, arb8str)) == 0) {
329 node = Arb8(gdml, node, attr);
330 }
else if ((strcmp(name, tubestr)) == 0) {
331 node = Tube(gdml, node, attr);
332 }
else if ((strcmp(name, conestr)) == 0) {
333 node = Cone(gdml, node, attr);
334 }
else if ((strcmp(name, polystr)) == 0) {
335 node = Polycone(gdml, node, attr);
336 }
else if ((strcmp(name, trapstr)) == 0) {
337 node = Trap(gdml, node, attr);
338 }
else if ((strcmp(name, trdstr)) == 0) {
339 node = Trd(gdml, node, attr);
340 }
else if ((strcmp(name, sphestr)) == 0) {
341 node = Sphere(gdml, node, attr);
342 }
else if ((strcmp(name, xtrustr)) == 0) {
343 node = Xtru(gdml, node, attr);
344 }
else if ((strcmp(name, twtrstr)) == 0) {
345 node = TwistTrap(gdml, node, attr);
346 }
else if ((strcmp(name, hypestr)) == 0) {
347 node = Hype(gdml, node, attr);
348 }
else if ((strcmp(name, orbstr)) == 0) {
349 node = Orb(gdml, node, attr);
350 }
else if ((strcmp(name, parastr)) == 0) {
351 node = Para(gdml, node, attr);
352 }
else if ((strcmp(name, torustr)) == 0) {
353 node = Torus(gdml, node, attr);
354 }
else if ((strcmp(name, eltustr)) == 0) {
355 node = ElTube(gdml, node, attr);
356 }
else if ((strcmp(name, hedrstr)) == 0) {
357 node = Polyhedra(gdml, node, attr);
358 }
else if ((strcmp(name, parbstr)) == 0) {
359 node = Paraboloid(gdml, node, attr);
360 }
else if ((strcmp(name, subtstr)) == 0) {
361 node = BooSolid(gdml, node, attr, 1);
362 }
else if ((strcmp(name, intestr)) == 0) {
363 node = BooSolid(gdml, node, attr, 2);
364 }
else if ((strcmp(name, uniostr)) == 0) {
365 node = BooSolid(gdml, node, attr, 3);
366 }
else if ((strcmp(name, reflstr)) == 0) {
367 node = Reflection(gdml, node, attr);
368 }
else if ((strcmp(name, assestr)) == 0) {
369 node = AssProcess(gdml, node);
370 }
else if ((strcmp(name, usrstr)) == 0) {
371 node = UsrProcess(gdml, node);
373 }
else if (((strcmp(name,
"gdml")) != 0) && ((strcmp(name,
"define")) != 0) &&
374 ((strcmp(name,
"element")) != 0) && ((strcmp(name,
"materials")) != 0) &&
375 ((strcmp(name,
"solids")) != 0) && ((strcmp(name,
"structure")) != 0) &&
376 ((strcmp(name,
"zplane")) != 0) && ((strcmp(name,
"first")) != 0) &&
377 ((strcmp(name,
"second")) != 0) && ((strcmp(name,
"twoDimVertex")) != 0) &&
378 ((strcmp(name,
"firstposition")) != 0) && ((strcmp(name,
"firstpositionref")) != 0) &&
379 ((strcmp(name,
"firstrotation")) != 0) && ((strcmp(name,
"firstrotationref")) != 0) &&
380 ((strcmp(name,
"section")) != 0) && ((strcmp(name,
"world")) != 0) &&
381 ((strcmp(name,
"isotope")) != 0)) {
382 std::cout <<
"Error: Unsupported GDML Tag Used :" << name <<
". Please Check Geometry/Schema." << std::endl;
387 XMLNodePointer_t child = gdml->GetChild(node);
389 ParseGDML(gdml, child);
390 child = gdml->GetNext(child);
401 double TGDMLParse::Evaluate(
const char* evalline)
404 return TFormula(
"TFormula", evalline).Eval(0);
411 Int_t TGDMLParse::SetAxis(
const char* axisString)
415 if ((strcmp(axisString,
"kXAxis")) == 0) {
417 }
else if ((strcmp(axisString,
"kYAxis")) == 0) {
419 }
else if ((strcmp(axisString,
"kZAxis")) == 0) {
421 }
else if ((strcmp(axisString,
"kRho")) == 0) {
423 }
else if ((strcmp(axisString,
"kPhi")) == 0) {
436 const char* TGDMLParse::NameShort(
const char* name)
438 static TString stripped;
440 Int_t index = stripped.Index(
"0x");
441 if (index >= 0) stripped = stripped(0, index);
442 return stripped.Data();
451 XMLNodePointer_t TGDMLParse::ConProcess(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
458 tempattr = gdml->GetAttrName(attr);
461 if (tempattr ==
"name") {
462 name = gdml->GetAttrValue(attr);
464 if (tempattr ==
"value") {
465 value = gdml->GetAttrValue(attr);
467 attr = gdml->GetNextAttr(attr);
474 Double_t val = Value(value);
475 fconsts[name.Data()] = val;
476 gGeoManager->AddProperty(name.Data(), val);
484 void TGDMLParse::DefineConstants()
487 fconsts[
"mm"] = TGeoUnit::mm;
488 fconsts[
"millimeter"] = TGeoUnit::mm;
489 fconsts[
"cm"] = TGeoUnit::cm;
490 fconsts[
"centimeter"] = TGeoUnit::cm;
491 fconsts[
"m"] = TGeoUnit::m;
492 fconsts[
"meter"] = TGeoUnit::m;
493 fconsts[
"km"] = TGeoUnit::km;
494 fconsts[
"kilometer"] = TGeoUnit::km;
495 fconsts[
"rad"] = TGeoUnit::rad;
496 fconsts[
"radian"] = TGeoUnit::rad;
497 fconsts[
"deg"] = TGeoUnit::deg;
498 fconsts[
"degree"] = TGeoUnit::deg;
499 fconsts[
"pi"] = TGeoUnit::pi;
500 fconsts[
"twopi"] = TGeoUnit::twopi;
501 fconsts[
"avogadro"] = TMath::Na();
502 fconsts[
"gev"] = TGeoUnit::GeV;
503 fconsts[
"GeV"] = TGeoUnit::GeV;
504 fconsts[
"mev"] = TGeoUnit::MeV;
505 fconsts[
"MeV"] = TGeoUnit::MeV;
506 fconsts[
"kev"] = TGeoUnit::keV;
507 fconsts[
"keV"] = TGeoUnit::keV;
508 fconsts[
"ev"] = TGeoUnit::eV;
509 fconsts[
"eV"] = TGeoUnit::eV;
510 fconsts[
"s"] = TGeoUnit::s;
511 fconsts[
"ms"] = TGeoUnit::ms;
512 fconsts[
"ns"] = TGeoUnit::ns;
513 fconsts[
"us"] = TGeoUnit::us;
514 fconsts[
"kg"] = TGeoUnit::kg;
515 fconsts[
"g"] = TGeoUnit::g;
516 fconsts[
"mg"] = TGeoUnit::mg;
523 XMLNodePointer_t TGDMLParse::QuantityProcess(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
527 TString unit =
"1.0";
531 tempattr = gdml->GetAttrName(attr);
534 if (tempattr ==
"name") {
535 name = gdml->GetAttrValue(attr);
537 if (tempattr ==
"value") {
538 value = gdml->GetAttrValue(attr);
540 if (tempattr ==
"unit") {
541 unit = gdml->GetAttrValue(attr);
543 attr = gdml->GetNextAttr(attr);
546 fconsts[name.Data()] = GetScaleVal(unit) * Value(value);
554 XMLNodePointer_t TGDMLParse::MatrixProcess(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
562 tempattr = gdml->GetAttrName(attr);
565 if (tempattr ==
"name") {
566 name = gdml->GetAttrValue(attr);
568 if (tempattr ==
"coldim") {
569 coldim = (Int_t)Value(gdml->GetAttrValue(attr));
571 if (tempattr ==
"values") {
572 values = gdml->GetAttrValue(attr);
574 attr = gdml->GetNextAttr(attr);
578 std::stringstream valueStream(values);
579 std::vector<Double_t> valueList;
580 while (!valueStream.eof())
582 std::string matrixValue;
583 valueStream >> matrixValue;
585 if ( matrixValue.empty() )
continue;
586 valueList.push_back(Value(matrixValue.c_str()));
589 TGDMLMatrix *matrix =
new TGDMLMatrix(name, valueList.size()/coldim, coldim);
590 matrix->SetMatrixAsString(values.c_str());
591 for (
size_t i=0; i<valueList.size(); ++i)
592 matrix->Set(i/coldim, i%coldim, valueList[i]);
594 gGeoManager->AddGDMLMatrix(matrix);
595 fmatrices[name.Data()] = matrix;
603 XMLNodePointer_t TGDMLParse::OpticalSurfaceProcess(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
605 TString name, propname, ref;
606 TGeoOpticalSurface::ESurfaceModel model = TGeoOpticalSurface::kMglisur;
607 TGeoOpticalSurface::ESurfaceFinish finish = TGeoOpticalSurface::kFpolished;
608 TGeoOpticalSurface::ESurfaceType type = TGeoOpticalSurface::kTdielectric_metal;
613 tempattr = gdml->GetAttrName(attr);
616 if (tempattr ==
"name") {
617 name = gdml->GetAttrValue(attr);
619 if (tempattr ==
"model") {
620 model = TGeoOpticalSurface::StringToModel(gdml->GetAttrValue(attr));
622 if (tempattr ==
"finish") {
623 finish = TGeoOpticalSurface::StringToFinish(gdml->GetAttrValue(attr));
625 if (tempattr ==
"type") {
626 type = TGeoOpticalSurface::StringToType(gdml->GetAttrValue(attr));
628 if (tempattr ==
"value") {
629 value = Value(gdml->GetAttrValue(attr));
631 attr = gdml->GetNextAttr(attr);
634 TGeoOpticalSurface *surf =
new TGeoOpticalSurface(name, model, finish, type, value);
636 XMLNodePointer_t child = gdml->GetChild(node);
638 attr = gdml->GetFirstAttr(child);
639 if ((strcmp(gdml->GetNodeName(child),
"property")) == 0) {
641 tempattr = gdml->GetAttrName(attr);
643 if (tempattr ==
"name") {
644 propname = gdml->GetAttrValue(attr);
645 }
else if (tempattr ==
"ref") {
646 ref = gdml->GetAttrValue(attr);
647 TGDMLMatrix *matrix = fmatrices[ref.Data()];
649 Error(
"OpticalSurfaceProcess",
"Reference matrix %s for optical surface %s not found", ref.Data(), name.Data());
650 surf->AddProperty(propname, ref);
652 attr = gdml->GetNextAttr(attr);
655 child = gdml->GetNext(child);
657 gGeoManager->AddOpticalSurface(surf);
667 TString TGDMLParse::GetScale(
const char* unit)
669 TString retunit =
"";
671 if (strcmp(unit,
"mm") == 0) {
673 }
else if (strcmp(unit,
"milimeter") == 0) {
675 }
else if (strcmp(unit,
"cm") == 0) {
677 }
else if (strcmp(unit,
"centimeter") == 0) {
679 }
else if (strcmp(unit,
"m") == 0) {
681 }
else if (strcmp(unit,
"meter") == 0) {
683 }
else if (strcmp(unit,
"km") == 0) {
684 retunit =
"100000.0";
685 }
else if (strcmp(unit,
"kilometer") == 0) {
686 retunit =
"100000.0";
687 }
else if (strcmp(unit,
"rad") == 0) {
688 retunit = TString::Format(
"%.12f", TMath::RadToDeg());
689 }
else if (strcmp(unit,
"radian") == 0) {
690 retunit = TString::Format(
"%.12f", TMath::RadToDeg());
691 }
else if (strcmp(unit,
"deg") == 0) {
693 }
else if (strcmp(unit,
"degree") == 0) {
695 }
else if (strcmp(unit,
"pi") == 0) {
697 }
else if (strcmp(unit,
"avogadro") == 0) {
698 retunit = TString::Format(
"%.12g", TMath::Na());
700 Fatal(
"GetScale",
"Unit <%s> not known", unit);
713 Double_t TGDMLParse::GetScaleVal(
const char* sunit)
715 Double_t retunit = 0.;
719 if ((unit ==
"mm") || (unit ==
"milimeter")) {
721 }
else if ((unit ==
"cm") || (unit ==
"centimeter")) {
723 }
else if ((unit ==
"m") || (unit ==
"meter")) {
725 }
else if ((unit ==
"km") || (unit ==
"kilometer")) {
727 }
else if ((unit ==
"rad") || (unit ==
"radian")) {
728 retunit = TMath::RadToDeg();
729 }
else if ((unit ==
"deg") || (unit ==
"degree")) {
731 }
else if ((unit ==
"ev") || (unit ==
"electronvolt")) {
732 retunit = 0.000000001;
733 }
else if ((unit ==
"kev") || (unit ==
"kiloelectronvolt")) {
735 }
else if ((unit ==
"mev") || (unit ==
"megaelectronvolt")) {
737 }
else if ((unit ==
"gev") || (unit ==
"gigaelectronvolt")) {
739 }
else if (unit ==
"pi") {
740 retunit = TMath::Pi();
741 }
else if (unit ==
"avogadro") {
742 retunit = TMath::Na();
744 Fatal(
"GetScaleVal",
"Unit <%s> not known", sunit);
753 Double_t TGDMLParse::Value(
const char *svalue)
const
756 double val = strtod(svalue, &end);
759 while( *end != 0 && isspace(*end) ) ++end;
763 if (*end == 0)
return val;
769 std::string expanded;
770 expanded.reserve(strlen(svalue) * 2);
774 const std::locale &loc = std::locale::classic();
777 const char *p = svalue;
780 for (; *p != 0; ++p) {
781 if (std::isalpha(*p, loc) || *p ==
'_') {
782 const char *pe = p + 1;
785 for (; *pe != 0; ++pe) {
786 if (!isalnum(*pe, loc) && *pe !=
'_') {
789 for (; p < pe; ++p) expanded += *p;
793 for (; p < pe; ++p) expanded += *p;
801 for (; p < pe; ++p) expanded += *p;
809 TFormula f(
"TFormula", expanded.c_str());
812 for (
auto it: fconsts) f.SetParameter(it.first.c_str(), it.second);
816 if (std::isnan(val) || std::isinf(val)) {
817 Fatal(
"Value",
"Got bad value %lf from string '%s'", val, svalue);
830 XMLNodePointer_t TGDMLParse::PosProcess(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
832 TString lunit = fDefault_lunit.c_str();
841 tempattr = gdml->GetAttrName(attr);
844 if (tempattr ==
"name") {
845 name = gdml->GetAttrValue(attr);
846 }
else if (tempattr ==
"x") {
847 xpos = gdml->GetAttrValue(attr);
848 }
else if (tempattr ==
"y") {
849 ypos = gdml->GetAttrValue(attr);
850 }
else if (tempattr ==
"z") {
851 zpos = gdml->GetAttrValue(attr);
852 }
else if (tempattr ==
"unit") {
853 lunit = gdml->GetAttrValue(attr);
856 attr = gdml->GetNextAttr(attr);
859 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
860 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
863 Double_t retunit = GetScaleVal(lunit);
864 Double_t xline = Value(xpos)*retunit;
865 Double_t yline = Value(ypos)*retunit;
866 Double_t zline = Value(zpos)*retunit;
868 TGeoTranslation* pos =
new TGeoTranslation(xline, yline, zline);
870 fposmap[name.Data()] = pos;
883 XMLNodePointer_t TGDMLParse::RotProcess(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
885 TString aunit = fDefault_aunit.c_str();
894 tempattr = gdml->GetAttrName(attr);
897 if (tempattr ==
"name") {
898 name = gdml->GetAttrValue(attr);
899 }
else if (tempattr ==
"x") {
900 xpos = gdml->GetAttrValue(attr);
901 }
else if (tempattr ==
"y") {
902 ypos = gdml->GetAttrValue(attr);
903 }
else if (tempattr ==
"z") {
904 zpos = gdml->GetAttrValue(attr);
905 }
else if (tempattr ==
"unit") {
906 aunit = gdml->GetAttrValue(attr);
909 attr = gdml->GetNextAttr(attr);
912 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
913 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
916 Double_t retunit = GetScaleVal(aunit);
918 Double_t xline = Value(xpos)*retunit;
919 Double_t yline = Value(ypos)*retunit;
920 Double_t zline = Value(zpos)*retunit;
922 TGeoRotation* rot =
new TGeoRotation();
924 rot->RotateZ(-zline);
925 rot->RotateY(-yline);
926 rot->RotateX(-xline);
928 frotmap[name.Data()] = rot;
941 XMLNodePointer_t TGDMLParse::SclProcess(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
951 tempattr = gdml->GetAttrName(attr);
954 if (tempattr ==
"name") {
955 name = gdml->GetAttrValue(attr);
956 }
else if (tempattr ==
"x") {
957 xpos = gdml->GetAttrValue(attr);
958 }
else if (tempattr ==
"y") {
959 ypos = gdml->GetAttrValue(attr);
960 }
else if (tempattr ==
"z") {
961 zpos = gdml->GetAttrValue(attr);
964 attr = gdml->GetNextAttr(attr);
967 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
968 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
971 TGeoScale* scl =
new TGeoScale(Value(xpos), Value(ypos), Value(zpos));
973 fsclmap[name.Data()] = scl;
985 XMLNodePointer_t TGDMLParse::IsoProcess(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t parentn)
995 XMLAttrPointer_t attr = gdml->GetFirstAttr(parentn);
999 tempattr = gdml->GetAttrName(attr);
1002 if (tempattr ==
"name") {
1003 name = gdml->GetAttrValue(attr);
1004 }
else if (tempattr ==
"z") {
1005 z = gdml->GetAttrValue(attr);
1006 }
else if (tempattr ==
"n") {
1007 n = gdml->GetAttrValue(attr);
1010 attr = gdml->GetNextAttr(attr);
1015 attr = gdml->GetFirstAttr(node);
1019 tempattr = gdml->GetAttrName(attr);
1021 if (tempattr ==
"value") {
1022 atom = gdml->GetAttrValue(attr);
1025 attr = gdml->GetNextAttr(attr);
1028 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1029 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
1032 Int_t z2 = (Int_t)Value(z);
1033 Int_t n2 = (Int_t)Value(n);
1034 Double_t atom2 = Value(atom);
1036 TGeoManager* mgr = gGeoManager;
1037 TString iso_name = NameShort(name);
1038 TGeoElementTable* tab = mgr->GetElementTable();
1039 TGeoIsotope* iso = tab->FindIsotope(iso_name);
1041 iso =
new TGeoIsotope(iso_name, z2 , n2, atom2);
1043 else if ( gDebug >= 2 ) {
1044 Info(
"TGDMLParse",
"Re-use existing isotope: %s",iso->GetName());
1046 fisomap[name.Data()] = iso;
1057 XMLNodePointer_t TGDMLParse::EleProcess(TXMLEngine* gdml, XMLNodePointer_t node, XMLNodePointer_t parentn, Bool_t hasIsotopes, Bool_t hasIsotopesExtended)
1062 TString formula =
"";
1066 TGeoManager* mgr = gGeoManager;
1067 TGeoElementTable* tab = mgr->GetElementTable();
1068 typedef FracMap::iterator fractions;
1071 XMLNodePointer_t child = 0;
1075 XMLAttrPointer_t attr = gdml->GetFirstAttr(node);
1081 tempattr = gdml->GetAttrName(attr);
1082 if (tempattr ==
"name") {
1083 name = gdml->GetAttrValue(attr);
1085 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1086 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
1090 attr = gdml->GetNextAttr(attr);
1093 child = gdml->GetChild(node);
1094 while (child != 0) {
1097 if ((strcmp(gdml->GetNodeName(child),
"fraction")) == 0) {
1100 ncompo = ncompo + 1;
1101 attr = gdml->GetFirstAttr(child);
1103 tempattr = gdml->GetAttrName(attr);
1105 if (tempattr ==
"n") {
1106 n = Value(gdml->GetAttrValue(attr));
1107 }
else if (tempattr ==
"ref") {
1108 ref = gdml->GetAttrValue(attr);
1109 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1110 ref = TString::Format(
"%s_%s", ref.Data(), fCurrentFile);
1113 attr = gdml->GetNextAttr(attr);
1115 fracmap[ref.Data()] = n;
1117 child = gdml->GetNext(child);
1120 TGeoElement* ele = tab->FindElement(NameShort(name));
1122 if (ele && ele->Z() == 0)
1125 ele =
new TGeoElement(NameShort(name), NameShort(name), ncompo);
1126 for (fractions f = fracmap.begin(); f != fracmap.end(); ++f) {
1127 if (fisomap.find(f->first) != fisomap.end()) {
1128 ele->AddIsotope((TGeoIsotope*)fisomap[f->first], f->second);
1132 else if ( gDebug >= 2 ) {
1133 Info(
"TGDMLParse",
"Re-use existing element: %s",ele->GetName());
1135 felemap[name.Data()] = ele;
1142 if (hasIsotopesExtended) {
1145 tempattr = gdml->GetAttrName(attr);
1147 if (tempattr ==
"name") {
1148 name = gdml->GetAttrValue(attr);
1150 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1151 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
1155 attr = gdml->GetNextAttr(attr);
1158 child = gdml->GetChild(node);
1159 while (child != 0) {
1162 if ((strcmp(gdml->GetNodeName(child),
"fraction")) == 0) {
1165 ncompo = ncompo + 1;
1166 attr = gdml->GetFirstAttr(child);
1168 tempattr = gdml->GetAttrName(attr);
1170 if (tempattr ==
"n") {
1171 n = Value(gdml->GetAttrValue(attr));
1172 }
else if (tempattr ==
"ref") {
1173 ref = gdml->GetAttrValue(attr);
1174 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1175 ref = TString::Format(
"%s_%s", ref.Data(), fCurrentFile);
1178 attr = gdml->GetNextAttr(attr);
1180 fracmap[ref.Data()] = n;
1182 child = gdml->GetNext(child);
1185 TGeoElement* ele = tab->FindElement(NameShort(name));
1187 if (ele && ele->Z() == 0)
1190 ele =
new TGeoElement(NameShort(name), NameShort(name), ncompo);
1191 for (fractions f = fracmap.begin(); f != fracmap.end(); ++f) {
1192 if (fisomap.find(f->first) != fisomap.end()) {
1193 ele->AddIsotope((TGeoIsotope*)fisomap[f->first], f->second);
1197 else if ( gDebug >= 2 ) {
1198 Info(
"TGDMLParse",
"Re-use existing element: %s",ele->GetName());
1200 felemap[name.Data()] = ele;
1206 attr = gdml->GetFirstAttr(parentn);
1209 tempattr = gdml->GetAttrName(attr);
1212 if (tempattr ==
"name") {
1213 name = gdml->GetAttrValue(attr);
1215 }
else if (tempattr ==
"z") {
1216 z = gdml->GetAttrValue(attr);
1217 }
else if (tempattr ==
"formula") {
1218 formula = gdml->GetAttrValue(attr);
1221 attr = gdml->GetNextAttr(attr);
1226 attr = gdml->GetFirstAttr(node);
1230 tempattr = gdml->GetAttrName(attr);
1233 if (tempattr ==
"value") {
1234 atom = gdml->GetAttrValue(attr);
1237 attr = gdml->GetNextAttr(attr);
1240 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1241 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
1244 Int_t z2 = (Int_t)Value(z);
1245 Double_t atom2 = Value(atom);
1246 TGeoElement* ele = tab->FindElement(formula);
1248 if (ele && ele->Z() == 0)
1252 ele =
new TGeoElement(formula, NameShort(name), z2 , atom2);
1254 else if ( gDebug >= 2 ) {
1255 Info(
"TGDMLParse",
"Re-use existing element: %s",ele->GetName());
1257 felemap[name.Data()] = ele;
1272 XMLNodePointer_t TGDMLParse::MatProcess(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr,
int z)
1275 typedef FracMap::iterator fractions;
1279 TGeoManager* mgr = gGeoManager;
1280 TGeoElementTable* tab_ele = mgr->GetElementTable();
1281 TList properties, constproperties;
1282 properties.SetOwner();
1283 constproperties.SetOwner();
1285 static int medid = mgr->GetListOfMedia()->GetSize()+1;
1286 XMLNodePointer_t child = gdml->GetChild(node);
1287 TString tempattr =
"";
1288 Int_t ncompo = 0, mixflag = 2;
1289 Double_t density = 0;
1291 TGeoMixture* mix = 0;
1292 TGeoMaterial* mat = 0;
1293 TString tempconst =
"";
1295 Bool_t composite = kFALSE;
1301 name = gdml->GetAttr(node,
"name");
1302 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1303 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
1306 while (child != 0) {
1307 attr = gdml->GetFirstAttr(child);
1309 if ((strcmp(gdml->GetNodeName(child),
"property")) == 0) {
1310 TNamed *
property =
new TNamed();
1312 tempattr = gdml->GetAttrName(attr);
1315 if (tempattr ==
"name") {
1316 property->SetName(gdml->GetAttrValue(attr));
1318 else if(tempattr ==
"ref") {
1319 property->SetTitle(gdml->GetAttrValue(attr));
1320 TGDMLMatrix *matrix = fmatrices[
property->GetTitle()];
1321 if (matrix) properties.Add(property);
1324 gGeoManager->GetProperty(property->GetTitle(), &error);
1326 Error(
"MatProcess",
"Reference %s for material %s not found", property->GetTitle(), name.Data());
1328 constproperties.Add(property);
1331 attr = gdml->GetNextAttr(attr);
1335 if ((strcmp(gdml->GetNodeName(child),
"atom")) == 0) {
1337 tempattr = gdml->GetAttrName(attr);
1340 if (tempattr ==
"value") {
1341 a = Value(gdml->GetAttrValue(attr));
1343 attr = gdml->GetNextAttr(attr);
1347 if ((strcmp(gdml->GetNodeName(child),
"D")) == 0) {
1349 tempattr = gdml->GetAttrName(attr);
1352 if (tempattr ==
"value") {
1353 d = Value(gdml->GetAttrValue(attr));
1355 attr = gdml->GetNextAttr(attr);
1358 child = gdml->GetNext(child);
1362 tempconst = gdml->GetAttr(node,
"Z");
1364 Double_t valZ = Value(tempconst);
1366 TString tmpname = name;
1369 if (tmpname ==
"vacuum") {
1372 TString mat_name = NameShort(name);
1373 mat = mgr->GetMaterial(mat_name);
1375 mat =
new TGeoMaterial(mat_name, a, valZ, d);
1378 Info(
"TGDMLParse",
"Re-use existing material: %s",mat->GetName());
1380 if (properties.GetSize()) {
1382 TIter next(&properties);
1383 while ((property = (TNamed*)next()))
1384 mat->AddProperty(property->GetName(),
property->GetTitle());
1386 if (constproperties.GetSize()) {
1388 TIter next(&constproperties);
1389 while ((property = (TNamed*)next()))
1390 mat->AddConstProperty(property->GetName(),
property->GetTitle());
1394 TGeoElement* mat_ele = tab_ele->FindElement(mat_name);
1396 if (mat_ele && mat_ele->Z() == 0)
1400 mat_ele =
new TGeoElement(mat_name, mat_name, atoi(tempconst), a);
1402 else if ( gDebug >= 2 ) {
1403 Info(
"TGDMLParse",
"Re-use existing material-element: %s",mat_ele->GetName());
1405 felemap[name.Data()] = mat_ele;
1409 while (child != 0) {
1410 attr = gdml->GetFirstAttr(child);
1412 if ((strcmp(gdml->GetNodeName(child),
"property")) == 0) {
1413 TNamed *
property =
new TNamed();
1415 tempattr = gdml->GetAttrName(attr);
1418 if (tempattr ==
"name") {
1419 property->SetName(gdml->GetAttrValue(attr));
1421 else if(tempattr ==
"ref") {
1422 property->SetTitle(gdml->GetAttrValue(attr));
1423 TGDMLMatrix *matrix = fmatrices[
property->GetTitle()];
1424 if (matrix) properties.Add(property);
1427 gGeoManager->GetProperty(property->GetTitle(), &error);
1429 Error(
"MatProcess",
"Reference %s for material %s not found", property->GetTitle(), name.Data());
1431 constproperties.Add(property);
1434 attr = gdml->GetNextAttr(attr);
1437 if ((strcmp(gdml->GetNodeName(child),
"fraction")) == 0) {
1440 ncompo = ncompo + 1;
1443 tempattr = gdml->GetAttrName(attr);
1446 if (tempattr ==
"n") {
1447 n = Value(gdml->GetAttrValue(attr));
1448 }
else if (tempattr ==
"ref") {
1449 ref = gdml->GetAttrValue(attr);
1450 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1451 ref = TString::Format(
"%s_%s", ref.Data(), fCurrentFile);
1454 attr = gdml->GetNextAttr(attr);
1456 fracmap[ref.Data()] = n;
1459 else if ((strcmp(gdml->GetNodeName(child),
"composite")) == 0) {
1463 ncompo = ncompo + 1;
1466 tempattr = gdml->GetAttrName(attr);
1468 if (tempattr ==
"n") {
1469 n = Value(gdml->GetAttrValue(attr));
1470 }
else if (tempattr ==
"ref") {
1471 ref = gdml->GetAttrValue(attr);
1472 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1473 ref = TString::Format(
"%s_%s", ref.Data(), fCurrentFile);
1476 attr = gdml->GetNextAttr(attr);
1478 fracmap[ref.Data()] = n;
1480 else if ((strcmp(gdml->GetNodeName(child),
"D")) == 0) {
1482 tempattr = gdml->GetAttrName(attr);
1485 if (tempattr ==
"value") {
1486 density = Value(gdml->GetAttrValue(attr));
1488 attr = gdml->GetNextAttr(attr);
1491 child = gdml->GetNext(child);
1495 name = gdml->GetAttr(node,
"name");
1496 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1497 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
1501 TString mat_name = NameShort(name);
1502 mat = mgr->GetMaterial(mat_name);
1504 mix =
new TGeoMixture(mat_name, ncompo, density);
1506 else if ( mat->IsMixture() ) {
1507 mix = (TGeoMixture*)mat;
1509 Info(
"TGDMLParse",
"Re-use existing material-mixture: %s",mix->GetName());
1512 Error(
"TGDMLParse",
"WARNING! Inconsistent material definitions between GDML and TGeoManager");
1514 if (properties.GetSize()) {
1516 TIter next(&properties);
1517 while ((property = (TNamed*)next()))
1518 mix->AddProperty(property->GetName(),
property->GetTitle());
1520 if (constproperties.GetSize()) {
1522 TIter next(&constproperties);
1523 while ((property = (TNamed*)next()))
1524 mix->AddConstProperty(property->GetName(),
property->GetTitle());
1529 for (fractions f = fracmap.begin(); f != fracmap.end(); ++f) {
1531 matname = NameShort(matname);
1533 TGeoMaterial *mattmp = (TGeoMaterial*)gGeoManager->GetListOfMaterials()->FindObject(matname);
1535 if (mattmp || (felemap.find(f->first) != felemap.end())) {
1537 natoms = (Int_t)f->second;
1539 mix->AddElement(felemap[f->first], natoms);
1546 mix->AddElement(mattmp, weight);
1549 mix->AddElement(felemap[f->first], weight);
1558 TGeoMedium* med = mgr->GetMedium(NameShort(name));
1561 fmixmap[name.Data()] = mix;
1562 med =
new TGeoMedium(NameShort(name), medid, mix);
1563 }
else if (mixflag == 0) {
1564 fmatmap[name.Data()] = mat;
1565 med =
new TGeoMedium(NameShort(name), medid, mat);
1568 else if ( gDebug >= 2 ) {
1569 Info(
"TGDMLParse",
"Re-use existing medium: %s",med->GetName());
1571 fmedmap[name.Data()] = med;
1579 XMLNodePointer_t TGDMLParse::SkinSurfaceProcess(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
1581 TString name, surfname, volname;
1585 tempattr = gdml->GetAttrName(attr);
1588 if (tempattr ==
"name") {
1589 name = gdml->GetAttrValue(attr);
1591 if (tempattr ==
"surfaceproperty") {
1592 surfname = gdml->GetAttrValue(attr);
1594 attr = gdml->GetNextAttr(attr);
1597 XMLNodePointer_t child = gdml->GetChild(node);
1598 while (child != 0) {
1599 attr = gdml->GetFirstAttr(child);
1600 if ((strcmp(gdml->GetNodeName(child),
"volumeref")) == 0) {
1602 tempattr = gdml->GetAttrName(attr);
1604 if (tempattr ==
"ref") {
1605 volname = gdml->GetAttrValue(attr);
1607 attr = gdml->GetNextAttr(attr);
1610 child = gdml->GetNext(child);
1612 TGeoOpticalSurface *surf = gGeoManager->GetOpticalSurface(surfname);
1614 Fatal(
"SkinSurfaceProcess",
"Skin surface %s: referenced optical surface %s not defined",
1615 name.Data(), surfname.Data());
1616 TGeoVolume *vol = fvolmap[volname.Data()];
1617 TGeoSkinSurface *skin =
new TGeoSkinSurface(name, surfname, surf, vol);
1618 gGeoManager->AddSkinSurface(skin);
1625 XMLNodePointer_t TGDMLParse::BorderSurfaceProcess(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
1627 TString name, surfname, nodename[2];
1631 tempattr = gdml->GetAttrName(attr);
1634 if (tempattr ==
"name") {
1635 name = gdml->GetAttrValue(attr);
1637 if (tempattr ==
"surfaceproperty") {
1638 surfname = gdml->GetAttrValue(attr);
1640 attr = gdml->GetNextAttr(attr);
1643 XMLNodePointer_t child = gdml->GetChild(node);
1645 while (child != 0) {
1646 attr = gdml->GetFirstAttr(child);
1647 if ((strcmp(gdml->GetNodeName(child),
"physvolref")) == 0) {
1649 tempattr = gdml->GetAttrName(attr);
1651 if (tempattr ==
"ref") {
1652 nodename[inode++] = gdml->GetAttrValue(attr);
1654 attr = gdml->GetNextAttr(attr);
1657 child = gdml->GetNext(child);
1660 Fatal(
"BorderSurfaceProcess",
"Border surface %s not referencing two nodes", name.Data());
1661 TGeoOpticalSurface *surf = gGeoManager->GetOpticalSurface(surfname);
1663 Fatal(
"BorderSurfaceProcess",
"Border surface %s: referenced optical surface %s not defined",
1664 name.Data(), surfname.Data());
1665 TGeoNode *node1 = fpvolmap[nodename[0].Data()];
1666 TGeoNode *node2 = fpvolmap[nodename[1].Data()];
1667 if (!node1 || !node2)
1668 Fatal(
"BorderSurfaceProcess",
"Border surface %s: not found nodes %s [%s] or %s [%s]",
1670 nodename[0].Data(), node1 ?
"present" :
"missing",
1671 nodename[1].Data(), node2 ?
"present" :
"missing");
1673 TGeoBorderSurface *border =
new TGeoBorderSurface(name, surfname, surf, node1, node2);
1674 gGeoManager->AddBorderSurface(border);
1693 XMLNodePointer_t TGDMLParse::VolProcess(TXMLEngine* gdml, XMLNodePointer_t node)
1695 XMLAttrPointer_t attr;
1696 XMLNodePointer_t subchild;
1697 XMLNodePointer_t subsubchild;
1699 XMLNodePointer_t child = gdml->GetChild(node);
1701 TString solidname =
"";
1702 TString tempattr =
"";
1703 TGeoShape* solid = 0;
1704 TGeoMedium* medium = 0;
1705 TGeoVolume* vol = 0;
1707 TGeoShape* reflex = 0;
1708 const Double_t* parentrot = 0;
1710 TString reftemp =
"";
1713 while (child != 0) {
1714 if ((strcmp(gdml->GetNodeName(child),
"solidref")) == 0) {
1716 reftemp = gdml->GetAttr(child,
"ref");
1717 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1718 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
1720 if (fsolmap.find(reftemp.Data()) != fsolmap.end()) {
1721 solid = fsolmap[reftemp.Data()];
1722 }
else if (freflectmap.find(reftemp.Data()) != freflectmap.end()) {
1723 solidname = reftemp;
1724 reflex = fsolmap[freflectmap[reftemp.Data()]];
1726 printf(
"Solid: %s, Not Yet Defined!\n", reftemp.Data());
1730 if ((strcmp(gdml->GetNodeName(child),
"materialref")) == 0) {
1731 reftemp = gdml->GetAttr(child,
"ref");
1732 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1733 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
1735 if (fmedmap.find(reftemp.Data()) != fmedmap.end()) {
1736 medium = fmedmap[reftemp.Data()];
1738 printf(
"Medium: %s, Not Yet Defined!\n", gdml->GetAttr(child,
"ref"));
1742 child = gdml->GetNext(child);
1745 name = gdml->GetAttr(node,
"name");
1747 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1748 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
1752 vol =
new TGeoVolume(NameShort(name), solid, medium);
1754 vol =
new TGeoVolume(NameShort(name), reflex, medium);
1755 freflvolmap[name.Data()] = solidname;
1756 TGDMLRefl* parentrefl = freflsolidmap[solidname.Data()];
1757 parentrot = parentrefl->GetMatrix()->GetRotationMatrix();
1761 fvolmap[name.Data()] = vol;
1765 child = gdml->GetChild(node);
1767 while (child != 0) {
1768 if ((strcmp(gdml->GetNodeName(child),
"physvol")) == 0) {
1770 TString volref =
"";
1772 TGeoTranslation* pos = 0;
1773 TGeoRotation* rot = 0;
1775 TString pnodename = gdml->GetAttr(child,
"name");
1776 TString scopynum = gdml->GetAttr(child,
"copynumber");
1777 Int_t copynum = (scopynum.IsNull()) ? 0 : (Int_t)Value(scopynum);
1779 subchild = gdml->GetChild(child);
1781 while (subchild != 0) {
1782 tempattr = gdml->GetNodeName(subchild);
1785 if (tempattr ==
"volumeref") {
1786 reftemp = gdml->GetAttr(subchild,
"ref");
1787 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1788 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
1790 lv = fvolmap[reftemp.Data()];
1793 else if (tempattr ==
"file") {
1794 const char* filevol;
1795 const char* prevfile = fCurrentFile;
1797 fCurrentFile = gdml->GetAttr(subchild,
"name");
1798 filevol = gdml->GetAttr(subchild,
"volname");
1800 TXMLEngine* gdml2 =
new TXMLEngine;
1801 gdml2->SetSkipComments(kTRUE);
1802 XMLDocPointer_t filedoc1 = gdml2->ParseFile(fCurrentFile);
1803 if (filedoc1 == 0) {
1804 Fatal(
"VolProcess",
"Bad filename given %s", fCurrentFile);
1807 XMLNodePointer_t mainnode2 = gdml2->DocGetRootElement(filedoc1);
1809 fFILENO = fFILENO + 1;
1810 fFileEngine[fFILENO] = gdml2;
1812 if (ffilemap.find(fCurrentFile) != ffilemap.end()) {
1813 volref = ffilemap[fCurrentFile];
1815 volref = ParseGDML(gdml2, mainnode2);
1816 ffilemap[fCurrentFile] = volref;
1821 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1822 volref = TString::Format(
"%s_%s", volref.Data(), fCurrentFile);
1826 fFILENO = fFILENO - 1;
1827 gdml = fFileEngine[fFILENO];
1828 fCurrentFile = prevfile;
1830 lv = fvolmap[volref.Data()];
1833 gdml->FreeDoc(filedoc1);
1836 else if (tempattr ==
"position") {
1837 attr = gdml->GetFirstAttr(subchild);
1838 PosProcess(gdml, subchild, attr);
1839 reftemp = gdml->GetAttr(subchild,
"name");
1840 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1841 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
1843 pos = fposmap[reftemp.Data()];
1844 }
else if (tempattr ==
"positionref") {
1845 reftemp = gdml->GetAttr(subchild,
"ref");
1846 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1847 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
1849 if (fposmap.find(reftemp.Data()) != fposmap.end()) pos = fposmap[reftemp.Data()];
1850 else std::cout <<
"ERROR! Physvol's position " << reftemp <<
" not found!" << std::endl;
1851 }
else if (tempattr ==
"rotation") {
1852 attr = gdml->GetFirstAttr(subchild);
1853 RotProcess(gdml, subchild, attr);
1854 reftemp = gdml->GetAttr(subchild,
"name");
1855 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1856 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
1858 rot = frotmap[reftemp.Data()];
1859 }
else if (tempattr ==
"rotationref") {
1860 reftemp = gdml->GetAttr(subchild,
"ref");
1861 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1862 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
1864 if (frotmap.find(reftemp.Data()) != frotmap.end()) rot = frotmap[reftemp.Data()];
1865 else std::cout <<
"ERROR! Physvol's rotation " << reftemp <<
" not found!" << std::endl;
1866 }
else if (tempattr ==
"scale") {
1867 attr = gdml->GetFirstAttr(subchild);
1868 SclProcess(gdml, subchild, attr);
1869 reftemp = gdml->GetAttr(subchild,
"name");
1870 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1871 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
1873 scl = fsclmap[reftemp.Data()];
1874 }
else if (tempattr ==
"scaleref") {
1875 reftemp = gdml->GetAttr(subchild,
"ref");
1876 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1877 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
1879 if (fsclmap.find(reftemp.Data()) != fsclmap.end()) scl = fsclmap[reftemp.Data()];
1880 else std::cout <<
"ERROR! Physvol's scale " << reftemp <<
" not found!" << std::endl;
1883 subchild = gdml->GetNext(subchild);
1887 fVolID = fVolID + 1;
1889 TGeoHMatrix *transform =
new TGeoHMatrix();
1891 if (pos != 0) transform->SetTranslation(pos->GetTranslation());
1892 if (rot != 0) transform->SetRotation(rot->GetRotationMatrix());
1896 Double_t scale3x3[9];
1897 memset(scale3x3, 0, 9 *
sizeof(Double_t));
1898 const Double_t *diagonal = scl->GetScale();
1900 scale3x3[0] = diagonal[0];
1901 scale3x3[4] = diagonal[1];
1902 scale3x3[8] = diagonal[2];
1904 TGeoRotation scaleMatrix;
1905 scaleMatrix.SetMatrix(scale3x3);
1906 transform->Multiply(&scaleMatrix);
1911 if (freflvolmap.find(volref.Data()) != freflvolmap.end()) {
1913 TGDMLRefl* temprefl = freflsolidmap[freflvolmap[volref.Data()]];
1914 transform->Multiply(temprefl->GetMatrix());
1920 prot.SetMatrix(parentrot);
1921 transform->MultiplyLeft(&prot);
1926 vol->AddNode(lv, copynum, transform);
1927 TGeoNode *lastnode = (TGeoNode*)vol->GetNodes()->Last();
1928 if (!pnodename.IsNull())
1929 lastnode->SetName(pnodename);
1930 fpvolmap[lastnode->GetName()] = lastnode;
1931 }
else if ((strcmp(gdml->GetNodeName(child),
"divisionvol")) == 0) {
1933 TString divVolref =
"";
1935 TString number =
"";
1937 TString offset =
"";
1938 TString lunit = fDefault_lunit.c_str();
1940 attr = gdml->GetFirstAttr(child);
1944 tempattr = gdml->GetAttrName(attr);
1947 if (tempattr ==
"axis") {
1948 axis = SetAxis(gdml->GetAttrValue(attr));
1949 }
else if (tempattr ==
"number") {
1950 number = gdml->GetAttrValue(attr);
1951 }
else if (tempattr ==
"width") {
1952 width = gdml->GetAttrValue(attr);
1953 }
else if (tempattr ==
"offset") {
1954 offset = gdml->GetAttrValue(attr);
1955 }
else if (tempattr ==
"unit") {
1956 lunit = gdml->GetAttrValue(attr);
1959 attr = gdml->GetNextAttr(attr);
1963 subchild = gdml->GetChild(child);
1965 while (subchild != 0) {
1966 tempattr = gdml->GetNodeName(subchild);
1969 if (tempattr ==
"volumeref") {
1970 reftemp = gdml->GetAttr(subchild,
"ref");
1971 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
1972 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
1974 divVolref = reftemp;
1977 subchild = gdml->GetNext(subchild);
1981 Double_t numberline = Value(number);
1982 Double_t retunit = GetScaleVal(lunit);
1983 Double_t step = Value(width) * retunit;
1984 Double_t offsetline = Value(offset) * retunit;
1986 fVolID = fVolID + 1;
1988 vol->GetShape()->GetAxisRange(axis, xlo, xhi);
1990 Int_t ndiv = (Int_t)numberline;
1991 Double_t start = xlo + offsetline;
1994 TGeoVolume *old = fvolmap[NameShort(reftemp)];
1997 old = fvolmap[NameShort(reftemp)];
1999 numed = old->GetMedium()->GetId();
2001 TGeoVolume *divvol = vol->Divide(NameShort(reftemp), axis, ndiv, start, step, numed);
2003 Fatal(
"VolProcess",
"Cannot divide volume %s", vol->GetName());
2006 if (old && old->GetNdaughters()) {
2007 divvol->ReplayCreation(old);
2009 fvolmap[NameShort(reftemp)] = divvol;
2014 else if ((strcmp(gdml->GetNodeName(child),
"replicavol")) == 0) {
2016 TString divVolref =
"";
2018 TString number =
"";
2020 TString offset =
"";
2021 TString wunit = fDefault_lunit.c_str();
2022 TString ounit = fDefault_lunit.c_str();
2023 Double_t wvalue = 0;
2024 Double_t ovalue = 0;
2027 attr = gdml->GetFirstAttr(child);
2031 tempattr = gdml->GetAttrName(attr);
2034 if (tempattr ==
"number") {
2035 number = gdml->GetAttrValue(attr);
2037 attr = gdml->GetNextAttr(attr);
2040 subchild = gdml->GetChild(child);
2042 while (subchild != 0) {
2043 tempattr = gdml->GetNodeName(subchild);
2046 if (tempattr ==
"volumeref") {
2047 reftemp = gdml->GetAttr(subchild,
"ref");
2048 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2049 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
2051 divVolref = reftemp;
2054 if (tempattr ==
"replicate_along_axis") {
2055 subsubchild = gdml->GetChild(subchild);
2057 while (subsubchild != 0) {
2058 if ((strcmp(gdml->GetNodeName(subsubchild),
"width")) == 0) {
2059 attr = gdml->GetFirstAttr(subsubchild);
2061 tempattr = gdml->GetAttrName(attr);
2063 if (tempattr ==
"value") {
2064 wvalue = Value(gdml->GetAttrValue(attr));
2066 else if (tempattr ==
"unit"){
2067 wunit = gdml->GetAttrValue(attr);
2070 attr = gdml->GetNextAttr(attr);
2073 else if ((strcmp(gdml->GetNodeName(subsubchild),
"offset")) == 0) {
2074 attr = gdml->GetFirstAttr(subsubchild);
2076 tempattr = gdml->GetAttrName(attr);
2078 if (tempattr ==
"value") {
2079 ovalue = Value(gdml->GetAttrValue(attr));
2081 else if (tempattr ==
"unit"){
2082 ounit = gdml->GetAttrValue(attr);
2084 attr = gdml->GetNextAttr(attr);
2087 else if ((strcmp(gdml->GetNodeName(subsubchild),
"direction")) == 0) {
2088 attr = gdml->GetFirstAttr(subsubchild);
2090 tempattr = gdml->GetAttrName(attr);
2092 if (tempattr ==
"x") {
2095 else if (tempattr ==
"y"){
2098 else if (tempattr ==
"z"){
2101 else if (tempattr ==
"rho"){
2104 else if (tempattr ==
"phi"){
2108 attr = gdml->GetNextAttr(attr);
2112 subsubchild = gdml->GetNext(subsubchild);
2117 subchild = gdml->GetNext(subchild);
2121 Double_t retwunit = GetScaleVal(wunit);
2122 Double_t retounit = GetScaleVal(ounit);
2124 Double_t numberline = Value(number);
2125 Double_t widthline = wvalue*retwunit;
2126 Double_t offsetline = ovalue*retounit;
2128 fVolID = fVolID + 1;
2130 vol->GetShape()->GetAxisRange(axis, xlo, xhi);
2132 Int_t ndiv = (Int_t)numberline;
2133 Double_t start = xlo + offsetline;
2135 Double_t step = widthline;
2137 TGeoVolume *old = fvolmap[NameShort(reftemp)];
2140 old = fvolmap[NameShort(reftemp)];
2142 numed = old->GetMedium()->GetId();
2144 TGeoVolume *divvol = vol->Divide(NameShort(reftemp), axis, ndiv, start, step, numed);
2146 Fatal(
"VolProcess",
"Cannot divide volume %s", vol->GetName());
2149 if (old && old->GetNdaughters()) {
2150 divvol->ReplayCreation(old);
2152 fvolmap[NameShort(reftemp)] = divvol;
2155 else if (strcmp(gdml->GetNodeName(child),
"auxiliary") == 0) {
2156 TString auxType, auxUnit, auxValue;
2159 auxmap =
new TMap();
2160 vol->SetUserExtension(
new TGeoRCExtension(auxmap));
2162 attr = gdml->GetFirstAttr(child);
2164 if (!strcmp(gdml->GetAttrName(attr),
"auxtype")) auxType = gdml->GetAttrValue(attr);
2165 else if (!strcmp(gdml->GetAttrName(attr),
"auxvalue")) auxValue = gdml->GetAttrValue(attr);
2166 else if (!strcmp(gdml->GetAttrName(attr),
"auxunit")) auxUnit = gdml->GetAttrValue(attr);
2167 attr = gdml->GetNextAttr(attr);
2169 if (!auxUnit.IsNull()) auxValue = TString::Format(
"%s*%s", auxValue.Data(), auxUnit.Data());
2170 auxmap->Add(
new TObjString(auxType),
new TObjString(auxValue));
2174 child = gdml->GetNext(child);
2192 XMLNodePointer_t TGDMLParse::BooSolid(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr,
int num)
2194 TString reftemp =
"";
2195 TString tempattr =
"";
2196 XMLNodePointer_t child = gdml->GetChild(node);
2198 TGeoShape* first = 0;
2199 TGeoShape* second = 0;
2201 TGeoTranslation* firstPos =
new TGeoTranslation(0, 0, 0);
2202 TGeoTranslation* secondPos =
new TGeoTranslation(0, 0, 0);
2204 TGeoRotation* firstRot =
new TGeoRotation();
2205 TGeoRotation* secondRot =
new TGeoRotation();
2207 firstRot->RotateZ(0);
2208 firstRot->RotateY(0);
2209 firstRot->RotateX(0);
2211 secondRot->RotateZ(0);
2212 secondRot->RotateY(0);
2213 secondRot->RotateX(0);
2215 TString name = gdml->GetAttr(node,
"name");
2217 if ((strcmp(fCurrentFile, fStartFile)) != 0)
2218 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
2220 while (child != 0) {
2221 tempattr = gdml->GetNodeName(child);
2224 if (tempattr ==
"first") {
2225 reftemp = gdml->GetAttr(child,
"ref");
2226 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2227 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
2229 if (fsolmap.find(reftemp.Data()) != fsolmap.end()) {
2230 first = fsolmap[reftemp.Data()];
2232 }
else if (tempattr ==
"second") {
2233 reftemp = gdml->GetAttr(child,
"ref");
2234 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2235 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
2237 if (fsolmap.find(reftemp.Data()) != fsolmap.end()) {
2238 second = fsolmap[reftemp.Data()];
2240 }
else if (tempattr ==
"position") {
2241 attr = gdml->GetFirstAttr(child);
2242 PosProcess(gdml, child, attr);
2243 reftemp = gdml->GetAttr(child,
"name");
2244 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2245 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
2247 secondPos = fposmap[reftemp.Data()];
2248 }
else if (tempattr ==
"positionref") {
2249 reftemp = gdml->GetAttr(child,
"ref");
2250 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2251 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
2253 if (fposmap.find(reftemp.Data()) != fposmap.end()) {
2254 secondPos = fposmap[reftemp.Data()];
2256 }
else if (tempattr ==
"rotation") {
2257 attr = gdml->GetFirstAttr(child);
2258 RotProcess(gdml, child, attr);
2259 reftemp = gdml->GetAttr(child,
"name");
2260 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2261 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
2263 secondRot = frotmap[reftemp.Data()];
2264 }
else if (tempattr ==
"rotationref") {
2265 reftemp = gdml->GetAttr(child,
"ref");
2266 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2267 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
2269 if (frotmap.find(reftemp.Data()) != frotmap.end()) {
2270 secondRot = frotmap[reftemp.Data()];
2272 }
else if (tempattr ==
"firstposition") {
2273 attr = gdml->GetFirstAttr(child);
2274 PosProcess(gdml, child, attr);
2275 reftemp = gdml->GetAttr(child,
"name");
2276 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2277 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
2279 firstPos = fposmap[reftemp.Data()];
2280 }
else if (tempattr ==
"firstpositionref") {
2281 reftemp = gdml->GetAttr(child,
"ref");
2282 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2283 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
2285 if (fposmap.find(reftemp.Data()) != fposmap.end()) {
2286 firstPos = fposmap[reftemp.Data()];
2288 }
else if (tempattr ==
"firstrotation") {
2289 attr = gdml->GetFirstAttr(child);
2290 RotProcess(gdml, child, attr);
2291 reftemp = gdml->GetAttr(child,
"name");
2292 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2293 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
2295 firstRot = frotmap[reftemp.Data()];
2296 }
else if (tempattr ==
"firstrotationref") {
2297 reftemp = gdml->GetAttr(child,
"ref");
2298 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2299 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
2301 if (frotmap.find(reftemp.Data()) != frotmap.end()) {
2302 firstRot = frotmap[reftemp.Data()];
2305 child = gdml->GetNext(child);
2308 TGeoMatrix* firstMatrix =
new TGeoCombiTrans(*firstPos, firstRot->Inverse());
2309 TGeoMatrix* secondMatrix =
new TGeoCombiTrans(*secondPos, secondRot->Inverse());
2311 TGeoCompositeShape*
boolean = 0;
2312 if (!first || !second) {
2313 Fatal(
"BooSolid",
"Incomplete solid %s, missing shape components", name.Data());
2318 boolean =
new TGeoCompositeShape(NameShort(name),
new TGeoSubtraction(first, second, firstMatrix, secondMatrix));
2321 boolean =
new TGeoCompositeShape(NameShort(name),
new TGeoIntersection(first, second, firstMatrix, secondMatrix));
2324 boolean =
new TGeoCompositeShape(NameShort(name),
new TGeoUnion(first, second, firstMatrix, secondMatrix));
2330 fsolmap[name.Data()] = boolean;
2338 XMLNodePointer_t TGDMLParse::UsrProcess(TXMLEngine* gdml, XMLNodePointer_t node)
2340 XMLNodePointer_t child = gdml->GetChild(node);
2341 TString nodename, auxtype, auxtypec, auxvalue, auxvaluec, auxunit, auxunitc;
2346 nodename = gdml->GetNodeName(child);
2347 if (nodename ==
"auxiliary") {
2348 auxtype = gdml->GetAttr(child,
"auxtype");
2349 auxvalue = gdml->GetAttr(child,
"auxvalue");
2350 if (auxtype ==
"Region") {
2351 auxvalue = NameShort(auxvalue);
2352 region =
new TGeoRegion(auxvalue);
2355 XMLNodePointer_t subchild = gdml->GetChild(child);
2357 auxtypec = gdml->GetAttr(subchild,
"auxtype");
2358 auxvaluec = gdml->GetAttr(subchild,
"auxvalue");
2359 auxunitc = gdml->GetAttr(subchild,
"auxunit");
2360 if (auxtypec ==
"volume") {
2361 auxvaluec = NameShort(auxvaluec);
2362 if (region) region->AddVolume(auxvaluec);
2364 if (auxtypec.Contains(
"cut")) {
2365 value = Value(auxvaluec) * GetScaleVal(auxunitc);
2366 if (region) region->AddCut(auxtypec, value);
2368 subchild = gdml->GetNext(subchild);
2371 gGeoManager->AddRegion(region);
2374 child = gdml->GetNext(child);
2389 XMLNodePointer_t TGDMLParse::AssProcess(TXMLEngine* gdml, XMLNodePointer_t node)
2391 TString name = gdml->GetAttr(node,
"name");
2392 TString reftemp =
"";
2394 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2395 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
2398 XMLAttrPointer_t attr;
2399 XMLNodePointer_t subchild;
2400 XMLNodePointer_t child = gdml->GetChild(node);
2401 TString tempattr =
"";
2403 TGeoTranslation* pos = 0;
2404 TGeoRotation* rot = 0;
2405 TGeoCombiTrans* matr;
2407 TGeoVolumeAssembly* assem =
new TGeoVolumeAssembly(NameShort(name));
2414 while (child != 0) {
2415 if ((strcmp(gdml->GetNodeName(child),
"physvol")) == 0) {
2416 TString pnodename = gdml->GetAttr(child,
"name");
2417 TString scopynum = gdml->GetAttr(child,
"copynumber");
2418 Int_t copynum = (scopynum.IsNull()) ? 0 : (Int_t)Value(scopynum);
2420 subchild = gdml->GetChild(child);
2421 pos =
new TGeoTranslation(0, 0, 0);
2422 rot =
new TGeoRotation();
2424 while (subchild != 0) {
2425 tempattr = gdml->GetNodeName(subchild);
2428 if (tempattr ==
"volumeref") {
2429 reftemp = gdml->GetAttr(subchild,
"ref");
2430 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2431 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
2433 lv = fvolmap[reftemp.Data()];
2434 }
else if (tempattr ==
"positionref") {
2435 reftemp = gdml->GetAttr(subchild,
"ref");
2436 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2437 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
2439 if (fposmap.find(reftemp.Data()) != fposmap.end()) {
2440 pos = fposmap[reftemp.Data()];
2442 }
else if (tempattr ==
"position") {
2443 attr = gdml->GetFirstAttr(subchild);
2444 PosProcess(gdml, subchild, attr);
2445 reftemp = gdml->GetAttr(subchild,
"name");
2446 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2447 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
2449 pos = fposmap[reftemp.Data()];
2450 }
else if (tempattr ==
"rotationref") {
2451 reftemp = gdml->GetAttr(subchild,
"ref");
2452 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2453 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
2455 if (frotmap.find(reftemp.Data()) != frotmap.end()) {
2456 rot = frotmap[reftemp.Data()];
2458 }
else if (tempattr ==
"rotation") {
2459 attr = gdml->GetFirstAttr(subchild);
2460 RotProcess(gdml, subchild, attr);
2461 reftemp = gdml->GetAttr(subchild,
"name");
2462 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2463 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
2465 rot = frotmap[reftemp.Data()];
2468 subchild = gdml->GetNext(subchild);
2472 fVolID = fVolID + 1;
2473 matr =
new TGeoCombiTrans(*pos, *rot);
2474 assem->AddNode(lv, copynum, matr);
2475 TGeoNode *lastnode = (TGeoNode*)assem->GetNodes()->Last();
2476 if (!pnodename.IsNull())
2477 lastnode->SetName(pnodename);
2478 fpvolmap[lastnode->GetName()] = lastnode;
2480 child = gdml->GetNext(child);
2483 fvolmap[name.Data()] = assem;
2492 XMLNodePointer_t TGDMLParse::TopProcess(TXMLEngine* gdml, XMLNodePointer_t node)
2494 const char* name = gdml->GetAttr(node,
"name");
2495 gGeoManager->SetName(name);
2496 XMLNodePointer_t child = gdml->GetChild(node);
2497 TString reftemp =
"";
2499 while (child != 0) {
2501 if ((strcmp(gdml->GetNodeName(child),
"world") == 0)) {
2504 reftemp = gdml->GetAttr(child,
"ref");
2507 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2508 reftemp = TString::Format(
"%s_%s", reftemp.Data(), fCurrentFile);
2511 fWorld = fvolmap[reftemp.Data()];
2512 fWorldName = reftemp.Data();
2515 child = gdml->GetNext(child);
2527 XMLNodePointer_t TGDMLParse::Box(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
2529 TString lunit = fDefault_lunit.c_str();
2538 tempattr = gdml->GetAttrName(attr);
2541 if (tempattr ==
"name") {
2542 name = gdml->GetAttrValue(attr);
2543 }
else if (tempattr ==
"x") {
2544 xpos = gdml->GetAttrValue(attr);
2545 }
else if (tempattr ==
"y") {
2546 ypos = gdml->GetAttrValue(attr);
2547 }
else if (tempattr ==
"z") {
2548 zpos = gdml->GetAttrValue(attr);
2549 }
else if (tempattr ==
"lunit") {
2550 lunit = gdml->GetAttrValue(attr);
2553 attr = gdml->GetNextAttr(attr);
2556 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2557 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
2560 Double_t retunit = GetScaleVal(lunit);
2562 Double_t xline = 0.5*Value(xpos)*retunit;
2563 Double_t yline = 0.5*Value(ypos)*retunit;
2564 Double_t zline = 0.5*Value(zpos)*retunit;
2567 TGeoBBox* box =
new TGeoBBox(NameShort(name), xline, yline, zline);
2569 fsolmap[name.Data()] = box;
2584 XMLNodePointer_t TGDMLParse::Ellipsoid(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
2586 TString lunit = fDefault_lunit.c_str();
2598 tempattr = gdml->GetAttrName(attr);
2601 if (tempattr ==
"name") {
2602 name = gdml->GetAttrValue(attr);
2603 }
else if (tempattr ==
"ax") {
2604 ax = gdml->GetAttrValue(attr);
2605 }
else if (tempattr ==
"by") {
2606 by = gdml->GetAttrValue(attr);
2607 }
else if (tempattr ==
"cz") {
2608 cz = gdml->GetAttrValue(attr);
2609 }
else if (tempattr ==
"zcut1") {
2610 zcut1 = gdml->GetAttrValue(attr);
2611 }
else if (tempattr ==
"zcut2") {
2612 zcut2 = gdml->GetAttrValue(attr);
2613 }
else if (tempattr ==
"lunit") {
2614 lunit = gdml->GetAttrValue(attr);
2617 attr = gdml->GetNextAttr(attr);
2620 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2621 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
2624 Double_t retunit = GetScaleVal(lunit);
2626 Double_t dx = Value(ax)*retunit;
2627 Double_t dy = Value(by)*retunit;
2628 Double_t radius = Value(cz)*retunit;
2629 Double_t sx = dx / radius;
2630 Double_t sy = dy / radius;
2637 z1 = Value(zcut1)*retunit;
2642 z2 = Value(zcut2)*retunit;
2645 TGeoSphere *sph =
new TGeoSphere(0, radius);
2646 TGeoScale *scl =
new TGeoScale(
"", sx, sy, sz);
2647 TGeoScaledShape *shape =
new TGeoScaledShape(NameShort(name), sph, scl);
2649 Double_t origin[3] = {0., 0., 0.};
2650 origin[2] = 0.5 * (z1 + z2);
2651 Double_t dz = 0.5 * (z2 - z1);
2652 TGeoBBox *pCutBox =
new TGeoBBox(
"cutBox", dx, dy, dz, origin);
2653 TGeoBoolNode *pBoolNode =
new TGeoIntersection(shape, pCutBox, 0, 0);
2654 TGeoCompositeShape *cs =
new TGeoCompositeShape(NameShort(name), pBoolNode);
2655 fsolmap[name.Data()] = cs;
2670 XMLNodePointer_t TGDMLParse::ElCone(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
2672 TString lunit = fDefault_lunit.c_str();
2682 tempattr = gdml->GetAttrName(attr);
2685 if (tempattr ==
"name") {
2686 name = gdml->GetAttrValue(attr);
2687 }
else if (tempattr ==
"dx") {
2688 dx = gdml->GetAttrValue(attr);
2689 }
else if (tempattr ==
"dy") {
2690 dy = gdml->GetAttrValue(attr);
2691 }
else if (tempattr ==
"zmax") {
2692 zmax = gdml->GetAttrValue(attr);
2693 }
else if (tempattr ==
"zcut") {
2694 zcut = gdml->GetAttrValue(attr);
2695 }
else if (tempattr ==
"lunit") {
2696 lunit = gdml->GetAttrValue(attr);
2699 attr = gdml->GetNextAttr(attr);
2702 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2703 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
2708 Double_t retunit = GetScaleVal(lunit);
2711 Double_t dxratio = Value(dx);
2712 Double_t dyratio = Value(dy);
2713 Double_t z = Value(zmax)*retunit;
2714 Double_t z1 = Value(zcut)*retunit;
2717 Info(
"ElCone",
"ERROR! Parameter zcut = %.12g is not set properly, elcone will not be imported.", z1);
2723 Double_t rx1 = (z + z1) * dxratio;
2724 Double_t ry1 = (z + z1) * dyratio;
2725 Double_t rx2 = (z - z1) * dxratio;
2727 Double_t sy = ry1 / rx1;
2730 TGeoCone *con =
new TGeoCone(z1, 0, rx1, 0, rx2);
2731 TGeoScale *scl =
new TGeoScale(
"", sx, sy, sz);
2732 TGeoScaledShape *shape =
new TGeoScaledShape(NameShort(name), con, scl);
2734 fsolmap[name.Data()] = shape;
2747 XMLNodePointer_t TGDMLParse::Paraboloid(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
2749 TString lunit = fDefault_lunit.c_str();
2750 TString rlopos =
"0";
2751 TString rhipos =
"0";
2752 TString dzpos =
"0";
2758 tempattr = gdml->GetAttrName(attr);
2761 if (tempattr ==
"name") {
2762 name = gdml->GetAttrValue(attr);
2763 }
else if (tempattr ==
"rlo") {
2764 rlopos = gdml->GetAttrValue(attr);
2765 }
else if (tempattr ==
"rhi") {
2766 rhipos = gdml->GetAttrValue(attr);
2767 }
else if (tempattr ==
"dz") {
2768 dzpos = gdml->GetAttrValue(attr);
2769 }
else if (tempattr ==
"lunit") {
2770 lunit = gdml->GetAttrValue(attr);
2773 attr = gdml->GetNextAttr(attr);
2776 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2777 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
2780 Double_t retunit = GetScaleVal(lunit);
2782 Double_t rlo = Value(rlopos)*retunit;
2783 Double_t rhi = Value(rhipos)*retunit;
2784 Double_t dz = Value(dzpos)*retunit;
2786 TGeoParaboloid* paraboloid =
new TGeoParaboloid(NameShort(name), rlo, rhi, dz);
2788 fsolmap[name.Data()] = paraboloid;
2801 XMLNodePointer_t TGDMLParse::Arb8(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
2803 TString lunit = fDefault_lunit.c_str();
2804 TString v1xpos =
"0";
2805 TString v1ypos =
"0";
2806 TString v2xpos =
"0";
2807 TString v2ypos =
"0";
2808 TString v3xpos =
"0";
2809 TString v3ypos =
"0";
2810 TString v4xpos =
"0";
2811 TString v4ypos =
"0";
2812 TString v5xpos =
"0";
2813 TString v5ypos =
"0";
2814 TString v6xpos =
"0";
2815 TString v6ypos =
"0";
2816 TString v7xpos =
"0";
2817 TString v7ypos =
"0";
2818 TString v8xpos =
"0";
2819 TString v8ypos =
"0";
2820 TString dzpos =
"0";
2826 tempattr = gdml->GetAttrName(attr);
2829 if (tempattr ==
"name") {
2830 name = gdml->GetAttrValue(attr);
2831 }
else if (tempattr ==
"v1x") {
2832 v1xpos = gdml->GetAttrValue(attr);
2833 }
else if (tempattr ==
"v1y") {
2834 v1ypos = gdml->GetAttrValue(attr);
2835 }
else if (tempattr ==
"v2x") {
2836 v2xpos = gdml->GetAttrValue(attr);
2837 }
else if (tempattr ==
"v2y") {
2838 v2ypos = gdml->GetAttrValue(attr);
2839 }
else if (tempattr ==
"v3x") {
2840 v3xpos = gdml->GetAttrValue(attr);
2841 }
else if (tempattr ==
"v3y") {
2842 v3ypos = gdml->GetAttrValue(attr);
2843 }
else if (tempattr ==
"v4x") {
2844 v4xpos = gdml->GetAttrValue(attr);
2845 }
else if (tempattr ==
"v4y") {
2846 v4ypos = gdml->GetAttrValue(attr);
2847 }
else if (tempattr ==
"v5x") {
2848 v5xpos = gdml->GetAttrValue(attr);
2849 }
else if (tempattr ==
"v5y") {
2850 v5ypos = gdml->GetAttrValue(attr);
2851 }
else if (tempattr ==
"v6x") {
2852 v6xpos = gdml->GetAttrValue(attr);
2853 }
else if (tempattr ==
"v6y") {
2854 v6ypos = gdml->GetAttrValue(attr);
2855 }
else if (tempattr ==
"v7x") {
2856 v7xpos = gdml->GetAttrValue(attr);
2857 }
else if (tempattr ==
"v7y") {
2858 v7ypos = gdml->GetAttrValue(attr);
2859 }
else if (tempattr ==
"v8x") {
2860 v8xpos = gdml->GetAttrValue(attr);
2861 }
else if (tempattr ==
"v8y") {
2862 v8ypos = gdml->GetAttrValue(attr);
2863 }
else if (tempattr ==
"dz") {
2864 dzpos = gdml->GetAttrValue(attr);
2865 }
else if (tempattr ==
"lunit") {
2866 lunit = gdml->GetAttrValue(attr);
2869 attr = gdml->GetNextAttr(attr);
2872 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2873 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
2876 Double_t retunit = GetScaleVal(lunit);
2878 Double_t v1x = Value(v1xpos)*retunit;
2879 Double_t v1y = Value(v1ypos)*retunit;
2880 Double_t v2x = Value(v2xpos)*retunit;
2881 Double_t v2y = Value(v2ypos)*retunit;
2882 Double_t v3x = Value(v3xpos)*retunit;
2883 Double_t v3y = Value(v3ypos)*retunit;
2884 Double_t v4x = Value(v4xpos)*retunit;
2885 Double_t v4y = Value(v4ypos)*retunit;
2886 Double_t v5x = Value(v5xpos)*retunit;
2887 Double_t v5y = Value(v5ypos)*retunit;
2888 Double_t v6x = Value(v6xpos)*retunit;
2889 Double_t v6y = Value(v6ypos)*retunit;
2890 Double_t v7x = Value(v7xpos)*retunit;
2891 Double_t v7y = Value(v7ypos)*retunit;
2892 Double_t v8x = Value(v8xpos)*retunit;
2893 Double_t v8y = Value(v8ypos)*retunit;
2894 Double_t dz = Value(dzpos)*retunit;
2897 TGeoArb8* arb8 =
new TGeoArb8(NameShort(name), dz);
2899 arb8->SetVertex(0, v1x, v1y);
2900 arb8->SetVertex(1, v2x, v2y);
2901 arb8->SetVertex(2, v3x, v3y);
2902 arb8->SetVertex(3, v4x, v4y);
2903 arb8->SetVertex(4, v5x, v5y);
2904 arb8->SetVertex(5, v6x, v6y);
2905 arb8->SetVertex(6, v7x, v7y);
2906 arb8->SetVertex(7, v8x, v8y);
2908 fsolmap[name.Data()] = arb8;
2921 XMLNodePointer_t TGDMLParse::Tube(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
2923 TString lunit = fDefault_lunit.c_str();
2924 TString aunit = fDefault_aunit.c_str();
2928 TString startphi =
"0";
2929 TString deltaphi =
"0";
2935 tempattr = gdml->GetAttrName(attr);
2938 if (tempattr ==
"name") {
2939 name = gdml->GetAttrValue(attr);
2940 }
else if (tempattr ==
"rmin") {
2941 rmin = gdml->GetAttrValue(attr);
2942 }
else if (tempattr ==
"rmax") {
2943 rmax = gdml->GetAttrValue(attr);
2944 }
else if (tempattr ==
"z") {
2945 z = gdml->GetAttrValue(attr);
2946 }
else if (tempattr ==
"lunit") {
2947 lunit = gdml->GetAttrValue(attr);
2948 }
else if (tempattr ==
"aunit") {
2949 aunit = gdml->GetAttrValue(attr);
2950 }
else if (tempattr ==
"startphi") {
2951 startphi = gdml->GetAttrValue(attr);
2952 }
else if (tempattr ==
"deltaphi") {
2953 deltaphi = gdml->GetAttrValue(attr);
2956 attr = gdml->GetNextAttr(attr);
2959 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
2960 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
2963 Double_t retlunit = GetScaleVal(lunit);
2964 Double_t retaunit = GetScaleVal(aunit);
2966 Double_t rminline = Value(rmin)*retlunit;
2967 Double_t rmaxline = Value(rmax)*retlunit;
2968 Double_t zline = Value(z)*retlunit;
2969 Double_t startphideg = Value(startphi)*retaunit;
2970 Double_t deltaphideg = Value(deltaphi)*retaunit;
2971 Double_t endphideg = startphideg + deltaphideg;
2973 TGeoShape *tube = 0;
2974 if (deltaphideg < 360.)
2975 tube =
new TGeoTubeSeg(NameShort(name), rminline,
2981 tube =
new TGeoTube(NameShort(name), rminline,
2984 fsolmap[name.Data()] = tube;
2997 XMLNodePointer_t TGDMLParse::CutTube(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
2999 TString lunit = fDefault_lunit.c_str();
3000 TString aunit = fDefault_aunit.c_str();
3004 TString startphi =
"0";
3005 TString deltaphi =
"0";
3009 TString highX =
"0";
3010 TString highY =
"0";
3011 TString highZ =
"0";
3017 tempattr = gdml->GetAttrName(attr);
3020 if (tempattr ==
"name") {
3021 name = gdml->GetAttrValue(attr);
3022 }
else if (tempattr ==
"rmin") {
3023 rmin = gdml->GetAttrValue(attr);
3024 }
else if (tempattr ==
"rmax") {
3025 rmax = gdml->GetAttrValue(attr);
3026 }
else if (tempattr ==
"z") {
3027 z = gdml->GetAttrValue(attr);
3028 }
else if (tempattr ==
"lunit") {
3029 lunit = gdml->GetAttrValue(attr);
3030 }
else if (tempattr ==
"aunit") {
3031 aunit = gdml->GetAttrValue(attr);
3032 }
else if (tempattr ==
"startphi") {
3033 startphi = gdml->GetAttrValue(attr);
3034 }
else if (tempattr ==
"deltaphi") {
3035 deltaphi = gdml->GetAttrValue(attr);
3036 }
else if (tempattr ==
"lowx") {
3037 lowX = gdml->GetAttrValue(attr);
3038 }
else if (tempattr ==
"lowy") {
3039 lowY = gdml->GetAttrValue(attr);
3040 }
else if (tempattr ==
"lowz") {
3041 lowZ = gdml->GetAttrValue(attr);
3042 }
else if (tempattr ==
"highx") {
3043 highX = gdml->GetAttrValue(attr);
3044 }
else if (tempattr ==
"highy") {
3045 highY = gdml->GetAttrValue(attr);
3046 }
else if (tempattr ==
"highz") {
3047 highZ = gdml->GetAttrValue(attr);
3050 attr = gdml->GetNextAttr(attr);
3053 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3054 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
3057 Double_t retlunit = GetScaleVal(lunit);
3058 Double_t retaunit = GetScaleVal(aunit);
3060 Double_t rminline = Value(rmin)*retlunit;
3061 Double_t rmaxline = Value(rmax)*retlunit;
3062 Double_t zline = Value(z)*retlunit;
3063 Double_t startphiline = Value(startphi)*retaunit;
3064 Double_t deltaphiline = Value(deltaphi)*retaunit + startphiline;
3065 Double_t lowXline = Value(lowX)*retlunit;
3066 Double_t lowYline = Value(lowY)*retlunit;
3067 Double_t lowZline = Value(lowZ)*retlunit;
3068 Double_t highXline = Value(highX)*retlunit;
3069 Double_t highYline = Value(highY)*retlunit;
3070 Double_t highZline = Value(highZ)*retlunit;
3073 TGeoCtub* cuttube =
new TGeoCtub(NameShort(name), rminline,
3086 fsolmap[name.Data()] = cuttube;
3099 XMLNodePointer_t TGDMLParse::Cone(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
3101 TString lunit = fDefault_lunit.c_str();
3102 TString aunit = fDefault_aunit.c_str();
3103 TString rmin1 =
"0";
3104 TString rmax1 =
"0";
3105 TString rmin2 =
"0";
3106 TString rmax2 =
"0";
3108 TString startphi =
"0";
3109 TString deltaphi =
"0";
3115 tempattr = gdml->GetAttrName(attr);
3118 if (tempattr ==
"name") {
3119 name = gdml->GetAttrValue(attr);
3120 }
else if (tempattr ==
"rmin1") {
3121 rmin1 = gdml->GetAttrValue(attr);
3122 }
else if (tempattr ==
"rmax1") {
3123 rmax1 = gdml->GetAttrValue(attr);
3124 }
else if (tempattr ==
"rmin2") {
3125 rmin2 = gdml->GetAttrValue(attr);
3126 }
else if (tempattr ==
"rmax2") {
3127 rmax2 = gdml->GetAttrValue(attr);
3128 }
else if (tempattr ==
"z") {
3129 z = gdml->GetAttrValue(attr);
3130 }
else if (tempattr ==
"lunit") {
3131 lunit = gdml->GetAttrValue(attr);
3132 }
else if (tempattr ==
"aunit") {
3133 aunit = gdml->GetAttrValue(attr);
3134 }
else if (tempattr ==
"startphi") {
3135 startphi = gdml->GetAttrValue(attr);
3136 }
else if (tempattr ==
"deltaphi") {
3137 deltaphi = gdml->GetAttrValue(attr);
3140 attr = gdml->GetNextAttr(attr);
3143 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3144 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
3147 Double_t retlunit = GetScaleVal(lunit);
3148 Double_t retaunit = GetScaleVal(aunit);
3150 Double_t rmin1line = Value(rmin1)*retlunit;
3151 Double_t rmax1line = Value(rmax1)*retlunit;
3152 Double_t rmin2line = Value(rmin2)*retlunit;
3153 Double_t rmax2line = Value(rmax2)*retlunit;
3154 Double_t zline = Value(z)*retlunit;
3155 Double_t sphi = Value(startphi)*retaunit;
3156 Double_t dphi = Value(deltaphi)*retaunit;
3157 Double_t ephi = sphi + dphi;
3159 TGeoShape *cone = 0;
3161 cone =
new TGeoConeSeg(NameShort(name), zline / 2,
3168 cone =
new TGeoCone(NameShort(name), zline / 2,
3174 fsolmap[name.Data()] = cone;
3187 XMLNodePointer_t TGDMLParse::Trap(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
3189 TString lunit = fDefault_lunit.c_str();
3190 TString aunit = fDefault_aunit.c_str();
3199 TString theta =
"0";
3200 TString alpha1 =
"0";
3201 TString alpha2 =
"0";
3207 tempattr = gdml->GetAttrName(attr);
3210 if (tempattr ==
"name") {
3211 name = gdml->GetAttrValue(attr);
3212 }
else if (tempattr ==
"x1") {
3213 x1 = gdml->GetAttrValue(attr);
3214 }
else if (tempattr ==
"x2") {
3215 x2 = gdml->GetAttrValue(attr);
3216 }
else if (tempattr ==
"x3") {
3217 x3 = gdml->GetAttrValue(attr);
3218 }
else if (tempattr ==
"x4") {
3219 x4 = gdml->GetAttrValue(attr);
3220 }
else if (tempattr ==
"y1") {
3221 y1 = gdml->GetAttrValue(attr);
3222 }
else if (tempattr ==
"y2") {
3223 y2 = gdml->GetAttrValue(attr);
3224 }
else if (tempattr ==
"z") {
3225 z = gdml->GetAttrValue(attr);
3226 }
else if (tempattr ==
"lunit") {
3227 lunit = gdml->GetAttrValue(attr);
3228 }
else if (tempattr ==
"aunit") {
3229 aunit = gdml->GetAttrValue(attr);
3230 }
else if (tempattr ==
"phi") {
3231 phi = gdml->GetAttrValue(attr);
3232 }
else if (tempattr ==
"theta") {
3233 theta = gdml->GetAttrValue(attr);
3234 }
else if (tempattr ==
"alpha1") {
3235 alpha1 = gdml->GetAttrValue(attr);
3236 }
else if (tempattr ==
"alpha2") {
3237 alpha2 = gdml->GetAttrValue(attr);
3240 attr = gdml->GetNextAttr(attr);
3243 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3244 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
3247 Double_t retlunit = GetScaleVal(lunit);
3248 Double_t retaunit = GetScaleVal(aunit);
3250 Double_t x1line = Value(x1)*retlunit;
3251 Double_t x2line = Value(x2)*retlunit;
3252 Double_t x3line = Value(x3)*retlunit;
3253 Double_t x4line = Value(x4)*retlunit;
3254 Double_t y1line = Value(y1)*retlunit;
3255 Double_t y2line = Value(y2)*retlunit;
3256 Double_t zline = Value(z)*retlunit;
3257 Double_t philine = Value(phi)*retaunit;
3258 Double_t thetaline = Value(theta)*retaunit;
3259 Double_t alpha1line = Value(alpha1)*retaunit;
3260 Double_t alpha2line = Value(alpha2)*retaunit;
3262 TGeoTrap* trap =
new TGeoTrap(NameShort(name), zline / 2,
3274 fsolmap[name.Data()] = trap;
3287 XMLNodePointer_t TGDMLParse::Trd(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
3289 TString lunit = fDefault_lunit.c_str();
3300 tempattr = gdml->GetAttrName(attr);
3303 if (tempattr ==
"name") {
3304 name = gdml->GetAttrValue(attr);
3305 }
else if (tempattr ==
"x1") {
3306 x1 = gdml->GetAttrValue(attr);
3307 }
else if (tempattr ==
"x2") {
3308 x2 = gdml->GetAttrValue(attr);
3309 }
else if (tempattr ==
"y1") {
3310 y1 = gdml->GetAttrValue(attr);
3311 }
else if (tempattr ==
"y2") {
3312 y2 = gdml->GetAttrValue(attr);
3313 }
else if (tempattr ==
"z") {
3314 z = gdml->GetAttrValue(attr);
3315 }
else if (tempattr ==
"lunit") {
3316 lunit = gdml->GetAttrValue(attr);
3319 attr = gdml->GetNextAttr(attr);
3322 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3323 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
3326 Double_t retlunit = GetScaleVal(lunit);
3328 Double_t x1line = Value(x1)*retlunit;
3329 Double_t x2line = Value(x2)*retlunit;
3330 Double_t y1line = Value(y1)*retlunit;
3331 Double_t y2line = Value(y2)*retlunit;
3332 Double_t zline = Value(z)*retlunit;
3334 TGeoTrd2* trd =
new TGeoTrd2(NameShort(name),
3341 fsolmap[name.Data()] = trd;
3355 XMLNodePointer_t TGDMLParse::Polycone(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
3357 TString lunit = fDefault_lunit.c_str();
3358 TString aunit = fDefault_aunit.c_str();
3362 TString startphi =
"0";
3363 TString deltaphi =
"0";
3369 tempattr = gdml->GetAttrName(attr);
3372 if (tempattr ==
"name") {
3373 name = gdml->GetAttrValue(attr);
3374 }
else if (tempattr ==
"lunit") {
3375 lunit = gdml->GetAttrValue(attr);
3376 }
else if (tempattr ==
"aunit") {
3377 aunit = gdml->GetAttrValue(attr);
3378 }
else if (tempattr ==
"startphi") {
3379 startphi = gdml->GetAttrValue(attr);
3380 }
else if (tempattr ==
"deltaphi") {
3381 deltaphi = gdml->GetAttrValue(attr);
3383 attr = gdml->GetNextAttr(attr);
3386 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3387 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
3390 Double_t retlunit = GetScaleVal(lunit);
3391 Double_t retaunit = GetScaleVal(aunit);
3395 XMLNodePointer_t child = gdml->GetChild(node);
3398 while (child != 0) {
3399 numplanes = numplanes + 1;
3400 child = gdml->GetNext(child);
3406 double ** table =
new double*[numplanes];
3407 for (i = 0; i < numplanes; i++) {
3408 table[i] =
new double[cols];
3411 child = gdml->GetChild(node);
3414 while (child != 0) {
3415 if (strcmp(gdml->GetNodeName(child),
"zplane") == 0) {
3417 Double_t rminline = 0;
3418 Double_t rmaxline = 0;
3421 attr = gdml->GetFirstAttr(child);
3424 tempattr = gdml->GetAttrName(attr);
3427 if (tempattr ==
"rmin") {
3428 rmin = gdml->GetAttrValue(attr);
3429 rminline = Value(rmin)*retlunit;
3430 table[planeno][0] = rminline;
3431 }
else if (tempattr ==
"rmax") {
3432 rmax = gdml->GetAttrValue(attr);
3433 rmaxline = Value(rmax)*retlunit;
3434 table[planeno][1] = rmaxline;
3435 }
else if (tempattr ==
"z") {
3436 z = gdml->GetAttrValue(attr);
3437 zline = Value(z)*retlunit;
3438 table[planeno][2] = zline;
3440 attr = gdml->GetNextAttr(attr);
3443 planeno = planeno + 1;
3444 child = gdml->GetNext(child);
3447 Double_t startphiline = Value(startphi)*retaunit;
3448 Double_t deltaphiline = Value(deltaphi)*retaunit;
3450 TGeoPcon* poly =
new TGeoPcon(NameShort(name),
3456 for (
int j = 0; j < numplanes; j++) {
3457 poly->DefineSection(zno, table[j][2], table[j][0], table[j][1]);
3461 fsolmap[name.Data()] = poly;
3462 for (i = 0; i < numplanes; i++) {
3478 XMLNodePointer_t TGDMLParse::Polyhedra(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
3480 TString lunit = fDefault_lunit.c_str();
3481 TString aunit = fDefault_aunit.c_str();
3485 TString startphi =
"0";
3486 TString deltaphi =
"0";
3487 TString numsides =
"1";
3493 tempattr = gdml->GetAttrName(attr);
3496 if (tempattr ==
"name") {
3497 name = gdml->GetAttrValue(attr);
3498 }
else if (tempattr ==
"lunit") {
3499 lunit = gdml->GetAttrValue(attr);
3500 }
else if (tempattr ==
"aunit") {
3501 aunit = gdml->GetAttrValue(attr);
3502 }
else if (tempattr ==
"startphi") {
3503 startphi = gdml->GetAttrValue(attr);
3504 }
else if (tempattr ==
"deltaphi") {
3505 deltaphi = gdml->GetAttrValue(attr);
3506 }
else if (tempattr ==
"numsides") {
3507 numsides = gdml->GetAttrValue(attr);
3510 attr = gdml->GetNextAttr(attr);
3513 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3514 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
3517 Double_t retlunit = GetScaleVal(lunit);
3518 Double_t retaunit = GetScaleVal(aunit);
3522 XMLNodePointer_t child = gdml->GetChild(node);
3525 while (child != 0) {
3526 numplanes = numplanes + 1;
3527 child = gdml->GetNext(child);
3533 double ** table =
new double*[numplanes];
3534 for (i = 0; i < numplanes; i++) {
3535 table[i] =
new double[cols];
3538 child = gdml->GetChild(node);
3541 while (child != 0) {
3542 if (strcmp(gdml->GetNodeName(child),
"zplane") == 0) {
3544 Double_t rminline = 0;
3545 Double_t rmaxline = 0;
3547 attr = gdml->GetFirstAttr(child);
3550 tempattr = gdml->GetAttrName(attr);
3553 if (tempattr ==
"rmin") {
3554 rmin = gdml->GetAttrValue(attr);
3555 rminline = Value(rmin)*retlunit;
3556 table[planeno][0] = rminline;
3557 }
else if (tempattr ==
"rmax") {
3558 rmax = gdml->GetAttrValue(attr);
3559 rmaxline = Value(rmax)*retlunit;
3560 table[planeno][1] = rmaxline;
3561 }
else if (tempattr ==
"z") {
3562 z = gdml->GetAttrValue(attr);
3563 zline = Value(z)*retlunit;
3564 table[planeno][2] = zline;
3567 attr = gdml->GetNextAttr(attr);
3570 planeno = planeno + 1;
3571 child = gdml->GetNext(child);
3574 Double_t startphiline = Value(startphi)*retaunit;
3575 Double_t deltaphiline = Value(deltaphi)*retaunit;
3576 Int_t numsidesline = (int)Value(numsides);
3578 TGeoPgon* polyg =
new TGeoPgon(NameShort(name),
3585 for (
int j = 0; j < numplanes; j++) {
3586 polyg->DefineSection(zno, table[j][2], table[j][0], table[j][1]);
3590 fsolmap[name.Data()] = polyg;
3591 for (i = 0; i < numplanes; i++) {
3607 XMLNodePointer_t TGDMLParse::Sphere(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
3609 TString lunit = fDefault_lunit.c_str();
3610 TString aunit = fDefault_aunit.c_str();
3613 TString startphi =
"0";
3614 TString deltaphi =
"0";
3615 TString starttheta =
"0";
3616 TString deltatheta =
"0";
3621 tempattr = gdml->GetAttrName(attr);
3624 if (tempattr ==
"name") {
3625 name = gdml->GetAttrValue(attr);
3626 }
else if (tempattr ==
"rmin") {
3627 rmin = gdml->GetAttrValue(attr);
3628 }
else if (tempattr ==
"rmax") {
3629 rmax = gdml->GetAttrValue(attr);
3630 }
else if (tempattr ==
"lunit") {
3631 lunit = gdml->GetAttrValue(attr);
3632 }
else if (tempattr ==
"aunit") {
3633 aunit = gdml->GetAttrValue(attr);
3634 }
else if (tempattr ==
"startphi") {
3635 startphi = gdml->GetAttrValue(attr);
3636 }
else if (tempattr ==
"deltaphi") {
3637 deltaphi = gdml->GetAttrValue(attr);
3638 }
else if (tempattr ==
"starttheta") {
3639 starttheta = gdml->GetAttrValue(attr);
3640 }
else if (tempattr ==
"deltatheta") {
3641 deltatheta = gdml->GetAttrValue(attr);
3644 attr = gdml->GetNextAttr(attr);
3647 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3648 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
3651 Double_t retlunit = GetScaleVal(lunit);
3652 Double_t retaunit = GetScaleVal(aunit);
3654 Double_t rminline = Value(rmin)*retlunit;
3655 Double_t rmaxline = Value(rmax)*retlunit;
3656 Double_t startphiline = Value(startphi)*retaunit;
3657 Double_t deltaphiline = startphiline+ Value(deltaphi)*retaunit;
3658 Double_t startthetaline = Value(starttheta)*retaunit;
3659 Double_t deltathetaline = startthetaline + Value(deltatheta)*retaunit;
3661 TGeoSphere* sphere =
new TGeoSphere(NameShort(name),
3669 fsolmap[name.Data()] = sphere;
3682 XMLNodePointer_t TGDMLParse::Torus(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
3684 TString lunit = fDefault_lunit.c_str();
3685 TString aunit = fDefault_aunit.c_str();
3689 TString startphi =
"0";
3690 TString deltaphi =
"0";
3696 tempattr = gdml->GetAttrName(attr);
3699 if (tempattr ==
"name") {
3700 name = gdml->GetAttrValue(attr);
3701 }
else if (tempattr ==
"rmin") {
3702 rmin = gdml->GetAttrValue(attr);
3703 }
else if (tempattr ==
"rmax") {
3704 rmax = gdml->GetAttrValue(attr);
3705 }
else if (tempattr ==
"rtor") {
3706 rtor = gdml->GetAttrValue(attr);
3707 }
else if (tempattr ==
"lunit") {
3708 lunit = gdml->GetAttrValue(attr);
3709 }
else if (tempattr ==
"aunit") {
3710 aunit = gdml->GetAttrValue(attr);
3711 }
else if (tempattr ==
"startphi") {
3712 startphi = gdml->GetAttrValue(attr);
3713 }
else if (tempattr ==
"deltaphi") {
3714 deltaphi = gdml->GetAttrValue(attr);
3717 attr = gdml->GetNextAttr(attr);
3720 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3721 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
3724 Double_t retlunit = GetScaleVal(lunit);
3725 Double_t retaunit = GetScaleVal(aunit);
3727 Double_t rminline = Value(rmin)*retlunit;
3728 Double_t rmaxline = Value(rmax)*retlunit;
3729 Double_t rtorline = Value(rtor)*retlunit;
3730 Double_t startphiline = Value(startphi)*retaunit;
3731 Double_t deltaphiline = Value(deltaphi)*retaunit;
3734 TGeoTorus* torus =
new TGeoTorus(NameShort(name), rtorline,
3740 fsolmap[name.Data()] = torus;
3753 XMLNodePointer_t TGDMLParse::Hype(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
3755 TString lunit = fDefault_lunit.c_str();
3756 TString aunit = fDefault_aunit.c_str();
3761 TString outst =
"0";
3766 tempattr = gdml->GetAttrName(attr);
3769 if (tempattr ==
"name") {
3770 name = gdml->GetAttrValue(attr);
3771 }
else if (tempattr ==
"rmin") {
3772 rmin = gdml->GetAttrValue(attr);
3773 }
else if (tempattr ==
"rmax") {
3774 rmax = gdml->GetAttrValue(attr);
3775 }
else if (tempattr ==
"z") {
3776 z = gdml->GetAttrValue(attr);
3777 }
else if (tempattr ==
"lunit") {
3778 lunit = gdml->GetAttrValue(attr);
3779 }
else if (tempattr ==
"aunit") {
3780 aunit = gdml->GetAttrValue(attr);
3781 }
else if (tempattr ==
"inst") {
3782 inst = gdml->GetAttrValue(attr);
3783 }
else if (tempattr ==
"outst") {
3784 outst = gdml->GetAttrValue(attr);
3787 attr = gdml->GetNextAttr(attr);
3790 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3791 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
3794 Double_t retlunit = GetScaleVal(lunit);
3795 Double_t retaunit = GetScaleVal(aunit);
3797 Double_t rminline = Value(rmin)*retlunit;
3798 Double_t rmaxline = Value(rmax)*retlunit;
3799 Double_t zline = Value(z)*retlunit;
3800 Double_t instline = Value(inst)*retaunit;
3801 Double_t outstline = Value(outst)*retaunit;
3804 TGeoHype* hype =
new TGeoHype(NameShort(name),
3811 fsolmap[name.Data()] = hype;
3824 XMLNodePointer_t TGDMLParse::Para(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
3826 TString lunit = fDefault_lunit.c_str();
3827 TString aunit = fDefault_aunit.c_str();
3832 TString theta =
"0";
3833 TString alpha =
"0";
3839 tempattr = gdml->GetAttrName(attr);
3842 if (tempattr ==
"name") {
3843 name = gdml->GetAttrValue(attr);
3844 }
else if (tempattr ==
"x") {
3845 x = gdml->GetAttrValue(attr);
3846 }
else if (tempattr ==
"y") {
3847 y = gdml->GetAttrValue(attr);
3848 }
else if (tempattr ==
"z") {
3849 z = gdml->GetAttrValue(attr);
3850 }
else if (tempattr ==
"lunit") {
3851 lunit = gdml->GetAttrValue(attr);
3852 }
else if (tempattr ==
"aunit") {
3853 aunit = gdml->GetAttrValue(attr);
3854 }
else if (tempattr ==
"phi") {
3855 phi = gdml->GetAttrValue(attr);
3856 }
else if (tempattr ==
"theta") {
3857 theta = gdml->GetAttrValue(attr);
3858 }
else if (tempattr ==
"alpha") {
3859 alpha = gdml->GetAttrValue(attr);
3862 attr = gdml->GetNextAttr(attr);
3865 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3866 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
3869 Double_t retlunit = GetScaleVal(lunit);
3870 Double_t retaunit = GetScaleVal(aunit);
3872 Double_t xline = Value(x)*retlunit;
3873 Double_t yline = Value(y)*retlunit;
3874 Double_t zline = Value(z)*retlunit;
3875 Double_t philine = Value(phi)*retaunit;
3876 Double_t alphaline = Value(alpha)*retaunit;
3877 Double_t thetaline = Value(theta)*retaunit;
3880 TGeoPara* para =
new TGeoPara(NameShort(name),
3888 fsolmap[name.Data()] = para;
3901 XMLNodePointer_t TGDMLParse::TwistTrap(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
3903 TString lunit = fDefault_lunit.c_str();
3904 TString aunit = fDefault_aunit.c_str();
3913 TString theta =
"0";
3914 TString alpha1 =
"0";
3915 TString alpha2 =
"0";
3916 TString twist =
"0";
3922 tempattr = gdml->GetAttrName(attr);
3925 if (tempattr ==
"name") {
3926 name = gdml->GetAttrValue(attr);
3927 }
else if (tempattr ==
"x1") {
3928 x1 = gdml->GetAttrValue(attr);
3929 }
else if (tempattr ==
"x2") {
3930 x2 = gdml->GetAttrValue(attr);
3931 }
else if (tempattr ==
"x3") {
3932 x3 = gdml->GetAttrValue(attr);
3933 }
else if (tempattr ==
"x4") {
3934 x4 = gdml->GetAttrValue(attr);
3935 }
else if (tempattr ==
"y1") {
3936 y1 = gdml->GetAttrValue(attr);
3937 }
else if (tempattr ==
"y2") {
3938 y2 = gdml->GetAttrValue(attr);
3939 }
else if (tempattr ==
"z") {
3940 z = gdml->GetAttrValue(attr);
3941 }
else if (tempattr ==
"lunit") {
3942 lunit = gdml->GetAttrValue(attr);
3943 }
else if (tempattr ==
"aunit") {
3944 aunit = gdml->GetAttrValue(attr);
3945 }
else if (tempattr ==
"phi") {
3946 phi = gdml->GetAttrValue(attr);
3947 }
else if (tempattr ==
"theta") {
3948 theta = gdml->GetAttrValue(attr);
3949 }
else if (tempattr ==
"alph") {
3950 alpha1 = gdml->GetAttrValue(attr);
3954 }
else if (tempattr ==
"phitwist") {
3955 twist = gdml->GetAttrValue(attr);
3958 attr = gdml->GetNextAttr(attr);
3961 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
3962 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
3965 Double_t retlunit = GetScaleVal(lunit);
3966 Double_t retaunit = GetScaleVal(aunit);
3968 Double_t x1line = Value(x1)*retlunit;
3969 Double_t x2line = Value(x2)*retlunit;
3970 Double_t x3line = Value(x3)*retlunit;
3971 Double_t x4line = Value(x4)*retlunit;
3972 Double_t y1line = Value(y1)*retlunit;
3973 Double_t y2line = Value(y2)*retlunit;
3974 Double_t zline = Value(z)*retlunit;
3975 Double_t philine = Value(phi)*retaunit;
3976 Double_t thetaline = Value(theta)*retaunit;
3977 Double_t alpha1line = Value(alpha1)*retaunit;
3978 Double_t alpha2line = Value(alpha2)*retaunit;
3979 Double_t twistline = Value(twist)*retaunit;
3982 TGeoGtra* twtrap =
new TGeoGtra(NameShort(name), zline / 2,
3995 fsolmap[name.Data()] = twtrap;
4009 XMLNodePointer_t TGDMLParse::ElTube(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
4011 TString lunit = fDefault_lunit.c_str();
4020 tempattr = gdml->GetAttrName(attr);
4023 if (tempattr ==
"name") {
4024 name = gdml->GetAttrValue(attr);
4025 }
else if (tempattr ==
"dx") {
4026 xpos = gdml->GetAttrValue(attr);
4027 }
else if (tempattr ==
"dy") {
4028 ypos = gdml->GetAttrValue(attr);
4029 }
else if (tempattr ==
"dz") {
4030 zpos = gdml->GetAttrValue(attr);
4031 }
else if (tempattr ==
"lunit") {
4032 lunit = gdml->GetAttrValue(attr);
4035 attr = gdml->GetNextAttr(attr);
4038 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
4039 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
4042 Double_t retunit = GetScaleVal(lunit);
4044 Double_t xline = Value(xpos)*retunit;
4045 Double_t yline = Value(ypos)*retunit;
4046 Double_t zline = Value(zpos)*retunit;
4048 TGeoEltu* eltu =
new TGeoEltu(NameShort(name), xline,
4052 fsolmap[name.Data()] = eltu;
4064 XMLNodePointer_t TGDMLParse::Orb(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
4066 TString lunit = fDefault_lunit.c_str();
4073 tempattr = gdml->GetAttrName(attr);
4076 if (tempattr ==
"name") {
4077 name = gdml->GetAttrValue(attr);
4078 }
else if (tempattr ==
"r") {
4079 r = gdml->GetAttrValue(attr);
4080 }
else if (tempattr ==
"lunit") {
4081 lunit = gdml->GetAttrValue(attr);
4084 attr = gdml->GetNextAttr(attr);
4087 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
4088 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
4091 Double_t retunit = GetScaleVal(lunit);
4093 Double_t rline = Value(r)*retunit;
4095 TGeoSphere* orb =
new TGeoSphere(NameShort(name), 0, rline, 0, 180, 0, 360);
4097 fsolmap[name.Data()] = orb;
4114 XMLNodePointer_t TGDMLParse::Xtru(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
4116 TString lunit = fDefault_lunit.c_str();
4120 TString zorder =
"0";
4124 TString scale =
"0";
4130 tempattr = gdml->GetAttrName(attr);
4133 if (tempattr ==
"name") {
4134 name = gdml->GetAttrValue(attr);
4135 }
else if (tempattr ==
"lunit") {
4136 lunit = gdml->GetAttrValue(attr);
4139 attr = gdml->GetNextAttr(attr);
4142 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
4143 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
4146 Double_t retlunit = GetScaleVal(lunit);
4150 XMLNodePointer_t child = gdml->GetChild(node);
4154 while (child != 0) {
4155 tempattr = gdml->GetNodeName(child);
4157 if (tempattr ==
"twoDimVertex") {
4158 noverts = noverts + 1;
4159 }
else if (tempattr ==
"section") {
4160 nosects = nosects + 1;
4163 child = gdml->GetNext(child);
4169 double *vertx =
new double[noverts];
4170 double *verty =
new double[noverts];
4172 double ** section =
new double*[nosects];
4173 for (i = 0; i < nosects; i++) {
4174 section[i] =
new double[cols];
4177 child = gdml->GetChild(node);
4181 while (child != 0) {
4182 if (strcmp(gdml->GetNodeName(child),
"twoDimVertex") == 0) {
4186 attr = gdml->GetFirstAttr(child);
4189 tempattr = gdml->GetAttrName(attr);
4191 if (tempattr ==
"x") {
4192 x = gdml->GetAttrValue(attr);
4193 xline = Value(x)*retlunit;
4194 vertx[vert] = xline;
4195 }
else if (tempattr ==
"y") {
4196 y = gdml->GetAttrValue(attr);
4197 yline = Value(y)*retlunit;
4198 verty[vert] = yline;
4201 attr = gdml->GetNextAttr(attr);
4207 else if (strcmp(gdml->GetNodeName(child),
"section") == 0) {
4209 Double_t zposline = 0;
4210 Double_t xoffline = 0;
4211 Double_t yoffline = 0;
4213 attr = gdml->GetFirstAttr(child);
4216 tempattr = gdml->GetAttrName(attr);
4218 if (tempattr ==
"zOrder") {
4219 zorder = gdml->GetAttrValue(attr);
4220 section[sect][0] = Value(zorder);
4221 }
else if (tempattr ==
"zPosition") {
4222 zpos = gdml->GetAttrValue(attr);
4223 zposline = Value(zpos)*retlunit;
4224 section[sect][1] = zposline;
4225 }
else if (tempattr ==
"xOffset") {
4226 xoff = gdml->GetAttrValue(attr);
4227 xoffline = Value(xoff)*retlunit;
4228 section[sect][2] = xoffline;
4229 }
else if (tempattr ==
"yOffset") {
4230 yoff = gdml->GetAttrValue(attr);
4231 yoffline = Value(yoff)*retlunit;
4232 section[sect][3] = yoffline;
4233 }
else if (tempattr ==
"scalingFactor") {
4234 scale = gdml->GetAttrValue(attr);
4235 section[sect][4] = Value(scale);
4238 attr = gdml->GetNextAttr(attr);
4243 child = gdml->GetNext(child);
4246 TGeoXtru* xtru =
new TGeoXtru(nosects);
4247 xtru->SetName(NameShort(name));
4248 xtru->DefinePolygon(vert, vertx, verty);
4250 for (
int j = 0; j < sect; j++) {
4251 xtru->DefineSection((
int)section[j][0], section[j][1], section[j][2], section[j][3], section[j][4]);
4254 fsolmap[name.Data()] = xtru;
4257 for (i = 0; i < nosects; i++) {
4258 delete [] section[i];
4274 XMLNodePointer_t TGDMLParse::Reflection(TXMLEngine* gdml, XMLNodePointer_t node, XMLAttrPointer_t attr)
4276 std::cout <<
"WARNING! The reflectedSolid is obsolete! Use scale transformation instead!" << std::endl;
4288 TString solid =
"0";
4293 tempattr = gdml->GetAttrName(attr);
4296 if (tempattr ==
"name") {
4297 name = gdml->GetAttrValue(attr);
4298 }
else if (tempattr ==
"sx") {
4299 sx = gdml->GetAttrValue(attr);
4300 }
else if (tempattr ==
"sy") {
4301 sy = gdml->GetAttrValue(attr);
4302 }
else if (tempattr ==
"sz") {
4303 sz = gdml->GetAttrValue(attr);
4304 }
else if (tempattr ==
"rx") {
4305 rx = gdml->GetAttrValue(attr);
4306 }
else if (tempattr ==
"ry") {
4307 ry = gdml->GetAttrValue(attr);
4308 }
else if (tempattr ==
"rz") {
4309 rz = gdml->GetAttrValue(attr);
4310 }
else if (tempattr ==
"dx") {
4311 dx = gdml->GetAttrValue(attr);
4312 }
else if (tempattr ==
"dy") {
4313 dy = gdml->GetAttrValue(attr);
4314 }
else if (tempattr ==
"dz") {
4315 dz = gdml->GetAttrValue(attr);
4316 }
else if (tempattr ==
"solid") {
4317 solid = gdml->GetAttrValue(attr);
4319 attr = gdml->GetNextAttr(attr);
4322 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
4323 name = TString::Format(
"%s_%s", name.Data(), fCurrentFile);
4325 if ((strcmp(fCurrentFile, fStartFile)) != 0) {
4326 solid = TString::Format(
"%s_%s", solid.Data(), fCurrentFile);
4329 TGeoRotation* rot =
new TGeoRotation();
4330 rot->RotateZ(-(Value(rz)));
4331 rot->RotateY(-(Value(ry)));
4332 rot->RotateX(-(Value(rx)));
4334 if (atoi(sx) == -1) {
4335 rot->ReflectX(kTRUE);
4337 if (atoi(sy) == -1) {
4338 rot->ReflectY(kTRUE);
4340 if (atoi(sz) == -1) {
4341 rot->ReflectZ(kTRUE);
4344 TGeoCombiTrans* relf_matx =
new TGeoCombiTrans(Value(dx), Value(dy), Value(dz), rot);
4346 TGDMLRefl* reflsol =
new TGDMLRefl(NameShort(name), solid, relf_matx);
4347 freflsolidmap[name.Data()] = reflsol;
4348 freflectmap[name.Data()] = solid;
4366 ClassImp(TGDMLRefl);
4371 TGDMLRefl::TGDMLRefl(
const char* name,
const char* solid, TGeoMatrix* matrix)
4381 TGeoMatrix* TGDMLRefl::GetMatrix()