14#include "G4Material.hh"
18#include "G4LogicalVolume.hh"
19#include "G4PVPlacement.hh"
20#include "G4PVReplica.hh"
21#include "G4TwistedTubs.hh"
22#include "G4SDManager.hh"
24#include "G4UserLimits.hh"
26#include "G4VisAttributes.hh"
35 : mdc_log(0),mdc_phys(0){
48 G4SDManager* SDman = G4SDManager::GetSDMpointer();
49 G4String mdcSDname =
"BesMdcSD";
50 aTrackerSD =
new BesMdcSD( mdcSDname);
51 SDman->AddNewDetector( aTrackerSD );
55 G4LogicalVolume *logicalMdc = 0;
56 G4LogicalVolume *lv = 0;
62 G4cout<<
"BesMdcConstruction::Construct(), logicalMdc not found"<<G4endl;
65 mdc_phys =
new G4PVPlacement(0,G4ThreeVector(0,0,0),
66 logicalMdc,
"physicalMdc",logicBes,
false, 0);
67 logicalMdc->SetVisAttributes(G4VisAttributes::Invisible);
70 G4VisAttributes* visAttStereoLayer =
new G4VisAttributes(G4Colour(0.,1.,0.));
71 G4VisAttributes* visAttAxialLayer =
new G4VisAttributes(G4Colour(1.,0.,0.));
73 G4double colorShift = 0., shift = 1.0 / (segmentNo-1);
75 for (
int i = 1; i < segmentNo; i++) {
76 std::ostringstream osnameSegment;
77 osnameSegment <<
"logical" <<
"Mdc" <<
"Segment" << i;
78 lv = (G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameSegment.str() );
79 G4VisAttributes* visAttSegment =
new G4VisAttributes(G4Colour(1.0-colorShift, 0.0+colorShift, 0.0));
80 if(i<3) visAttSegment->SetForceWireframe(
true);
82 lv->SetVisAttributes(visAttSegment);
85 else G4cout <<
"logical volume " << osnameSegment.str() <<
"not found " << G4endl;
89 for (
int i = 0; i < 8; i++) {
90 std::ostringstream osnameStereoLayer;
91 osnameStereoLayer <<
"logical" <<
"Mdc" <<
"StereoLayer" << i;
92 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameStereoLayer.str() );
94 lv->SetVisAttributes(visAttStereoLayer);
95 lv->SetVisAttributes(G4VisAttributes::Invisible);
97 else G4cout <<
"logical volume " << osnameStereoLayer.str() <<
"not found " << G4endl;
99 std::ostringstream osnameTwistedTubs;
100 osnameTwistedTubs <<
"logical" <<
"Mdc" <<
"StereoLayer" << i <<
"Cell";
101 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameTwistedTubs.str() );
103 lv->SetSensitiveDetector( aTrackerSD );
104 lv->SetVisAttributes(G4VisAttributes::Invisible);
106 else G4cout <<
"logical volume " << osnameTwistedTubs.str() <<
"not found " << G4endl;
109 for (
int i = 20; i < 36; i++) {
110 std::ostringstream osnameStereoLayer;
111 osnameStereoLayer <<
"logical" <<
"Mdc" <<
"StereoLayer" << i;
112 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameStereoLayer.str() );
114 lv->SetVisAttributes(visAttStereoLayer);
115 lv->SetVisAttributes(G4VisAttributes::Invisible);
117 else G4cout <<
"logical volume " << osnameStereoLayer.str() <<
"not found " << G4endl;
119 std::ostringstream osnameTwistedTubs;
120 osnameTwistedTubs <<
"logical" <<
"Mdc" <<
"StereoLayer" << i <<
"Cell";
121 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameTwistedTubs.str() );
123 lv->SetSensitiveDetector( aTrackerSD );
124 lv->SetVisAttributes(G4VisAttributes::Invisible);
126 else G4cout <<
"logical volume " << osnameTwistedTubs.str() <<
"not found " << G4endl;
129 for (
int i = 8; i < 20; i++) {
130 std::ostringstream osnameAxialLayer;
131 osnameAxialLayer <<
"logical" <<
"Mdc" <<
"AxialLayer" << i;
132 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameAxialLayer.str() );
134 lv->SetVisAttributes(visAttAxialLayer);
135 lv->SetVisAttributes(G4VisAttributes::Invisible);
137 else G4cout <<
"logical volume " << osnameAxialLayer.str() <<
"not found " << G4endl;
139 std::ostringstream osnameReplica;
140 osnameReplica <<
"logical" <<
"Mdc" <<
"AxialLayer" << i <<
"Cell";
141 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameReplica.str() );
143 lv->SetSensitiveDetector( aTrackerSD );
144 lv->SetVisAttributes(G4VisAttributes::Invisible);
146 else G4cout <<
"logical volume " << osnameReplica.str() <<
"not found " << G4endl;
149 for (
int i = 36; i < 43; i++) {
150 for (
int n = 0;
n < 2;
n++) {
151 std::ostringstream osnameAxialLayer;
152 osnameAxialLayer <<
"logical" <<
"Mdc" <<
"AxialLayer" << i <<
"_" <<
n;
153 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameAxialLayer.str() );
155 lv->SetVisAttributes(visAttAxialLayer);
156 lv->SetVisAttributes(G4VisAttributes::Invisible);
158 else G4cout <<
"logical volume " << osnameAxialLayer.str() <<
"not found " << G4endl;
160 std::ostringstream osnameReplica;
161 osnameReplica <<
"logical" <<
"Mdc" <<
"AxialLayer" << i <<
"_" <<
n <<
"Cell";
162 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameReplica.str() );
164 lv->SetSensitiveDetector( aTrackerSD );
165 lv->SetVisAttributes(G4VisAttributes::Invisible);
167 else G4cout <<
"logical volume " << osnameReplica.str() <<
"not found " << G4endl;
179 G4Material* MdcGas = G4Material::GetMaterial(
"Mdcgas");
180 G4Material*
Al = G4Material::GetMaterial(
"Aluminium");
181 G4Element *
C =G4Element::GetElement(
"Carbon");
182 G4Element *
H =G4Element::GetElement(
"Hydrogen");
183 G4Element *O =G4Element::GetElement(
"Oxygen");
185 G4double density = 19.3*g/cm3;
186 G4double a = 183.84*g/mole;
187 G4Material* W =
new G4Material(
"Tungsten", 74., a, density);
191 G4Material* Au=
new G4Material(
"Au",79,a,density);
195 G4Material* CarbonFiber=
new G4Material(
"CarbonFiber",density,nElement);
196 CarbonFiber->AddElement(
C,0.697);
197 CarbonFiber->AddElement(
H,0.0061);
198 CarbonFiber->AddElement(O,0.2969);
200 density = 1.42*g/cm3;
201 G4Material* Kapton =
new G4Material(
"Kapton", density, 3);
202 Kapton->AddElement(O,2);
203 Kapton->AddElement(
C,5);
204 Kapton->AddElement(
H,4);
208 G4double outR, innerR, length;
209 G4double startAngle, spanAngle;
210 G4double posX, posY, posZ;
211 G4VisAttributes* visAtt;
220 G4cout << mdc->
Segment(0).
Name() <<
" innerR: " << innerR <<
" , outR: " << outR <<
" , length: "<<setprecision(8)<<
length << endl;
228 G4Tubs* mdc_tube=
new G4Tubs(
"solidMdc",innerR,outR,
length,startAngle,spanAngle);
229 mdc_log=
new G4LogicalVolume(mdc_tube, MdcGas,
"logicalMdc",0,0,0);
230 mdc_log->SetVisAttributes(G4VisAttributes::Invisible);
236 mdc_phys=
new G4PVPlacement(0,
237 G4ThreeVector(posX ,posY ,posZ),
238 mdc_log,
"physicalMdc",logicBes,
false,0);
243 G4double colorShift=0., shift=1./(mdc->
SegmentNo()-1);
244 G4double gap=0.5*micrometer;
256 std::ostringstream osnameSolid;
257 osnameSolid <<
"solid"<<name<<i;
258 G4Tubs* segment_tube=
new G4Tubs(osnameSolid.str(),innerR,outR,
length,startAngle,spanAngle);
259 std::ostringstream osnameLogical;
260 osnameLogical <<
"logical"<<name<<i;
261 G4LogicalVolume* segment_log;
263 segment_log=
new G4LogicalVolume(segment_tube, CarbonFiber,osnameLogical.str(),0,0,0);
265 segment_log=
new G4LogicalVolume(segment_tube,
Al,osnameLogical.str(),0,0,0);
268 visAtt=
new G4VisAttributes(G4Colour(1.0-colorShift,0.0+colorShift,0.0));
269 if(i<3)visAtt->SetForceWireframe(
true);
270 segment_log->SetVisAttributes(visAtt);
274 G4VPhysicalVolume* segment_phys;
275 std::ostringstream osnamePhys1;
276 osnamePhys1 <<
"physical"<<name<<i<<
"p";
277 segment_phys=
new G4PVPlacement(0,
278 G4ThreeVector(posX ,posY ,posZ),
279 segment_log,osnamePhys1.str(),mdc_log,
false,0);
282 std::ostringstream osnamePhys2;
283 osnamePhys2 <<
"physical"<<name<<i<<
"m";
284 segment_phys=
new G4PVPlacement(0,
285 G4ThreeVector(posX ,posY ,-posZ),
286 segment_log,osnamePhys2.str(),mdc_log,
false,0);
333 G4Tubs* segment_tube3=
new G4Tubs(
"SolidMdcOutFilm0",innerR,outR,
length,startAngle,spanAngle);
334 G4LogicalVolume* segment_log3;
335 segment_log3=
new G4LogicalVolume(segment_tube3,
Al,
"LogicalMdcOutFilm0",0,0,0);
336 G4VisAttributes* visAtt3=
new G4VisAttributes(G4Colour(0,1.0,0.0));
337 segment_log3->SetVisAttributes(visAtt3);
338 G4VPhysicalVolume* segment_phys3;
339 segment_phys3=
new G4PVPlacement(0,
340 G4ThreeVector(posX ,posY ,posZ),
341 segment_log3,
"PhysicalMdcOutFilm0",mdc_log,
false,0);
349 G4Tubs* segment_tube4=
new G4Tubs(
"SolidMdcOutFilm1",innerR,outR,
length,startAngle,spanAngle);
350 G4LogicalVolume* segment_log4;
351 segment_log4=
new G4LogicalVolume(segment_tube4,
Al,
"LogicalMdcOutFilm1",0,0,0);
352 G4VisAttributes* visAtt4=
new G4VisAttributes(G4Colour(0,0.0,1.0));
353 segment_log4->SetVisAttributes(visAtt4);
354 G4VPhysicalVolume* segment_phys4;
355 segment_phys4=
new G4PVPlacement(0,
356 G4ThreeVector(posX ,posY ,posZ),
357 segment_log4,
"PhysicalMdcOutFilm1",mdc_log,
false,0);
360 innerR=mdc->
Segment(1).
OutR()*mm+100*micrometer+gap;
365 G4Tubs* segment_tube5=
new G4Tubs(
"SolidMdcOutFilm2",innerR,outR,
length,startAngle,spanAngle);
366 G4LogicalVolume* segment_log5;
367 segment_log5=
new G4LogicalVolume(segment_tube5, Kapton,
"LogicalMdcOutFilm2",0,0,0);
368 G4VisAttributes* visAtt5=
new G4VisAttributes(G4Colour(0,0.5,0.5));
369 segment_log5->SetVisAttributes(visAtt5);
370 G4VPhysicalVolume* segment_phys5;
371 segment_phys5=
new G4PVPlacement(0,
372 G4ThreeVector(posX ,posY ,posZ),
373 segment_log5,
"PhysicalMdcOutFilm2",mdc_log,
false,0);
380 G4Tubs*fixTub=
new G4Tubs(
"solidFixTub",elecGeomPointer->
FixRing(0)*mm,elecGeomPointer->
FixRing(1)*mm,elecGeomPointer->
FixRing(2)/2.*mm,0.*deg,360.*deg);
381 G4LogicalVolume*fixTub_log=
new G4LogicalVolume(fixTub,
Al,
"logicalFixTub");
382 G4VPhysicalVolume*fixTub_phys1=
new G4PVPlacement(0,G4ThreeVector(0,0,1134.5*mm),fixTub_log,
"physcalFixTub1",mdc_log,
false,0);
383 G4VPhysicalVolume*fixTub_phys2=
new G4PVPlacement(0,G4ThreeVector(0,0,-1134.5*mm),fixTub_log,
"physicalFixTub2",mdc_log,
false,0);
386 G4Element *Cu=G4Element::GetElement(
"Copper");
387 G4Element *Si=G4Element::GetElement(
"Silicon");
390 G4double boxDensityEndcape=1.9745*g/cm3;
391 G4int boxNcomponenEndcape=6;
392 G4Material *Cuu = G4Material::GetMaterial(
"Copper");
397 G4Element *Cl =
new G4Element(
"Chlorine",
"Cl",17.,35.5*g/mole);
398 G4Material*synEndcape=
new G4Material(
"M_synthesis",boxDensityEndcape,boxNcomponenEndcape);
399 synEndcape->AddElement(Cu,0.50);
400 synEndcape->AddElement(
C,0.134);
401 synEndcape->AddElement(
H,0.033);
402 synEndcape->AddElement(Si,0.11);
403 synEndcape->AddElement(Cl,0.014);
404 synEndcape->AddElement(O,0.209);
406 G4Box*boxEndcape=
new G4Box(
"solidboxEndcape",elecGeomPointer->
BoxEndcape(0)/2.*mm,elecGeomPointer->
BoxEndcape(1)/2.*mm,elecGeomPointer->
BoxEndcape(2)/2.*mm);
407 G4LogicalVolume*boxEndcape_log=
new G4LogicalVolume(boxEndcape,synEndcape,
"logical boxEndcape");
408 visAtt=
new G4VisAttributes(G4Colour(0.0,1.0,0.0));
409 boxEndcape_log->SetVisAttributes(visAtt);
412 double boxCuEndDx=8.5*mm;
413 double boxCuEndDy=12.*mm;
414 double boxCuEndDz=29.*mm;
416 G4Box* boxCuEnd=
new G4Box(
"solidboxCuEnd",boxCuEndDx/2.,boxCuEndDy/2.,boxCuEndDz/2.);
417 G4LogicalVolume*boxCuEnd_log=
new G4LogicalVolume(boxCuEnd,Cuu,
"logical boxCuEnd");
418 visAtt=
new G4VisAttributes(G4Colour(1.0,1.0,0.0));
419 boxCuEnd_log->SetVisAttributes(visAtt);
421 double dxVirtualBox=18.*mm;
422 double dyVirtualBox=106.*mm;
423 double dzVirtualBox=53.*mm;
424 G4Box*virtualBoxForEndcape=
new G4Box(
"solid virtualBoxEndcape",dxVirtualBox/2.,dyVirtualBox/2.*mm,dzVirtualBox/2.*mm);
425 G4LogicalVolume*virtualBoxForEndcape_log=
new G4LogicalVolume(virtualBoxForEndcape,G4Material::GetMaterial(
"Air"),
"logical virtualBoxEndcape");
427 virtualBoxForEndcape_log->SetVisAttributes(visAtt);
428 G4VPhysicalVolume*boxEndcape_phys=
new G4PVPlacement(0,G4ThreeVector(elecGeomPointer->
BoxEndcape(0)/2.,0,0),boxEndcape_log,
"physical boxEndcape",virtualBoxForEndcape_log,
false,0);
429 G4VPhysicalVolume*boxCuEnd_physFront=
new G4PVPlacement(0,G4ThreeVector(-boxCuEndDx*0.5-0.1*mm,elecGeomPointer->
BoxEndcape(1)/2.-boxCuEndDy/2,0),boxCuEnd_log,
"physical boxCuEnd",virtualBoxForEndcape_log,
false,0);
430 G4VPhysicalVolume*boxCuEnd_physBehind=
new G4PVPlacement(0,G4ThreeVector(-boxCuEndDx*0.5-0.1*mm,-(elecGeomPointer->
BoxEndcape(1)/2.-boxCuEndDy/2),0),boxCuEnd_log,
"physical boxCuEnd",virtualBoxForEndcape_log,
false,0);
431 const double pi=3.141593;
435 double startAngleArray;
439 startAngleArray=acos(elecGeomPointer->
X(i)/elecGeomPointer->
R(i));
441 for(
int j=0;j<elecGeomPointer->
ElecNo(i);j++)
443 G4RotationMatrix*boxRotj=
new G4RotationMatrix;
444 boxRotj->rotateZ(-startAngleArray-j*2*
pi/elecGeomPointer->
ElecNo(i));
445 posXArray=elecGeomPointer->
R(i)*
cos((startAngleArray+j*2*
pi/elecGeomPointer->
ElecNo(i)));
446 posYArray=elecGeomPointer->
R(i)*
sin((startAngleArray+j*2*
pi/elecGeomPointer->
ElecNo(i)));
447 posZArray=elecGeomPointer->
Z(i);
448 std::ostringstream osnamephys;
449 osnamephys<<
"physicalLayer"<<i<<
"Ebox"<<j;
450 G4VPhysicalVolume*box_phys=
new G4PVPlacement(boxRotj,G4ThreeVector(posXArray,posYArray,posZArray),virtualBoxForEndcape_log,osnamephys.str(),mdc_log,
false,j);
456 G4double mCableDensity=6.4*g/cm3;
457 G4Material*materialCable=
new G4Material(
"M_materialCable",mCableDensity,3);
458 materialCable->AddElement(Cu,0.4);
459 materialCable->AddElement(
C,0.3);
460 materialCable->AddElement(
H,0.3);
462 double gapR=0.1*micrometer;
465 double innerRCableTub;
466 double outerRCableTub;
467 for(
int i=0;i<11;i++)
469 innerRCableTub=elecGeomPointer->
R(i)*mm-dxVirtualBox/2.+gapR;
470 outerRCableTub=elecGeomPointer->
R(i+1)*mm-dxVirtualBox/2.-gapR;
471 std::ostringstream osnameCableSolid;
472 osnameCableSolid<<
"MdcCableSolidWest"<<i;
473 G4Tubs*cableTub=
new G4Tubs(osnameCableSolid.str(),innerRCableTub,outerRCableTub,elecGeomPointer->
LengthCableTub(i+1)*1.15/2*mm,0*deg,360*deg);
475 std::ostringstream osnameCableLog;
476 osnameCableLog<<
"MdcCableLogWest"<<i;
477 G4LogicalVolume*cableTub_log=
new G4LogicalVolume(cableTub,materialCable,osnameCableLog.str());
478 visAtt=
new G4VisAttributes(G4Colour(1,0.3,0.5));
479 cableTub_log->SetVisAttributes(visAtt);
481 std::ostringstream osnameCablePhys;
482 osnameCablePhys<<
"MdcCablePhysWest"<<i;
483 G4VPhysicalVolume*cableTub_phys=
new G4PVPlacement(0,G4ThreeVector(0,0,elecGeomPointer->
Z(i)*mm-dzVirtualBox/2.*mm-(elecGeomPointer->
LengthCableTub(i+1))*1.15/2.*mm-0.2*mm),cableTub_log,osnameCablePhys.str(),mdc_log,
false,0);
487 for(
int i=0;i<10;i++)
489 innerRCableTub=elecGeomPointer->
R(i+12)-dxVirtualBox/2.+gapR;
490 outerRCableTub=elecGeomPointer->
R(i+12+1)-dxVirtualBox/2.-gapR;
491 std::ostringstream osnameCableSolid;
492 osnameCableSolid<<
"MdcCableSolidEast"<<i;
493 G4Tubs*cableTub=
new G4Tubs(osnameCableSolid.str(),innerRCableTub,outerRCableTub,elecGeomPointer->
LengthCableTub(i+14)*1.15/2*mm,0*deg,360*deg);
495 std::ostringstream osnameCableLog;
496 osnameCableLog<<
"MdcCableLogEast"<<i;
497 G4LogicalVolume*cableTub_log=
new G4LogicalVolume(cableTub,materialCable,osnameCableLog.str());
498 visAtt=
new G4VisAttributes(G4Colour(1,0.3,0.5));
499 cableTub_log->SetVisAttributes(visAtt);
501 std::ostringstream osnameCablePhys;
502 osnameCablePhys<<
"MdcCablePhysEast"<<i;
503 G4VPhysicalVolume*cableTub_phys=
new G4PVPlacement(0,G4ThreeVector(0,0,elecGeomPointer->
Z(i+12)*mm+dzVirtualBox/2.*mm+(elecGeomPointer->
LengthCableTub(i+14))*1.15/2.*mm+0.2*mm),cableTub_log,osnameCablePhys.str(),mdc_log,
false,0);
509 G4Tubs*cableTubBeginnerW=
new G4Tubs(
"solid cableTubBeginnerW",mdc->
Segment(30).
InnerR()*mm+gapR,elecGeomPointer->
R(0)*mm-dxVirtualBox/2.-gapR,elecGeomPointer->
LengthCableTub(0)*1.15/2.*mm,0*deg,360*deg);
510 G4LogicalVolume*cableTubBeginnerW_log=
new G4LogicalVolume(cableTubBeginnerW,materialCable,
"logical cableTubBeginnerW");
511 visAtt=
new G4VisAttributes(G4Colour(0,0.3,0.8));
512 cableTubBeginnerW_log->SetVisAttributes(visAtt);
513 G4VPhysicalVolume*cableTubBeginnerW_phys=
new G4PVPlacement(0,G4ThreeVector(0,0,elecGeomPointer->
Z(0)*mm-dzVirtualBox/2.*mm-(elecGeomPointer->
LengthCableTub(0))*1.15/2.*mm-0.2*mm),cableTubBeginnerW_log,
"physical cableTubBeginnerW",mdc_log,
false,0);
515 G4Tubs*cableTubBeginnerE=
new G4Tubs(
"solid cableBeginnerE",mdc->
Segment(30).
InnerR()*mm+gapR,elecGeomPointer->
R(12)*mm-dxVirtualBox/2.-gapR,elecGeomPointer->
LengthCableTub(13)*1.15/2.*mm,0*deg,360*deg);
516 G4LogicalVolume*cableTubBeginnerE_log=
new G4LogicalVolume(cableTubBeginnerE,materialCable,
"logical cabieTubBeginnerE");
517 visAtt=
new G4VisAttributes(G4Colour(1,0.3,0.5));
518 cableTubBeginnerE_log->SetVisAttributes(visAtt);
520 G4VPhysicalVolume*cableTubBeginnerE_phys=
new G4PVPlacement(0,G4ThreeVector(0,0,elecGeomPointer->
Z(13)*mm+dzVirtualBox/2.*mm+(elecGeomPointer->
LengthCableTub(13))*1.15/2.*mm+0.2*mm),cableTubBeginnerE_log,
"physical cableTubBeginnerE",mdc_log,
false,0);
525 G4Tubs*cableTubToTailW=
new G4Tubs(
"solid cabletubToTailW",elecGeomPointer->
R(11)*mm+gapR,mdc->
Segment(6).
InnerR()*mm-gapR,elecGeomPointer->
LengthCableTub(12)*1.15/2.*mm,0*deg,360*deg);
526 G4LogicalVolume*cableTubToTailW_log=
new G4LogicalVolume(cableTubToTailW,materialCable,
"logical cableTubToTailW");
527 visAtt=
new G4VisAttributes(G4Colour(0,0.3,0.8));
528 cableTubToTailW_log->SetVisAttributes(visAtt);
530 G4VPhysicalVolume*cableTubToTailW_phys=
new G4PVPlacement(0,G4ThreeVector(0,0,elecGeomPointer->
Z(11)*mm-dzVirtualBox/2.*mm-(elecGeomPointer->
LengthCableTub(12))*1.15/2.*mm-0.2*mm),cableTubToTailW_log,
"physical cableTubToTailW",mdc_log,
false,0);
532 G4Tubs*cableTubToTailE=
new G4Tubs(
"solid cabletubToTailE",elecGeomPointer->
R(22)*mm-dxVirtualBox/2.+gapR,mdc->
Segment(6).
InnerR()*mm-gapR,elecGeomPointer->
LengthCableTub(24)*1.15/2.*mm,0*deg,360*deg);
534 G4LogicalVolume*cableTubToTailE_log=
new G4LogicalVolume(cableTubToTailE,materialCable,
"logical cabieTubToTailE");
535 visAtt=
new G4VisAttributes(G4Colour(1.0,0.3,0.5));
536 cableTubToTailE_log->SetVisAttributes(visAtt);
538 G4VPhysicalVolume*cableTubToTailE_phys=
new G4PVPlacement(0,G4ThreeVector(0,0,elecGeomPointer->
Z(22)*mm+dzVirtualBox/2.*mm+(elecGeomPointer->
LengthCableTub(24))*1.15/2.*mm+0.2*mm),cableTubToTailE_log,
"physical cableTubToTailE",mdc_log,
false,0);
542 G4Box* box0=
new G4Box(
"box0",10.,15.,3.);
543 G4LogicalVolume* box0_log=
new G4LogicalVolume(box0,
Al,
"logicalBox0",0,0,0);
544 visAtt=
new G4VisAttributes(G4Colour(1.0,0.8,0.0));
545 box0_log->SetVisAttributes(visAtt);
547 G4Box* box1=
new G4Box(
"box1",3.*
cos(11.28*deg),15.,81./
sin(11.28*deg)/2.);
548 G4LogicalVolume* box1_log=
new G4LogicalVolume(box1,
Al,
"logicalBox1",0,0,0);
549 box1_log->SetVisAttributes(visAtt);
551 G4Box* box2=
new G4Box(
"box2",63.5,15.,3.);
552 G4LogicalVolume* box2_log=
new G4LogicalVolume(box2,
Al,
"logicalBox2",0,0,0);
553 box2_log->SetVisAttributes(visAtt);
557 G4RotationMatrix* boxRot0=
new G4RotationMatrix();
558 boxRot0->rotateZ(-45*i*deg);
559 posX=784.*
cos(45*i*deg);
560 posY=784.*
sin(45*i*deg);
562 std::ostringstream osnameBox0PhysEast;
563 osnameBox0PhysEast<<
"physical"<<
"box0p"<<i;
564 G4VPhysicalVolume* box0p_phys=
new G4PVPlacement(boxRot0,G4ThreeVector(posX ,posY ,posZ),
565 box0_log,osnameBox0PhysEast.str(),mdc_log,
false,i);
567 std::ostringstream osnameBox0PhysWest;
568 osnameBox0PhysWest<<
"physical"<<
"box0m"<<i;
569 G4VPhysicalVolume* box0m_phys=
new G4PVPlacement(boxRot0,G4ThreeVector(posX ,posY ,-posZ),
570 box0_log,osnameBox0PhysWest.str(),mdc_log,
false,i);
573 G4RotationMatrix* boxRot1p=
new G4RotationMatrix();
574 boxRot1p->rotateZ(-45*i*deg);
575 boxRot1p->rotateY(-78.72*deg);
576 posX=570.5*
cos(45*i*deg);
577 posY=570.5*
sin(45*i*deg);
579 std::ostringstream osnameBox1PhysEast;
580 osnameBox1PhysEast<<
"physical"<<
"box1p"<<i;
581 G4VPhysicalVolume* box1p_phys=
new G4PVPlacement(boxRot1p,G4ThreeVector(posX ,posY ,posZ),
582 box1_log,osnameBox1PhysEast.str(),mdc_log,
false,i);
584 G4RotationMatrix* boxRot1m=
new G4RotationMatrix();
585 boxRot1m->rotateZ(-45*i*deg);
586 boxRot1m->rotateY(78.72*deg);
587 std::ostringstream osnameBox1PhysWest;
588 osnameBox1PhysWest<<
"physical"<<
"box1m"<<i;
589 G4VPhysicalVolume* box1m_phys=
new G4PVPlacement(boxRot1m,G4ThreeVector(posX ,posY ,-posZ),
590 box1_log,osnameBox1PhysWest.str(),mdc_log,
false,i);
592 G4RotationMatrix* boxRot2=
new G4RotationMatrix();
593 boxRot2->rotateZ(-45*i*deg);
594 posX=303.5*
cos(45*i*deg);
595 posY=303.5*
sin(45*i*deg);
597 std::ostringstream osnameBox2PhysEast;
598 osnameBox2PhysEast<<
"physical"<<
"box2p"<<i;
599 G4VPhysicalVolume* box2p_phys=
new G4PVPlacement(boxRot2,G4ThreeVector(posX ,posY ,posZ),
600 box2_log,osnameBox2PhysEast.str(),mdc_log,
false,i);
602 std::ostringstream osnameBox2PhysWest;
603 osnameBox2PhysWest<<
"physical"<<
"box2m"<<i;
604 G4VPhysicalVolume* box2m_phys=
new G4PVPlacement(boxRot2,G4ThreeVector(posX ,posY ,-posZ),
605 box2_log,osnameBox2PhysWest.str(),mdc_log,
false,i);
609 G4double rMax2=774.*mm;
610 G4double rMin2=rMax2 - 1.*mm/
sin(11.28*deg);
611 G4double rMin1=rMin2 - 80.*mm/
tan(11.28*deg);
612 G4double rMax1=rMin1 + 1.*mm/
sin(11.28*deg);
613 G4Cons* shieldPlate0p=
new G4Cons(
"shieldPlate0p",rMin1,rMax1,rMin2,rMax2,40.*mm,0.,360.*deg);
614 G4LogicalVolume* shieldPlate0p_log=
new G4LogicalVolume(shieldPlate0p,
Al,
"logicalShieldPlate0p",0,0,0);
615 visAtt=
new G4VisAttributes(G4Colour(0.0,0.0,1.0));
616 shieldPlate0p_log->SetVisAttributes(visAtt);
620 G4VPhysicalVolume* shieldPlate0p_phys=
new G4PVPlacement(0,G4ThreeVector(posX ,posY ,posZ),
621 shieldPlate0p_log,
"physicalShieldPalte0p",mdc_log,
false,0);
623 G4Cons* shieldPlate0m=
new G4Cons(
"shieldPlate0m",rMin2,rMax2,rMin1,rMax1,40.*mm,0.,360.*deg);
624 G4LogicalVolume* shieldPlate0m_log=
new G4LogicalVolume(shieldPlate0m,
Al,
"logicalShieldPlate0m",0,0,0);
625 visAtt=
new G4VisAttributes(G4Colour(0.0,0.0,1.0));
626 shieldPlate0m_log->SetVisAttributes(visAtt);
630 G4VPhysicalVolume* shieldPlate0m_phys=
new G4PVPlacement(0,G4ThreeVector(posX ,posY ,-posZ),
631 shieldPlate0m_log,
"physicalShieldPalte0m",mdc_log,
false,0);
634 G4Tubs* shieldPlate1=
new G4Tubs(
"shieldPlate1",240.*mm,367.*mm,0.5*mm,0.,360.*deg);
635 G4LogicalVolume* shieldPlate1_log=
new G4LogicalVolume(shieldPlate1,
Al,
"logicalShieldPlate1",0,0,0);
636 visAtt=
new G4VisAttributes(G4Colour(1.0,0.0,0.0));
637 shieldPlate1_log->SetVisAttributes(visAtt);
641 G4VPhysicalVolume* shieldPlate1p_phys=
new G4PVPlacement(0,G4ThreeVector(posX ,posY ,posZ),
642 shieldPlate1_log,
"physicalShieldPalte1p",mdc_log,
false,0);
643 G4VPhysicalVolume* shieldPlate1m_phys=
new G4PVPlacement(0,G4ThreeVector(posX ,posY ,-posZ),
644 shieldPlate1_log,
"physicalShieldPalte1m",mdc_log,
false,0);
647 G4int signalLayer,firstWire;
651 G4double signalWireR=mdc->
SignalWireR()*micrometer;
652 G4double fieldWireR=mdc->
FieldWireR()*micrometer;
653 G4double thickOfAu=0.7*micrometer;
655 G4double innerLength,innerTwistAngle,innerTan,midInnerR,innerStereo;
656 G4double outLength,outTwistAngle,outTwistAngleFixed,outTan,midOutR,outStereo,outRFixed,outTanFixed;
659 for(i=42; i>35; i--){
663 innerR=mdc->
Layer(signalLayer-1+
n).
R()*mm-fieldWireR;
664 outR=mdc->
Layer(signalLayer+
n).
R()*mm-fieldWireR;
665 if(i==42&&
n==1)outR=mdc->
Layer(signalLayer+
n).
R()*mm+fieldWireR;
674 std::ostringstream osnameLayerSolid;
675 osnameLayerSolid <<
"solid"<<
"MdcAxialLayer"<<i<<
"_"<<
n;
676 G4Tubs* axialLayer_tube=
new G4Tubs(osnameLayerSolid.str(),innerR,outR,
length,startAngle,spanAngle);
678 std::ostringstream osnameLayerLogical;
679 osnameLayerLogical <<
"logical"<<
"MdcAxialLayer"<<i<<
"_"<<
n;
680 G4LogicalVolume* axialLayer_log=
new G4LogicalVolume(axialLayer_tube, MdcGas,osnameLayerLogical.str(),0,0,0);
682 axialLayer_log->SetVisAttributes(G4VisAttributes::Invisible);
685 spanAngle=360./replicaNo*deg;
687 offset=mdc->
Layer(signalLayer).
Phi()*
rad-firstWire*spanAngle/2.;
688 G4RotationMatrix* layerRot=
new G4RotationMatrix();
689 layerRot->rotateZ(-offset);
691 std::ostringstream osnameLayerPhys;
692 osnameLayerPhys <<
"physical"<<
"MdcAxialLayer"<<i<<
"_"<<
n;
693 G4VPhysicalVolume* axialLayer_phys;
694 axialLayer_phys=
new G4PVPlacement(layerRot,
696 axialLayer_log,osnameLayerPhys.str(),mdc_log,
false,i);
699 std::ostringstream osnameCellSolid;
700 osnameCellSolid<<
"solid"<<
"MdcAxialLayer"<<i<<
"_"<<
n<<
"Cell";
701 G4Tubs* replica_tube=
new G4Tubs(osnameCellSolid.str(),innerR,outR,
length,startAngle,spanAngle);
703 std::ostringstream osnameCellLogical;
704 osnameCellLogical<<
"logical"<<
"MdcAxialLayer"<<i<<
"_"<<
n<<
"Cell";
705 G4LogicalVolume* replica_log=
new G4LogicalVolume(replica_tube,MdcGas,osnameCellLogical.str(),0,0,0);
707 replica_log->SetSensitiveDetector( aTrackerSD );
708 visAtt=
new G4VisAttributes(G4Colour(0.0,0.0,1.0));
709 replica_log->SetVisAttributes(visAtt);
710 replica_log->SetVisAttributes(G4VisAttributes::Invisible);
714 std::ostringstream osnameFieldWireSolid;
715 osnameFieldWireSolid<<
"solid"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWire";
716 G4Tubs* fieldWire_tube=
new G4Tubs(osnameFieldWireSolid.str(),0.,fieldWireR,
length,0.,360*deg);
717 std::ostringstream osnameFieldWireLogical;
718 osnameFieldWireLogical<<
"logical"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWire";
719 G4LogicalVolume* fieldWire_log=
new G4LogicalVolume(fieldWire_tube,Au,osnameFieldWireLogical.str(),0,0,0);
721 std::ostringstream osnameFieldWireSubSolid;
722 osnameFieldWireSubSolid<<
"solid"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWireSub";
723 G4Tubs* fieldWireSub_tube=
new G4Tubs(osnameFieldWireSubSolid.str(),0.,fieldWireR-thickOfAu,
length,0.,360*deg);
724 std::ostringstream osnameFieldWireSubLogical;
725 osnameFieldWireSubLogical<<
"logical"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWireSub";
726 G4LogicalVolume* fieldWireSub_log=
new G4LogicalVolume(fieldWireSub_tube,
Al,osnameFieldWireSubLogical.str(),0,0,0);
727 std::ostringstream osnameFieldWireSubPhys;
728 osnameFieldWireSubPhys<<
"physical"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWireSub";
729 G4VPhysicalVolume* fieldWireSub_phys;
730 fieldWireSub_phys=
new G4PVPlacement(0,0,fieldWireSub_log,
731 osnameFieldWireSubPhys.str(),fieldWire_log,
false,0);
733 std::ostringstream osnameFieldWireHalfSolid;
734 osnameFieldWireHalfSolid<<
"solid"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWireHalf";
735 G4Tubs* fieldWireHalf_tube=
new G4Tubs(osnameFieldWireHalfSolid.str(),0.,fieldWireR,
length,0.,180*deg);
736 std::ostringstream osnameFieldWireHalfLogical;
737 osnameFieldWireHalfLogical<<
"logical"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWireHalf";
738 G4LogicalVolume* fieldWireHalf_log=
new G4LogicalVolume(fieldWireHalf_tube,Au,osnameFieldWireHalfLogical.str(),0,0,0);
740 std::ostringstream osnameFieldWireHalfSubSolid;
741 osnameFieldWireHalfSubSolid<<
"solid"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWireHalfSub";
742 G4Tubs* fieldWireHalfSub_tube=
new G4Tubs(osnameFieldWireHalfSubSolid.str(),0.,fieldWireR-thickOfAu,
length,0.,360*deg);
743 std::ostringstream osnameFieldWireHalfSubLogical;
744 osnameFieldWireHalfSubLogical<<
"logical"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWireHalfSub";
745 G4LogicalVolume* fieldWireHalfSub_log=
new G4LogicalVolume(fieldWireHalfSub_tube,
Al,osnameFieldWireHalfSubLogical.str(),0,0,0);
746 std::ostringstream osnameFieldWireHalfSubPhys;
747 osnameFieldWireHalfSubPhys<<
"physical"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWireHalfSub";
748 G4VPhysicalVolume* fieldWireHalfSub_phys;
749 fieldWireHalfSub_phys=
new G4PVPlacement(0,0,fieldWireHalfSub_log,
750 osnameFieldWireHalfSubPhys.str(),fieldWireHalf_log,
false,0);
761 std::ostringstream osnameFieldWire0Phys;
762 osnameFieldWire0Phys<<
"physicalAxialLayer"<<i<<
"_"<<
n<<
"FieldWire0";
763 posX=mdc->
Layer(signalLayer-1).
R()*mm;
764 G4VPhysicalVolume* fieldWire0_phys;
765 fieldWire0_phys=
new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log,
766 osnameFieldWire0Phys.str(),replica_log,
false,0);
768 std::ostringstream osnameFieldWire3Phys;
769 osnameFieldWire3Phys<<
"physicalAxialLayer"<<i<<
"_"<<
n<<
"FieldWire3";
770 posX=mdc->
Layer(signalLayer-1).
R()*mm*
cos(spanAngle/2.);
771 posY=mdc->
Layer(signalLayer-1).
R()*mm*
sin(spanAngle/2.);
772 G4VPhysicalVolume* fieldWire3_phys;
773 fieldWire3_phys=
new G4PVPlacement(0,G4ThreeVector(posX,posY,0),fieldWire_log,
774 osnameFieldWire3Phys.str(),replica_log,
false,3);
775 std::ostringstream osnameFieldWire6Phys;
776 osnameFieldWire6Phys<<
"physicalAxialLayer"<<i<<
"_"<<
n<<
"FieldWire6";
777 posX=mdc->
Layer(signalLayer-1).
R()*mm*
cos(spanAngle);
778 posY=mdc->
Layer(signalLayer-1).
R()*mm*
sin(spanAngle);
779 G4RotationMatrix* wireRot6=
new G4RotationMatrix();
780 wireRot6->rotateZ(180*deg-spanAngle);
781 G4VPhysicalVolume* fieldWire6_phys;
782 fieldWire6_phys=
new G4PVPlacement(wireRot6,G4ThreeVector(posX,posY,0),fieldWireHalf_log,
783 osnameFieldWire6Phys.str(),replica_log,
false,6);
787 std::ostringstream osnameFieldWire1Phys;
788 osnameFieldWire1Phys<<
"physicalAxialLayer"<<i<<
"_"<<
n<<
"FieldWire1";
789 posX=mdc->
Layer(signalLayer).
R()*mm;
790 G4VPhysicalVolume* fieldWire1_phys;
791 fieldWire1_phys=
new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log,
792 osnameFieldWire1Phys.str(),replica_log,
false,1);
793 std::ostringstream osnameSignalWireSolid;
794 osnameSignalWireSolid<<
"solid"<<
"AxialLayer"<<i<<
"_"<<
n<<
"SignalWire";
795 G4Tubs* signalWire_tube=
new G4Tubs(osnameSignalWireSolid.str(),0.,signalWireR,
length,0.,360*deg);
796 std::ostringstream osnameSignalWireLogical;
797 osnameSignalWireLogical<<
"logical"<<
"AxialLayer"<<i<<
"_"<<
n<<
"SignalWire";
798 G4LogicalVolume* signalWire_log=
new G4LogicalVolume(signalWire_tube,Au,osnameSignalWireLogical.str(),0,0,0);
800 std::ostringstream osnameSignalWireSubSolid;
801 osnameSignalWireSubSolid<<
"solid"<<
"AxialLayer"<<i<<
"_"<<
n<<
"SignalWireSub";
802 G4Tubs* signalWireSub_tube=
new G4Tubs(osnameSignalWireSubSolid.str(),0.,signalWireR-thickOfAu,
length,0.,360*deg);
803 std::ostringstream osnameSignalWireSubLogical;
804 osnameSignalWireSubLogical<<
"logical"<<
"AxialLayer"<<i<<
"_"<<
n<<
"SignalWireSub";
805 G4LogicalVolume* signalWireSub_log=
new G4LogicalVolume(signalWireSub_tube,W,osnameSignalWireSubLogical.str(),0,0,0);
806 std::ostringstream osnameSignalWireSubPhys;
807 osnameSignalWireSubPhys<<
"physical"<<
"AxialLayer"<<i<<
"_"<<
n<<
"SignalWireSub";
808 G4VPhysicalVolume* signalWireSub_phys;
809 signalWireSub_phys=
new G4PVPlacement(0,0,signalWireSub_log,
810 osnameSignalWireSubPhys.str(),signalWire_log,
false,0);
812 std::ostringstream osnameSignalWirePhys;
813 osnameSignalWirePhys<<
"physicalAxialLayer"<<i<<
"_"<<
n<<
"SignalWire4";
814 posX=mdc->
Layer(signalLayer).
R()*mm*
cos(spanAngle/2.);
815 posY=mdc->
Layer(signalLayer).
R()*mm*
sin(spanAngle/2.);
816 G4VPhysicalVolume* signalWire_phys;
817 signalWire_phys=
new G4PVPlacement(0,G4ThreeVector(posX,posY,0),signalWire_log,
818 osnameSignalWirePhys.str(),replica_log,
false,4);
820 std::ostringstream osnameFieldWire7Phys;
821 osnameFieldWire7Phys<<
"physicalAxialLayer"<<i<<
"_"<<
n<<
"FieldWire7";
822 posX=mdc->
Layer(signalLayer).
R()*mm*
cos(spanAngle);
823 posY=mdc->
Layer(signalLayer).
R()*mm*
sin(spanAngle);
824 G4RotationMatrix* wireRot7=
new G4RotationMatrix();
825 wireRot7->rotateZ(180*deg-spanAngle);
826 G4VPhysicalVolume* fieldWire7_phys;
827 fieldWire7_phys=
new G4PVPlacement(wireRot7,G4ThreeVector(posX,posY,0),fieldWireHalf_log,
828 osnameFieldWire7Phys.str(),replica_log,
false,7);
830 std::ostringstream osnameFieldWire2Phys;
831 osnameFieldWire2Phys<<
"physicalAxialLayer"<<i<<
"_"<<
n<<
"FieldWire2";
832 posX=mdc->
Layer(signalLayer+1).
R()*mm;
833 G4VPhysicalVolume* fieldWire2_phys;
834 fieldWire2_phys=
new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log,
835 osnameFieldWire2Phys.str(),replica_log,
false,2);
837 std::ostringstream osnameFieldWire5Phys;
838 osnameFieldWire5Phys<<
"physicalAxialLayer"<<i<<
"_"<<
n<<
"FieldWire5";
839 posX=mdc->
Layer(signalLayer+1).
R()*mm*
cos(spanAngle/2.);
840 posY=mdc->
Layer(signalLayer+1).
R()*mm*
sin(spanAngle/2.);
841 G4VPhysicalVolume* fieldWire5_phys;
842 fieldWire5_phys=
new G4PVPlacement(0,G4ThreeVector(posX,posY,0),fieldWire_log,
843 osnameFieldWire5Phys.str(),replica_log,
false,5);
845 std::ostringstream osnameFieldWire8Phys;
846 osnameFieldWire8Phys<<
"physicalAxialLayer"<<i<<
"_"<<
n<<
"FieldWire8";
847 posX=mdc->
Layer(signalLayer+1).
R()*mm*
cos(spanAngle);
848 posY=mdc->
Layer(signalLayer+1).
R()*mm*
sin(spanAngle);
849 G4RotationMatrix* wireRot8=
new G4RotationMatrix();
850 wireRot8->rotateZ(180*deg-spanAngle);
851 G4VPhysicalVolume* fieldWire8_phys;
852 fieldWire8_phys=
new G4PVPlacement(wireRot8,G4ThreeVector(posX,posY,0),fieldWireHalf_log,
853 osnameFieldWire8Phys.str(),replica_log,
false,8);
858 for(j=replicaNo-1;j>-1;j--){
859 G4RotationMatrix* cellRot=
new G4RotationMatrix();
860 cellRot->rotateZ(-spanAngle*j);
861 std::ostringstream osnameCellPhys;
862 osnameCellPhys<<
"physical"<<
"MdcAxialLayer"<<i<<
"_"<<
n<<
"Cell"<<j;
863 G4VPhysicalVolume* replica_phys;
864 replica_phys=
new G4PVPlacement(cellRot,0,replica_log,
865 osnameCellPhys.str(),axialLayer_log,
false,j);
873 for(i=35; i>19; i--){
876 innerR=mdc->
Layer(signalLayer-1).
R()*mm-fieldWireR;
877 outR=mdc->
Layer(signalLayer+1).
R()*mm-fieldWireR;
878 if(i==35)outR=mdc->
Layer(signalLayer+1).
R()*mm+fieldWireR;
880 innerLength=(mdc->
Layer(signalLayer-1).
Length())/2.*mm;
881 outLength=(mdc->
Layer(signalLayer+1).
Length())/2.*mm;
886 innerTan=innerR/innerLength*
sin(innerTwistAngle);
888 midInnerR=innerR*
cos(innerTwistAngle);
889 innerStereo=atan(innerTan);
891 outTan=outR/outLength*
sin(outTwistAngle);
892 outTwistAngleFixed=atan(innerLength/outLength*
tan(outTwistAngle));
894 if(
abs(outTwistAngleFixed) >=
abs(innerTwistAngle)){
895 midOutR=outR*
cos(outTwistAngle);
896 outRFixed=midOutR/
cos(innerTwistAngle);
899 outTanFixed=midOutR/innerLength*
tan(innerTwistAngle);
900 outStereo=atan(outTanFixed);
902 outRFixed=sqrt(outR*outR+(innerLength*innerLength-outLength*outLength)*outTan*outTan);
904 midOutR=outR*
cos(innerTwistAngle);
906 outTanFixed=outRFixed/innerLength*
sin(innerTwistAngle);
907 outStereo=atan(outTanFixed);
910 std::ostringstream osnameLayerSolid;
911 osnameLayerSolid <<
"solid"<<
"MdcStereoLayer"<<i;
913 G4Hype* stereoLayer_hype=
new G4Hype(osnameLayerSolid.str(),midInnerR, midOutR,innerStereo,
914 outStereo,innerLength);
916 std::ostringstream osnameLayerLogical;
917 osnameLayerLogical <<
"logical"<<
"MdcStereoLayer"<<i;
918 G4LogicalVolume* stereoLayer_log=
new G4LogicalVolume(stereoLayer_hype,MdcGas,
919 osnameLayerLogical.str(),0,0,0);
920 stereoLayer_log->SetVisAttributes(G4VisAttributes::Invisible);
923 spanAngle=360./replicaNo*deg;
926 G4RotationMatrix* layerRot=
new G4RotationMatrix();
927 layerRot->rotateZ(-(spanAngle*(1-firstWire)/2.+innerTwistAngle));
929 std::ostringstream osnameLayerPhys;
930 osnameLayerPhys<<
"physical"<<
"MdcStereoLayer"<<i;
931 G4VPhysicalVolume* stereoLayer_phys;
932 stereoLayer_phys=
new G4PVPlacement(layerRot,0,stereoLayer_log,osnameLayerPhys.str(),
935 std::ostringstream osnameCellSolid;
936 osnameCellSolid<<
"solid"<<
"MdcStereoLayer"<<i<<
"Cell";
938 G4TwistedTubs* twistTub=
new G4TwistedTubs(osnameCellSolid.str(), -innerTwistAngle*2, innerR,outR-1.0*micrometer,innerLength,spanAngle);
940 std::ostringstream osnameCellLogical;
941 osnameCellLogical<<
"logical"<<
"MdcStereoLayer"<<i<<
"Cell";
942 G4LogicalVolume* twistTub_log=
new G4LogicalVolume(twistTub, MdcGas,osnameCellLogical.str(),0,0,0);
944 twistTub_log->SetVisAttributes(G4VisAttributes::Invisible);
945 twistTub_log->SetSensitiveDetector( aTrackerSD );
950 std::ostringstream osnameFieldWireSolid;
951 osnameFieldWireSolid<<
"solid"<<
"StereoLayer"<<i<<
"FieldWire";
952 G4Tubs* fieldWire_tube=
new G4Tubs(osnameFieldWireSolid.str(),0.,fieldWireR,innerLength,0.,360*deg);
953 std::ostringstream osnameFieldWireLogical;
954 osnameFieldWireLogical<<
"logical"<<
"StereoLayer"<<i<<
"FieldWire";
955 G4LogicalVolume* fieldWire_log=
new G4LogicalVolume(fieldWire_tube,Au,osnameFieldWireLogical.str(),0,0,0);
957 std::ostringstream osnameFieldWireSubSolid;
958 osnameFieldWireSubSolid<<
"solid"<<
"StereoLayer"<<i<<
"FieldWireSub";
959 G4Tubs* fieldWireSub_tube=
new G4Tubs(osnameFieldWireSubSolid.str(),0.,fieldWireR-thickOfAu,innerLength,0.,360*deg);
960 std::ostringstream osnameFieldWireSubLogical;
961 osnameFieldWireSubLogical<<
"logical"<<
"StereoLayer"<<i<<
"FieldWireSub";
962 G4LogicalVolume* fieldWireSub_log=
new G4LogicalVolume(fieldWireSub_tube,
Al,osnameFieldWireSubLogical.str(),0,0,0);
963 std::ostringstream osnameFieldWireSubPhys;
964 osnameFieldWireSubPhys<<
"physical"<<
"StereoLayer"<<i<<
"FieldWireSub";
965 G4VPhysicalVolume* fieldWireSub_phys;
966 fieldWireSub_phys=
new G4PVPlacement(0,0,fieldWireSub_log,
967 osnameFieldWireSubPhys.str(),fieldWire_log,
false,0);
969 std::ostringstream osnameSignalWireSolid;
970 osnameSignalWireSolid<<
"solid"<<
"StereoLayer"<<i<<
"SignalWire";
971 G4Tubs* signalWire_tube=
new G4Tubs(osnameSignalWireSolid.str(),0.,signalWireR,innerLength,0.,360*deg);
972 std::ostringstream osnameSignalWireLogical;
973 osnameSignalWireLogical<<
"logical"<<
"StereoLayer"<<i<<
"SignalWire";
974 G4LogicalVolume* signalWire_log=
new G4LogicalVolume(signalWire_tube,Au,osnameSignalWireLogical.str(),0,0,0);
976 std::ostringstream osnameSignalWireSubSolid;
977 osnameSignalWireSubSolid<<
"solid"<<
"StereoLayer"<<i<<
"SignalWireSub";
978 G4Tubs* signalWireSub_tube=
new G4Tubs(osnameSignalWireSubSolid.str(),0.,signalWireR-thickOfAu,innerLength,0.,360*deg);
979 std::ostringstream osnameSignalWireSubLogical;
980 osnameSignalWireSubLogical<<
"logical"<<
"StereoLayer"<<i<<
"SignalWireSub";
981 G4LogicalVolume* signalWireSub_log=
new G4LogicalVolume(signalWireSub_tube,W,osnameSignalWireSubLogical.str(),0,0,0);
982 std::ostringstream osnameSignalWireSubPhys;
983 osnameSignalWireSubPhys<<
"physical"<<
"StereoLayer"<<i<<
"SignalWireSub";
984 G4VPhysicalVolume* signalWireSub_phys;
985 signalWireSub_phys=
new G4PVPlacement(0,0,signalWireSub_log,
986 osnameSignalWireSubPhys.str(),signalWire_log,
false,0);
995 G4double shiftR,midR,eastX,eastY,westX,westY;
996 shiftR=fieldWireR+1*micrometer;
997 midR=mdc->
Layer(signalLayer).
R()*mm;
999 std::ostringstream osnameFieldWire0Phys;
1000 osnameFieldWire0Phys<<
"physicalStereoLayer"<<i<<
"FieldWire0";
1002 eastX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg-innerTwistAngle);
1003 eastY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle)+shiftR*
sin(90*deg-innerTwistAngle);
1004 westX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg+innerTwistAngle);
1005 westY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle)+shiftR*
sin(90*deg+innerTwistAngle);
1007 G4ThreeVector east0(eastX,eastY,innerLength);
1008 G4ThreeVector west0(westX,westY,-innerLength);
1009 east0.rotateZ(-spanAngle/2.);
1010 west0.rotateZ(-spanAngle/2.);
1012 posX=(east0.x()+west0.x())/2.;
1013 posY=(east0.y()+west0.y())/2.;
1014 G4ThreeVector line0=east0-west0;
1015 G4RotationMatrix* wireRot0=
new G4RotationMatrix();
1016 wireRot0->rotateZ(-line0.phi());
1017 wireRot0->rotateY(-line0.theta());
1018 G4VPhysicalVolume* fieldWire0_phys;
1019 fieldWire0_phys=
new G4PVPlacement(wireRot0,G4ThreeVector(posX,posY,0),fieldWire_log,
1020 osnameFieldWire0Phys.str(),twistTub_log,
false,0);
1022 std::ostringstream osnameFieldWire1Phys;
1023 osnameFieldWire1Phys<<
"physicalStereoLayer"<<i<<
"FieldWire1";
1024 eastX=midR*
cos(innerTwistAngle)+shiftR*
cos(90*deg-innerTwistAngle);
1025 eastY=midR*
sin(-innerTwistAngle)+shiftR*
sin(90*deg-innerTwistAngle);
1026 westX=midR*
cos(innerTwistAngle)+shiftR*
cos(90*deg+innerTwistAngle);
1027 westY=midR*
sin(innerTwistAngle)+shiftR*
sin(90*deg+innerTwistAngle);
1028 G4ThreeVector east1(eastX,eastY,innerLength);
1029 G4ThreeVector west1(westX,westY,-innerLength);
1030 east1.rotateZ(-spanAngle/2.);
1031 west1.rotateZ(-spanAngle/2.);
1032 posX=(east1.x()+west1.x())/2.;
1033 posY=(east1.y()+west1.y())/2.;
1034 G4ThreeVector line1=east1-west1;
1035 G4RotationMatrix* wireRot1=
new G4RotationMatrix();
1036 wireRot1->rotateZ(-line1.phi());
1037 wireRot1->rotateY(-line1.theta());
1038 G4VPhysicalVolume* fieldWire1_phys;
1039 fieldWire1_phys=
new G4PVPlacement(wireRot1,G4ThreeVector(posX,posY,0),fieldWire_log,
1040 osnameFieldWire1Phys.str(),twistTub_log,
false,1);
1042 std::ostringstream osnameFieldWire3Phys;
1043 osnameFieldWire3Phys<<
"physicalStereoLayer"<<i<<
"FieldWire3";
1045 eastX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1046 eastY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle);
1047 westX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1048 westY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle);
1050 G4ThreeVector east3(eastX,eastY,innerLength);
1051 G4ThreeVector west3(westX,westY,-innerLength);
1053 posX=(east3.x()+west3.x())/2.;
1054 posY=(east3.y()+west3.y())/2.;
1055 G4ThreeVector line3=east3-west3;
1056 G4RotationMatrix* wireRot3=
new G4RotationMatrix();
1057 wireRot3->rotateZ(-line3.phi());
1058 wireRot3->rotateY(-line3.theta());
1059 G4VPhysicalVolume* fieldWire3_phys;
1060 fieldWire3_phys=
new G4PVPlacement(wireRot3,G4ThreeVector(posX,posY,0),fieldWire_log,
1061 osnameFieldWire3Phys.str(),twistTub_log,
false,3);
1063 std::ostringstream osnameSignalWire4Phys;
1064 osnameSignalWire4Phys<<
"physicalStereoLayer"<<i<<
"SignalWire4";
1066 eastX=midR*
cos(innerTwistAngle);
1067 eastY=midR*
sin(-innerTwistAngle);
1068 westX=midR*
cos(innerTwistAngle);
1069 westY=midR*
sin(innerTwistAngle);
1071 G4ThreeVector east4(eastX,eastY,innerLength);
1072 G4ThreeVector west4(westX,westY,-innerLength);
1074 posX=(east4.x()+west4.x())/2.;
1075 posY=(east4.y()+west4.y())/2.;
1076 G4ThreeVector line4=east4-west4;
1077 G4RotationMatrix* wireRot4=
new G4RotationMatrix();
1078 wireRot4->rotateZ(-line4.phi());
1079 wireRot4->rotateY(-line4.theta());
1080 G4VPhysicalVolume* signalWire4_phys;
1081 signalWire4_phys=
new G4PVPlacement(wireRot4,G4ThreeVector(posX,posY,0),signalWire_log,
1082 osnameSignalWire4Phys.str(),twistTub_log,
false,4);
1085 std::ostringstream osnameFieldWire2Phys;
1086 osnameFieldWire2Phys<<
"physicalStereoLayer"<<i<<
"FieldWire2";
1088 eastX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg-innerTwistAngle);
1089 eastY=(outR-shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle)+shiftR*
sin(90*deg-innerTwistAngle);
1090 westX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg+innerTwistAngle);
1091 westY=(outR-shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle)+shiftR*
sin(90*deg+innerTwistAngle);
1093 G4ThreeVector east2(eastX,eastY,innerLength);
1094 G4ThreeVector west2(westX,westY,-innerLength);
1095 east2.rotateZ(-spanAngle/2.);
1096 west2.rotateZ(-spanAngle/2.);
1098 posX=(east2.x()+west2.x())/2.;
1099 posY=(east2.y()+west2.y())/2.;
1100 G4ThreeVector line2=east2-west2;
1101 G4RotationMatrix* wireRot2=
new G4RotationMatrix();
1102 wireRot2->rotateZ(-line2.phi());
1103 wireRot2->rotateY(-line2.theta());
1104 G4VPhysicalVolume* fieldWire2_phys;
1105 fieldWire2_phys=
new G4PVPlacement(wireRot2,G4ThreeVector(posX,posY,0),fieldWire_log,
1106 osnameFieldWire2Phys.str(),twistTub_log,
false,2);
1108 std::ostringstream osnameFieldWire5Phys;
1109 osnameFieldWire5Phys<<
"physicalStereoLayer"<<i<<
"FieldWire5";
1111 eastX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1112 eastY=(outR-shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle);
1113 westX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1114 westY=(outR-shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle);
1116 G4ThreeVector east5(eastX,eastY,innerLength);
1117 G4ThreeVector west5(westX,westY,-innerLength);
1119 posX=(east5.x()+west5.x())/2.;
1120 posY=(east5.y()+west5.y())/2.;
1121 G4ThreeVector line5=east5-west5;
1122 G4RotationMatrix* wireRot5=
new G4RotationMatrix();
1123 wireRot5->rotateZ(-line5.phi());
1124 wireRot5->rotateY(-line5.theta());
1125 G4VPhysicalVolume* fieldWire5_phys;
1126 fieldWire5_phys=
new G4PVPlacement(wireRot5,G4ThreeVector(posX,posY,0),fieldWire_log,
1127 osnameFieldWire5Phys.str(),twistTub_log,
false,5);
1131 for(j=replicaNo-1;j>-1;j--){
1132 G4RotationMatrix* cellRot=
new G4RotationMatrix();
1133 cellRot->rotateZ(-spanAngle*j);
1135 std::ostringstream osnameCellPhys;
1136 osnameCellPhys<<
"physical"<<
"MdcStereoLayer"<<i<<
"Cell"<<j;
1137 G4VPhysicalVolume* twistTub_phys;
1138 twistTub_phys=
new G4PVPlacement(cellRot,0,twistTub_log,
1139 osnameCellPhys.str(),stereoLayer_log,
false,j);
1144 for(i=19; i>7; i--){
1146 innerR=mdc->
Layer(signalLayer-1).
R()*mm-fieldWireR;
1147 outR=mdc->
Layer(signalLayer+1).
R()*mm-fieldWireR;
1148 if(i==19)outR=mdc->
Layer(signalLayer+1).
R()*mm+fieldWireR;
1158 std::ostringstream osnameLayerSolid;
1159 osnameLayerSolid <<
"solid"<<
"MdcAxialLayer"<<i;
1160 G4Tubs* axialLayer_tube=
new G4Tubs(osnameLayerSolid.str(),innerR,outR,
length,startAngle,spanAngle);
1162 std::ostringstream osnameLayerLogical;
1163 osnameLayerLogical <<
"logical"<<
"MdcAxialLayer"<<i;
1164 G4LogicalVolume* axialLayer_log=
new G4LogicalVolume(axialLayer_tube, MdcGas,osnameLayerLogical.str(),0,0,0);
1165 axialLayer_log->SetVisAttributes(G4VisAttributes::Invisible);
1168 spanAngle=360./replicaNo*deg;
1170 offset=mdc->
Layer(signalLayer).
Phi()*
rad-firstWire*spanAngle/2.;
1171 G4RotationMatrix* layerRot=
new G4RotationMatrix();
1172 layerRot->rotateZ(-offset);
1174 std::ostringstream osnameLayerPhys;
1175 osnameLayerPhys<<
"physical"<<
"MdcAxialLayer"<<i;
1176 G4VPhysicalVolume* axialLayer_phys;
1177 axialLayer_phys=
new G4PVPlacement(layerRot,0,axialLayer_log,
1178 osnameLayerPhys.str(),mdc_log,
false,i);
1181 std::ostringstream osnameCellSolid;
1182 osnameCellSolid<<
"solid"<<
"MdcAxialLayer"<<i<<
"Cell";
1183 G4Tubs* replica_tube=
new G4Tubs(osnameCellSolid.str(),innerR,outR,
length,startAngle,spanAngle);
1185 std::ostringstream osnameCellLogical;
1186 osnameCellLogical<<
"logical"<<
"MdcAxialLayer"<<i<<
"Cell";
1187 G4LogicalVolume* replica_log=
new G4LogicalVolume(replica_tube,MdcGas,osnameCellLogical.str(),0,0,0);
1189 replica_log->SetSensitiveDetector( aTrackerSD );
1190 visAtt=
new G4VisAttributes(G4Colour(0.0,0.0,1.0));
1191 replica_log->SetVisAttributes(visAtt);
1192 replica_log->SetVisAttributes(G4VisAttributes::Invisible);
1196 std::ostringstream osnameFieldWireSolid;
1197 osnameFieldWireSolid<<
"solid"<<
"AxialLayer"<<i<<
"FieldWire";
1198 G4Tubs* fieldWire_tube=
new G4Tubs(osnameFieldWireSolid.str(),0.,fieldWireR,
length,0.,360*deg);
1199 std::ostringstream osnameFieldWireLogical;
1200 osnameFieldWireLogical<<
"logical"<<
"AxialLayer"<<i<<
"FieldWire";
1201 G4LogicalVolume* fieldWire_log=
new G4LogicalVolume(fieldWire_tube,Au,osnameFieldWireLogical.str(),0,0,0);
1203 std::ostringstream osnameFieldWireSubSolid;
1204 osnameFieldWireSubSolid<<
"solid"<<
"AxialLayer"<<i<<
"FieldWireSub";
1205 G4Tubs* fieldWireSub_tube=
new G4Tubs(osnameFieldWireSubSolid.str(),0.,fieldWireR-thickOfAu,
length,0.,360*deg);
1206 std::ostringstream osnameFieldWireSubLogical;
1207 osnameFieldWireSubLogical<<
"logical"<<
"AxialLayer"<<i<<
"FieldWireSub";
1208 G4LogicalVolume* fieldWireSub_log=
new G4LogicalVolume(fieldWireSub_tube,
Al,osnameFieldWireSubLogical.str(),0,0,0);
1209 std::ostringstream osnameFieldWireSubPhys;
1210 osnameFieldWireSubPhys<<
"physical"<<
"AxialLayer"<<i<<
"FieldWireSub";
1211 G4VPhysicalVolume* fieldWireSub_phys;
1212 fieldWireSub_phys=
new G4PVPlacement(0,0,fieldWireSub_log,
1213 osnameFieldWireSubPhys.str(),fieldWire_log,
false,0);
1215 std::ostringstream osnameFieldWireHalfSolid;
1216 osnameFieldWireHalfSolid<<
"solid"<<
"AxialLayer"<<i<<
"FieldWireHalf";
1217 G4Tubs* fieldWireHalf_tube=
new G4Tubs(osnameFieldWireHalfSolid.str(),0.,fieldWireR,
length,0.,180*deg);
1218 std::ostringstream osnameFieldWireHalfLogical;
1219 osnameFieldWireHalfLogical<<
"logical"<<
"AxialLayer"<<i<<
"FieldWireHalf";
1220 G4LogicalVolume* fieldWireHalf_log=
new G4LogicalVolume(fieldWireHalf_tube,Au,osnameFieldWireHalfLogical.str(),0,0,0);
1222 std::ostringstream osnameFieldWireHalfSubSolid;
1223 osnameFieldWireHalfSubSolid<<
"solid"<<
"AxialLayer"<<i<<
"FieldWireHalfSub";
1224 G4Tubs* fieldWireHalfSub_tube=
new G4Tubs(osnameFieldWireHalfSubSolid.str(),0.,fieldWireR-thickOfAu,
length,0.,360*deg);
1225 std::ostringstream osnameFieldWireHalfSubLogical;
1226 osnameFieldWireHalfSubLogical<<
"logical"<<
"AxialLayer"<<i<<
"FieldWireHalfSub";
1227 G4LogicalVolume* fieldWireHalfSub_log=
new G4LogicalVolume(fieldWireHalfSub_tube,
Al,osnameFieldWireHalfSubLogical.str(),0,0,0);
1228 std::ostringstream osnameFieldWireHalfSubPhys;
1229 osnameFieldWireHalfSubPhys<<
"physical"<<
"AxialLayer"<<i<<
"FieldWireHalfSub";
1230 G4VPhysicalVolume* fieldWireHalfSub_phys;
1231 fieldWireHalfSub_phys=
new G4PVPlacement(0,0,fieldWireHalfSub_log,
1232 osnameFieldWireHalfSubPhys.str(),fieldWireHalf_log,
false,0);
1234 std::ostringstream osnameSignalWireSolid;
1235 osnameSignalWireSolid<<
"solid"<<
"AxialLayer"<<i<<
"SignalWire";
1236 G4Tubs* signalWire_tube=
new G4Tubs(osnameSignalWireSolid.str(),0.,signalWireR,
length,0.,360*deg);
1237 std::ostringstream osnameSignalWireLogical;
1238 osnameSignalWireLogical<<
"logical"<<
"AxialLayer"<<i<<
"SignalWire";
1239 G4LogicalVolume* signalWire_log=
new G4LogicalVolume(signalWire_tube,Au,osnameSignalWireLogical.str(),0,0,0);
1241 std::ostringstream osnameSignalWireSubSolid;
1242 osnameSignalWireSubSolid<<
"solid"<<
"AxialLayer"<<i<<
"SignalWireSub";
1243 G4Tubs* signalWireSub_tube=
new G4Tubs(osnameSignalWireSubSolid.str(),0.,signalWireR-thickOfAu,
length,0.,360*deg);
1244 std::ostringstream osnameSignalWireSubLogical;
1245 osnameSignalWireSubLogical<<
"logical"<<
"AxialLayer"<<i<<
"SignalWireSub";
1246 G4LogicalVolume* signalWireSub_log=
new G4LogicalVolume(signalWireSub_tube,W,osnameSignalWireSubLogical.str(),0,0,0);
1247 std::ostringstream osnameSignalWireSubPhys;
1248 osnameSignalWireSubPhys<<
"physical"<<
"AxialLayer"<<i<<
"SignalWireSub";
1249 G4VPhysicalVolume* signalWireSub_phys;
1250 signalWireSub_phys=
new G4PVPlacement(0,0,signalWireSub_log,
1251 osnameSignalWireSubPhys.str(),signalWire_log,
false,0);
1260 std::ostringstream osnameFieldWire0Phys;
1261 osnameFieldWire0Phys<<
"physicalAxialLayer"<<i<<
"FieldWire0";
1262 posX=mdc->
Layer(signalLayer-1).
R()*mm;
1263 G4VPhysicalVolume* fieldWire0_phys;
1264 fieldWire0_phys=
new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log,
1265 osnameFieldWire0Phys.str(),replica_log,
false,0);
1267 std::ostringstream osnameFieldWire1Phys;
1268 osnameFieldWire1Phys<<
"physicalAxialLayer"<<i<<
"FieldWire1";
1269 posX=mdc->
Layer(signalLayer).
R()*mm;
1270 G4VPhysicalVolume* fieldWire1_phys;
1271 fieldWire1_phys=
new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log,
1272 osnameFieldWire1Phys.str(),replica_log,
false,1);
1275 std::ostringstream osnameFieldWire2Phys;
1276 osnameFieldWire2Phys<<
"physicalAxialLayer"<<i<<
"FieldWire2";
1277 posX=mdc->
Layer(signalLayer+1).
R()*mm;
1278 G4VPhysicalVolume* fieldWire2_phys;
1279 fieldWire2_phys=
new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log,
1280 osnameFieldWire2Phys.str(),replica_log,
false,2);
1283 std::ostringstream osnameFieldWire3Phys;
1284 osnameFieldWire3Phys<<
"physicalAxialLayer"<<i<<
"FieldWire3";
1285 posX=mdc->
Layer(signalLayer-1).
R()*mm*
cos(spanAngle/2.);
1286 posY=mdc->
Layer(signalLayer-1).
R()*mm*
sin(spanAngle/2.);
1287 G4VPhysicalVolume* fieldWire3_phys;
1288 fieldWire3_phys=
new G4PVPlacement(0,G4ThreeVector(posX,posY,0),fieldWire_log,
1289 osnameFieldWire3Phys.str(),replica_log,
false,3);
1291 std::ostringstream osnameSignalWirePhys;
1292 osnameSignalWirePhys<<
"physicalAxialLayer"<<i<<
"SignalWire4";
1293 posX=mdc->
Layer(signalLayer).
R()*mm*
cos(spanAngle/2.);
1294 posY=mdc->
Layer(signalLayer).
R()*mm*
sin(spanAngle/2.);
1295 G4VPhysicalVolume* signalWire_phys;
1296 signalWire_phys=
new G4PVPlacement(0,G4ThreeVector(posX,posY,0),signalWire_log,
1297 osnameSignalWirePhys.str(),replica_log,
false,4);
1300 std::ostringstream osnameFieldWire5Phys;
1301 osnameFieldWire5Phys<<
"physicalAxialLayer"<<i<<
"FieldWire5";
1302 posX=mdc->
Layer(signalLayer+1).
R()*mm*
cos(spanAngle/2.);
1303 posY=mdc->
Layer(signalLayer+1).
R()*mm*
sin(spanAngle/2.);
1304 G4VPhysicalVolume* fieldWire5_phys;
1305 fieldWire5_phys=
new G4PVPlacement(0,G4ThreeVector(posX,posY,0),fieldWire_log,
1306 osnameFieldWire5Phys.str(),replica_log,
false,5);
1309 std::ostringstream osnameFieldWire6Phys;
1310 osnameFieldWire6Phys<<
"physicalAxialLayer"<<i<<
"FieldWire6";
1311 posX=mdc->
Layer(signalLayer-1).
R()*mm*
cos(spanAngle);
1312 posY=mdc->
Layer(signalLayer-1).
R()*mm*
sin(spanAngle);
1313 G4RotationMatrix* wireRot6=
new G4RotationMatrix();
1314 wireRot6->rotateZ(180*deg-spanAngle);
1315 G4VPhysicalVolume* fieldWire6_phys;
1316 fieldWire6_phys=
new G4PVPlacement(wireRot6,G4ThreeVector(posX,posY,0),fieldWireHalf_log,
1317 osnameFieldWire6Phys.str(),replica_log,
false,6);
1319 std::ostringstream osnameFieldWire7Phys;
1320 osnameFieldWire7Phys<<
"physicalAxialLayer"<<i<<
"FieldWire7";
1321 posX=mdc->
Layer(signalLayer).
R()*mm*
cos(spanAngle);
1322 posY=mdc->
Layer(signalLayer).
R()*mm*
sin(spanAngle);
1323 G4RotationMatrix* wireRot7=
new G4RotationMatrix();
1324 wireRot7->rotateZ(180*deg-spanAngle);
1325 G4VPhysicalVolume* fieldWire7_phys;
1326 fieldWire7_phys=
new G4PVPlacement(wireRot7,G4ThreeVector(posX,posY,0),fieldWireHalf_log,
1327 osnameFieldWire7Phys.str(),replica_log,
false,7);
1330 std::ostringstream osnameFieldWire8Phys;
1331 osnameFieldWire8Phys<<
"physicalAxialLayer"<<i<<
"FieldWire8";
1332 posX=mdc->
Layer(signalLayer+1).
R()*mm*
cos(spanAngle);
1333 posY=mdc->
Layer(signalLayer+1).
R()*mm*
sin(spanAngle);
1334 G4RotationMatrix* wireRot8=
new G4RotationMatrix();
1335 wireRot8->rotateZ(180*deg-spanAngle);
1336 G4VPhysicalVolume* fieldWire8_phys;
1337 fieldWire8_phys=
new G4PVPlacement(wireRot8,G4ThreeVector(posX,posY,0),fieldWireHalf_log,
1338 osnameFieldWire8Phys.str(),replica_log,
false,8);
1342 for(j=replicaNo-1;j>-1;j--){
1343 G4RotationMatrix* cellRot=
new G4RotationMatrix();
1344 cellRot->rotateZ(-spanAngle*j);
1346 std::ostringstream osnameCellPhys;
1347 osnameCellPhys<<
"physical"<<
"MdcAxialLayer"<<i<<
"Cell"<<j;
1348 G4VPhysicalVolume* replica_phys;
1349 replica_phys=
new G4PVPlacement(cellRot,0,replica_log,
1350 osnameCellPhys.str(),axialLayer_log,
false,j);
1358 for(i=7; i>innestLayer; i--){
1361 innerR=mdc->
Layer(signalLayer-1).
R()*mm-fieldWireR;
1362 outR=mdc->
Layer(signalLayer+1).
R()*mm-fieldWireR;
1363 if(i==7)outR=mdc->
Layer(signalLayer+1).
R()*mm+fieldWireR;
1365 innerLength=(mdc->
Layer(signalLayer-1).
Length())/2.*mm;
1366 outLength=(mdc->
Layer(signalLayer+1).
Length())/2.*mm;
1371 innerTan=innerR/innerLength*
sin(innerTwistAngle);
1373 midInnerR=innerR*
cos(innerTwistAngle);
1374 innerStereo=atan(innerTan);
1376 outTan=outR/outLength*
sin(outTwistAngle);
1377 outTwistAngleFixed=atan(innerLength/outLength*
tan(outTwistAngle));
1379 if(
abs(outTwistAngleFixed) >=
abs(innerTwistAngle)){
1380 midOutR=outR*
cos(outTwistAngle);
1381 outRFixed=midOutR/
cos(innerTwistAngle);
1384 outTanFixed=midOutR/innerLength*
tan(innerTwistAngle);
1385 outStereo=atan(outTanFixed);
1387 outRFixed=sqrt(outR*outR+(innerLength*innerLength-outLength*outLength)*outTan*outTan);
1389 midOutR=outR*
cos(innerTwistAngle);
1391 outTanFixed=outRFixed/innerLength*
sin(innerTwistAngle);
1392 outStereo=atan(outTanFixed);
1396 std::ostringstream osnameLayerSolid;
1397 osnameLayerSolid <<
"solid"<<
"MdcStereoLayer"<<i;
1399 G4Hype* stereoLayer_hype=
new G4Hype(osnameLayerSolid.str(),midInnerR, midOutR,innerStereo,
1400 outStereo,innerLength);
1401 std::ostringstream osnameLayerLogical;
1402 osnameLayerLogical <<
"logical"<<
"MdcStereoLayer"<<i;
1403 G4LogicalVolume* stereoLayer_log=
new G4LogicalVolume(stereoLayer_hype,MdcGas,
1404 osnameLayerLogical.str(),0,0,0);
1405 stereoLayer_log->SetVisAttributes(G4VisAttributes::Invisible);
1408 spanAngle=360./replicaNo*deg;
1411 G4RotationMatrix* layerRot=
new G4RotationMatrix();
1412 layerRot->rotateZ(-(spanAngle*(1-firstWire)/2.+innerTwistAngle));
1414 std::ostringstream osnameLayerPhys;
1415 osnameLayerPhys<<
"physical"<<
"MdcStereoLayer"<<i;
1417 G4VPhysicalVolume* stereoLayer_phys;
1418 stereoLayer_phys=
new G4PVPlacement(layerRot,0,stereoLayer_log,osnameLayerPhys.str(),
1422 std::ostringstream osnameCellSolid;
1423 osnameCellSolid<<
"solid"<<
"MdcStereoLayer"<<i<<
"Cell";
1425 G4TwistedTubs* twistTub=
new G4TwistedTubs(osnameCellSolid.str(), -innerTwistAngle*2, innerR,outR-1.0*micrometer,innerLength,spanAngle);
1427 std::ostringstream osnameCellLogical;
1428 osnameCellLogical<<
"logical"<<
"MdcStereoLayer"<<i<<
"Cell";
1429 G4LogicalVolume* twistTub_log=
new G4LogicalVolume(twistTub, MdcGas,osnameCellLogical.str(),0,0,0);
1431 twistTub_log->SetVisAttributes(G4VisAttributes::Invisible);
1432 twistTub_log->SetSensitiveDetector( aTrackerSD );
1436 std::ostringstream osnameFieldWireSolid;
1437 osnameFieldWireSolid<<
"solid"<<
"StereoLayer"<<i<<
"FieldWire";
1438 G4Tubs* fieldWire_tube=
new G4Tubs(osnameFieldWireSolid.str(),0.,fieldWireR,innerLength,0.,360*deg);
1439 std::ostringstream osnameFieldWireLogical;
1440 osnameFieldWireLogical<<
"logical"<<
"StereoLayer"<<i<<
"FieldWire";
1441 G4LogicalVolume* fieldWire_log=
new G4LogicalVolume(fieldWire_tube,Au,osnameFieldWireLogical.str(),0,0,0);
1443 std::ostringstream osnameFieldWireSubSolid;
1444 osnameFieldWireSubSolid<<
"solid"<<
"StereoLayer"<<i<<
"FieldWireSub";
1445 G4Tubs* fieldWireSub_tube=
new G4Tubs(osnameFieldWireSubSolid.str(),0.,fieldWireR-thickOfAu,innerLength,0.,360*deg);
1446 std::ostringstream osnameFieldWireSubLogical;
1447 osnameFieldWireSubLogical<<
"logical"<<
"StereoLayer"<<i<<
"FieldWireSub";
1448 G4LogicalVolume* fieldWireSub_log=
new G4LogicalVolume(fieldWireSub_tube,
Al,osnameFieldWireSubLogical.str(),0,0,0);
1449 std::ostringstream osnameFieldWireSubPhys;
1450 osnameFieldWireSubPhys<<
"physical"<<
"StereoLayer"<<i<<
"FieldWireSub";
1451 G4VPhysicalVolume* fieldWireSub_phys;
1452 fieldWireSub_phys=
new G4PVPlacement(0,0,fieldWireSub_log,
1453 osnameFieldWireSubPhys.str(),fieldWire_log,
false,0);
1456 std::ostringstream osnameSignalWireSolid;
1457 osnameSignalWireSolid<<
"solid"<<
"StereoLayer"<<i<<
"SignalWire";
1458 G4Tubs* signalWire_tube=
new G4Tubs(osnameSignalWireSolid.str(),0.,signalWireR,innerLength,0.,360*deg);
1459 std::ostringstream osnameSignalWireLogical;
1460 osnameSignalWireLogical<<
"logical"<<
"StereoLayer"<<i<<
"SignalWire";
1461 G4LogicalVolume* signalWire_log=
new G4LogicalVolume(signalWire_tube,Au,osnameSignalWireLogical.str(),0,0,0);
1463 std::ostringstream osnameSignalWireSubSolid;
1464 osnameSignalWireSubSolid<<
"solid"<<
"StereoLayer"<<i<<
"SignalWireSub";
1465 G4Tubs* signalWireSub_tube=
new G4Tubs(osnameSignalWireSubSolid.str(),0.,signalWireR-thickOfAu,innerLength,0.,360*deg);
1466 std::ostringstream osnameSignalWireSubLogical;
1467 osnameSignalWireSubLogical<<
"logical"<<
"StereoLayer"<<i<<
"SignalWireSub";
1468 G4LogicalVolume* signalWireSub_log=
new G4LogicalVolume(signalWireSub_tube,W,osnameSignalWireSubLogical.str(),0,0,0);
1469 std::ostringstream osnameSignalWireSubPhys;
1470 osnameSignalWireSubPhys<<
"physical"<<
"StereoLayer"<<i<<
"SignalWireSub";
1471 G4VPhysicalVolume* signalWireSub_phys;
1472 signalWireSub_phys=
new G4PVPlacement(0,0,signalWireSub_log,
1473 osnameSignalWireSubPhys.str(),signalWire_log,
false,0);
1482 G4double shiftR,midR,eastX,eastY,westX,westY;
1483 shiftR=fieldWireR+1*micrometer;
1484 midR=mdc->
Layer(signalLayer).
R()*mm;
1486 std::ostringstream osnameFieldWire0Phys;
1487 osnameFieldWire0Phys<<
"physicalStereoLayer"<<i<<
"FieldWire0";
1489 eastX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg-innerTwistAngle);
1490 eastY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle)+shiftR*
sin(90*deg-innerTwistAngle);
1491 westX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg+innerTwistAngle);
1492 westY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle)+shiftR*
sin(90*deg+innerTwistAngle);
1494 G4ThreeVector east0(eastX,eastY,innerLength);
1495 G4ThreeVector west0(westX,westY,-innerLength);
1496 east0.rotateZ(-spanAngle/2.);
1497 west0.rotateZ(-spanAngle/2.);
1499 posX=(east0.x()+west0.x())/2.;
1500 posY=(east0.y()+west0.y())/2.;
1501 G4ThreeVector line0=east0-west0;
1502 G4RotationMatrix* wireRot0=
new G4RotationMatrix();
1503 wireRot0->rotateZ(-line0.phi());
1504 wireRot0->rotateY(-line0.theta());
1505 G4VPhysicalVolume* fieldWire0_phys;
1506 fieldWire0_phys=
new G4PVPlacement(wireRot0,G4ThreeVector(posX,posY,0),fieldWire_log,
1507 osnameFieldWire0Phys.str(),twistTub_log,
false,0);
1509 std::ostringstream osnameFieldWire1Phys;
1510 osnameFieldWire1Phys<<
"physicalStereoLayer"<<i<<
"FieldWire1";
1511 eastX=midR*
cos(innerTwistAngle)+shiftR*
cos(90*deg-innerTwistAngle);
1512 eastY=midR*
sin(-innerTwistAngle)+shiftR*
sin(90*deg-innerTwistAngle);
1513 westX=midR*
cos(innerTwistAngle)+shiftR*
cos(90*deg+innerTwistAngle);
1514 westY=midR*
sin(innerTwistAngle)+shiftR*
sin(90*deg+innerTwistAngle);
1515 G4ThreeVector east1(eastX,eastY,innerLength);
1516 G4ThreeVector west1(westX,westY,-innerLength);
1517 east1.rotateZ(-spanAngle/2.);
1518 west1.rotateZ(-spanAngle/2.);
1519 posX=(east1.x()+west1.x())/2.;
1520 posY=(east1.y()+west1.y())/2.;
1521 G4ThreeVector line1=east1-west1;
1522 G4RotationMatrix* wireRot1=
new G4RotationMatrix();
1523 wireRot1->rotateZ(-line1.phi());
1524 wireRot1->rotateY(-line1.theta());
1525 G4VPhysicalVolume* fieldWire1_phys;
1526 fieldWire1_phys=
new G4PVPlacement(wireRot1,G4ThreeVector(posX,posY,0),fieldWire_log,
1527 osnameFieldWire1Phys.str(),twistTub_log,
false,1);
1529 std::ostringstream osnameFieldWire3Phys;
1530 osnameFieldWire3Phys<<
"physicalStereoLayer"<<i<<
"FieldWire3";
1532 eastX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1533 eastY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle);
1534 westX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1535 westY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle);
1537 G4ThreeVector east3(eastX,eastY,innerLength);
1538 G4ThreeVector west3(westX,westY,-innerLength);
1540 posX=(east3.x()+west3.x())/2.;
1541 posY=(east3.y()+west3.y())/2.;
1542 G4ThreeVector line3=east3-west3;
1543 G4RotationMatrix* wireRot3=
new G4RotationMatrix();
1544 wireRot3->rotateZ(-line3.phi());
1545 wireRot3->rotateY(-line3.theta());
1546 G4VPhysicalVolume* fieldWire3_phys;
1547 fieldWire3_phys=
new G4PVPlacement(wireRot3,G4ThreeVector(posX,posY,0),fieldWire_log,
1548 osnameFieldWire3Phys.str(),twistTub_log,
false,3);
1550 std::ostringstream osnameSignalWire4Phys;
1551 osnameSignalWire4Phys<<
"physicalStereoLayer"<<i<<
"SignalWire4";
1553 eastX=midR*
cos(innerTwistAngle);
1554 eastY=midR*
sin(-innerTwistAngle);
1555 westX=midR*
cos(innerTwistAngle);
1556 westY=midR*
sin(innerTwistAngle);
1558 G4ThreeVector east4(eastX,eastY,innerLength);
1559 G4ThreeVector west4(westX,westY,-innerLength);
1561 posX=(east4.x()+west4.x())/2.;
1562 posY=(east4.y()+west4.y())/2.;
1563 G4ThreeVector line4=east4-west4;
1564 G4RotationMatrix* wireRot4=
new G4RotationMatrix();
1565 wireRot4->rotateZ(-line4.phi());
1566 wireRot4->rotateY(-line4.theta());
1567 G4VPhysicalVolume* signalWire4_phys;
1568 signalWire4_phys=
new G4PVPlacement(wireRot4,G4ThreeVector(posX,posY,0),signalWire_log,
1569 osnameSignalWire4Phys.str(),twistTub_log,
false,4);
1572 std::ostringstream osnameFieldWire2Phys;
1573 osnameFieldWire2Phys<<
"physicalStereoLayer"<<i<<
"FieldWire2";
1575 eastX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg-innerTwistAngle);
1576 eastY=(outR-shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle)+shiftR*
sin(90*deg-innerTwistAngle);
1577 westX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg+innerTwistAngle);
1578 westY=(outR-shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle)+shiftR*
sin(90*deg+innerTwistAngle);
1580 G4ThreeVector east2(eastX,eastY,innerLength);
1581 G4ThreeVector west2(westX,westY,-innerLength);
1582 east2.rotateZ(-spanAngle/2.);
1583 west2.rotateZ(-spanAngle/2.);
1585 posX=(east2.x()+west2.x())/2.;
1586 posY=(east2.y()+west2.y())/2.;
1587 G4ThreeVector line2=east2-west2;
1588 G4RotationMatrix* wireRot2=
new G4RotationMatrix();
1589 wireRot2->rotateZ(-line2.phi());
1590 wireRot2->rotateY(-line2.theta());
1591 G4VPhysicalVolume* fieldWire2_phys;
1592 fieldWire2_phys=
new G4PVPlacement(wireRot2,G4ThreeVector(posX,posY,0),fieldWire_log,
1593 osnameFieldWire2Phys.str(),twistTub_log,
false,2);
1595 std::ostringstream osnameFieldWire5Phys;
1596 osnameFieldWire5Phys<<
"physicalStereoLayer"<<i<<
"FieldWire5";
1598 eastX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1599 eastY=(outR-shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle);
1600 westX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1601 westY=(outR-shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle);
1603 G4ThreeVector east5(eastX,eastY,innerLength);
1604 G4ThreeVector west5(westX,westY,-innerLength);
1606 posX=(east5.x()+west5.x())/2.;
1607 posY=(east5.y()+west5.y())/2.;
1608 G4ThreeVector line5=east5-west5;
1609 G4RotationMatrix* wireRot5=
new G4RotationMatrix();
1610 wireRot5->rotateZ(-line5.phi());
1611 wireRot5->rotateY(-line5.theta());
1612 G4VPhysicalVolume* fieldWire5_phys;
1613 fieldWire5_phys=
new G4PVPlacement(wireRot5,G4ThreeVector(posX,posY,0),fieldWire_log,
1614 osnameFieldWire5Phys.str(),twistTub_log,
false,5);
1618 for(j=replicaNo-1;j>-1;j--){
1619 G4RotationMatrix* cellRot=
new G4RotationMatrix();
1620 cellRot->rotateZ(-spanAngle*j);
1622 std::ostringstream osnameCellPhys;
1623 osnameCellPhys<<
"physical"<<
"MdcStereoLayer"<<i<<
"Cell"<<j;
1624 G4VPhysicalVolume* twistTub_phys;
1625 twistTub_phys=
new G4PVPlacement(cellRot,0,twistTub_log,
1626 osnameCellPhys.str(),stereoLayer_log,
false,j);
1629 G4cout<<
"MyMessage::The Most Inner Mdc LayerID: "<<i<<G4endl;
double tan(const BesAngle a)
double sin(const BesAngle a)
double cos(const BesAngle a)
double abs(const EvtComplex &c)
***************************************************************************************Pseudo Class RRes *****************************************************************************************Parameters and physical constants **Maarten sept ************************************************************************DOUBLE PRECISION xsmu **************************************************************************PARTICLE DATA all others are from PDG *Only resonances with known widths into electron pairs are sept ************************************************************************C Declarations C
void Construct(G4LogicalVolume *)
static BesMdcGeoParameter * GetGeo(void)
const BesMdcLayer & Layer(int) const
BesMdcMember Segment(int x)
int FirstWire(void) const
double Length(void) const
double RotateAngle(void) const
double LengthCableTub(int n)
G4LogicalVolume * GetTopVolume()
Get the top(world) volume;.