FairRoot/PandaRoot
Functions
create3StationsGem_v2_1.C File Reference

Go to the source code of this file.

Functions

Int_t create3StationsGem_v2_1 ()
 

Function Documentation

Int_t create3StationsGem_v2_1 ( )

Definition at line 3 of file create3StationsGem_v2_1.C.

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