38 {
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64 MucG4Geo* aMucG4Geo = new MucG4Geo();
66
67
68 if ( !logicalMuc )
69 { G4cout << "BesMucConstruction::Construct() 1, logicalMuc not found!" << G4endl; }
70 else
71 {
72
73 physicalMuc = new G4PVPlacement( 0, G4ThreeVector( 0, 0, 0 ), logicalMuc, "PhysicalMuc",
74 logicBes, false, 0 );
75 logicalMuc->SetVisAttributes( G4VisAttributes::Invisible );
76 }
77
78
79 G4SDManager* aSDman = G4SDManager::GetSDMpointer();
80 BesMucSD* aMucSD = new BesMucSD( "BesMucSD", this );
81 aSDman->AddNewDetector( aMucSD );
82
83 G4LogicalVolume* lv = 0;
84
85 G4int partMax = 3;
86
87 G4int stripMax = 96, bakeliteMax = 4, gasChamberMax = 2;
88 G4int segOnPart[3] = { 4, 8, 4 };
89 G4int absorberOnPart[3] = { 9, 9, 9 };
90 G4int gapOnPart[3] = { 8, 9, 8 };
91 G4int panelOnPart[3] = { 3, 4, 3 };
92 G4int part, seg, absorber, panel, gap, bakelite, gasChamber, strip;
93
94 for ( part = 0; part < partMax; part++ )
95 {
96
97 for ( seg = 0; seg < segOnPart[part]; seg++ )
98 {
99 if ( seg == 0 || part == 1 && seg == 2 )
100 {
101 for ( gap = 0; gap < gapOnPart[part]; gap++ )
102 {
103 for ( gasChamber = 0; gasChamber < gasChamberMax; gasChamber++ )
104 {
105 int seg_shift = 0;
106 if ( part == 1 && seg == 2 ) seg_shift = 1;
107 for ( panel = 0; panel < panelOnPart[part] + seg_shift; panel++ )
108 {
109 std::ostrstream sf;
110 sf << "l"
111 << "Muc"
112 << "P" << part << "S" << seg << "G" << gap << "R" << gasChamber << "Pn"
113 << panel << "C" << std::ends;
114
115
116
117
118
119
120
121
122
123
125 if ( !lv )
126 {
127 G4cout << "BesMucConstruction::Construct(), " << sf.str() << " not found!"
128 << G4endl;
129 }
130 else { lv->SetSensitiveDetector( aMucSD ); }
131 }
132 }
133 }
134 }
135 }
136 }
137
138
139 G4VisAttributes* mucVisAtt = new G4VisAttributes( G4Colour( 1.0, 0.0, 1.0, 0.05 ) );
140 G4VisAttributes* absorberVisAtt = new G4VisAttributes( G4Colour( 1.0, 0.3, 0.0, 1.0 ) );
141 G4VisAttributes* gapVisAtt = new G4VisAttributes( G4Colour( 0.5, 0.5, 0.5, 1.0 ) );
142 G4VisAttributes* stripVisAtt = new G4VisAttributes( G4Colour( 1.0, 0.0, 1.0, 1.0 ) );
143 G4VisAttributes* bakeliteVisAtt = new G4VisAttributes( G4Colour( 1.0, 1.0, 0.0, 1.0 ) );
144 G4VisAttributes* gasChamberVisAtt = new G4VisAttributes( G4Colour( 0.6, 0.8, 1.0, 1.0 ) );
145
147 if ( !lv ) { G4cout << "BesMucConstruction::Construct() 2, logicMuc not found!" << G4endl; }
148 else
149 {
150 lv->SetVisAttributes( mucVisAtt );
151 lv->SetVisAttributes( G4VisAttributes::Invisible );
152 }
153
154 for ( part = 0; part < partMax; part++ )
155 {
156 for ( seg = 0; seg < segOnPart[part]; seg++ )
157 {
158 for ( absorber = 0; absorber < absorberOnPart[part]; absorber++ )
159 {
160 std::ostrstream sf;
161 sf << "logical"
162 << "Muc"
163 << "Part" << part << "Seg" << seg << "Absorber" << absorber << std::ends;
164
166 if ( lv )
167 {
168 lv->SetVisAttributes( absorberVisAtt );
169
170 if ( part != 1 ) { lv->SetVisAttributes( G4VisAttributes::Invisible ); }
171 }
172 }
173 }
174 }
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201 for ( part = 0; part < partMax; part++ )
202 {
203 for ( seg = 0; seg < segOnPart[part]; seg++ )
204 {
205 for ( gap = 0; gap < gapOnPart[part]; gap++ )
206 {
207 std::ostrstream sf;
208 sf << "logical"
209 << "Muc"
210 << "Part" << part << "Seg" << seg << "Gap" << gap << std::ends;
211
213 if ( lv )
214 {
215 lv->SetVisAttributes( gapVisAtt );
216 lv->SetVisAttributes( G4VisAttributes::Invisible );
217 }
218 }
219 }
220 }
221
222 for ( part = 0; part < partMax; part++ )
223 {
224 for ( seg = 0; seg < 1; seg++ )
225 {
226
227 for ( gap = 0; gap < gapOnPart[part]; gap++ )
228 {
229 std::ostrstream sf;
230 sf << "logical"
231 << "Muc"
232 << "Part" << part << "Seg" << seg << "Gap" << gap << "StripPlane" << std::ends;
233
235 if ( lv )
236 {
237 lv->SetVisAttributes( gapVisAtt );
238 lv->SetVisAttributes( G4VisAttributes::Invisible );
239 }
240 }
241 }
242 }
243
244 for ( part = 0; part < partMax; part++ )
245 {
246 for ( seg = 0; seg < 1; seg++ )
247 {
248
249 for ( gap = 0; gap < gapOnPart[part]; gap++ )
250 {
251 for ( strip = 0; strip < stripMax; strip++ )
252 {
253 std::ostrstream sf;
254 if ( strip >= 0 && strip < 10 )
255 {
256 sf << "logical"
257 << "Muc"
258 << "Part" << part << "Seg" << seg << "Gap" << gap << "Strip0" << strip
259 << std::ends;
260 }
261 else if ( strip >= 10 && strip < 100 )
262 {
263 sf << "logical"
264 << "Muc"
265 << "Part" << part << "Seg" << seg << "Gap" << gap << "Strip" << strip
266 << std::ends;
267 }
268 else
269 {
270 G4cout << "BesMucConstruction::Construct(), strip=" << strip << " error!"
271 << G4endl;
272 }
273
275 if ( lv )
276 {
277 lv->SetVisAttributes( stripVisAtt );
278 lv->SetVisAttributes( G4VisAttributes::Invisible );
279 }
280 }
281 }
282 }
283 }
284
285 for ( part = 0; part < partMax; part++ )
286 {
287 for ( seg = 0; seg < 1; seg++ )
288 {
289
290 for ( gap = 0; gap < gapOnPart[part]; gap++ )
291 {
292 for ( panel = 0; panel < panelOnPart[part]; panel++ )
293 {
294 for ( bakelite = 0; bakelite < bakeliteMax; bakelite++ )
295 {
296 std::ostrstream sf;
297 sf << "logical"
298 << "Muc"
299 << "Part" << part << "Seg" << seg << "Gap" << gap << "Panel" << panel
300 << "Bakelite" << bakelite << std::ends;
301
303 if ( lv )
304 {
305 lv->SetVisAttributes( bakeliteVisAtt );
306 lv->SetVisAttributes( G4VisAttributes::Invisible );
307 }
308 }
309 }
310 }
311 }
312 }
313
314 for ( part = 0; part < partMax; part++ )
315 {
316 for ( seg = 0; seg < 1; seg++ )
317 {
318
319 for ( gap = 0; gap < gapOnPart[part]; gap++ )
320 {
321 for ( panel = 0; panel < panelOnPart[part]; panel++ )
322 {
323 for ( gasChamber = 0; gasChamber < gasChamberMax; gasChamber++ )
324 {
325 std::ostrstream sf;
326 sf << "logical"
327 << "Muc"
328 << "Part" << part << "Seg" << seg << "Gap" << gap << "Panel" << panel
329 << "GasChamber" << gasChamber << std::ends;
330
332 if ( lv )
333 {
334 lv->SetVisAttributes( gasChamberVisAtt );
335
336
337
338
339 if ( part != 1 ) { lv->SetVisAttributes( G4VisAttributes::Invisible ); }
340 }
341 }
342 }
343 }
344 }
345 }
346
347 delete aMucG4Geo;
348}
G4LogicalVolume * FindLogicalVolume(const G4String &vn)
G4LogicalVolume * GetTopVolume()
Get the top(world) volume;.