4 #include<FairGeoLoader.h>
5 #include<FairGeoInterface.h>
6 #include<FairGeoBuilder.h>
7 #include<FairGeoPcon.h>
8 #include<FairGeoMedia.h>
9 #include<TGeoCompositeShape.h>
10 #include<TGeoMatrix.h>
11 #include<TGeoVolume.h>
18 #include<TGeoManager.h>
20 #include<TGeoSphere.h>
24 #include<TGeoPhysicalNode.h>
26 #include<TApplication.h>
48 cout <<
"current node is " <<
gGeoManager->GetCurrentNavigator()->GetCurrentNode()->GetName() << endl;
49 int nnodes =
gGeoManager->GetCurrentNode()->GetNdaughters();
50 for (
int i = 0;
i < nnodes;
i++){
51 cout <<
" navigating into node " <<
i << endl;
133 char* dirc = getenv(
"VMCWORKDIR");
137 cout <<
"warning! environment variable VMCWORKDIR not found! set this variable and try again!\n";
149 outfile = dir+
"/geometry/Luminosity-Detector_misaligned-0u.root";
151 outfile = dir+
"/geometry/Luminosity-Detector.root";
152 TFile*
fi =
new TFile(outfile,
"RECREATE");
154 FairGeoLoader*
geoLoad =
new FairGeoLoader(
"TGeo",
"FairGeoLoader");
155 FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
156 geoFace->setMediaFile((dir+
"/geometry/media_pnd.geo").c_str());
157 geoFace->readMedia();
160 FairGeoMedia *
Media = geoFace->getMedia();
161 FairGeoBuilder *
geobuild=geoLoad->getGeoBuilder();
163 FairGeoMedium *FairMediumSilicon = Media->getMedium(
"silicon");
165 Int_t
nmed=geobuild->createMedium(FairMediumSilicon);
167 TGeoManager*
gGeoMan = (TGeoManager*)gROOT->FindObject(
"FAIRGeom");
169 TGeoVolume *
top =
new TGeoVolumeAssembly(
"lum");
171 gGeoMan->SetTopVolume(top);
224 gGeoMan->CloseGeometry();
226 gGeoMan->CheckOverlaps(0.001);
228 gGeoMan->PrintOverlaps();
232 gGeoMan->SetVisLevel(20);
236 cout <<
" found " <<
gGeoManager->GetListOfPhysicalNodes()->GetEntries() <<
" entries " << endl;
239 cout <<
" trying to navigate through the geometry " << endl;
240 vector<string> list_of_sensors;
245 if (lmddim.
Test_List_of_Sensors(list_of_sensors, offset)) cout <<
" testing of sensors was fine and gave an offset of " << offset << endl;
254 cout <<
" reading matrices from file into the aligned map " << endl;
256 cout <<
" loading transformation matrices from geometry into not aligned map " << endl;
258 cout <<
" writing matrices from aligned map to geometry" << endl;
260 cout <<
" reading transformation matrices from geometry once again " << endl;
267 TGeoHMatrix* matrix = lmddim.
Get_matrix(
"/lum_1/lmd_vol_vac_3/lmd_vol_ref_sys_0/lmd_vol_half_1",
false, 1,-1,-1,-1,-1,-1);
269 matrix->RotateX(90.);
271 lmddim.
Set_matrix(
"/lum_1/lmd_vol_vac_3/lmd_vol_ref_sys_0/lmd_vol_half_1", matrix, 1,-1,-1,-1,-1,-1);
273 cout <<
" the original matrix is " << endl;
274 matrix = lmddim.
Get_matrix(
"/lum_1/lmd_vol_vac_3/lmd_vol_ref_sys_0/lmd_vol_half_1",
false, 1,-1,-1,-1,-1,-1);
277 cout <<
" the aligned matrix is " << endl;
278 matrix = lmddim.
Get_matrix(
"/lum_1/lmd_vol_vac_3/lmd_vol_ref_sys_0/lmd_vol_half_1",
true, 1,-1,-1,-1,-1,-1);
281 cout <<
" testing matrices " << endl;
284 gGeoMan->RefreshPhysicalNodes();
346 TApplication myapp(
"myapp", 0, 0);
bool Test_List_of_Sensors(vector< string > list_of_sensors, int &offset)
int main(int argc, char **argv)
double plane_half_tilt_theta
double plane_half_offset_y
double plane_half_tilt_phi
string Get_List_of_Sensors(vector< string > &list_of_sensors, bool found_lmd=false, bool first_call=true)
double plane_half_tilt_psi
TGeoManager * gGeoManager
bool Read_transformation_matrices_from_geometry(bool aligned=true)
void Calc_matrix_offsets()
const bool show_beam_pipe_dummy
FairGeoBuilder * geobuild
void Generate_rootgeom(TGeoVolume &mothervol, bool misaligned=false)
TGeoMatrix * Get_matrix(int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool aligned=true)
void Write_transformation_matrices(string filename, bool aligned=true, int version_number=geometry_version)
void Read_transformation_matrices(string filename="", bool aligned=true, int version_number=geometry_version)
bool Set_matrix(string path, TGeoHMatrix *matrix, int ihalf=-1, int iplane=-1, int imodule=-1, int iside=-1, int idie=-1, int isensor=-1)
double plane_half_offset_x
static PndLmdDim & Get_instance()
FairGeoInterface * geoFace
double plane_half_offset_z
bool Write_transformation_matrices_to_geometry(bool aligned=true)
void Navigate_into(int depth=0)