47 G4SDManager* SDman = G4SDManager::GetSDMpointer();
48 G4String mdcSDname =
"BesMdcSD";
49 aTrackerSD =
new BesMdcSD( mdcSDname );
50 SDman->AddNewDetector( aTrackerSD );
54 G4LogicalVolume* logicalMdc = 0;
55 G4LogicalVolume* lv = 0;
62 { G4cout <<
"BesMdcConstruction::Construct(), logicalMdc not found" << G4endl; }
66 mdc_phys =
new G4PVPlacement( 0, G4ThreeVector( 0, 0, 0 ), logicalMdc,
"physicalMdc",
67 logicBes,
false, 0,
false );
68 logicalMdc->SetVisAttributes( G4VisAttributes::Invisible );
71 G4VisAttributes* visAttStereoLayer =
new G4VisAttributes( G4Colour( 0., 1., 0. ) );
72 G4VisAttributes* visAttAxialLayer =
new G4VisAttributes( G4Colour( 1., 0., 0. ) );
73 G4int segmentNo = mdc->SegmentNo();
74 G4double colorShift = 0., shift = 1.0 / ( segmentNo - 1 );
76 for (
int i = 1; i < segmentNo; i++ )
78 std::ostringstream osnameSegment;
79 osnameSegment <<
"logical"
82 lv = (G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume(
83 osnameSegment.str() );
84 G4VisAttributes* visAttSegment =
85 new G4VisAttributes( G4Colour( 1.0 - colorShift, 0.0 + colorShift, 0.0 ) );
86 if ( i < 3 ) visAttSegment->SetForceWireframe(
true );
89 lv->SetVisAttributes( visAttSegment );
92 else G4cout <<
"logical volume " << osnameSegment.str() <<
"not found " << G4endl;
96 for (
int i = 0; i < 8; i++ )
98 std::ostringstream osnameStereoLayer;
99 osnameStereoLayer <<
"logical"
101 <<
"StereoLayer" << i;
102 lv = (G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume(
103 osnameStereoLayer.str() );
106 lv->SetVisAttributes( visAttStereoLayer );
107 lv->SetVisAttributes( G4VisAttributes::Invisible );
109 else G4cout <<
"logical volume " << osnameStereoLayer.str() <<
"not found " << G4endl;
111 std::ostringstream osnameTwistedTubs;
112 osnameTwistedTubs <<
"logical"
114 <<
"StereoLayer" << i <<
"Cell";
115 lv = (G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume(
116 osnameTwistedTubs.str() );
119 lv->SetSensitiveDetector( aTrackerSD );
120 lv->SetVisAttributes( G4VisAttributes::Invisible );
122 else G4cout <<
"logical volume " << osnameTwistedTubs.str() <<
"not found " << G4endl;
125 for (
int i = 20; i < 36; i++ )
127 std::ostringstream osnameStereoLayer;
128 osnameStereoLayer <<
"logical"
130 <<
"StereoLayer" << i;
131 lv = (G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume(
132 osnameStereoLayer.str() );
135 lv->SetVisAttributes( visAttStereoLayer );
136 lv->SetVisAttributes( G4VisAttributes::Invisible );
138 else G4cout <<
"logical volume " << osnameStereoLayer.str() <<
"not found " << G4endl;
140 std::ostringstream osnameTwistedTubs;
141 osnameTwistedTubs <<
"logical"
143 <<
"StereoLayer" << i <<
"Cell";
144 lv = (G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume(
145 osnameTwistedTubs.str() );
148 lv->SetSensitiveDetector( aTrackerSD );
149 lv->SetVisAttributes( G4VisAttributes::Invisible );
151 else G4cout <<
"logical volume " << osnameTwistedTubs.str() <<
"not found " << G4endl;
154 for (
int i = 8; i < 20; i++ )
156 std::ostringstream osnameAxialLayer;
157 osnameAxialLayer <<
"logical"
159 <<
"AxialLayer" << i;
160 lv = (G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume(
161 osnameAxialLayer.str() );
164 lv->SetVisAttributes( visAttAxialLayer );
165 lv->SetVisAttributes( G4VisAttributes::Invisible );
167 else G4cout <<
"logical volume " << osnameAxialLayer.str() <<
"not found " << G4endl;
169 std::ostringstream osnameReplica;
170 osnameReplica <<
"logical"
172 <<
"AxialLayer" << i <<
"Cell";
173 lv = (G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume(
174 osnameReplica.str() );
177 lv->SetSensitiveDetector( aTrackerSD );
178 lv->SetVisAttributes( G4VisAttributes::Invisible );
180 else G4cout <<
"logical volume " << osnameReplica.str() <<
"not found " << G4endl;
183 for (
int i = 36; i < 43; i++ )
185 for (
int n = 0;
n < 2;
n++ )
187 std::ostringstream osnameAxialLayer;
188 osnameAxialLayer <<
"logical"
190 <<
"AxialLayer" << i <<
"_" <<
n;
191 lv = (G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume(
192 osnameAxialLayer.str() );
195 lv->SetVisAttributes( visAttAxialLayer );
196 lv->SetVisAttributes( G4VisAttributes::Invisible );
198 else G4cout <<
"logical volume " << osnameAxialLayer.str() <<
"not found " << G4endl;
200 std::ostringstream osnameReplica;
201 osnameReplica <<
"logical"
203 <<
"AxialLayer" << i <<
"_" <<
n <<
"Cell";
204 lv = (G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume(
205 osnameReplica.str() );
208 lv->SetSensitiveDetector( aTrackerSD );
209 lv->SetVisAttributes( G4VisAttributes::Invisible );
211 else G4cout <<
"logical volume " << osnameReplica.str() <<
"not found " << G4endl;
225 G4Material* MdcGas = G4Material::GetMaterial(
"Mdcgas" );
226 G4Material* Al = G4Material::GetMaterial(
"Aluminium" );
227 G4Element*
C = G4Element::GetElement(
"Carbon" );
228 G4Element*
H = G4Element::GetElement(
"Hydrogen" );
229 G4Element* O = G4Element::GetElement(
"Oxygen" );
231 G4double density = 19.3 * g / cm3;
232 G4double a = 183.84 * g / mole;
233 G4Material* W =
new G4Material(
"Tungsten", 74., a, density );
235 density = 19.32 * g / cm3;
236 a = 196.967 * g / mole;
237 G4Material* Au =
new G4Material(
"Au", 79, a, density );
239 density = 1.57 * g / cm3;
241 G4Material* CarbonFiber =
new G4Material(
"CarbonFiber", density, nElement );
242 CarbonFiber->AddElement(
C, 0.697 );
243 CarbonFiber->AddElement(
H, 0.0061 );
244 CarbonFiber->AddElement( O, 0.2969 );
246 density = 1.42 * g / cm3;
247 G4Material* Kapton =
new G4Material(
"Kapton", density, 3 );
248 Kapton->AddElement( O, 2 );
249 Kapton->AddElement(
C, 5 );
250 Kapton->AddElement(
H, 4 );
254 G4double outR, innerR, length;
255 G4double startAngle, spanAngle;
256 G4double posX, posY, posZ;
257 G4VisAttributes* visAtt;
261 outR = mdc->Segment( 0 ).OutR() * mm;
262 innerR = mdc->Segment( 0 ).InnerR() * mm;
263 length = mdc->Segment( 0 ).Length() / 2. * mm;
265 startAngle = 0. * deg;
266 spanAngle = 360. * deg;
271 G4Tubs* mdc_tube =
new G4Tubs(
"solidMdc", innerR, outR, length, startAngle, spanAngle );
272 mdc_log =
new G4LogicalVolume( mdc_tube, MdcGas,
"logicalMdc", 0, 0, 0 );
273 mdc_log->SetVisAttributes( G4VisAttributes::Invisible );
278 mdc_phys =
new G4PVPlacement( 0, G4ThreeVector( posX, posY, posZ ), mdc_log,
"physicalMdc",
279 logicBes,
false, 0,
false );
283 G4double colorShift = 0., shift = 1. / ( mdc->SegmentNo() - 1 );
284 G4double gap = 0.5 * micrometer;
285 for ( i = 1; i < mdc->SegmentNo(); i++ )
287 outR = mdc->Segment( i ).OutR() * mm - gap;
288 innerR = mdc->Segment( i ).InnerR() * mm + gap;
289 length = mdc->Segment( i ).Length() / 2. * mm - gap;
290 startAngle = 0 * deg;
291 spanAngle = 360 * deg;
292 posZ = mdc->Segment( i ).Z() * mm;
295 std::ostringstream osnameSolid;
296 osnameSolid <<
"solid" << name << i;
297 G4Tubs* segment_tube =
298 new G4Tubs( osnameSolid.str(), innerR, outR, length, startAngle, spanAngle );
299 std::ostringstream osnameLogical;
300 osnameLogical <<
"logical" << name << i;
301 G4LogicalVolume* segment_log;
302 if ( i == 1 || i == 2 )
305 new G4LogicalVolume( segment_tube, CarbonFiber, osnameLogical.str(), 0, 0, 0 );
308 { segment_log =
new G4LogicalVolume( segment_tube, Al, osnameLogical.str(), 0, 0, 0 ); }
310 visAtt =
new G4VisAttributes( G4Colour( 1.0 - colorShift, 0.0 + colorShift, 0.0 ) );
311 if ( i < 3 ) visAtt->SetForceWireframe(
true );
312 segment_log->SetVisAttributes( visAtt );
316 G4VPhysicalVolume* segment_phys;
317 std::ostringstream osnamePhys1;
318 osnamePhys1 <<
"physical" << name << i <<
"p";
319 segment_phys =
new G4PVPlacement( 0, G4ThreeVector( posX, posY, posZ ), segment_log,
320 osnamePhys1.str(), mdc_log,
false, 0,
false );
324 std::ostringstream osnamePhys2;
325 osnamePhys2 <<
"physical" << name << i <<
"m";
326 segment_phys =
new G4PVPlacement( 0, G4ThreeVector( posX, posY, -posZ ), segment_log,
327 osnamePhys2.str(), mdc_log,
false, 0,
false );
332 outR = mdc->Segment( 2 ).InnerR() * mm - gap;
333 innerR = mdc->Segment( 2 ).InnerR() * mm - 100 * micrometer;
334 length = mdc->Segment( 2 ).Length() / 2. * mm - gap - 10 * mm;
335 startAngle = 0 * deg;
336 spanAngle = 360 * deg;
337 posZ = mdc->Segment( 2 ).Z() * mm;
338 G4Tubs* segment_tube1 =
339 new G4Tubs(
"SolidMdcInnerFilm0", innerR, outR, length, startAngle, spanAngle );
340 G4LogicalVolume* segment_log1;
341 segment_log1 =
new G4LogicalVolume( segment_tube1, Al,
"LogicalMdcInnerFilm0", 0, 0, 0 );
342 G4VisAttributes* visAtt1 =
new G4VisAttributes( G4Colour( 0, 1.0, 0.0 ) );
343 segment_log1->SetVisAttributes( visAtt1 );
344 G4VPhysicalVolume* segment_phys1;
345 segment_phys1 =
new G4PVPlacement( 0, G4ThreeVector( posX, posY, posZ ), segment_log1,
346 "PhysicalMdcInnerFilm0", mdc_log,
false, 0,
false );
348 outR = mdc->Segment( 2 ).OutR() * mm + 50 * micrometer;
349 innerR = mdc->Segment( 2 ).OutR() * mm + gap;
350 length = mdc->Segment( 2 ).Length() / 2. * mm - gap;
351 startAngle = 0 * deg;
352 spanAngle = 360 * deg;
353 posZ = mdc->Segment( 2 ).Z() * mm;
354 G4Tubs* segment_tube2 =
355 new G4Tubs(
"SolidMdcInnerFilm1", innerR, outR, length, startAngle, spanAngle );
356 G4LogicalVolume* segment_log2;
357 segment_log2 =
new G4LogicalVolume( segment_tube2, Al,
"LogicalMdcInnerFilm1", 0, 0, 0 );
358 G4VisAttributes* visAtt2 =
new G4VisAttributes( G4Colour( 0, 0.0, 1.0 ) );
359 segment_log2->SetVisAttributes( visAtt2 );
360 G4VPhysicalVolume* segment_phys2;
361 segment_phys2 =
new G4PVPlacement( 0, G4ThreeVector( posX, posY, posZ ), segment_log2,
362 "PhysicalMdcInnerFilm1", mdc_log,
false, 0,
false );
364 outR = mdc->Segment( 1 ).InnerR() * mm - gap;
365 innerR = mdc->Segment( 1 ).InnerR() * mm - 100 * micrometer;
366 length = mdc->Segment( 1 ).Length() / 2. * mm - gap;
367 startAngle = 0 * deg;
368 spanAngle = 360 * deg;
369 posZ = mdc->Segment( 1 ).Z() * mm;
370 G4Tubs* segment_tube3 =
371 new G4Tubs(
"SolidMdcOutFilm0", innerR, outR, length, startAngle, spanAngle );
372 G4LogicalVolume* segment_log3;
373 segment_log3 =
new G4LogicalVolume( segment_tube3, Al,
"LogicalMdcOutFilm0", 0, 0, 0 );
374 G4VisAttributes* visAtt3 =
new G4VisAttributes( G4Colour( 0, 1.0, 0.0 ) );
375 segment_log3->SetVisAttributes( visAtt3 );
376 G4VPhysicalVolume* segment_phys3;
377 segment_phys3 =
new G4PVPlacement( 0, G4ThreeVector( posX, posY, posZ ), segment_log3,
378 "PhysicalMdcOutFilm0", mdc_log,
false, 0,
false );
380 outR = mdc->Segment( 1 ).OutR() * mm + 100 * micrometer;
381 innerR = mdc->Segment( 1 ).OutR() * mm + gap;
382 length = mdc->Segment( 1 ).Length() / 2. * mm - gap;
383 startAngle = 0 * deg;
384 spanAngle = 360 * deg;
385 posZ = mdc->Segment( 1 ).Z() * mm;
386 G4Tubs* segment_tube4 =
387 new G4Tubs(
"SolidMdcOutFilm1", innerR, outR, length, startAngle, spanAngle );
388 G4LogicalVolume* segment_log4;
389 segment_log4 =
new G4LogicalVolume( segment_tube4, Al,
"LogicalMdcOutFilm1", 0, 0, 0 );
390 G4VisAttributes* visAtt4 =
new G4VisAttributes( G4Colour( 0, 0.0, 1.0 ) );
391 segment_log4->SetVisAttributes( visAtt4 );
392 G4VPhysicalVolume* segment_phys4;
393 segment_phys4 =
new G4PVPlacement( 0, G4ThreeVector( posX, posY, posZ ), segment_log4,
394 "PhysicalMdcOutFilm1", mdc_log,
false, 0,
false );
396 outR = mdc->Segment( 1 ).OutR() * mm + 150 * micrometer;
397 innerR = mdc->Segment( 1 ).OutR() * mm + 100 * micrometer + gap;
398 length = mdc->Segment( 1 ).Length() / 2. * mm - gap;
399 startAngle = 0 * deg;
400 spanAngle = 360 * deg;
401 posZ = mdc->Segment( 1 ).Z() * mm;
402 G4Tubs* segment_tube5 =
403 new G4Tubs(
"SolidMdcOutFilm2", innerR, outR, length, startAngle, spanAngle );
404 G4LogicalVolume* segment_log5;
405 segment_log5 =
new G4LogicalVolume( segment_tube5, Kapton,
"LogicalMdcOutFilm2", 0, 0, 0 );
406 G4VisAttributes* visAtt5 =
new G4VisAttributes( G4Colour( 0, 0.5, 0.5 ) );
407 segment_log5->SetVisAttributes( visAtt5 );
408 G4VPhysicalVolume* segment_phys5;
409 segment_phys5 =
new G4PVPlacement( 0, G4ThreeVector( posX, posY, posZ ), segment_log5,
410 "PhysicalMdcOutFilm2", mdc_log,
false, 0,
false );
416 G4Tubs* fixTub =
new G4Tubs(
417 "solidFixTub", elecGeomPointer->
FixRing( 0 ) * mm, elecGeomPointer->
FixRing( 1 ) * mm,
418 elecGeomPointer->
FixRing( 2 ) / 2. * mm, 0. * deg, 360. * deg );
419 G4LogicalVolume* fixTub_log =
new G4LogicalVolume( fixTub, Al,
"logicalFixTub" );
420 G4VPhysicalVolume* fixTub_phys1 =
421 new G4PVPlacement( 0, G4ThreeVector( 0, 0, 1134.5 * mm ), fixTub_log,
"physcalFixTub1",
422 mdc_log,
false, 0,
false );
423 G4VPhysicalVolume* fixTub_phys2 =
424 new G4PVPlacement( 0, G4ThreeVector( 0, 0, -1134.5 * mm ), fixTub_log,
425 "physicalFixTub2", mdc_log,
false, 0,
false );
428 G4Element* Cu = G4Element::GetElement(
"Copper" );
429 G4Element* Si = G4Element::GetElement(
"Silicon" );
432 G4double boxDensityEndcape = 1.9745 * g / cm3;
433 G4int boxNcomponenEndcape = 6;
434 G4Material* Cuu = G4Material::GetMaterial(
"Copper" );
439 G4Element* Cl =
new G4Element(
"Chlorine",
"Cl", 17., 35.5 * g / mole );
440 G4Material* synEndcape =
441 new G4Material(
"M_synthesis", boxDensityEndcape, boxNcomponenEndcape );
442 synEndcape->AddElement( Cu, 0.50 );
443 synEndcape->AddElement(
C, 0.134 );
444 synEndcape->AddElement(
H, 0.033 );
445 synEndcape->AddElement( Si, 0.11 );
446 synEndcape->AddElement( Cl, 0.014 );
447 synEndcape->AddElement( O, 0.209 );
450 new G4Box(
"solidboxEndcape", elecGeomPointer->
BoxEndcape( 0 ) / 2. * mm,
453 G4LogicalVolume* boxEndcape_log =
454 new G4LogicalVolume( boxEndcape, synEndcape,
"logical boxEndcape" );
455 visAtt =
new G4VisAttributes( G4Colour( 0.0, 1.0, 0.0 ) );
456 boxEndcape_log->SetVisAttributes( visAtt );
459 double boxCuEndDx = 8.5 * mm;
460 double boxCuEndDy = 12. * mm;
461 double boxCuEndDz = 29. * mm;
464 new G4Box(
"solidboxCuEnd", boxCuEndDx / 2., boxCuEndDy / 2., boxCuEndDz / 2. );
465 G4LogicalVolume* boxCuEnd_log =
new G4LogicalVolume( boxCuEnd, Cuu,
"logical boxCuEnd" );
466 visAtt =
new G4VisAttributes( G4Colour( 1.0, 1.0, 0.0 ) );
467 boxCuEnd_log->SetVisAttributes( visAtt );
469 double dxVirtualBox = 18. * mm;
470 double dyVirtualBox = 106. * mm;
471 double dzVirtualBox = 53. * mm;
472 G4Box* virtualBoxForEndcape =
new G4Box(
"solid virtualBoxEndcape", dxVirtualBox / 2.,
473 dyVirtualBox / 2. * mm, dzVirtualBox / 2. * mm );
474 G4LogicalVolume* virtualBoxForEndcape_log =
new G4LogicalVolume(
475 virtualBoxForEndcape, G4Material::GetMaterial(
"Air" ),
"logical virtualBoxEndcape" );
477 virtualBoxForEndcape_log->SetVisAttributes( visAtt );
478 G4VPhysicalVolume* boxEndcape_phys =
new G4PVPlacement(
479 0, G4ThreeVector( elecGeomPointer->
BoxEndcape( 0 ) / 2., 0, 0 ), boxEndcape_log,
480 "physical boxEndcape", virtualBoxForEndcape_log,
false, 0,
false );
481 G4VPhysicalVolume* boxCuEnd_physFront =
new G4PVPlacement(
483 G4ThreeVector( -boxCuEndDx * 0.5 - 0.1 * mm,
484 elecGeomPointer->
BoxEndcape( 1 ) / 2. - boxCuEndDy / 2, 0 ),
485 boxCuEnd_log,
"physical boxCuEnd", virtualBoxForEndcape_log,
false, 0,
false );
486 G4VPhysicalVolume* boxCuEnd_physBehind =
new G4PVPlacement(
488 G4ThreeVector( -boxCuEndDx * 0.5 - 0.1 * mm,
489 -( elecGeomPointer->
BoxEndcape( 1 ) / 2. - boxCuEndDy / 2 ), 0 ),
490 boxCuEnd_log,
"physical boxCuEnd", virtualBoxForEndcape_log,
false, 0,
false );
491 const double pi = 3.141593;
495 double startAngleArray;
499 startAngleArray = acos( elecGeomPointer->
X( i ) / elecGeomPointer->
R( i ) );
501 for (
int j = 0; j < elecGeomPointer->
ElecNo( i ); j++ )
503 G4RotationMatrix* boxRotj =
new G4RotationMatrix;
504 boxRotj->rotateZ( -startAngleArray - j * 2 *
pi / elecGeomPointer->
ElecNo( i ) );
505 posXArray = elecGeomPointer->
R( i ) *
506 cos( ( startAngleArray + j * 2 *
pi / elecGeomPointer->
ElecNo( i ) ) );
507 posYArray = elecGeomPointer->
R( i ) *
508 sin( ( startAngleArray + j * 2 *
pi / elecGeomPointer->
ElecNo( i ) ) );
509 posZArray = elecGeomPointer->
Z( i );
510 std::ostringstream osnamephys;
511 osnamephys <<
"physicalLayer" << i <<
"Ebox" << j;
512 G4VPhysicalVolume* box_phys =
new G4PVPlacement(
513 boxRotj, G4ThreeVector( posXArray, posYArray, posZArray ),
514 virtualBoxForEndcape_log, osnamephys.str(), mdc_log,
false, j,
false );
519 G4double mCableDensity = 6.4 * g / cm3;
520 G4Material* materialCable =
new G4Material(
"M_materialCable", mCableDensity, 3 );
521 materialCable->AddElement( Cu, 0.4 );
522 materialCable->AddElement(
C, 0.3 );
523 materialCable->AddElement(
H, 0.3 );
525 double gapR = 0.1 * micrometer;
528 double innerRCableTub;
529 double outerRCableTub;
530 for (
int i = 0; i < 11; i++ )
532 innerRCableTub = elecGeomPointer->
R( i ) * mm - dxVirtualBox / 2. + gapR;
533 outerRCableTub = elecGeomPointer->
R( i + 1 ) * mm - dxVirtualBox / 2. - gapR;
534 std::ostringstream osnameCableSolid;
535 osnameCableSolid <<
"MdcCableSolidWest" << i;
536 G4Tubs* cableTub =
new G4Tubs( osnameCableSolid.str(), innerRCableTub, outerRCableTub,
538 0 * deg, 360 * deg );
540 std::ostringstream osnameCableLog;
541 osnameCableLog <<
"MdcCableLogWest" << i;
542 G4LogicalVolume* cableTub_log =
543 new G4LogicalVolume( cableTub, materialCable, osnameCableLog.str() );
544 visAtt =
new G4VisAttributes( G4Colour( 1, 0.3, 0.5 ) );
545 cableTub_log->SetVisAttributes( visAtt );
547 std::ostringstream osnameCablePhys;
548 osnameCablePhys <<
"MdcCablePhysWest" << i;
549 G4VPhysicalVolume* cableTub_phys =
new G4PVPlacement(
552 elecGeomPointer->
Z( i ) * mm - dzVirtualBox / 2. * mm -
555 cableTub_log, osnameCablePhys.str(), mdc_log,
false, 0,
false );
559 for (
int i = 0; i < 10; i++ )
561 innerRCableTub = elecGeomPointer->
R( i + 12 ) - dxVirtualBox / 2. + gapR;
562 outerRCableTub = elecGeomPointer->
R( i + 12 + 1 ) - dxVirtualBox / 2. - gapR;
563 std::ostringstream osnameCableSolid;
564 osnameCableSolid <<
"MdcCableSolidEast" << i;
565 G4Tubs* cableTub =
new G4Tubs( osnameCableSolid.str(), innerRCableTub, outerRCableTub,
567 0 * deg, 360 * deg );
569 std::ostringstream osnameCableLog;
570 osnameCableLog <<
"MdcCableLogEast" << i;
571 G4LogicalVolume* cableTub_log =
572 new G4LogicalVolume( cableTub, materialCable, osnameCableLog.str() );
573 visAtt =
new G4VisAttributes( G4Colour( 1, 0.3, 0.5 ) );
574 cableTub_log->SetVisAttributes( visAtt );
576 std::ostringstream osnameCablePhys;
577 osnameCablePhys <<
"MdcCablePhysEast" << i;
578 G4VPhysicalVolume* cableTub_phys =
new G4PVPlacement(
581 elecGeomPointer->
Z( i + 12 ) * mm + dzVirtualBox / 2. * mm +
584 cableTub_log, osnameCablePhys.str(), mdc_log,
false, 0,
false );
589 G4Tubs* cableTubBeginnerW =
new G4Tubs(
590 "solid cableTubBeginnerW", mdc->Segment( 30 ).InnerR() * mm + gapR,
591 elecGeomPointer->
R( 0 ) * mm - dxVirtualBox / 2. - gapR,
592 elecGeomPointer->
LengthCableTub( 0 ) * 1.15 / 2. * mm, 0 * deg, 360 * deg );
593 G4LogicalVolume* cableTubBeginnerW_log =
594 new G4LogicalVolume( cableTubBeginnerW, materialCable,
"logical cableTubBeginnerW" );
595 visAtt =
new G4VisAttributes( G4Colour( 0, 0.3, 0.8 ) );
596 cableTubBeginnerW_log->SetVisAttributes( visAtt );
597 G4VPhysicalVolume* cableTubBeginnerW_phys =
new G4PVPlacement(
600 elecGeomPointer->
Z( 0 ) * mm - dzVirtualBox / 2. * mm -
603 cableTubBeginnerW_log,
"physical cableTubBeginnerW", mdc_log,
false, 0,
false );
606 G4Tubs* cableTubBeginnerE =
new G4Tubs(
607 "solid cableBeginnerE", mdc->Segment( 30 ).InnerR() * mm + gapR,
608 elecGeomPointer->
R( 12 ) * mm - dxVirtualBox / 2. - gapR,
609 elecGeomPointer->
LengthCableTub( 13 ) * 1.15 / 2. * mm, 0 * deg, 360 * deg );
610 G4LogicalVolume* cableTubBeginnerE_log =
611 new G4LogicalVolume( cableTubBeginnerE, materialCable,
"logical cabieTubBeginnerE" );
612 visAtt =
new G4VisAttributes( G4Colour( 1, 0.3, 0.5 ) );
613 cableTubBeginnerE_log->SetVisAttributes( visAtt );
615 G4VPhysicalVolume* cableTubBeginnerE_phys =
new G4PVPlacement(
618 elecGeomPointer->
Z( 13 ) * mm + dzVirtualBox / 2. * mm +
621 cableTubBeginnerE_log,
"physical cableTubBeginnerE", mdc_log,
false, 0,
false );
625 G4Tubs* cableTubToTailW =
new G4Tubs(
626 "solid cabletubToTailW", elecGeomPointer->
R( 11 ) * mm + gapR,
627 mdc->Segment( 6 ).InnerR() * mm - gapR,
628 elecGeomPointer->
LengthCableTub( 12 ) * 1.15 / 2. * mm, 0 * deg, 360 * deg );
629 G4LogicalVolume* cableTubToTailW_log =
630 new G4LogicalVolume( cableTubToTailW, materialCable,
"logical cableTubToTailW" );
631 visAtt =
new G4VisAttributes( G4Colour( 0, 0.3, 0.8 ) );
632 cableTubToTailW_log->SetVisAttributes( visAtt );
634 G4VPhysicalVolume* cableTubToTailW_phys =
new G4PVPlacement(
637 elecGeomPointer->
Z( 11 ) * mm - dzVirtualBox / 2. * mm -
640 cableTubToTailW_log,
"physical cableTubToTailW", mdc_log,
false, 0,
false );
642 G4Tubs* cableTubToTailE =
new G4Tubs(
643 "solid cabletubToTailE", elecGeomPointer->
R( 22 ) * mm - dxVirtualBox / 2. + gapR,
644 mdc->Segment( 6 ).InnerR() * mm - gapR,
645 elecGeomPointer->
LengthCableTub( 24 ) * 1.15 / 2. * mm, 0 * deg, 360 * deg );
647 G4LogicalVolume* cableTubToTailE_log =
648 new G4LogicalVolume( cableTubToTailE, materialCable,
"logical cabieTubToTailE" );
649 visAtt =
new G4VisAttributes( G4Colour( 1.0, 0.3, 0.5 ) );
650 cableTubToTailE_log->SetVisAttributes( visAtt );
652 G4VPhysicalVolume* cableTubToTailE_phys =
new G4PVPlacement(
655 elecGeomPointer->
Z( 22 ) * mm + dzVirtualBox / 2. * mm +
658 cableTubToTailE_log,
"physical cableTubToTailE", mdc_log,
false, 0,
false );
662 G4Box* box0 =
new G4Box(
"box0", 10., 15., 3. );
663 G4LogicalVolume* box0_log =
new G4LogicalVolume( box0, Al,
"logicalBox0", 0, 0, 0 );
664 visAtt =
new G4VisAttributes( G4Colour( 1.0, 0.8, 0.0 ) );
665 box0_log->SetVisAttributes( visAtt );
668 new G4Box(
"box1", 3. *
cos( 11.28 * deg ), 15., 81. /
sin( 11.28 * deg ) / 2. );
669 G4LogicalVolume* box1_log =
new G4LogicalVolume( box1, Al,
"logicalBox1", 0, 0, 0 );
670 box1_log->SetVisAttributes( visAtt );
672 G4Box* box2 =
new G4Box(
"box2", 63.5, 15., 3. );
673 G4LogicalVolume* box2_log =
new G4LogicalVolume( box2, Al,
"logicalBox2", 0, 0, 0 );
674 box2_log->SetVisAttributes( visAtt );
676 for ( i = 0; i < 8; i++ )
678 G4RotationMatrix* boxRot0 =
new G4RotationMatrix();
679 boxRot0->rotateZ( -45 * i * deg );
680 posX = 784. *
cos( 45 * i * deg );
681 posY = 784. *
sin( 45 * i * deg );
683 std::ostringstream osnameBox0PhysEast;
684 osnameBox0PhysEast <<
"physical"
686 G4VPhysicalVolume* box0p_phys =
687 new G4PVPlacement( boxRot0, G4ThreeVector( posX, posY, posZ ), box0_log,
688 osnameBox0PhysEast.str(), mdc_log,
false, i,
false );
690 std::ostringstream osnameBox0PhysWest;
691 osnameBox0PhysWest <<
"physical"
693 G4VPhysicalVolume* box0m_phys =
694 new G4PVPlacement( boxRot0, G4ThreeVector( posX, posY, -posZ ), box0_log,
695 osnameBox0PhysWest.str(), mdc_log,
false, i,
false );
697 G4RotationMatrix* boxRot1p =
new G4RotationMatrix();
698 boxRot1p->rotateZ( -45 * i * deg );
699 boxRot1p->rotateY( -78.72 * deg );
700 posX = 570.5 *
cos( 45 * i * deg );
701 posY = 570.5 *
sin( 45 * i * deg );
703 std::ostringstream osnameBox1PhysEast;
704 osnameBox1PhysEast <<
"physical"
706 G4VPhysicalVolume* box1p_phys =
707 new G4PVPlacement( boxRot1p, G4ThreeVector( posX, posY, posZ ), box1_log,
708 osnameBox1PhysEast.str(), mdc_log,
false, i,
false );
710 G4RotationMatrix* boxRot1m =
new G4RotationMatrix();
711 boxRot1m->rotateZ( -45 * i * deg );
712 boxRot1m->rotateY( 78.72 * deg );
713 std::ostringstream osnameBox1PhysWest;
714 osnameBox1PhysWest <<
"physical"
716 G4VPhysicalVolume* box1m_phys =
717 new G4PVPlacement( boxRot1m, G4ThreeVector( posX, posY, -posZ ), box1_log,
718 osnameBox1PhysWest.str(), mdc_log,
false, i,
false );
720 G4RotationMatrix* boxRot2 =
new G4RotationMatrix();
721 boxRot2->rotateZ( -45 * i * deg );
722 posX = 303.5 *
cos( 45 * i * deg );
723 posY = 303.5 *
sin( 45 * i * deg );
725 std::ostringstream osnameBox2PhysEast;
726 osnameBox2PhysEast <<
"physical"
728 G4VPhysicalVolume* box2p_phys =
729 new G4PVPlacement( boxRot2, G4ThreeVector( posX, posY, posZ ), box2_log,
730 osnameBox2PhysEast.str(), mdc_log,
false, i,
false );
732 std::ostringstream osnameBox2PhysWest;
733 osnameBox2PhysWest <<
"physical"
735 G4VPhysicalVolume* box2m_phys =
736 new G4PVPlacement( boxRot2, G4ThreeVector( posX, posY, -posZ ), box2_log,
737 osnameBox2PhysWest.str(), mdc_log,
false, i,
false );
740 G4double rMax2 = 774. * mm;
741 G4double rMin2 = rMax2 - 1. * mm /
sin( 11.28 * deg );
742 G4double rMin1 = rMin2 - 80. * mm /
tan( 11.28 * deg );
743 G4double rMax1 = rMin1 + 1. * mm /
sin( 11.28 * deg );
744 G4Cons* shieldPlate0p =
745 new G4Cons(
"shieldPlate0p", rMin1, rMax1, rMin2, rMax2, 40. * mm, 0., 360. * deg );
746 G4LogicalVolume* shieldPlate0p_log =
747 new G4LogicalVolume( shieldPlate0p, Al,
"logicalShieldPlate0p", 0, 0, 0 );
748 visAtt =
new G4VisAttributes( G4Colour( 0.0, 0.0, 1.0 ) );
749 shieldPlate0p_log->SetVisAttributes( visAtt );
753 G4VPhysicalVolume* shieldPlate0p_phys =
754 new G4PVPlacement( 0, G4ThreeVector( posX, posY, posZ ), shieldPlate0p_log,
755 "physicalShieldPalte0p", mdc_log,
false, 0,
false );
757 G4Cons* shieldPlate0m =
758 new G4Cons(
"shieldPlate0m", rMin2, rMax2, rMin1, rMax1, 40. * mm, 0., 360. * deg );
759 G4LogicalVolume* shieldPlate0m_log =
760 new G4LogicalVolume( shieldPlate0m, Al,
"logicalShieldPlate0m", 0, 0, 0 );
761 visAtt =
new G4VisAttributes( G4Colour( 0.0, 0.0, 1.0 ) );
762 shieldPlate0m_log->SetVisAttributes( visAtt );
766 G4VPhysicalVolume* shieldPlate0m_phys =
767 new G4PVPlacement( 0, G4ThreeVector( posX, posY, -posZ ), shieldPlate0m_log,
768 "physicalShieldPalte0m", mdc_log,
false, 0,
false );
770 G4Tubs* shieldPlate1 =
771 new G4Tubs(
"shieldPlate1", 240. * mm, 367. * mm, 0.5 * mm, 0., 360. * deg );
772 G4LogicalVolume* shieldPlate1_log =
773 new G4LogicalVolume( shieldPlate1, Al,
"logicalShieldPlate1", 0, 0, 0 );
774 visAtt =
new G4VisAttributes( G4Colour( 1.0, 0.0, 0.0 ) );
775 shieldPlate1_log->SetVisAttributes( visAtt );
779 G4VPhysicalVolume* shieldPlate1p_phys =
780 new G4PVPlacement( 0, G4ThreeVector( posX, posY, posZ ), shieldPlate1_log,
781 "physicalShieldPalte1p", mdc_log,
false, 0,
false );
782 G4VPhysicalVolume* shieldPlate1m_phys =
783 new G4PVPlacement( 0, G4ThreeVector( posX, posY, -posZ ), shieldPlate1_log,
784 "physicalShieldPalte1m", mdc_log,
false, 0,
false );
787 G4int signalLayer, firstWire;
791 G4double signalWireR = mdc->SignalWireR() * micrometer;
792 G4double fieldWireR = mdc->FieldWireR() * micrometer;
793 G4double thickOfAu = 0.7 * micrometer;
795 G4double innerLength, innerTwistAngle, innerTan, midInnerR, innerStereo;
796 G4double outLength, outTwistAngle, outTwistAngleFixed, outTan, midOutR, outStereo,
797 outRFixed, outTanFixed;
800 for ( i = 42; i > 35; i-- )
802 G4int signalLayer = mdc->Signal2Global( i );
803 firstWire = mdc->Layer( signalLayer ).FirstWire();
804 for (
n = 1;
n > -1;
n-- )
806 innerR = mdc->Layer( signalLayer - 1 +
n ).R() * mm - fieldWireR;
807 outR = mdc->Layer( signalLayer +
n ).R() * mm - fieldWireR;
808 if ( i == 42 &&
n == 1 ) outR = mdc->Layer( signalLayer +
n ).R() * mm + fieldWireR;
809 length = ( mdc->Layer( signalLayer - 1 +
n ).Length() ) / 2. * mm;
810 startAngle = 0. * deg;
811 spanAngle = 360. * deg;
817 std::ostringstream osnameLayerSolid;
818 osnameLayerSolid <<
"solid"
819 <<
"MdcAxialLayer" << i <<
"_" <<
n;
820 G4Tubs* axialLayer_tube =
821 new G4Tubs( osnameLayerSolid.str(), innerR, outR, length, startAngle, spanAngle );
823 std::ostringstream osnameLayerLogical;
824 osnameLayerLogical <<
"logical"
825 <<
"MdcAxialLayer" << i <<
"_" <<
n;
826 G4LogicalVolume* axialLayer_log =
827 new G4LogicalVolume( axialLayer_tube, MdcGas, osnameLayerLogical.str(), 0, 0, 0 );
829 axialLayer_log->SetVisAttributes( G4VisAttributes::Invisible );
831 replicaNo = mdc->Layer( signalLayer ).WireNo() / 2;
832 spanAngle = 360. / replicaNo * deg;
834 offset = mdc->Layer( signalLayer ).Phi() *
rad - firstWire * spanAngle / 2.;
835 G4RotationMatrix* layerRot =
new G4RotationMatrix();
836 layerRot->rotateZ( -offset );
838 std::ostringstream osnameLayerPhys;
839 osnameLayerPhys <<
"physical"
840 <<
"MdcAxialLayer" << i <<
"_" <<
n;
841 G4VPhysicalVolume* axialLayer_phys;
842 axialLayer_phys =
new G4PVPlacement( layerRot, G4ThreeVector(), axialLayer_log,
843 osnameLayerPhys.str(), mdc_log,
false, i,
false );
846 std::ostringstream osnameCellSolid;
847 osnameCellSolid <<
"solid"
848 <<
"MdcAxialLayer" << i <<
"_" <<
n <<
"Cell";
849 G4Tubs* replica_tube =
850 new G4Tubs( osnameCellSolid.str(), innerR, outR, length, startAngle, spanAngle );
852 std::ostringstream osnameCellLogical;
853 osnameCellLogical <<
"logical"
854 <<
"MdcAxialLayer" << i <<
"_" <<
n <<
"Cell";
855 G4LogicalVolume* replica_log =
856 new G4LogicalVolume( replica_tube, MdcGas, osnameCellLogical.str(), 0, 0, 0 );
858 replica_log->SetSensitiveDetector( aTrackerSD );
859 visAtt =
new G4VisAttributes( G4Colour( 0.0, 0.0, 1.0 ) );
860 replica_log->SetVisAttributes( visAtt );
861 replica_log->SetVisAttributes( G4VisAttributes::Invisible );
866 std::ostringstream osnameFieldWireSolid;
867 osnameFieldWireSolid <<
"solid"
868 <<
"AxialLayer" << i <<
"_" <<
n <<
"FieldWire";
869 G4Tubs* fieldWire_tube =
870 new G4Tubs( osnameFieldWireSolid.str(), 0., fieldWireR, length, 0., 360 * deg );
871 std::ostringstream osnameFieldWireLogical;
872 osnameFieldWireLogical <<
"logical"
873 <<
"AxialLayer" << i <<
"_" <<
n <<
"FieldWire";
874 G4LogicalVolume* fieldWire_log =
875 new G4LogicalVolume( fieldWire_tube, Au, osnameFieldWireLogical.str(), 0, 0, 0 );
877 std::ostringstream osnameFieldWireSubSolid;
878 osnameFieldWireSubSolid <<
"solid"
879 <<
"AxialLayer" << i <<
"_" <<
n <<
"FieldWireSub";
880 G4Tubs* fieldWireSub_tube =
881 new G4Tubs( osnameFieldWireSubSolid.str(), 0., fieldWireR - thickOfAu, length,
883 std::ostringstream osnameFieldWireSubLogical;
884 osnameFieldWireSubLogical <<
"logical"
885 <<
"AxialLayer" << i <<
"_" <<
n <<
"FieldWireSub";
886 G4LogicalVolume* fieldWireSub_log =
new G4LogicalVolume(
887 fieldWireSub_tube, Al, osnameFieldWireSubLogical.str(), 0, 0, 0 );
888 std::ostringstream osnameFieldWireSubPhys;
889 osnameFieldWireSubPhys <<
"physical"
890 <<
"AxialLayer" << i <<
"_" <<
n <<
"FieldWireSub";
891 G4VPhysicalVolume* fieldWireSub_phys;
892 fieldWireSub_phys =
new G4PVPlacement( 0, G4ThreeVector(), fieldWireSub_log,
893 osnameFieldWireSubPhys.str(), fieldWire_log,
896 std::ostringstream osnameFieldWireHalfSolid;
897 osnameFieldWireHalfSolid <<
"solid"
898 <<
"AxialLayer" << i <<
"_" <<
n <<
"FieldWireHalf";
899 G4Tubs* fieldWireHalf_tube =
new G4Tubs( osnameFieldWireHalfSolid.str(), 0.,
900 fieldWireR, length, 0., 180 * deg );
901 std::ostringstream osnameFieldWireHalfLogical;
902 osnameFieldWireHalfLogical <<
"logical"
903 <<
"AxialLayer" << i <<
"_" <<
n <<
"FieldWireHalf";
904 G4LogicalVolume* fieldWireHalf_log =
new G4LogicalVolume(
905 fieldWireHalf_tube, Au, osnameFieldWireHalfLogical.str(), 0, 0, 0 );
907 std::ostringstream osnameFieldWireHalfSubSolid;
908 osnameFieldWireHalfSubSolid <<
"solid"
909 <<
"AxialLayer" << i <<
"_" <<
n <<
"FieldWireHalfSub";
910 G4Tubs* fieldWireHalfSub_tube =
911 new G4Tubs( osnameFieldWireHalfSubSolid.str(), 0., fieldWireR - thickOfAu,
912 length, 0., 360 * deg );
913 std::ostringstream osnameFieldWireHalfSubLogical;
914 osnameFieldWireHalfSubLogical <<
"logical"
915 <<
"AxialLayer" << i <<
"_" <<
n <<
"FieldWireHalfSub";
916 G4LogicalVolume* fieldWireHalfSub_log =
new G4LogicalVolume(
917 fieldWireHalfSub_tube, Al, osnameFieldWireHalfSubLogical.str(), 0, 0, 0 );
918 std::ostringstream osnameFieldWireHalfSubPhys;
919 osnameFieldWireHalfSubPhys <<
"physical"
920 <<
"AxialLayer" << i <<
"_" <<
n <<
"FieldWireHalfSub";
921 G4VPhysicalVolume* fieldWireHalfSub_phys;
922 fieldWireHalfSub_phys =
new G4PVPlacement( 0, G4ThreeVector(), fieldWireHalfSub_log,
923 osnameFieldWireHalfSubPhys.str(),
924 fieldWireHalf_log,
false, 0,
false );
936 std::ostringstream osnameFieldWire0Phys;
937 osnameFieldWire0Phys <<
"physicalAxialLayer" << i <<
"_" <<
n <<
"FieldWire0";
938 posX = mdc->Layer( signalLayer - 1 ).R() * mm;
939 G4VPhysicalVolume* fieldWire0_phys;
941 new G4PVPlacement( 0, G4ThreeVector( posX, 0, 0 ), fieldWireHalf_log,
942 osnameFieldWire0Phys.str(), replica_log,
false, 0,
false );
944 std::ostringstream osnameFieldWire3Phys;
945 osnameFieldWire3Phys <<
"physicalAxialLayer" << i <<
"_" <<
n <<
"FieldWire3";
946 posX = mdc->Layer( signalLayer - 1 ).R() * mm *
cos( spanAngle / 2. );
947 posY = mdc->Layer( signalLayer - 1 ).R() * mm *
sin( spanAngle / 2. );
948 G4VPhysicalVolume* fieldWire3_phys;
950 new G4PVPlacement( 0, G4ThreeVector( posX, posY, 0 ), fieldWire_log,
951 osnameFieldWire3Phys.str(), replica_log,
false, 3,
false );
952 std::ostringstream osnameFieldWire6Phys;
953 osnameFieldWire6Phys <<
"physicalAxialLayer" << i <<
"_" <<
n <<
"FieldWire6";
954 posX = mdc->Layer( signalLayer - 1 ).R() * mm *
cos( spanAngle );
955 posY = mdc->Layer( signalLayer - 1 ).R() * mm *
sin( spanAngle );
956 G4RotationMatrix* wireRot6 =
new G4RotationMatrix();
957 wireRot6->rotateZ( 180 * deg - spanAngle );
958 G4VPhysicalVolume* fieldWire6_phys;
960 new G4PVPlacement( wireRot6, G4ThreeVector( posX, posY, 0 ), fieldWireHalf_log,
961 osnameFieldWire6Phys.str(), replica_log,
false, 6,
false );
966 std::ostringstream osnameFieldWire1Phys;
967 osnameFieldWire1Phys <<
"physicalAxialLayer" << i <<
"_" <<
n <<
"FieldWire1";
968 posX = mdc->Layer( signalLayer ).R() * mm;
969 G4VPhysicalVolume* fieldWire1_phys;
971 new G4PVPlacement( 0, G4ThreeVector( posX, 0, 0 ), fieldWireHalf_log,
972 osnameFieldWire1Phys.str(), replica_log,
false, 1,
false );
973 std::ostringstream osnameSignalWireSolid;
974 osnameSignalWireSolid <<
"solid"
975 <<
"AxialLayer" << i <<
"_" <<
n <<
"SignalWire";
976 G4Tubs* signalWire_tube =
new G4Tubs( osnameSignalWireSolid.str(), 0., signalWireR,
977 length, 0., 360 * deg );
978 std::ostringstream osnameSignalWireLogical;
979 osnameSignalWireLogical <<
"logical"
980 <<
"AxialLayer" << i <<
"_" <<
n <<
"SignalWire";
981 G4LogicalVolume* signalWire_log =
new G4LogicalVolume(
982 signalWire_tube, Au, osnameSignalWireLogical.str(), 0, 0, 0 );
984 std::ostringstream osnameSignalWireSubSolid;
985 osnameSignalWireSubSolid <<
"solid"
986 <<
"AxialLayer" << i <<
"_" <<
n <<
"SignalWireSub";
987 G4Tubs* signalWireSub_tube =
988 new G4Tubs( osnameSignalWireSubSolid.str(), 0., signalWireR - thickOfAu,
989 length, 0., 360 * deg );
990 std::ostringstream osnameSignalWireSubLogical;
991 osnameSignalWireSubLogical <<
"logical"
992 <<
"AxialLayer" << i <<
"_" <<
n <<
"SignalWireSub";
993 G4LogicalVolume* signalWireSub_log =
new G4LogicalVolume(
994 signalWireSub_tube, W, osnameSignalWireSubLogical.str(), 0, 0, 0 );
995 std::ostringstream osnameSignalWireSubPhys;
996 osnameSignalWireSubPhys <<
"physical"
997 <<
"AxialLayer" << i <<
"_" <<
n <<
"SignalWireSub";
998 G4VPhysicalVolume* signalWireSub_phys;
999 signalWireSub_phys =
new G4PVPlacement( 0, G4ThreeVector(), signalWireSub_log,
1000 osnameSignalWireSubPhys.str(),
1001 signalWire_log,
false, 0,
false );
1003 std::ostringstream osnameSignalWirePhys;
1004 osnameSignalWirePhys <<
"physicalAxialLayer" << i <<
"_" <<
n <<
"SignalWire4";
1005 posX = mdc->Layer( signalLayer ).R() * mm *
cos( spanAngle / 2. );
1006 posY = mdc->Layer( signalLayer ).R() * mm *
sin( spanAngle / 2. );
1007 G4VPhysicalVolume* signalWire_phys;
1009 new G4PVPlacement( 0, G4ThreeVector( posX, posY, 0 ), signalWire_log,
1010 osnameSignalWirePhys.str(), replica_log,
false, 4,
false );
1012 std::ostringstream osnameFieldWire7Phys;
1013 osnameFieldWire7Phys <<
"physicalAxialLayer" << i <<
"_" <<
n <<
"FieldWire7";
1014 posX = mdc->Layer( signalLayer ).R() * mm *
cos( spanAngle );
1015 posY = mdc->Layer( signalLayer ).R() * mm *
sin( spanAngle );
1016 G4RotationMatrix* wireRot7 =
new G4RotationMatrix();
1017 wireRot7->rotateZ( 180 * deg - spanAngle );
1018 G4VPhysicalVolume* fieldWire7_phys;
1020 new G4PVPlacement( wireRot7, G4ThreeVector( posX, posY, 0 ), fieldWireHalf_log,
1021 osnameFieldWire7Phys.str(), replica_log,
false, 7,
false );
1024 std::ostringstream osnameFieldWire2Phys;
1025 osnameFieldWire2Phys <<
"physicalAxialLayer" << i <<
"_" <<
n <<
"FieldWire2";
1026 posX = mdc->Layer( signalLayer + 1 ).R() * mm;
1027 G4VPhysicalVolume* fieldWire2_phys;
1028 fieldWire2_phys =
new G4PVPlacement(
1029 0, G4ThreeVector( posX, 0, 0 ), fieldWireHalf_log,
1030 osnameFieldWire2Phys.str(), replica_log,
false, 2,
false );
1032 std::ostringstream osnameFieldWire5Phys;
1033 osnameFieldWire5Phys <<
"physicalAxialLayer" << i <<
"_" <<
n <<
"FieldWire5";
1034 posX = mdc->Layer( signalLayer + 1 ).R() * mm *
cos( spanAngle / 2. );
1035 posY = mdc->Layer( signalLayer + 1 ).R() * mm *
sin( spanAngle / 2. );
1036 G4VPhysicalVolume* fieldWire5_phys;
1037 fieldWire5_phys =
new G4PVPlacement( 0, G4ThreeVector( posX, posY, 0 ),
1038 fieldWire_log, osnameFieldWire5Phys.str(),
1039 replica_log,
false, 5,
false );
1041 std::ostringstream osnameFieldWire8Phys;
1042 osnameFieldWire8Phys <<
"physicalAxialLayer" << i <<
"_" <<
n <<
"FieldWire8";
1043 posX = mdc->Layer( signalLayer + 1 ).R() * mm *
cos( spanAngle );
1044 posY = mdc->Layer( signalLayer + 1 ).R() * mm *
sin( spanAngle );
1045 G4RotationMatrix* wireRot8 =
new G4RotationMatrix();
1046 wireRot8->rotateZ( 180 * deg - spanAngle );
1047 G4VPhysicalVolume* fieldWire8_phys;
1048 fieldWire8_phys =
new G4PVPlacement(
1049 wireRot8, G4ThreeVector( posX, posY, 0 ), fieldWireHalf_log,
1050 osnameFieldWire8Phys.str(), replica_log,
false, 8,
false );
1055 for ( j = replicaNo - 1; j > -1; j-- )
1057 G4RotationMatrix* cellRot =
new G4RotationMatrix();
1058 cellRot->rotateZ( -spanAngle * j );
1059 std::ostringstream osnameCellPhys;
1060 osnameCellPhys <<
"physical"
1061 <<
"MdcAxialLayer" << i <<
"_" <<
n <<
"Cell" << j;
1062 G4VPhysicalVolume* replica_phys;
1064 new G4PVPlacement( cellRot, G4ThreeVector(), replica_log, osnameCellPhys.str(),
1065 axialLayer_log,
false, j,
false );
1071 for ( i = 35; i > 19; i-- )
1073 signalLayer = mdc->Signal2Global( i );
1075 innerR = mdc->Layer( signalLayer - 1 ).R() * mm - fieldWireR;
1076 outR = mdc->Layer( signalLayer + 1 ).R() * mm - fieldWireR;
1077 if ( i == 35 ) outR = mdc->Layer( signalLayer + 1 ).R() * mm + fieldWireR;
1079 innerLength = ( mdc->Layer( signalLayer - 1 ).Length() ) / 2. * mm;
1080 outLength = ( mdc->Layer( signalLayer + 1 ).Length() ) / 2. * mm;
1082 innerTwistAngle = mdc->Layer( signalLayer - 1 ).RotateAngle() *
rad;
1083 outTwistAngle = mdc->Layer( signalLayer + 1 ).RotateAngle() *
rad;
1085 innerTan = innerR / innerLength *
sin( innerTwistAngle );
1087 midInnerR = innerR *
cos( innerTwistAngle );
1088 innerStereo = atan( innerTan );
1090 outTan = outR / outLength *
sin( outTwistAngle );
1091 outTwistAngleFixed = atan( innerLength / outLength *
tan( outTwistAngle ) );
1093 if (
abs( outTwistAngleFixed ) >=
abs( innerTwistAngle ) )
1095 midOutR = outR *
cos( outTwistAngle );
1096 outRFixed = midOutR /
cos( innerTwistAngle );
1099 outTanFixed = midOutR / innerLength *
tan( innerTwistAngle );
1100 outStereo = atan( outTanFixed );
1104 outRFixed = sqrt( outR * outR + ( innerLength * innerLength - outLength * outLength ) *
1107 midOutR = outR *
cos( innerTwistAngle );
1109 outTanFixed = outRFixed / innerLength *
sin( innerTwistAngle );
1110 outStereo = atan( outTanFixed );
1113 std::ostringstream osnameLayerSolid;
1114 osnameLayerSolid <<
"solid"
1115 <<
"MdcStereoLayer" << i;
1117 G4Hype* stereoLayer_hype =
new G4Hype( osnameLayerSolid.str(), midInnerR, midOutR,
1118 innerStereo, outStereo, innerLength );
1120 std::ostringstream osnameLayerLogical;
1121 osnameLayerLogical <<
"logical"
1122 <<
"MdcStereoLayer" << i;
1123 G4LogicalVolume* stereoLayer_log =
1124 new G4LogicalVolume( stereoLayer_hype, MdcGas, osnameLayerLogical.str(), 0, 0, 0 );
1125 stereoLayer_log->SetVisAttributes( G4VisAttributes::Invisible );
1127 replicaNo = mdc->Layer( signalLayer ).WireNo() / 2;
1128 spanAngle = 360. / replicaNo * deg;
1129 firstWire = mdc->Layer( signalLayer ).FirstWire();
1131 G4RotationMatrix* layerRot =
new G4RotationMatrix();
1132 layerRot->rotateZ( -( spanAngle * ( 1 - firstWire ) / 2. + innerTwistAngle ) );
1134 std::ostringstream osnameLayerPhys;
1135 osnameLayerPhys <<
"physical"
1136 <<
"MdcStereoLayer" << i;
1137 G4VPhysicalVolume* stereoLayer_phys;
1138 stereoLayer_phys =
new G4PVPlacement( layerRot, G4ThreeVector(), stereoLayer_log,
1139 osnameLayerPhys.str(), mdc_log,
false, i,
false );
1141 std::ostringstream osnameCellSolid;
1142 osnameCellSolid <<
"solid"
1143 <<
"MdcStereoLayer" << i <<
"Cell";
1145 G4TwistedTubs* twistTub =
1146 new G4TwistedTubs( osnameCellSolid.str(), -innerTwistAngle * 2, innerR,
1147 outR - 1.0 * micrometer, innerLength, spanAngle );
1149 std::ostringstream osnameCellLogical;
1150 osnameCellLogical <<
"logical"
1151 <<
"MdcStereoLayer" << i <<
"Cell";
1152 G4LogicalVolume* twistTub_log =
1153 new G4LogicalVolume( twistTub, MdcGas, osnameCellLogical.str(), 0, 0, 0 );
1155 twistTub_log->SetVisAttributes( G4VisAttributes::Invisible );
1156 twistTub_log->SetSensitiveDetector( aTrackerSD );
1162 std::ostringstream osnameFieldWireSolid;
1163 osnameFieldWireSolid <<
"solid"
1164 <<
"StereoLayer" << i <<
"FieldWire";
1165 G4Tubs* fieldWire_tube =
new G4Tubs( osnameFieldWireSolid.str(), 0., fieldWireR,
1166 innerLength, 0., 360 * deg );
1167 std::ostringstream osnameFieldWireLogical;
1168 osnameFieldWireLogical <<
"logical"
1169 <<
"StereoLayer" << i <<
"FieldWire";
1170 G4LogicalVolume* fieldWire_log =
1171 new G4LogicalVolume( fieldWire_tube, Au, osnameFieldWireLogical.str(), 0, 0, 0 );
1173 std::ostringstream osnameFieldWireSubSolid;
1174 osnameFieldWireSubSolid <<
"solid"
1175 <<
"StereoLayer" << i <<
"FieldWireSub";
1176 G4Tubs* fieldWireSub_tube =
1177 new G4Tubs( osnameFieldWireSubSolid.str(), 0., fieldWireR - thickOfAu, innerLength,
1179 std::ostringstream osnameFieldWireSubLogical;
1180 osnameFieldWireSubLogical <<
"logical"
1181 <<
"StereoLayer" << i <<
"FieldWireSub";
1182 G4LogicalVolume* fieldWireSub_log =
new G4LogicalVolume(
1183 fieldWireSub_tube, Al, osnameFieldWireSubLogical.str(), 0, 0, 0 );
1184 std::ostringstream osnameFieldWireSubPhys;
1185 osnameFieldWireSubPhys <<
"physical"
1186 <<
"StereoLayer" << i <<
"FieldWireSub";
1187 G4VPhysicalVolume* fieldWireSub_phys;
1189 new G4PVPlacement( 0, G4ThreeVector(), fieldWireSub_log,
1190 osnameFieldWireSubPhys.str(), fieldWire_log,
false, 0,
false );
1192 std::ostringstream osnameSignalWireSolid;
1193 osnameSignalWireSolid <<
"solid"
1194 <<
"StereoLayer" << i <<
"SignalWire";
1195 G4Tubs* signalWire_tube =
new G4Tubs( osnameSignalWireSolid.str(), 0., signalWireR,
1196 innerLength, 0., 360 * deg );
1197 std::ostringstream osnameSignalWireLogical;
1198 osnameSignalWireLogical <<
"logical"
1199 <<
"StereoLayer" << i <<
"SignalWire";
1200 G4LogicalVolume* signalWire_log =
1201 new G4LogicalVolume( signalWire_tube, Au, osnameSignalWireLogical.str(), 0, 0, 0 );
1203 std::ostringstream osnameSignalWireSubSolid;
1204 osnameSignalWireSubSolid <<
"solid"
1205 <<
"StereoLayer" << i <<
"SignalWireSub";
1206 G4Tubs* signalWireSub_tube =
1207 new G4Tubs( osnameSignalWireSubSolid.str(), 0., signalWireR - thickOfAu,
1208 innerLength, 0., 360 * deg );
1209 std::ostringstream osnameSignalWireSubLogical;
1210 osnameSignalWireSubLogical <<
"logical"
1211 <<
"StereoLayer" << i <<
"SignalWireSub";
1212 G4LogicalVolume* signalWireSub_log =
new G4LogicalVolume(
1213 signalWireSub_tube, W, osnameSignalWireSubLogical.str(), 0, 0, 0 );
1214 std::ostringstream osnameSignalWireSubPhys;
1215 osnameSignalWireSubPhys <<
"physical"
1216 <<
"StereoLayer" << i <<
"SignalWireSub";
1217 G4VPhysicalVolume* signalWireSub_phys;
1218 signalWireSub_phys =
new G4PVPlacement( 0, G4ThreeVector(), signalWireSub_log,
1219 osnameSignalWireSubPhys.str(), signalWire_log,
1229 G4double shiftR, midR, eastX, eastY, westX, westY;
1230 shiftR = fieldWireR + 1 * micrometer;
1231 midR = mdc->Layer( signalLayer ).R() * mm;
1233 std::ostringstream osnameFieldWire0Phys;
1234 osnameFieldWire0Phys <<
"physicalStereoLayer" << i <<
"FieldWire0";
1236 eastX = ( innerR + shiftR /
cos( innerTwistAngle ) ) *
cos( innerTwistAngle ) +
1237 shiftR *
cos( 90 * deg - innerTwistAngle );
1238 eastY = ( innerR + shiftR /
cos( innerTwistAngle ) ) *
sin( -innerTwistAngle ) +
1239 shiftR *
sin( 90 * deg - innerTwistAngle );
1240 westX = ( innerR + shiftR /
cos( innerTwistAngle ) ) *
cos( innerTwistAngle ) +
1241 shiftR *
cos( 90 * deg + innerTwistAngle );
1242 westY = ( innerR + shiftR /
cos( innerTwistAngle ) ) *
sin( innerTwistAngle ) +
1243 shiftR *
sin( 90 * deg + innerTwistAngle );
1245 G4ThreeVector east0( eastX, eastY, innerLength );
1246 G4ThreeVector west0( westX, westY, -innerLength );
1247 east0.rotateZ( -spanAngle / 2. );
1248 west0.rotateZ( -spanAngle / 2. );
1250 posX = ( east0.x() + west0.x() ) / 2.;
1251 posY = ( east0.y() + west0.y() ) / 2.;
1252 G4ThreeVector line0 = east0 - west0;
1253 G4RotationMatrix* wireRot0 =
new G4RotationMatrix();
1254 wireRot0->rotateZ( -line0.phi() );
1255 wireRot0->rotateY( -line0.theta() );
1256 G4VPhysicalVolume* fieldWire0_phys;
1258 new G4PVPlacement( wireRot0, G4ThreeVector( posX, posY, 0 ), fieldWire_log,
1259 osnameFieldWire0Phys.str(), twistTub_log,
false, 0,
false );
1261 std::ostringstream osnameFieldWire1Phys;
1262 osnameFieldWire1Phys <<
"physicalStereoLayer" << i <<
"FieldWire1";
1263 eastX = midR *
cos( innerTwistAngle ) + shiftR *
cos( 90 * deg - innerTwistAngle );
1264 eastY = midR *
sin( -innerTwistAngle ) + shiftR *
sin( 90 * deg - innerTwistAngle );
1265 westX = midR *
cos( innerTwistAngle ) + shiftR *
cos( 90 * deg + innerTwistAngle );
1266 westY = midR *
sin( innerTwistAngle ) + shiftR *
sin( 90 * deg + innerTwistAngle );
1267 G4ThreeVector east1( eastX, eastY, innerLength );
1268 G4ThreeVector west1( westX, westY, -innerLength );
1269 east1.rotateZ( -spanAngle / 2. );
1270 west1.rotateZ( -spanAngle / 2. );
1271 posX = ( east1.x() + west1.x() ) / 2.;
1272 posY = ( east1.y() + west1.y() ) / 2.;
1273 G4ThreeVector line1 = east1 - west1;
1274 G4RotationMatrix* wireRot1 =
new G4RotationMatrix();
1275 wireRot1->rotateZ( -line1.phi() );
1276 wireRot1->rotateY( -line1.theta() );
1277 G4VPhysicalVolume* fieldWire1_phys;
1279 new G4PVPlacement( wireRot1, G4ThreeVector( posX, posY, 0 ), fieldWire_log,
1280 osnameFieldWire1Phys.str(), twistTub_log,
false, 1,
false );
1282 std::ostringstream osnameFieldWire3Phys;
1283 osnameFieldWire3Phys <<
"physicalStereoLayer" << i <<
"FieldWire3";
1285 eastX = ( innerR + shiftR /
cos( innerTwistAngle ) ) *
cos( innerTwistAngle );
1286 eastY = ( innerR + shiftR /
cos( innerTwistAngle ) ) *
sin( -innerTwistAngle );
1287 westX = ( innerR + shiftR /
cos( innerTwistAngle ) ) *
cos( innerTwistAngle );
1288 westY = ( innerR + shiftR /
cos( innerTwistAngle ) ) *
sin( innerTwistAngle );
1290 G4ThreeVector east3( eastX, eastY, innerLength );
1291 G4ThreeVector west3( westX, westY, -innerLength );
1293 posX = ( east3.x() + west3.x() ) / 2.;
1294 posY = ( east3.y() + west3.y() ) / 2.;
1295 G4ThreeVector line3 = east3 - west3;
1296 G4RotationMatrix* wireRot3 =
new G4RotationMatrix();
1297 wireRot3->rotateZ( -line3.phi() );
1298 wireRot3->rotateY( -line3.theta() );
1299 G4VPhysicalVolume* fieldWire3_phys;
1301 new G4PVPlacement( wireRot3, G4ThreeVector( posX, posY, 0 ), fieldWire_log,
1302 osnameFieldWire3Phys.str(), twistTub_log,
false, 3,
false );
1304 std::ostringstream osnameSignalWire4Phys;
1305 osnameSignalWire4Phys <<
"physicalStereoLayer" << i <<
"SignalWire4";
1307 eastX = midR *
cos( innerTwistAngle );
1308 eastY = midR *
sin( -innerTwistAngle );
1309 westX = midR *
cos( innerTwistAngle );
1310 westY = midR *
sin( innerTwistAngle );
1312 G4ThreeVector east4( eastX, eastY, innerLength );
1313 G4ThreeVector west4( westX, westY, -innerLength );
1315 posX = ( east4.x() + west4.x() ) / 2.;
1316 posY = ( east4.y() + west4.y() ) / 2.;
1317 G4ThreeVector line4 = east4 - west4;
1318 G4RotationMatrix* wireRot4 =
new G4RotationMatrix();
1319 wireRot4->rotateZ( -line4.phi() );
1320 wireRot4->rotateY( -line4.theta() );
1321 G4VPhysicalVolume* signalWire4_phys;
1323 new G4PVPlacement( wireRot4, G4ThreeVector( posX, posY, 0 ), signalWire_log,
1324 osnameSignalWire4Phys.str(), twistTub_log,
false, 4,
false );
1328 std::ostringstream osnameFieldWire2Phys;
1329 osnameFieldWire2Phys <<
"physicalStereoLayer" << i <<
"FieldWire2";
1331 eastX = ( outR - shiftR /
cos( innerTwistAngle ) ) *
cos( innerTwistAngle ) +
1332 shiftR *
cos( 90 * deg - innerTwistAngle );
1333 eastY = ( outR - shiftR /
cos( innerTwistAngle ) ) *
sin( -innerTwistAngle ) +
1334 shiftR *
sin( 90 * deg - innerTwistAngle );
1335 westX = ( outR - shiftR /
cos( innerTwistAngle ) ) *
cos( innerTwistAngle ) +
1336 shiftR *
cos( 90 * deg + innerTwistAngle );
1337 westY = ( outR - shiftR /
cos( innerTwistAngle ) ) *
sin( innerTwistAngle ) +
1338 shiftR *
sin( 90 * deg + innerTwistAngle );
1340 G4ThreeVector east2( eastX, eastY, innerLength );
1341 G4ThreeVector west2( westX, westY, -innerLength );
1342 east2.rotateZ( -spanAngle / 2. );
1343 west2.rotateZ( -spanAngle / 2. );
1345 posX = ( east2.x() + west2.x() ) / 2.;
1346 posY = ( east2.y() + west2.y() ) / 2.;
1347 G4ThreeVector line2 = east2 - west2;
1348 G4RotationMatrix* wireRot2 =
new G4RotationMatrix();
1349 wireRot2->rotateZ( -line2.phi() );
1350 wireRot2->rotateY( -line2.theta() );
1351 G4VPhysicalVolume* fieldWire2_phys;
1353 new G4PVPlacement( wireRot2, G4ThreeVector( posX, posY, 0 ), fieldWire_log,
1354 osnameFieldWire2Phys.str(), twistTub_log,
false, 2,
false );
1356 std::ostringstream osnameFieldWire5Phys;
1357 osnameFieldWire5Phys <<
"physicalStereoLayer" << i <<
"FieldWire5";
1359 eastX = ( outR - shiftR /
cos( innerTwistAngle ) ) *
cos( innerTwistAngle );
1360 eastY = ( outR - shiftR /
cos( innerTwistAngle ) ) *
sin( -innerTwistAngle );
1361 westX = ( outR - shiftR /
cos( innerTwistAngle ) ) *
cos( innerTwistAngle );
1362 westY = ( outR - shiftR /
cos( innerTwistAngle ) ) *
sin( innerTwistAngle );
1364 G4ThreeVector east5( eastX, eastY, innerLength );
1365 G4ThreeVector west5( westX, westY, -innerLength );
1367 posX = ( east5.x() + west5.x() ) / 2.;
1368 posY = ( east5.y() + west5.y() ) / 2.;
1369 G4ThreeVector line5 = east5 - west5;
1370 G4RotationMatrix* wireRot5 =
new G4RotationMatrix();
1371 wireRot5->rotateZ( -line5.phi() );
1372 wireRot5->rotateY( -line5.theta() );
1373 G4VPhysicalVolume* fieldWire5_phys;
1375 new G4PVPlacement( wireRot5, G4ThreeVector( posX, posY, 0 ), fieldWire_log,
1376 osnameFieldWire5Phys.str(), twistTub_log,
false, 5,
false );
1380 for ( j = replicaNo - 1; j > -1; j-- )
1382 G4RotationMatrix* cellRot =
new G4RotationMatrix();
1383 cellRot->rotateZ( -spanAngle * j );
1385 std::ostringstream osnameCellPhys;
1386 osnameCellPhys <<
"physical"
1387 <<
"MdcStereoLayer" << i <<
"Cell" << j;
1388 G4VPhysicalVolume* twistTub_phys;
1390 new G4PVPlacement( cellRot, G4ThreeVector(), twistTub_log, osnameCellPhys.str(),
1391 stereoLayer_log,
false, j,
false );
1396 for ( i = 19; i > 7; i-- )
1398 signalLayer = mdc->Signal2Global( i );
1399 innerR = mdc->Layer( signalLayer - 1 ).R() * mm - fieldWireR;
1400 outR = mdc->Layer( signalLayer + 1 ).R() * mm - fieldWireR;
1401 if ( i == 19 ) outR = mdc->Layer( signalLayer + 1 ).R() * mm + fieldWireR;
1402 length = ( mdc->Layer( signalLayer ).Length() ) / 2. * mm;
1403 startAngle = 0. * deg;
1404 spanAngle = 360. * deg;
1405 firstWire = mdc->Layer( signalLayer ).FirstWire();
1411 std::ostringstream osnameLayerSolid;
1412 osnameLayerSolid <<
"solid"
1413 <<
"MdcAxialLayer" << i;
1414 G4Tubs* axialLayer_tube =
1415 new G4Tubs( osnameLayerSolid.str(), innerR, outR, length, startAngle, spanAngle );
1417 std::ostringstream osnameLayerLogical;
1418 osnameLayerLogical <<
"logical"
1419 <<
"MdcAxialLayer" << i;
1420 G4LogicalVolume* axialLayer_log =
1421 new G4LogicalVolume( axialLayer_tube, MdcGas, osnameLayerLogical.str(), 0, 0, 0 );
1422 axialLayer_log->SetVisAttributes( G4VisAttributes::Invisible );
1424 replicaNo = mdc->Layer( signalLayer ).WireNo() / 2;
1425 spanAngle = 360. / replicaNo * deg;
1427 offset = mdc->Layer( signalLayer ).Phi() *
rad - firstWire * spanAngle / 2.;
1428 G4RotationMatrix* layerRot =
new G4RotationMatrix();
1429 layerRot->rotateZ( -offset );
1431 std::ostringstream osnameLayerPhys;
1432 osnameLayerPhys <<
"physical"
1433 <<
"MdcAxialLayer" << i;
1434 G4VPhysicalVolume* axialLayer_phys;
1435 axialLayer_phys =
new G4PVPlacement( layerRot, G4ThreeVector(), axialLayer_log,
1436 osnameLayerPhys.str(), mdc_log,
false, i,
false );
1439 std::ostringstream osnameCellSolid;
1440 osnameCellSolid <<
"solid"
1441 <<
"MdcAxialLayer" << i <<
"Cell";
1442 G4Tubs* replica_tube =
1443 new G4Tubs( osnameCellSolid.str(), innerR, outR, length, startAngle, spanAngle );
1445 std::ostringstream osnameCellLogical;
1446 osnameCellLogical <<
"logical"
1447 <<
"MdcAxialLayer" << i <<
"Cell";
1448 G4LogicalVolume* replica_log =
1449 new G4LogicalVolume( replica_tube, MdcGas, osnameCellLogical.str(), 0, 0, 0 );
1451 replica_log->SetSensitiveDetector( aTrackerSD );
1452 visAtt =
new G4VisAttributes( G4Colour( 0.0, 0.0, 1.0 ) );
1453 replica_log->SetVisAttributes( visAtt );
1454 replica_log->SetVisAttributes( G4VisAttributes::Invisible );
1459 std::ostringstream osnameFieldWireSolid;
1460 osnameFieldWireSolid <<
"solid"
1461 <<
"AxialLayer" << i <<
"FieldWire";
1462 G4Tubs* fieldWire_tube =
1463 new G4Tubs( osnameFieldWireSolid.str(), 0., fieldWireR, length, 0., 360 * deg );
1464 std::ostringstream osnameFieldWireLogical;
1465 osnameFieldWireLogical <<
"logical"
1466 <<
"AxialLayer" << i <<
"FieldWire";
1467 G4LogicalVolume* fieldWire_log =
1468 new G4LogicalVolume( fieldWire_tube, Au, osnameFieldWireLogical.str(), 0, 0, 0 );
1470 std::ostringstream osnameFieldWireSubSolid;
1471 osnameFieldWireSubSolid <<
"solid"
1472 <<
"AxialLayer" << i <<
"FieldWireSub";
1473 G4Tubs* fieldWireSub_tube =
new G4Tubs(
1474 osnameFieldWireSubSolid.str(), 0., fieldWireR - thickOfAu, length, 0., 360 * deg );
1475 std::ostringstream osnameFieldWireSubLogical;
1476 osnameFieldWireSubLogical <<
"logical"
1477 <<
"AxialLayer" << i <<
"FieldWireSub";
1478 G4LogicalVolume* fieldWireSub_log =
new G4LogicalVolume(
1479 fieldWireSub_tube, Al, osnameFieldWireSubLogical.str(), 0, 0, 0 );
1480 std::ostringstream osnameFieldWireSubPhys;
1481 osnameFieldWireSubPhys <<
"physical"
1482 <<
"AxialLayer" << i <<
"FieldWireSub";
1483 G4VPhysicalVolume* fieldWireSub_phys;
1485 new G4PVPlacement( 0, G4ThreeVector(), fieldWireSub_log,
1486 osnameFieldWireSubPhys.str(), fieldWire_log,
false, 0,
false );
1488 std::ostringstream osnameFieldWireHalfSolid;
1489 osnameFieldWireHalfSolid <<
"solid"
1490 <<
"AxialLayer" << i <<
"FieldWireHalf";
1491 G4Tubs* fieldWireHalf_tube =
new G4Tubs( osnameFieldWireHalfSolid.str(), 0.,
1492 fieldWireR, length, 0., 180 * deg );
1493 std::ostringstream osnameFieldWireHalfLogical;
1494 osnameFieldWireHalfLogical <<
"logical"
1495 <<
"AxialLayer" << i <<
"FieldWireHalf";
1496 G4LogicalVolume* fieldWireHalf_log =
new G4LogicalVolume(
1497 fieldWireHalf_tube, Au, osnameFieldWireHalfLogical.str(), 0, 0, 0 );
1499 std::ostringstream osnameFieldWireHalfSubSolid;
1500 osnameFieldWireHalfSubSolid <<
"solid"
1501 <<
"AxialLayer" << i <<
"FieldWireHalfSub";
1502 G4Tubs* fieldWireHalfSub_tube =
1503 new G4Tubs( osnameFieldWireHalfSubSolid.str(), 0., fieldWireR - thickOfAu, length,
1505 std::ostringstream osnameFieldWireHalfSubLogical;
1506 osnameFieldWireHalfSubLogical <<
"logical"
1507 <<
"AxialLayer" << i <<
"FieldWireHalfSub";
1508 G4LogicalVolume* fieldWireHalfSub_log =
new G4LogicalVolume(
1509 fieldWireHalfSub_tube, Al, osnameFieldWireHalfSubLogical.str(), 0, 0, 0 );
1510 std::ostringstream osnameFieldWireHalfSubPhys;
1511 osnameFieldWireHalfSubPhys <<
"physical"
1512 <<
"AxialLayer" << i <<
"FieldWireHalfSub";
1513 G4VPhysicalVolume* fieldWireHalfSub_phys;
1514 fieldWireHalfSub_phys =
new G4PVPlacement( 0, G4ThreeVector(), fieldWireHalfSub_log,
1515 osnameFieldWireHalfSubPhys.str(),
1516 fieldWireHalf_log,
false, 0,
false );
1518 std::ostringstream osnameSignalWireSolid;
1519 osnameSignalWireSolid <<
"solid"
1520 <<
"AxialLayer" << i <<
"SignalWire";
1521 G4Tubs* signalWire_tube =
1522 new G4Tubs( osnameSignalWireSolid.str(), 0., signalWireR, length, 0., 360 * deg );
1523 std::ostringstream osnameSignalWireLogical;
1524 osnameSignalWireLogical <<
"logical"
1525 <<
"AxialLayer" << i <<
"SignalWire";
1526 G4LogicalVolume* signalWire_log =
1527 new G4LogicalVolume( signalWire_tube, Au, osnameSignalWireLogical.str(), 0, 0, 0 );
1529 std::ostringstream osnameSignalWireSubSolid;
1530 osnameSignalWireSubSolid <<
"solid"
1531 <<
"AxialLayer" << i <<
"SignalWireSub";
1532 G4Tubs* signalWireSub_tube =
1533 new G4Tubs( osnameSignalWireSubSolid.str(), 0., signalWireR - thickOfAu, length,
1535 std::ostringstream osnameSignalWireSubLogical;
1536 osnameSignalWireSubLogical <<
"logical"
1537 <<
"AxialLayer" << i <<
"SignalWireSub";
1538 G4LogicalVolume* signalWireSub_log =
new G4LogicalVolume(
1539 signalWireSub_tube, W, osnameSignalWireSubLogical.str(), 0, 0, 0 );
1540 std::ostringstream osnameSignalWireSubPhys;
1541 osnameSignalWireSubPhys <<
"physical"
1542 <<
"AxialLayer" << i <<
"SignalWireSub";
1543 G4VPhysicalVolume* signalWireSub_phys;
1544 signalWireSub_phys =
new G4PVPlacement( 0, G4ThreeVector(), signalWireSub_log,
1545 osnameSignalWireSubPhys.str(), signalWire_log,
1555 std::ostringstream osnameFieldWire0Phys;
1556 osnameFieldWire0Phys <<
"physicalAxialLayer" << i <<
"FieldWire0";
1557 posX = mdc->Layer( signalLayer - 1 ).R() * mm;
1558 G4VPhysicalVolume* fieldWire0_phys;
1560 new G4PVPlacement( 0, G4ThreeVector( posX, 0, 0 ), fieldWireHalf_log,
1561 osnameFieldWire0Phys.str(), replica_log,
false, 0,
false );
1563 std::ostringstream osnameFieldWire1Phys;
1564 osnameFieldWire1Phys <<
"physicalAxialLayer" << i <<
"FieldWire1";
1565 posX = mdc->Layer( signalLayer ).R() * mm;
1566 G4VPhysicalVolume* fieldWire1_phys;
1568 new G4PVPlacement( 0, G4ThreeVector( posX, 0, 0 ), fieldWireHalf_log,
1569 osnameFieldWire1Phys.str(), replica_log,
false, 1,
false );
1573 std::ostringstream osnameFieldWire2Phys;
1574 osnameFieldWire2Phys <<
"physicalAxialLayer" << i <<
"FieldWire2";
1575 posX = mdc->Layer( signalLayer + 1 ).R() * mm;
1576 G4VPhysicalVolume* fieldWire2_phys;
1578 new G4PVPlacement( 0, G4ThreeVector( posX, 0, 0 ), fieldWireHalf_log,
1579 osnameFieldWire2Phys.str(), replica_log,
false, 2,
false );
1582 std::ostringstream osnameFieldWire3Phys;
1583 osnameFieldWire3Phys <<
"physicalAxialLayer" << i <<
"FieldWire3";
1584 posX = mdc->Layer( signalLayer - 1 ).R() * mm *
cos( spanAngle / 2. );
1585 posY = mdc->Layer( signalLayer - 1 ).R() * mm *
sin( spanAngle / 2. );
1586 G4VPhysicalVolume* fieldWire3_phys;
1588 new G4PVPlacement( 0, G4ThreeVector( posX, posY, 0 ), fieldWire_log,
1589 osnameFieldWire3Phys.str(), replica_log,
false, 3,
false );
1591 std::ostringstream osnameSignalWirePhys;
1592 osnameSignalWirePhys <<
"physicalAxialLayer" << i <<
"SignalWire4";
1593 posX = mdc->Layer( signalLayer ).R() * mm *
cos( spanAngle / 2. );
1594 posY = mdc->Layer( signalLayer ).R() * mm *
sin( spanAngle / 2. );
1595 G4VPhysicalVolume* signalWire_phys;
1597 new G4PVPlacement( 0, G4ThreeVector( posX, posY, 0 ), signalWire_log,
1598 osnameSignalWirePhys.str(), replica_log,
false, 4,
false );
1602 std::ostringstream osnameFieldWire5Phys;
1603 osnameFieldWire5Phys <<
"physicalAxialLayer" << i <<
"FieldWire5";
1604 posX = mdc->Layer( signalLayer + 1 ).R() * mm *
cos( spanAngle / 2. );
1605 posY = mdc->Layer( signalLayer + 1 ).R() * mm *
sin( spanAngle / 2. );
1606 G4VPhysicalVolume* fieldWire5_phys;
1608 new G4PVPlacement( 0, G4ThreeVector( posX, posY, 0 ), fieldWire_log,
1609 osnameFieldWire5Phys.str(), replica_log,
false, 5,
false );
1612 std::ostringstream osnameFieldWire6Phys;
1613 osnameFieldWire6Phys <<
"physicalAxialLayer" << i <<
"FieldWire6";
1614 posX = mdc->Layer( signalLayer - 1 ).R() * mm *
cos( spanAngle );
1615 posY = mdc->Layer( signalLayer - 1 ).R() * mm *
sin( spanAngle );
1616 G4RotationMatrix* wireRot6 =
new G4RotationMatrix();
1617 wireRot6->rotateZ( 180 * deg - spanAngle );
1618 G4VPhysicalVolume* fieldWire6_phys;
1620 new G4PVPlacement( wireRot6, G4ThreeVector( posX, posY, 0 ), fieldWireHalf_log,
1621 osnameFieldWire6Phys.str(), replica_log,
false, 6,
false );
1623 std::ostringstream osnameFieldWire7Phys;
1624 osnameFieldWire7Phys <<
"physicalAxialLayer" << i <<
"FieldWire7";
1625 posX = mdc->Layer( signalLayer ).R() * mm *
cos( spanAngle );
1626 posY = mdc->Layer( signalLayer ).R() * mm *
sin( spanAngle );
1627 G4RotationMatrix* wireRot7 =
new G4RotationMatrix();
1628 wireRot7->rotateZ( 180 * deg - spanAngle );
1629 G4VPhysicalVolume* fieldWire7_phys;
1631 new G4PVPlacement( wireRot7, G4ThreeVector( posX, posY, 0 ), fieldWireHalf_log,
1632 osnameFieldWire7Phys.str(), replica_log,
false, 7,
false );
1636 std::ostringstream osnameFieldWire8Phys;
1637 osnameFieldWire8Phys <<
"physicalAxialLayer" << i <<
"FieldWire8";
1638 posX = mdc->Layer( signalLayer + 1 ).R() * mm *
cos( spanAngle );
1639 posY = mdc->Layer( signalLayer + 1 ).R() * mm *
sin( spanAngle );
1640 G4RotationMatrix* wireRot8 =
new G4RotationMatrix();
1641 wireRot8->rotateZ( 180 * deg - spanAngle );
1642 G4VPhysicalVolume* fieldWire8_phys;
1644 new G4PVPlacement( wireRot8, G4ThreeVector( posX, posY, 0 ), fieldWireHalf_log,
1645 osnameFieldWire8Phys.str(), replica_log,
false, 8,
false );
1649 for ( j = replicaNo - 1; j > -1; j-- )
1651 G4RotationMatrix* cellRot =
new G4RotationMatrix();
1652 cellRot->rotateZ( -spanAngle * j );
1654 std::ostringstream osnameCellPhys;
1655 osnameCellPhys <<
"physical"
1656 <<
"MdcAxialLayer" << i <<
"Cell" << j;
1657 G4VPhysicalVolume* replica_phys;
1659 new G4PVPlacement( cellRot, G4ThreeVector(), replica_log, osnameCellPhys.str(),
1660 axialLayer_log,
false, j,
false );
1665 for ( i = 7; i > -1; i-- )
1667 signalLayer = mdc->Signal2Global( i );
1669 innerR = mdc->Layer( signalLayer - 1 ).R() * mm - fieldWireR;
1670 outR = mdc->Layer( signalLayer + 1 ).R() * mm - fieldWireR;
1671 if ( i == 7 ) outR = mdc->Layer( signalLayer + 1 ).R() * mm + fieldWireR;
1673 innerLength = ( mdc->Layer( signalLayer - 1 ).Length() ) / 2. * mm;
1674 outLength = ( mdc->Layer( signalLayer + 1 ).Length() ) / 2. * mm;
1676 innerTwistAngle = mdc->Layer( signalLayer - 1 ).RotateAngle() *
rad;
1677 outTwistAngle = mdc->Layer( signalLayer + 1 ).RotateAngle() *
rad;
1679 innerTan = innerR / innerLength *
sin( innerTwistAngle );
1681 midInnerR = innerR *
cos( innerTwistAngle );
1682 innerStereo = atan( innerTan );
1684 outTan = outR / outLength *
sin( outTwistAngle );
1685 outTwistAngleFixed = atan( innerLength / outLength *
tan( outTwistAngle ) );
1687 if (
abs( outTwistAngleFixed ) >=
abs( innerTwistAngle ) )
1689 midOutR = outR *
cos( outTwistAngle );
1690 outRFixed = midOutR /
cos( innerTwistAngle );
1693 outTanFixed = midOutR / innerLength *
tan( innerTwistAngle );
1694 outStereo = atan( outTanFixed );
1698 outRFixed = sqrt( outR * outR + ( innerLength * innerLength - outLength * outLength ) *
1701 midOutR = outR *
cos( innerTwistAngle );
1703 outTanFixed = outRFixed / innerLength *
sin( innerTwistAngle );
1704 outStereo = atan( outTanFixed );
1708 std::ostringstream osnameLayerSolid;
1709 osnameLayerSolid <<
"solid"
1710 <<
"MdcStereoLayer" << i;
1712 G4Hype* stereoLayer_hype =
new G4Hype( osnameLayerSolid.str(), midInnerR, midOutR,
1713 innerStereo, outStereo, innerLength );
1714 std::ostringstream osnameLayerLogical;
1715 osnameLayerLogical <<
"logical"
1716 <<
"MdcStereoLayer" << i;
1717 G4LogicalVolume* stereoLayer_log =
1718 new G4LogicalVolume( stereoLayer_hype, MdcGas, osnameLayerLogical.str(), 0, 0, 0 );
1719 stereoLayer_log->SetVisAttributes( G4VisAttributes::Invisible );
1721 replicaNo = mdc->Layer( signalLayer ).WireNo() / 2;
1722 spanAngle = 360. / replicaNo * deg;
1723 firstWire = mdc->Layer( signalLayer ).FirstWire();
1725 G4RotationMatrix* layerRot =
new G4RotationMatrix();
1726 layerRot->rotateZ( -( spanAngle * ( 1 - firstWire ) / 2. + innerTwistAngle ) );
1728 std::ostringstream osnameLayerPhys;
1729 osnameLayerPhys <<
"physical"
1730 <<
"MdcStereoLayer" << i;
1732 G4VPhysicalVolume* stereoLayer_phys;
1733 stereoLayer_phys =
new G4PVPlacement( layerRot, G4ThreeVector(), stereoLayer_log,
1734 osnameLayerPhys.str(), mdc_log,
false, i,
false );
1737 std::ostringstream osnameCellSolid;
1738 osnameCellSolid <<
"solid"
1739 <<
"MdcStereoLayer" << i <<
"Cell";
1741 G4TwistedTubs* twistTub =
1742 new G4TwistedTubs( osnameCellSolid.str(), -innerTwistAngle * 2, innerR,
1743 outR - 1.0 * micrometer, innerLength, spanAngle );
1745 std::ostringstream osnameCellLogical;
1746 osnameCellLogical <<
"logical"
1747 <<
"MdcStereoLayer" << i <<
"Cell";
1748 G4LogicalVolume* twistTub_log =
1749 new G4LogicalVolume( twistTub, MdcGas, osnameCellLogical.str(), 0, 0, 0 );
1751 twistTub_log->SetVisAttributes( G4VisAttributes::Invisible );
1752 twistTub_log->SetSensitiveDetector( aTrackerSD );
1757 std::ostringstream osnameFieldWireSolid;
1758 osnameFieldWireSolid <<
"solid"
1759 <<
"StereoLayer" << i <<
"FieldWire";
1760 G4Tubs* fieldWire_tube =
new G4Tubs( osnameFieldWireSolid.str(), 0., fieldWireR,
1761 innerLength, 0., 360 * deg );
1762 std::ostringstream osnameFieldWireLogical;
1763 osnameFieldWireLogical <<
"logical"
1764 <<
"StereoLayer" << i <<
"FieldWire";
1765 G4LogicalVolume* fieldWire_log =
1766 new G4LogicalVolume( fieldWire_tube, Au, osnameFieldWireLogical.str(), 0, 0, 0 );
1768 std::ostringstream osnameFieldWireSubSolid;
1769 osnameFieldWireSubSolid <<
"solid"
1770 <<
"StereoLayer" << i <<
"FieldWireSub";
1771 G4Tubs* fieldWireSub_tube =
1772 new G4Tubs( osnameFieldWireSubSolid.str(), 0., fieldWireR - thickOfAu, innerLength,
1774 std::ostringstream osnameFieldWireSubLogical;
1775 osnameFieldWireSubLogical <<
"logical"
1776 <<
"StereoLayer" << i <<
"FieldWireSub";
1777 G4LogicalVolume* fieldWireSub_log =
new G4LogicalVolume(
1778 fieldWireSub_tube, Al, osnameFieldWireSubLogical.str(), 0, 0, 0 );
1779 std::ostringstream osnameFieldWireSubPhys;
1780 osnameFieldWireSubPhys <<
"physical"
1781 <<
"StereoLayer" << i <<
"FieldWireSub";
1782 G4VPhysicalVolume* fieldWireSub_phys;
1784 new G4PVPlacement( 0, G4ThreeVector(), fieldWireSub_log,
1785 osnameFieldWireSubPhys.str(), fieldWire_log,
false, 0,
false );
1787 std::ostringstream osnameSignalWireSolid;
1788 osnameSignalWireSolid <<
"solid"
1789 <<
"StereoLayer" << i <<
"SignalWire";
1790 G4Tubs* signalWire_tube =
new G4Tubs( osnameSignalWireSolid.str(), 0., signalWireR,
1791 innerLength, 0., 360 * deg );
1792 std::ostringstream osnameSignalWireLogical;
1793 osnameSignalWireLogical <<
"logical"
1794 <<
"StereoLayer" << i <<
"SignalWire";
1795 G4LogicalVolume* signalWire_log =
1796 new G4LogicalVolume( signalWire_tube, Au, osnameSignalWireLogical.str(), 0, 0, 0 );
1798 std::ostringstream osnameSignalWireSubSolid;
1799 osnameSignalWireSubSolid <<
"solid"
1800 <<
"StereoLayer" << i <<
"SignalWireSub";
1801 G4Tubs* signalWireSub_tube =
1802 new G4Tubs( osnameSignalWireSubSolid.str(), 0., signalWireR - thickOfAu,
1803 innerLength, 0., 360 * deg );
1804 std::ostringstream osnameSignalWireSubLogical;
1805 osnameSignalWireSubLogical <<
"logical"
1806 <<
"StereoLayer" << i <<
"SignalWireSub";
1807 G4LogicalVolume* signalWireSub_log =
new G4LogicalVolume(
1808 signalWireSub_tube, W, osnameSignalWireSubLogical.str(), 0, 0, 0 );
1809 std::ostringstream osnameSignalWireSubPhys;
1810 osnameSignalWireSubPhys <<
"physical"
1811 <<
"StereoLayer" << i <<
"SignalWireSub";
1812 G4VPhysicalVolume* signalWireSub_phys;
1813 signalWireSub_phys =
new G4PVPlacement( 0, G4ThreeVector(), signalWireSub_log,
1814 osnameSignalWireSubPhys.str(), signalWire_log,
1824 G4double shiftR, midR, eastX, eastY, westX, westY;
1825 shiftR = fieldWireR + 1 * micrometer;
1826 midR = mdc->Layer( signalLayer ).R() * mm;
1828 std::ostringstream osnameFieldWire0Phys;
1829 osnameFieldWire0Phys <<
"physicalStereoLayer" << i <<
"FieldWire0";
1831 eastX = ( innerR + shiftR /
cos( innerTwistAngle ) ) *
cos( innerTwistAngle ) +
1832 shiftR *
cos( 90 * deg - innerTwistAngle );
1833 eastY = ( innerR + shiftR /
cos( innerTwistAngle ) ) *
sin( -innerTwistAngle ) +
1834 shiftR *
sin( 90 * deg - innerTwistAngle );
1835 westX = ( innerR + shiftR /
cos( innerTwistAngle ) ) *
cos( innerTwistAngle ) +
1836 shiftR *
cos( 90 * deg + innerTwistAngle );
1837 westY = ( innerR + shiftR /
cos( innerTwistAngle ) ) *
sin( innerTwistAngle ) +
1838 shiftR *
sin( 90 * deg + innerTwistAngle );
1840 G4ThreeVector east0( eastX, eastY, innerLength );
1841 G4ThreeVector west0( westX, westY, -innerLength );
1842 east0.rotateZ( -spanAngle / 2. );
1843 west0.rotateZ( -spanAngle / 2. );
1845 posX = ( east0.x() + west0.x() ) / 2.;
1846 posY = ( east0.y() + west0.y() ) / 2.;
1847 G4ThreeVector line0 = east0 - west0;
1848 G4RotationMatrix* wireRot0 =
new G4RotationMatrix();
1849 wireRot0->rotateZ( -line0.phi() );
1850 wireRot0->rotateY( -line0.theta() );
1851 G4VPhysicalVolume* fieldWire0_phys;
1853 new G4PVPlacement( wireRot0, G4ThreeVector( posX, posY, 0 ), fieldWire_log,
1854 osnameFieldWire0Phys.str(), twistTub_log,
false, 0,
false );
1856 std::ostringstream osnameFieldWire1Phys;
1857 osnameFieldWire1Phys <<
"physicalStereoLayer" << i <<
"FieldWire1";
1858 eastX = midR *
cos( innerTwistAngle ) + shiftR *
cos( 90 * deg - innerTwistAngle );
1859 eastY = midR *
sin( -innerTwistAngle ) + shiftR *
sin( 90 * deg - innerTwistAngle );
1860 westX = midR *
cos( innerTwistAngle ) + shiftR *
cos( 90 * deg + innerTwistAngle );
1861 westY = midR *
sin( innerTwistAngle ) + shiftR *
sin( 90 * deg + innerTwistAngle );
1862 G4ThreeVector east1( eastX, eastY, innerLength );
1863 G4ThreeVector west1( westX, westY, -innerLength );
1864 east1.rotateZ( -spanAngle / 2. );
1865 west1.rotateZ( -spanAngle / 2. );
1866 posX = ( east1.x() + west1.x() ) / 2.;
1867 posY = ( east1.y() + west1.y() ) / 2.;
1868 G4ThreeVector line1 = east1 - west1;
1869 G4RotationMatrix* wireRot1 =
new G4RotationMatrix();
1870 wireRot1->rotateZ( -line1.phi() );
1871 wireRot1->rotateY( -line1.theta() );
1872 G4VPhysicalVolume* fieldWire1_phys;
1874 new G4PVPlacement( wireRot1, G4ThreeVector( posX, posY, 0 ), fieldWire_log,
1875 osnameFieldWire1Phys.str(), twistTub_log,
false, 1,
false );
1877 std::ostringstream osnameFieldWire3Phys;
1878 osnameFieldWire3Phys <<
"physicalStereoLayer" << i <<
"FieldWire3";
1880 eastX = ( innerR + shiftR /
cos( innerTwistAngle ) ) *
cos( innerTwistAngle );
1881 eastY = ( innerR + shiftR /
cos( innerTwistAngle ) ) *
sin( -innerTwistAngle );
1882 westX = ( innerR + shiftR /
cos( innerTwistAngle ) ) *
cos( innerTwistAngle );
1883 westY = ( innerR + shiftR /
cos( innerTwistAngle ) ) *
sin( innerTwistAngle );
1885 G4ThreeVector east3( eastX, eastY, innerLength );
1886 G4ThreeVector west3( westX, westY, -innerLength );
1888 posX = ( east3.x() + west3.x() ) / 2.;
1889 posY = ( east3.y() + west3.y() ) / 2.;
1890 G4ThreeVector line3 = east3 - west3;
1891 G4RotationMatrix* wireRot3 =
new G4RotationMatrix();
1892 wireRot3->rotateZ( -line3.phi() );
1893 wireRot3->rotateY( -line3.theta() );
1894 G4VPhysicalVolume* fieldWire3_phys;
1896 new G4PVPlacement( wireRot3, G4ThreeVector( posX, posY, 0 ), fieldWire_log,
1897 osnameFieldWire3Phys.str(), twistTub_log,
false, 3,
false );
1899 std::ostringstream osnameSignalWire4Phys;
1900 osnameSignalWire4Phys <<
"physicalStereoLayer" << i <<
"SignalWire4";
1902 eastX = midR *
cos( innerTwistAngle );
1903 eastY = midR *
sin( -innerTwistAngle );
1904 westX = midR *
cos( innerTwistAngle );
1905 westY = midR *
sin( innerTwistAngle );
1907 G4ThreeVector east4( eastX, eastY, innerLength );
1908 G4ThreeVector west4( westX, westY, -innerLength );
1910 posX = ( east4.x() + west4.x() ) / 2.;
1911 posY = ( east4.y() + west4.y() ) / 2.;
1912 G4ThreeVector line4 = east4 - west4;
1913 G4RotationMatrix* wireRot4 =
new G4RotationMatrix();
1914 wireRot4->rotateZ( -line4.phi() );
1915 wireRot4->rotateY( -line4.theta() );
1916 G4VPhysicalVolume* signalWire4_phys;
1918 new G4PVPlacement( wireRot4, G4ThreeVector( posX, posY, 0 ), signalWire_log,
1919 osnameSignalWire4Phys.str(), twistTub_log,
false, 4,
false );
1923 std::ostringstream osnameFieldWire2Phys;
1924 osnameFieldWire2Phys <<
"physicalStereoLayer" << i <<
"FieldWire2";
1926 eastX = ( outR - shiftR /
cos( innerTwistAngle ) ) *
cos( innerTwistAngle ) +
1927 shiftR *
cos( 90 * deg - innerTwistAngle );
1928 eastY = ( outR - shiftR /
cos( innerTwistAngle ) ) *
sin( -innerTwistAngle ) +
1929 shiftR *
sin( 90 * deg - innerTwistAngle );
1930 westX = ( outR - shiftR /
cos( innerTwistAngle ) ) *
cos( innerTwistAngle ) +
1931 shiftR *
cos( 90 * deg + innerTwistAngle );
1932 westY = ( outR - shiftR /
cos( innerTwistAngle ) ) *
sin( innerTwistAngle ) +
1933 shiftR *
sin( 90 * deg + innerTwistAngle );
1935 G4ThreeVector east2( eastX, eastY, innerLength );
1936 G4ThreeVector west2( westX, westY, -innerLength );
1937 east2.rotateZ( -spanAngle / 2. );
1938 west2.rotateZ( -spanAngle / 2. );
1940 posX = ( east2.x() + west2.x() ) / 2.;
1941 posY = ( east2.y() + west2.y() ) / 2.;
1942 G4ThreeVector line2 = east2 - west2;
1943 G4RotationMatrix* wireRot2 =
new G4RotationMatrix();
1944 wireRot2->rotateZ( -line2.phi() );
1945 wireRot2->rotateY( -line2.theta() );
1946 G4VPhysicalVolume* fieldWire2_phys;
1948 new G4PVPlacement( wireRot2, G4ThreeVector( posX, posY, 0 ), fieldWire_log,
1949 osnameFieldWire2Phys.str(), twistTub_log,
false, 2,
false );
1951 std::ostringstream osnameFieldWire5Phys;
1952 osnameFieldWire5Phys <<
"physicalStereoLayer" << i <<
"FieldWire5";
1954 eastX = ( outR - shiftR /
cos( innerTwistAngle ) ) *
cos( innerTwistAngle );
1955 eastY = ( outR - shiftR /
cos( innerTwistAngle ) ) *
sin( -innerTwistAngle );
1956 westX = ( outR - shiftR /
cos( innerTwistAngle ) ) *
cos( innerTwistAngle );
1957 westY = ( outR - shiftR /
cos( innerTwistAngle ) ) *
sin( innerTwistAngle );
1959 G4ThreeVector east5( eastX, eastY, innerLength );
1960 G4ThreeVector west5( westX, westY, -innerLength );
1962 posX = ( east5.x() + west5.x() ) / 2.;
1963 posY = ( east5.y() + west5.y() ) / 2.;
1964 G4ThreeVector line5 = east5 - west5;
1965 G4RotationMatrix* wireRot5 =
new G4RotationMatrix();
1966 wireRot5->rotateZ( -line5.phi() );
1967 wireRot5->rotateY( -line5.theta() );
1968 G4VPhysicalVolume* fieldWire5_phys;
1970 new G4PVPlacement( wireRot5, G4ThreeVector( posX, posY, 0 ), fieldWire_log,
1971 osnameFieldWire5Phys.str(), twistTub_log,
false, 5,
false );
1975 for ( j = replicaNo - 1; j > -1; j-- )
1977 G4RotationMatrix* cellRot =
new G4RotationMatrix();
1978 cellRot->rotateZ( -spanAngle * j );
1980 std::ostringstream osnameCellPhys;
1981 osnameCellPhys <<
"physical"
1982 <<
"MdcStereoLayer" << i <<
"Cell" << j;
1983 G4VPhysicalVolume* twistTub_phys;
1985 new G4PVPlacement( cellRot, G4ThreeVector( 0, 0, 0 ), twistTub_log,
1986 osnameCellPhys.str(), stereoLayer_log,
false, j,
false );