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;
225 G4Tubs* mdc_tube=
new G4Tubs(
"solidMdc",innerR,outR,length,startAngle,spanAngle);
226 mdc_log=
new G4LogicalVolume(mdc_tube, MdcGas,
"logicalMdc",0,0,0);
227 mdc_log->SetVisAttributes(G4VisAttributes::Invisible);
233 mdc_phys=
new G4PVPlacement(0,
234 G4ThreeVector(posX ,posY ,posZ),
235 mdc_log,
"physicalMdc",logicBes,
false,0);
240 G4double colorShift=0., shift=1./(mdc->
SegmentNo()-1);
241 G4double gap=0.5*micrometer;
251 std::ostringstream osnameSolid;
252 osnameSolid <<
"solid"<<name<<i;
253 G4Tubs* segment_tube=
new G4Tubs(osnameSolid.str(),innerR,outR,length,startAngle,spanAngle);
254 std::ostringstream osnameLogical;
255 osnameLogical <<
"logical"<<name<<i;
256 G4LogicalVolume* segment_log;
258 segment_log=
new G4LogicalVolume(segment_tube, CarbonFiber,osnameLogical.str(),0,0,0);
260 segment_log=
new G4LogicalVolume(segment_tube, Al,osnameLogical.str(),0,0,0);
263 visAtt=
new G4VisAttributes(G4Colour(1.0-colorShift,0.0+colorShift,0.0));
264 if(i<3)visAtt->SetForceWireframe(
true);
265 segment_log->SetVisAttributes(visAtt);
269 G4VPhysicalVolume* segment_phys;
270 std::ostringstream osnamePhys1;
271 osnamePhys1 <<
"physical"<<name<<i<<
"p";
272 segment_phys=
new G4PVPlacement(0,
273 G4ThreeVector(posX ,posY ,posZ),
274 segment_log,osnamePhys1.str(),mdc_log,
false,0);
277 std::ostringstream osnamePhys2;
278 osnamePhys2 <<
"physical"<<name<<i<<
"m";
279 segment_phys=
new G4PVPlacement(0,
280 G4ThreeVector(posX ,posY ,-posZ),
281 segment_log,osnamePhys2.str(),mdc_log,
false,0);
293 G4Tubs* segment_tube1=
new G4Tubs(
"SolidMdcInnerFilm0",innerR,outR,length,startAngle,spanAngle);
294 G4LogicalVolume* segment_log1;
295 segment_log1=
new G4LogicalVolume(segment_tube1, Al,
"LogicalMdcInnerFilm0",0,0,0);
296 G4VisAttributes* visAtt1=
new G4VisAttributes(G4Colour(0,1.0,0.0));
297 segment_log1->SetVisAttributes(visAtt1);
298 G4VPhysicalVolume* segment_phys1;
299 segment_phys1=
new G4PVPlacement(0,
300 G4ThreeVector(posX ,posY ,posZ),
301 segment_log1,
"PhysicalMdcInnerFilm0",mdc_log,
false,0);
309 G4Tubs* segment_tube2=
new G4Tubs(
"SolidMdcInnerFilm1",innerR,outR,length,startAngle,spanAngle);
310 G4LogicalVolume* segment_log2;
311 segment_log2=
new G4LogicalVolume(segment_tube2, Al,
"LogicalMdcInnerFilm1",0,0,0);
312 G4VisAttributes* visAtt2=
new G4VisAttributes(G4Colour(0,0.0,1.0));
313 segment_log2->SetVisAttributes(visAtt2);
314 G4VPhysicalVolume* segment_phys2;
315 segment_phys2=
new G4PVPlacement(0,
316 G4ThreeVector(posX ,posY ,posZ),
317 segment_log2,
"PhysicalMdcInnerFilm1",mdc_log,
false,0);
325 G4Tubs* segment_tube3=
new G4Tubs(
"SolidMdcOutFilm0",innerR,outR,length,startAngle,spanAngle);
326 G4LogicalVolume* segment_log3;
327 segment_log3=
new G4LogicalVolume(segment_tube3, Al,
"LogicalMdcOutFilm0",0,0,0);
328 G4VisAttributes* visAtt3=
new G4VisAttributes(G4Colour(0,1.0,0.0));
329 segment_log3->SetVisAttributes(visAtt3);
330 G4VPhysicalVolume* segment_phys3;
331 segment_phys3=
new G4PVPlacement(0,
332 G4ThreeVector(posX ,posY ,posZ),
333 segment_log3,
"PhysicalMdcOutFilm0",mdc_log,
false,0);
341 G4Tubs* segment_tube4=
new G4Tubs(
"SolidMdcOutFilm1",innerR,outR,length,startAngle,spanAngle);
342 G4LogicalVolume* segment_log4;
343 segment_log4=
new G4LogicalVolume(segment_tube4, Al,
"LogicalMdcOutFilm1",0,0,0);
344 G4VisAttributes* visAtt4=
new G4VisAttributes(G4Colour(0,0.0,1.0));
345 segment_log4->SetVisAttributes(visAtt4);
346 G4VPhysicalVolume* segment_phys4;
347 segment_phys4=
new G4PVPlacement(0,
348 G4ThreeVector(posX ,posY ,posZ),
349 segment_log4,
"PhysicalMdcOutFilm1",mdc_log,
false,0);
352 innerR=mdc->
Segment(1).
OutR()*mm+100*micrometer+gap;
357 G4Tubs* segment_tube5=
new G4Tubs(
"SolidMdcOutFilm2",innerR,outR,length,startAngle,spanAngle);
358 G4LogicalVolume* segment_log5;
359 segment_log5=
new G4LogicalVolume(segment_tube5, Kapton,
"LogicalMdcOutFilm2",0,0,0);
360 G4VisAttributes* visAtt5=
new G4VisAttributes(G4Colour(0,0.5,0.5));
361 segment_log5->SetVisAttributes(visAtt5);
362 G4VPhysicalVolume* segment_phys5;
363 segment_phys5=
new G4PVPlacement(0,
364 G4ThreeVector(posX ,posY ,posZ),
365 segment_log5,
"PhysicalMdcOutFilm2",mdc_log,
false,0);
372 G4Tubs*fixTub=
new G4Tubs(
"solidFixTub",elecGeomPointer->
FixRing(0)*mm,elecGeomPointer->
FixRing(1)*mm,elecGeomPointer->
FixRing(2)/2.*mm,0.*deg,360.*deg);
373 G4LogicalVolume*fixTub_log=
new G4LogicalVolume(fixTub,Al,
"logicalFixTub");
374 G4VPhysicalVolume*fixTub_phys1=
new G4PVPlacement(0,G4ThreeVector(0,0,1134.5*mm),fixTub_log,
"physcalFixTub1",mdc_log,
false,0);
375 G4VPhysicalVolume*fixTub_phys2=
new G4PVPlacement(0,G4ThreeVector(0,0,-1134.5*mm),fixTub_log,
"physicalFixTub2",mdc_log,
false,0);
378 G4Element *Cu=G4Element::GetElement(
"Copper");
379 G4Element *Si=G4Element::GetElement(
"Silicon");
382 G4double boxDensityEndcape=1.9745*g/cm3;
383 G4int boxNcomponenEndcape=6;
384 G4Material *Cuu = G4Material::GetMaterial(
"Copper");
389 G4Element *Cl =
new G4Element(
"Chlorine",
"Cl",17.,35.5*g/mole);
390 G4Material*synEndcape=
new G4Material(
"M_synthesis",boxDensityEndcape,boxNcomponenEndcape);
391 synEndcape->AddElement(Cu,0.50);
392 synEndcape->AddElement(
C,0.134);
393 synEndcape->AddElement(
H,0.033);
394 synEndcape->AddElement(Si,0.11);
395 synEndcape->AddElement(Cl,0.014);
396 synEndcape->AddElement(O,0.209);
398 G4Box*boxEndcape=
new G4Box(
"solidboxEndcape",elecGeomPointer->
BoxEndcape(0)/2.*mm,elecGeomPointer->
BoxEndcape(1)/2.*mm,elecGeomPointer->
BoxEndcape(2)/2.*mm);
399 G4LogicalVolume*boxEndcape_log=
new G4LogicalVolume(boxEndcape,synEndcape,
"logical boxEndcape");
400 visAtt=
new G4VisAttributes(G4Colour(0.0,1.0,0.0));
401 boxEndcape_log->SetVisAttributes(visAtt);
404 double boxCuEndDx=8.5*mm;
405 double boxCuEndDy=12.*mm;
406 double boxCuEndDz=29.*mm;
408 G4Box* boxCuEnd=
new G4Box(
"solidboxCuEnd",boxCuEndDx/2.,boxCuEndDy/2.,boxCuEndDz/2.);
409 G4LogicalVolume*boxCuEnd_log=
new G4LogicalVolume(boxCuEnd,Cuu,
"logical boxCuEnd");
410 visAtt=
new G4VisAttributes(G4Colour(1.0,1.0,0.0));
411 boxCuEnd_log->SetVisAttributes(visAtt);
413 double dxVirtualBox=18.*mm;
414 double dyVirtualBox=106.*mm;
415 double dzVirtualBox=53.*mm;
416 G4Box*virtualBoxForEndcape=
new G4Box(
"solid virtualBoxEndcape",dxVirtualBox/2.,dyVirtualBox/2.*mm,dzVirtualBox/2.*mm);
417 G4LogicalVolume*virtualBoxForEndcape_log=
new G4LogicalVolume(virtualBoxForEndcape,G4Material::GetMaterial(
"Air"),
"logical virtualBoxEndcape");
419 virtualBoxForEndcape_log->SetVisAttributes(visAtt);
420 G4VPhysicalVolume*boxEndcape_phys=
new G4PVPlacement(0,G4ThreeVector(elecGeomPointer->
BoxEndcape(0)/2.,0,0),boxEndcape_log,
"physical boxEndcape",virtualBoxForEndcape_log,
false,0);
421 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);
422 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);
423 const double pi=3.141593;
427 double startAngleArray;
431 startAngleArray=acos(elecGeomPointer->
X(i)/elecGeomPointer->
R(i));
433 for(
int j=0;j<elecGeomPointer->
ElecNo(i);j++)
435 G4RotationMatrix*boxRotj=
new G4RotationMatrix;
436 boxRotj->rotateZ(-startAngleArray-j*2*
pi/elecGeomPointer->
ElecNo(i));
437 posXArray=elecGeomPointer->
R(i)*
cos((startAngleArray+j*2*
pi/elecGeomPointer->
ElecNo(i)));
438 posYArray=elecGeomPointer->
R(i)*
sin((startAngleArray+j*2*
pi/elecGeomPointer->
ElecNo(i)));
439 posZArray=elecGeomPointer->
Z(i);
440 std::ostringstream osnamephys;
441 osnamephys<<
"physicalLayer"<<i<<
"Ebox"<<j;
442 G4VPhysicalVolume*box_phys=
new G4PVPlacement(boxRotj,G4ThreeVector(posXArray,posYArray,posZArray),virtualBoxForEndcape_log,osnamephys.str(),mdc_log,
false,j);
448 G4double mCableDensity=6.4*g/cm3;
449 G4Material*materialCable=
new G4Material(
"M_materialCable",mCableDensity,3);
450 materialCable->AddElement(Cu,0.4);
451 materialCable->AddElement(
C,0.3);
452 materialCable->AddElement(
H,0.3);
454 double gapR=0.1*micrometer;
457 double innerRCableTub;
458 double outerRCableTub;
459 for(
int i=0;i<11;i++)
461 innerRCableTub=elecGeomPointer->
R(i)*mm-dxVirtualBox/2.+gapR;
462 outerRCableTub=elecGeomPointer->
R(i+1)*mm-dxVirtualBox/2.-gapR;
463 std::ostringstream osnameCableSolid;
464 osnameCableSolid<<
"MdcCableSolidWest"<<i;
465 G4Tubs*cableTub=
new G4Tubs(osnameCableSolid.str(),innerRCableTub,outerRCableTub,elecGeomPointer->
LengthCableTub(i+1)*1.15/2*mm,0*deg,360*deg);
467 std::ostringstream osnameCableLog;
468 osnameCableLog<<
"MdcCableLogWest"<<i;
469 G4LogicalVolume*cableTub_log=
new G4LogicalVolume(cableTub,materialCable,osnameCableLog.str());
470 visAtt=
new G4VisAttributes(G4Colour(1,0.3,0.5));
471 cableTub_log->SetVisAttributes(visAtt);
473 std::ostringstream osnameCablePhys;
474 osnameCablePhys<<
"MdcCablePhysWest"<<i;
475 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);
479 for(
int i=0;i<10;i++)
481 innerRCableTub=elecGeomPointer->
R(i+12)-dxVirtualBox/2.+gapR;
482 outerRCableTub=elecGeomPointer->
R(i+12+1)-dxVirtualBox/2.-gapR;
483 std::ostringstream osnameCableSolid;
484 osnameCableSolid<<
"MdcCableSolidEast"<<i;
485 G4Tubs*cableTub=
new G4Tubs(osnameCableSolid.str(),innerRCableTub,outerRCableTub,elecGeomPointer->
LengthCableTub(i+14)*1.15/2*mm,0*deg,360*deg);
487 std::ostringstream osnameCableLog;
488 osnameCableLog<<
"MdcCableLogEast"<<i;
489 G4LogicalVolume*cableTub_log=
new G4LogicalVolume(cableTub,materialCable,osnameCableLog.str());
490 visAtt=
new G4VisAttributes(G4Colour(1,0.3,0.5));
491 cableTub_log->SetVisAttributes(visAtt);
493 std::ostringstream osnameCablePhys;
494 osnameCablePhys<<
"MdcCablePhysEast"<<i;
495 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);
501 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);
502 G4LogicalVolume*cableTubBeginnerW_log=
new G4LogicalVolume(cableTubBeginnerW,materialCable,
"logical cableTubBeginnerW");
503 visAtt=
new G4VisAttributes(G4Colour(0,0.3,0.8));
504 cableTubBeginnerW_log->SetVisAttributes(visAtt);
505 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);
507 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);
508 G4LogicalVolume*cableTubBeginnerE_log=
new G4LogicalVolume(cableTubBeginnerE,materialCable,
"logical cabieTubBeginnerE");
509 visAtt=
new G4VisAttributes(G4Colour(1,0.3,0.5));
510 cableTubBeginnerE_log->SetVisAttributes(visAtt);
512 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);
517 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);
518 G4LogicalVolume*cableTubToTailW_log=
new G4LogicalVolume(cableTubToTailW,materialCable,
"logical cableTubToTailW");
519 visAtt=
new G4VisAttributes(G4Colour(0,0.3,0.8));
520 cableTubToTailW_log->SetVisAttributes(visAtt);
522 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);
524 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);
526 G4LogicalVolume*cableTubToTailE_log=
new G4LogicalVolume(cableTubToTailE,materialCable,
"logical cabieTubToTailE");
527 visAtt=
new G4VisAttributes(G4Colour(1.0,0.3,0.5));
528 cableTubToTailE_log->SetVisAttributes(visAtt);
530 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);
534 G4Box* box0=
new G4Box(
"box0",10.,15.,3.);
535 G4LogicalVolume* box0_log=
new G4LogicalVolume(box0,Al,
"logicalBox0",0,0,0);
536 visAtt=
new G4VisAttributes(G4Colour(1.0,0.8,0.0));
537 box0_log->SetVisAttributes(visAtt);
539 G4Box* box1=
new G4Box(
"box1",3.*
cos(11.28*deg),15.,81./
sin(11.28*deg)/2.);
540 G4LogicalVolume* box1_log=
new G4LogicalVolume(box1,Al,
"logicalBox1",0,0,0);
541 box1_log->SetVisAttributes(visAtt);
543 G4Box* box2=
new G4Box(
"box2",63.5,15.,3.);
544 G4LogicalVolume* box2_log=
new G4LogicalVolume(box2,Al,
"logicalBox2",0,0,0);
545 box2_log->SetVisAttributes(visAtt);
549 G4RotationMatrix* boxRot0=
new G4RotationMatrix();
550 boxRot0->rotateZ(-45*i*deg);
551 posX=784.*
cos(45*i*deg);
552 posY=784.*
sin(45*i*deg);
554 std::ostringstream osnameBox0PhysEast;
555 osnameBox0PhysEast<<
"physical"<<
"box0p"<<i;
556 G4VPhysicalVolume* box0p_phys=
new G4PVPlacement(boxRot0,G4ThreeVector(posX ,posY ,posZ),
557 box0_log,osnameBox0PhysEast.str(),mdc_log,
false,i);
559 std::ostringstream osnameBox0PhysWest;
560 osnameBox0PhysWest<<
"physical"<<
"box0m"<<i;
561 G4VPhysicalVolume* box0m_phys=
new G4PVPlacement(boxRot0,G4ThreeVector(posX ,posY ,-posZ),
562 box0_log,osnameBox0PhysWest.str(),mdc_log,
false,i);
565 G4RotationMatrix* boxRot1p=
new G4RotationMatrix();
566 boxRot1p->rotateZ(-45*i*deg);
567 boxRot1p->rotateY(-78.72*deg);
568 posX=570.5*
cos(45*i*deg);
569 posY=570.5*
sin(45*i*deg);
571 std::ostringstream osnameBox1PhysEast;
572 osnameBox1PhysEast<<
"physical"<<
"box1p"<<i;
573 G4VPhysicalVolume* box1p_phys=
new G4PVPlacement(boxRot1p,G4ThreeVector(posX ,posY ,posZ),
574 box1_log,osnameBox1PhysEast.str(),mdc_log,
false,i);
576 G4RotationMatrix* boxRot1m=
new G4RotationMatrix();
577 boxRot1m->rotateZ(-45*i*deg);
578 boxRot1m->rotateY(78.72*deg);
579 std::ostringstream osnameBox1PhysWest;
580 osnameBox1PhysWest<<
"physical"<<
"box1m"<<i;
581 G4VPhysicalVolume* box1m_phys=
new G4PVPlacement(boxRot1m,G4ThreeVector(posX ,posY ,-posZ),
582 box1_log,osnameBox1PhysWest.str(),mdc_log,
false,i);
584 G4RotationMatrix* boxRot2=
new G4RotationMatrix();
585 boxRot2->rotateZ(-45*i*deg);
586 posX=303.5*
cos(45*i*deg);
587 posY=303.5*
sin(45*i*deg);
589 std::ostringstream osnameBox2PhysEast;
590 osnameBox2PhysEast<<
"physical"<<
"box2p"<<i;
591 G4VPhysicalVolume* box2p_phys=
new G4PVPlacement(boxRot2,G4ThreeVector(posX ,posY ,posZ),
592 box2_log,osnameBox2PhysEast.str(),mdc_log,
false,i);
594 std::ostringstream osnameBox2PhysWest;
595 osnameBox2PhysWest<<
"physical"<<
"box2m"<<i;
596 G4VPhysicalVolume* box2m_phys=
new G4PVPlacement(boxRot2,G4ThreeVector(posX ,posY ,-posZ),
597 box2_log,osnameBox2PhysWest.str(),mdc_log,
false,i);
601 G4double rMax2=774.*mm;
602 G4double rMin2=rMax2 - 1.*mm/
sin(11.28*deg);
603 G4double rMin1=rMin2 - 80.*mm/
tan(11.28*deg);
604 G4double rMax1=rMin1 + 1.*mm/
sin(11.28*deg);
605 G4Cons* shieldPlate0p=
new G4Cons(
"shieldPlate0p",rMin1,rMax1,rMin2,rMax2,40.*mm,0.,360.*deg);
606 G4LogicalVolume* shieldPlate0p_log=
new G4LogicalVolume(shieldPlate0p,Al,
"logicalShieldPlate0p",0,0,0);
607 visAtt=
new G4VisAttributes(G4Colour(0.0,0.0,1.0));
608 shieldPlate0p_log->SetVisAttributes(visAtt);
612 G4VPhysicalVolume* shieldPlate0p_phys=
new G4PVPlacement(0,G4ThreeVector(posX ,posY ,posZ),
613 shieldPlate0p_log,
"physicalShieldPalte0p",mdc_log,
false,0);
615 G4Cons* shieldPlate0m=
new G4Cons(
"shieldPlate0m",rMin2,rMax2,rMin1,rMax1,40.*mm,0.,360.*deg);
616 G4LogicalVolume* shieldPlate0m_log=
new G4LogicalVolume(shieldPlate0m,Al,
"logicalShieldPlate0m",0,0,0);
617 visAtt=
new G4VisAttributes(G4Colour(0.0,0.0,1.0));
618 shieldPlate0m_log->SetVisAttributes(visAtt);
622 G4VPhysicalVolume* shieldPlate0m_phys=
new G4PVPlacement(0,G4ThreeVector(posX ,posY ,-posZ),
623 shieldPlate0m_log,
"physicalShieldPalte0m",mdc_log,
false,0);
626 G4Tubs* shieldPlate1=
new G4Tubs(
"shieldPlate1",240.*mm,367.*mm,0.5*mm,0.,360.*deg);
627 G4LogicalVolume* shieldPlate1_log=
new G4LogicalVolume(shieldPlate1,Al,
"logicalShieldPlate1",0,0,0);
628 visAtt=
new G4VisAttributes(G4Colour(1.0,0.0,0.0));
629 shieldPlate1_log->SetVisAttributes(visAtt);
633 G4VPhysicalVolume* shieldPlate1p_phys=
new G4PVPlacement(0,G4ThreeVector(posX ,posY ,posZ),
634 shieldPlate1_log,
"physicalShieldPalte1p",mdc_log,
false,0);
635 G4VPhysicalVolume* shieldPlate1m_phys=
new G4PVPlacement(0,G4ThreeVector(posX ,posY ,-posZ),
636 shieldPlate1_log,
"physicalShieldPalte1m",mdc_log,
false,0);
640 G4int signalLayer,firstWire;
644 G4double signalWireR=mdc->
SignalWireR()*micrometer;
645 G4double fieldWireR=mdc->
FieldWireR()*micrometer;
646 G4double thickOfAu=0.7*micrometer;
648 G4double innerLength,innerTwistAngle,innerTan,midInnerR,innerStereo;
649 G4double outLength,outTwistAngle,outTwistAngleFixed,outTan,midOutR,outStereo,outRFixed,outTanFixed;
652 for(i=42; i>35; i--){
656 innerR=mdc->
Layer(signalLayer-1+n).
R()*mm-fieldWireR;
657 outR=mdc->
Layer(signalLayer+n).
R()*mm-fieldWireR;
658 if(i==42&&n==1)outR=mdc->
Layer(signalLayer+n).
R()*mm+fieldWireR;
659 length=(mdc->
Layer(signalLayer-1+n).
Length())/2.*mm;
667 std::ostringstream osnameLayerSolid;
668 osnameLayerSolid <<
"solid"<<
"MdcAxialLayer"<<i<<
"_"<<n;
669 G4Tubs* axialLayer_tube=
new G4Tubs(osnameLayerSolid.str(),innerR,outR,length,startAngle,spanAngle);
671 std::ostringstream osnameLayerLogical;
672 osnameLayerLogical <<
"logical"<<
"MdcAxialLayer"<<i<<
"_"<<n;
673 G4LogicalVolume* axialLayer_log=
new G4LogicalVolume(axialLayer_tube, MdcGas,osnameLayerLogical.str(),0,0,0);
675 axialLayer_log->SetVisAttributes(G4VisAttributes::Invisible);
678 spanAngle=360./replicaNo*deg;
680 offset=mdc->
Layer(signalLayer).
Phi()*
rad-firstWire*spanAngle/2.;
681 G4RotationMatrix* layerRot=
new G4RotationMatrix();
682 layerRot->rotateZ(-offset);
684 std::ostringstream osnameLayerPhys;
685 osnameLayerPhys <<
"physical"<<
"MdcAxialLayer"<<i<<
"_"<<n;
686 G4VPhysicalVolume* axialLayer_phys;
687 axialLayer_phys=
new G4PVPlacement(layerRot,
689 axialLayer_log,osnameLayerPhys.str(),mdc_log,
false,i);
692 std::ostringstream osnameCellSolid;
693 osnameCellSolid<<
"solid"<<
"MdcAxialLayer"<<i<<
"_"<<n<<
"Cell";
694 G4Tubs* replica_tube=
new G4Tubs(osnameCellSolid.str(),innerR,outR,length,startAngle,spanAngle);
696 std::ostringstream osnameCellLogical;
697 osnameCellLogical<<
"logical"<<
"MdcAxialLayer"<<i<<
"_"<<n<<
"Cell";
698 G4LogicalVolume* replica_log=
new G4LogicalVolume(replica_tube,MdcGas,osnameCellLogical.str(),0,0,0);
700 replica_log->SetSensitiveDetector( aTrackerSD );
701 visAtt=
new G4VisAttributes(G4Colour(0.0,0.0,1.0));
702 replica_log->SetVisAttributes(visAtt);
703 replica_log->SetVisAttributes(G4VisAttributes::Invisible);
707 std::ostringstream osnameFieldWireSolid;
708 osnameFieldWireSolid<<
"solid"<<
"AxialLayer"<<i<<
"_"<<n<<
"FieldWire";
709 G4Tubs* fieldWire_tube=
new G4Tubs(osnameFieldWireSolid.str(),0.,fieldWireR,length,0.,360*deg);
710 std::ostringstream osnameFieldWireLogical;
711 osnameFieldWireLogical<<
"logical"<<
"AxialLayer"<<i<<
"_"<<n<<
"FieldWire";
712 G4LogicalVolume* fieldWire_log=
new G4LogicalVolume(fieldWire_tube,Au,osnameFieldWireLogical.str(),0,0,0);
714 std::ostringstream osnameFieldWireSubSolid;
715 osnameFieldWireSubSolid<<
"solid"<<
"AxialLayer"<<i<<
"_"<<n<<
"FieldWireSub";
716 G4Tubs* fieldWireSub_tube=
new G4Tubs(osnameFieldWireSubSolid.str(),0.,fieldWireR-thickOfAu,length,0.,360*deg);
717 std::ostringstream osnameFieldWireSubLogical;
718 osnameFieldWireSubLogical<<
"logical"<<
"AxialLayer"<<i<<
"_"<<n<<
"FieldWireSub";
719 G4LogicalVolume* fieldWireSub_log=
new G4LogicalVolume(fieldWireSub_tube,Al,osnameFieldWireSubLogical.str(),0,0,0);
720 std::ostringstream osnameFieldWireSubPhys;
721 osnameFieldWireSubPhys<<
"physical"<<
"AxialLayer"<<i<<
"_"<<n<<
"FieldWireSub";
722 G4VPhysicalVolume* fieldWireSub_phys;
723 fieldWireSub_phys=
new G4PVPlacement(0,0,fieldWireSub_log,
724 osnameFieldWireSubPhys.str(),fieldWire_log,
false,0);
726 std::ostringstream osnameFieldWireHalfSolid;
727 osnameFieldWireHalfSolid<<
"solid"<<
"AxialLayer"<<i<<
"_"<<n<<
"FieldWireHalf";
728 G4Tubs* fieldWireHalf_tube=
new G4Tubs(osnameFieldWireHalfSolid.str(),0.,fieldWireR,length,0.,180*deg);
729 std::ostringstream osnameFieldWireHalfLogical;
730 osnameFieldWireHalfLogical<<
"logical"<<
"AxialLayer"<<i<<
"_"<<n<<
"FieldWireHalf";
731 G4LogicalVolume* fieldWireHalf_log=
new G4LogicalVolume(fieldWireHalf_tube,Au,osnameFieldWireHalfLogical.str(),0,0,0);
733 std::ostringstream osnameFieldWireHalfSubSolid;
734 osnameFieldWireHalfSubSolid<<
"solid"<<
"AxialLayer"<<i<<
"_"<<n<<
"FieldWireHalfSub";
735 G4Tubs* fieldWireHalfSub_tube=
new G4Tubs(osnameFieldWireHalfSubSolid.str(),0.,fieldWireR-thickOfAu,length,0.,360*deg);
736 std::ostringstream osnameFieldWireHalfSubLogical;
737 osnameFieldWireHalfSubLogical<<
"logical"<<
"AxialLayer"<<i<<
"_"<<n<<
"FieldWireHalfSub";
738 G4LogicalVolume* fieldWireHalfSub_log=
new G4LogicalVolume(fieldWireHalfSub_tube,Al,osnameFieldWireHalfSubLogical.str(),0,0,0);
739 std::ostringstream osnameFieldWireHalfSubPhys;
740 osnameFieldWireHalfSubPhys<<
"physical"<<
"AxialLayer"<<i<<
"_"<<n<<
"FieldWireHalfSub";
741 G4VPhysicalVolume* fieldWireHalfSub_phys;
742 fieldWireHalfSub_phys=
new G4PVPlacement(0,0,fieldWireHalfSub_log,
743 osnameFieldWireHalfSubPhys.str(),fieldWireHalf_log,
false,0);
754 std::ostringstream osnameFieldWire0Phys;
755 osnameFieldWire0Phys<<
"physicalAxialLayer"<<i<<
"_"<<n<<
"FieldWire0";
756 posX=mdc->
Layer(signalLayer-1).
R()*mm;
757 G4VPhysicalVolume* fieldWire0_phys;
758 fieldWire0_phys=
new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log,
759 osnameFieldWire0Phys.str(),replica_log,
false,0);
761 std::ostringstream osnameFieldWire3Phys;
762 osnameFieldWire3Phys<<
"physicalAxialLayer"<<i<<
"_"<<n<<
"FieldWire3";
763 posX=mdc->
Layer(signalLayer-1).
R()*mm*
cos(spanAngle/2.);
764 posY=mdc->
Layer(signalLayer-1).
R()*mm*
sin(spanAngle/2.);
765 G4VPhysicalVolume* fieldWire3_phys;
766 fieldWire3_phys=
new G4PVPlacement(0,G4ThreeVector(posX,posY,0),fieldWire_log,
767 osnameFieldWire3Phys.str(),replica_log,
false,3);
768 std::ostringstream osnameFieldWire6Phys;
769 osnameFieldWire6Phys<<
"physicalAxialLayer"<<i<<
"_"<<n<<
"FieldWire6";
770 posX=mdc->
Layer(signalLayer-1).
R()*mm*
cos(spanAngle);
771 posY=mdc->
Layer(signalLayer-1).
R()*mm*
sin(spanAngle);
772 G4RotationMatrix* wireRot6=
new G4RotationMatrix();
773 wireRot6->rotateZ(180*deg-spanAngle);
774 G4VPhysicalVolume* fieldWire6_phys;
775 fieldWire6_phys=
new G4PVPlacement(wireRot6,G4ThreeVector(posX,posY,0),fieldWireHalf_log,
776 osnameFieldWire6Phys.str(),replica_log,
false,6);
780 std::ostringstream osnameFieldWire1Phys;
781 osnameFieldWire1Phys<<
"physicalAxialLayer"<<i<<
"_"<<n<<
"FieldWire1";
782 posX=mdc->
Layer(signalLayer).
R()*mm;
783 G4VPhysicalVolume* fieldWire1_phys;
784 fieldWire1_phys=
new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log,
785 osnameFieldWire1Phys.str(),replica_log,
false,1);
786 std::ostringstream osnameSignalWireSolid;
787 osnameSignalWireSolid<<
"solid"<<
"AxialLayer"<<i<<
"_"<<n<<
"SignalWire";
788 G4Tubs* signalWire_tube=
new G4Tubs(osnameSignalWireSolid.str(),0.,signalWireR,length,0.,360*deg);
789 std::ostringstream osnameSignalWireLogical;
790 osnameSignalWireLogical<<
"logical"<<
"AxialLayer"<<i<<
"_"<<n<<
"SignalWire";
791 G4LogicalVolume* signalWire_log=
new G4LogicalVolume(signalWire_tube,Au,osnameSignalWireLogical.str(),0,0,0);
793 std::ostringstream osnameSignalWireSubSolid;
794 osnameSignalWireSubSolid<<
"solid"<<
"AxialLayer"<<i<<
"_"<<n<<
"SignalWireSub";
795 G4Tubs* signalWireSub_tube=
new G4Tubs(osnameSignalWireSubSolid.str(),0.,signalWireR-thickOfAu,length,0.,360*deg);
796 std::ostringstream osnameSignalWireSubLogical;
797 osnameSignalWireSubLogical<<
"logical"<<
"AxialLayer"<<i<<
"_"<<n<<
"SignalWireSub";
798 G4LogicalVolume* signalWireSub_log=
new G4LogicalVolume(signalWireSub_tube,W,osnameSignalWireSubLogical.str(),0,0,0);
799 std::ostringstream osnameSignalWireSubPhys;
800 osnameSignalWireSubPhys<<
"physical"<<
"AxialLayer"<<i<<
"_"<<n<<
"SignalWireSub";
801 G4VPhysicalVolume* signalWireSub_phys;
802 signalWireSub_phys=
new G4PVPlacement(0,0,signalWireSub_log,
803 osnameSignalWireSubPhys.str(),signalWire_log,
false,0);
805 std::ostringstream osnameSignalWirePhys;
806 osnameSignalWirePhys<<
"physicalAxialLayer"<<i<<
"_"<<n<<
"SignalWire4";
807 posX=mdc->
Layer(signalLayer).
R()*mm*
cos(spanAngle/2.);
808 posY=mdc->
Layer(signalLayer).
R()*mm*
sin(spanAngle/2.);
809 G4VPhysicalVolume* signalWire_phys;
810 signalWire_phys=
new G4PVPlacement(0,G4ThreeVector(posX,posY,0),signalWire_log,
811 osnameSignalWirePhys.str(),replica_log,
false,4);
813 std::ostringstream osnameFieldWire7Phys;
814 osnameFieldWire7Phys<<
"physicalAxialLayer"<<i<<
"_"<<n<<
"FieldWire7";
815 posX=mdc->
Layer(signalLayer).
R()*mm*
cos(spanAngle);
816 posY=mdc->
Layer(signalLayer).
R()*mm*
sin(spanAngle);
817 G4RotationMatrix* wireRot7=
new G4RotationMatrix();
818 wireRot7->rotateZ(180*deg-spanAngle);
819 G4VPhysicalVolume* fieldWire7_phys;
820 fieldWire7_phys=
new G4PVPlacement(wireRot7,G4ThreeVector(posX,posY,0),fieldWireHalf_log,
821 osnameFieldWire7Phys.str(),replica_log,
false,7);
823 std::ostringstream osnameFieldWire2Phys;
824 osnameFieldWire2Phys<<
"physicalAxialLayer"<<i<<
"_"<<n<<
"FieldWire2";
825 posX=mdc->
Layer(signalLayer+1).
R()*mm;
826 G4VPhysicalVolume* fieldWire2_phys;
827 fieldWire2_phys=
new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log,
828 osnameFieldWire2Phys.str(),replica_log,
false,2);
830 std::ostringstream osnameFieldWire5Phys;
831 osnameFieldWire5Phys<<
"physicalAxialLayer"<<i<<
"_"<<n<<
"FieldWire5";
832 posX=mdc->
Layer(signalLayer+1).
R()*mm*
cos(spanAngle/2.);
833 posY=mdc->
Layer(signalLayer+1).
R()*mm*
sin(spanAngle/2.);
834 G4VPhysicalVolume* fieldWire5_phys;
835 fieldWire5_phys=
new G4PVPlacement(0,G4ThreeVector(posX,posY,0),fieldWire_log,
836 osnameFieldWire5Phys.str(),replica_log,
false,5);
838 std::ostringstream osnameFieldWire8Phys;
839 osnameFieldWire8Phys<<
"physicalAxialLayer"<<i<<
"_"<<n<<
"FieldWire8";
840 posX=mdc->
Layer(signalLayer+1).
R()*mm*
cos(spanAngle);
841 posY=mdc->
Layer(signalLayer+1).
R()*mm*
sin(spanAngle);
842 G4RotationMatrix* wireRot8=
new G4RotationMatrix();
843 wireRot8->rotateZ(180*deg-spanAngle);
844 G4VPhysicalVolume* fieldWire8_phys;
845 fieldWire8_phys=
new G4PVPlacement(wireRot8,G4ThreeVector(posX,posY,0),fieldWireHalf_log,
846 osnameFieldWire8Phys.str(),replica_log,
false,8);
851 for(j=replicaNo-1;j>-1;j--){
852 G4RotationMatrix* cellRot=
new G4RotationMatrix();
853 cellRot->rotateZ(-spanAngle*j);
854 std::ostringstream osnameCellPhys;
855 osnameCellPhys<<
"physical"<<
"MdcAxialLayer"<<i<<
"_"<<n<<
"Cell"<<j;
856 G4VPhysicalVolume* replica_phys;
857 replica_phys=
new G4PVPlacement(cellRot,0,replica_log,
858 osnameCellPhys.str(),axialLayer_log,
false,j);
866 for(i=35; i>19; i--){
869 innerR=mdc->
Layer(signalLayer-1).
R()*mm-fieldWireR;
870 outR=mdc->
Layer(signalLayer+1).
R()*mm-fieldWireR;
871 if(i==35)outR=mdc->
Layer(signalLayer+1).
R()*mm+fieldWireR;
873 innerLength=(mdc->
Layer(signalLayer-1).
Length())/2.*mm;
874 outLength=(mdc->
Layer(signalLayer+1).
Length())/2.*mm;
879 innerTan=innerR/innerLength*
sin(innerTwistAngle);
881 midInnerR=innerR*
cos(innerTwistAngle);
882 innerStereo=atan(innerTan);
884 outTan=outR/outLength*
sin(outTwistAngle);
885 outTwistAngleFixed=atan(innerLength/outLength*
tan(outTwistAngle));
887 if(
abs(outTwistAngleFixed) >=
abs(innerTwistAngle)){
888 midOutR=outR*
cos(outTwistAngle);
889 outRFixed=midOutR/
cos(innerTwistAngle);
892 outTanFixed=midOutR/innerLength*
tan(innerTwistAngle);
893 outStereo=atan(outTanFixed);
895 outRFixed=sqrt(outR*outR+(innerLength*innerLength-outLength*outLength)*outTan*outTan);
897 midOutR=outR*
cos(innerTwistAngle);
899 outTanFixed=outRFixed/innerLength*
sin(innerTwistAngle);
900 outStereo=atan(outTanFixed);
903 std::ostringstream osnameLayerSolid;
904 osnameLayerSolid <<
"solid"<<
"MdcStereoLayer"<<i;
906 G4Hype* stereoLayer_hype=
new G4Hype(osnameLayerSolid.str(),midInnerR, midOutR,innerStereo,
907 outStereo,innerLength);
909 std::ostringstream osnameLayerLogical;
910 osnameLayerLogical <<
"logical"<<
"MdcStereoLayer"<<i;
911 G4LogicalVolume* stereoLayer_log=
new G4LogicalVolume(stereoLayer_hype,MdcGas,
912 osnameLayerLogical.str(),0,0,0);
913 stereoLayer_log->SetVisAttributes(G4VisAttributes::Invisible);
916 spanAngle=360./replicaNo*deg;
919 G4RotationMatrix* layerRot=
new G4RotationMatrix();
920 layerRot->rotateZ(-(spanAngle*(1-firstWire)/2.+innerTwistAngle));
922 std::ostringstream osnameLayerPhys;
923 osnameLayerPhys<<
"physical"<<
"MdcStereoLayer"<<i;
924 G4VPhysicalVolume* stereoLayer_phys;
925 stereoLayer_phys=
new G4PVPlacement(layerRot,0,stereoLayer_log,osnameLayerPhys.str(),
928 std::ostringstream osnameCellSolid;
929 osnameCellSolid<<
"solid"<<
"MdcStereoLayer"<<i<<
"Cell";
931 G4TwistedTubs* twistTub=
new G4TwistedTubs(osnameCellSolid.str(), -innerTwistAngle*2, innerR,outR-1.0*micrometer,innerLength,spanAngle);
933 std::ostringstream osnameCellLogical;
934 osnameCellLogical<<
"logical"<<
"MdcStereoLayer"<<i<<
"Cell";
935 G4LogicalVolume* twistTub_log=
new G4LogicalVolume(twistTub, MdcGas,osnameCellLogical.str(),0,0,0);
937 twistTub_log->SetVisAttributes(G4VisAttributes::Invisible);
938 twistTub_log->SetSensitiveDetector( aTrackerSD );
943 std::ostringstream osnameFieldWireSolid;
944 osnameFieldWireSolid<<
"solid"<<
"StereoLayer"<<i<<
"FieldWire";
945 G4Tubs* fieldWire_tube=
new G4Tubs(osnameFieldWireSolid.str(),0.,fieldWireR,innerLength,0.,360*deg);
946 std::ostringstream osnameFieldWireLogical;
947 osnameFieldWireLogical<<
"logical"<<
"StereoLayer"<<i<<
"FieldWire";
948 G4LogicalVolume* fieldWire_log=
new G4LogicalVolume(fieldWire_tube,Au,osnameFieldWireLogical.str(),0,0,0);
950 std::ostringstream osnameFieldWireSubSolid;
951 osnameFieldWireSubSolid<<
"solid"<<
"StereoLayer"<<i<<
"FieldWireSub";
952 G4Tubs* fieldWireSub_tube=
new G4Tubs(osnameFieldWireSubSolid.str(),0.,fieldWireR-thickOfAu,innerLength,0.,360*deg);
953 std::ostringstream osnameFieldWireSubLogical;
954 osnameFieldWireSubLogical<<
"logical"<<
"StereoLayer"<<i<<
"FieldWireSub";
955 G4LogicalVolume* fieldWireSub_log=
new G4LogicalVolume(fieldWireSub_tube,Al,osnameFieldWireSubLogical.str(),0,0,0);
956 std::ostringstream osnameFieldWireSubPhys;
957 osnameFieldWireSubPhys<<
"physical"<<
"StereoLayer"<<i<<
"FieldWireSub";
958 G4VPhysicalVolume* fieldWireSub_phys;
959 fieldWireSub_phys=
new G4PVPlacement(0,0,fieldWireSub_log,
960 osnameFieldWireSubPhys.str(),fieldWire_log,
false,0);
962 std::ostringstream osnameSignalWireSolid;
963 osnameSignalWireSolid<<
"solid"<<
"StereoLayer"<<i<<
"SignalWire";
964 G4Tubs* signalWire_tube=
new G4Tubs(osnameSignalWireSolid.str(),0.,signalWireR,innerLength,0.,360*deg);
965 std::ostringstream osnameSignalWireLogical;
966 osnameSignalWireLogical<<
"logical"<<
"StereoLayer"<<i<<
"SignalWire";
967 G4LogicalVolume* signalWire_log=
new G4LogicalVolume(signalWire_tube,Au,osnameSignalWireLogical.str(),0,0,0);
969 std::ostringstream osnameSignalWireSubSolid;
970 osnameSignalWireSubSolid<<
"solid"<<
"StereoLayer"<<i<<
"SignalWireSub";
971 G4Tubs* signalWireSub_tube=
new G4Tubs(osnameSignalWireSubSolid.str(),0.,signalWireR-thickOfAu,innerLength,0.,360*deg);
972 std::ostringstream osnameSignalWireSubLogical;
973 osnameSignalWireSubLogical<<
"logical"<<
"StereoLayer"<<i<<
"SignalWireSub";
974 G4LogicalVolume* signalWireSub_log=
new G4LogicalVolume(signalWireSub_tube,W,osnameSignalWireSubLogical.str(),0,0,0);
975 std::ostringstream osnameSignalWireSubPhys;
976 osnameSignalWireSubPhys<<
"physical"<<
"StereoLayer"<<i<<
"SignalWireSub";
977 G4VPhysicalVolume* signalWireSub_phys;
978 signalWireSub_phys=
new G4PVPlacement(0,0,signalWireSub_log,
979 osnameSignalWireSubPhys.str(),signalWire_log,
false,0);
988 G4double shiftR,midR,eastX,eastY,westX,westY;
989 shiftR=fieldWireR+1*micrometer;
990 midR=mdc->
Layer(signalLayer).
R()*mm;
992 std::ostringstream osnameFieldWire0Phys;
993 osnameFieldWire0Phys<<
"physicalStereoLayer"<<i<<
"FieldWire0";
995 eastX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg-innerTwistAngle);
996 eastY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle)+shiftR*
sin(90*deg-innerTwistAngle);
997 westX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg+innerTwistAngle);
998 westY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle)+shiftR*
sin(90*deg+innerTwistAngle);
1000 G4ThreeVector east0(eastX,eastY,innerLength);
1001 G4ThreeVector west0(westX,westY,-innerLength);
1002 east0.rotateZ(-spanAngle/2.);
1003 west0.rotateZ(-spanAngle/2.);
1005 posX=(east0.x()+west0.x())/2.;
1006 posY=(east0.y()+west0.y())/2.;
1007 G4ThreeVector line0=east0-west0;
1008 G4RotationMatrix* wireRot0=
new G4RotationMatrix();
1009 wireRot0->rotateZ(-line0.phi());
1010 wireRot0->rotateY(-line0.theta());
1011 G4VPhysicalVolume* fieldWire0_phys;
1012 fieldWire0_phys=
new G4PVPlacement(wireRot0,G4ThreeVector(posX,posY,0),fieldWire_log,
1013 osnameFieldWire0Phys.str(),twistTub_log,
false,0);
1015 std::ostringstream osnameFieldWire1Phys;
1016 osnameFieldWire1Phys<<
"physicalStereoLayer"<<i<<
"FieldWire1";
1017 eastX=midR*
cos(innerTwistAngle)+shiftR*
cos(90*deg-innerTwistAngle);
1018 eastY=midR*
sin(-innerTwistAngle)+shiftR*
sin(90*deg-innerTwistAngle);
1019 westX=midR*
cos(innerTwistAngle)+shiftR*
cos(90*deg+innerTwistAngle);
1020 westY=midR*
sin(innerTwistAngle)+shiftR*
sin(90*deg+innerTwistAngle);
1021 G4ThreeVector east1(eastX,eastY,innerLength);
1022 G4ThreeVector west1(westX,westY,-innerLength);
1023 east1.rotateZ(-spanAngle/2.);
1024 west1.rotateZ(-spanAngle/2.);
1025 posX=(east1.x()+west1.x())/2.;
1026 posY=(east1.y()+west1.y())/2.;
1027 G4ThreeVector line1=east1-west1;
1028 G4RotationMatrix* wireRot1=
new G4RotationMatrix();
1029 wireRot1->rotateZ(-line1.phi());
1030 wireRot1->rotateY(-line1.theta());
1031 G4VPhysicalVolume* fieldWire1_phys;
1032 fieldWire1_phys=
new G4PVPlacement(wireRot1,G4ThreeVector(posX,posY,0),fieldWire_log,
1033 osnameFieldWire1Phys.str(),twistTub_log,
false,1);
1035 std::ostringstream osnameFieldWire3Phys;
1036 osnameFieldWire3Phys<<
"physicalStereoLayer"<<i<<
"FieldWire3";
1038 eastX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1039 eastY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle);
1040 westX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1041 westY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle);
1043 G4ThreeVector east3(eastX,eastY,innerLength);
1044 G4ThreeVector west3(westX,westY,-innerLength);
1046 posX=(east3.x()+west3.x())/2.;
1047 posY=(east3.y()+west3.y())/2.;
1048 G4ThreeVector line3=east3-west3;
1049 G4RotationMatrix* wireRot3=
new G4RotationMatrix();
1050 wireRot3->rotateZ(-line3.phi());
1051 wireRot3->rotateY(-line3.theta());
1052 G4VPhysicalVolume* fieldWire3_phys;
1053 fieldWire3_phys=
new G4PVPlacement(wireRot3,G4ThreeVector(posX,posY,0),fieldWire_log,
1054 osnameFieldWire3Phys.str(),twistTub_log,
false,3);
1056 std::ostringstream osnameSignalWire4Phys;
1057 osnameSignalWire4Phys<<
"physicalStereoLayer"<<i<<
"SignalWire4";
1059 eastX=midR*
cos(innerTwistAngle);
1060 eastY=midR*
sin(-innerTwistAngle);
1061 westX=midR*
cos(innerTwistAngle);
1062 westY=midR*
sin(innerTwistAngle);
1064 G4ThreeVector east4(eastX,eastY,innerLength);
1065 G4ThreeVector west4(westX,westY,-innerLength);
1067 posX=(east4.x()+west4.x())/2.;
1068 posY=(east4.y()+west4.y())/2.;
1069 G4ThreeVector line4=east4-west4;
1070 G4RotationMatrix* wireRot4=
new G4RotationMatrix();
1071 wireRot4->rotateZ(-line4.phi());
1072 wireRot4->rotateY(-line4.theta());
1073 G4VPhysicalVolume* signalWire4_phys;
1074 signalWire4_phys=
new G4PVPlacement(wireRot4,G4ThreeVector(posX,posY,0),signalWire_log,
1075 osnameSignalWire4Phys.str(),twistTub_log,
false,4);
1078 std::ostringstream osnameFieldWire2Phys;
1079 osnameFieldWire2Phys<<
"physicalStereoLayer"<<i<<
"FieldWire2";
1081 eastX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg-innerTwistAngle);
1082 eastY=(outR-shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle)+shiftR*
sin(90*deg-innerTwistAngle);
1083 westX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg+innerTwistAngle);
1084 westY=(outR-shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle)+shiftR*
sin(90*deg+innerTwistAngle);
1086 G4ThreeVector east2(eastX,eastY,innerLength);
1087 G4ThreeVector west2(westX,westY,-innerLength);
1088 east2.rotateZ(-spanAngle/2.);
1089 west2.rotateZ(-spanAngle/2.);
1091 posX=(east2.x()+west2.x())/2.;
1092 posY=(east2.y()+west2.y())/2.;
1093 G4ThreeVector line2=east2-west2;
1094 G4RotationMatrix* wireRot2=
new G4RotationMatrix();
1095 wireRot2->rotateZ(-line2.phi());
1096 wireRot2->rotateY(-line2.theta());
1097 G4VPhysicalVolume* fieldWire2_phys;
1098 fieldWire2_phys=
new G4PVPlacement(wireRot2,G4ThreeVector(posX,posY,0),fieldWire_log,
1099 osnameFieldWire2Phys.str(),twistTub_log,
false,2);
1101 std::ostringstream osnameFieldWire5Phys;
1102 osnameFieldWire5Phys<<
"physicalStereoLayer"<<i<<
"FieldWire5";
1104 eastX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1105 eastY=(outR-shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle);
1106 westX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1107 westY=(outR-shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle);
1109 G4ThreeVector east5(eastX,eastY,innerLength);
1110 G4ThreeVector west5(westX,westY,-innerLength);
1112 posX=(east5.x()+west5.x())/2.;
1113 posY=(east5.y()+west5.y())/2.;
1114 G4ThreeVector line5=east5-west5;
1115 G4RotationMatrix* wireRot5=
new G4RotationMatrix();
1116 wireRot5->rotateZ(-line5.phi());
1117 wireRot5->rotateY(-line5.theta());
1118 G4VPhysicalVolume* fieldWire5_phys;
1119 fieldWire5_phys=
new G4PVPlacement(wireRot5,G4ThreeVector(posX,posY,0),fieldWire_log,
1120 osnameFieldWire5Phys.str(),twistTub_log,
false,5);
1124 for(j=replicaNo-1;j>-1;j--){
1125 G4RotationMatrix* cellRot=
new G4RotationMatrix();
1126 cellRot->rotateZ(-spanAngle*j);
1128 std::ostringstream osnameCellPhys;
1129 osnameCellPhys<<
"physical"<<
"MdcStereoLayer"<<i<<
"Cell"<<j;
1130 G4VPhysicalVolume* twistTub_phys;
1131 twistTub_phys=
new G4PVPlacement(cellRot,0,twistTub_log,
1132 osnameCellPhys.str(),stereoLayer_log,
false,j);
1137 for(i=19; i>7; i--){
1139 innerR=mdc->
Layer(signalLayer-1).
R()*mm-fieldWireR;
1140 outR=mdc->
Layer(signalLayer+1).
R()*mm-fieldWireR;
1141 if(i==19)outR=mdc->
Layer(signalLayer+1).
R()*mm+fieldWireR;
1151 std::ostringstream osnameLayerSolid;
1152 osnameLayerSolid <<
"solid"<<
"MdcAxialLayer"<<i;
1153 G4Tubs* axialLayer_tube=
new G4Tubs(osnameLayerSolid.str(),innerR,outR,length,startAngle,spanAngle);
1155 std::ostringstream osnameLayerLogical;
1156 osnameLayerLogical <<
"logical"<<
"MdcAxialLayer"<<i;
1157 G4LogicalVolume* axialLayer_log=
new G4LogicalVolume(axialLayer_tube, MdcGas,osnameLayerLogical.str(),0,0,0);
1158 axialLayer_log->SetVisAttributes(G4VisAttributes::Invisible);
1161 spanAngle=360./replicaNo*deg;
1163 offset=mdc->
Layer(signalLayer).
Phi()*
rad-firstWire*spanAngle/2.;
1164 G4RotationMatrix* layerRot=
new G4RotationMatrix();
1165 layerRot->rotateZ(-offset);
1167 std::ostringstream osnameLayerPhys;
1168 osnameLayerPhys<<
"physical"<<
"MdcAxialLayer"<<i;
1169 G4VPhysicalVolume* axialLayer_phys;
1170 axialLayer_phys=
new G4PVPlacement(layerRot,0,axialLayer_log,
1171 osnameLayerPhys.str(),mdc_log,
false,i);
1174 std::ostringstream osnameCellSolid;
1175 osnameCellSolid<<
"solid"<<
"MdcAxialLayer"<<i<<
"Cell";
1176 G4Tubs* replica_tube=
new G4Tubs(osnameCellSolid.str(),innerR,outR,length,startAngle,spanAngle);
1178 std::ostringstream osnameCellLogical;
1179 osnameCellLogical<<
"logical"<<
"MdcAxialLayer"<<i<<
"Cell";
1180 G4LogicalVolume* replica_log=
new G4LogicalVolume(replica_tube,MdcGas,osnameCellLogical.str(),0,0,0);
1182 replica_log->SetSensitiveDetector( aTrackerSD );
1183 visAtt=
new G4VisAttributes(G4Colour(0.0,0.0,1.0));
1184 replica_log->SetVisAttributes(visAtt);
1185 replica_log->SetVisAttributes(G4VisAttributes::Invisible);
1189 std::ostringstream osnameFieldWireSolid;
1190 osnameFieldWireSolid<<
"solid"<<
"AxialLayer"<<i<<
"FieldWire";
1191 G4Tubs* fieldWire_tube=
new G4Tubs(osnameFieldWireSolid.str(),0.,fieldWireR,length,0.,360*deg);
1192 std::ostringstream osnameFieldWireLogical;
1193 osnameFieldWireLogical<<
"logical"<<
"AxialLayer"<<i<<
"FieldWire";
1194 G4LogicalVolume* fieldWire_log=
new G4LogicalVolume(fieldWire_tube,Au,osnameFieldWireLogical.str(),0,0,0);
1196 std::ostringstream osnameFieldWireSubSolid;
1197 osnameFieldWireSubSolid<<
"solid"<<
"AxialLayer"<<i<<
"FieldWireSub";
1198 G4Tubs* fieldWireSub_tube=
new G4Tubs(osnameFieldWireSubSolid.str(),0.,fieldWireR-thickOfAu,length,0.,360*deg);
1199 std::ostringstream osnameFieldWireSubLogical;
1200 osnameFieldWireSubLogical<<
"logical"<<
"AxialLayer"<<i<<
"FieldWireSub";
1201 G4LogicalVolume* fieldWireSub_log=
new G4LogicalVolume(fieldWireSub_tube,Al,osnameFieldWireSubLogical.str(),0,0,0);
1202 std::ostringstream osnameFieldWireSubPhys;
1203 osnameFieldWireSubPhys<<
"physical"<<
"AxialLayer"<<i<<
"FieldWireSub";
1204 G4VPhysicalVolume* fieldWireSub_phys;
1205 fieldWireSub_phys=
new G4PVPlacement(0,0,fieldWireSub_log,
1206 osnameFieldWireSubPhys.str(),fieldWire_log,
false,0);
1208 std::ostringstream osnameFieldWireHalfSolid;
1209 osnameFieldWireHalfSolid<<
"solid"<<
"AxialLayer"<<i<<
"FieldWireHalf";
1210 G4Tubs* fieldWireHalf_tube=
new G4Tubs(osnameFieldWireHalfSolid.str(),0.,fieldWireR,length,0.,180*deg);
1211 std::ostringstream osnameFieldWireHalfLogical;
1212 osnameFieldWireHalfLogical<<
"logical"<<
"AxialLayer"<<i<<
"FieldWireHalf";
1213 G4LogicalVolume* fieldWireHalf_log=
new G4LogicalVolume(fieldWireHalf_tube,Au,osnameFieldWireHalfLogical.str(),0,0,0);
1215 std::ostringstream osnameFieldWireHalfSubSolid;
1216 osnameFieldWireHalfSubSolid<<
"solid"<<
"AxialLayer"<<i<<
"FieldWireHalfSub";
1217 G4Tubs* fieldWireHalfSub_tube=
new G4Tubs(osnameFieldWireHalfSubSolid.str(),0.,fieldWireR-thickOfAu,length,0.,360*deg);
1218 std::ostringstream osnameFieldWireHalfSubLogical;
1219 osnameFieldWireHalfSubLogical<<
"logical"<<
"AxialLayer"<<i<<
"FieldWireHalfSub";
1220 G4LogicalVolume* fieldWireHalfSub_log=
new G4LogicalVolume(fieldWireHalfSub_tube,Al,osnameFieldWireHalfSubLogical.str(),0,0,0);
1221 std::ostringstream osnameFieldWireHalfSubPhys;
1222 osnameFieldWireHalfSubPhys<<
"physical"<<
"AxialLayer"<<i<<
"FieldWireHalfSub";
1223 G4VPhysicalVolume* fieldWireHalfSub_phys;
1224 fieldWireHalfSub_phys=
new G4PVPlacement(0,0,fieldWireHalfSub_log,
1225 osnameFieldWireHalfSubPhys.str(),fieldWireHalf_log,
false,0);
1227 std::ostringstream osnameSignalWireSolid;
1228 osnameSignalWireSolid<<
"solid"<<
"AxialLayer"<<i<<
"SignalWire";
1229 G4Tubs* signalWire_tube=
new G4Tubs(osnameSignalWireSolid.str(),0.,signalWireR,length,0.,360*deg);
1230 std::ostringstream osnameSignalWireLogical;
1231 osnameSignalWireLogical<<
"logical"<<
"AxialLayer"<<i<<
"SignalWire";
1232 G4LogicalVolume* signalWire_log=
new G4LogicalVolume(signalWire_tube,Au,osnameSignalWireLogical.str(),0,0,0);
1234 std::ostringstream osnameSignalWireSubSolid;
1235 osnameSignalWireSubSolid<<
"solid"<<
"AxialLayer"<<i<<
"SignalWireSub";
1236 G4Tubs* signalWireSub_tube=
new G4Tubs(osnameSignalWireSubSolid.str(),0.,signalWireR-thickOfAu,length,0.,360*deg);
1237 std::ostringstream osnameSignalWireSubLogical;
1238 osnameSignalWireSubLogical<<
"logical"<<
"AxialLayer"<<i<<
"SignalWireSub";
1239 G4LogicalVolume* signalWireSub_log=
new G4LogicalVolume(signalWireSub_tube,W,osnameSignalWireSubLogical.str(),0,0,0);
1240 std::ostringstream osnameSignalWireSubPhys;
1241 osnameSignalWireSubPhys<<
"physical"<<
"AxialLayer"<<i<<
"SignalWireSub";
1242 G4VPhysicalVolume* signalWireSub_phys;
1243 signalWireSub_phys=
new G4PVPlacement(0,0,signalWireSub_log,
1244 osnameSignalWireSubPhys.str(),signalWire_log,
false,0);
1253 std::ostringstream osnameFieldWire0Phys;
1254 osnameFieldWire0Phys<<
"physicalAxialLayer"<<i<<
"FieldWire0";
1255 posX=mdc->
Layer(signalLayer-1).
R()*mm;
1256 G4VPhysicalVolume* fieldWire0_phys;
1257 fieldWire0_phys=
new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log,
1258 osnameFieldWire0Phys.str(),replica_log,
false,0);
1260 std::ostringstream osnameFieldWire1Phys;
1261 osnameFieldWire1Phys<<
"physicalAxialLayer"<<i<<
"FieldWire1";
1262 posX=mdc->
Layer(signalLayer).
R()*mm;
1263 G4VPhysicalVolume* fieldWire1_phys;
1264 fieldWire1_phys=
new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log,
1265 osnameFieldWire1Phys.str(),replica_log,
false,1);
1268 std::ostringstream osnameFieldWire2Phys;
1269 osnameFieldWire2Phys<<
"physicalAxialLayer"<<i<<
"FieldWire2";
1270 posX=mdc->
Layer(signalLayer+1).
R()*mm;
1271 G4VPhysicalVolume* fieldWire2_phys;
1272 fieldWire2_phys=
new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log,
1273 osnameFieldWire2Phys.str(),replica_log,
false,2);
1276 std::ostringstream osnameFieldWire3Phys;
1277 osnameFieldWire3Phys<<
"physicalAxialLayer"<<i<<
"FieldWire3";
1278 posX=mdc->
Layer(signalLayer-1).
R()*mm*
cos(spanAngle/2.);
1279 posY=mdc->
Layer(signalLayer-1).
R()*mm*
sin(spanAngle/2.);
1280 G4VPhysicalVolume* fieldWire3_phys;
1281 fieldWire3_phys=
new G4PVPlacement(0,G4ThreeVector(posX,posY,0),fieldWire_log,
1282 osnameFieldWire3Phys.str(),replica_log,
false,3);
1284 std::ostringstream osnameSignalWirePhys;
1285 osnameSignalWirePhys<<
"physicalAxialLayer"<<i<<
"SignalWire4";
1286 posX=mdc->
Layer(signalLayer).
R()*mm*
cos(spanAngle/2.);
1287 posY=mdc->
Layer(signalLayer).
R()*mm*
sin(spanAngle/2.);
1288 G4VPhysicalVolume* signalWire_phys;
1289 signalWire_phys=
new G4PVPlacement(0,G4ThreeVector(posX,posY,0),signalWire_log,
1290 osnameSignalWirePhys.str(),replica_log,
false,4);
1293 std::ostringstream osnameFieldWire5Phys;
1294 osnameFieldWire5Phys<<
"physicalAxialLayer"<<i<<
"FieldWire5";
1295 posX=mdc->
Layer(signalLayer+1).
R()*mm*
cos(spanAngle/2.);
1296 posY=mdc->
Layer(signalLayer+1).
R()*mm*
sin(spanAngle/2.);
1297 G4VPhysicalVolume* fieldWire5_phys;
1298 fieldWire5_phys=
new G4PVPlacement(0,G4ThreeVector(posX,posY,0),fieldWire_log,
1299 osnameFieldWire5Phys.str(),replica_log,
false,5);
1302 std::ostringstream osnameFieldWire6Phys;
1303 osnameFieldWire6Phys<<
"physicalAxialLayer"<<i<<
"FieldWire6";
1304 posX=mdc->
Layer(signalLayer-1).
R()*mm*
cos(spanAngle);
1305 posY=mdc->
Layer(signalLayer-1).
R()*mm*
sin(spanAngle);
1306 G4RotationMatrix* wireRot6=
new G4RotationMatrix();
1307 wireRot6->rotateZ(180*deg-spanAngle);
1308 G4VPhysicalVolume* fieldWire6_phys;
1309 fieldWire6_phys=
new G4PVPlacement(wireRot6,G4ThreeVector(posX,posY,0),fieldWireHalf_log,
1310 osnameFieldWire6Phys.str(),replica_log,
false,6);
1312 std::ostringstream osnameFieldWire7Phys;
1313 osnameFieldWire7Phys<<
"physicalAxialLayer"<<i<<
"FieldWire7";
1314 posX=mdc->
Layer(signalLayer).
R()*mm*
cos(spanAngle);
1315 posY=mdc->
Layer(signalLayer).
R()*mm*
sin(spanAngle);
1316 G4RotationMatrix* wireRot7=
new G4RotationMatrix();
1317 wireRot7->rotateZ(180*deg-spanAngle);
1318 G4VPhysicalVolume* fieldWire7_phys;
1319 fieldWire7_phys=
new G4PVPlacement(wireRot7,G4ThreeVector(posX,posY,0),fieldWireHalf_log,
1320 osnameFieldWire7Phys.str(),replica_log,
false,7);
1323 std::ostringstream osnameFieldWire8Phys;
1324 osnameFieldWire8Phys<<
"physicalAxialLayer"<<i<<
"FieldWire8";
1325 posX=mdc->
Layer(signalLayer+1).
R()*mm*
cos(spanAngle);
1326 posY=mdc->
Layer(signalLayer+1).
R()*mm*
sin(spanAngle);
1327 G4RotationMatrix* wireRot8=
new G4RotationMatrix();
1328 wireRot8->rotateZ(180*deg-spanAngle);
1329 G4VPhysicalVolume* fieldWire8_phys;
1330 fieldWire8_phys=
new G4PVPlacement(wireRot8,G4ThreeVector(posX,posY,0),fieldWireHalf_log,
1331 osnameFieldWire8Phys.str(),replica_log,
false,8);
1335 for(j=replicaNo-1;j>-1;j--){
1336 G4RotationMatrix* cellRot=
new G4RotationMatrix();
1337 cellRot->rotateZ(-spanAngle*j);
1339 std::ostringstream osnameCellPhys;
1340 osnameCellPhys<<
"physical"<<
"MdcAxialLayer"<<i<<
"Cell"<<j;
1341 G4VPhysicalVolume* replica_phys;
1342 replica_phys=
new G4PVPlacement(cellRot,0,replica_log,
1343 osnameCellPhys.str(),axialLayer_log,
false,j);
1348 for(i=7; i>-1; i--){
1351 innerR=mdc->
Layer(signalLayer-1).
R()*mm-fieldWireR;
1352 outR=mdc->
Layer(signalLayer+1).
R()*mm-fieldWireR;
1353 if(i==7)outR=mdc->
Layer(signalLayer+1).
R()*mm+fieldWireR;
1355 innerLength=(mdc->
Layer(signalLayer-1).
Length())/2.*mm;
1356 outLength=(mdc->
Layer(signalLayer+1).
Length())/2.*mm;
1361 innerTan=innerR/innerLength*
sin(innerTwistAngle);
1363 midInnerR=innerR*
cos(innerTwistAngle);
1364 innerStereo=atan(innerTan);
1366 outTan=outR/outLength*
sin(outTwistAngle);
1367 outTwistAngleFixed=atan(innerLength/outLength*
tan(outTwistAngle));
1369 if(
abs(outTwistAngleFixed) >=
abs(innerTwistAngle)){
1370 midOutR=outR*
cos(outTwistAngle);
1371 outRFixed=midOutR/
cos(innerTwistAngle);
1374 outTanFixed=midOutR/innerLength*
tan(innerTwistAngle);
1375 outStereo=atan(outTanFixed);
1377 outRFixed=sqrt(outR*outR+(innerLength*innerLength-outLength*outLength)*outTan*outTan);
1379 midOutR=outR*
cos(innerTwistAngle);
1381 outTanFixed=outRFixed/innerLength*
sin(innerTwistAngle);
1382 outStereo=atan(outTanFixed);
1386 std::ostringstream osnameLayerSolid;
1387 osnameLayerSolid <<
"solid"<<
"MdcStereoLayer"<<i;
1389 G4Hype* stereoLayer_hype=
new G4Hype(osnameLayerSolid.str(),midInnerR, midOutR,innerStereo,
1390 outStereo,innerLength);
1391 std::ostringstream osnameLayerLogical;
1392 osnameLayerLogical <<
"logical"<<
"MdcStereoLayer"<<i;
1393 G4LogicalVolume* stereoLayer_log=
new G4LogicalVolume(stereoLayer_hype,MdcGas,
1394 osnameLayerLogical.str(),0,0,0);
1395 stereoLayer_log->SetVisAttributes(G4VisAttributes::Invisible);
1398 spanAngle=360./replicaNo*deg;
1401 G4RotationMatrix* layerRot=
new G4RotationMatrix();
1402 layerRot->rotateZ(-(spanAngle*(1-firstWire)/2.+innerTwistAngle));
1404 std::ostringstream osnameLayerPhys;
1405 osnameLayerPhys<<
"physical"<<
"MdcStereoLayer"<<i;
1407 G4VPhysicalVolume* stereoLayer_phys;
1408 stereoLayer_phys=
new G4PVPlacement(layerRot,0,stereoLayer_log,osnameLayerPhys.str(),
1412 std::ostringstream osnameCellSolid;
1413 osnameCellSolid<<
"solid"<<
"MdcStereoLayer"<<i<<
"Cell";
1415 G4TwistedTubs* twistTub=
new G4TwistedTubs(osnameCellSolid.str(), -innerTwistAngle*2, innerR,outR-1.0*micrometer,innerLength,spanAngle);
1417 std::ostringstream osnameCellLogical;
1418 osnameCellLogical<<
"logical"<<
"MdcStereoLayer"<<i<<
"Cell";
1419 G4LogicalVolume* twistTub_log=
new G4LogicalVolume(twistTub, MdcGas,osnameCellLogical.str(),0,0,0);
1421 twistTub_log->SetVisAttributes(G4VisAttributes::Invisible);
1422 twistTub_log->SetSensitiveDetector( aTrackerSD );
1426 std::ostringstream osnameFieldWireSolid;
1427 osnameFieldWireSolid<<
"solid"<<
"StereoLayer"<<i<<
"FieldWire";
1428 G4Tubs* fieldWire_tube=
new G4Tubs(osnameFieldWireSolid.str(),0.,fieldWireR,innerLength,0.,360*deg);
1429 std::ostringstream osnameFieldWireLogical;
1430 osnameFieldWireLogical<<
"logical"<<
"StereoLayer"<<i<<
"FieldWire";
1431 G4LogicalVolume* fieldWire_log=
new G4LogicalVolume(fieldWire_tube,Au,osnameFieldWireLogical.str(),0,0,0);
1433 std::ostringstream osnameFieldWireSubSolid;
1434 osnameFieldWireSubSolid<<
"solid"<<
"StereoLayer"<<i<<
"FieldWireSub";
1435 G4Tubs* fieldWireSub_tube=
new G4Tubs(osnameFieldWireSubSolid.str(),0.,fieldWireR-thickOfAu,innerLength,0.,360*deg);
1436 std::ostringstream osnameFieldWireSubLogical;
1437 osnameFieldWireSubLogical<<
"logical"<<
"StereoLayer"<<i<<
"FieldWireSub";
1438 G4LogicalVolume* fieldWireSub_log=
new G4LogicalVolume(fieldWireSub_tube,Al,osnameFieldWireSubLogical.str(),0,0,0);
1439 std::ostringstream osnameFieldWireSubPhys;
1440 osnameFieldWireSubPhys<<
"physical"<<
"StereoLayer"<<i<<
"FieldWireSub";
1441 G4VPhysicalVolume* fieldWireSub_phys;
1442 fieldWireSub_phys=
new G4PVPlacement(0,0,fieldWireSub_log,
1443 osnameFieldWireSubPhys.str(),fieldWire_log,
false,0);
1446 std::ostringstream osnameSignalWireSolid;
1447 osnameSignalWireSolid<<
"solid"<<
"StereoLayer"<<i<<
"SignalWire";
1448 G4Tubs* signalWire_tube=
new G4Tubs(osnameSignalWireSolid.str(),0.,signalWireR,innerLength,0.,360*deg);
1449 std::ostringstream osnameSignalWireLogical;
1450 osnameSignalWireLogical<<
"logical"<<
"StereoLayer"<<i<<
"SignalWire";
1451 G4LogicalVolume* signalWire_log=
new G4LogicalVolume(signalWire_tube,Au,osnameSignalWireLogical.str(),0,0,0);
1453 std::ostringstream osnameSignalWireSubSolid;
1454 osnameSignalWireSubSolid<<
"solid"<<
"StereoLayer"<<i<<
"SignalWireSub";
1455 G4Tubs* signalWireSub_tube=
new G4Tubs(osnameSignalWireSubSolid.str(),0.,signalWireR-thickOfAu,innerLength,0.,360*deg);
1456 std::ostringstream osnameSignalWireSubLogical;
1457 osnameSignalWireSubLogical<<
"logical"<<
"StereoLayer"<<i<<
"SignalWireSub";
1458 G4LogicalVolume* signalWireSub_log=
new G4LogicalVolume(signalWireSub_tube,W,osnameSignalWireSubLogical.str(),0,0,0);
1459 std::ostringstream osnameSignalWireSubPhys;
1460 osnameSignalWireSubPhys<<
"physical"<<
"StereoLayer"<<i<<
"SignalWireSub";
1461 G4VPhysicalVolume* signalWireSub_phys;
1462 signalWireSub_phys=
new G4PVPlacement(0,0,signalWireSub_log,
1463 osnameSignalWireSubPhys.str(),signalWire_log,
false,0);
1472 G4double shiftR,midR,eastX,eastY,westX,westY;
1473 shiftR=fieldWireR+1*micrometer;
1474 midR=mdc->
Layer(signalLayer).
R()*mm;
1476 std::ostringstream osnameFieldWire0Phys;
1477 osnameFieldWire0Phys<<
"physicalStereoLayer"<<i<<
"FieldWire0";
1479 eastX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg-innerTwistAngle);
1480 eastY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle)+shiftR*
sin(90*deg-innerTwistAngle);
1481 westX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg+innerTwistAngle);
1482 westY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle)+shiftR*
sin(90*deg+innerTwistAngle);
1484 G4ThreeVector east0(eastX,eastY,innerLength);
1485 G4ThreeVector west0(westX,westY,-innerLength);
1486 east0.rotateZ(-spanAngle/2.);
1487 west0.rotateZ(-spanAngle/2.);
1489 posX=(east0.x()+west0.x())/2.;
1490 posY=(east0.y()+west0.y())/2.;
1491 G4ThreeVector line0=east0-west0;
1492 G4RotationMatrix* wireRot0=
new G4RotationMatrix();
1493 wireRot0->rotateZ(-line0.phi());
1494 wireRot0->rotateY(-line0.theta());
1495 G4VPhysicalVolume* fieldWire0_phys;
1496 fieldWire0_phys=
new G4PVPlacement(wireRot0,G4ThreeVector(posX,posY,0),fieldWire_log,
1497 osnameFieldWire0Phys.str(),twistTub_log,
false,0);
1499 std::ostringstream osnameFieldWire1Phys;
1500 osnameFieldWire1Phys<<
"physicalStereoLayer"<<i<<
"FieldWire1";
1501 eastX=midR*
cos(innerTwistAngle)+shiftR*
cos(90*deg-innerTwistAngle);
1502 eastY=midR*
sin(-innerTwistAngle)+shiftR*
sin(90*deg-innerTwistAngle);
1503 westX=midR*
cos(innerTwistAngle)+shiftR*
cos(90*deg+innerTwistAngle);
1504 westY=midR*
sin(innerTwistAngle)+shiftR*
sin(90*deg+innerTwistAngle);
1505 G4ThreeVector east1(eastX,eastY,innerLength);
1506 G4ThreeVector west1(westX,westY,-innerLength);
1507 east1.rotateZ(-spanAngle/2.);
1508 west1.rotateZ(-spanAngle/2.);
1509 posX=(east1.x()+west1.x())/2.;
1510 posY=(east1.y()+west1.y())/2.;
1511 G4ThreeVector line1=east1-west1;
1512 G4RotationMatrix* wireRot1=
new G4RotationMatrix();
1513 wireRot1->rotateZ(-line1.phi());
1514 wireRot1->rotateY(-line1.theta());
1515 G4VPhysicalVolume* fieldWire1_phys;
1516 fieldWire1_phys=
new G4PVPlacement(wireRot1,G4ThreeVector(posX,posY,0),fieldWire_log,
1517 osnameFieldWire1Phys.str(),twistTub_log,
false,1);
1519 std::ostringstream osnameFieldWire3Phys;
1520 osnameFieldWire3Phys<<
"physicalStereoLayer"<<i<<
"FieldWire3";
1522 eastX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1523 eastY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle);
1524 westX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1525 westY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle);
1527 G4ThreeVector east3(eastX,eastY,innerLength);
1528 G4ThreeVector west3(westX,westY,-innerLength);
1530 posX=(east3.x()+west3.x())/2.;
1531 posY=(east3.y()+west3.y())/2.;
1532 G4ThreeVector line3=east3-west3;
1533 G4RotationMatrix* wireRot3=
new G4RotationMatrix();
1534 wireRot3->rotateZ(-line3.phi());
1535 wireRot3->rotateY(-line3.theta());
1536 G4VPhysicalVolume* fieldWire3_phys;
1537 fieldWire3_phys=
new G4PVPlacement(wireRot3,G4ThreeVector(posX,posY,0),fieldWire_log,
1538 osnameFieldWire3Phys.str(),twistTub_log,
false,3);
1540 std::ostringstream osnameSignalWire4Phys;
1541 osnameSignalWire4Phys<<
"physicalStereoLayer"<<i<<
"SignalWire4";
1543 eastX=midR*
cos(innerTwistAngle);
1544 eastY=midR*
sin(-innerTwistAngle);
1545 westX=midR*
cos(innerTwistAngle);
1546 westY=midR*
sin(innerTwistAngle);
1548 G4ThreeVector east4(eastX,eastY,innerLength);
1549 G4ThreeVector west4(westX,westY,-innerLength);
1551 posX=(east4.x()+west4.x())/2.;
1552 posY=(east4.y()+west4.y())/2.;
1553 G4ThreeVector line4=east4-west4;
1554 G4RotationMatrix* wireRot4=
new G4RotationMatrix();
1555 wireRot4->rotateZ(-line4.phi());
1556 wireRot4->rotateY(-line4.theta());
1557 G4VPhysicalVolume* signalWire4_phys;
1558 signalWire4_phys=
new G4PVPlacement(wireRot4,G4ThreeVector(posX,posY,0),signalWire_log,
1559 osnameSignalWire4Phys.str(),twistTub_log,
false,4);
1562 std::ostringstream osnameFieldWire2Phys;
1563 osnameFieldWire2Phys<<
"physicalStereoLayer"<<i<<
"FieldWire2";
1565 eastX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg-innerTwistAngle);
1566 eastY=(outR-shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle)+shiftR*
sin(90*deg-innerTwistAngle);
1567 westX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg+innerTwistAngle);
1568 westY=(outR-shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle)+shiftR*
sin(90*deg+innerTwistAngle);
1570 G4ThreeVector east2(eastX,eastY,innerLength);
1571 G4ThreeVector west2(westX,westY,-innerLength);
1572 east2.rotateZ(-spanAngle/2.);
1573 west2.rotateZ(-spanAngle/2.);
1575 posX=(east2.x()+west2.x())/2.;
1576 posY=(east2.y()+west2.y())/2.;
1577 G4ThreeVector line2=east2-west2;
1578 G4RotationMatrix* wireRot2=
new G4RotationMatrix();
1579 wireRot2->rotateZ(-line2.phi());
1580 wireRot2->rotateY(-line2.theta());
1581 G4VPhysicalVolume* fieldWire2_phys;
1582 fieldWire2_phys=
new G4PVPlacement(wireRot2,G4ThreeVector(posX,posY,0),fieldWire_log,
1583 osnameFieldWire2Phys.str(),twistTub_log,
false,2);
1585 std::ostringstream osnameFieldWire5Phys;
1586 osnameFieldWire5Phys<<
"physicalStereoLayer"<<i<<
"FieldWire5";
1588 eastX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1589 eastY=(outR-shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle);
1590 westX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1591 westY=(outR-shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle);
1593 G4ThreeVector east5(eastX,eastY,innerLength);
1594 G4ThreeVector west5(westX,westY,-innerLength);
1596 posX=(east5.x()+west5.x())/2.;
1597 posY=(east5.y()+west5.y())/2.;
1598 G4ThreeVector line5=east5-west5;
1599 G4RotationMatrix* wireRot5=
new G4RotationMatrix();
1600 wireRot5->rotateZ(-line5.phi());
1601 wireRot5->rotateY(-line5.theta());
1602 G4VPhysicalVolume* fieldWire5_phys;
1603 fieldWire5_phys=
new G4PVPlacement(wireRot5,G4ThreeVector(posX,posY,0),fieldWire_log,
1604 osnameFieldWire5Phys.str(),twistTub_log,
false,5);
1608 for(j=replicaNo-1;j>-1;j--){
1609 G4RotationMatrix* cellRot=
new G4RotationMatrix();
1610 cellRot->rotateZ(-spanAngle*j);
1612 std::ostringstream osnameCellPhys;
1613 osnameCellPhys<<
"physical"<<
"MdcStereoLayer"<<i<<
"Cell"<<j;
1614 G4VPhysicalVolume* twistTub_phys;
1615 twistTub_phys=
new G4PVPlacement(cellRot,0,twistTub_log,
1616 osnameCellPhys.str(),stereoLayer_log,
false,j);
double tan(const BesAngle a)
double sin(const BesAngle a)
double cos(const BesAngle a)
***************************************************************************************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;.