create_BeamDet_geo_v3_3.C
1 |
// ----- BeamDet parameters -------------------------------------------------
|
---|---|
2 |
|
3 |
// ----- GasCone)parameters -----------------------------------------------------
|
4 |
|
5 |
Double_t dz=5.;
|
6 |
Double_t rmin1=0.;
|
7 |
Double_t rmax1= .5;
|
8 |
Double_t rmin2=0.;
|
9 |
Double_t rmax2=1.5; |
10 |
|
11 |
Double_t mylarZ= 0.0002; |
12 |
Double_t shell_Z=0.2; |
13 |
// --------------------------------------------------------------------------
|
14 |
// ----SI parameters ----------------------------------------------------
|
15 |
|
16 |
Double_t SiR = 1.5; //cm |
17 |
Double_t SiZ = 0.4; |
18 |
// --------------------------------------------------------------------------
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
// ------ Position of detector's parts relative to zero ---------------------
|
24 |
|
25 |
Double_t positionSi = 22.5; |
26 |
Double_t positiongasCone = 19.3; |
27 |
Double_t positionshell=16.6; |
28 |
|
29 |
Double_t positionmylar1=16.7; |
30 |
|
31 |
|
32 |
void create_BeamDet_geo_v3_3()
|
33 |
{ |
34 |
// Create a global translation
|
35 |
Float_t global_X = 0.;
|
36 |
Float_t global_Y = 0.;
|
37 |
Float_t global_Z = 0.;
|
38 |
//Create gloabal Rotation
|
39 |
TGeoRotation *fGlobalRotation = new TGeoRotation();
|
40 |
fGlobalRotation->RotateX(0.);
|
41 |
fGlobalRotation->RotateY(-10.); |
42 |
fGlobalRotation->RotateZ(0.);
|
43 |
|
44 |
|
45 |
// Create a zero rot1ation
|
46 |
TGeoRotation *fZeroRotation = new TGeoRotation();
|
47 |
fZeroRotation->RotateX(0.);
|
48 |
fZeroRotation->RotateY(0.);
|
49 |
fZeroRotation->RotateZ(0.);
|
50 |
// Create a 90 degree rotation around Z axis
|
51 |
TGeoRotation *f90ZRotation = new TGeoRotation();
|
52 |
f90ZRotation->RotateX(0.);
|
53 |
f90ZRotation->RotateY(0.);
|
54 |
f90ZRotation->RotateZ(0.);
|
55 |
// Create a 90 degree rotation around X axis
|
56 |
TGeoRotation *f90XRotation = new TGeoRotation();
|
57 |
f90XRotation->RotateX(0.);
|
58 |
f90XRotation->RotateY(0.);
|
59 |
f90XRotation->RotateZ(0.);
|
60 |
|
61 |
TGeoManager* gGeoMan = NULL;
|
62 |
// ------- Load media from media file -----------------------------------
|
63 |
FairGeoLoader* geoLoad = new FairGeoLoader("TGeo","FairGeoLoader"); |
64 |
FairGeoInterface* geoFace = geoLoad->getGeoInterface(); |
65 |
TString geoPath = gSystem->Getenv("VMCWORKDIR");
|
66 |
TString medFile = geoPath + "/geometry/media_my.geo";
|
67 |
geoFace->setMediaFile(medFile); |
68 |
geoFace->readMedia(); |
69 |
gGeoMan = gGeoManager; |
70 |
// --------------------------------------------------------------------------
|
71 |
// ------- Geometry file name (output) ----------------------------------
|
72 |
TString geoFileName = geoPath + "/geometry/base.geo_2.root";
|
73 |
// --------------------------------------------------------------------------
|
74 |
// ----------------- Get and create the required media -----------------
|
75 |
FairGeoMedia* geoMedia = geoFace->getMedia(); |
76 |
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder(); |
77 |
|
78 |
// ----- Create media for MWPC (GasCone) -----------------------------------------------
|
79 |
FairGeoMedium* mmylar = geoMedia->getMedium("mylar");
|
80 |
if ( ! mmylar ) Fatal("Main", "FairMedium mylar not found"); |
81 |
geoBuild->createMedium( mmylar ); |
82 |
TGeoMedium* pmmylar = gGeoMan->GetMedium("mylar");
|
83 |
//if ( ! pMedBC408 ) Fatal("Main", "Medium BC408 not found");
|
84 |
//FairGeoMedium* mCF4 = geoMedia->getMedium("CF4_CH4");
|
85 |
//if ( ! mCF4 ) Fatal("Main", "FairMedium CF4_CH4 not found");
|
86 |
//geoBuild->createMedium(mCF4);
|
87 |
//TGeoMedium* pMedCF4 = gGeoMan->GetMedium("CF4_CH4");
|
88 |
//if ( ! pMedCF4 ) Fatal("Main", "Medium CF4_CH4 not found");
|
89 |
|
90 |
|
91 |
FairGeoMedium* misobutan003= geoMedia->getMedium("isobutan003");
|
92 |
if ( ! misobutan003) Fatal("Main", "FairMedium isobutan003 not found"); |
93 |
geoBuild->createMedium(misobutan003); |
94 |
TGeoMedium* pmisobutan003 = gGeoMan->GetMedium("isobutan003");
|
95 |
if ( ! pmisobutan003) Fatal("Main", "isobutan003 not found"); |
96 |
// --------------------------------------------------------------------------
|
97 |
// ----- Create media for TOF (Si) ----------------------------------------------
|
98 |
//FairGeoMedium* mCF4 = geoMedia->getMedium("CF4_CH4");
|
99 |
//if ( ! mCF4 ) Fatal("Main", "FairMedium CF4_CH4 not found");
|
100 |
//geoBuild->createMedium(mCF4);
|
101 |
//TGeoMedium* pMedCF4 = gGeoMan->GetMedium("CF4_CH4");
|
102 |
//if ( ! pMedCF4 ) Fatal("Main", "Medium CF4_CH4 not found");
|
103 |
|
104 |
//FairGeoMedium* mKapton = geoMedia->getMedium("kapton");
|
105 |
//if ( ! mKapton ) Fatal("Main", "FairMedium kapton not found");
|
106 |
//geoBuild->createMedium(mKapton);
|
107 |
//TGeoMedium* pMedKapton = gGeoMan->GetMedium("kapton");
|
108 |
//if ( ! pMedKapton ) Fatal("Main", "Medium kapton not found");
|
109 |
|
110 |
//FairGeoMedium* mAluminium = geoMedia->getMedium("aluminium");
|
111 |
//if ( ! mAluminium ) Fatal("Main", "FairMedium aluminium not found");
|
112 |
//geoBuild->createMedium(mAluminium);
|
113 |
//TGeoMedium* pMedAluminium = gGeoMan->GetMedium("aluminium");
|
114 |
//if ( ! pMedAluminium ) Fatal("Main", "Medium aluminium not found");
|
115 |
|
116 |
//FairGeoMedium* mTungsten = geoMedia->getMedium("tungsten");
|
117 |
//if ( ! mTungsten ) Fatal("Main", "FairMedium tungsten not found");
|
118 |
//geoBuild->createMedium(mTungsten);
|
119 |
//TGeoMedium* pMedTungsten = gGeoMan->GetMedium("tungsten");
|
120 |
//if ( ! pMedTungsten ) Fatal("Main", "Medium tungsten not found");
|
121 |
|
122 |
FairGeoMedium* msilicon = geoMedia->getMedium("silicon");
|
123 |
if ( ! msilicon ) Fatal("Main", "FairMedium silicon not found"); |
124 |
geoBuild->createMedium(msilicon); |
125 |
TGeoMedium* silicon_Si = gGeoMan->GetMedium("silicon");
|
126 |
if ( ! silicon_Si) Fatal("Main", "Medium silicon not found"); |
127 |
// --------------------------------------------------------------------------
|
128 |
// ------ Create media for target -------------------------------------------
|
129 |
//FairGeoMedium* mborum11 = geoMedia->getMedium("borum11");
|
130 |
//if ( ! mborum11 ) Fatal("Main", "FairMedium borum11 not found");
|
131 |
//TgeoBuild->createMedium(mborum11);
|
132 |
//GeoMedium* pborum11 = gGeoMan->GetMedium("borum11");
|
133 |
//if ( ! pborum11 ) Fatal("Main", "Medium borum11 not found");
|
134 |
|
135 |
FairGeoMedium* mSteel = geoMedia->getMedium("Steel");
|
136 |
if ( ! mSteel ) Fatal("Main", "FairMedium Steel not found"); |
137 |
geoBuild->createMedium(mSteel); |
138 |
TGeoMedium* pSteel = gGeoMan->GetMedium("Steel");
|
139 |
if ( ! pSteel ) Fatal("Main", "Medium vacuum not found"); |
140 |
// --------------------------------------------------------------------------
|
141 |
|
142 |
// ------ Create media for collimator -----------------------------------------------
|
143 |
FairGeoMedium* maluminium = geoMedia->getMedium("aluminium");
|
144 |
if ( ! maluminium ) Fatal("Main", "FairMedium aluminium not found"); |
145 |
geoBuild->createMedium(maluminium); |
146 |
TGeoMedium* pmaluminium = gGeoMan->GetMedium("aluminium");
|
147 |
if ( ! pmaluminium ) Fatal("Main", "Medium aluminium not found"); |
148 |
// --------------------------------------------------------------------------
|
149 |
// ------ Create vacuum media -----------------------------------------------
|
150 |
FairGeoMedium* mvacuum = geoMedia->getMedium("vacuum");
|
151 |
if ( ! mvacuum ) Fatal("Main", "FairMedium vacuum not found"); |
152 |
geoBuild->createMedium(mvacuum); |
153 |
TGeoMedium* pmvacuum = gGeoMan->GetMedium("vacuum");
|
154 |
if ( ! pmvacuum ) Fatal("Main", "Medium vacuum not found"); |
155 |
// --------------------------------------------------------------------------
|
156 |
//------------------------- VOLUMES -----------------------------------------
|
157 |
|
158 |
// -------------- Create geometry and top volume -------------------------
|
159 |
gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
|
160 |
gGeoMan->SetName("DETgeom");
|
161 |
TGeoVolume* top = new TGeoVolumeAssembly("TOP"); |
162 |
gGeoMan->SetTopVolume(top); |
163 |
TGeoVolume* beamdet = new TGeoVolumeAssembly("beamdet_2"); |
164 |
// --------------------------------------------------------------------------
|
165 |
//----------------collimator ---------------------
|
166 |
|
167 |
//TGeoVolume* collimator= gGeoManager->MakeTube("collimator", pmaluminium, CoRmin,CoRmax, CoZ/2);
|
168 |
|
169 |
//TGeoVolume* D1= gGeoManager->MakeTube("D1", pmaluminium, D1Rmin,D1Rmax, D1Z/2);
|
170 |
|
171 |
//TGeoVolume* D2= gGeoManager->MakeTube("D2", pmaluminium, D2Rmin,D2Rmax, D2Z/2);
|
172 |
// ---------------- target --------------------------------------------------
|
173 |
|
174 |
//targetH2Z /= 2.;
|
175 |
//Double_t targetShellRmin = targetB11R ;
|
176 |
//Double_t targetShellRmax = targetB11R + targetShellThickness;
|
177 |
|
178 |
//TGeoVolume *targetB11 = gGeoManager->MakeTube("targetB11", pborum11, 0, targetB11R, targetB11Z/2);
|
179 |
|
180 |
//TGeoVolume * targetShell = gGeoManager->MakeTube("targetShell", pSteel, targetShellRmin, targetShellRmax, targetShellZ/2);
|
181 |
//TGeoVolume *targetShell = gGeoManager->MakeTube("targetShell", pSteel, 0, targetShellR, targetShellZ);
|
182 |
|
183 |
|
184 |
// --------------------------------------------------------------------------
|
185 |
// ---------------- gasCone-----------------------------------------------------
|
186 |
|
187 |
|
188 |
TGeoVolume* gasCone = gGeoManager->MakeCone("gas1",pmisobutan003, dz/2, rmin1,rmax1, rmin2,rmax2); |
189 |
|
190 |
TGeoVolume* gCone_shell = gGeoManager->MakeCone("gCone_shell",pmaluminium, dz/2, rmax1,rmax1+0.2, rmax2,rmax2+0.2); |
191 |
TGeoVolume *mylar1 = gGeoManager->MakeTube("mylar1", pmmylar, 0, rmax1, mylarZ/2); |
192 |
TGeoVolume *Shell_Z = gGeoManager->MakeTube("Shell_Z", pmaluminium, rmax1-0.0001, rmax1, shell_Z/2); |
193 |
|
194 |
// --------------------------------------------------------------------------
|
195 |
|
196 |
// ----------------- (Si) ---------------------------------------------------
|
197 |
|
198 |
|
199 |
//TGeoVolume* gasVol = gGeoManager->MakeBox("MWPCVol", pMedCF4, gasVolX, gasVolY, gasVolZ);
|
200 |
|
201 |
TGeoVolume* Si = gGeoManager->MakeTube("plastic1", silicon_Si, 0,SiR, SiZ/2); |
202 |
|
203 |
|
204 |
|
205 |
//TGeoVolume* gas = gGeoManager->MakeBox("gas", pMedCF4, gasX, gasY, gasZ);
|
206 |
|
207 |
//TGeoVolume* gasPlane = gGeoManager->MakeBox("gasPlane", pMedCF4, gasVolX, gasVolY, gasZ + aluminiumThickness);
|
208 |
|
209 |
//TGeoVolume* tungstenWire = gGeoManager->MakeTube("tungstenWire", pMedTungsten, 0, wireDiameter / 2, gasY);
|
210 |
//------------------ STRUCTURE ---------------------------------------------
|
211 |
//gas->AddNode(tungstenWire, 1, new TGeoCombiTrans(0, 0, 0, f90XRotation));
|
212 |
|
213 |
//Int_t gasCount = gasVolX / (2 * gasX);
|
214 |
|
215 |
//Double_t gasPosX;
|
216 |
|
217 |
//for(Int_t i_gas = 1; i_gas <= 2*gasCount; i_gas++)
|
218 |
//{ gasPosX = gasVolX - gasX * 2 * (i_gas - 1) - gasX;
|
219 |
//gasPlane->AddNode(gas, i_gas, new TGeoCombiTrans(gasPosX, 0, 0, fZeroRotation));
|
220 |
//}
|
221 |
|
222 |
//gasVol->AddNode(gasPlane, 1, new TGeoCombiTrans(0, 0, -distBetweenXandY / 2, fZeroRotation));
|
223 |
//gasVol->AddNode(gasPlane, 2, new TGeoCombiTrans(0, 0, distBetweenXandY / 2, f90ZRotation));
|
224 |
|
225 |
//MWPC->AddNode(gasVol, 1, new TGeoCombiTrans(0, 0, 0, fZeroRotation));
|
226 |
|
227 |
//beamdet->AddNode(plastic, 1, new TGeoCombiTrans(global_X, global_Y, positionToF1, fGlobalRotation));
|
228 |
beamdet->AddNode(gasCone,1, new TGeoCombiTrans(global_X, global_Y, positiongasCone, fZeroRotation)); |
229 |
beamdet->AddNode(gCone_shell,1, new TGeoCombiTrans(global_X, global_Y, positiongasCone, fZeroRotation)); |
230 |
beamdet->AddNode(mylar1,1, new TGeoCombiTrans(global_X, global_Y, positionmylar1, fZeroRotation)); |
231 |
beamdet->AddNode(Si, 1, new TGeoCombiTrans(global_X, global_Y, positionSi, fZeroRotation)); |
232 |
beamdet->AddNode(Shell_Z,1, new TGeoCombiTrans(global_X, global_Y, positionshell, fZeroRotation)); |
233 |
|
234 |
//beamdet->AddNode(MWPC, 2, new TGeoCombiTrans(global_X, global_Y, positionMWPC2, fGlobalRotation));
|
235 |
//Collimator->AddNode(D1, 1, new TGeoCombiTrans(global_X, global_Y, positionD1, fGlobalRotation));
|
236 |
//Collimator ->AddNode(D1, 2, new TGeoCombiTrans(global_X, global_Y, positionD1_2, fGlobalRotation));
|
237 |
//Collimator->AddNode(D2, 1, new TGeoCombiTrans(global_X, global_Y, positionD2, fGlobalRotation));
|
238 |
//beamdet -> AddNode(collimator, 1, new TGeoCombiTrans(global_X ,global_Y, positionCollimator, fGlobalRotation));
|
239 |
//targetShell->AddNode(targetB11 , 1, new TGeoCombiTrans(.0,.0,.0, f90ZRotation));
|
240 |
//target->AddNode(targetShell, 1, new TGeoCombiTrans(.0, .0, .0, f90ZRotation));
|
241 |
|
242 |
|
243 |
//beamdet -> AddNode(targetShell, 1, new TGeoCombiTrans(global_X ,global_Y, positiontargetShell, fGlobalRotation));
|
244 |
|
245 |
|
246 |
//top->AddNode(Collimator , 1, new TGeoCombiTrans(global_X ,global_Y, global_Z, fGlobalRotation));
|
247 |
//top->AddNode(target , 1, new TGeoCombiTrans(global_X ,global_Y, global_Z, fGlobalRotation));
|
248 |
top->AddNode(beamdet , 1, new TGeoCombiTrans(global_X ,global_Y, global_Z, fGlobalRotation)); |
249 |
|
250 |
// --------------- Finish -----------------------------------------------
|
251 |
gGeoMan->CloseGeometry(); |
252 |
gGeoMan->CheckOverlaps(0.001); |
253 |
gGeoMan->PrintOverlaps(); |
254 |
gGeoMan->Test(); |
255 |
|
256 |
TFile* geoFile = new TFile(geoFileName, "RECREATE"); |
257 |
top->Write(); |
258 |
geoFile->Close(); |
259 |
// --------------------------------------------------------------------------
|
260 |
} |