9 #include "ERGeoComponent.h" 11 #include "TGeoMedium.h" 12 #include "TGeoManager.h" 16 #include "FairGeoLoader.h" 17 #include "FairGeoMedia.h" 18 #include "FairGeoBuilder.h" 19 #include "FairGeoMedium.h" 20 #include "FairGeoInterface.h" 21 #include "FairLogger.h" 23 ERGeoComponent::ERGeoComponent(
const TString& typeFromXML,
const TString&
id)
24 : TNamed(typeFromXML + id, typeFromXML + id),
31 ERGeoComponent::ERGeoComponent(
const TString& name,
const TVector3& position,
32 const TVector3& rotation)
33 : TNamed(name, name), fVolumeName(name), fPosition(position)
35 fRotation.RotateX(rotation.X());
36 fRotation.RotateY(rotation.Y());
37 fRotation.RotateZ(rotation.Z());
40 ERGeoComponent::ERGeoComponent(
const TString& typeFromXML,
const TString&
id,
const TVector3& position,
41 const TVector3& rotation)
42 : TNamed(typeFromXML + id, typeFromXML + id), fType(typeFromXML),
43 fComponentId(id), fVolumeName(id), fPosition(position)
45 fRotation.RotateX(rotation.X());
46 fRotation.RotateY(rotation.Y());
47 fRotation.RotateZ(rotation.Z());
50 void ERGeoComponent::SetRotation(
const TVector3& rotation) {
52 fRotation.RotateX(rotation.X());
53 fRotation.RotateY(rotation.Y());
54 fRotation.RotateZ(rotation.Z());
57 TGeoMedium* ERGeoComponent::CreateMaterial(
const TString& name) {
58 FairGeoLoader* geoLoader = FairGeoLoader::Instance();
59 FairGeoInterface* geoFace = geoLoader->getGeoInterface();
60 TString geoPath = gSystem->Getenv(
"VMCWORKDIR");
61 TString medFile = geoPath +
"/geometry/media.geo";
62 geoFace->setMediaFile(medFile);
64 FairGeoMedia* geoMedia = geoFace->getMedia();
65 FairGeoBuilder* geoBuilder = geoLoader->getGeoBuilder();
66 FairGeoMedium* fairMedia = geoMedia->getMedium(name);
68 LOG(FATAL) <<
"Media " << name <<
" not found in media.geo file\n";
69 geoBuilder->createMedium(fairMedia);
70 TGeoMedium* rootMedia = gGeoManager->GetMedium(name);
72 LOG(FATAL) <<
"Media " << name <<
" not found in gGeoManager\n";
73 LOG(DEBUG) <<
"Created " << name <<
" media\n";