7 #include <TObjString.h>
10 #include "Geant4GM/volumes/Factory.h"
11 #include "RootGM/volumes/Factory.h"
15 #include "G4SystemOfUnits.hh"
17 #include "G4LogicalVolume.hh"
18 #include "G4VPhysicalVolume.hh"
19 #include "G4SubtractionSolid.hh"
29 mTGeoModel(0), mHadronBeamPipeOpening(0.0), mActualCrossingAngle(0.0),
30 mStandaloneMode(
false), g4Factory(0)
40 static unsigned counter;
42 new TGeoMedium (name, ++counter,
new TGeoMaterial(name, A, Z, density));
61 mTGeoModel =
new TGeoManager(
"VC.ROOT",
"Simplified IR vacuum chamber geometry");
76 200., 200.,
eic->GetIrRegionLength() + 100.);
79 auto world =
new TGeoVolumeAssembly(
"World");
82 world->SetVisibility(kFALSE);
139 const char *fname =
"/tmp/tmp.gdml";
146 std::ifstream fin(fname);
151 TObjString ostr; ostr.SetString(str);
153 ostr.Write(
"VC.GDML");
175 double step = 5.0 *
etm::cm, zcurr = -
eic->GetIrRegionLength()/2, rprev[2] = {0.0, 0.0};
178 for( ; zcurr <=
eic->GetIrRegionLength()/2; zcurr +=
step) {
180 if (rprev[0] && rprev[1] && rcurr[0] && rcurr[1]) {
181 double xx[4] = { zcurr-
step, zcurr, zcurr, zcurr-step};
182 double yy[4] = { -rprev[0], -rcurr[0], rcurr[1], rprev[1]};
184 eic->DrawPolygon(4, xx, yy, gray,
false);
186 for(
unsigned du=0; du<2; du++)
187 rprev[du] = rcurr[du];
206 double xx[3] = {0.0, 0.0, z};
207 double nn[3] = {
cos(phi), sin(phi), 0.0}, outerR = 0.0;
212 for(
auto node =
mTGeoModel->GetCurrentNode(); ; ) {
213 auto material = node->GetVolume()->GetMaterial();
223 const double *pt =
mTGeoModel->GetCurrentPoint();
224 outerR = sqrt(pt[0]*pt[0] + pt[1]*pt[1]);
240 #if defined(_ETM2GEANT_) && defined(_VGM_)
247 TGeoManager *saveGeoManager = gGeoManager; gGeoManager = 0;
250 RootGM::Factory rtFactory;
251 rtFactory.Import(gGeoManager->GetTopNode());
254 rtFactory.Export((Geant4GM::Factory*)
g4Factory);
257 delete gGeoManager; gGeoManager = saveGeoManager;
261 G4VSolid *ptr =
solid;
262 G4VPhysicalVolume *gcut = ((Geant4GM::Factory*)
g4Factory)->World();
263 auto glog = gcut->GetLogicalVolume();
265 for(
int iq=0; iq<glog->GetNoDaughters(); iq++) {
266 auto daughter = glog->GetDaughter(iq);
269 CLHEP::Hep3Vector vv(0, 0, dz);
272 ptr =
new G4SubtractionSolid(ptr->GetName(), ptr, daughter->GetLogicalVolume()->GetSolid(),
273 daughter->GetRotation(), daughter->GetTranslation() - vv);