BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
BesMucConstruction Class Reference

#include <BesMucConstruction.hh>

+ Inheritance diagram for BesMucConstruction:

Public Member Functions

 BesMucConstruction ()
 
virtual ~BesMucConstruction ()
 
void Construct (G4LogicalVolume *logicBes)
 
G4VPhysicalVolume * GetPhysicalMuc ()
 
- Public Member Functions inherited from BesSubdetector
 BesSubdetector ()
 
virtual ~BesSubdetector ()
 
G4LogicalVolume * FindLogicalVolume (const G4String &vn)
 

Additional Inherited Members

- Protected Attributes inherited from BesSubdetector
SAXProcessor m_sxp
 
ProcessingConfigurator m_config
 

Detailed Description

Definition at line 20 of file BesMucConstruction.hh.

Constructor & Destructor Documentation

◆ BesMucConstruction()

BesMucConstruction::BesMucConstruction ( )

Definition at line 33 of file BesMucConstruction.cc.

34{
35}

◆ ~BesMucConstruction()

BesMucConstruction::~BesMucConstruction ( )
virtual

Definition at line 37 of file BesMucConstruction.cc.

38{
39}

Member Function Documentation

◆ Construct()

void BesMucConstruction::Construct ( G4LogicalVolume * logicBes)
virtual

Implements BesSubdetector.

Definition at line 41 of file BesMucConstruction.cc.

42{
43 //construct Muc
44
45 //Dengzy for boostroot environment
46// ReadBoostRoot* boostroot=new ReadBoostRoot();
47// G4String GeometryPath = boostroot->GetBoostRoot();
48// delete boostroot;
49
50// if(!GeometryPath){
51// G4Exception("BOOST environment not set!");
52// }
53// GeometryPath += "/dat/Muc.gdml";
54
55// m_config.SetURI(GeometryPath);
56// m_config.SetSetupName( "Muc" );
57// m_config.SetSetupVersion( "1.0" );
58// m_config.SetType( "G4" );
59// m_sxp.Configure(&m_config);
60// m_sxp.Initialize();
61// m_sxp.Run();
62
63// G4cout << "Construct Muc from" << GeometryPath << G4endl;
64// G4LogicalVolume* logicalMuc = FindLogicalVolume("logicalMuc");
65
66 // init geo from MucGeoSvc 2006.11.23
67
68 MucG4Geo *aMucG4Geo = new MucG4Geo();
69 G4LogicalVolume* logicalMuc = aMucG4Geo->GetTopVolume();
70 //G4LogicalVolume* logicalMuc = MucG4Geo::Instance()->GetTopVolume();
71
72 if(!logicalMuc) {
73 G4cout << "BesMucConstruction::Construct() 1, logicalMuc not found!" << G4endl;
74 }
75 else {
76 //G4cout << "Muc" exist" << G4endl;
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 //sensitive detectors
88 G4SDManager* aSDman = G4SDManager::GetSDMpointer();
89 BesMucSD* aMucSD = new BesMucSD("BesMucSD", this);
90 aSDman->AddNewDetector(aMucSD);
91
92 G4LogicalVolume* lv = 0;
93
94 G4int partMax = 3;
95 //G4int segMax = 8, absorberMax = 9, gapMax = 9, panelMax = 4;
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 //for(seg = 0; seg < 1; seg++) {
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// sf << "logical" << "Muc"
122// << "Part" << part
123// << "Seg" << seg
124// << "Gap" << gap
125// << "RpcUpDown" << gasChamber
126// << "Panel" << panel
127// << "GasChamber"
128// << std::ends;
129
130 lv = FindLogicalVolume(sf.str());
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 //visulizatioin attibutes
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
152 lv = FindLogicalVolume("logicalMuc");
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
171 lv = FindLogicalVolume(sf.str());
172 if(lv) {
173 lv->SetVisAttributes(absorberVisAtt);
174 //if(part == 1 || seg == 0 || seg == 1 || seg == 2) {
175 if(part != 1) {
176 lv->SetVisAttributes (G4VisAttributes::Invisible);
177 }
178 }
179 }
180 }
181 }
182
183// for(part = 0; part < partMax; part++) {
184// for(seg = 0; seg < segOnPart[part]; seg++) {
185// for(absorber = 0; absorber < absorberOnPart[part]; absorber++) {
186// for(panel = 0; panel < panelOnPart[part]; panel++) {
187// std::ostrstream sf;
188// sf << "logical"
189// << "MucPart" << part
190// << "Seg" << seg
191// << "Absorber" << absorber
192// << "Panel" << panel
193// << std::ends;
194
195// lv = FindLogicalVolume(sf.str());
196// if(lv) {
197// lv->SetVisAttributes(absorberVisAtt);
198// if(part != 1) {
199// lv->SetVisAttributes (G4VisAttributes::Invisible);
200// }
201// //lv->SetVisAttributes (G4VisAttributes::Invisible);
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
218 lv = FindLogicalVolume(sf.str());
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 // for(seg = 0; seg < segOnPart[part]; seg++) {
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
239 lv = FindLogicalVolume(sf.str());
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 //for(seg = 0; seg < segOnPart[part]; seg++) {
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
274 lv = FindLogicalVolume(sf.str());
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 // for(seg = 0; seg < segOnPart[part]; seg++) {
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
299 lv = FindLogicalVolume(sf.str());
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 // for(seg = 0; seg < segOnPart[part]; seg++) {
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
326 lv = FindLogicalVolume(sf.str());
327 if(lv) {
328 lv->SetVisAttributes(gasChamberVisAtt);
329 //if( (part == 1 && (seg == 0 || seg == 1 || seg == 3 || seg == 4) )
330 // || (part == 0 && (seg == 0 || seg == 1 || seg ==2) ) ) {
331 //lv->SetVisAttributes (G4VisAttributes::Invisible);
332 //}
333 if(part != 1) {
334 lv->SetVisAttributes(G4VisAttributes::Invisible);
335 }
336 }
337 }
338 }
339 }
340 }
341 }
342 //m_sxp.Finalize();
343 delete aMucG4Geo;
344}
G4LogicalVolume * FindLogicalVolume(const G4String &vn)
G4LogicalVolume * GetTopVolume()
Get the top(world) volume;.

Referenced by BesDetectorConstruction::Construct().

◆ GetPhysicalMuc()

G4VPhysicalVolume * BesMucConstruction::GetPhysicalMuc ( )
inline

Definition at line 29 of file BesMucConstruction.hh.

29{return physicalMuc;};

Referenced by BesMucSD::BesMucSD().


The documentation for this class was generated from the following files: