11 #include "ERGeoCave.h" 12 #include "FairGeoNode.h" 13 #include "FairGeoShapes.h" 14 #include "FairGeoBasicShape.h" 15 #include "FairGeoMedium.h" 27 Bool_t ERGeoCave::read(fstream& fin,FairGeoMedia* media) {
29 if (!media)
return kFALSE;
30 const Int_t maxbuf=256;
33 FairGeoMedium* medium;
36 fin.getline(buf,maxbuf);
37 if (buf[0]!=
'\0' && buf[0]!=
'/' && !fin.eof()) {
38 if (strcmp(buf,name)==0) {
41 volu->setVolumeType(kFairGeoTopNode);
43 fin.getline(buf,maxbuf);
45 FairGeoBasicShape* sh=pShapes->selectShape(shape);
46 if (sh) volu->setShape(sh);
48 fin.getline(buf,maxbuf);
49 medium=media->getMedium(buf);
51 medium=
new FairGeoMedium();
52 media->addMedium(medium);
54 volu->setMedium(medium);
56 if (sh) n=sh->readPoints(&fin,volu);
60 }
while (rc && !volu && !fin.eof());
63 masterNodes->Add(
new FairGeoNode(*volu));
72 void ERGeoCave::addRefNodes() {
74 FairGeoNode* volu=getVolume(name);
75 if (volu) masterNodes->Add(
new FairGeoNode(*volu));
78 void ERGeoCave::write(fstream& fout) {
80 fout.setf(ios::fixed,ios::floatfield);
81 FairGeoNode* volu=getVolume(name);
83 FairGeoBasicShape* sh=volu->getShapePointer();
84 FairGeoMedium* med=volu->getMedium();
86 fout<<volu->GetName()<<
'\n'<<sh->GetName()<<
'\n'<<med->GetName()<<
'\n';
87 sh->writePoints(&fout,volu);
92 void ERGeoCave::print() {
94 FairGeoNode* volu=getVolume(name);
96 FairGeoBasicShape* sh=volu->getShapePointer();
97 FairGeoMedium* med=volu->getMedium();
99 cout<<volu->GetName()<<
'\n'<<sh->GetName()<<
'\n'<<med->GetName()<<
'\n';
100 sh->printPoints(volu);