FairRoot/PandaRoot
createTestSensorsTGM.C
Go to the documentation of this file.
1 {
2 
3 
4  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
5 
6  // Load this libraries
7 // gSystem->Load("libGeoBase");
8 // gSystem->Load("libParBase");
9 // gSystem->Load("libBase");
10 // gSystem->Load("libPndData");
11 // gSystem->Load("libPassive");
12 
13  TString outfile= "teststation.root";
14 // TFile* fi = new TFile(outfile,"RECREATE");
15 
16  TString mediafile = gSystem->Getenv("VMCWORKDIR");
17  mediafile+="/geometry/media_pnd.geo";
18 
19  FairGeoLoader* geoLoad = new FairGeoLoader("TGeo","FairGeoLoader");
20  FairGeoInterface *geoFace = geoLoad->getGeoInterface();
21  geoFace->setMediaFile(mediafile);
22  geoFace->readMedia();
23  geoFace->print();
24 
25  FairGeoMedia *Media = geoFace->getMedia();
26  FairGeoBuilder *geobuild=geoLoad->getGeoBuilder();
27 
28  FairGeoMedium *CbmMediumAir = Media->getMedium("air");
29  FairGeoMedium *CbmMediumSilicon = Media->getMedium("silicon");
30  FairGeoMedium *CbmMediumCarbon = Media->getMedium("carbon");
31  FairGeoMedium *CbmMediumAluminium = Media->getMedium("aluminium");
32 
33  Int_t nmed=geobuild->createMedium(CbmMediumAir);
34  nmed=geobuild->createMedium(CbmMediumSilicon);
35  nmed=geobuild->createMedium(CbmMediumCarbon);
36  nmed=geobuild->createMedium(CbmMediumAluminium);
37 
38  TGeoManager* GeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
39 
40  TGeoVolume *top = new TGeoVolumeAssembly("SiliconTestStation");
41 
42  GeoMan->SetTopVolume(top);
43 
44 
45  // materials & media
46  TGeoMaterial *matVacuum = new TGeoMaterial("vacuum",0,0,0);
47  TGeoMaterial *matSilicon = new TGeoMaterial("silicon", 28.0855, 14, 2.33);
48  TGeoMedium *medVacuum = new TGeoMedium("vacuum", 1, matVacuum);
49  TGeoMedium *medSilicon = new TGeoMedium("silicon", 2, matSilicon);
50 
51  TGeoVolumeAssembly* assamb = new TGeoVolumeAssembly("DummysensorAss");
52 
53  TGeoShape* shape = new TGeoBBox(0.96, 0.96, 0.015);
54  TGeoRotation* rot = new TGeoRotation("rot",0.,0.,0.);//2.Stelle in 10er
55  TGeoCombiTrans *trafo = new TGeoCombiTrans(0., 0., 4., rot);
56  TGeoVolume* sensor = new TGeoVolume("Module15",shape,GeoMan->GetMedium("silicon"));
57 
58  TGeoShape* shape2 = new TGeoBBox(0.96, 0.96, 0.015);
59  TGeoRotation* rot2 = new TGeoRotation("rot",90.,0.,0.);//2.Stelle in 10er
60  TGeoCombiTrans *trafo2 = new TGeoCombiTrans(0., 0., 4.5, rot2);
61  TGeoVolume* sensor2 = new TGeoVolume("Module16",shape2,GeoMan->GetMedium("silicon"));
62 
63  assamb->AddNode(sensor,0,trafo);
64  assamb->AddNode(sensor2,0,trafo2);
65  top->AddNode(assamb,0,new TGeoHMatrix());
66 cout<<""<<endl;
67 cout<<"----------------------------------------------------------"<<endl;
68 cout<<""<<endl;
69  GeoMan->Print();
70 cout<<""<<endl;
71 cout<<"----------------------------------------------------------"<<endl;
72 cout<<""<<endl;
73 
74 
75  GeoMan->CloseGeometry();
76  GeoMan->Export(outfile.Data());
77 
78 // top->Export(outfile.Data(),"top","recreate");
79 // top->Draw("ogl");
80 
81 
82 }
TGeoCombiTrans * trafo2
TGeoMedium * medSilicon
FairGeoLoader * geoLoad
FairGeoMedia * Media
TGeoCombiTrans * trafo
FairGeoMedium * CbmMediumCarbon
TGeoVolume * sensor
TGeoVolume * top
FairGeoMedium * CbmMediumAluminium
TGeoMedium * medVacuum
FairGeoMedium * CbmMediumSilicon
TGeoVolumeAssembly * assamb
TGeoMaterial * matSilicon
FairGeoBuilder * geobuild
TGeoShape * shape
TString mediafile
TGeoRotation rot2
FairGeoMedium * CbmMediumAir
TGeoMaterial * matVacuum
TGeoVolume * sensor2
TGeoShape * shape2
TGeoRotation rot
TGeoManager * GeoMan
FairGeoInterface * geoFace
TString outfile