49 G4SDManager* SDman = G4SDManager::GetSDMpointer();
50 G4String mdcSDname =
"BesMdcSD";
51 aTrackerSD =
new BesMdcSD( mdcSDname);
52 SDman->AddNewDetector( aTrackerSD );
56 G4LogicalVolume *logicalMdc = 0;
57 G4LogicalVolume *lv = 0;
63 G4cout<<
"BesMdcConstruction::Construct(), logicalMdc not found"<<G4endl;
66 mdc_phys =
new G4PVPlacement(0,G4ThreeVector(0,0,0),
67 logicalMdc,
"physicalMdc",logicBes,
false, 0,
false);
68 logicalMdc->SetVisAttributes(G4VisAttributes::Invisible);
71 G4VisAttributes* visAttStereoLayer =
new G4VisAttributes(G4Colour(0.,1.,0.));
72 G4VisAttributes* visAttAxialLayer =
new G4VisAttributes(G4Colour(1.,0.,0.));
74 G4double colorShift = 0., shift = 1.0 / (segmentNo-1);
76 for (
int i = 1; i < segmentNo; i++) {
77 std::ostringstream osnameSegment;
78 osnameSegment <<
"logical" <<
"Mdc" <<
"Segment" << i;
79 lv = (G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameSegment.str() );
80 G4VisAttributes* visAttSegment =
new G4VisAttributes(G4Colour(1.0-colorShift, 0.0+colorShift, 0.0));
81 if(i<3) visAttSegment->SetForceWireframe(
true);
83 lv->SetVisAttributes(visAttSegment);
86 else G4cout <<
"logical volume " << osnameSegment.str() <<
"not found " << G4endl;
90 for (
int i = 0; i < 8; i++) {
91 std::ostringstream osnameStereoLayer;
92 osnameStereoLayer <<
"logical" <<
"Mdc" <<
"StereoLayer" << i;
93 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameStereoLayer.str() );
95 lv->SetVisAttributes(visAttStereoLayer);
96 lv->SetVisAttributes(G4VisAttributes::Invisible);
98 else G4cout <<
"logical volume " << osnameStereoLayer.str() <<
"not found " << G4endl;
100 std::ostringstream osnameTwistedTubs;
101 osnameTwistedTubs <<
"logical" <<
"Mdc" <<
"StereoLayer" << i <<
"Cell";
102 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameTwistedTubs.str() );
104 lv->SetSensitiveDetector( aTrackerSD );
105 lv->SetVisAttributes(G4VisAttributes::Invisible);
107 else G4cout <<
"logical volume " << osnameTwistedTubs.str() <<
"not found " << G4endl;
110 for (
int i = 20; i < 36; i++) {
111 std::ostringstream osnameStereoLayer;
112 osnameStereoLayer <<
"logical" <<
"Mdc" <<
"StereoLayer" << i;
113 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameStereoLayer.str() );
115 lv->SetVisAttributes(visAttStereoLayer);
116 lv->SetVisAttributes(G4VisAttributes::Invisible);
118 else G4cout <<
"logical volume " << osnameStereoLayer.str() <<
"not found " << G4endl;
120 std::ostringstream osnameTwistedTubs;
121 osnameTwistedTubs <<
"logical" <<
"Mdc" <<
"StereoLayer" << i <<
"Cell";
122 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameTwistedTubs.str() );
124 lv->SetSensitiveDetector( aTrackerSD );
125 lv->SetVisAttributes(G4VisAttributes::Invisible);
127 else G4cout <<
"logical volume " << osnameTwistedTubs.str() <<
"not found " << G4endl;
130 for (
int i = 8; i < 20; i++) {
131 std::ostringstream osnameAxialLayer;
132 osnameAxialLayer <<
"logical" <<
"Mdc" <<
"AxialLayer" << i;
133 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameAxialLayer.str() );
135 lv->SetVisAttributes(visAttAxialLayer);
136 lv->SetVisAttributes(G4VisAttributes::Invisible);
138 else G4cout <<
"logical volume " << osnameAxialLayer.str() <<
"not found " << G4endl;
140 std::ostringstream osnameReplica;
141 osnameReplica <<
"logical" <<
"Mdc" <<
"AxialLayer" << i <<
"Cell";
142 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameReplica.str() );
144 lv->SetSensitiveDetector( aTrackerSD );
145 lv->SetVisAttributes(G4VisAttributes::Invisible);
147 else G4cout <<
"logical volume " << osnameReplica.str() <<
"not found " << G4endl;
150 for (
int i = 36; i < 43; i++) {
151 for (
int n = 0;
n < 2;
n++) {
152 std::ostringstream osnameAxialLayer;
153 osnameAxialLayer <<
"logical" <<
"Mdc" <<
"AxialLayer" << i <<
"_" <<
n;
154 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameAxialLayer.str() );
156 lv->SetVisAttributes(visAttAxialLayer);
157 lv->SetVisAttributes(G4VisAttributes::Invisible);
159 else G4cout <<
"logical volume " << osnameAxialLayer.str() <<
"not found " << G4endl;
161 std::ostringstream osnameReplica;
162 osnameReplica <<
"logical" <<
"Mdc" <<
"AxialLayer" << i <<
"_" <<
n <<
"Cell";
163 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameReplica.str() );
165 lv->SetSensitiveDetector( aTrackerSD );
166 lv->SetVisAttributes(G4VisAttributes::Invisible);
168 else G4cout <<
"logical volume " << osnameReplica.str() <<
"not found " << G4endl;
180 G4Material* MdcGas = G4Material::GetMaterial(
"Mdcgas");
181 G4Material* Al = G4Material::GetMaterial(
"Aluminium");
182 G4Element *
C =G4Element::GetElement(
"Carbon");
183 G4Element *
H =G4Element::GetElement(
"Hydrogen");
184 G4Element *O =G4Element::GetElement(
"Oxygen");
186 G4double density = 19.3*g/cm3;
187 G4double a = 183.84*g/mole;
188 G4Material* W =
new G4Material(
"Tungsten", 74., a, density);
192 G4Material* Au=
new G4Material(
"Au",79,a,density);
196 G4Material* CarbonFiber=
new G4Material(
"CarbonFiber",density,nElement);
197 CarbonFiber->AddElement(
C,0.697);
198 CarbonFiber->AddElement(
H,0.0061);
199 CarbonFiber->AddElement(O,0.2969);
201 density = 1.42*g/cm3;
202 G4Material* Kapton =
new G4Material(
"Kapton", density, 3);
203 Kapton->AddElement(O,2);
204 Kapton->AddElement(
C,5);
205 Kapton->AddElement(
H,4);
209 G4double outR, innerR, length;
210 G4double startAngle, spanAngle;
211 G4double posX, posY, posZ;
212 G4VisAttributes* visAtt;
226 G4Tubs* mdc_tube=
new G4Tubs(
"solidMdc",innerR,outR,length,startAngle,spanAngle);
227 mdc_log=
new G4LogicalVolume(mdc_tube, MdcGas,
"logicalMdc",0,0,0);
228 mdc_log->SetVisAttributes(G4VisAttributes::Invisible);
234 mdc_phys=
new G4PVPlacement(0,
235 G4ThreeVector(posX ,posY ,posZ),
236 mdc_log,
"physicalMdc",logicBes,
false,0,
false);
241 G4double colorShift=0., shift=1./(mdc->
SegmentNo()-1);
242 G4double gap=0.5*micrometer;
252 std::ostringstream osnameSolid;
253 osnameSolid <<
"solid"<<name<<i;
254 G4Tubs* segment_tube=
new G4Tubs(osnameSolid.str(),innerR,outR,length,startAngle,spanAngle);
255 std::ostringstream osnameLogical;
256 osnameLogical <<
"logical"<<name<<i;
257 G4LogicalVolume* segment_log;
259 segment_log=
new G4LogicalVolume(segment_tube, CarbonFiber,osnameLogical.str(),0,0,0);
261 segment_log=
new G4LogicalVolume(segment_tube, Al,osnameLogical.str(),0,0,0);
264 visAtt=
new G4VisAttributes(G4Colour(1.0-colorShift,0.0+colorShift,0.0));
265 if(i<3)visAtt->SetForceWireframe(
true);
266 segment_log->SetVisAttributes(visAtt);
270 G4VPhysicalVolume* segment_phys;
271 std::ostringstream osnamePhys1;
272 osnamePhys1 <<
"physical"<<name<<i<<
"p";
273 segment_phys=
new G4PVPlacement(0,
274 G4ThreeVector(posX ,posY ,posZ),
275 segment_log,osnamePhys1.str(),mdc_log,
false,0,
false);
278 std::ostringstream osnamePhys2;
279 osnamePhys2 <<
"physical"<<name<<i<<
"m";
280 segment_phys=
new G4PVPlacement(0,
281 G4ThreeVector(posX ,posY ,-posZ),
282 segment_log,osnamePhys2.str(),mdc_log,
false,0,
false);
294 G4Tubs* segment_tube1=
new G4Tubs(
"SolidMdcInnerFilm0",innerR,outR,length,startAngle,spanAngle);
295 G4LogicalVolume* segment_log1;
296 segment_log1=
new G4LogicalVolume(segment_tube1, Al,
"LogicalMdcInnerFilm0",0,0,0);
297 G4VisAttributes* visAtt1=
new G4VisAttributes(G4Colour(0,1.0,0.0));
298 segment_log1->SetVisAttributes(visAtt1);
299 G4VPhysicalVolume* segment_phys1;
300 segment_phys1=
new G4PVPlacement(0,
301 G4ThreeVector(posX ,posY ,posZ),
302 segment_log1,
"PhysicalMdcInnerFilm0",mdc_log,
false,0,
false);
310 G4Tubs* segment_tube2=
new G4Tubs(
"SolidMdcInnerFilm1",innerR,outR,length,startAngle,spanAngle);
311 G4LogicalVolume* segment_log2;
312 segment_log2=
new G4LogicalVolume(segment_tube2, Al,
"LogicalMdcInnerFilm1",0,0,0);
313 G4VisAttributes* visAtt2=
new G4VisAttributes(G4Colour(0,0.0,1.0));
314 segment_log2->SetVisAttributes(visAtt2);
315 G4VPhysicalVolume* segment_phys2;
316 segment_phys2=
new G4PVPlacement(0,
317 G4ThreeVector(posX ,posY ,posZ),
318 segment_log2,
"PhysicalMdcInnerFilm1",mdc_log,
false,0,
false);
326 G4Tubs* segment_tube3=
new G4Tubs(
"SolidMdcOutFilm0",innerR,outR,length,startAngle,spanAngle);
327 G4LogicalVolume* segment_log3;
328 segment_log3=
new G4LogicalVolume(segment_tube3, Al,
"LogicalMdcOutFilm0",0,0,0);
329 G4VisAttributes* visAtt3=
new G4VisAttributes(G4Colour(0,1.0,0.0));
330 segment_log3->SetVisAttributes(visAtt3);
331 G4VPhysicalVolume* segment_phys3;
332 segment_phys3=
new G4PVPlacement(0,
333 G4ThreeVector(posX ,posY ,posZ),
334 segment_log3,
"PhysicalMdcOutFilm0",mdc_log,
false,0,
false);
342 G4Tubs* segment_tube4=
new G4Tubs(
"SolidMdcOutFilm1",innerR,outR,length,startAngle,spanAngle);
343 G4LogicalVolume* segment_log4;
344 segment_log4=
new G4LogicalVolume(segment_tube4, Al,
"LogicalMdcOutFilm1",0,0,0);
345 G4VisAttributes* visAtt4=
new G4VisAttributes(G4Colour(0,0.0,1.0));
346 segment_log4->SetVisAttributes(visAtt4);
347 G4VPhysicalVolume* segment_phys4;
348 segment_phys4=
new G4PVPlacement(0,
349 G4ThreeVector(posX ,posY ,posZ),
350 segment_log4,
"PhysicalMdcOutFilm1",mdc_log,
false,0,
false);
353 innerR=mdc->
Segment(1).
OutR()*mm+100*micrometer+gap;
358 G4Tubs* segment_tube5=
new G4Tubs(
"SolidMdcOutFilm2",innerR,outR,length,startAngle,spanAngle);
359 G4LogicalVolume* segment_log5;
360 segment_log5=
new G4LogicalVolume(segment_tube5, Kapton,
"LogicalMdcOutFilm2",0,0,0);
361 G4VisAttributes* visAtt5=
new G4VisAttributes(G4Colour(0,0.5,0.5));
362 segment_log5->SetVisAttributes(visAtt5);
363 G4VPhysicalVolume* segment_phys5;
364 segment_phys5=
new G4PVPlacement(0,
365 G4ThreeVector(posX ,posY ,posZ),
366 segment_log5,
"PhysicalMdcOutFilm2",mdc_log,
false,0,
false);
373 G4Tubs*fixTub=
new G4Tubs(
"solidFixTub",elecGeomPointer->
FixRing(0)*mm,elecGeomPointer->
FixRing(1)*mm,elecGeomPointer->
FixRing(2)/2.*mm,0.*deg,360.*deg);
374 G4LogicalVolume*fixTub_log=
new G4LogicalVolume(fixTub,Al,
"logicalFixTub");
375 G4VPhysicalVolume*fixTub_phys1=
new G4PVPlacement(0,G4ThreeVector(0,0,1134.5*mm),fixTub_log,
"physcalFixTub1",mdc_log,
false,0,
false);
376 G4VPhysicalVolume*fixTub_phys2=
new G4PVPlacement(0,G4ThreeVector(0,0,-1134.5*mm),fixTub_log,
"physicalFixTub2",mdc_log,
false,0,
false);
379 G4Element *Cu=G4Element::GetElement(
"Copper");
380 G4Element *Si=G4Element::GetElement(
"Silicon");
383 G4double boxDensityEndcape=1.9745*g/cm3;
384 G4int boxNcomponenEndcape=6;
385 G4Material *Cuu = G4Material::GetMaterial(
"Copper");
390 G4Element *Cl =
new G4Element(
"Chlorine",
"Cl",17.,35.5*g/mole);
391 G4Material*synEndcape=
new G4Material(
"M_synthesis",boxDensityEndcape,boxNcomponenEndcape);
392 synEndcape->AddElement(Cu,0.50);
393 synEndcape->AddElement(
C,0.134);
394 synEndcape->AddElement(
H,0.033);
395 synEndcape->AddElement(Si,0.11);
396 synEndcape->AddElement(Cl,0.014);
397 synEndcape->AddElement(O,0.209);
399 G4Box*boxEndcape=
new G4Box(
"solidboxEndcape",elecGeomPointer->
BoxEndcape(0)/2.*mm,elecGeomPointer->
BoxEndcape(1)/2.*mm,elecGeomPointer->
BoxEndcape(2)/2.*mm);
400 G4LogicalVolume*boxEndcape_log=
new G4LogicalVolume(boxEndcape,synEndcape,
"logical boxEndcape");
401 visAtt=
new G4VisAttributes(G4Colour(0.0,1.0,0.0));
402 boxEndcape_log->SetVisAttributes(visAtt);
405 double boxCuEndDx=8.5*mm;
406 double boxCuEndDy=12.*mm;
407 double boxCuEndDz=29.*mm;
409 G4Box* boxCuEnd=
new G4Box(
"solidboxCuEnd",boxCuEndDx/2.,boxCuEndDy/2.,boxCuEndDz/2.);
410 G4LogicalVolume*boxCuEnd_log=
new G4LogicalVolume(boxCuEnd,Cuu,
"logical boxCuEnd");
411 visAtt=
new G4VisAttributes(G4Colour(1.0,1.0,0.0));
412 boxCuEnd_log->SetVisAttributes(visAtt);
414 double dxVirtualBox=18.*mm;
415 double dyVirtualBox=106.*mm;
416 double dzVirtualBox=53.*mm;
417 G4Box*virtualBoxForEndcape=
new G4Box(
"solid virtualBoxEndcape",dxVirtualBox/2.,dyVirtualBox/2.*mm,dzVirtualBox/2.*mm);
418 G4LogicalVolume*virtualBoxForEndcape_log=
new G4LogicalVolume(virtualBoxForEndcape,G4Material::GetMaterial(
"Air"),
"logical virtualBoxEndcape");
420 virtualBoxForEndcape_log->SetVisAttributes(visAtt);
421 G4VPhysicalVolume*boxEndcape_phys=
new G4PVPlacement(0,G4ThreeVector(elecGeomPointer->
BoxEndcape(0)/2.,0,0),boxEndcape_log,
"physical boxEndcape",virtualBoxForEndcape_log,
false,0,
false);
422 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,
false);
423 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,
false);
424 const double pi=3.141593;
428 double startAngleArray;
432 startAngleArray=acos(elecGeomPointer->
X(i)/elecGeomPointer->
R(i));
434 for(
int j=0;j<elecGeomPointer->
ElecNo(i);j++)
436 G4RotationMatrix*boxRotj=
new G4RotationMatrix;
437 boxRotj->rotateZ(-startAngleArray-j*2*
pi/elecGeomPointer->
ElecNo(i));
438 posXArray=elecGeomPointer->
R(i)*
cos((startAngleArray+j*2*
pi/elecGeomPointer->
ElecNo(i)));
439 posYArray=elecGeomPointer->
R(i)*
sin((startAngleArray+j*2*
pi/elecGeomPointer->
ElecNo(i)));
440 posZArray=elecGeomPointer->
Z(i);
441 std::ostringstream osnamephys;
442 osnamephys<<
"physicalLayer"<<i<<
"Ebox"<<j;
443 G4VPhysicalVolume*box_phys=
new G4PVPlacement(boxRotj,G4ThreeVector(posXArray,posYArray,posZArray),virtualBoxForEndcape_log,osnamephys.str(),mdc_log,
false,j,
false);
449 G4double mCableDensity=6.4*g/cm3;
450 G4Material*materialCable=
new G4Material(
"M_materialCable",mCableDensity,3);
451 materialCable->AddElement(Cu,0.4);
452 materialCable->AddElement(
C,0.3);
453 materialCable->AddElement(
H,0.3);
455 double gapR=0.1*micrometer;
458 double innerRCableTub;
459 double outerRCableTub;
460 for(
int i=0;i<11;i++)
462 innerRCableTub=elecGeomPointer->
R(i)*mm-dxVirtualBox/2.+gapR;
463 outerRCableTub=elecGeomPointer->
R(i+1)*mm-dxVirtualBox/2.-gapR;
464 std::ostringstream osnameCableSolid;
465 osnameCableSolid<<
"MdcCableSolidWest"<<i;
466 G4Tubs*cableTub=
new G4Tubs(osnameCableSolid.str(),innerRCableTub,outerRCableTub,elecGeomPointer->
LengthCableTub(i+1)*1.15/2*mm,0*deg,360*deg);
468 std::ostringstream osnameCableLog;
469 osnameCableLog<<
"MdcCableLogWest"<<i;
470 G4LogicalVolume*cableTub_log=
new G4LogicalVolume(cableTub,materialCable,osnameCableLog.str());
471 visAtt=
new G4VisAttributes(G4Colour(1,0.3,0.5));
472 cableTub_log->SetVisAttributes(visAtt);
474 std::ostringstream osnameCablePhys;
475 osnameCablePhys<<
"MdcCablePhysWest"<<i;
476 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,
false);
480 for(
int i=0;i<10;i++)
482 innerRCableTub=elecGeomPointer->
R(i+12)-dxVirtualBox/2.+gapR;
483 outerRCableTub=elecGeomPointer->
R(i+12+1)-dxVirtualBox/2.-gapR;
484 std::ostringstream osnameCableSolid;
485 osnameCableSolid<<
"MdcCableSolidEast"<<i;
486 G4Tubs*cableTub=
new G4Tubs(osnameCableSolid.str(),innerRCableTub,outerRCableTub,elecGeomPointer->
LengthCableTub(i+14)*1.15/2*mm,0*deg,360*deg);
488 std::ostringstream osnameCableLog;
489 osnameCableLog<<
"MdcCableLogEast"<<i;
490 G4LogicalVolume*cableTub_log=
new G4LogicalVolume(cableTub,materialCable,osnameCableLog.str());
491 visAtt=
new G4VisAttributes(G4Colour(1,0.3,0.5));
492 cableTub_log->SetVisAttributes(visAtt);
494 std::ostringstream osnameCablePhys;
495 osnameCablePhys<<
"MdcCablePhysEast"<<i;
496 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,
false);
502 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);
503 G4LogicalVolume*cableTubBeginnerW_log=
new G4LogicalVolume(cableTubBeginnerW,materialCable,
"logical cableTubBeginnerW");
504 visAtt=
new G4VisAttributes(G4Colour(0,0.3,0.8));
505 cableTubBeginnerW_log->SetVisAttributes(visAtt);
506 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,
false);
508 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);
509 G4LogicalVolume*cableTubBeginnerE_log=
new G4LogicalVolume(cableTubBeginnerE,materialCable,
"logical cabieTubBeginnerE");
510 visAtt=
new G4VisAttributes(G4Colour(1,0.3,0.5));
511 cableTubBeginnerE_log->SetVisAttributes(visAtt);
513 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,
false);
518 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);
519 G4LogicalVolume*cableTubToTailW_log=
new G4LogicalVolume(cableTubToTailW,materialCable,
"logical cableTubToTailW");
520 visAtt=
new G4VisAttributes(G4Colour(0,0.3,0.8));
521 cableTubToTailW_log->SetVisAttributes(visAtt);
523 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,
false);
525 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);
527 G4LogicalVolume*cableTubToTailE_log=
new G4LogicalVolume(cableTubToTailE,materialCable,
"logical cabieTubToTailE");
528 visAtt=
new G4VisAttributes(G4Colour(1.0,0.3,0.5));
529 cableTubToTailE_log->SetVisAttributes(visAtt);
531 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,
false);
535 G4Box* box0=
new G4Box(
"box0",10.,15.,3.);
536 G4LogicalVolume* box0_log=
new G4LogicalVolume(box0,Al,
"logicalBox0",0,0,0);
537 visAtt=
new G4VisAttributes(G4Colour(1.0,0.8,0.0));
538 box0_log->SetVisAttributes(visAtt);
540 G4Box* box1=
new G4Box(
"box1",3.*
cos(11.28*deg),15.,81./
sin(11.28*deg)/2.);
541 G4LogicalVolume* box1_log=
new G4LogicalVolume(box1,Al,
"logicalBox1",0,0,0);
542 box1_log->SetVisAttributes(visAtt);
544 G4Box* box2=
new G4Box(
"box2",63.5,15.,3.);
545 G4LogicalVolume* box2_log=
new G4LogicalVolume(box2,Al,
"logicalBox2",0,0,0);
546 box2_log->SetVisAttributes(visAtt);
550 G4RotationMatrix* boxRot0=
new G4RotationMatrix();
551 boxRot0->rotateZ(-45*i*deg);
552 posX=784.*
cos(45*i*deg);
553 posY=784.*
sin(45*i*deg);
555 std::ostringstream osnameBox0PhysEast;
556 osnameBox0PhysEast<<
"physical"<<
"box0p"<<i;
557 G4VPhysicalVolume* box0p_phys=
new G4PVPlacement(boxRot0,G4ThreeVector(posX ,posY ,posZ),
558 box0_log,osnameBox0PhysEast.str(),mdc_log,
false,i,
false);
560 std::ostringstream osnameBox0PhysWest;
561 osnameBox0PhysWest<<
"physical"<<
"box0m"<<i;
562 G4VPhysicalVolume* box0m_phys=
new G4PVPlacement(boxRot0,G4ThreeVector(posX ,posY ,-posZ),
563 box0_log,osnameBox0PhysWest.str(),mdc_log,
false,i,
false);
566 G4RotationMatrix* boxRot1p=
new G4RotationMatrix();
567 boxRot1p->rotateZ(-45*i*deg);
568 boxRot1p->rotateY(-78.72*deg);
569 posX=570.5*
cos(45*i*deg);
570 posY=570.5*
sin(45*i*deg);
572 std::ostringstream osnameBox1PhysEast;
573 osnameBox1PhysEast<<
"physical"<<
"box1p"<<i;
574 G4VPhysicalVolume* box1p_phys=
new G4PVPlacement(boxRot1p,G4ThreeVector(posX ,posY ,posZ),
575 box1_log,osnameBox1PhysEast.str(),mdc_log,
false,i,
false);
577 G4RotationMatrix* boxRot1m=
new G4RotationMatrix();
578 boxRot1m->rotateZ(-45*i*deg);
579 boxRot1m->rotateY(78.72*deg);
580 std::ostringstream osnameBox1PhysWest;
581 osnameBox1PhysWest<<
"physical"<<
"box1m"<<i;
582 G4VPhysicalVolume* box1m_phys=
new G4PVPlacement(boxRot1m,G4ThreeVector(posX ,posY ,-posZ),
583 box1_log,osnameBox1PhysWest.str(),mdc_log,
false,i,
false);
585 G4RotationMatrix* boxRot2=
new G4RotationMatrix();
586 boxRot2->rotateZ(-45*i*deg);
587 posX=303.5*
cos(45*i*deg);
588 posY=303.5*
sin(45*i*deg);
590 std::ostringstream osnameBox2PhysEast;
591 osnameBox2PhysEast<<
"physical"<<
"box2p"<<i;
592 G4VPhysicalVolume* box2p_phys=
new G4PVPlacement(boxRot2,G4ThreeVector(posX ,posY ,posZ),
593 box2_log,osnameBox2PhysEast.str(),mdc_log,
false,i,
false);
595 std::ostringstream osnameBox2PhysWest;
596 osnameBox2PhysWest<<
"physical"<<
"box2m"<<i;
597 G4VPhysicalVolume* box2m_phys=
new G4PVPlacement(boxRot2,G4ThreeVector(posX ,posY ,-posZ),
598 box2_log,osnameBox2PhysWest.str(),mdc_log,
false,i,
false);
602 G4double rMax2=774.*mm;
603 G4double rMin2=rMax2 - 1.*mm/
sin(11.28*deg);
604 G4double rMin1=rMin2 - 80.*mm/
tan(11.28*deg);
605 G4double rMax1=rMin1 + 1.*mm/
sin(11.28*deg);
606 G4Cons* shieldPlate0p=
new G4Cons(
"shieldPlate0p",rMin1,rMax1,rMin2,rMax2,40.*mm,0.,360.*deg);
607 G4LogicalVolume* shieldPlate0p_log=
new G4LogicalVolume(shieldPlate0p,Al,
"logicalShieldPlate0p",0,0,0);
608 visAtt=
new G4VisAttributes(G4Colour(0.0,0.0,1.0));
609 shieldPlate0p_log->SetVisAttributes(visAtt);
613 G4VPhysicalVolume* shieldPlate0p_phys=
new G4PVPlacement(0,G4ThreeVector(posX ,posY ,posZ),
614 shieldPlate0p_log,
"physicalShieldPalte0p",mdc_log,
false,0,
false);
616 G4Cons* shieldPlate0m=
new G4Cons(
"shieldPlate0m",rMin2,rMax2,rMin1,rMax1,40.*mm,0.,360.*deg);
617 G4LogicalVolume* shieldPlate0m_log=
new G4LogicalVolume(shieldPlate0m,Al,
"logicalShieldPlate0m",0,0,0);
618 visAtt=
new G4VisAttributes(G4Colour(0.0,0.0,1.0));
619 shieldPlate0m_log->SetVisAttributes(visAtt);
623 G4VPhysicalVolume* shieldPlate0m_phys=
new G4PVPlacement(0,G4ThreeVector(posX ,posY ,-posZ),
624 shieldPlate0m_log,
"physicalShieldPalte0m",mdc_log,
false,0,
false);
627 G4Tubs* shieldPlate1=
new G4Tubs(
"shieldPlate1",240.*mm,367.*mm,0.5*mm,0.,360.*deg);
628 G4LogicalVolume* shieldPlate1_log=
new G4LogicalVolume(shieldPlate1,Al,
"logicalShieldPlate1",0,0,0);
629 visAtt=
new G4VisAttributes(G4Colour(1.0,0.0,0.0));
630 shieldPlate1_log->SetVisAttributes(visAtt);
634 G4VPhysicalVolume* shieldPlate1p_phys=
new G4PVPlacement(0,G4ThreeVector(posX ,posY ,posZ),
635 shieldPlate1_log,
"physicalShieldPalte1p",mdc_log,
false,0,
false);
636 G4VPhysicalVolume* shieldPlate1m_phys=
new G4PVPlacement(0,G4ThreeVector(posX ,posY ,-posZ),
637 shieldPlate1_log,
"physicalShieldPalte1m",mdc_log,
false,0,
false);
641 G4int signalLayer,firstWire;
645 G4double signalWireR=mdc->
SignalWireR()*micrometer;
646 G4double fieldWireR=mdc->
FieldWireR()*micrometer;
647 G4double thickOfAu=0.7*micrometer;
649 G4double innerLength,innerTwistAngle,innerTan,midInnerR,innerStereo;
650 G4double outLength,outTwistAngle,outTwistAngleFixed,outTan,midOutR,outStereo,outRFixed,outTanFixed;
653 for(i=42; i>35; i--){
657 innerR=mdc->
Layer(signalLayer-1+
n).
R()*mm-fieldWireR;
658 outR=mdc->
Layer(signalLayer+
n).
R()*mm-fieldWireR;
659 if(i==42&&
n==1)outR=mdc->
Layer(signalLayer+
n).
R()*mm+fieldWireR;
660 length=(mdc->
Layer(signalLayer-1+
n).Length())/2.*mm;
668 std::ostringstream osnameLayerSolid;
669 osnameLayerSolid <<
"solid"<<
"MdcAxialLayer"<<i<<
"_"<<
n;
670 G4Tubs* axialLayer_tube=
new G4Tubs(osnameLayerSolid.str(),innerR,outR,length,startAngle,spanAngle);
672 std::ostringstream osnameLayerLogical;
673 osnameLayerLogical <<
"logical"<<
"MdcAxialLayer"<<i<<
"_"<<
n;
674 G4LogicalVolume* axialLayer_log=
new G4LogicalVolume(axialLayer_tube, MdcGas,osnameLayerLogical.str(),0,0,0);
676 axialLayer_log->SetVisAttributes(G4VisAttributes::Invisible);
679 spanAngle=360./replicaNo*deg;
681 offset=mdc->
Layer(signalLayer).
Phi()*
rad-firstWire*spanAngle/2.;
682 G4RotationMatrix* layerRot=
new G4RotationMatrix();
683 layerRot->rotateZ(-offset);
685 std::ostringstream osnameLayerPhys;
686 osnameLayerPhys <<
"physical"<<
"MdcAxialLayer"<<i<<
"_"<<
n;
687 G4VPhysicalVolume* axialLayer_phys;
688 axialLayer_phys=
new G4PVPlacement(layerRot,
690 axialLayer_log,osnameLayerPhys.str(),mdc_log,
false,i,
false);
693 std::ostringstream osnameCellSolid;
694 osnameCellSolid<<
"solid"<<
"MdcAxialLayer"<<i<<
"_"<<
n<<
"Cell";
695 G4Tubs* replica_tube=
new G4Tubs(osnameCellSolid.str(),innerR,outR,length,startAngle,spanAngle);
697 std::ostringstream osnameCellLogical;
698 osnameCellLogical<<
"logical"<<
"MdcAxialLayer"<<i<<
"_"<<
n<<
"Cell";
699 G4LogicalVolume* replica_log=
new G4LogicalVolume(replica_tube,MdcGas,osnameCellLogical.str(),0,0,0);
701 replica_log->SetSensitiveDetector( aTrackerSD );
702 visAtt=
new G4VisAttributes(G4Colour(0.0,0.0,1.0));
703 replica_log->SetVisAttributes(visAtt);
704 replica_log->SetVisAttributes(G4VisAttributes::Invisible);
708 std::ostringstream osnameFieldWireSolid;
709 osnameFieldWireSolid<<
"solid"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWire";
710 G4Tubs* fieldWire_tube=
new G4Tubs(osnameFieldWireSolid.str(),0.,fieldWireR,length,0.,360*deg);
711 std::ostringstream osnameFieldWireLogical;
712 osnameFieldWireLogical<<
"logical"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWire";
713 G4LogicalVolume* fieldWire_log=
new G4LogicalVolume(fieldWire_tube,Au,osnameFieldWireLogical.str(),0,0,0);
715 std::ostringstream osnameFieldWireSubSolid;
716 osnameFieldWireSubSolid<<
"solid"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWireSub";
717 G4Tubs* fieldWireSub_tube=
new G4Tubs(osnameFieldWireSubSolid.str(),0.,fieldWireR-thickOfAu,length,0.,360*deg);
718 std::ostringstream osnameFieldWireSubLogical;
719 osnameFieldWireSubLogical<<
"logical"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWireSub";
720 G4LogicalVolume* fieldWireSub_log=
new G4LogicalVolume(fieldWireSub_tube,Al,osnameFieldWireSubLogical.str(),0,0,0);
721 std::ostringstream osnameFieldWireSubPhys;
722 osnameFieldWireSubPhys<<
"physical"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWireSub";
723 G4VPhysicalVolume* fieldWireSub_phys;
724 fieldWireSub_phys=
new G4PVPlacement(0,G4ThreeVector(),fieldWireSub_log,
725 osnameFieldWireSubPhys.str(),fieldWire_log,
false,0,
false);
727 std::ostringstream osnameFieldWireHalfSolid;
728 osnameFieldWireHalfSolid<<
"solid"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWireHalf";
729 G4Tubs* fieldWireHalf_tube=
new G4Tubs(osnameFieldWireHalfSolid.str(),0.,fieldWireR,length,0.,180*deg);
730 std::ostringstream osnameFieldWireHalfLogical;
731 osnameFieldWireHalfLogical<<
"logical"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWireHalf";
732 G4LogicalVolume* fieldWireHalf_log=
new G4LogicalVolume(fieldWireHalf_tube,Au,osnameFieldWireHalfLogical.str(),0,0,0);
734 std::ostringstream osnameFieldWireHalfSubSolid;
735 osnameFieldWireHalfSubSolid<<
"solid"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWireHalfSub";
736 G4Tubs* fieldWireHalfSub_tube=
new G4Tubs(osnameFieldWireHalfSubSolid.str(),0.,fieldWireR-thickOfAu,length,0.,360*deg);
737 std::ostringstream osnameFieldWireHalfSubLogical;
738 osnameFieldWireHalfSubLogical<<
"logical"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWireHalfSub";
739 G4LogicalVolume* fieldWireHalfSub_log=
new G4LogicalVolume(fieldWireHalfSub_tube,Al,osnameFieldWireHalfSubLogical.str(),0,0,0);
740 std::ostringstream osnameFieldWireHalfSubPhys;
741 osnameFieldWireHalfSubPhys<<
"physical"<<
"AxialLayer"<<i<<
"_"<<
n<<
"FieldWireHalfSub";
742 G4VPhysicalVolume* fieldWireHalfSub_phys;
743 fieldWireHalfSub_phys=
new G4PVPlacement(0,G4ThreeVector(),fieldWireHalfSub_log,
744 osnameFieldWireHalfSubPhys.str(),fieldWireHalf_log,
false,0,
false);
755 std::ostringstream osnameFieldWire0Phys;
756 osnameFieldWire0Phys<<
"physicalAxialLayer"<<i<<
"_"<<
n<<
"FieldWire0";
757 posX=mdc->
Layer(signalLayer-1).
R()*mm;
758 G4VPhysicalVolume* fieldWire0_phys;
759 fieldWire0_phys=
new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log,
760 osnameFieldWire0Phys.str(),replica_log,
false,0,
false);
762 std::ostringstream osnameFieldWire3Phys;
763 osnameFieldWire3Phys<<
"physicalAxialLayer"<<i<<
"_"<<
n<<
"FieldWire3";
764 posX=mdc->
Layer(signalLayer-1).
R()*mm*
cos(spanAngle/2.);
765 posY=mdc->
Layer(signalLayer-1).
R()*mm*
sin(spanAngle/2.);
766 G4VPhysicalVolume* fieldWire3_phys;
767 fieldWire3_phys=
new G4PVPlacement(0,G4ThreeVector(posX,posY,0),fieldWire_log,
768 osnameFieldWire3Phys.str(),replica_log,
false,3,
false);
769 std::ostringstream osnameFieldWire6Phys;
770 osnameFieldWire6Phys<<
"physicalAxialLayer"<<i<<
"_"<<
n<<
"FieldWire6";
771 posX=mdc->
Layer(signalLayer-1).
R()*mm*
cos(spanAngle);
772 posY=mdc->
Layer(signalLayer-1).
R()*mm*
sin(spanAngle);
773 G4RotationMatrix* wireRot6=
new G4RotationMatrix();
774 wireRot6->rotateZ(180*deg-spanAngle);
775 G4VPhysicalVolume* fieldWire6_phys;
776 fieldWire6_phys=
new G4PVPlacement(wireRot6,G4ThreeVector(posX,posY,0),fieldWireHalf_log,
777 osnameFieldWire6Phys.str(),replica_log,
false,6,
false);
781 std::ostringstream osnameFieldWire1Phys;
782 osnameFieldWire1Phys<<
"physicalAxialLayer"<<i<<
"_"<<
n<<
"FieldWire1";
783 posX=mdc->
Layer(signalLayer).
R()*mm;
784 G4VPhysicalVolume* fieldWire1_phys;
785 fieldWire1_phys=
new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log,
786 osnameFieldWire1Phys.str(),replica_log,
false,1,
false);
787 std::ostringstream osnameSignalWireSolid;
788 osnameSignalWireSolid<<
"solid"<<
"AxialLayer"<<i<<
"_"<<
n<<
"SignalWire";
789 G4Tubs* signalWire_tube=
new G4Tubs(osnameSignalWireSolid.str(),0.,signalWireR,length,0.,360*deg);
790 std::ostringstream osnameSignalWireLogical;
791 osnameSignalWireLogical<<
"logical"<<
"AxialLayer"<<i<<
"_"<<
n<<
"SignalWire";
792 G4LogicalVolume* signalWire_log=
new G4LogicalVolume(signalWire_tube,Au,osnameSignalWireLogical.str(),0,0,0);
794 std::ostringstream osnameSignalWireSubSolid;
795 osnameSignalWireSubSolid<<
"solid"<<
"AxialLayer"<<i<<
"_"<<
n<<
"SignalWireSub";
796 G4Tubs* signalWireSub_tube=
new G4Tubs(osnameSignalWireSubSolid.str(),0.,signalWireR-thickOfAu,length,0.,360*deg);
797 std::ostringstream osnameSignalWireSubLogical;
798 osnameSignalWireSubLogical<<
"logical"<<
"AxialLayer"<<i<<
"_"<<
n<<
"SignalWireSub";
799 G4LogicalVolume* signalWireSub_log=
new G4LogicalVolume(signalWireSub_tube,W,osnameSignalWireSubLogical.str(),0,0,0);
800 std::ostringstream osnameSignalWireSubPhys;
801 osnameSignalWireSubPhys<<
"physical"<<
"AxialLayer"<<i<<
"_"<<
n<<
"SignalWireSub";
802 G4VPhysicalVolume* signalWireSub_phys;
803 signalWireSub_phys=
new G4PVPlacement(0,G4ThreeVector(),signalWireSub_log,
804 osnameSignalWireSubPhys.str(),signalWire_log,
false,0,
false);
806 std::ostringstream osnameSignalWirePhys;
807 osnameSignalWirePhys<<
"physicalAxialLayer"<<i<<
"_"<<
n<<
"SignalWire4";
808 posX=mdc->
Layer(signalLayer).
R()*mm*
cos(spanAngle/2.);
809 posY=mdc->
Layer(signalLayer).
R()*mm*
sin(spanAngle/2.);
810 G4VPhysicalVolume* signalWire_phys;
811 signalWire_phys=
new G4PVPlacement(0,G4ThreeVector(posX,posY,0),signalWire_log,
812 osnameSignalWirePhys.str(),replica_log,
false,4,
false);
814 std::ostringstream osnameFieldWire7Phys;
815 osnameFieldWire7Phys<<
"physicalAxialLayer"<<i<<
"_"<<
n<<
"FieldWire7";
816 posX=mdc->
Layer(signalLayer).
R()*mm*
cos(spanAngle);
817 posY=mdc->
Layer(signalLayer).
R()*mm*
sin(spanAngle);
818 G4RotationMatrix* wireRot7=
new G4RotationMatrix();
819 wireRot7->rotateZ(180*deg-spanAngle);
820 G4VPhysicalVolume* fieldWire7_phys;
821 fieldWire7_phys=
new G4PVPlacement(wireRot7,G4ThreeVector(posX,posY,0),fieldWireHalf_log,
822 osnameFieldWire7Phys.str(),replica_log,
false,7,
false);
824 std::ostringstream osnameFieldWire2Phys;
825 osnameFieldWire2Phys<<
"physicalAxialLayer"<<i<<
"_"<<
n<<
"FieldWire2";
826 posX=mdc->
Layer(signalLayer+1).
R()*mm;
827 G4VPhysicalVolume* fieldWire2_phys;
828 fieldWire2_phys=
new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log,
829 osnameFieldWire2Phys.str(),replica_log,
false,2,
false);
831 std::ostringstream osnameFieldWire5Phys;
832 osnameFieldWire5Phys<<
"physicalAxialLayer"<<i<<
"_"<<
n<<
"FieldWire5";
833 posX=mdc->
Layer(signalLayer+1).
R()*mm*
cos(spanAngle/2.);
834 posY=mdc->
Layer(signalLayer+1).
R()*mm*
sin(spanAngle/2.);
835 G4VPhysicalVolume* fieldWire5_phys;
836 fieldWire5_phys=
new G4PVPlacement(0,G4ThreeVector(posX,posY,0),fieldWire_log,
837 osnameFieldWire5Phys.str(),replica_log,
false,5,
false);
839 std::ostringstream osnameFieldWire8Phys;
840 osnameFieldWire8Phys<<
"physicalAxialLayer"<<i<<
"_"<<
n<<
"FieldWire8";
841 posX=mdc->
Layer(signalLayer+1).
R()*mm*
cos(spanAngle);
842 posY=mdc->
Layer(signalLayer+1).
R()*mm*
sin(spanAngle);
843 G4RotationMatrix* wireRot8=
new G4RotationMatrix();
844 wireRot8->rotateZ(180*deg-spanAngle);
845 G4VPhysicalVolume* fieldWire8_phys;
846 fieldWire8_phys=
new G4PVPlacement(wireRot8,G4ThreeVector(posX,posY,0),fieldWireHalf_log,
847 osnameFieldWire8Phys.str(),replica_log,
false,8,
false);
852 for(j=replicaNo-1;j>-1;j--){
853 G4RotationMatrix* cellRot=
new G4RotationMatrix();
854 cellRot->rotateZ(-spanAngle*j);
855 std::ostringstream osnameCellPhys;
856 osnameCellPhys<<
"physical"<<
"MdcAxialLayer"<<i<<
"_"<<
n<<
"Cell"<<j;
857 G4VPhysicalVolume* replica_phys;
858 replica_phys=
new G4PVPlacement(cellRot,G4ThreeVector(),replica_log,
859 osnameCellPhys.str(),axialLayer_log,
false,j,
false);
867 for(i=35; i>19; i--){
870 innerR=mdc->
Layer(signalLayer-1).
R()*mm-fieldWireR;
871 outR=mdc->
Layer(signalLayer+1).
R()*mm-fieldWireR;
872 if(i==35)outR=mdc->
Layer(signalLayer+1).
R()*mm+fieldWireR;
874 innerLength=(mdc->
Layer(signalLayer-1).Length())/2.*mm;
875 outLength=(mdc->
Layer(signalLayer+1).Length())/2.*mm;
880 innerTan=innerR/innerLength*
sin(innerTwistAngle);
882 midInnerR=innerR*
cos(innerTwistAngle);
883 innerStereo=atan(innerTan);
885 outTan=outR/outLength*
sin(outTwistAngle);
886 outTwistAngleFixed=atan(innerLength/outLength*
tan(outTwistAngle));
888 if(
abs(outTwistAngleFixed) >=
abs(innerTwistAngle)){
889 midOutR=outR*
cos(outTwistAngle);
890 outRFixed=midOutR/
cos(innerTwistAngle);
893 outTanFixed=midOutR/innerLength*
tan(innerTwistAngle);
894 outStereo=atan(outTanFixed);
896 outRFixed=sqrt(outR*outR+(innerLength*innerLength-outLength*outLength)*outTan*outTan);
898 midOutR=outR*
cos(innerTwistAngle);
900 outTanFixed=outRFixed/innerLength*
sin(innerTwistAngle);
901 outStereo=atan(outTanFixed);
904 std::ostringstream osnameLayerSolid;
905 osnameLayerSolid <<
"solid"<<
"MdcStereoLayer"<<i;
907 G4Hype* stereoLayer_hype=
new G4Hype(osnameLayerSolid.str(),midInnerR, midOutR,innerStereo,
908 outStereo,innerLength);
910 std::ostringstream osnameLayerLogical;
911 osnameLayerLogical <<
"logical"<<
"MdcStereoLayer"<<i;
912 G4LogicalVolume* stereoLayer_log=
new G4LogicalVolume(stereoLayer_hype,MdcGas,
913 osnameLayerLogical.str(),0,0,0);
914 stereoLayer_log->SetVisAttributes(G4VisAttributes::Invisible);
917 spanAngle=360./replicaNo*deg;
920 G4RotationMatrix* layerRot=
new G4RotationMatrix();
921 layerRot->rotateZ(-(spanAngle*(1-firstWire)/2.+innerTwistAngle));
923 std::ostringstream osnameLayerPhys;
924 osnameLayerPhys<<
"physical"<<
"MdcStereoLayer"<<i;
925 G4VPhysicalVolume* stereoLayer_phys;
926 stereoLayer_phys=
new G4PVPlacement(layerRot,G4ThreeVector(),stereoLayer_log,osnameLayerPhys.str(),
927 mdc_log,
false,i,
false);
929 std::ostringstream osnameCellSolid;
930 osnameCellSolid<<
"solid"<<
"MdcStereoLayer"<<i<<
"Cell";
932 G4TwistedTubs* twistTub=
new G4TwistedTubs(osnameCellSolid.str(), -innerTwistAngle*2, innerR,outR-1.0*micrometer,innerLength,spanAngle);
934 std::ostringstream osnameCellLogical;
935 osnameCellLogical<<
"logical"<<
"MdcStereoLayer"<<i<<
"Cell";
936 G4LogicalVolume* twistTub_log=
new G4LogicalVolume(twistTub, MdcGas,osnameCellLogical.str(),0,0,0);
938 twistTub_log->SetVisAttributes(G4VisAttributes::Invisible);
939 twistTub_log->SetSensitiveDetector( aTrackerSD );
944 std::ostringstream osnameFieldWireSolid;
945 osnameFieldWireSolid<<
"solid"<<
"StereoLayer"<<i<<
"FieldWire";
946 G4Tubs* fieldWire_tube=
new G4Tubs(osnameFieldWireSolid.str(),0.,fieldWireR,innerLength,0.,360*deg);
947 std::ostringstream osnameFieldWireLogical;
948 osnameFieldWireLogical<<
"logical"<<
"StereoLayer"<<i<<
"FieldWire";
949 G4LogicalVolume* fieldWire_log=
new G4LogicalVolume(fieldWire_tube,Au,osnameFieldWireLogical.str(),0,0,0);
951 std::ostringstream osnameFieldWireSubSolid;
952 osnameFieldWireSubSolid<<
"solid"<<
"StereoLayer"<<i<<
"FieldWireSub";
953 G4Tubs* fieldWireSub_tube=
new G4Tubs(osnameFieldWireSubSolid.str(),0.,fieldWireR-thickOfAu,innerLength,0.,360*deg);
954 std::ostringstream osnameFieldWireSubLogical;
955 osnameFieldWireSubLogical<<
"logical"<<
"StereoLayer"<<i<<
"FieldWireSub";
956 G4LogicalVolume* fieldWireSub_log=
new G4LogicalVolume(fieldWireSub_tube,Al,osnameFieldWireSubLogical.str(),0,0,0);
957 std::ostringstream osnameFieldWireSubPhys;
958 osnameFieldWireSubPhys<<
"physical"<<
"StereoLayer"<<i<<
"FieldWireSub";
959 G4VPhysicalVolume* fieldWireSub_phys;
960 fieldWireSub_phys=
new G4PVPlacement(0,G4ThreeVector(),fieldWireSub_log,
961 osnameFieldWireSubPhys.str(),fieldWire_log,
false,0,
false);
963 std::ostringstream osnameSignalWireSolid;
964 osnameSignalWireSolid<<
"solid"<<
"StereoLayer"<<i<<
"SignalWire";
965 G4Tubs* signalWire_tube=
new G4Tubs(osnameSignalWireSolid.str(),0.,signalWireR,innerLength,0.,360*deg);
966 std::ostringstream osnameSignalWireLogical;
967 osnameSignalWireLogical<<
"logical"<<
"StereoLayer"<<i<<
"SignalWire";
968 G4LogicalVolume* signalWire_log=
new G4LogicalVolume(signalWire_tube,Au,osnameSignalWireLogical.str(),0,0,0);
970 std::ostringstream osnameSignalWireSubSolid;
971 osnameSignalWireSubSolid<<
"solid"<<
"StereoLayer"<<i<<
"SignalWireSub";
972 G4Tubs* signalWireSub_tube=
new G4Tubs(osnameSignalWireSubSolid.str(),0.,signalWireR-thickOfAu,innerLength,0.,360*deg);
973 std::ostringstream osnameSignalWireSubLogical;
974 osnameSignalWireSubLogical<<
"logical"<<
"StereoLayer"<<i<<
"SignalWireSub";
975 G4LogicalVolume* signalWireSub_log=
new G4LogicalVolume(signalWireSub_tube,W,osnameSignalWireSubLogical.str(),0,0,0);
976 std::ostringstream osnameSignalWireSubPhys;
977 osnameSignalWireSubPhys<<
"physical"<<
"StereoLayer"<<i<<
"SignalWireSub";
978 G4VPhysicalVolume* signalWireSub_phys;
979 signalWireSub_phys=
new G4PVPlacement(0,G4ThreeVector(),signalWireSub_log,
980 osnameSignalWireSubPhys.str(),signalWire_log,
false,0,
false);
989 G4double shiftR,midR,eastX,eastY,westX,westY;
990 shiftR=fieldWireR+1*micrometer;
991 midR=mdc->
Layer(signalLayer).
R()*mm;
993 std::ostringstream osnameFieldWire0Phys;
994 osnameFieldWire0Phys<<
"physicalStereoLayer"<<i<<
"FieldWire0";
996 eastX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg-innerTwistAngle);
997 eastY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle)+shiftR*
sin(90*deg-innerTwistAngle);
998 westX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg+innerTwistAngle);
999 westY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle)+shiftR*
sin(90*deg+innerTwistAngle);
1001 G4ThreeVector east0(eastX,eastY,innerLength);
1002 G4ThreeVector west0(westX,westY,-innerLength);
1003 east0.rotateZ(-spanAngle/2.);
1004 west0.rotateZ(-spanAngle/2.);
1006 posX=(east0.x()+west0.x())/2.;
1007 posY=(east0.y()+west0.y())/2.;
1008 G4ThreeVector line0=east0-west0;
1009 G4RotationMatrix* wireRot0=
new G4RotationMatrix();
1010 wireRot0->rotateZ(-line0.phi());
1011 wireRot0->rotateY(-line0.theta());
1012 G4VPhysicalVolume* fieldWire0_phys;
1013 fieldWire0_phys=
new G4PVPlacement(wireRot0,G4ThreeVector(posX,posY,0),fieldWire_log,
1014 osnameFieldWire0Phys.str(),twistTub_log,
false,0,
false);
1016 std::ostringstream osnameFieldWire1Phys;
1017 osnameFieldWire1Phys<<
"physicalStereoLayer"<<i<<
"FieldWire1";
1018 eastX=midR*
cos(innerTwistAngle)+shiftR*
cos(90*deg-innerTwistAngle);
1019 eastY=midR*
sin(-innerTwistAngle)+shiftR*
sin(90*deg-innerTwistAngle);
1020 westX=midR*
cos(innerTwistAngle)+shiftR*
cos(90*deg+innerTwistAngle);
1021 westY=midR*
sin(innerTwistAngle)+shiftR*
sin(90*deg+innerTwistAngle);
1022 G4ThreeVector east1(eastX,eastY,innerLength);
1023 G4ThreeVector west1(westX,westY,-innerLength);
1024 east1.rotateZ(-spanAngle/2.);
1025 west1.rotateZ(-spanAngle/2.);
1026 posX=(east1.x()+west1.x())/2.;
1027 posY=(east1.y()+west1.y())/2.;
1028 G4ThreeVector line1=east1-west1;
1029 G4RotationMatrix* wireRot1=
new G4RotationMatrix();
1030 wireRot1->rotateZ(-line1.phi());
1031 wireRot1->rotateY(-line1.theta());
1032 G4VPhysicalVolume* fieldWire1_phys;
1033 fieldWire1_phys=
new G4PVPlacement(wireRot1,G4ThreeVector(posX,posY,0),fieldWire_log,
1034 osnameFieldWire1Phys.str(),twistTub_log,
false,1,
false);
1036 std::ostringstream osnameFieldWire3Phys;
1037 osnameFieldWire3Phys<<
"physicalStereoLayer"<<i<<
"FieldWire3";
1039 eastX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1040 eastY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle);
1041 westX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1042 westY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle);
1044 G4ThreeVector east3(eastX,eastY,innerLength);
1045 G4ThreeVector west3(westX,westY,-innerLength);
1047 posX=(east3.x()+west3.x())/2.;
1048 posY=(east3.y()+west3.y())/2.;
1049 G4ThreeVector line3=east3-west3;
1050 G4RotationMatrix* wireRot3=
new G4RotationMatrix();
1051 wireRot3->rotateZ(-line3.phi());
1052 wireRot3->rotateY(-line3.theta());
1053 G4VPhysicalVolume* fieldWire3_phys;
1054 fieldWire3_phys=
new G4PVPlacement(wireRot3,G4ThreeVector(posX,posY,0),fieldWire_log,
1055 osnameFieldWire3Phys.str(),twistTub_log,
false,3,
false);
1057 std::ostringstream osnameSignalWire4Phys;
1058 osnameSignalWire4Phys<<
"physicalStereoLayer"<<i<<
"SignalWire4";
1060 eastX=midR*
cos(innerTwistAngle);
1061 eastY=midR*
sin(-innerTwistAngle);
1062 westX=midR*
cos(innerTwistAngle);
1063 westY=midR*
sin(innerTwistAngle);
1065 G4ThreeVector east4(eastX,eastY,innerLength);
1066 G4ThreeVector west4(westX,westY,-innerLength);
1068 posX=(east4.x()+west4.x())/2.;
1069 posY=(east4.y()+west4.y())/2.;
1070 G4ThreeVector line4=east4-west4;
1071 G4RotationMatrix* wireRot4=
new G4RotationMatrix();
1072 wireRot4->rotateZ(-line4.phi());
1073 wireRot4->rotateY(-line4.theta());
1074 G4VPhysicalVolume* signalWire4_phys;
1075 signalWire4_phys=
new G4PVPlacement(wireRot4,G4ThreeVector(posX,posY,0),signalWire_log,
1076 osnameSignalWire4Phys.str(),twistTub_log,
false,4,
false);
1079 std::ostringstream osnameFieldWire2Phys;
1080 osnameFieldWire2Phys<<
"physicalStereoLayer"<<i<<
"FieldWire2";
1082 eastX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg-innerTwistAngle);
1083 eastY=(outR-shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle)+shiftR*
sin(90*deg-innerTwistAngle);
1084 westX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg+innerTwistAngle);
1085 westY=(outR-shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle)+shiftR*
sin(90*deg+innerTwistAngle);
1087 G4ThreeVector east2(eastX,eastY,innerLength);
1088 G4ThreeVector west2(westX,westY,-innerLength);
1089 east2.rotateZ(-spanAngle/2.);
1090 west2.rotateZ(-spanAngle/2.);
1092 posX=(east2.x()+west2.x())/2.;
1093 posY=(east2.y()+west2.y())/2.;
1094 G4ThreeVector line2=east2-west2;
1095 G4RotationMatrix* wireRot2=
new G4RotationMatrix();
1096 wireRot2->rotateZ(-line2.phi());
1097 wireRot2->rotateY(-line2.theta());
1098 G4VPhysicalVolume* fieldWire2_phys;
1099 fieldWire2_phys=
new G4PVPlacement(wireRot2,G4ThreeVector(posX,posY,0),fieldWire_log,
1100 osnameFieldWire2Phys.str(),twistTub_log,
false,2,
false);
1102 std::ostringstream osnameFieldWire5Phys;
1103 osnameFieldWire5Phys<<
"physicalStereoLayer"<<i<<
"FieldWire5";
1105 eastX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1106 eastY=(outR-shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle);
1107 westX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1108 westY=(outR-shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle);
1110 G4ThreeVector east5(eastX,eastY,innerLength);
1111 G4ThreeVector west5(westX,westY,-innerLength);
1113 posX=(east5.x()+west5.x())/2.;
1114 posY=(east5.y()+west5.y())/2.;
1115 G4ThreeVector line5=east5-west5;
1116 G4RotationMatrix* wireRot5=
new G4RotationMatrix();
1117 wireRot5->rotateZ(-line5.phi());
1118 wireRot5->rotateY(-line5.theta());
1119 G4VPhysicalVolume* fieldWire5_phys;
1120 fieldWire5_phys=
new G4PVPlacement(wireRot5,G4ThreeVector(posX,posY,0),fieldWire_log,
1121 osnameFieldWire5Phys.str(),twistTub_log,
false,5,
false);
1125 for(j=replicaNo-1;j>-1;j--){
1126 G4RotationMatrix* cellRot=
new G4RotationMatrix();
1127 cellRot->rotateZ(-spanAngle*j);
1129 std::ostringstream osnameCellPhys;
1130 osnameCellPhys<<
"physical"<<
"MdcStereoLayer"<<i<<
"Cell"<<j;
1131 G4VPhysicalVolume* twistTub_phys;
1132 twistTub_phys=
new G4PVPlacement(cellRot,G4ThreeVector(),twistTub_log,
1133 osnameCellPhys.str(),stereoLayer_log,
false,j,
false);
1138 for(i=19; i>7; i--){
1140 innerR=mdc->
Layer(signalLayer-1).
R()*mm-fieldWireR;
1141 outR=mdc->
Layer(signalLayer+1).
R()*mm-fieldWireR;
1142 if(i==19)outR=mdc->
Layer(signalLayer+1).
R()*mm+fieldWireR;
1143 length=(mdc->
Layer(signalLayer).Length())/2.*mm;
1152 std::ostringstream osnameLayerSolid;
1153 osnameLayerSolid <<
"solid"<<
"MdcAxialLayer"<<i;
1154 G4Tubs* axialLayer_tube=
new G4Tubs(osnameLayerSolid.str(),innerR,outR,length,startAngle,spanAngle);
1156 std::ostringstream osnameLayerLogical;
1157 osnameLayerLogical <<
"logical"<<
"MdcAxialLayer"<<i;
1158 G4LogicalVolume* axialLayer_log=
new G4LogicalVolume(axialLayer_tube, MdcGas,osnameLayerLogical.str(),0,0,0);
1159 axialLayer_log->SetVisAttributes(G4VisAttributes::Invisible);
1162 spanAngle=360./replicaNo*deg;
1164 offset=mdc->
Layer(signalLayer).
Phi()*
rad-firstWire*spanAngle/2.;
1165 G4RotationMatrix* layerRot=
new G4RotationMatrix();
1166 layerRot->rotateZ(-offset);
1168 std::ostringstream osnameLayerPhys;
1169 osnameLayerPhys<<
"physical"<<
"MdcAxialLayer"<<i;
1170 G4VPhysicalVolume* axialLayer_phys;
1171 axialLayer_phys=
new G4PVPlacement(layerRot,G4ThreeVector(),axialLayer_log,
1172 osnameLayerPhys.str(),mdc_log,
false,i,
false);
1175 std::ostringstream osnameCellSolid;
1176 osnameCellSolid<<
"solid"<<
"MdcAxialLayer"<<i<<
"Cell";
1177 G4Tubs* replica_tube=
new G4Tubs(osnameCellSolid.str(),innerR,outR,length,startAngle,spanAngle);
1179 std::ostringstream osnameCellLogical;
1180 osnameCellLogical<<
"logical"<<
"MdcAxialLayer"<<i<<
"Cell";
1181 G4LogicalVolume* replica_log=
new G4LogicalVolume(replica_tube,MdcGas,osnameCellLogical.str(),0,0,0);
1183 replica_log->SetSensitiveDetector( aTrackerSD );
1184 visAtt=
new G4VisAttributes(G4Colour(0.0,0.0,1.0));
1185 replica_log->SetVisAttributes(visAtt);
1186 replica_log->SetVisAttributes(G4VisAttributes::Invisible);
1190 std::ostringstream osnameFieldWireSolid;
1191 osnameFieldWireSolid<<
"solid"<<
"AxialLayer"<<i<<
"FieldWire";
1192 G4Tubs* fieldWire_tube=
new G4Tubs(osnameFieldWireSolid.str(),0.,fieldWireR,length,0.,360*deg);
1193 std::ostringstream osnameFieldWireLogical;
1194 osnameFieldWireLogical<<
"logical"<<
"AxialLayer"<<i<<
"FieldWire";
1195 G4LogicalVolume* fieldWire_log=
new G4LogicalVolume(fieldWire_tube,Au,osnameFieldWireLogical.str(),0,0,0);
1197 std::ostringstream osnameFieldWireSubSolid;
1198 osnameFieldWireSubSolid<<
"solid"<<
"AxialLayer"<<i<<
"FieldWireSub";
1199 G4Tubs* fieldWireSub_tube=
new G4Tubs(osnameFieldWireSubSolid.str(),0.,fieldWireR-thickOfAu,length,0.,360*deg);
1200 std::ostringstream osnameFieldWireSubLogical;
1201 osnameFieldWireSubLogical<<
"logical"<<
"AxialLayer"<<i<<
"FieldWireSub";
1202 G4LogicalVolume* fieldWireSub_log=
new G4LogicalVolume(fieldWireSub_tube,Al,osnameFieldWireSubLogical.str(),0,0,0);
1203 std::ostringstream osnameFieldWireSubPhys;
1204 osnameFieldWireSubPhys<<
"physical"<<
"AxialLayer"<<i<<
"FieldWireSub";
1205 G4VPhysicalVolume* fieldWireSub_phys;
1206 fieldWireSub_phys=
new G4PVPlacement(0,G4ThreeVector(),fieldWireSub_log,
1207 osnameFieldWireSubPhys.str(),fieldWire_log,
false,0,
false);
1209 std::ostringstream osnameFieldWireHalfSolid;
1210 osnameFieldWireHalfSolid<<
"solid"<<
"AxialLayer"<<i<<
"FieldWireHalf";
1211 G4Tubs* fieldWireHalf_tube=
new G4Tubs(osnameFieldWireHalfSolid.str(),0.,fieldWireR,length,0.,180*deg);
1212 std::ostringstream osnameFieldWireHalfLogical;
1213 osnameFieldWireHalfLogical<<
"logical"<<
"AxialLayer"<<i<<
"FieldWireHalf";
1214 G4LogicalVolume* fieldWireHalf_log=
new G4LogicalVolume(fieldWireHalf_tube,Au,osnameFieldWireHalfLogical.str(),0,0,0);
1216 std::ostringstream osnameFieldWireHalfSubSolid;
1217 osnameFieldWireHalfSubSolid<<
"solid"<<
"AxialLayer"<<i<<
"FieldWireHalfSub";
1218 G4Tubs* fieldWireHalfSub_tube=
new G4Tubs(osnameFieldWireHalfSubSolid.str(),0.,fieldWireR-thickOfAu,length,0.,360*deg);
1219 std::ostringstream osnameFieldWireHalfSubLogical;
1220 osnameFieldWireHalfSubLogical<<
"logical"<<
"AxialLayer"<<i<<
"FieldWireHalfSub";
1221 G4LogicalVolume* fieldWireHalfSub_log=
new G4LogicalVolume(fieldWireHalfSub_tube,Al,osnameFieldWireHalfSubLogical.str(),0,0,0);
1222 std::ostringstream osnameFieldWireHalfSubPhys;
1223 osnameFieldWireHalfSubPhys<<
"physical"<<
"AxialLayer"<<i<<
"FieldWireHalfSub";
1224 G4VPhysicalVolume* fieldWireHalfSub_phys;
1225 fieldWireHalfSub_phys=
new G4PVPlacement(0,G4ThreeVector(),fieldWireHalfSub_log,
1226 osnameFieldWireHalfSubPhys.str(),fieldWireHalf_log,
false,0,
false);
1228 std::ostringstream osnameSignalWireSolid;
1229 osnameSignalWireSolid<<
"solid"<<
"AxialLayer"<<i<<
"SignalWire";
1230 G4Tubs* signalWire_tube=
new G4Tubs(osnameSignalWireSolid.str(),0.,signalWireR,length,0.,360*deg);
1231 std::ostringstream osnameSignalWireLogical;
1232 osnameSignalWireLogical<<
"logical"<<
"AxialLayer"<<i<<
"SignalWire";
1233 G4LogicalVolume* signalWire_log=
new G4LogicalVolume(signalWire_tube,Au,osnameSignalWireLogical.str(),0,0,0);
1235 std::ostringstream osnameSignalWireSubSolid;
1236 osnameSignalWireSubSolid<<
"solid"<<
"AxialLayer"<<i<<
"SignalWireSub";
1237 G4Tubs* signalWireSub_tube=
new G4Tubs(osnameSignalWireSubSolid.str(),0.,signalWireR-thickOfAu,length,0.,360*deg);
1238 std::ostringstream osnameSignalWireSubLogical;
1239 osnameSignalWireSubLogical<<
"logical"<<
"AxialLayer"<<i<<
"SignalWireSub";
1240 G4LogicalVolume* signalWireSub_log=
new G4LogicalVolume(signalWireSub_tube,W,osnameSignalWireSubLogical.str(),0,0,0);
1241 std::ostringstream osnameSignalWireSubPhys;
1242 osnameSignalWireSubPhys<<
"physical"<<
"AxialLayer"<<i<<
"SignalWireSub";
1243 G4VPhysicalVolume* signalWireSub_phys;
1244 signalWireSub_phys=
new G4PVPlacement(0,G4ThreeVector(),signalWireSub_log,
1245 osnameSignalWireSubPhys.str(),signalWire_log,
false,0,
false);
1254 std::ostringstream osnameFieldWire0Phys;
1255 osnameFieldWire0Phys<<
"physicalAxialLayer"<<i<<
"FieldWire0";
1256 posX=mdc->
Layer(signalLayer-1).
R()*mm;
1257 G4VPhysicalVolume* fieldWire0_phys;
1258 fieldWire0_phys=
new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log,
1259 osnameFieldWire0Phys.str(),replica_log,
false,0,
false);
1261 std::ostringstream osnameFieldWire1Phys;
1262 osnameFieldWire1Phys<<
"physicalAxialLayer"<<i<<
"FieldWire1";
1263 posX=mdc->
Layer(signalLayer).
R()*mm;
1264 G4VPhysicalVolume* fieldWire1_phys;
1265 fieldWire1_phys=
new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log,
1266 osnameFieldWire1Phys.str(),replica_log,
false,1,
false);
1269 std::ostringstream osnameFieldWire2Phys;
1270 osnameFieldWire2Phys<<
"physicalAxialLayer"<<i<<
"FieldWire2";
1271 posX=mdc->
Layer(signalLayer+1).
R()*mm;
1272 G4VPhysicalVolume* fieldWire2_phys;
1273 fieldWire2_phys=
new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log,
1274 osnameFieldWire2Phys.str(),replica_log,
false,2,
false);
1277 std::ostringstream osnameFieldWire3Phys;
1278 osnameFieldWire3Phys<<
"physicalAxialLayer"<<i<<
"FieldWire3";
1279 posX=mdc->
Layer(signalLayer-1).
R()*mm*
cos(spanAngle/2.);
1280 posY=mdc->
Layer(signalLayer-1).
R()*mm*
sin(spanAngle/2.);
1281 G4VPhysicalVolume* fieldWire3_phys;
1282 fieldWire3_phys=
new G4PVPlacement(0,G4ThreeVector(posX,posY,0),fieldWire_log,
1283 osnameFieldWire3Phys.str(),replica_log,
false,3,
false);
1285 std::ostringstream osnameSignalWirePhys;
1286 osnameSignalWirePhys<<
"physicalAxialLayer"<<i<<
"SignalWire4";
1287 posX=mdc->
Layer(signalLayer).
R()*mm*
cos(spanAngle/2.);
1288 posY=mdc->
Layer(signalLayer).
R()*mm*
sin(spanAngle/2.);
1289 G4VPhysicalVolume* signalWire_phys;
1290 signalWire_phys=
new G4PVPlacement(0,G4ThreeVector(posX,posY,0),signalWire_log,
1291 osnameSignalWirePhys.str(),replica_log,
false,4,
false);
1294 std::ostringstream osnameFieldWire5Phys;
1295 osnameFieldWire5Phys<<
"physicalAxialLayer"<<i<<
"FieldWire5";
1296 posX=mdc->
Layer(signalLayer+1).
R()*mm*
cos(spanAngle/2.);
1297 posY=mdc->
Layer(signalLayer+1).
R()*mm*
sin(spanAngle/2.);
1298 G4VPhysicalVolume* fieldWire5_phys;
1299 fieldWire5_phys=
new G4PVPlacement(0,G4ThreeVector(posX,posY,0),fieldWire_log,
1300 osnameFieldWire5Phys.str(),replica_log,
false,5,
false);
1303 std::ostringstream osnameFieldWire6Phys;
1304 osnameFieldWire6Phys<<
"physicalAxialLayer"<<i<<
"FieldWire6";
1305 posX=mdc->
Layer(signalLayer-1).
R()*mm*
cos(spanAngle);
1306 posY=mdc->
Layer(signalLayer-1).
R()*mm*
sin(spanAngle);
1307 G4RotationMatrix* wireRot6=
new G4RotationMatrix();
1308 wireRot6->rotateZ(180*deg-spanAngle);
1309 G4VPhysicalVolume* fieldWire6_phys;
1310 fieldWire6_phys=
new G4PVPlacement(wireRot6,G4ThreeVector(posX,posY,0),fieldWireHalf_log,
1311 osnameFieldWire6Phys.str(),replica_log,
false,6,
false);
1313 std::ostringstream osnameFieldWire7Phys;
1314 osnameFieldWire7Phys<<
"physicalAxialLayer"<<i<<
"FieldWire7";
1315 posX=mdc->
Layer(signalLayer).
R()*mm*
cos(spanAngle);
1316 posY=mdc->
Layer(signalLayer).
R()*mm*
sin(spanAngle);
1317 G4RotationMatrix* wireRot7=
new G4RotationMatrix();
1318 wireRot7->rotateZ(180*deg-spanAngle);
1319 G4VPhysicalVolume* fieldWire7_phys;
1320 fieldWire7_phys=
new G4PVPlacement(wireRot7,G4ThreeVector(posX,posY,0),fieldWireHalf_log,
1321 osnameFieldWire7Phys.str(),replica_log,
false,7,
false);
1324 std::ostringstream osnameFieldWire8Phys;
1325 osnameFieldWire8Phys<<
"physicalAxialLayer"<<i<<
"FieldWire8";
1326 posX=mdc->
Layer(signalLayer+1).
R()*mm*
cos(spanAngle);
1327 posY=mdc->
Layer(signalLayer+1).
R()*mm*
sin(spanAngle);
1328 G4RotationMatrix* wireRot8=
new G4RotationMatrix();
1329 wireRot8->rotateZ(180*deg-spanAngle);
1330 G4VPhysicalVolume* fieldWire8_phys;
1331 fieldWire8_phys=
new G4PVPlacement(wireRot8,G4ThreeVector(posX,posY,0),fieldWireHalf_log,
1332 osnameFieldWire8Phys.str(),replica_log,
false,8,
false);
1336 for(j=replicaNo-1;j>-1;j--){
1337 G4RotationMatrix* cellRot=
new G4RotationMatrix();
1338 cellRot->rotateZ(-spanAngle*j);
1340 std::ostringstream osnameCellPhys;
1341 osnameCellPhys<<
"physical"<<
"MdcAxialLayer"<<i<<
"Cell"<<j;
1342 G4VPhysicalVolume* replica_phys;
1343 replica_phys=
new G4PVPlacement(cellRot,G4ThreeVector(),replica_log,
1344 osnameCellPhys.str(),axialLayer_log,
false,j,
false);
1349 for(i=7; i>-1; i--){
1352 innerR=mdc->
Layer(signalLayer-1).
R()*mm-fieldWireR;
1353 outR=mdc->
Layer(signalLayer+1).
R()*mm-fieldWireR;
1354 if(i==7)outR=mdc->
Layer(signalLayer+1).
R()*mm+fieldWireR;
1356 innerLength=(mdc->
Layer(signalLayer-1).Length())/2.*mm;
1357 outLength=(mdc->
Layer(signalLayer+1).Length())/2.*mm;
1362 innerTan=innerR/innerLength*
sin(innerTwistAngle);
1364 midInnerR=innerR*
cos(innerTwistAngle);
1365 innerStereo=atan(innerTan);
1367 outTan=outR/outLength*
sin(outTwistAngle);
1368 outTwistAngleFixed=atan(innerLength/outLength*
tan(outTwistAngle));
1370 if(
abs(outTwistAngleFixed) >=
abs(innerTwistAngle)){
1371 midOutR=outR*
cos(outTwistAngle);
1372 outRFixed=midOutR/
cos(innerTwistAngle);
1375 outTanFixed=midOutR/innerLength*
tan(innerTwistAngle);
1376 outStereo=atan(outTanFixed);
1378 outRFixed=sqrt(outR*outR+(innerLength*innerLength-outLength*outLength)*outTan*outTan);
1380 midOutR=outR*
cos(innerTwistAngle);
1382 outTanFixed=outRFixed/innerLength*
sin(innerTwistAngle);
1383 outStereo=atan(outTanFixed);
1387 std::ostringstream osnameLayerSolid;
1388 osnameLayerSolid <<
"solid"<<
"MdcStereoLayer"<<i;
1390 G4Hype* stereoLayer_hype=
new G4Hype(osnameLayerSolid.str(),midInnerR, midOutR,innerStereo,
1391 outStereo,innerLength);
1392 std::ostringstream osnameLayerLogical;
1393 osnameLayerLogical <<
"logical"<<
"MdcStereoLayer"<<i;
1394 G4LogicalVolume* stereoLayer_log=
new G4LogicalVolume(stereoLayer_hype,MdcGas,
1395 osnameLayerLogical.str(),0,0,0);
1396 stereoLayer_log->SetVisAttributes(G4VisAttributes::Invisible);
1399 spanAngle=360./replicaNo*deg;
1402 G4RotationMatrix* layerRot=
new G4RotationMatrix();
1403 layerRot->rotateZ(-(spanAngle*(1-firstWire)/2.+innerTwistAngle));
1405 std::ostringstream osnameLayerPhys;
1406 osnameLayerPhys<<
"physical"<<
"MdcStereoLayer"<<i;
1408 G4VPhysicalVolume* stereoLayer_phys;
1409 stereoLayer_phys=
new G4PVPlacement(layerRot,G4ThreeVector(),stereoLayer_log,osnameLayerPhys.str(),
1410 mdc_log,
false,i,
false);
1413 std::ostringstream osnameCellSolid;
1414 osnameCellSolid<<
"solid"<<
"MdcStereoLayer"<<i<<
"Cell";
1416 G4TwistedTubs* twistTub=
new G4TwistedTubs(osnameCellSolid.str(), -innerTwistAngle*2, innerR,outR-1.0*micrometer,innerLength,spanAngle);
1418 std::ostringstream osnameCellLogical;
1419 osnameCellLogical<<
"logical"<<
"MdcStereoLayer"<<i<<
"Cell";
1420 G4LogicalVolume* twistTub_log=
new G4LogicalVolume(twistTub, MdcGas,osnameCellLogical.str(),0,0,0);
1422 twistTub_log->SetVisAttributes(G4VisAttributes::Invisible);
1423 twistTub_log->SetSensitiveDetector( aTrackerSD );
1427 std::ostringstream osnameFieldWireSolid;
1428 osnameFieldWireSolid<<
"solid"<<
"StereoLayer"<<i<<
"FieldWire";
1429 G4Tubs* fieldWire_tube=
new G4Tubs(osnameFieldWireSolid.str(),0.,fieldWireR,innerLength,0.,360*deg);
1430 std::ostringstream osnameFieldWireLogical;
1431 osnameFieldWireLogical<<
"logical"<<
"StereoLayer"<<i<<
"FieldWire";
1432 G4LogicalVolume* fieldWire_log=
new G4LogicalVolume(fieldWire_tube,Au,osnameFieldWireLogical.str(),0,0,0);
1434 std::ostringstream osnameFieldWireSubSolid;
1435 osnameFieldWireSubSolid<<
"solid"<<
"StereoLayer"<<i<<
"FieldWireSub";
1436 G4Tubs* fieldWireSub_tube=
new G4Tubs(osnameFieldWireSubSolid.str(),0.,fieldWireR-thickOfAu,innerLength,0.,360*deg);
1437 std::ostringstream osnameFieldWireSubLogical;
1438 osnameFieldWireSubLogical<<
"logical"<<
"StereoLayer"<<i<<
"FieldWireSub";
1439 G4LogicalVolume* fieldWireSub_log=
new G4LogicalVolume(fieldWireSub_tube,Al,osnameFieldWireSubLogical.str(),0,0,0);
1440 std::ostringstream osnameFieldWireSubPhys;
1441 osnameFieldWireSubPhys<<
"physical"<<
"StereoLayer"<<i<<
"FieldWireSub";
1442 G4VPhysicalVolume* fieldWireSub_phys;
1443 fieldWireSub_phys=
new G4PVPlacement(0,G4ThreeVector(),fieldWireSub_log,
1444 osnameFieldWireSubPhys.str(),fieldWire_log,
false,0,
false);
1447 std::ostringstream osnameSignalWireSolid;
1448 osnameSignalWireSolid<<
"solid"<<
"StereoLayer"<<i<<
"SignalWire";
1449 G4Tubs* signalWire_tube=
new G4Tubs(osnameSignalWireSolid.str(),0.,signalWireR,innerLength,0.,360*deg);
1450 std::ostringstream osnameSignalWireLogical;
1451 osnameSignalWireLogical<<
"logical"<<
"StereoLayer"<<i<<
"SignalWire";
1452 G4LogicalVolume* signalWire_log=
new G4LogicalVolume(signalWire_tube,Au,osnameSignalWireLogical.str(),0,0,0);
1454 std::ostringstream osnameSignalWireSubSolid;
1455 osnameSignalWireSubSolid<<
"solid"<<
"StereoLayer"<<i<<
"SignalWireSub";
1456 G4Tubs* signalWireSub_tube=
new G4Tubs(osnameSignalWireSubSolid.str(),0.,signalWireR-thickOfAu,innerLength,0.,360*deg);
1457 std::ostringstream osnameSignalWireSubLogical;
1458 osnameSignalWireSubLogical<<
"logical"<<
"StereoLayer"<<i<<
"SignalWireSub";
1459 G4LogicalVolume* signalWireSub_log=
new G4LogicalVolume(signalWireSub_tube,W,osnameSignalWireSubLogical.str(),0,0,0);
1460 std::ostringstream osnameSignalWireSubPhys;
1461 osnameSignalWireSubPhys<<
"physical"<<
"StereoLayer"<<i<<
"SignalWireSub";
1462 G4VPhysicalVolume* signalWireSub_phys;
1463 signalWireSub_phys=
new G4PVPlacement(0,G4ThreeVector(),signalWireSub_log,
1464 osnameSignalWireSubPhys.str(),signalWire_log,
false,0,
false);
1473 G4double shiftR,midR,eastX,eastY,westX,westY;
1474 shiftR=fieldWireR+1*micrometer;
1475 midR=mdc->
Layer(signalLayer).
R()*mm;
1477 std::ostringstream osnameFieldWire0Phys;
1478 osnameFieldWire0Phys<<
"physicalStereoLayer"<<i<<
"FieldWire0";
1480 eastX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg-innerTwistAngle);
1481 eastY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle)+shiftR*
sin(90*deg-innerTwistAngle);
1482 westX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg+innerTwistAngle);
1483 westY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle)+shiftR*
sin(90*deg+innerTwistAngle);
1485 G4ThreeVector east0(eastX,eastY,innerLength);
1486 G4ThreeVector west0(westX,westY,-innerLength);
1487 east0.rotateZ(-spanAngle/2.);
1488 west0.rotateZ(-spanAngle/2.);
1490 posX=(east0.x()+west0.x())/2.;
1491 posY=(east0.y()+west0.y())/2.;
1492 G4ThreeVector line0=east0-west0;
1493 G4RotationMatrix* wireRot0=
new G4RotationMatrix();
1494 wireRot0->rotateZ(-line0.phi());
1495 wireRot0->rotateY(-line0.theta());
1496 G4VPhysicalVolume* fieldWire0_phys;
1497 fieldWire0_phys=
new G4PVPlacement(wireRot0,G4ThreeVector(posX,posY,0),fieldWire_log,
1498 osnameFieldWire0Phys.str(),twistTub_log,
false,0,
false);
1500 std::ostringstream osnameFieldWire1Phys;
1501 osnameFieldWire1Phys<<
"physicalStereoLayer"<<i<<
"FieldWire1";
1502 eastX=midR*
cos(innerTwistAngle)+shiftR*
cos(90*deg-innerTwistAngle);
1503 eastY=midR*
sin(-innerTwistAngle)+shiftR*
sin(90*deg-innerTwistAngle);
1504 westX=midR*
cos(innerTwistAngle)+shiftR*
cos(90*deg+innerTwistAngle);
1505 westY=midR*
sin(innerTwistAngle)+shiftR*
sin(90*deg+innerTwistAngle);
1506 G4ThreeVector east1(eastX,eastY,innerLength);
1507 G4ThreeVector west1(westX,westY,-innerLength);
1508 east1.rotateZ(-spanAngle/2.);
1509 west1.rotateZ(-spanAngle/2.);
1510 posX=(east1.x()+west1.x())/2.;
1511 posY=(east1.y()+west1.y())/2.;
1512 G4ThreeVector line1=east1-west1;
1513 G4RotationMatrix* wireRot1=
new G4RotationMatrix();
1514 wireRot1->rotateZ(-line1.phi());
1515 wireRot1->rotateY(-line1.theta());
1516 G4VPhysicalVolume* fieldWire1_phys;
1517 fieldWire1_phys=
new G4PVPlacement(wireRot1,G4ThreeVector(posX,posY,0),fieldWire_log,
1518 osnameFieldWire1Phys.str(),twistTub_log,
false,1,
false);
1520 std::ostringstream osnameFieldWire3Phys;
1521 osnameFieldWire3Phys<<
"physicalStereoLayer"<<i<<
"FieldWire3";
1523 eastX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1524 eastY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle);
1525 westX=(innerR+shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1526 westY=(innerR+shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle);
1528 G4ThreeVector east3(eastX,eastY,innerLength);
1529 G4ThreeVector west3(westX,westY,-innerLength);
1531 posX=(east3.x()+west3.x())/2.;
1532 posY=(east3.y()+west3.y())/2.;
1533 G4ThreeVector line3=east3-west3;
1534 G4RotationMatrix* wireRot3=
new G4RotationMatrix();
1535 wireRot3->rotateZ(-line3.phi());
1536 wireRot3->rotateY(-line3.theta());
1537 G4VPhysicalVolume* fieldWire3_phys;
1538 fieldWire3_phys=
new G4PVPlacement(wireRot3,G4ThreeVector(posX,posY,0),fieldWire_log,
1539 osnameFieldWire3Phys.str(),twistTub_log,
false,3,
false);
1541 std::ostringstream osnameSignalWire4Phys;
1542 osnameSignalWire4Phys<<
"physicalStereoLayer"<<i<<
"SignalWire4";
1544 eastX=midR*
cos(innerTwistAngle);
1545 eastY=midR*
sin(-innerTwistAngle);
1546 westX=midR*
cos(innerTwistAngle);
1547 westY=midR*
sin(innerTwistAngle);
1549 G4ThreeVector east4(eastX,eastY,innerLength);
1550 G4ThreeVector west4(westX,westY,-innerLength);
1552 posX=(east4.x()+west4.x())/2.;
1553 posY=(east4.y()+west4.y())/2.;
1554 G4ThreeVector line4=east4-west4;
1555 G4RotationMatrix* wireRot4=
new G4RotationMatrix();
1556 wireRot4->rotateZ(-line4.phi());
1557 wireRot4->rotateY(-line4.theta());
1558 G4VPhysicalVolume* signalWire4_phys;
1559 signalWire4_phys=
new G4PVPlacement(wireRot4,G4ThreeVector(posX,posY,0),signalWire_log,
1560 osnameSignalWire4Phys.str(),twistTub_log,
false,4,
false);
1563 std::ostringstream osnameFieldWire2Phys;
1564 osnameFieldWire2Phys<<
"physicalStereoLayer"<<i<<
"FieldWire2";
1566 eastX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg-innerTwistAngle);
1567 eastY=(outR-shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle)+shiftR*
sin(90*deg-innerTwistAngle);
1568 westX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle)+shiftR*
cos(90*deg+innerTwistAngle);
1569 westY=(outR-shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle)+shiftR*
sin(90*deg+innerTwistAngle);
1571 G4ThreeVector east2(eastX,eastY,innerLength);
1572 G4ThreeVector west2(westX,westY,-innerLength);
1573 east2.rotateZ(-spanAngle/2.);
1574 west2.rotateZ(-spanAngle/2.);
1576 posX=(east2.x()+west2.x())/2.;
1577 posY=(east2.y()+west2.y())/2.;
1578 G4ThreeVector line2=east2-west2;
1579 G4RotationMatrix* wireRot2=
new G4RotationMatrix();
1580 wireRot2->rotateZ(-line2.phi());
1581 wireRot2->rotateY(-line2.theta());
1582 G4VPhysicalVolume* fieldWire2_phys;
1583 fieldWire2_phys=
new G4PVPlacement(wireRot2,G4ThreeVector(posX,posY,0),fieldWire_log,
1584 osnameFieldWire2Phys.str(),twistTub_log,
false,2,
false);
1586 std::ostringstream osnameFieldWire5Phys;
1587 osnameFieldWire5Phys<<
"physicalStereoLayer"<<i<<
"FieldWire5";
1589 eastX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1590 eastY=(outR-shiftR/
cos(innerTwistAngle))*
sin(-innerTwistAngle);
1591 westX=(outR-shiftR/
cos(innerTwistAngle))*
cos(innerTwistAngle);
1592 westY=(outR-shiftR/
cos(innerTwistAngle))*
sin(innerTwistAngle);
1594 G4ThreeVector east5(eastX,eastY,innerLength);
1595 G4ThreeVector west5(westX,westY,-innerLength);
1597 posX=(east5.x()+west5.x())/2.;
1598 posY=(east5.y()+west5.y())/2.;
1599 G4ThreeVector line5=east5-west5;
1600 G4RotationMatrix* wireRot5=
new G4RotationMatrix();
1601 wireRot5->rotateZ(-line5.phi());
1602 wireRot5->rotateY(-line5.theta());
1603 G4VPhysicalVolume* fieldWire5_phys;
1604 fieldWire5_phys=
new G4PVPlacement(wireRot5,G4ThreeVector(posX,posY,0),fieldWire_log,
1605 osnameFieldWire5Phys.str(),twistTub_log,
false,5,
false);
1609 for(j=replicaNo-1;j>-1;j--){
1610 G4RotationMatrix* cellRot=
new G4RotationMatrix();
1611 cellRot->rotateZ(-spanAngle*j);
1613 std::ostringstream osnameCellPhys;
1614 osnameCellPhys<<
"physical"<<
"MdcStereoLayer"<<i<<
"Cell"<<j;
1615 G4VPhysicalVolume* twistTub_phys;
1616 twistTub_phys=
new G4PVPlacement(cellRot,G4ThreeVector(0,0,0),twistTub_log,
1617 osnameCellPhys.str(),stereoLayer_log,
false,j,
false);