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