1
|
#include <iomanip>
|
2
|
#include <iostream>
|
3
|
#include "TGeoManager.h"
|
4
|
#include "TMath.h"
|
5
|
|
6
|
|
7
|
|
8
|
void create_collimator_geo()
|
9
|
{
|
10
|
|
11
|
TGeoRotation *fZeroRotation = new TGeoRotation();
|
12
|
|
13
|
Double_t transX = 0.;
|
14
|
Double_t transY = 0.;
|
15
|
Double_t transZ = 0.;
|
16
|
|
17
|
TGeoManager* gGeoMan = NULL;
|
18
|
|
19
|
fZeroRotation->RotateX(0.);
|
20
|
fZeroRotation->RotateY(0.);
|
21
|
fZeroRotation->RotateZ(0.);
|
22
|
|
23
|
FairGeoLoader* geoLoad = new FairGeoLoader("TGeo","FairGeoLoader");
|
24
|
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
|
25
|
TString geoPath = gSystem->Getenv("VMCWORKDIR");
|
26
|
TString medFile = geoPath + "/geometry/media_my.geo";
|
27
|
geoFace->setMediaFile(medFile);
|
28
|
geoFace->readMedia();
|
29
|
gGeoMan = gGeoManager;
|
30
|
|
31
|
Double_t positionCollimator= -16.4;
|
32
|
Double_t positionD1= -30.8;
|
33
|
Double_t positionD1_2=-11.8;
|
34
|
Double_t positionD2= -2. ;
|
35
|
|
36
|
TString geoFileName = geoPath + "/geometry/collimator.mygeo.root";
|
37
|
|
38
|
|
39
|
|
40
|
FairGeoMedia* geoMedia = geoFace->getMedia();
|
41
|
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
|
42
|
|
43
|
FairGeoMedium* mFe = geoMedia->getMedium("ferum");
|
44
|
if ( ! mFe ) Fatal("Main", "FairMedium ferum not found");
|
45
|
geoBuild->createMedium(mFe);
|
46
|
TGeoMedium* pFe = gGeoMan->GetMedium("ferum");
|
47
|
if ( ! pFe ) Fatal("Main", "Medium ferum not found");
|
48
|
|
49
|
FairGeoMedium* vacuum = geoMedia->getMedium("vacuum");
|
50
|
if ( ! vacuum ) Fatal("Main", "FairMedium vacuum not found");
|
51
|
geoBuild->createMedium(vacuum);
|
52
|
TGeoMedium* pMed0 = gGeoMan->GetMedium("vacuum");
|
53
|
if ( ! pMed0 ) Fatal("Main", "Medium vacuum not found");
|
54
|
|
55
|
|
56
|
FairGeoMedium* maluminium = geoMedia->getMedium("aluminium");
|
57
|
if ( ! maluminium ) Fatal("Main", "FairMedium aluminium not found");
|
58
|
geoBuild->createMedium(maluminium);
|
59
|
TGeoMedium* pmaluminium = gGeoMan->GetMedium("aluminium");
|
60
|
if ( ! pmaluminium ) Fatal("Main", "Medium aluminium not found");
|
61
|
|
62
|
|
63
|
|
64
|
|
65
|
|
66
|
gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
|
67
|
gGeoMan->SetName("DETgeom");
|
68
|
TGeoVolume* top = new TGeoVolumeAssembly("TOP");
|
69
|
gGeoMan->SetTopVolume(top);
|
70
|
|
71
|
|
72
|
|
73
|
|
74
|
|
75
|
|
76
|
|
77
|
|
78
|
|
79
|
Double_t CoRmin = 1.5 ;
|
80
|
Double_t CoRmax = 1.6;
|
81
|
Double_t CoZ = 28.8;
|
82
|
|
83
|
Double_t D1Rmin = .5;
|
84
|
Double_t D1Rmax = 1.5;
|
85
|
Double_t D1Z = 0.2;
|
86
|
|
87
|
Double_t D2Rmin = .5;
|
88
|
Double_t D2Rmax = 1.5;
|
89
|
Double_t D2Z = 0.2 ;
|
90
|
|
91
|
TGeoVolume* collimator= gGeoManager->MakeTube("collimator", pmaluminium, CoRmin,CoRmax, CoZ/2);
|
92
|
|
93
|
TGeoVolume* D1= gGeoManager->MakeTube("D1", pmaluminium, D1Rmin,D1Rmax, D1Z/2);
|
94
|
|
95
|
TGeoVolume* D2= gGeoManager->MakeTube("D2", pmaluminium, D2Rmin,D2Rmax, D2Z/2);
|
96
|
|
97
|
TGeoVolume* CollimatorAss = new TGeoVolumeAssembly("Collimator");
|
98
|
|
99
|
|
100
|
|
101
|
|
102
|
CollimatorAss->AddNode(D1, 1, new TGeoCombiTrans(transX, transY, positionD1, fZeroRotation));
|
103
|
CollimatorAss ->AddNode(D1, 2, new TGeoCombiTrans(transX, transY, positionD1_2, fZeroRotation));
|
104
|
CollimatorAss->AddNode(D2, 1, new TGeoCombiTrans(transX, transY, positionD2, fZeroRotation));
|
105
|
CollimatorAss->AddNode(collimator, 1, new TGeoCombiTrans(transX, transY, positionCollimator, fZeroRotation));
|
106
|
top->AddNode(CollimatorAss, 1, new TGeoCombiTrans(transX, transY, transZ, fZeroRotation));
|
107
|
|
108
|
|
109
|
gGeoMan->CloseGeometry();
|
110
|
gGeoMan->CheckOverlaps(0.001);
|
111
|
gGeoMan->PrintOverlaps();
|
112
|
gGeoMan->Test();
|
113
|
|
114
|
TFile* geoFile = new TFile(geoFileName, "RECREATE");
|
115
|
top->Write();
|
116
|
geoFile->Close();
|
117
|
|
118
|
}
|