FairRoot/PandaRoot
Functions
create3StationsGem_v2.C File Reference

Go to the source code of this file.

Functions

Int_t create3StationsGem_v2 ()
 

Function Documentation

Int_t create3StationsGem_v2 ( )

Definition at line 3 of file create3StationsGem_v2.C.

References CbmMediumAir, CbmMediumAluminium, CbmMediumCarbon, CbmMediumPWO, CAMath::Cos(), Double_t, dummyrot, fi, geobuild, geoFace, geoLoad, gGeoMan, Media, medium, nmed, outfile, Pi, SetLineColor(), CAMath::Sin(), SubunitVol, top, and TString.

4 {
5  // Gem disk geometry parameters (R.Karabowicz)
6  //----------------------------------------------------------------------------------------------------------------------------------------------
7  // Done Some Changes By Nazila Divani (since May 2015 ...) (v2)---> updated 3Stations GEM geometry (April 2017)
8  //----------------------------------------------------------------------------------------------------------------------------------------------
9  // Tried to get close to the CAD Geometry as the realistic one // ( After could not use CadConverter to convert CAD files to ROOT) // Parameters from DL.
10  //----------------------------------------------------------------------------------------------------------------------------------------------
11  // Units are in [cm]
12  //---------------------------------------------------------------------------------------------------------------------------------------------
13 
14  const Int_t NofDisks = 3; //number of GEM stations in form of disk
15 
16  const Double_t DiskVolInnerRadius[NofDisks] = { 4.50, 4.50, 4.50 }; // InnerRadius for 3 Stations in form of disk
17  const Double_t DiskVolOuterRadius[NofDisks] = { 45.06, 56.06, 74.06 }; // OuterRadius for 3 Stations in form of disk
18  const Double_t DiskZPosition [NofDisks] = { 119.40, 155.40, 188.50 }; // ZPosition for 3 Stations in form of disk
19 
20 
21  const Int_t DiskNFoils [NofDisks] = { 2 , 2 , 4 }; // For modifying misalignment
22  const Double_t MiddleROBarHfTh[NofDisks] = { 2.35, 2.35, 2.35 }; // half thickness of space in the middle of foils [cm]
23  const Double_t HalfStationThickness = 8.003;
24 
25  const Double_t carbonRingInnerRadius[NofDisks] = { 39.97, 50.97, 68.97 };
26  const Double_t carbonRingOuterRadius[NofDisks] = { 40.17, 51.17, 69.17 };
27  const Double_t carbonRingHalfThickness = 1.50;
28 
29  const Double_t copperRingInnerRadius[NofDisks] = { 39.47, 50.47, 68.47 };
30  const Double_t copperRingOuterRadius[NofDisks] = { 39.67, 50.67, 68.67 };
31  const Double_t copperRingHalfThickness = 3.75;
32 
33  const Double_t AlRingInnerRadius[NofDisks] = { 39.70, 50.70, 68.70 };
34  const Double_t AlRingOuterRadius[NofDisks] = { 44.70, 55.70, 73.70 };
35  const Double_t AlRingHalfThickness = 3.75;
36 
37  const Double_t SegmentHalfThickness = 0.25;
38  const Int_t NofSegments = 24;
39  const Double_t SegmentDeltaAngle = 360./(Double_t(NofSegments));
40  const Double_t FirstSegmentAngle = 7.5;
41  const TString newsegment [NofSegments] = { "seg1" ,"seg2" ,"seg3" ,"seg4" ,"seg5" ,"seg6" ,"seg7" ,"seg8" ,
42  "seg9" ,"seg10","seg11","seg12","seg13","seg14","seg15","seg16",
43  "seg17","seg18","seg19","seg20","seg21","seg22","seg23","seg24" };
44 
45  const Double_t moduleRingInnerRadius[NofDisks] = { 39.70, 50.70, 68.70 };
46  const Double_t moduleRingOuterRadius[NofDisks] = { 44.65, 55.65, 73.65 };
47  const Double_t moduleRingHalfThickness = 3.75;
48 
49  const Double_t moduleSegmentHalfThickness = 1.30;
50  const Int_t NofmoduleSegments = 24;
51  const Double_t moduleSegmentDeltaAngle = 360./(Double_t(NofmoduleSegments));
52  const Double_t FirstmoduleSegmentAngle = 0.0 ;
53  const TString newmodulesegment [NofmoduleSegments] = { "moduleseg1" ,"moduleseg2" ,"moduleseg3" ,"moduleseg4" ,"moduleseg5" ,"moduleseg6" ,"moduleseg7" ,"moduleseg8" ,
54  "moduleseg9" ,"moduleseg10","moduleseg11","moduleseg12","moduleseg13","moduleseg14","moduleseg15","moduleseg16",
55  "moduleseg17","moduleseg18","moduleseg19","moduleseg20","moduleseg21","moduleseg22","moduleseg23","moduleseg24" };
56 
57  const Double_t AlumiRingInnerRadius[NofDisks] = { 44.7, 55.7, 73.7 };
58  const Double_t AlumiRingOuterRadius[NofDisks] = { 45.0, 56.0, 74.0 };
59  const Double_t AlumiRingHalfThickness = 3.75;
60 
61  const Double_t coverRingInnerRadius[NofDisks] = { 39.70, 50.70, 68.70 };
62  const Double_t coverRingOuterRadius[NofDisks] = { 45.00, 56.00, 74.00 };
63  const Double_t coverRingHalfThickness = 0.2;
64 
65  const Double_t rcopperbarx = 1.90;
66  const Double_t rcopperbary = 5.50;
67  const Double_t rcopperbarHalfThickness = 8.40;
68 
69  const Double_t lcopperbarx = 0.90;
70  const Double_t lcopperbary = 5.50;
71  const Double_t lcopperbarHalfThickness = 13.80;
72 
73  //------------------------------------------------------------ main layers in shape of Disk----------------------------------------------------------------------
74  const Int_t NofLayers = 49;
75 
76  const TString LayerName [NofLayers] = {"space", // these "spaces" belong to holding structure layers
77  "window1_foil_out_aluminium", "WindowF_kapton", "window2_foil_out_aluminium",
78  "space", // these "spaces" belong to holding structure layers
79  "WindowF_aluminium", "CathodeF_kapton", "CathodeF_aluminium",
80  "space", //
81  //"Gem1_Sensor_GEMmixture", // sensitive layer
82  "space", //
83  "Gem1F_copper", "Gem1_kapton", "Gem1B_copper",
84  "space", //
85  "Gem2F_copper", "Gem2_kapton", "Gem2B_copper",
86  "space", //
87  "Gem3F_copper", "Gem3_kapton", "Gem3B_copper",
88  "space", //
89  "space", //
90  "PadF_copper", "Pad_kapton", "PadB_copper",
91  "space", //
92  "space", //
93  "Gem4F_copper", "Gem4_kapton", "Gem4B_copper",
94  "space", //
95  "Gem5F_copper", "Gem5_kapton", "Gem5B_copper",
96  "space", //
97  "Gem6F_copper", "Gem6_kapton", "Gem6B_copper",
98  "space", //
99  //"Gem6_Sensor_GEMmixture", // sensitive layer
100  "space", //
101  "CathodeB_aluminium", "CathodeB_kapton", "WindowB_aluminium",
102  "space", //
103  "window1_foil_in_aluminium", "WindowB_kapton", "window2_foil_in_aluminium",
104  "space" };
105 
106 
107  const Double_t LayerThick[NofLayers] = { 1.0, // windowF1_ring_carbon=holding structure // 1 = 1 space
108  0.0001, 0.0007, 0.0001, // +3 = 4 window
109  1.00, // windowF2_ring_carbon=holding structure // +1 = 5 space
110  0.0001, 0.0007, 0.0001, // +3 = 8 cathode
111  0.80, // cathodeF_ring_GlassFiber=holding structure // +1 = 9 space
112  //1.0020, //Sens // +1 = 10 SENSOR
113  0.050, // gem_ring1_GlassFiber=holding structure // +1 = 11 space
114  0.0005, 0.0050, 0.0005, // +3 = 14 GEM Foil
115  0.050, // gem_ring2_GlassFiber=holding structure // +1 = 15 space
116  0.0005, 0.0050, 0.0005, // +3 = 18 GEM Foil
117  0.050, // gem_ring3_GlassFiber=holding structure // +1 = 19 space
118  0.0005, 0.0050, 0.0005, // +3 = 22 GEM Foil
119  0.050, // gem_ring4_GlassFiber=holding structure // +1 = 23 space
120  0.10, // padplaneF_support_GlassFiber=holding structure // +1 = 24 space
121  0.001, 0.001, 0.001, // +3 = 27 PAD plane
122  0.10, // padplaneB_support_GlassFiber=holding structure // +1 = 28 space
123  0.050, // gem_ring5_GlassFiber=holding structure // +1 = 29 space
124  0.0005, 0.0050, 0.0005, // +3 = 32 GEM Foil
125  0.050, // gem_ring6_GlassFiber=holding structure // +1 = 33 space
126  0.0005, 0.0050, 0.0005, // +3 = 36 GEM Foil
127  0.050, // gem_ring7_GlassFiber=holding structure // +1 = 37 space
128  0.0005, 0.0050, 0.0005, // +3 = 40 GEM Foil
129  0.050, // gem_ring8_GlassFiber=holding structure // +1 = 41 space
130  //1.0020, //Sens // +1 = 42 SENSOR
131  0.80, // cathodeB_ring_GlassFiber=holding structure // +1 = 43 space
132  0.0001, 0.0007, 0.0001, // +3 = 46 cathode
133  1.00, // windowB1_ring_carbon=holding structure // +1 = 47 space
134  0.0001, 0.0007, 0.0001, // +3 = 50 window
135  1.0 }; // windowB2_ring_carbon=holding structure // +3 = 51 space
136 
137 
138  const Double_t DiskOuterRadius[NofLayers][NofDisks] = { 39.90, 50.90, 68.90,
139  38.95, 49.95, 67.95, 39.40, 50.40, 68.40, 38.95, 49.95, 67.95,
140  39.90, 50.90, 68.90,
141  38.45, 49.45, 67.45, 39.40, 50.40, 68.40, 38.45, 49.45, 67.45,
142  39.40, 50.40, 68.40,
143  //38.00, 49.00, 67.00,
144  39.05, 50.40, 68.40,
145  38.10, 49.45, 67.45, 39.05, 50.05, 68.05, 38.10, 49.45, 67.45,
146  39.05, 50.40, 68.40,
147  38.10, 49.45, 67.45, 39.05, 50.05, 68.05, 38.10, 49.45, 67.45,
148  39.05, 50.40, 68.40,
149  38.10, 49.45, 67.45, 39.05, 50.05, 68.05, 38.10, 49.45, 67.45,
150  39.05, 50.40, 68.40,
151  45.00, 56.00, 74.00,
152  44.90, 55.90, 73.90, 44.90, 55.90, 73.90, 44.90, 55.90, 73.90,
153  45.00, 56.00, 74.00,
154  39.05, 50.40, 68.40,
155  38.10, 49.45, 67.45, 39.05, 50.05, 68.05, 38.10, 49.45, 67.45,
156  39.05, 50.40, 68.40,
157  38.10, 49.45, 67.45, 39.05, 50.05, 68.05, 38.10, 49.45, 67.45,
158  39.05, 50.40, 68.40,
159  38.10, 49.45, 67.45, 39.05, 50.05, 68.05, 38.10, 49.45, 67.45,
160  39.05, 50.40, 68.40,
161  //38.00, 49.00, 67.00,
162  39.40, 50.40, 68.40,
163  38.45, 49.45, 67.45, 39.40, 50.40, 68.40, 38.45, 49.45, 67.45,
164  39.40, 50.40, 68.40,
165  39.40, 50.40, 68.40, 38.95, 49.45, 67.95, 39.40, 50.40, 68.40,
166  39.40, 50.40, 68.40 };
167 
168 
169  const Double_t DiskInnerRadius[NofLayers][NofDisks] = { 4.50, 4.50, 4.50,
170  4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50,
171  4.50, 4.50, 4.50,
172  4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50,
173  4.50, 4.50, 4.50,
174  //4.50, 4.50, 4.50,
175  4.50, 4.50, 4.50,
176  4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50,
177  4.50, 4.50, 4.50,
178  4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50,
179  4.50, 4.50, 4.50,
180  4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50,
181  4.50, 4.50, 4.50,
182  4.50, 4.50, 4.50,
183  4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50,
184  4.50, 4.50, 4.50,
185  4.50, 4.50, 4.50,
186  4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50,
187  4.50, 4.50, 4.50,
188  4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50,
189  4.50, 4.50, 4.50,
190  4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50,
191  4.50, 4.50, 4.50,
192  //4.50, 4.50, 4.50,
193  4.50, 4.50, 4.50,
194  4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50,
195  4.50, 4.50, 4.50,
196  4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50, 4.50,
197  4.50, 4.50, 4.50 };
198 
199 
200  const Double_t HoleTZ = 0.0; // (top and down) holes Translation parameters
201  const Double_t HoleTX = 0.0;
202  const Double_t HoleTY = 33.00;
203 //------------------------------------ sensitive layers ---------------------------------------------------------------------------------------
204 
205  const Int_t NofSensLayers = 2;
206 
207  const Double_t sMiddleROBarHfTh[NofDisks] = { 2.35, 2.35, 2.35 }; // half thickness of space in the middle of Sens [cm]
208 
209  const TString SensLayerName[NofSensLayers] = { "Gem1_Sensor_GEMmixture", // drift layers
210  "Gem6_Sensor_GEMmixture" };
211 
212  const Double_t SensLayerThick[NofSensLayers] = { 0.85,
213  0.85 };
214 
215  const Double_t SensZPosition[NofSensLayers][NofDisks] = { -0.6942, -0.6942, -0.6942,
216  0.6948, 0.6948, 0.6948 };
217 
218  const Double_t SensOuterRadius[NofSensLayers][NofDisks] = { 38.15, 49.15, 67.15,
219  38.15, 49.15, 67.15 };
220 
221  const Double_t SensInnerRadius[NofSensLayers][NofDisks] = { 5.00, 5.00, 5.00,
222  5.00, 5.00, 5.00 };
223 
224  const Double_t sHoleTZ = 0.0; // (top and down) holes Translation parameters
225  const Double_t sHoleTX = 0.0;
226  const Double_t sHoleTY = 33.00;
227 
228 //----------------------- holding structure layers ------------------------------------------------------------------------------------------------
229  const Int_t NofHLayers = 16;
230 
231  const TString HLayersName [NofHLayers] = { "windowF1_ring_carbon",
232  //"space",
233  "windowF2_ring_carbon",
234  //"space",
235  "cathodeF_ring_GlassFiber",
236  //"space",
237  "gem_ring1_GlassFiber",
238  //"space",
239  "gem_ring2_GlassFiber",
240  //"space",
241  "gem_ring3_GlassFiber",
242  //"space",
243  "gem_ring4_GlassFiber",
244  "padplaneF_support_GlassFiber",
245  //"space",
246  "padplaneB_support_GlassFiber",
247  "gem_ring5_GlassFiber",
248  //"space",
249  "gem_ring6_GlassFiber",
250  //"space",
251  "gem_ring7_GlassFiber",
252  //"space",
253  "gem_ring8_GlassFiber",
254  //"space",
255  "cathodeB_ring_GlassFiber",
256  //"space",
257  "windowB1_ring_carbon",
258  //"space",
259  "windowB2_ring_carbon" };
260 
261  const Double_t HLayersThick[NofHLayers] = { 1.00,
262  1.00,
263  0.80,
264  0.050,
265  0.050,
266  0.050,
267  0.050,
268  0.10,
269  0.10,
270  0.050,
271  0.050,
272  0.050,
273  0.050,
274  0.80,
275  1.00,
276  1.00 };
277 
278 
279  const Double_t HZPosition[NofHLayers][NofDisks] = { -2.6216, -2.6216, -2.6216,
280  -1.6201, -1.6201, -1.6201,
281  -0.7192, -0.7192, -0.7192,
282  -0.2942, -0.2942, -0.2942,
283  -0.2382, -0.2382, -0.2382,
284  -0.1822, -0.1822, -0.1822,
285  -0.1262, -0.1262, -0.1262,
286  -0.0512, -0.0512, -0.0512,
287  0.0518, 0.0518, 0.0518,
288  0.1268, 0.1268, 0.1268,
289  0.1828, 0.1828, 0.1828,
290  0.2388, 0.2388, 0.2388,
291  0.2948, 0.2948, 0.2948,
292  0.7198, 0.7198, 0.7198,
293  1.6207, 1.6207, 1.6207,
294  2.6216, 2.6216, 2.6216 };
295 
296 
297  const Double_t HOuterRadius[NofHLayers][NofDisks] = { 39.90, 50.90, 68.90,
298  39.90, 50.90, 68.90,
299  39.40, 50.40, 68.40,
300  39.05, 50.05, 68.05,
301  39.05, 50.05, 68.05,
302  39.05, 50.05, 68.05,
303  39.05, 50.05, 68.05,
304  45.00, 56.00, 74.00,
305  45.00, 56.00, 74.00,
306  39.05, 50.05, 68.05,
307  39.05, 50.05, 68.05,
308  39.05, 50.05, 68.05,
309  39.05, 50.05, 68.05,
310  39.40, 50.40, 68.40,
311  39.40, 50.40, 68.40,
312  39.40, 50.40, 68.40 };
313 
314  const Double_t HInnerRadius[NofHLayers][NofDisks] = { 38.50, 49.50, 67.50,
315  38.50, 49.50, 67.50,
316  38.50, 49.50, 67.50,
317  38.15, 49.15, 67.15,
318  38.15, 49.15, 67.15,
319  38.15, 49.15, 67.15,
320  38.15, 49.15, 67.15,
321  38.50, 49.50, 67.50,
322  38.50, 49.50, 67.50,
323  38.15, 49.15, 67.15,
324  38.15, 49.15, 67.15,
325  38.15, 49.15, 67.15,
326  38.15, 49.15, 67.15,
327  38.50, 49.50, 67.50,
328  38.00, 49.00, 67.00,
329  38.00, 49.00, 67.00 };
330 
331  const Double_t HXBoxWidth = 2.30; // Using to define holes for the holding structure layers
332  const Double_t HXPlateWidth = 1.90;
333  const Double_t HYPlateWidth = 9.30;
334 
335  const Double_t HTZ = 0.0; // Translation parameters for vertical holes
336  const Double_t HTX = 0.0;
337  const Double_t HTY[NofHLayers][NofDisks] = { 25.0, 45.0, 65.0,
338  25.0, 45.0, 65.0,
339  25.0, 45.0, 65.0,
340  25.0, 45.0, 65.0,
341  25.0, 45.0, 65.0,
342  25.0, 45.0, 65.0,
343  25.0, 45.0, 65.0,
344  25.0, 45.0, 65.0,
345  25.0, 45.0, 65.0,
346  25.0, 45.0, 65.0,
347  25.0, 45.0, 65.0,
348  25.0, 45.0, 65.0,
349  25.0, 45.0, 65.0,
350  25.0, 45.0, 65.0,
351  25.0, 45.0, 65.0,
352  25.0, 45.0, 65.0 };
353 
354 
355 //-------------------------------------------------------------------------------------------------------------------------------------------------
356  const Int_t SensorStripType [2] = { 3 , 2 };
357 
358  const Double_t SensorStripAngle[2][2] = { 0. , 0. , 0. , 0. };
359  const Double_t SensorStripPitch[2][2] = { 0.04, 0.04, 0.04, 0.04};
360 
361  Double_t firstLayerOffset = 0.;
362 
363  for ( Int_t ilayer = 0 ; ilayer < NofLayers ; ilayer++ ) {
364  cout << LayerName[ilayer].Data() << " -> " << LayerThick[ilayer] << endl;
365  firstLayerOffset += LayerThick[ilayer];
366  }
367 
368  cout << "total thickness is " << firstLayerOffset << endl;
369  firstLayerOffset = firstLayerOffset/2.;
370  firstLayerOffset = -0.001*(TMath::Floor(1000.*firstLayerOffset));
371  cout << "first layer offset is " << firstLayerOffset << endl;
372  //-----------------------------------------------------------------------------------------------
373 
374  TString vmcWorkdir = getenv("VMCWORKDIR");
375 
376  TString outfile= "../../geometry/gem_3Stations_realistic_v2.root"; //v2
377 
378 
379  TFile* fi = new TFile(outfile,"RECREATE");
380 
381  cout << "created output file" << endl;
382  FairGeoLoader* geoLoad = new FairGeoLoader("TGeo","FairGeoLoader");
383  FairGeoInterface *geoFace = geoLoad->getGeoInterface();
384  cout << "geoface setmediafile" << endl;
385  geoFace->setMediaFile("../../geometry/media_pnd.geo");
386  cout << "geoface readmedia" << endl;
387  geoFace->readMedia();
388  cout << "geoface print" << endl;
389  geoFace->print();
390  cout << "geoface done" << endl;
391 
392  FairGeoMedia *Media = geoFace->getMedia();
393  FairGeoBuilder *geobuild=geoLoad->getGeoBuilder();
394 
395  FairGeoMedium *CbmMediumAir = Media->getMedium("air");
396  FairGeoMedium *CbmMediumPWO = Media->getMedium("PWO");
397  FairGeoMedium *CbmMediumCarbon = Media->getMedium("carbon");
398  FairGeoMedium *CbmMediumAluminium = Media->getMedium("aluminium");
399  FairGeoMedium *CbmMediumCopper = Media->getMedium("copper");
400  FairGeoMedium *CbmMediumKapton = Media->getMedium("kapton");
401  FairGeoMedium *CbmMediumArCO2 = Media->getMedium("GEMmixture");
402  FairGeoMedium *CbmMediumUranium = Media->getMedium("uranium");
403  FairGeoMedium *CbmMediumGlassFiber= Media->getMedium("GlassFiber");
404 
405  Int_t nmed=geobuild->createMedium(CbmMediumAir);
406  nmed=geobuild->createMedium(CbmMediumPWO);
407  nmed=geobuild->createMedium(CbmMediumCarbon);
408  nmed=geobuild->createMedium(CbmMediumAluminium);
409  nmed=geobuild->createMedium(CbmMediumCopper);
410  nmed=geobuild->createMedium(CbmMediumKapton);
411  nmed=geobuild->createMedium(CbmMediumArCO2);
412  nmed=geobuild->createMedium(CbmMediumUranium);
413  nmed=geobuild->createMedium(CbmMediumGlassFiber);
414 
415 
416  TGeoManager* gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
417 
418  TGeoVolume *top = new TGeoVolumeAssembly("Gem");
419 
420  gGeoMan->SetTopVolume(top);
421 
422  cout << "-------------------------------------------------------------------" << endl;
423  TList* mediaList = (TList*)gGeoMan->GetListOfMedia();
424 
425  cout << "media known: " << mediaList->GetEntries() << "." << endl;
426  for ( Int_t itemp = 0 ; itemp < mediaList->GetEntries() ; itemp++ ) {
427  TGeoMedium* medium = (TGeoMedium*)mediaList->At(itemp);
428  cout << "medium " << itemp << " name is " << medium->GetName() << endl;
429  }
430  cout << "-------------------------------------------------------------------" << endl;
431 
432  TGeoRotation* dummyrot = new TGeoRotation();
433 
434  TGeoVolumeAssembly* SubunitVol = new TGeoVolumeAssembly("Gem_Disks");
435 
436  //----------------------------------------------------------------------------------------
437  TGeoShape *DiskShape[NofDisks];
438  TGeoVolume *DiskVol [NofDisks];
439  TGeoRotation *DiskRotat[NofDisks];
440  TGeoTranslation *DiskTrans[NofDisks];
441  TGeoCombiTrans *DiskCombi[NofDisks];
442  //--------------------------------------------------------------------------------------------
443  TGeoShape *carbonRingShape[NofDisks];
444  TGeoVolume *carbonRingVol [NofDisks];
445  TGeoTranslation *carbonRingTrans[NofDisks];
446  TGeoCombiTrans *carbonRingCombi[NofDisks];
447  //------------------------------------------------------------------------------------------
448  TGeoShape *copperRingShape[NofDisks];
449  TGeoVolume *copperRingVol [NofDisks];
450  TGeoTranslation *copperRingTrans[NofDisks];
451  TGeoCombiTrans *copperRingCombi[NofDisks];
452  //-----------------------------------------------------------------------------------------
453  TGeoShape *coverRingShape[NofDisks];
454  TGeoVolume *coverRingVol [NofDisks];
455  TGeoTranslation *coverRingTrans[NofDisks];
456  TGeoCombiTrans *coverRingCombi[NofDisks];
457  //-------------------------------------------------------------------------------------------
458  TGeoShape *tAcopperbarShape;
459  TGeoVolume *tAcopperbarVol ;
460  TGeoTranslation *tAcopperbarTrans;
461  TGeoRotation *tAcopperbarRot;
462  TGeoCombiTrans *tAcopperbarCombi;
463  //-----------------------------------------------------------------------------------------
464  TGeoShape *tBcopperbarShape;
465  TGeoVolume *tBcopperbarVol ;
466  TGeoTranslation *tBcopperbarTrans;
467  TGeoRotation *tBcopperbarRot;
468  TGeoCombiTrans *tBcopperbarCombi;
469  //-----------------------------------------------------------------------------------------
470  TGeoShape *dAcopperbarShape;
471  TGeoVolume *dAcopperbarVol ;
472  TGeoTranslation *dAcopperbarTrans;
473  TGeoRotation *dAcopperbarRot;
474  TGeoCombiTrans *dAcopperbarCombi;
475  //-----------------------------------------------------------------------------------------
476  TGeoShape *dBcopperbarShape;
477  TGeoVolume *dBcopperbarVol ;
478  TGeoTranslation *dBcopperbarTrans;
479  TGeoRotation *dBcopperbarRot;
480  TGeoCombiTrans *dBcopperbarCombi;
481  //-----------------------------------------------------------------------------------------
482  TGeoShape *AlRingShape[NofDisks][NofSegments];
483  TGeoVolume *AlRingVol [NofDisks][NofSegments];
484  TGeoTranslation *AlRingTrans[NofDisks][NofSegments];
485  TGeoCombiTrans *AlRingCombi[NofDisks][NofSegments];
486  //-----------------------------------------------------------------------------------------
487  TGeoShape *moduleRingShape[NofDisks][NofmoduleSegments];
488  TGeoVolume *moduleRingVol [NofDisks][NofmoduleSegments];
489  TGeoTranslation *moduleRingTrans[NofDisks][NofmoduleSegments];
490  TGeoCombiTrans *moduleRingCombi[NofDisks][NofmoduleSegments];
491  //-----------------------------------------------------------------------------------------
492  TGeoShape *AlumiRingShape[NofDisks];
493  TGeoVolume *AlumiRingVol [NofDisks];
494  TGeoTranslation *AlumiRingTrans[NofDisks];
495  TGeoCombiTrans *AlumiRingCombi[NofDisks];
496  //----------------------------------------------------------------------------------------------
497  TGeoShape *DiskLayersShapeA [NofLayers][NofDisks][4]; // 4 is number of seg
498  TGeoShape *DiskLayersShapeB [NofLayers][NofDisks][4];
499  TGeoSubtraction *DiskLayersSubtr [NofLayers][NofDisks][4];
500  TGeoShape *DiskLayersShapeC [NofLayers][NofDisks][4]; // final, C = A-B
501  TGeoShape *DiskLayersShapeHole [NofLayers][NofDisks][4];
502  TGeoCompositeShape *DiskLayersShapecompos[NofLayers][NofDisks][4];
503  TGeoVolume *DiskLayersVol [NofLayers][NofDisks][4];
504  TGeoTranslation *DiskLayersTranshA [NofLayers][NofDisks][4];
505  TGeoTranslation *DiskLayersTranshB [NofLayers][NofDisks][4];
506  TGeoTranslation *DiskLayersTrans [NofLayers][NofDisks][4];
507  TGeoCombiTrans *DiskLayersCombi [NofLayers][NofDisks][4];
508  //---------------------------------------------------------------------------------------------------
509  TGeoShape *SensDiskLayersShapeA [NofSensLayers][NofDisks][4]; // 4 is number of seg
510  TGeoShape *SensDiskLayersShapeB [NofSensLayers][NofDisks][4];
511  TGeoSubtraction *SensDiskLayersSubtr [NofSensLayers][NofDisks][4];
512  TGeoShape *SensDiskLayersShapeC [NofSensLayers][NofDisks][4]; // final, C = A-B
513  TGeoShape *SensDiskLayersShapeHole [NofSensLayers][NofDisks][4];
514  TGeoCompositeShape *SensDiskLayersShapecompos[NofSensLayers][NofDisks][4];
515  TGeoVolume *SensDiskLayersVol [NofSensLayers][NofDisks][4];
516  TGeoTranslation *SensDiskLayersTranshA [NofSensLayers][NofDisks][4];
517  TGeoTranslation *SensDiskLayersTranshB [NofSensLayers][NofDisks][4];
518  TGeoTranslation *SensDiskLayersTrans [NofSensLayers][NofDisks][4];
519  TGeoCombiTrans *SensDiskLayersCombi [NofSensLayers][NofDisks][4];
520  //------------------------------------------------------------------------------------------------
521  TGeoShape *HLayersShapeTube [NofHLayers][NofDisks];
522  TGeoShape *HLayersShapeBox [NofHLayers][NofDisks];
523  TGeoShape *HLayersShapePlate [NofHLayers][NofDisks];
524  TGeoShape *HLayersShapeHT [NofHLayers][NofDisks];
525  TGeoShape *HLayersShapeHTM [NofHLayers][NofDisks];
526  TGeoShape *HLayersShapeHTD [NofHLayers][NofDisks];
527  TGeoCompositeShape *HLayersShapecompos[NofHLayers][NofDisks];
528  TGeoVolume *HLayersVolcomp [NofHLayers][NofDisks];
529  TGeoTranslation *HLayersTranstA [NofHLayers][NofDisks];
530  TGeoTranslation *HLayersTranstB [NofHLayers][NofDisks];
531  TGeoTranslation *HLayersTranstC [NofHLayers][NofDisks];
532  TGeoTranslation *HLayersTranstD [NofHLayers][NofDisks];
533  TGeoTranslation *HLayersTranstE [NofHLayers][NofDisks];
534  TGeoTranslation *HLayersTranstF [NofHLayers][NofDisks];
535  TGeoRotation *HLayersRotrA [NofHLayers][NofDisks];
536  TGeoShape *HLayersShape [NofHLayers][NofDisks];
537  TGeoVolume *HLayersVol [NofHLayers][NofDisks];
538  TGeoTranslation *HLayersTrans [NofHLayers][NofDisks];
539  TGeoCombiTrans *HLayersCombi [NofHLayers][NofDisks];
540  //------------------------------------------------------------------------------------------------
541  TGeoShape *RiddleShapeTubeA ;
542  TGeoShape *RiddleShapeTubeB ;
543  TGeoShape *RiddleShapeCone ;
544  TGeoShape *RiddleShapeTubeC ;
545  TGeoShape *RiddleShapeTubeD ;
546  TGeoShape *RiddleShapeTubeE ;
547  TGeoShape *RiddleShapeTubeF ;
548  TGeoSubtraction *RiddleSubtr ;
549  TGeoCompositeShape *RiddleShapecompos;
550  TGeoVolume *RiddleVolcomp ;
551  TGeoTranslation *RiddleTrans ;
552  TGeoTranslation *RiddleTransTubeA ;
553  TGeoTranslation *RiddleTransCone ;
554  TGeoTranslation *RiddleTransTubeC ;
555  TGeoTranslation *RiddleTransTubeD ;
556  TGeoTranslation *RiddleTransTubeE ;
557  TGeoCombiTrans *RiddleCombi ;
558  TGeoTranslation *RiddleTransTubeF[4][100] ;
559  TGeoCombiTrans *RiddleCombiTranshole[4][100] ;
560  TGeoRotation *RiddleRothole[4][100] ;
561  //----------------------------------------------------------------------------------------------
562  TString outParFileName = Form("%s/macro/params/gem_3Stations_realistic_v2.digi.par",vmcWorkdir.Data()); //v2
563 
564 
565  cout << "parameter file = \"" << outParFileName.Data() << "\"" << endl;
566 
567  ofstream pout(outParFileName.Data());
568  pout.setf(ios::fixed);
569 
570  pout << "#################################################################" << endl;
571  pout << "# Digitization parameters for GEM " << endl;
572  pout << "# with 3 Stations " << endl;
573  pout << "# Format: " << endl;
574  pout << "# Description of parameters: " << endl;
575  pout << "# [PndGemDetectors] " << endl;
576  pout << "# parameters:d station_number, ZPos, rotation_angle, number_of_sensors, \\" << endl;
577  pout << "# sensor_number, sensor_type, pos_x, pos_y, pos_z, rotAngle, inn_rad, out_rad, thick, str_ang_0, str_ang_1, barWidth, pitch_0, pitch_1, \\" << endl;
578  pout << "# sensor_number, ...." << endl;
579  pout << "# station_number, ..." << endl;
580  pout << "#################################################################" << endl;
581  pout << "[PndGemDetectors]" << setprecision(4) << endl;
582 
583  pout << "parameters:Double_t \\" << endl;
584 
585  for ( Int_t istat = 0 ; istat < NofDisks ; istat++ ) {
586 
587  pout << " " << istat+1 << ", "
588  << setw(9) << DiskZPosition[istat]
589  << ", 0.0, " << 2 << ", \\" << endl;
590 
591  //-----------------------------------GEM Disk------------------------------------------------------------------------------------------------------
592  DiskShape[istat] = new TGeoTube (Form("disk%dshape",istat+1),DiskVolInnerRadius[istat],DiskVolOuterRadius[istat],HalfStationThickness);
593  DiskVol [istat] = new TGeoVolume(Form("Gem_Disk%d_Volume",istat+1),DiskShape[istat],gGeoMan->GetMedium("GEMmixture"));
594  DiskTrans[istat] = new TGeoTranslation(0.,0.,DiskZPosition[istat]);
595  cout << "station " << DiskVolInnerRadius[istat] << " " << DiskVolOuterRadius[istat] << " at " << DiskZPosition[istat] << endl;
596  if(istat<2)
597  DiskCombi[istat] = new TGeoCombiTrans(*DiskTrans[istat],*dummyrot);
598  else
599  {
600  DiskRotat[istat] = new TGeoRotation(Form("disk%drotat"), 0.0, 180.0, 0.0); //turned over the 3rd station because of the position of the electronic devices
601  DiskCombi[istat] = new TGeoCombiTrans(*DiskTrans[istat],*DiskRotat[istat]);
602  }
603  //DiskCombi[istat] = new TGeoCombiTrans(*DiskTrans[istat],*dummyrot);
604  DiskCombi[istat]->SetName(Form("Gem_Disk%d_Volume",istat+1));
605  DiskCombi[istat]->RegisterYourself();
606  DiskVol[istat]->SetLineColor(kYellow);
607  //--------------------------------------------------------------------------------------------------------------------------------------------------------------------
608  //------------------------- Gas container Ring Bottom -------------------------------------------------------------------------------------
609  carbonRingShape[istat] = new TGeoTube (Form("carbonRing%dshape",istat+1),carbonRingInnerRadius[istat],carbonRingOuterRadius[istat],carbonRingHalfThickness);
610  carbonRingVol [istat] = new TGeoVolume(Form("Gem_carbonRing%d_Volume",istat+1),carbonRingShape[istat],gGeoMan->GetMedium("carbon"));
611  carbonRingTrans[istat] = new TGeoTranslation(0.,0.,-1.61);
612  cout << "carbonRing " << carbonRingInnerRadius[istat] << " " << carbonRingOuterRadius[istat] << endl;
613  carbonRingCombi[istat] = new TGeoCombiTrans(*carbonRingTrans[istat],*dummyrot);
614  carbonRingCombi[istat]->SetName(Form("Gem_carbonRing%d_Volume",istat+1));
615  carbonRingCombi[istat]->RegisterYourself();
616  carbonRingVol[istat]->SetLineColor(kMagenta);
617  //----------------------------------------------------------------------------------------------------------------------------------------
618  DiskVol[istat]->AddNode(carbonRingVol[istat],0,carbonRingCombi[istat]);
619  //------------------------------------------------------------------------------------------------------------------------------------------
620  //------------------------- Gas container Ring top -----------------------------------------------------------------------------------------
621  copperRingShape[istat] = new TGeoTube (Form("copperRing%dshape",istat+1),copperRingInnerRadius[istat],copperRingOuterRadius[istat],copperRingHalfThickness);
622  copperRingVol [istat] = new TGeoVolume(Form("Gem_copperRing%d_Volume",istat+1),copperRingShape[istat],gGeoMan->GetMedium("copper"));
623  copperRingTrans[istat] = new TGeoTranslation(0.,0.,3.853);
624  cout << "copperRing " << copperRingInnerRadius[istat] << " " << copperRingOuterRadius[istat] << endl;
625  copperRingCombi[istat] = new TGeoCombiTrans(*copperRingTrans[istat],*dummyrot);
626  copperRingCombi[istat]->SetName(Form("Gem_copperRing%d_Volume",istat+1));
627  copperRingCombi[istat]->RegisterYourself();
628  copperRingVol[istat]->SetLineColor(kYellow-5);
629  //----------------------------------------------------------------------------------------------------------------------------------------
630  DiskVol[istat]->AddNode(copperRingVol[istat],0,copperRingCombi[istat]);
631  //----------------------------------------------------------------------------------------------------------------------------------------
632  //----------------------segments for electronics --------------------------------------------------------------------------------------------------------
633  Double_t segmentAngularSize = SegmentHalfThickness/AlRingInnerRadius[istat]*360.;
634  for ( Int_t isegm = 0 ; isegm < NofSegments ; isegm++ ) {
635  cout << " Segment " << isegm << " with name " << newsegment[isegm] << " will be put at " << FirstSegmentAngle+isegm*SegmentDeltaAngle << " (in fact from " << FirstSegmentAngle+isegm*SegmentDeltaAngle-segmentAngularSize/2. << " to " << FirstSegmentAngle+isegm*SegmentDeltaAngle+segmentAngularSize/2. << ")" << endl;
636  AlRingShape[istat][isegm] = new TGeoTubeSeg (Form("AlRing%dshape",istat+1,isegm+1),AlRingInnerRadius[istat],AlRingOuterRadius[istat],AlRingHalfThickness,FirstSegmentAngle+isegm*SegmentDeltaAngle-segmentAngularSize/2.,FirstSegmentAngle+isegm*SegmentDeltaAngle+segmentAngularSize/2. );
637  AlRingVol[istat][isegm] = new TGeoVolume (Form("Gem_AlRing%d_Volume",istat+1,isegm+1),AlRingShape[istat][isegm],gGeoMan->GetMedium("aluminium"));
638  AlRingTrans[istat][isegm] = new TGeoTranslation (0.,0.,3.853);
639  cout << "AlRing " << AlRingInnerRadius[istat] << " " << AlRingOuterRadius[istat] << endl;
640  AlRingCombi[istat][isegm] = new TGeoCombiTrans (*AlRingTrans[istat][isegm],*dummyrot);
641  AlRingCombi[istat][isegm]->SetName(Form("Gem_AlRing%d_Volume",istat+1,isegm+1));
642  AlRingCombi[istat][isegm]->RegisterYourself();
643  AlRingVol[istat][isegm]->SetLineColor(kCyan-9);
644  //-----------------------------------------------------------------------------------------------------------------------------------------
645  DiskVol[istat]->AddNode(AlRingVol[istat][isegm],0,AlRingCombi[istat][isegm]);
646  //------------------------------------------------------------------------------------------------------------------------------------------
647  }
648  //----------------------------------------------------------------------------------------------------------------------------------------
649  //---------------------- electronic module --------------------------------------------------------------------------------------------------------
650  Double_t modulesegmentAngularSize = moduleSegmentHalfThickness/moduleRingInnerRadius[istat]*360.;
651  for ( Int_t imodulesegm = 0 ; imodulesegm < NofmoduleSegments ; imodulesegm++ ) {
652  cout << " moduleSegment " << imodulesegm << " with name " << newmodulesegment[imodulesegm] << " will be put at " << FirstmoduleSegmentAngle+imodulesegm*moduleSegmentDeltaAngle << " (in fact from " << FirstmoduleSegmentAngle+imodulesegm*moduleSegmentDeltaAngle-modulesegmentAngularSize/2. << " to " << FirstmoduleSegmentAngle+imodulesegm*moduleSegmentDeltaAngle+modulesegmentAngularSize/2. << ")" << endl;
653  moduleRingShape[istat][imodulesegm] = new TGeoTubeSeg (Form("moduleRing%dshape",istat+1,imodulesegm+1),moduleRingInnerRadius[istat],moduleRingOuterRadius[istat],moduleRingHalfThickness,FirstmoduleSegmentAngle+imodulesegm*moduleSegmentDeltaAngle-modulesegmentAngularSize/2.,FirstmoduleSegmentAngle+imodulesegm*moduleSegmentDeltaAngle+modulesegmentAngularSize/2. );
654  moduleRingVol[istat][imodulesegm] = new TGeoVolume (Form("Gem_moduleRing%d_Volume",istat+1,imodulesegm+1),moduleRingShape[istat][imodulesegm],gGeoMan->GetMedium("copper"));
655  moduleRingTrans[istat][imodulesegm] = new TGeoTranslation (0.,0.,3.853);
656  cout << "moduleRing " << moduleRingInnerRadius[istat] << " " << moduleRingOuterRadius[istat] << endl;
657  moduleRingCombi[istat][imodulesegm] = new TGeoCombiTrans (*moduleRingTrans[istat][imodulesegm],*dummyrot);
658  moduleRingCombi[istat][imodulesegm]->SetName(Form("Gem_moduleRing%d_Volume",istat+1,imodulesegm+1));
659  moduleRingCombi[istat][imodulesegm]->RegisterYourself();
660  moduleRingVol[istat][imodulesegm]->SetLineColor(kGreen);
661  //-----------------------------------------------------------------------------------------------------------------------------------------
662  DiskVol[istat]->AddNode(moduleRingVol[istat][imodulesegm],0,moduleRingCombi[istat][imodulesegm]);
663  //------------------------------------------------------------------------------------------------------------------------------------------
664  }
665  //---------------------------------Cooling Ring-------------------------------------------------------------------------------------------------------------
666  AlumiRingShape[istat] = new TGeoTube (Form("AlumiRing%dshape",istat+1),AlumiRingInnerRadius[istat],AlumiRingOuterRadius[istat],AlumiRingHalfThickness);
667  AlumiRingVol [istat] = new TGeoVolume(Form("Gem_AlumiRing%d_Volume",istat+1),AlumiRingShape[istat],gGeoMan->GetMedium("aluminium"));
668  AlumiRingTrans[istat] = new TGeoTranslation(0.,0.,3.853);
669  cout << "AlumiRing " << AlumiRingInnerRadius[istat] << " " << AlumiRingOuterRadius[istat] << endl;
670  AlumiRingCombi[istat] = new TGeoCombiTrans(*AlumiRingTrans[istat],*dummyrot);
671  AlumiRingCombi[istat]->SetName(Form("Gem_AlumiRing%d_Volume",istat+1));
672  AlumiRingCombi[istat]->RegisterYourself();
673  AlumiRingVol[istat]->SetLineColor(kCyan-9);
674  //----------------------------------------------------------------------------------------------------------------------------------------
675  DiskVol[istat]->AddNode(AlumiRingVol[istat],0,AlumiRingCombi[istat]);
676  //----------------------------------------------------------------------------------------------------------------------------------------
677  //------------------------- GEM tracker cover electronic module -----------------------------------------------------------------------------------------
678  coverRingShape[istat] = new TGeoTube (Form("coverRing%dshape",istat+1),coverRingInnerRadius[istat],coverRingOuterRadius[istat],coverRingHalfThickness);
679  coverRingVol [istat] = new TGeoVolume(Form("Gem_coverRing%d_Volume",istat+1),coverRingShape[istat],gGeoMan->GetMedium("GlassFiber"));
680  coverRingTrans[istat] = new TGeoTranslation(0.,0.,7.803);
681  cout << "coverRing " << coverRingInnerRadius[istat] << " " << coverRingOuterRadius[istat] << endl;
682  coverRingCombi[istat] = new TGeoCombiTrans(*coverRingTrans[istat],*dummyrot);
683  coverRingCombi[istat]->SetName(Form("Gem_coverRing%d_Volume",istat+1));
684  coverRingCombi[istat]->RegisterYourself();
685  coverRingVol[istat]->SetLineColor(kGreen+3);
686  //----------------------------------------------------------------------------------------------------------------------------------------
687  DiskVol[istat]->AddNode(coverRingVol[istat],0,coverRingCombi[istat]);
688  //----------------------------------------------------------------------------------------------------------------------------------------
690  //Double_t firstHLayersOffset = 0.;
691 
692  // for ( Int_t jlay = 0 ; jlay < NofHLayers ; jlay++ ) {
693  // cout << HLayersName[jlay].Data() << " -> " << HLayersThick[jlay] << endl;
694  // firstHLayersOffset += HLayersThick[jlay];
695  // }
696 
697  // cout << "total Hlayers thickness is " << firstHLayersOffset << endl;
698  // firstHLayersOffset = firstHLayersOffset/2.;
699  // firstHLayersOffset = -0.001*(TMath::Floor(1000.*firstHLayersOffset)); //floor: round to nearest integer
700  // cout << "first Hlayer offset is " << firstHLayersOffset << endl;
701 
702  // Double_t HZPosition = firstHLayersOffset;
703 
704  for ( Int_t jlay = 0 ; jlay < NofHLayers ; jlay++ ) {
705  // for ( Int_t jlay = 7 ; jlay < 8 ; jlay++ ) {
706  cout << "doing Hlayers " << jlay << endl;
707 
708  // HZPosition += HLayersThick[jlay]/2.;
709 
710  // if ( HLayersName[jlay].Contains("space") && HLayersThick[jlay] > 0.001 ) {
711  // cout << "***** THE THICK SPACE HLAYER IS AT " << HZPosition << endl;
712  // }
713  // if ( HLayersName[jlay].Contains("space") && HLayersName[jlay].Length() == 5 ) {
714  // HZPosition += LayerThick[jlay]/2.;
715  // continue;
716  // }
717 
718  cout << " got Hlayer " << HLayersName[jlay].Data() << endl;
719 
720  HLayersShapeTube[jlay][istat] = new TGeoTube (Form("T%dT%s",istat+1,HLayersName[jlay].Data()),HInnerRadius[jlay][istat],HOuterRadius[jlay][istat],HLayersThick[jlay]/2.);
721  HLayersShapeHT[jlay][istat] = new TGeoTube (Form("H%dH%s",istat+1,HLayersName[jlay].Data()),0.0,5.00,HLayersThick[jlay]/2.);
722  HLayersShapeHTM[jlay][istat] = new TGeoTube (Form("HTM%dHTM%s",istat+1,HLayersName[jlay].Data()),0.0,4.50,HLayersThick[jlay]/2.+0.0002);
723  HLayersShapeHTD[jlay][istat] = new TGeoTube (Form("HTD%dHTD%s",istat+1,HLayersName[jlay].Data()),0.0,1.90,HLayersThick[jlay]/2.+0.0001);
724  cout << "Tube name is " << HLayersShapeTube[jlay][istat]->GetName() << endl;
725  // cout << "TubeHTM name is " << HLayersShapeHTM[jlay][istat]->GetName() << endl;
726  HLayersShapeBox[jlay][istat] = new TGeoBBox(Form("B%dB%s",istat+1,HLayersName[jlay].Data()),HXBoxWidth,HOuterRadius[jlay][istat],HLayersThick[jlay]/2.);
727  HLayersShapePlate[jlay][istat] = new TGeoBBox(Form("P%dP%s",istat+1,HLayersName[jlay].Data()),HXPlateWidth,HYPlateWidth,HLayersThick[jlay]/2.+0.0001);
728 
729  HLayersTranstA[jlay][istat] = new TGeoTranslation("tA",HTX,HTY[jlay][istat],HTZ);
730  HLayersTranstA[jlay][istat] ->RegisterYourself();
731  HLayersTranstB[jlay][istat] = new TGeoTranslation("tB",HTX,-HTY[jlay][istat],HTZ);
732  HLayersTranstB[jlay][istat] ->RegisterYourself();
733  HLayersTranstC[jlay][istat] = new TGeoTranslation("tC",HTX,HTY[jlay][istat]+9.0,HTZ);
734  HLayersTranstC[jlay][istat] ->RegisterYourself();
735  HLayersTranstD[jlay][istat] = new TGeoTranslation("tD",HTX,HTY[jlay][istat]-9.0,HTZ);
736  HLayersTranstD[jlay][istat] ->RegisterYourself();
737  HLayersTranstE[jlay][istat] = new TGeoTranslation("tE",HTX,-HTY[jlay][istat]+9.0,HTZ);
738  HLayersTranstE[jlay][istat] ->RegisterYourself();
739  HLayersTranstF[jlay][istat] = new TGeoTranslation("tF",HTX,-HTY[jlay][istat]-9.0,HTZ);
740  HLayersTranstF[jlay][istat] ->RegisterYourself();
741 
742  HLayersShapecompos[jlay][istat] = new TGeoCompositeShape(Form("compos%dcompos%s",istat+1,HLayersName[jlay].Data()),
743  Form("T%dT%s+B%dB%s+H%dH%s-HTM%dHTM%s-(P%dP%s:tA)-(HTD%dHTD%s:tC)-(HTD%dHTD%s:tD)-(P%dP%s:tB)-(HTD%dHTD%s:tE)-(HTD%dHTD%s:tF)",
744  istat+1,HLayersName[jlay].Data(),istat+1,HLayersName[jlay].Data(),istat+1,HLayersName[jlay].Data(),istat+1,HLayersName[jlay].Data(),
745  istat+1,HLayersName[jlay].Data(),istat+1,HLayersName[jlay].Data(),istat+1,HLayersName[jlay].Data(),istat+1,HLayersName[jlay].Data(),
746  istat+1,HLayersName[jlay].Data(),istat+1,HLayersName[jlay].Data()));
747 
748  cout << "composite name is " << HLayersShapecompos[jlay][istat] -> GetName() << endl;
749 
750  TString HlayersMaterial = HLayersName[jlay].Data();
751  HlayersMaterial.Remove(0,HlayersMaterial.Last('_')+1);
752  cout << "THE HMATERIAL IS \"" << HlayersMaterial.Data() << "\"" << endl;
753  HLayersVolcomp[jlay][istat] = new TGeoVolume(Form("GEMHLayersCOMP%dGEMHLayersCOMP%s",istat+1,HLayersName[jlay].Data()),HLayersShapecompos[jlay][istat],gGeoMan->GetMedium(HlayersMaterial.Data()));
754  cout << "COMP name is " << HLayersVolcomp[jlay][istat] -> GetName() << endl;
755  cout << "Hlayersmaterial = " << HlayersMaterial.Data() << endl;
756 
757  if ( HlayersMaterial.Contains("carbon" ) )
758  HLayersVolcomp[jlay][istat]->SetLineColor(kPink);
759  if ( HlayersMaterial.Contains("GlassFiber" ) )
760  HLayersVolcomp[jlay][istat]->SetLineColor(kGreen+3);
761 
762  cout << "STATION " << istat << " LAYER " << jlay << " POSITION " << HZPosition[jlay][istat] << endl;
763 
764  HLayersTrans[jlay][istat] = new TGeoTranslation(0.0,0.0,HZPosition[jlay][istat]);
765  HLayersCombi[jlay][istat] = new TGeoCombiTrans(*HLayersTrans[jlay][istat],*dummyrot);
766  HLayersCombi[jlay][istat]->SetName(Form("GEMHLayersCOMP%dGEMHLayersCOMP%s",istat+1,HLayersName[jlay].Data()));
767  HLayersCombi[jlay][istat]->RegisterYourself();
768  DiskVol[istat]->AddNode( HLayersVolcomp[jlay][istat],0,HLayersCombi[jlay][istat] );
769  }
771  //--------------------------------------------------- drift layers-----------------------------------------------------------------------------------------
772 
773  Int_t sensorNumber = 0;
774 
775  for ( Int_t slay = 0 ; slay < NofSensLayers ; slay++ ) {
776  cout << "doing Senslayer " << slay << endl;
777  //SensZPosition[slay][istat] ++ ;
778  if ( SensLayerName[slay].Contains("space") && SensLayerThick[slay] > 0.0 ) {
779  cout << "***** THE THICK SPACE SensLAYER IS AT " << SensZPosition[slay][istat] << endl;
780  }
781  if ( SensLayerName[slay].Contains("space") && SensLayerName[slay].Length() == 5 ) {
782  //SensZPosition[slay][istat] ++ ;
783  continue;
784  }
785 
786  cout << " got layer : " << SensLayerName[slay].Data() << endl;
787 
788 
789  Double_t segPhiSpan = 360./(Double_t(DiskNFoils[istat]));
790  Double_t segBegin = 90.;
791  cout << "will do loop over segments" << endl;
792 
793  for ( Int_t iseg = 0 ; iseg < 1 ; iseg++ ) {
794  cout << "segment " << iseg << endl;
795  SensDiskLayersShapeA[slay][istat][iseg] = new TGeoTube(Form("sdisk%dseg%d%sshape",istat+1,iseg+1,SensLayerName[slay].Data()),
796  SensInnerRadius[slay][istat],SensOuterRadius[slay][istat],
797  SensLayerThick[slay]/2.);
798  SensDiskLayersShapeB[slay][istat][iseg] = new TGeoBBox(Form("srobo%dseg%d%sshape",istat+1,iseg+1,SensLayerName[slay].Data()),
799  sMiddleROBarHfTh[istat],
800  SensOuterRadius[slay][istat],
801  SensLayerThick[slay]);
802  SensDiskLayersSubtr[slay][istat][iseg] = new TGeoSubtraction(SensDiskLayersShapeA[slay][istat][iseg],
803  SensDiskLayersShapeB[slay][istat][iseg]);
804 
805  SensDiskLayersShapeC[slay][istat][iseg] = new TGeoCompositeShape(Form("scomp%dseg%d%sshape",istat+1,iseg+1,SensLayerName[slay].Data()),
806  SensDiskLayersSubtr[slay][istat][iseg]);
807  segBegin += segPhiSpan;
808  cout << " segBegin " << segBegin << endl;
809 
810  SensDiskLayersShapeHole[slay][istat][iseg] = new TGeoTube(Form("sHole%dseg%d%sshape",istat+1,iseg+1,SensLayerName[slay].Data()),0.0,3.80,SensLayerThick[slay]+0.01);
811 
812  SensDiskLayersTranshA[slay][istat][iseg] = new TGeoTranslation("shA",sHoleTX,sHoleTY,sHoleTZ);
813  SensDiskLayersTranshA[slay][istat][iseg] ->RegisterYourself();
814  SensDiskLayersTranshB[slay][istat][iseg] = new TGeoTranslation("shB",sHoleTX,-sHoleTY,sHoleTZ);
815  SensDiskLayersTranshB[slay][istat][iseg] ->RegisterYourself();
816 
817  SensDiskLayersShapecompos[slay][istat][iseg] = new TGeoCompositeShape(Form("scompos%dseg%d%sshape",istat+1,iseg+1,SensLayerName[slay].Data()),
818  Form("scomp%dseg%d%sshape-(sHole%dseg%d%sshape:shA)-(sHole%dseg%d%sshape:shB)",
819  istat+1,iseg+1,SensLayerName[slay].Data(),istat+1,iseg+1,SensLayerName[slay].Data(),istat+1,iseg+1,SensLayerName[slay].Data()));
820  TString SenslayerMaterial = SensLayerName[slay].Data();
821  SenslayerMaterial.Remove(0,SenslayerMaterial.Last('_')+1);
822  cout << "THE MATERIAL IS \"" << SenslayerMaterial.Data() << "\"" << endl;
823  SensDiskLayersVol[slay][istat][iseg] = new TGeoVolume(Form("GemSen_Disk%d_Seg%d_%s",istat+1,iseg+1,SensLayerName[slay].Data()),
824  SensDiskLayersShapecompos[slay][istat][iseg],
825  gGeoMan->GetMedium(SenslayerMaterial.Data()));
826 
827  cout << "Senslayer material = " << SenslayerMaterial.Data() << endl;
828  if ( SenslayerMaterial.Contains("GEMmixture" ) )
829  SensDiskLayersVol[slay][istat][iseg]->SetLineColor(kYellow);
830 
831  SensDiskLayersTrans[slay][istat][iseg] = new TGeoTranslation(0.,0.,SensZPosition[slay][istat]);
832  SensDiskLayersCombi[slay][istat][iseg] = new TGeoCombiTrans(*SensDiskLayersTrans[slay][istat][iseg],*dummyrot);
833  SensDiskLayersCombi[slay][istat][iseg]->SetName(Form("GemSen_Disk%d_Seg%d_%s",istat+1,iseg+1,SensLayerName[slay].Data()));
834  SensDiskLayersCombi[slay][istat][iseg]->RegisterYourself();
835  DiskVol[istat]->AddNode(SensDiskLayersVol[slay][istat][iseg],0,SensDiskLayersCombi[slay][istat][iseg]);
836  }
837 //-------------------------------------------------------------------------------------------------------------------------------------------------------
838  cout << "Svolume " << SensLayerName[slay] << " from "
839  << setprecision(10) << DiskZPosition[istat]+SensZPosition[slay][istat]-SensLayerThick[slay]/2. << " to "
840  << setprecision(10) << DiskZPosition[istat]+SensZPosition[slay][istat]+SensLayerThick[slay]/2. << endl;
841 
842  if ( SensLayerName[slay].Contains("Gem") && SensLayerName[slay].Contains("Sensor") ) {
843  Double_t newRadius = SensInnerRadius[slay][istat];
844  Double_t nofStrips = 0;
845 
846  cout << "srad = " << SensInnerRadius[slay][istat] << " pitch = " << SensorStripPitch[sensorNumber][0] << " for sensor " << sensorNumber << endl;
847  if ( SensorStripType[sensorNumber] != 2 ) {
848  nofStrips = TMath::Ceil(2.*TMath::Pi()*SensInnerRadius[slay][istat]/SensorStripPitch[sensorNumber][0]);
849  newRadius = nofStrips*SensorStripPitch[sensorNumber][0]/2./TMath::Pi();
850  }
851  cout << "!!!! " << istat << " " << slay << " > there shall be " << nofStrips << " strips here so the radius should be " << newRadius << endl;
852  pout << " " << sensorNumber+1 << ", " << SensorStripType[sensorNumber] << ", "
853  << setw(9) << 0. << ", "
854  << setw(9) << 0. << ", "
855  << setw(9) << DiskZPosition[istat]+SensZPosition[slay][istat] << ", "
856  << setw(9) << 0. << ", "
857  << setw(9) << newRadius << ", "
858  << setw(9) << SensOuterRadius[slay][istat] << ", "
859  << setw(9) << SensLayerThick[slay] << ", "
860  << setw(9) << SensorStripAngle[sensorNumber][0] << ", "
861  //<< setw(9) << SensorStripAngle[sensorNumber][1] << ", "
862  << setw(9) << sMiddleROBarHfTh[istat] << ", "
863  << setw(9) << SensorStripPitch[sensorNumber][0] << ", "
864  << setw(9) << SensorStripPitch[sensorNumber][1] << ((istat==NofDisks-1 && sensorNumber==1)?"":", \\")
865  << endl;
866  sensorNumber++;
867  }
868 
869  SensZPosition[slay][istat] ++ ;
870 
871  }
873 
874  Double_t layerPosition = firstLayerOffset;//-LayerThick[0]/2.;
875 
876  Int_t msensorNumber = 0;
877 
878  for ( Int_t ilay = 0 ; ilay < NofLayers ; ilay++ ) {
879  cout << "doing layer " << ilay << endl;
880  layerPosition += LayerThick[ilay]/2.;
881  if ( LayerName[ilay].Contains("space") && LayerThick[ilay] > 0.0 ) {
882  cout << "***** THE THICK SPACE LAYER IS AT " << layerPosition << endl;
883  }
884  if ( LayerName[ilay].Contains("space") && LayerName[ilay].Length() == 5 ) {
885  layerPosition += LayerThick[ilay]/2.;
886  continue;
887  }
888 
889  cout << " got layer : " << LayerName[ilay].Data() << endl;
890 
891  Double_t msegPhiSpan = 360./(Double_t(DiskNFoils[istat]));
892  Double_t msegBegin = 90.;
893  cout << "will do loop over segments" << endl;
894  for ( Int_t miseg = 0 ; miseg < 1 ; miseg++ ) {
895  cout << "segment " << miseg << endl;
896  DiskLayersShapeA[ilay][istat][miseg] = new TGeoTube(Form("disk%dseg%d%sshape",istat+1,miseg+1,LayerName[ilay].Data()),
897  DiskInnerRadius[ilay][istat],DiskOuterRadius[ilay][istat],
898  LayerThick[ilay]/2.);
899  DiskLayersShapeB[ilay][istat][miseg] = new TGeoBBox (Form("robo%dseg%d%sshape",istat+1,miseg+1,LayerName[ilay].Data()),
900  MiddleROBarHfTh[istat],
901  DiskOuterRadius[ilay][istat],
902  LayerThick[ilay]);
903  DiskLayersSubtr[ilay][istat][miseg] = new TGeoSubtraction(DiskLayersShapeA[ilay][istat][miseg],
904  DiskLayersShapeB[ilay][istat][miseg]);
905 
906  DiskLayersShapeC[ilay][istat][miseg] = new TGeoCompositeShape(Form("comp%dseg%d%sshape",istat+1,miseg+1,LayerName[ilay].Data()),
907  DiskLayersSubtr[ilay][istat][miseg]);
908  msegBegin += msegPhiSpan;
909  cout << " msegBegin " << msegBegin << endl;
910 
911  DiskLayersShapeHole[ilay][istat][miseg] = new TGeoTube(Form("Hole%dseg%d%sshape",istat+1,miseg+1,LayerName[ilay].Data()),0.0,3.80,LayerThick[ilay]+0.01);
912 
913  DiskLayersTranshA[ilay][istat][miseg] = new TGeoTranslation("hA",HoleTX,HoleTY,HoleTZ);
914  DiskLayersTranshA[ilay][istat][miseg] ->RegisterYourself();
915  DiskLayersTranshB[ilay][istat][miseg] = new TGeoTranslation("hB",HoleTX,-HoleTY,HoleTZ);
916  DiskLayersTranshB[ilay][istat][miseg] ->RegisterYourself();
917 
918  DiskLayersShapecompos[ilay][istat][miseg] = new TGeoCompositeShape(Form("compos%dseg%d%sshape",istat+1,miseg+1,LayerName[ilay].Data()),
919  Form("comp%dseg%d%sshape-(Hole%dseg%d%sshape:hA)-(Hole%dseg%d%sshape:hB)",
920  istat+1,miseg+1,LayerName[ilay].Data(),istat+1,miseg+1,LayerName[ilay].Data(),istat+1,miseg+1,LayerName[ilay].Data()));
921 
922 
923  TString layerMaterial = LayerName[ilay].Data();
924  layerMaterial.Remove(0,layerMaterial.Last('_')+1);
925  cout << "THE MATERIAL IS \"" << layerMaterial.Data() << "\"" << endl;
926  DiskLayersVol[ilay][istat][miseg] = new TGeoVolume(Form("Gem_Disk%d_Seg%d_%s",istat+1,miseg+1,LayerName[ilay].Data()),
927  DiskLayersShapecompos[ilay][istat][miseg],
928  gGeoMan->GetMedium(layerMaterial.Data()));
929 
930  cout << "layer material = " << layerMaterial.Data() << endl;
931  if ( layerMaterial.Contains("air" ) )
932  DiskLayersVol[ilay][istat][miseg]->SetLineColor(kWhite);kGray+1);
933  if ( layerMaterial.Contains("copper" ) )
934  DiskLayersVol[ilay][istat][miseg]->SetLineColor(kOrange+1);
935  if ( layerMaterial.Contains("kapton" ) )
936  DiskLayersVol[ilay][istat][miseg]->SetLineColor(kOrange+2);
937  if ( layerMaterial.Contains("aluminium" ) )
938  DiskLayersVol[ilay][istat][miseg]->SetLineColor(kCyan-9);
939  if ( layerMaterial.Contains("GEMmixture" ) )
940  DiskLayersVol[ilay][istat][miseg]->SetLineColor(kYellow);
941  if ( layerMaterial.Contains("carbon" ) )
942  DiskLayersVol[ilay][istat][miseg]->SetLineColor(kPink);
943  if ( layerMaterial.Contains("GlassFiber" ) )
944  DiskLayersVol[ilay][istat][miseg]->SetLineColor(kGreen+3);
945 
946  DiskLayersTrans[ilay][istat][miseg] = new TGeoTranslation(0.,0.,layerPosition);
947  DiskLayersCombi[ilay][istat][miseg] = new TGeoCombiTrans(*DiskLayersTrans[ilay][istat][miseg],*dummyrot);
948  DiskLayersCombi[ilay][istat][miseg]->SetName(Form("Gem_Disk%d_Seg%d_%s",istat+1,miseg+1,LayerName[ilay].Data()));
949  DiskLayersCombi[ilay][istat][miseg]->RegisterYourself();
950  DiskVol[istat]->AddNode(DiskLayersVol[ilay][istat][miseg],0,DiskLayersCombi[ilay][istat][miseg]);
951 
952  }
953  //-----------------------------------------------------------------------------------------------------------------------------------------------------------
954  cout << "mvolume " << LayerName[ilay] << " from "
955  << setprecision(10) << DiskZPosition[istat]+layerPosition-LayerThick[ilay]/2. << " to "
956  << setprecision(10) << DiskZPosition[istat]+layerPosition+LayerThick[ilay]/2. << endl;
957 
958  if ( LayerName[ilay].Contains("Gem") && LayerName[ilay].Contains("Sensor") ) {
959  Double_t mnewRadius = DiskInnerRadius[ilay][istat];
960  Double_t mnofStrips = 0;
961 
962  cout << "mrad = " << DiskInnerRadius[ilay][istat] << " pitch = " << SensorStripPitch[msensorNumber][0] << " for sensor " << msensorNumber << endl;
963  if ( SensorStripType[msensorNumber] != 2 ) {
964  mnofStrips = TMath::Ceil(2.*TMath::Pi()*DiskInnerRadius[ilay][istat]/SensorStripPitch[msensorNumber][0]);
965  mnewRadius = mnofStrips*SensorStripPitch[msensorNumber][0]/2./TMath::Pi();
966  }
967  cout << "!!!! " << istat << " " << ilay << " > there shall be " << mnofStrips << " strips here so the radius should be " << mnewRadius << endl;
968  pout << " " << msensorNumber+1 << ", " << SensorStripType[msensorNumber] << ", "
969  << setw(9) << 0. << ", " // setw:sets the field width to be used on output operations
970  << setw(9) << 0. << ", "
971  << setw(9) << DiskZPosition[istat]+layerPosition << ", "
972  << setw(9) << 0. << ", "
973  << setw(9) << mnewRadius << ", "
974  << setw(9) << DiskOuterRadius[ilay][istat] << ", "
975  << setw(9) << LayerThick[ilay] << ", "
976  << setw(9) << SensorStripAngle[msensorNumber][0] << ", "
977  // << setw(9) << SensorStripAngle[msensorNumber][1] << ", "
978  << setw(9) << MiddleROBarHfTh[istat] << ", "
979  << setw(9) << SensorStripPitch[msensorNumber][0] << ", "
980  << setw(9) << SensorStripPitch[msensorNumber][1] << ((istat==NofDisks-1&&msensorNumber==1)?"":", \\")
981  << endl;
982  msensorNumber++;
983  }
984 
985  layerPosition += LayerThick[ilay]/2.;
986  }
987 //---------------------------------------------------------------------------------------------------------------------------------------------------------------
988  SubunitVol->AddNode(DiskVol[istat],0,DiskCombi[istat]);
989 
990  }
992  pout << "TrackFinderOnHits_ParThetaA: Double_t 59.4" << endl
993  << "TrackFinderOnHits_ParThetaB: Double_t -0.02" << endl
994  << "TrackFinderOnHits_ParTheta0: Double_t 56.1372" << endl
995  << "TrackFinderOnHits_ParTheta1: Double_t -0.000564362" << endl
996  << "TrackFinderOnHits_ParTheta2: Double_t -0.181828" << endl
997  << "TrackFinderOnHits_ParTheta3: Double_t 0.284289" << endl
998  << "TrackFinderOnHits_ParRadPhi0:Double_t 0.9944432" << endl
999  << "TrackFinderOnHits_ParRadPhi2:Double_t -0.000590706" << endl
1000  << "TrackFinderOnHits_ParMat0: Double_t \\" << endl
1001  // << " -2.31333e-6, 0.00067035, 0.10173" << endl
1002  << " -2.35034328e-6, 0.0006810756, 0.10335768" << endl
1003  << "TrackFinderOnHits_ParMat1: Double_t \\" << endl
1004  // << " -7.46844e-10, -6.6696e-7, 0.000736672" << endl
1005  << " -7.58793504e-10, -6.7763136e-7, 0.000748458752" << endl
1006  << "##########################################################################################" << flush;
1008 
1009  // ----------------------- Riddle shell -------------------------------------------------------------------------------------------------------------------------------
1010  RiddleShapeTubeA = new TGeoTube ("TubeA" , 43.3, 46.3, 0.10 );
1011  RiddleShapeTubeB = new TGeoTube ("TubeB" , 46.2, 46.3, 9.10 );
1012  RiddleShapeCone = new TGeoCone ("Cone" , 18.2, 46.2, 46.3, 69.0, 69.1 );
1013  RiddleShapeTubeC = new TGeoTube ("TubeC" , 69.0, 75.4, 0.10 );
1014  RiddleShapeTubeD = new TGeoTube ("TubeD" , 75.4, 75.5, 10.4 );
1015  RiddleShapeTubeE = new TGeoTube ("TubeE" , 72.5, 75.4, 0.10 );
1016  RiddleShapeTubeF = new TGeoTube ("TubeF" , 0.00, 8.00, 5.00 );
1017 
1018  RiddleTransTubeA = new TGeoTranslation("trA",0.0,0.0,9.20);
1019  RiddleTransTubeA ->RegisterYourself();
1020  RiddleTransCone = new TGeoTranslation("trB",0.0,0.0,36.5);
1021  RiddleTransCone ->RegisterYourself();
1022  RiddleTransTubeC = new TGeoTranslation("trC",0.0,0.0,54.6);
1023  RiddleTransTubeC ->RegisterYourself();
1024  RiddleTransTubeD = new TGeoTranslation("trD",0.0,0.0,64.5);
1025  RiddleTransTubeD ->RegisterYourself();
1026  RiddleTransTubeE = new TGeoTranslation("trE",0.0,0.0,74.4);
1027  RiddleTransTubeE ->RegisterYourself();
1028 
1029  //RiddleShapecompos = new TGeoCompositeShape("riddle", "TubeA+(TubeB:trA)+(Cone:trB)+(TubeC:trC)+(TubeD:trD)+(TubeE:trE)" );
1030 
1031  // ---------putting holes on the Riddle--------------------------------------
1032 
1033  const Int_t NofHoles = 16.0;
1034  const Double_t rotDeltaAngle = 360.0/(Double_t(NofHoles));
1035  const Int_t NofHolesRows = 4;
1036 
1037  Double_t holePosR[4] = {46,52,64,75}; // holes X position
1038  Double_t holePosD[4] = {90,-60,-60,90}; // holes angles
1039  Double_t holePosZ[4] = {9,28,45,65}; // holes Z position
1040 
1041  TString RiddleshapeFormula = "TubeA+(TubeB:trA)+(Cone:trB)+(TubeC:trC)+(TubeD:trD)+(TubeE:trE)" ;
1042 
1043 
1044  for ( Int_t irow = 0 ; irow < NofHolesRows ; irow++ ) {
1045  for ( Int_t ihole= 0 ; ihole < NofHoles ; ihole++ ) {
1046 
1047  Double_t holePosA = ihole*rotDeltaAngle;
1048  Double_t holePosX = holePosR[irow]*TMath::Cos(holePosA*TMath::DegToRad());
1049  Double_t holePosY = holePosR[irow]*TMath::Sin(holePosA*TMath::DegToRad());
1050 
1051  RiddleTransTubeF[irow][ihole] = new TGeoTranslation(Form("trF%d_%d",irow+1, ihole+1) , holePosX, holePosY,holePosZ[irow]);
1052  RiddleTransTubeF[irow][ihole] ->RegisterYourself();
1053 
1054  RiddleRothole[irow][ihole] = new TGeoRotation(Form("ro%d_%d" , irow+1, ihole+1) ,holePosA+90, holePosD[irow],20);
1055  RiddleRothole[irow][ihole] ->RegisterYourself();
1056 
1057  RiddleCombiTranshole[irow][ihole] = new TGeoCombiTrans( *RiddleTransTubeF[irow][ihole] , *RiddleRothole[irow][ihole] );
1058 
1059  RiddleCombiTranshole[irow][ihole] ->SetName(Form("TR%d_%d",irow+1, ihole+1));
1060  RiddleCombiTranshole[irow][ihole] ->RegisterYourself();
1061 
1062  RiddleshapeFormula += Form("-(TubeF:TR%d_%d)" , irow+1,ihole+1 );
1063 
1064  }
1065  }
1066  cout<< " RiddleshapeFormula = \"" <<RiddleshapeFormula.Data()<< "\""<< endl;
1067 
1068  RiddleShapecompos = new TGeoCompositeShape("riddle", RiddleshapeFormula );
1069 
1071 
1072  RiddleVolcomp = new TGeoVolume("GEMriddleCOMP", RiddleShapecompos,gGeoMan->GetMedium("carbon"));
1073 
1074 
1075  RiddleTrans = new TGeoTranslation(0.0,0.0,116.8);
1076  RiddleCombi = new TGeoCombiTrans(*RiddleTrans,*dummyrot);
1077  RiddleCombi->SetName("GEMriddleCOMP");
1078  RiddleCombi->RegisterYourself();
1079  RiddleVolcomp->SetLineColor(kGray+1);
1080  SubunitVol->AddNode(RiddleVolcomp,0,RiddleCombi);
1081 //---------------------------------------------------------------------------------------------------------------------------------------------------------
1082 //------------------ cables top 1 --------------------------------------------------------------------------------------------------------------------------
1083  tAcopperbarShape = new TGeoPara ("tAcopperbarshape",lcopperbarx,lcopperbary,lcopperbarHalfThickness, 0.0, -24.0, 0.0);
1084  tAcopperbarVol = new TGeoVolume("GEM_tAcopperbarVolume",tAcopperbarShape,gGeoMan->GetMedium("copper"));
1085  tAcopperbarTrans = new TGeoTranslation(0.,47.3,141.35);
1086  tAcopperbarRot = new TGeoRotation("tAcopperbarrot",-90.0,0.0,0.0);
1087  tAcopperbarRot ->RegisterYourself();
1088  tAcopperbarCombi = new TGeoCombiTrans(*tAcopperbarTrans,*tAcopperbarRot);
1089  tAcopperbarCombi->SetName("GEM_tAcopperbar_Volume");
1090  tAcopperbarCombi->RegisterYourself();
1091  tAcopperbarVol->SetLineColor(kOrange+1);
1092  SubunitVol->AddNode(tAcopperbarVol,0,tAcopperbarCombi);
1093 //------------------------ cables top 2 -------------------------------------------------------------------------------------------------------------------------
1094  tBcopperbarShape = new TGeoPara ("tBcopperbarshape",rcopperbarx,rcopperbary,rcopperbarHalfThickness, 0.0, -45.0, 0.0);
1095  tBcopperbarVol = new TGeoVolume("GEM_tBcopperbarVolume",tBcopperbarShape,gGeoMan->GetMedium("copper"));
1096  tBcopperbarTrans = new TGeoTranslation(0.,61.8,171.9);
1097  tBcopperbarRot = new TGeoRotation("tBcopperbarrot",-90.0,0.0,0.0);
1098  tBcopperbarRot ->RegisterYourself();
1099  tBcopperbarCombi = new TGeoCombiTrans(*tBcopperbarTrans,*tBcopperbarRot);
1100  tBcopperbarCombi->SetName("GEM_tBcopperbar_Volume");
1101  tBcopperbarCombi->RegisterYourself();
1102  tBcopperbarVol->SetLineColor(kOrange+1);
1103  SubunitVol->AddNode(tBcopperbarVol,0,tBcopperbarCombi);
1104  //------------------ cables down 1 --------------------------------------------------------------------------------------------------------------------------
1105  dAcopperbarShape = new TGeoPara ("dAcopperbarshape",lcopperbarx,lcopperbary,lcopperbarHalfThickness, 0.0, -24.0, 0.0);
1106  dAcopperbarVol = new TGeoVolume("GEM_dAcopperbarVolume",dAcopperbarShape,gGeoMan->GetMedium("copper"));
1107  dAcopperbarTrans = new TGeoTranslation(0.,-47.3,141.35);
1108  dAcopperbarRot = new TGeoRotation("dAcopperbarrot",90.0,0.0,0.0);
1109  dAcopperbarRot ->RegisterYourself();
1110  dAcopperbarCombi = new TGeoCombiTrans(*dAcopperbarTrans,*dAcopperbarRot);
1111  dAcopperbarCombi->SetName("GEM_dAcopperbar_Volume");
1112  dAcopperbarCombi->RegisterYourself();
1113  dAcopperbarVol->SetLineColor(kOrange+1);
1114  SubunitVol->AddNode(dAcopperbarVol,0,dAcopperbarCombi);
1115 //------------------------ cables down 2 -------------------------------------------------------------------------------------------------------------------------
1116  dBcopperbarShape = new TGeoPara ("dBcopperbarshape",rcopperbarx,rcopperbary,rcopperbarHalfThickness, 0.0, -45.0, 0.0);
1117  dBcopperbarVol = new TGeoVolume("GEM_dBcopperbarVolume",dBcopperbarShape,gGeoMan->GetMedium("copper"));
1118  dBcopperbarTrans = new TGeoTranslation(0.,-61.8,171.9);
1119  dBcopperbarRot = new TGeoRotation("dBcopperbarrot",90.0,0.0,0.0);
1120  dBcopperbarRot ->RegisterYourself();
1121  dBcopperbarCombi = new TGeoCombiTrans(*dBcopperbarTrans,*dBcopperbarRot);
1122  dBcopperbarCombi->SetName("GEM_dBcopperbar_Volume");
1123  dBcopperbarCombi->RegisterYourself();
1124  dBcopperbarVol->SetLineColor(kOrange+1);
1125  SubunitVol->AddNode(dBcopperbarVol,0,dBcopperbarCombi);
1127 
1128  top->AddNode(SubunitVol,0,new TGeoCombiTrans());
1129 
1130  // top->CheckOverlaps(0.0001, "");
1131  // gGeoManager->CheckOverlaps(0.0001,""); // [cm]
1132  // gGeoManager->CheckGeometryFull();
1133 
1134  // TObjArray *listOfOverlaps = gGeoManager->GetListOfOverlaps();
1135  // cout << "************************************************" << endl;
1136  // cout<<listOfOverlaps->GetEntries()<<endl;
1137  // listOfOverlaps->Print();
1138  // cout << "************************************************" << endl;
1139 
1140  // gGeoManager->CheckOverlaps();
1141  // gGeoManager->PrintOverlaps();
1142 
1143  gGeoMan->CloseGeometry();
1144  top->Write();
1145  fi->Close();
1146  //gGeoManager->Export(outfile);
1147 
1148  //top->Raytrace();
1149  top->Draw("ogl");
1150  //top->Draw();
1151 
1152  pout.close();
1153 return 0;
1154 }
TGeoRotation * dummyrot
FairGeoLoader * geoLoad
FairGeoMedia * Media
TGeoManager * gGeoMan
FairGeoMedium * CbmMediumCarbon
static T Sin(const T &x)
Definition: PndCAMath.h:42
static T Cos(const T &x)
Definition: PndCAMath.h:43
TGeoVolume * top
FairGeoMedium * CbmMediumAluminium
TGeoVolume * SubunitVol
FairGeoBuilder * geobuild
TFile * fi
Double_t
TString medium
FairGeoMedium * CbmMediumAir
FairGeoMedium * CbmMediumPWO
FairGeoInterface * geoFace
vDisk SetLineColor(colYellow)
Double_t Pi
TString outfile