8 #include<FairGeoLoader.h>
9 #include<FairGeoInterface.h>
10 #include<FairGeoBuilder.h>
11 #include<FairGeoPcon.h>
12 #include<FairGeoMedia.h>
13 #include<TGeoCompositeShape.h>
14 #include<TGeoMatrix.h>
15 #include<TGeoVolume.h>
22 #include<TGeoManager.h>
61 kPlaneZPosition[0] = 0.0;
62 kPlaneZPosition[1] = 20.0;
63 kPlaneZPosition[2] = 30.0;
64 kPlaneZPosition[3] = 40.0;
68 double end_seg_upstream = 360.1;
69 double r_bend = 5750.;
70 double phi_bend = 40.068e-3;
72 const Double_t kRot = phi_bend/3.141*180.;
74 const Double_t kRotUmZ = end_seg_upstream + tan(phi_bend/2.)*r_bend;
82 const Double_t kTransX = (kTransZ - end_seg_upstream - tan(phi_bend/2.)*r_bend)*tan(phi_bend);
83 std::cout <<
" translation in x by " << kTransX << std::endl;
86 gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
89 gSystem->Load(
"libGeoBase");
90 gSystem->Load(
"libParBase");
91 gSystem->Load(
"libBase");
92 gSystem->Load(
"libPndData");
93 gSystem->Load(
"libPassive");
96 TFile*
fi =
new TFile(outfile,
"RECREATE");
98 FairGeoLoader*
geoLoad =
new FairGeoLoader(
"TGeo",
"FairGeoLoader");
99 FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
100 geoFace->setMediaFile(
"../../geometry/media_pnd.geo");
101 geoFace->readMedia();
104 FairGeoMedia *
Media = geoFace->getMedia();
105 FairGeoBuilder *
geobuild = geoLoad->getGeoBuilder();
107 FairGeoMedium *FairMediumSilicon = Media->getMedium(
"silicon");
109 Int_t
nmed = geobuild->createMedium(FairMediumSilicon);
111 TGeoManager*
gGeoMan = (TGeoManager*) gROOT->FindObject(
"FAIRGeom");
113 TGeoVolume *
top =
new TGeoVolumeAssembly(
"lmd_HV_MAPS");
115 gGeoMan->SetTopVolume(top);
120 const double inner_rad = 3.6;
121 const double outer_rad = 9.;
122 const int n_cvd_discs = 6;
123 const double cvd_disc_rad = 4.;
124 const double cvd_disc_thick_half = 0.01;
127 const double cvd_disc_even_odd_offset = 0.25;
129 const double delta_phi =
TMath::TwoPi() / ((double) (n_cvd_discs));
132 const double pol_side_lg_half = inner_rad *
sin(delta_phi / 2.);
134 const double pol_side_dist_min = inner_rad *
cos(delta_phi / 2.);
138 const double cvd_disc_dist = pol_side_dist_min +
sqrt(
139 cvd_disc_rad * cvd_disc_rad - pol_side_lg_half * pol_side_lg_half);
143 TGeoTube* shape_cvd_disc =
new TGeoTube(
"shape_cvd_disc", 0., cvd_disc_rad,
144 cvd_disc_thick_half);
146 TGeoTube* shape_cvd_cutout_inner =
new TGeoTube(
"shape_cvd_cutout_inner",
150 TGeoTubeSeg* shape_cvd_disc_cut_left =
151 new TGeoTubeSeg(
"shape_cvd_disc_cut_left",0., outer_rad, 1., 0.,-delta_phi/2./
TMath::Pi()*180.+90.);
152 TGeoTubeSeg* shape_cvd_disc_cut_right =
153 new TGeoTubeSeg(
"shape_cvd_disc_cut_right",0., outer_rad, 1.,+delta_phi/2./
TMath::Pi()*180.+90., +180.);
155 TGeoRotation* cvd_rotation =
new TGeoRotation(
"cvd_rotation", 0, 0, 0);
156 TGeoTranslation* cvd_translation =
new TGeoTranslation(
"cvd_translation", 0, cvd_disc_dist, 0);
157 TGeoCombiTrans* cvd_combtrans =
new TGeoCombiTrans(*cvd_translation, *cvd_rotation);
158 cvd_combtrans->SetName(
"cvd_combtrans");
159 cvd_combtrans->RegisterYourself();
172 TGeoCompositeShape *shape_cvd_support =
new TGeoCompositeShape(
173 "shape_cvd_support",
"(shape_cvd_disc:cvd_combtrans-shape_cvd_cutout_inner-shape_cvd_disc_cut_left-shape_cvd_disc_cut_right)");
197 const double maps_thickness = 0.005 / 2.;
198 const double maps_active_width = 2.0 / 2.;
199 const double maps_active_height = 1.9 / 2.;
200 const double maps_passive_top = 0.01 / 2.;
201 const double maps_passive_bottom = 0.1 / 2.;
202 const double maps_passive_left = 0.01 / 2.;
203 const double maps_passive_right = 0.01 / 2.;
205 const double maps_width = maps_passive_left + maps_active_width + maps_passive_right ;
206 const double maps_height = maps_passive_top + maps_active_height + maps_passive_bottom;
211 const int maps_n_col = 3;
212 const int maps_n_row = 1;
214 const double maps_die_widht = maps_width * maps_n_col;
215 const double maps_die_height = maps_height * maps_n_row;
217 TGeoRotation* no_rotation =
new TGeoRotation(
"no_rotation", 0, 0, 0);
220 TGeoBBox *shape_maps_active_centered =
new TGeoBBox(
"shape_maps_active_centered", maps_active_width, maps_active_height, maps_thickness);
221 TGeoCombiTrans* combtrans_maps_active =
222 new TGeoCombiTrans(
"combtrans_maps_active",
223 - maps_width + maps_passive_left*2. + maps_active_width,
224 - maps_height + maps_passive_bottom*2. + maps_active_height, 0., no_rotation);
225 combtrans_maps_active->RegisterYourself();
226 TGeoBBox *shape_maps_passive_left =
new TGeoBBox(
"shape_maps_passive_left", maps_passive_left, maps_height, maps_thickness);
227 TGeoCombiTrans* combtrans_maps_passive_left =
228 new TGeoCombiTrans(
"combtrans_maps_passive_left", - maps_width + maps_passive_left, 0., 0., no_rotation);
229 combtrans_maps_passive_left->RegisterYourself();
230 TGeoBBox *shape_maps_passive_right =
new TGeoBBox(
"shape_maps_passive_right", maps_passive_right, maps_height, maps_thickness);
231 TGeoCombiTrans* combtrans_maps_passive_right =
232 new TGeoCombiTrans(
"combtrans_maps_passive_right", maps_width - maps_passive_right, 0., 0., no_rotation);
233 combtrans_maps_passive_right->RegisterYourself();
234 TGeoBBox *shape_maps_passive_top =
new TGeoBBox(
"shape_maps_passive_top", maps_width, maps_passive_top, maps_thickness);
235 TGeoCombiTrans* combtrans_maps_passive_top =
236 new TGeoCombiTrans(
"combtrans_maps_passive_top", 0., maps_height - maps_passive_top, 0., no_rotation);
237 combtrans_maps_passive_top->RegisterYourself();
238 TGeoBBox *shape_maps_passive_bottom =
new TGeoBBox(
"shape_maps_passive_bottom", maps_width, maps_passive_bottom, maps_thickness);
239 TGeoCombiTrans* combtrans_maps_passive_bottom =
240 new TGeoCombiTrans(
"combtrans_maps_passive_bottom", 0., - maps_height + maps_passive_bottom, 0., no_rotation);
241 combtrans_maps_passive_bottom->RegisterYourself();
243 TGeoCompositeShape *shape_maps_passive =
new TGeoCompositeShape(
244 "shape_maps_passive",
"(shape_maps_passive_top:combtrans_maps_passive_top+shape_maps_passive_right:combtrans_maps_passive_right+shape_maps_passive_bottom:combtrans_maps_passive_bottom+shape_maps_passive_left:combtrans_maps_passive_left)");
246 TGeoCompositeShape *shape_maps_active =
new TGeoCompositeShape(
247 "shape_maps_active",
"(shape_maps_active_centered:combtrans_maps_active-shape_maps_passive)");
256 TGeoVolumeAssembly*
SubunitVol =
new TGeoVolumeAssembly(
"Lumi_HV-MAPS");
258 for (
int i_plane = 0; i_plane < 4; i_plane++) {
259 std::stringstream plane_name;
260 plane_name <<
"plane_" << (i_plane + 1);
261 for (
int i_cvd_disc = 0; i_cvd_disc < n_cvd_discs; i_cvd_disc++) {
262 double angle = delta_phi * i_cvd_disc;
263 double offset_z = cvd_disc_even_odd_offset;
264 if ((i_cvd_disc%2)==0) offset_z = -offset_z;
265 std::stringstream disc_name;
266 disc_name <<
"LumPassive_cvd_disc_" << plane_name.str() <<
"_disc_"
268 std::stringstream rot_name;
269 rot_name <<
"rot_" << plane_name.str() <<
"_disc_" << (i_cvd_disc
272 TGeoVolume* tmpvol =
new TGeoVolume(disc_name.str().c_str(),
273 shape_cvd_support, gGeoMan->GetMedium(
"silicon"));
274 tmpvol->SetLineColor(16);
275 TGeoRotation*
rot =
new TGeoRotation(rot_name.str().c_str(), dreh,
277 TGeoTranslation* trt =
new TGeoTranslation(
279 kTransZ + kPlaneZPosition[i_plane] + offset_z - kRotUmZ);
280 TGeoCombiTrans* trctmp =
new TGeoCombiTrans(*trt, *rot);
281 trctmp->SetName((rot_name.str() +
"_comb").c_str());
282 trctmp->RegisterYourself();
286 SubunitVol->AddNode(tmpvol, 0, trctmp);
288 for (
int iside = 0; iside < 2; iside++){
292 for (
int idie = 0; idie < 2; idie++){
293 for (
int maps_col = 0; maps_col < maps_n_col; maps_col++){
294 for (
int maps_row = 0; maps_row < maps_n_row; maps_row++){
296 std::stringstream _module_name;
297 _module_name <<
"_plane_" << i_plane <<
"_disc_"<< i_cvd_disc;
298 _module_name <<
"_side_" << iside <<
"_die_" << idie;
299 _module_name <<
"_col_" << maps_col <<
"_row_" << maps_row;
301 TGeoVolume* _vol_active =
new TGeoVolume((
"LumActivePixelRect"+_module_name.str()).c_str(),
302 shape_maps_active, gGeoMan->GetMedium(
"silicon"));
303 _vol_active->SetLineColor(36);
304 TGeoVolume* _vol_passive =
new TGeoVolume((
"LumPassiveRect"+_module_name.str()).c_str(),
305 shape_maps_passive, gGeoMan->GetMedium(
"silicon"));
306 _vol_passive->SetLineColor(30);
312 _trans_z = - cvd_disc_thick_half - maps_thickness;
313 _trans_y = inner_rad + maps_col * maps_width*2. + maps_width;
316 _trans_x = maps_height + maps_row * maps_height*2.;
318 double temp_trans_x = _trans_x;
319 _trans_x = _trans_x *
cos(angle) - _trans_y *
sin(angle);
320 _trans_y = temp_trans_x *
sin(angle) + _trans_y *
cos(angle);
323 _trans_x = - maps_height - maps_row * maps_height*2.;
325 double temp_trans_x = _trans_x;
326 _trans_x = _trans_x *
cos(angle) - _trans_y *
sin(angle);
327 _trans_y = temp_trans_x *
sin(angle) + _trans_y *
cos(angle);
330 _trans_z = + cvd_disc_thick_half + maps_thickness;
331 _trans_y = inner_rad + maps_col * maps_width*2. + maps_width;
333 _rot_z = -90. -delta_phi/2./
TMath::Pi()*180.;
335 _trans_x = - maps_height - maps_row * maps_height*2.;
337 double temp_trans_x = _trans_x;
338 _trans_x = _trans_x *
cos(-delta_phi/2.+angle) - _trans_y *
sin(-delta_phi/2.+angle);
339 _trans_y = temp_trans_x *
sin(-delta_phi/2.+angle) + _trans_y *
cos(-delta_phi/2.+angle);
341 _rot_z = +90. +delta_phi/2./
TMath::Pi()*180.;
343 _trans_x = maps_height + maps_row * maps_height*2.;
345 double temp_trans_x = _trans_x;
346 _trans_x = _trans_x *
cos(delta_phi/2.+angle) - _trans_y *
sin(delta_phi/2.+angle);
347 _trans_y = temp_trans_x *
sin(delta_phi/2.+angle) + _trans_y *
cos(delta_phi/2.+angle);
351 TGeoRotation* _rot =
new TGeoRotation((
"rot_"+_module_name.str()).c_str(), _rot_z + dreh,
353 TGeoTranslation* _trans =
new TGeoTranslation(
355 kTransZ + kPlaneZPosition[i_plane] + offset_z - kRotUmZ + _trans_z);
356 TGeoCombiTrans* _combtrans =
new TGeoCombiTrans(*_trans, *_rot);
357 _combtrans->SetName((
"combtrans_"+_module_name.str()).c_str());
358 _combtrans->RegisterYourself();
363 SubunitVol->AddNode(_vol_active, 0, _combtrans);
364 SubunitVol->AddNode(_vol_passive, 0, _combtrans);
387 TGeoRotation* rotf =
new TGeoRotation(
"final", 90, kRot, 0);
389 TGeoTranslation* trtf =
new TGeoTranslation(0, 0, kRotUmZ);
390 TGeoCombiTrans *trcf =
new TGeoCombiTrans(*trtf, *rotf);
393 top->AddNode(SubunitVol, 0, trcf);
395 gGeoMan->CloseGeometry();
404 #include<TApplication.h>
407 TApplication myapp(
"myapp", 0, 0);
int main(int argc, char **argv)
friend F32vec4 cos(const F32vec4 &a)
friend F32vec4 sqrt(const F32vec4 &a)
friend F32vec4 sin(const F32vec4 &a)
FairGeoBuilder * geobuild
FairGeoInterface * geoFace