#include <BesMdcConstruction.hh>
Inheritance diagram for BesMdcConstruction:
Public Member Functions | |
BesMdcConstruction () | |
~BesMdcConstruction () | |
void | Construct (G4LogicalVolume *) |
G4LogicalVolume * | FindLogicalVolume (const G4String &vn) |
Protected Attributes | |
SAXProcessor | m_sxp |
ProcessingConfigurator | m_config |
Private Member Functions | |
void | TubeConstruct (G4LogicalVolume *) |
void | StereoLayerConstruct (G4LogicalVolume *, G4int) |
void | AxialLayerConstruct (G4LogicalVolume *, G4int) |
void | AxialCellConstruct (G4LogicalVolume *, G4int, G4int) |
Private Attributes | |
G4LogicalVolume * | mdc_log |
G4VPhysicalVolume * | mdc_phys |
BesMdcGeoParameter * | mdc |
BesMdcSD * | aTrackerSD |
G4double | outR |
G4double | innerR |
G4double | length |
G4double | startAngle |
G4double | spanAngle |
G4double | posX |
G4double | posY |
G4double | posZ |
G4double | signalWireR |
G4double | fieldWireR |
G4RotationMatrix * | Rot |
G4VisAttributes * | visAtt |
Definition at line 23 of file BesMdcConstruction.hh.
BesMdcConstruction::BesMdcConstruction | ( | ) |
Definition at line 34 of file BesMdcConstruction.cc.
References BesMdcGeoParameter::GetGeo(), and mdc.
00035 : mdc_log(0),mdc_phys(0){ 00036 mdc=BesMdcGeoParameter::GetGeo(); 00037 }
BesMdcConstruction::~BesMdcConstruction | ( | ) |
void BesMdcConstruction::AxialCellConstruct | ( | G4LogicalVolume * | , | |
G4int | , | |||
G4int | ||||
) | [private] |
void BesMdcConstruction::AxialLayerConstruct | ( | G4LogicalVolume * | , | |
G4int | ||||
) | [private] |
void BesMdcConstruction::Construct | ( | G4LogicalVolume * | ) | [virtual] |
Implements BesSubdetector.
Definition at line 44 of file BesMdcConstruction.cc.
References abs, aTrackerSD, MyMdcGeomSvc::BoxEndcape(), EvtCyclic3::C, cos(), MyMdcGeomSvc::ElecNo(), BesMdcGeoParameter::FieldWireR(), fieldWireR, BesMdcLayer::FirstWire(), MyMdcGeomSvc::FixRing(), ReadBoostRoot::GetMdc(), SubDetectorG4Geo::GetTopVolume(), ReadBoostRoot::GetTuning(), H, genRecEmupikp::i, BesMdcMember::InnerR(), innerR, ganga-rec::j, BesMdcGeoParameter::Layer(), BesMdcWire::Length(), BesMdcMember::Length(), length, MyMdcGeomSvc::LengthCableTub(), mdc, mdc_log, mdc_phys, BesMdcMember::OutR(), outR, BesMdcWire::Phi(), pi, posX, posY, posZ, BesMdcWire::R(), MyMdcGeomSvc::R(), rad, BesMdcWire::RotateAngle(), BesMdcGeoParameter::Segment(), BesMdcGeoParameter::SegmentNo(), BesMdcGeoParameter::Signal2Global(), BesMdcGeoParameter::SignalWireR(), signalWireR, sin(), spanAngle, startAngle, deljobs::string, tan(), MyMdcGeomSvc::TotalElecLayerNo(), visAtt, BesMdcLayer::WireNo(), MyMdcGeomSvc::X(), MyMdcGeomSvc::Z(), and BesMdcMember::Z().
Referenced by BesDetectorConstruction::Construct().
00044 { 00045 //------------------------------------------------ 00046 // Sensitive detectors 00047 //------------------------------------------------ 00048 G4SDManager* SDman = G4SDManager::GetSDMpointer(); 00049 G4String mdcSDname = "BesMdcSD"; 00050 aTrackerSD = new BesMdcSD( mdcSDname); 00051 SDman->AddNewDetector( aTrackerSD ); 00052 00053 if(ReadBoostRoot::GetTuning())return; //No construct when tuning 00054 //Construct 00055 G4LogicalVolume *logicalMdc = 0; 00056 G4LogicalVolume *lv = 0; 00057 00058 if(ReadBoostRoot::GetMdc()==2){ 00059 MdcG4Geo* aMdcG4Geo = new MdcG4Geo(); 00060 logicalMdc = aMdcG4Geo->GetTopVolume(); 00061 if(!logicalMdc){ 00062 G4cout<<"BesMdcConstruction::Construct(), logicalMdc not found"<<G4endl; 00063 }else{ 00064 //construct Mdc 00065 mdc_phys = new G4PVPlacement(0,G4ThreeVector(0,0,0), 00066 logicalMdc, "physicalMdc",logicBes, false, 0); 00067 logicalMdc->SetVisAttributes(G4VisAttributes::Invisible); 00068 00069 //visual attributes and sensitive detector 00070 G4VisAttributes* visAttStereoLayer = new G4VisAttributes(G4Colour(0.,1.,0.)); 00071 G4VisAttributes* visAttAxialLayer = new G4VisAttributes(G4Colour(1.,0.,0.)); 00072 G4int segmentNo=mdc->SegmentNo(); 00073 G4double colorShift = 0., shift = 1.0 / (segmentNo-1); 00074 00075 for (int i = 1; i < segmentNo; i++) { 00076 std::ostringstream osnameSegment; 00077 osnameSegment << "logical" << "Mdc" << "Segment" << i; 00078 lv = (G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameSegment.str() ); 00079 G4VisAttributes* visAttSegment = new G4VisAttributes(G4Colour(1.0-colorShift, 0.0+colorShift, 0.0)); 00080 if(i<3) visAttSegment->SetForceWireframe(true); 00081 if(lv) { 00082 lv->SetVisAttributes(visAttSegment); 00083 //lv->SetVisAttributes(G4VisAttributes::Invisible); 00084 } 00085 else G4cout << "logical volume " << osnameSegment.str() << "not found " << G4endl; 00086 colorShift +=shift; 00087 } 00088 00089 for (int i = 0; i < 8; i++) { 00090 std::ostringstream osnameStereoLayer; 00091 osnameStereoLayer << "logical" << "Mdc" << "StereoLayer" << i; 00092 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameStereoLayer.str() ); 00093 if(lv) { 00094 lv->SetVisAttributes(visAttStereoLayer); 00095 lv->SetVisAttributes(G4VisAttributes::Invisible); 00096 } 00097 else G4cout << "logical volume " << osnameStereoLayer.str() << "not found " << G4endl; 00098 00099 std::ostringstream osnameTwistedTubs; 00100 osnameTwistedTubs << "logical" << "Mdc" << "StereoLayer" << i << "Cell"; 00101 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameTwistedTubs.str() ); 00102 if(lv) { 00103 lv->SetSensitiveDetector( aTrackerSD ); 00104 lv->SetVisAttributes(G4VisAttributes::Invisible); 00105 } 00106 else G4cout << "logical volume " << osnameTwistedTubs.str() << "not found " << G4endl; 00107 } 00108 00109 for (int i = 20; i < 36; i++) { 00110 std::ostringstream osnameStereoLayer; 00111 osnameStereoLayer << "logical" << "Mdc" << "StereoLayer" << i; 00112 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameStereoLayer.str() ); 00113 if(lv) { 00114 lv->SetVisAttributes(visAttStereoLayer); 00115 lv->SetVisAttributes(G4VisAttributes::Invisible); 00116 } 00117 else G4cout << "logical volume " << osnameStereoLayer.str() << "not found " << G4endl; 00118 00119 std::ostringstream osnameTwistedTubs; 00120 osnameTwistedTubs << "logical" << "Mdc" << "StereoLayer" << i << "Cell"; 00121 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameTwistedTubs.str() ); 00122 if(lv) { 00123 lv->SetSensitiveDetector( aTrackerSD ); 00124 lv->SetVisAttributes(G4VisAttributes::Invisible); 00125 } 00126 else G4cout << "logical volume " << osnameTwistedTubs.str() << "not found " << G4endl; 00127 } 00128 00129 for (int i = 8; i < 20; i++) { 00130 std::ostringstream osnameAxialLayer; 00131 osnameAxialLayer << "logical" << "Mdc" << "AxialLayer" << i; 00132 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameAxialLayer.str() ); 00133 if(lv) { 00134 lv->SetVisAttributes(visAttAxialLayer); 00135 lv->SetVisAttributes(G4VisAttributes::Invisible); 00136 } 00137 else G4cout << "logical volume " << osnameAxialLayer.str() << "not found " << G4endl; 00138 00139 std::ostringstream osnameReplica; 00140 osnameReplica << "logical" << "Mdc" << "AxialLayer" << i << "Cell"; 00141 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameReplica.str() ); 00142 if(lv) { 00143 lv->SetSensitiveDetector( aTrackerSD ); 00144 lv->SetVisAttributes(G4VisAttributes::Invisible); 00145 } 00146 else G4cout << "logical volume " << osnameReplica.str() << "not found " << G4endl; 00147 } 00148 00149 for (int i = 36; i < 43; i++) { 00150 for (int n = 0; n < 2; n++) { 00151 std::ostringstream osnameAxialLayer; 00152 osnameAxialLayer << "logical" << "Mdc" << "AxialLayer" << i << "_" << n; 00153 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameAxialLayer.str() ); 00154 if(lv) { 00155 lv->SetVisAttributes(visAttAxialLayer); 00156 lv->SetVisAttributes(G4VisAttributes::Invisible); 00157 } 00158 else G4cout << "logical volume " << osnameAxialLayer.str() << "not found " << G4endl; 00159 00160 std::ostringstream osnameReplica; 00161 osnameReplica << "logical" << "Mdc" << "AxialLayer" << i << "_" << n << "Cell"; 00162 lv=(G4LogicalVolume*)GDMLProcessor::GetInstance()->GetLogicalVolume( osnameReplica.str() ); 00163 if(lv) { 00164 lv->SetSensitiveDetector( aTrackerSD ); 00165 lv->SetVisAttributes(G4VisAttributes::Invisible); 00166 } 00167 else G4cout << "logical volume " << osnameReplica.str() << "not found " << G4endl; 00168 } 00169 } 00170 } 00171 delete aMdcG4Geo; 00172 }else { 00173 //construct with previous code. 00174 if(ReadBoostRoot::GetMdc()==3)G4cout<<"Nowire in Mdc Construct"<<G4endl; 00175 00176 //--------- Materials --------- 00177 00178 // Mdcgas He/C3H8 (60:40) 00179 G4Material* MdcGas = G4Material::GetMaterial("Mdcgas"); 00180 G4Material* Al = G4Material::GetMaterial("Aluminium"); 00181 G4Element *C =G4Element::GetElement("Carbon"); 00182 G4Element *H =G4Element::GetElement("Hydrogen"); 00183 G4Element *O =G4Element::GetElement("Oxygen"); 00184 00185 G4double density = 19.3*g/cm3; 00186 G4double a = 183.84*g/mole; 00187 G4Material* W = new G4Material("Tungsten", 74., a, density); 00188 00189 density=19.32*g/cm3; 00190 a = 196.967*g/mole; 00191 G4Material* Au= new G4Material("Au",79,a,density); 00192 00193 density=1.57*g/cm3; 00194 G4int nElement=3; 00195 G4Material* CarbonFiber=new G4Material("CarbonFiber",density,nElement); 00196 CarbonFiber->AddElement(C,0.697); 00197 CarbonFiber->AddElement(H,0.0061); 00198 CarbonFiber->AddElement(O,0.2969); 00199 00200 density = 1.42*g/cm3; 00201 G4Material* Kapton = new G4Material("Kapton", density, 3); 00202 Kapton->AddElement(O,2); 00203 Kapton->AddElement(C,5); 00204 Kapton->AddElement(H,4); 00205 00206 //Begin construct 00207 G4int i,j,k,n; 00208 G4double outR, innerR, length; 00209 G4double startAngle, spanAngle; 00210 G4double posX, posY, posZ; 00211 G4VisAttributes* visAtt; 00212 string name; 00213 //=======Mdc container 00214 00215 outR=mdc->Segment(0).OutR()*mm; 00216 innerR=mdc->Segment(0).InnerR()*mm; 00217 length=mdc->Segment(0).Length()/2.*mm; //In Geant4, soild has central-symmetry 00218 00219 startAngle=0.*deg; 00220 spanAngle=360.*deg; 00221 posX = 0.*m; 00222 posY = 0.*m; 00223 posZ = 0.*m; 00224 00225 G4Tubs* mdc_tube=new G4Tubs("solidMdc",innerR,outR,length,startAngle,spanAngle); 00226 mdc_log=new G4LogicalVolume(mdc_tube, MdcGas,"logicalMdc",0,0,0); 00227 mdc_log->SetVisAttributes(G4VisAttributes::Invisible); 00228 00229 //limits of step length 00230 // G4double maxStep = 20.*mm; 00231 00232 00233 mdc_phys= new G4PVPlacement(0, 00234 G4ThreeVector(posX ,posY ,posZ), 00235 mdc_log,"physicalMdc",logicBes,false,0); 00236 00237 00238 //======Tube and Endplane 00239 00240 G4double colorShift=0., shift=1./(mdc->SegmentNo()-1); 00241 G4double gap=0.5*micrometer; 00242 for(i=1; i<mdc->SegmentNo(); i++){ 00243 outR=mdc->Segment(i).OutR()*mm-gap; 00244 innerR=mdc->Segment(i).InnerR()*mm+gap; 00245 length=mdc->Segment(i).Length()/2.*mm-gap; 00246 startAngle=0*deg; 00247 spanAngle=360*deg; 00248 posZ=mdc->Segment(i).Z()*mm; 00249 //name=mdc->Segment(i).Name(); 00250 name="MdcSegment"; 00251 std::ostringstream osnameSolid; 00252 osnameSolid << "solid"<<name<<i; 00253 G4Tubs* segment_tube=new G4Tubs(osnameSolid.str(),innerR,outR,length,startAngle,spanAngle); 00254 std::ostringstream osnameLogical; 00255 osnameLogical << "logical"<<name<<i; 00256 G4LogicalVolume* segment_log; 00257 if(i==1||i==2){ 00258 segment_log=new G4LogicalVolume(segment_tube, CarbonFiber,osnameLogical.str(),0,0,0); 00259 }else{ 00260 segment_log=new G4LogicalVolume(segment_tube, Al,osnameLogical.str(),0,0,0); 00261 } 00262 00263 visAtt= new G4VisAttributes(G4Colour(1.0-colorShift,0.0+colorShift,0.0)); 00264 if(i<3)visAtt->SetForceWireframe(true); 00265 segment_log->SetVisAttributes(visAtt); 00266 //segment_log->SetVisAttributes(G4VisAttributes::Invisible); 00267 colorShift +=shift; 00268 00269 G4VPhysicalVolume* segment_phys; 00270 std::ostringstream osnamePhys1; 00271 osnamePhys1 << "physical"<<name<<i<<"p"; 00272 segment_phys=new G4PVPlacement(0, 00273 G4ThreeVector(posX ,posY ,posZ), 00274 segment_log,osnamePhys1.str(),mdc_log,false,0); 00275 //Endplane have two parts at +-Z 00276 if(i>2){ 00277 std::ostringstream osnamePhys2; 00278 osnamePhys2 << "physical"<<name<<i<<"m"; 00279 segment_phys=new G4PVPlacement(0, 00280 G4ThreeVector(posX ,posY ,-posZ), 00281 segment_log,osnamePhys2.str(),mdc_log,false,0); 00282 } 00283 00284 } 00285 //shielding film of inner & outer tube 00286 00287 outR=mdc->Segment(2).InnerR()*mm-gap; 00288 innerR=mdc->Segment(2).InnerR()*mm-100*micrometer; 00289 length=mdc->Segment(2).Length()/2.*mm-gap-10*mm; 00290 startAngle=0*deg; 00291 spanAngle=360*deg; 00292 posZ=mdc->Segment(2).Z()*mm; 00293 G4Tubs* segment_tube1=new G4Tubs("SolidMdcInnerFilm0",innerR,outR,length,startAngle,spanAngle); 00294 G4LogicalVolume* segment_log1; 00295 segment_log1=new G4LogicalVolume(segment_tube1, Al,"LogicalMdcInnerFilm0",0,0,0); 00296 G4VisAttributes* visAtt1= new G4VisAttributes(G4Colour(0,1.0,0.0)); 00297 segment_log1->SetVisAttributes(visAtt1); 00298 G4VPhysicalVolume* segment_phys1; 00299 segment_phys1=new G4PVPlacement(0, 00300 G4ThreeVector(posX ,posY ,posZ), 00301 segment_log1,"PhysicalMdcInnerFilm0",mdc_log,false,0); 00302 00303 outR=mdc->Segment(2).OutR()*mm+50*micrometer; 00304 innerR=mdc->Segment(2).OutR()*mm+gap; 00305 length=mdc->Segment(2).Length()/2.*mm-gap; 00306 startAngle=0*deg; 00307 spanAngle=360*deg; 00308 posZ=mdc->Segment(2).Z()*mm; 00309 G4Tubs* segment_tube2=new G4Tubs("SolidMdcInnerFilm1",innerR,outR,length,startAngle,spanAngle); 00310 G4LogicalVolume* segment_log2; 00311 segment_log2=new G4LogicalVolume(segment_tube2, Al,"LogicalMdcInnerFilm1",0,0,0); 00312 G4VisAttributes* visAtt2= new G4VisAttributes(G4Colour(0,0.0,1.0)); 00313 segment_log2->SetVisAttributes(visAtt2); 00314 G4VPhysicalVolume* segment_phys2; 00315 segment_phys2=new G4PVPlacement(0, 00316 G4ThreeVector(posX ,posY ,posZ), 00317 segment_log2,"PhysicalMdcInnerFilm1",mdc_log,false,0); 00318 00319 outR=mdc->Segment(1).InnerR()*mm-gap; 00320 innerR=mdc->Segment(1).InnerR()*mm-100*micrometer; 00321 length=mdc->Segment(1).Length()/2.*mm-gap; 00322 startAngle=0*deg; 00323 spanAngle=360*deg; 00324 posZ=mdc->Segment(1).Z()*mm; 00325 G4Tubs* segment_tube3=new G4Tubs("SolidMdcOutFilm0",innerR,outR,length,startAngle,spanAngle); 00326 G4LogicalVolume* segment_log3; 00327 segment_log3=new G4LogicalVolume(segment_tube3, Al,"LogicalMdcOutFilm0",0,0,0); 00328 G4VisAttributes* visAtt3= new G4VisAttributes(G4Colour(0,1.0,0.0)); 00329 segment_log3->SetVisAttributes(visAtt3); 00330 G4VPhysicalVolume* segment_phys3; 00331 segment_phys3=new G4PVPlacement(0, 00332 G4ThreeVector(posX ,posY ,posZ), 00333 segment_log3,"PhysicalMdcOutFilm0",mdc_log,false,0); 00334 00335 outR=mdc->Segment(1).OutR()*mm+100*micrometer; 00336 innerR=mdc->Segment(1).OutR()*mm+gap; 00337 length=mdc->Segment(1).Length()/2.*mm-gap; 00338 startAngle=0*deg; 00339 spanAngle=360*deg; 00340 posZ=mdc->Segment(1).Z()*mm; 00341 G4Tubs* segment_tube4=new G4Tubs("SolidMdcOutFilm1",innerR,outR,length,startAngle,spanAngle); 00342 G4LogicalVolume* segment_log4; 00343 segment_log4=new G4LogicalVolume(segment_tube4, Al,"LogicalMdcOutFilm1",0,0,0); 00344 G4VisAttributes* visAtt4= new G4VisAttributes(G4Colour(0,0.0,1.0)); 00345 segment_log4->SetVisAttributes(visAtt4); 00346 G4VPhysicalVolume* segment_phys4; 00347 segment_phys4=new G4PVPlacement(0, 00348 G4ThreeVector(posX ,posY ,posZ), 00349 segment_log4,"PhysicalMdcOutFilm1",mdc_log,false,0); 00350 00351 outR=mdc->Segment(1).OutR()*mm+150*micrometer; 00352 innerR=mdc->Segment(1).OutR()*mm+100*micrometer+gap; 00353 length=mdc->Segment(1).Length()/2.*mm-gap; 00354 startAngle=0*deg; 00355 spanAngle=360*deg; 00356 posZ=mdc->Segment(1).Z()*mm; 00357 G4Tubs* segment_tube5=new G4Tubs("SolidMdcOutFilm2",innerR,outR,length,startAngle,spanAngle); 00358 G4LogicalVolume* segment_log5; 00359 segment_log5=new G4LogicalVolume(segment_tube5, Kapton,"LogicalMdcOutFilm2",0,0,0); 00360 G4VisAttributes* visAtt5= new G4VisAttributes(G4Colour(0,0.5,0.5)); 00361 segment_log5->SetVisAttributes(visAtt5); 00362 G4VPhysicalVolume* segment_phys5; 00363 segment_phys5=new G4PVPlacement(0, 00364 G4ThreeVector(posX ,posY ,posZ), 00365 segment_log5,"PhysicalMdcOutFilm2",mdc_log,false,0); 00366 00367 00368 MyMdcGeomSvc* elecGeomPointer= new MyMdcGeomSvc(); 00369 00370 // sustain ring which is used to fix electronic box 00371 00372 G4Tubs*fixTub=new G4Tubs("solidFixTub",elecGeomPointer->FixRing(0)*mm,elecGeomPointer->FixRing(1)*mm,elecGeomPointer->FixRing(2)/2.*mm,0.*deg,360.*deg); 00373 G4LogicalVolume*fixTub_log=new G4LogicalVolume(fixTub,Al,"logicalFixTub"); 00374 G4VPhysicalVolume*fixTub_phys1=new G4PVPlacement(0,G4ThreeVector(0,0,1134.5*mm),fixTub_log,"physcalFixTub1",mdc_log,false,0); 00375 G4VPhysicalVolume*fixTub_phys2=new G4PVPlacement(0,G4ThreeVector(0,0,-1134.5*mm),fixTub_log,"physicalFixTub2",mdc_log,false,0); 00376 00377 00378 G4Element *Cu=G4Element::GetElement("Copper"); 00379 G4Element *Si=G4Element::GetElement("Silicon"); 00380 00381 // construct east and west endcape 00382 G4double boxDensityEndcape=1.9745*g/cm3; 00383 G4int boxNcomponenEndcape=6; 00384 G4Material *Cuu = G4Material::GetMaterial("Copper"); 00385 // construct material or element using another method!but you must include "G4NistManager.hh" 00386 // G4NistManager*man=G4NistManager::Instance(); 00387 // G4Element*Cl=man->FindOrBuildElement("Cl"); 00388 00389 G4Element *Cl =new G4Element("Chlorine","Cl",17.,35.5*g/mole); 00390 G4Material*synEndcape=new G4Material("M_synthesis",boxDensityEndcape,boxNcomponenEndcape); 00391 synEndcape->AddElement(Cu,0.50); 00392 synEndcape->AddElement(C,0.134); 00393 synEndcape->AddElement(H,0.033); 00394 synEndcape->AddElement(Si,0.11); 00395 synEndcape->AddElement(Cl,0.014); 00396 synEndcape->AddElement(O,0.209); 00397 00398 G4Box*boxEndcape=new G4Box("solidboxEndcape",elecGeomPointer->BoxEndcape(0)/2.*mm,elecGeomPointer->BoxEndcape(1)/2.*mm,elecGeomPointer->BoxEndcape(2)/2.*mm); 00399 G4LogicalVolume*boxEndcape_log=new G4LogicalVolume(boxEndcape,synEndcape,"logical boxEndcape"); 00400 visAtt= new G4VisAttributes(G4Colour(0.0,1.0,0.0)); 00401 boxEndcape_log->SetVisAttributes(visAtt); 00402 00403 // Here is my estimated values 00404 double boxCuEndDx=8.5*mm; 00405 double boxCuEndDy=12.*mm; 00406 double boxCuEndDz=29.*mm; 00407 00408 G4Box* boxCuEnd=new G4Box("solidboxCuEnd",boxCuEndDx/2.,boxCuEndDy/2.,boxCuEndDz/2.); 00409 G4LogicalVolume*boxCuEnd_log=new G4LogicalVolume(boxCuEnd,Cuu,"logical boxCuEnd"); 00410 visAtt= new G4VisAttributes(G4Colour(1.0,1.0,0.0)); 00411 boxCuEnd_log->SetVisAttributes(visAtt); 00412 // to construct a virtual box used to contain boxCuEnd and boxEndcape 00413 double dxVirtualBox=18.*mm; 00414 double dyVirtualBox=106.*mm; 00415 double dzVirtualBox=53.*mm; 00416 G4Box*virtualBoxForEndcape=new G4Box("solid virtualBoxEndcape",dxVirtualBox/2.,dyVirtualBox/2.*mm,dzVirtualBox/2.*mm); 00417 G4LogicalVolume*virtualBoxForEndcape_log=new G4LogicalVolume(virtualBoxForEndcape,G4Material::GetMaterial("Air"),"logical virtualBoxEndcape"); 00418 // virtualBoxForEndcape_log->SetVisAttributes(G4VisAttributes::Invisible); 00419 virtualBoxForEndcape_log->SetVisAttributes(visAtt); 00420 G4VPhysicalVolume*boxEndcape_phys=new G4PVPlacement(0,G4ThreeVector(elecGeomPointer->BoxEndcape(0)/2.,0,0),boxEndcape_log,"physical boxEndcape",virtualBoxForEndcape_log,false,0); 00421 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); 00422 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); 00423 const double pi=3.141593; 00424 double posXArray; 00425 double posYArray; 00426 double posZArray; 00427 double startAngleArray; 00428 00429 for (int i=0;i<elecGeomPointer->TotalElecLayerNo();i++) 00430 { 00431 startAngleArray=acos(elecGeomPointer->X(i)/elecGeomPointer->R(i)); 00432 00433 for(int j=0;j<elecGeomPointer->ElecNo(i);j++) 00434 { 00435 G4RotationMatrix*boxRotj=new G4RotationMatrix; 00436 boxRotj->rotateZ(-startAngleArray-j*2*pi/elecGeomPointer->ElecNo(i)); 00437 posXArray=elecGeomPointer->R(i)*cos((startAngleArray+j*2*pi/elecGeomPointer->ElecNo(i))); 00438 posYArray=elecGeomPointer->R(i)*sin((startAngleArray+j*2*pi/elecGeomPointer->ElecNo(i))); 00439 posZArray=elecGeomPointer->Z(i); 00440 std::ostringstream osnamephys; 00441 osnamephys<<"physicalLayer"<<i<<"Ebox"<<j; 00442 G4VPhysicalVolume*box_phys=new G4PVPlacement(boxRotj,G4ThreeVector(posXArray,posYArray,posZArray),virtualBoxForEndcape_log,osnamephys.str(),mdc_log,false,j); 00443 00444 } 00445 } 00446 00447 // cable on endcape 00448 G4double mCableDensity=6.4*g/cm3; 00449 G4Material*materialCable=new G4Material("M_materialCable",mCableDensity,3); 00450 materialCable->AddElement(Cu,0.4); 00451 materialCable->AddElement(C,0.3); 00452 materialCable->AddElement(H,0.3); 00453 00454 double gapR=0.1*micrometer; 00455 00456 // The west cable tub can be constructed via recursive alogrithm 00457 double innerRCableTub; 00458 double outerRCableTub; 00459 for(int i=0;i<11;i++) 00460 { 00461 innerRCableTub=elecGeomPointer->R(i)*mm-dxVirtualBox/2.+gapR; 00462 outerRCableTub=elecGeomPointer->R(i+1)*mm-dxVirtualBox/2.-gapR; 00463 std::ostringstream osnameCableSolid; 00464 osnameCableSolid<<"MdcCableSolidWest"<<i; 00465 G4Tubs*cableTub=new G4Tubs(osnameCableSolid.str(),innerRCableTub,outerRCableTub,elecGeomPointer->LengthCableTub(i+1)*1.15/2*mm,0*deg,360*deg); 00466 00467 std::ostringstream osnameCableLog; 00468 osnameCableLog<<"MdcCableLogWest"<<i; 00469 G4LogicalVolume*cableTub_log=new G4LogicalVolume(cableTub,materialCable,osnameCableLog.str()); 00470 visAtt= new G4VisAttributes(G4Colour(1,0.3,0.5)); 00471 cableTub_log->SetVisAttributes(visAtt); 00472 00473 std::ostringstream osnameCablePhys; 00474 osnameCablePhys<<"MdcCablePhysWest"<<i; 00475 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); 00476 } 00477 00478 // The east too 00479 for(int i=0;i<10;i++) 00480 { 00481 innerRCableTub=elecGeomPointer->R(i+12)-dxVirtualBox/2.+gapR; 00482 outerRCableTub=elecGeomPointer->R(i+12+1)-dxVirtualBox/2.-gapR; 00483 std::ostringstream osnameCableSolid; 00484 osnameCableSolid<<"MdcCableSolidEast"<<i; 00485 G4Tubs*cableTub=new G4Tubs(osnameCableSolid.str(),innerRCableTub,outerRCableTub,elecGeomPointer->LengthCableTub(i+14)*1.15/2*mm,0*deg,360*deg); 00486 00487 std::ostringstream osnameCableLog; 00488 osnameCableLog<<"MdcCableLogEast"<<i; 00489 G4LogicalVolume*cableTub_log=new G4LogicalVolume(cableTub,materialCable,osnameCableLog.str()); 00490 visAtt= new G4VisAttributes(G4Colour(1,0.3,0.5)); 00491 cableTub_log->SetVisAttributes(visAtt); 00492 00493 std::ostringstream osnameCablePhys; 00494 osnameCablePhys<<"MdcCablePhysEast"<<i; 00495 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); 00496 } 00497 00498 00499 // There's need to construct the two first cable tub . 00500 00501 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); 00502 G4LogicalVolume*cableTubBeginnerW_log=new G4LogicalVolume(cableTubBeginnerW,materialCable,"logical cableTubBeginnerW"); 00503 visAtt= new G4VisAttributes(G4Colour(0,0.3,0.8)); 00504 cableTubBeginnerW_log->SetVisAttributes(visAtt); 00505 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); 00506 //Mutiplying 1.15 is used to estimate the practicle length according to Dong Ming-yi and Liu Rong-guang. 00507 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); 00508 G4LogicalVolume*cableTubBeginnerE_log=new G4LogicalVolume(cableTubBeginnerE,materialCable,"logical cabieTubBeginnerE"); 00509 visAtt= new G4VisAttributes(G4Colour(1,0.3,0.5)); 00510 cableTubBeginnerE_log->SetVisAttributes(visAtt); 00511 00512 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); 00513 00514 00515 // There's need to construct the two cable tub(west and east) to tail seperately too. 00516 00517 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); 00518 G4LogicalVolume*cableTubToTailW_log=new G4LogicalVolume(cableTubToTailW,materialCable,"logical cableTubToTailW"); 00519 visAtt= new G4VisAttributes(G4Colour(0,0.3,0.8)); 00520 cableTubToTailW_log->SetVisAttributes(visAtt); 00521 00522 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); 00523 00524 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); 00525 00526 G4LogicalVolume*cableTubToTailE_log=new G4LogicalVolume(cableTubToTailE,materialCable,"logical cabieTubToTailE"); 00527 visAtt= new G4VisAttributes(G4Colour(1.0,0.3,0.5)); 00528 cableTubToTailE_log->SetVisAttributes(visAtt); 00529 00530 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); 00531 00532 // Construct shield plate beyond endcape 00533 00534 G4Box* box0=new G4Box("box0",10.,15.,3.); 00535 G4LogicalVolume* box0_log=new G4LogicalVolume(box0,Al,"logicalBox0",0,0,0); 00536 visAtt= new G4VisAttributes(G4Colour(1.0,0.8,0.0)); 00537 box0_log->SetVisAttributes(visAtt); 00538 00539 G4Box* box1=new G4Box("box1",3.*cos(11.28*deg),15.,81./sin(11.28*deg)/2.); 00540 G4LogicalVolume* box1_log=new G4LogicalVolume(box1,Al,"logicalBox1",0,0,0); 00541 box1_log->SetVisAttributes(visAtt); 00542 00543 G4Box* box2=new G4Box("box2",63.5,15.,3.); 00544 G4LogicalVolume* box2_log=new G4LogicalVolume(box2,Al,"logicalBox2",0,0,0); 00545 box2_log->SetVisAttributes(visAtt); 00546 00547 00548 for(i=0;i<8;i++){ 00549 G4RotationMatrix* boxRot0=new G4RotationMatrix(); 00550 boxRot0->rotateZ(-45*i*deg); 00551 posX=784.*cos(45*i*deg); 00552 posY=784.*sin(45*i*deg); 00553 posZ=1309.*mm; 00554 std::ostringstream osnameBox0PhysEast; 00555 osnameBox0PhysEast<<"physical"<< "box0p"<<i; 00556 G4VPhysicalVolume* box0p_phys=new G4PVPlacement(boxRot0,G4ThreeVector(posX ,posY ,posZ), 00557 box0_log,osnameBox0PhysEast.str(),mdc_log,false,i); 00558 00559 std::ostringstream osnameBox0PhysWest; 00560 osnameBox0PhysWest<<"physical"<< "box0m"<<i; 00561 G4VPhysicalVolume* box0m_phys=new G4PVPlacement(boxRot0,G4ThreeVector(posX ,posY ,-posZ), 00562 box0_log,osnameBox0PhysWest.str(),mdc_log,false,i); 00563 00564 00565 G4RotationMatrix* boxRot1p=new G4RotationMatrix(); 00566 boxRot1p->rotateZ(-45*i*deg); 00567 boxRot1p->rotateY(-78.72*deg); 00568 posX=570.5*cos(45*i*deg); 00569 posY=570.5*sin(45*i*deg); 00570 posZ=1268.5*mm; 00571 std::ostringstream osnameBox1PhysEast; 00572 osnameBox1PhysEast<<"physical"<< "box1p"<<i; 00573 G4VPhysicalVolume* box1p_phys=new G4PVPlacement(boxRot1p,G4ThreeVector(posX ,posY ,posZ), 00574 box1_log,osnameBox1PhysEast.str(),mdc_log,false,i); 00575 00576 G4RotationMatrix* boxRot1m=new G4RotationMatrix(); 00577 boxRot1m->rotateZ(-45*i*deg); 00578 boxRot1m->rotateY(78.72*deg); 00579 std::ostringstream osnameBox1PhysWest; 00580 osnameBox1PhysWest<<"physical"<< "box1m"<<i; 00581 G4VPhysicalVolume* box1m_phys=new G4PVPlacement(boxRot1m,G4ThreeVector(posX ,posY ,-posZ), 00582 box1_log,osnameBox1PhysWest.str(),mdc_log,false,i); 00583 00584 G4RotationMatrix* boxRot2=new G4RotationMatrix(); 00585 boxRot2->rotateZ(-45*i*deg); 00586 posX=303.5*cos(45*i*deg); 00587 posY=303.5*sin(45*i*deg); 00588 posZ=1228.*mm; 00589 std::ostringstream osnameBox2PhysEast; 00590 osnameBox2PhysEast<<"physical"<< "box2p"<<i; 00591 G4VPhysicalVolume* box2p_phys=new G4PVPlacement(boxRot2,G4ThreeVector(posX ,posY ,posZ), 00592 box2_log,osnameBox2PhysEast.str(),mdc_log,false,i); 00593 00594 std::ostringstream osnameBox2PhysWest; 00595 osnameBox2PhysWest<<"physical"<< "box2m"<<i; 00596 G4VPhysicalVolume* box2m_phys=new G4PVPlacement(boxRot2,G4ThreeVector(posX ,posY ,-posZ), 00597 box2_log,osnameBox2PhysWest.str(),mdc_log,false,i); 00598 00599 } 00600 00601 G4double rMax2=774.*mm; 00602 G4double rMin2=rMax2 - 1.*mm/sin(11.28*deg); 00603 G4double rMin1=rMin2 - 80.*mm/tan(11.28*deg); 00604 G4double rMax1=rMin1 + 1.*mm/sin(11.28*deg); 00605 G4Cons* shieldPlate0p=new G4Cons("shieldPlate0p",rMin1,rMax1,rMin2,rMax2,40.*mm,0.,360.*deg); 00606 G4LogicalVolume* shieldPlate0p_log=new G4LogicalVolume(shieldPlate0p,Al,"logicalShieldPlate0p",0,0,0); 00607 visAtt= new G4VisAttributes(G4Colour(0.0,0.0,1.0)); 00608 shieldPlate0p_log->SetVisAttributes(visAtt); 00609 posX=0.; 00610 posY=0.; 00611 posZ=1272.*mm; 00612 G4VPhysicalVolume* shieldPlate0p_phys=new G4PVPlacement(0,G4ThreeVector(posX ,posY ,posZ), 00613 shieldPlate0p_log,"physicalShieldPalte0p",mdc_log,false,0); 00614 00615 G4Cons* shieldPlate0m=new G4Cons("shieldPlate0m",rMin2,rMax2,rMin1,rMax1,40.*mm,0.,360.*deg); 00616 G4LogicalVolume* shieldPlate0m_log=new G4LogicalVolume(shieldPlate0m,Al,"logicalShieldPlate0m",0,0,0); 00617 visAtt= new G4VisAttributes(G4Colour(0.0,0.0,1.0)); 00618 shieldPlate0m_log->SetVisAttributes(visAtt); 00619 posX=0.; 00620 posY=0.; 00621 posZ=1272.*mm; 00622 G4VPhysicalVolume* shieldPlate0m_phys=new G4PVPlacement(0,G4ThreeVector(posX ,posY ,-posZ), 00623 shieldPlate0m_log,"physicalShieldPalte0m",mdc_log,false,0); 00624 00625 00626 G4Tubs* shieldPlate1=new G4Tubs("shieldPlate1",240.*mm,367.*mm,0.5*mm,0.,360.*deg); 00627 G4LogicalVolume* shieldPlate1_log=new G4LogicalVolume(shieldPlate1,Al,"logicalShieldPlate1",0,0,0); 00628 visAtt= new G4VisAttributes(G4Colour(1.0,0.0,0.0)); 00629 shieldPlate1_log->SetVisAttributes(visAtt); 00630 posX=0.; 00631 posY=0.; 00632 posZ=1231.5*mm; 00633 G4VPhysicalVolume* shieldPlate1p_phys=new G4PVPlacement(0,G4ThreeVector(posX ,posY ,posZ), 00634 shieldPlate1_log,"physicalShieldPalte1p",mdc_log,false,0); 00635 G4VPhysicalVolume* shieldPlate1m_phys=new G4PVPlacement(0,G4ThreeVector(posX ,posY ,-posZ), 00636 shieldPlate1_log,"physicalShieldPalte1m",mdc_log,false,0); 00637 00638 00639 //========Layer 00640 G4int signalLayer,firstWire; 00641 G4int replicaNo; 00642 G4double offset; 00643 00644 G4double signalWireR=mdc->SignalWireR()*micrometer; 00645 G4double fieldWireR=mdc->FieldWireR()*micrometer; 00646 G4double thickOfAu=0.7*micrometer; // All wires are goldplated. 00647 00648 G4double innerLength,innerTwistAngle,innerTan,midInnerR,innerStereo; 00649 G4double outLength,outTwistAngle,outTwistAngleFixed,outTan,midOutR,outStereo,outRFixed,outTanFixed; 00650 00651 //----Axial layers 37-43 00652 for(i=42; i>35; i--){ 00653 G4int signalLayer=mdc->Signal2Global(i); 00654 firstWire=mdc->Layer(signalLayer).FirstWire(); 00655 for(n=1;n>-1;n--){ 00656 innerR=mdc->Layer(signalLayer-1+n).R()*mm-fieldWireR; 00657 outR=mdc->Layer(signalLayer+n).R()*mm-fieldWireR; 00658 if(i==42&&n==1)outR=mdc->Layer(signalLayer+n).R()*mm+fieldWireR; 00659 length=(mdc->Layer(signalLayer-1+n).Length())/2.*mm; 00660 startAngle=0.*deg; 00661 spanAngle=360.*deg; 00662 posX = 0.*m; 00663 posY = 0.*m; 00664 posZ = 0.*m; 00665 00666 //Layer 00667 std::ostringstream osnameLayerSolid; 00668 osnameLayerSolid <<"solid"<< "MdcAxialLayer"<<i<<"_"<<n; 00669 G4Tubs* axialLayer_tube=new G4Tubs(osnameLayerSolid.str(),innerR,outR,length,startAngle,spanAngle); 00670 00671 std::ostringstream osnameLayerLogical; 00672 osnameLayerLogical <<"logical"<< "MdcAxialLayer"<<i<<"_"<<n; 00673 G4LogicalVolume* axialLayer_log=new G4LogicalVolume(axialLayer_tube, MdcGas,osnameLayerLogical.str(),0,0,0); 00674 00675 axialLayer_log->SetVisAttributes(G4VisAttributes::Invisible); 00676 00677 replicaNo=mdc->Layer(signalLayer).WireNo()/2; 00678 spanAngle=360./replicaNo*deg; 00679 00680 offset=mdc->Layer(signalLayer).Phi()*rad-firstWire*spanAngle/2.; 00681 G4RotationMatrix* layerRot=new G4RotationMatrix(); 00682 layerRot->rotateZ(-offset); 00683 00684 std::ostringstream osnameLayerPhys; 00685 osnameLayerPhys <<"physical"<< "MdcAxialLayer"<<i<<"_"<<n; 00686 G4VPhysicalVolume* axialLayer_phys; 00687 axialLayer_phys=new G4PVPlacement(layerRot, 00688 0, 00689 axialLayer_log,osnameLayerPhys.str(),mdc_log,false,i); 00690 00691 //Cell 00692 std::ostringstream osnameCellSolid; 00693 osnameCellSolid<<"solid"<< "MdcAxialLayer"<<i<<"_"<<n<<"Cell"; 00694 G4Tubs* replica_tube=new G4Tubs(osnameCellSolid.str(),innerR,outR,length,startAngle,spanAngle); 00695 00696 std::ostringstream osnameCellLogical; 00697 osnameCellLogical<<"logical"<< "MdcAxialLayer"<<i<<"_"<<n<<"Cell"; 00698 G4LogicalVolume* replica_log=new G4LogicalVolume(replica_tube,MdcGas,osnameCellLogical.str(),0,0,0); 00699 00700 replica_log->SetSensitiveDetector( aTrackerSD ); 00701 visAtt= new G4VisAttributes(G4Colour(0.0,0.0,1.0)); 00702 replica_log->SetVisAttributes(visAtt); 00703 replica_log->SetVisAttributes(G4VisAttributes::Invisible); 00704 // replica_log->SetUserLimits(new G4UserLimits(maxStep)); 00705 //Wire 00706 if(ReadBoostRoot::GetMdc()==1){ 00707 std::ostringstream osnameFieldWireSolid; 00708 osnameFieldWireSolid<<"solid"<< "AxialLayer"<<i<<"_"<<n<<"FieldWire"; 00709 G4Tubs* fieldWire_tube=new G4Tubs(osnameFieldWireSolid.str(),0.,fieldWireR,length,0.,360*deg); 00710 std::ostringstream osnameFieldWireLogical; 00711 osnameFieldWireLogical<<"logical"<< "AxialLayer"<<i<<"_"<<n<<"FieldWire"; 00712 G4LogicalVolume* fieldWire_log=new G4LogicalVolume(fieldWire_tube,Au,osnameFieldWireLogical.str(),0,0,0); 00713 00714 std::ostringstream osnameFieldWireSubSolid; 00715 osnameFieldWireSubSolid<<"solid"<< "AxialLayer"<<i<<"_"<<n<<"FieldWireSub"; 00716 G4Tubs* fieldWireSub_tube=new G4Tubs(osnameFieldWireSubSolid.str(),0.,fieldWireR-thickOfAu,length,0.,360*deg); 00717 std::ostringstream osnameFieldWireSubLogical; 00718 osnameFieldWireSubLogical<<"logical"<< "AxialLayer"<<i<<"_"<<n<<"FieldWireSub"; 00719 G4LogicalVolume* fieldWireSub_log=new G4LogicalVolume(fieldWireSub_tube,Al,osnameFieldWireSubLogical.str(),0,0,0); 00720 std::ostringstream osnameFieldWireSubPhys; 00721 osnameFieldWireSubPhys<<"physical"<< "AxialLayer"<<i<<"_"<<n<<"FieldWireSub"; 00722 G4VPhysicalVolume* fieldWireSub_phys; 00723 fieldWireSub_phys=new G4PVPlacement(0,0,fieldWireSub_log, 00724 osnameFieldWireSubPhys.str(),fieldWire_log,false,0); 00725 00726 std::ostringstream osnameFieldWireHalfSolid; 00727 osnameFieldWireHalfSolid<<"solid"<< "AxialLayer"<<i<<"_"<<n<<"FieldWireHalf"; 00728 G4Tubs* fieldWireHalf_tube=new G4Tubs(osnameFieldWireHalfSolid.str(),0.,fieldWireR,length,0.,180*deg); 00729 std::ostringstream osnameFieldWireHalfLogical; 00730 osnameFieldWireHalfLogical<<"logical"<< "AxialLayer"<<i<<"_"<<n<<"FieldWireHalf"; 00731 G4LogicalVolume* fieldWireHalf_log=new G4LogicalVolume(fieldWireHalf_tube,Au,osnameFieldWireHalfLogical.str(),0,0,0); 00732 00733 std::ostringstream osnameFieldWireHalfSubSolid; 00734 osnameFieldWireHalfSubSolid<<"solid"<< "AxialLayer"<<i<<"_"<<n<<"FieldWireHalfSub"; 00735 G4Tubs* fieldWireHalfSub_tube=new G4Tubs(osnameFieldWireHalfSubSolid.str(),0.,fieldWireR-thickOfAu,length,0.,360*deg); 00736 std::ostringstream osnameFieldWireHalfSubLogical; 00737 osnameFieldWireHalfSubLogical<<"logical"<< "AxialLayer"<<i<<"_"<<n<<"FieldWireHalfSub"; 00738 G4LogicalVolume* fieldWireHalfSub_log=new G4LogicalVolume(fieldWireHalfSub_tube,Al,osnameFieldWireHalfSubLogical.str(),0,0,0); 00739 std::ostringstream osnameFieldWireHalfSubPhys; 00740 osnameFieldWireHalfSubPhys<<"physical"<< "AxialLayer"<<i<<"_"<<n<<"FieldWireHalfSub"; 00741 G4VPhysicalVolume* fieldWireHalfSub_phys; 00742 fieldWireHalfSub_phys=new G4PVPlacement(0,0,fieldWireHalfSub_log, 00743 osnameFieldWireHalfSubPhys.str(),fieldWireHalf_log,false,0); 00744 00745 //phi <------------------->-phi 00746 // |F8 F5 F2| There are 1 signal wire S4,2 half field wire F1,7 00747 // sub1 | | in each cell of sub1 except Layer 42, 00748 // |F7 S4 F1| 1 more full field wire F5, 2 more half field wire F2,8 00749 // |-----------------| 00750 // sub0 | | Each cell of sub0 have 1 full field wire F3, 2 half 00751 // |F6 F3 F0| field wire F0,6 00752 // ------------------- 00753 if(n==0){ 00754 std::ostringstream osnameFieldWire0Phys; 00755 osnameFieldWire0Phys<<"physicalAxialLayer"<<i<<"_"<<n<<"FieldWire0"; 00756 posX=mdc->Layer(signalLayer-1).R()*mm; 00757 G4VPhysicalVolume* fieldWire0_phys; 00758 fieldWire0_phys=new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log, 00759 osnameFieldWire0Phys.str(),replica_log,false,0); 00760 00761 std::ostringstream osnameFieldWire3Phys; 00762 osnameFieldWire3Phys<<"physicalAxialLayer"<<i<<"_"<<n<<"FieldWire3"; 00763 posX=mdc->Layer(signalLayer-1).R()*mm*cos(spanAngle/2.); 00764 posY=mdc->Layer(signalLayer-1).R()*mm*sin(spanAngle/2.); 00765 G4VPhysicalVolume* fieldWire3_phys; 00766 fieldWire3_phys=new G4PVPlacement(0,G4ThreeVector(posX,posY,0),fieldWire_log, 00767 osnameFieldWire3Phys.str(),replica_log,false,3); 00768 std::ostringstream osnameFieldWire6Phys; 00769 osnameFieldWire6Phys<<"physicalAxialLayer"<<i<<"_"<<n<<"FieldWire6"; 00770 posX=mdc->Layer(signalLayer-1).R()*mm*cos(spanAngle); 00771 posY=mdc->Layer(signalLayer-1).R()*mm*sin(spanAngle); 00772 G4RotationMatrix* wireRot6=new G4RotationMatrix(); 00773 wireRot6->rotateZ(180*deg-spanAngle); 00774 G4VPhysicalVolume* fieldWire6_phys; 00775 fieldWire6_phys=new G4PVPlacement(wireRot6,G4ThreeVector(posX,posY,0),fieldWireHalf_log, 00776 osnameFieldWire6Phys.str(),replica_log,false,6); 00777 } 00778 00779 if(n==1){ 00780 std::ostringstream osnameFieldWire1Phys; 00781 osnameFieldWire1Phys<<"physicalAxialLayer"<<i<<"_"<<n<<"FieldWire1"; 00782 posX=mdc->Layer(signalLayer).R()*mm; 00783 G4VPhysicalVolume* fieldWire1_phys; 00784 fieldWire1_phys=new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log, 00785 osnameFieldWire1Phys.str(),replica_log,false,1); 00786 std::ostringstream osnameSignalWireSolid; 00787 osnameSignalWireSolid<<"solid"<< "AxialLayer"<<i<<"_"<<n<<"SignalWire"; 00788 G4Tubs* signalWire_tube=new G4Tubs(osnameSignalWireSolid.str(),0.,signalWireR,length,0.,360*deg); 00789 std::ostringstream osnameSignalWireLogical; 00790 osnameSignalWireLogical<<"logical"<< "AxialLayer"<<i<<"_"<<n<<"SignalWire"; 00791 G4LogicalVolume* signalWire_log=new G4LogicalVolume(signalWire_tube,Au,osnameSignalWireLogical.str(),0,0,0); 00792 00793 std::ostringstream osnameSignalWireSubSolid; 00794 osnameSignalWireSubSolid<<"solid"<< "AxialLayer"<<i<<"_"<<n<<"SignalWireSub"; 00795 G4Tubs* signalWireSub_tube=new G4Tubs(osnameSignalWireSubSolid.str(),0.,signalWireR-thickOfAu,length,0.,360*deg); 00796 std::ostringstream osnameSignalWireSubLogical; 00797 osnameSignalWireSubLogical<<"logical"<< "AxialLayer"<<i<<"_"<<n<<"SignalWireSub"; 00798 G4LogicalVolume* signalWireSub_log=new G4LogicalVolume(signalWireSub_tube,W,osnameSignalWireSubLogical.str(),0,0,0); 00799 std::ostringstream osnameSignalWireSubPhys; 00800 osnameSignalWireSubPhys<<"physical"<< "AxialLayer"<<i<<"_"<<n<<"SignalWireSub"; 00801 G4VPhysicalVolume* signalWireSub_phys; 00802 signalWireSub_phys=new G4PVPlacement(0,0,signalWireSub_log, 00803 osnameSignalWireSubPhys.str(),signalWire_log,false,0); 00804 00805 std::ostringstream osnameSignalWirePhys; 00806 osnameSignalWirePhys<<"physicalAxialLayer"<<i<<"_"<<n<<"SignalWire4"; 00807 posX=mdc->Layer(signalLayer).R()*mm*cos(spanAngle/2.); 00808 posY=mdc->Layer(signalLayer).R()*mm*sin(spanAngle/2.); 00809 G4VPhysicalVolume* signalWire_phys; 00810 signalWire_phys=new G4PVPlacement(0,G4ThreeVector(posX,posY,0),signalWire_log, 00811 osnameSignalWirePhys.str(),replica_log,false,4); 00812 00813 std::ostringstream osnameFieldWire7Phys; 00814 osnameFieldWire7Phys<<"physicalAxialLayer"<<i<<"_"<<n<<"FieldWire7"; 00815 posX=mdc->Layer(signalLayer).R()*mm*cos(spanAngle); 00816 posY=mdc->Layer(signalLayer).R()*mm*sin(spanAngle); 00817 G4RotationMatrix* wireRot7=new G4RotationMatrix(); 00818 wireRot7->rotateZ(180*deg-spanAngle); 00819 G4VPhysicalVolume* fieldWire7_phys; 00820 fieldWire7_phys=new G4PVPlacement(wireRot7,G4ThreeVector(posX,posY,0),fieldWireHalf_log, 00821 osnameFieldWire7Phys.str(),replica_log,false,7); 00822 if(i==42){ 00823 std::ostringstream osnameFieldWire2Phys; 00824 osnameFieldWire2Phys<<"physicalAxialLayer"<<i<<"_"<<n<<"FieldWire2"; 00825 posX=mdc->Layer(signalLayer+1).R()*mm; 00826 G4VPhysicalVolume* fieldWire2_phys; 00827 fieldWire2_phys=new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log, 00828 osnameFieldWire2Phys.str(),replica_log,false,2); 00829 00830 std::ostringstream osnameFieldWire5Phys; 00831 osnameFieldWire5Phys<<"physicalAxialLayer"<<i<<"_"<<n<<"FieldWire5"; 00832 posX=mdc->Layer(signalLayer+1).R()*mm*cos(spanAngle/2.); 00833 posY=mdc->Layer(signalLayer+1).R()*mm*sin(spanAngle/2.); 00834 G4VPhysicalVolume* fieldWire5_phys; 00835 fieldWire5_phys=new G4PVPlacement(0,G4ThreeVector(posX,posY,0),fieldWire_log, 00836 osnameFieldWire5Phys.str(),replica_log,false,5); 00837 00838 std::ostringstream osnameFieldWire8Phys; 00839 osnameFieldWire8Phys<<"physicalAxialLayer"<<i<<"_"<<n<<"FieldWire8"; 00840 posX=mdc->Layer(signalLayer+1).R()*mm*cos(spanAngle); 00841 posY=mdc->Layer(signalLayer+1).R()*mm*sin(spanAngle); 00842 G4RotationMatrix* wireRot8=new G4RotationMatrix(); 00843 wireRot8->rotateZ(180*deg-spanAngle); 00844 G4VPhysicalVolume* fieldWire8_phys; 00845 fieldWire8_phys=new G4PVPlacement(wireRot8,G4ThreeVector(posX,posY,0),fieldWireHalf_log, 00846 osnameFieldWire8Phys.str(),replica_log,false,8); 00847 } 00848 } 00849 } 00850 //Put cells into layer 00851 for(j=replicaNo-1;j>-1;j--){ 00852 G4RotationMatrix* cellRot=new G4RotationMatrix(); 00853 cellRot->rotateZ(-spanAngle*j); 00854 std::ostringstream osnameCellPhys; 00855 osnameCellPhys<<"physical"<< "MdcAxialLayer"<<i<<"_"<<n<<"Cell"<<j; 00856 G4VPhysicalVolume* replica_phys; 00857 replica_phys=new G4PVPlacement(cellRot,0,replica_log, 00858 osnameCellPhys.str(),axialLayer_log,false,j); 00859 } 00860 00861 } 00862 00863 } 00864 //----Stereo layers 21-36 00865 00866 for(i=35; i>19; i--){ 00867 signalLayer=mdc->Signal2Global(i); 00868 00869 innerR=mdc->Layer(signalLayer-1).R()*mm-fieldWireR; 00870 outR=mdc->Layer(signalLayer+1).R()*mm-fieldWireR; 00871 if(i==35)outR=mdc->Layer(signalLayer+1).R()*mm+fieldWireR; 00872 00873 innerLength=(mdc->Layer(signalLayer-1).Length())/2.*mm; 00874 outLength=(mdc->Layer(signalLayer+1).Length())/2.*mm; 00875 00876 innerTwistAngle=mdc->Layer(signalLayer-1).RotateAngle()*rad; 00877 outTwistAngle=mdc->Layer(signalLayer+1).RotateAngle()*rad; 00878 00879 innerTan=innerR/innerLength*sin(innerTwistAngle); 00880 00881 midInnerR=innerR*cos(innerTwistAngle); 00882 innerStereo=atan(innerTan); 00883 00884 outTan=outR/outLength*sin(outTwistAngle); 00885 outTwistAngleFixed=atan(innerLength/outLength*tan(outTwistAngle)); 00886 00887 if(abs(outTwistAngleFixed) >= abs(innerTwistAngle)){ 00888 midOutR=outR*cos(outTwistAngle); 00889 outRFixed=midOutR/cos(innerTwistAngle); 00890 outR=outRFixed; 00891 00892 outTanFixed=midOutR/innerLength*tan(innerTwistAngle); 00893 outStereo=atan(outTanFixed); 00894 }else{ 00895 outRFixed=sqrt(outR*outR+(innerLength*innerLength-outLength*outLength)*outTan*outTan); 00896 outR=outRFixed; 00897 midOutR=outR*cos(innerTwistAngle); 00898 00899 outTanFixed=outRFixed/innerLength*sin(innerTwistAngle); 00900 outStereo=atan(outTanFixed); 00901 } 00902 //Layer 00903 std::ostringstream osnameLayerSolid; 00904 osnameLayerSolid <<"solid"<< "MdcStereoLayer"<<i; 00905 00906 G4Hype* stereoLayer_hype=new G4Hype(osnameLayerSolid.str(),midInnerR, midOutR,innerStereo, 00907 outStereo,innerLength); 00908 00909 std::ostringstream osnameLayerLogical; 00910 osnameLayerLogical <<"logical"<< "MdcStereoLayer"<<i; 00911 G4LogicalVolume* stereoLayer_log=new G4LogicalVolume(stereoLayer_hype,MdcGas, 00912 osnameLayerLogical.str(),0,0,0); 00913 stereoLayer_log->SetVisAttributes(G4VisAttributes::Invisible); 00914 00915 replicaNo=mdc->Layer(signalLayer).WireNo()/2; 00916 spanAngle=360./replicaNo*deg; 00917 firstWire=mdc->Layer(signalLayer).FirstWire(); 00918 00919 G4RotationMatrix* layerRot=new G4RotationMatrix(); 00920 layerRot->rotateZ(-(spanAngle*(1-firstWire)/2.+innerTwistAngle)); 00921 00922 std::ostringstream osnameLayerPhys; 00923 osnameLayerPhys<<"physical"<< "MdcStereoLayer"<<i; 00924 G4VPhysicalVolume* stereoLayer_phys; 00925 stereoLayer_phys=new G4PVPlacement(layerRot,0,stereoLayer_log,osnameLayerPhys.str(), 00926 mdc_log,false,i); 00927 //Cell 00928 std::ostringstream osnameCellSolid; 00929 osnameCellSolid<<"solid"<< "MdcStereoLayer"<<i<<"Cell"; 00930 00931 G4TwistedTubs* twistTub=new G4TwistedTubs(osnameCellSolid.str(), -innerTwistAngle*2, innerR,outR-1.0*micrometer,innerLength,spanAngle); 00932 00933 std::ostringstream osnameCellLogical; 00934 osnameCellLogical<<"logical"<< "MdcStereoLayer"<<i<<"Cell"; 00935 G4LogicalVolume* twistTub_log=new G4LogicalVolume(twistTub, MdcGas,osnameCellLogical.str(),0,0,0); 00936 00937 twistTub_log->SetVisAttributes(G4VisAttributes::Invisible); 00938 twistTub_log->SetSensitiveDetector( aTrackerSD ); 00939 // twistTub_log->SetUserLimits(new G4UserLimits(maxStep)); 00940 00941 //Wire 00942 if(ReadBoostRoot::GetMdc()==1){ 00943 std::ostringstream osnameFieldWireSolid; 00944 osnameFieldWireSolid<<"solid"<< "StereoLayer"<<i<<"FieldWire"; 00945 G4Tubs* fieldWire_tube=new G4Tubs(osnameFieldWireSolid.str(),0.,fieldWireR,innerLength,0.,360*deg); 00946 std::ostringstream osnameFieldWireLogical; 00947 osnameFieldWireLogical<<"logical"<< "StereoLayer"<<i<<"FieldWire"; 00948 G4LogicalVolume* fieldWire_log=new G4LogicalVolume(fieldWire_tube,Au,osnameFieldWireLogical.str(),0,0,0); 00949 00950 std::ostringstream osnameFieldWireSubSolid; 00951 osnameFieldWireSubSolid<<"solid"<< "StereoLayer"<<i<<"FieldWireSub"; 00952 G4Tubs* fieldWireSub_tube=new G4Tubs(osnameFieldWireSubSolid.str(),0.,fieldWireR-thickOfAu,innerLength,0.,360*deg); 00953 std::ostringstream osnameFieldWireSubLogical; 00954 osnameFieldWireSubLogical<<"logical"<< "StereoLayer"<<i<<"FieldWireSub"; 00955 G4LogicalVolume* fieldWireSub_log=new G4LogicalVolume(fieldWireSub_tube,Al,osnameFieldWireSubLogical.str(),0,0,0); 00956 std::ostringstream osnameFieldWireSubPhys; 00957 osnameFieldWireSubPhys<<"physical"<< "StereoLayer"<<i<<"FieldWireSub"; 00958 G4VPhysicalVolume* fieldWireSub_phys; 00959 fieldWireSub_phys=new G4PVPlacement(0,0,fieldWireSub_log, 00960 osnameFieldWireSubPhys.str(),fieldWire_log,false,0); 00961 00962 std::ostringstream osnameSignalWireSolid; 00963 osnameSignalWireSolid<<"solid"<< "StereoLayer"<<i<<"SignalWire"; 00964 G4Tubs* signalWire_tube=new G4Tubs(osnameSignalWireSolid.str(),0.,signalWireR,innerLength,0.,360*deg); 00965 std::ostringstream osnameSignalWireLogical; 00966 osnameSignalWireLogical<<"logical"<< "StereoLayer"<<i<<"SignalWire"; 00967 G4LogicalVolume* signalWire_log=new G4LogicalVolume(signalWire_tube,Au,osnameSignalWireLogical.str(),0,0,0); 00968 00969 std::ostringstream osnameSignalWireSubSolid; 00970 osnameSignalWireSubSolid<<"solid"<< "StereoLayer"<<i<<"SignalWireSub"; 00971 G4Tubs* signalWireSub_tube=new G4Tubs(osnameSignalWireSubSolid.str(),0.,signalWireR-thickOfAu,innerLength,0.,360*deg); 00972 std::ostringstream osnameSignalWireSubLogical; 00973 osnameSignalWireSubLogical<<"logical"<< "StereoLayer"<<i<<"SignalWireSub"; 00974 G4LogicalVolume* signalWireSub_log=new G4LogicalVolume(signalWireSub_tube,W,osnameSignalWireSubLogical.str(),0,0,0); 00975 std::ostringstream osnameSignalWireSubPhys; 00976 osnameSignalWireSubPhys<<"physical"<< "StereoLayer"<<i<<"SignalWireSub"; 00977 G4VPhysicalVolume* signalWireSub_phys; 00978 signalWireSub_phys=new G4PVPlacement(0,0,signalWireSub_log, 00979 osnameSignalWireSubPhys.str(),signalWire_log,false,0); 00980 00981 //phi <------------------->-phi 00982 // | F5 F2| There are 1 signal wire S4,3 full field 00983 // | | wire F0,1,3 in each cell except Layer 35, 00984 // | S4 F1| 2 more full field wire F2,5. 00985 // | | In stereo cell we can't put half wire at edge because of 00986 // | F3 F0| overlap, so all wires are full wire,Positon of field 00987 // ----------------| wire is not at cell edge but move into cell avoid overlap 00988 G4double shiftR,midR,eastX,eastY,westX,westY; 00989 shiftR=fieldWireR+1*micrometer; 00990 midR=mdc->Layer(signalLayer).R()*mm; 00991 00992 std::ostringstream osnameFieldWire0Phys; 00993 osnameFieldWire0Phys<<"physicalStereoLayer"<<i<<"FieldWire0"; 00994 00995 eastX=(innerR+shiftR/cos(innerTwistAngle))*cos(innerTwistAngle)+shiftR*cos(90*deg-innerTwistAngle); 00996 eastY=(innerR+shiftR/cos(innerTwistAngle))*sin(-innerTwistAngle)+shiftR*sin(90*deg-innerTwistAngle); 00997 westX=(innerR+shiftR/cos(innerTwistAngle))*cos(innerTwistAngle)+shiftR*cos(90*deg+innerTwistAngle); 00998 westY=(innerR+shiftR/cos(innerTwistAngle))*sin(innerTwistAngle)+shiftR*sin(90*deg+innerTwistAngle); 00999 01000 G4ThreeVector east0(eastX,eastY,innerLength); 01001 G4ThreeVector west0(westX,westY,-innerLength); 01002 east0.rotateZ(-spanAngle/2.); 01003 west0.rotateZ(-spanAngle/2.); 01004 01005 posX=(east0.x()+west0.x())/2.; 01006 posY=(east0.y()+west0.y())/2.; 01007 G4ThreeVector line0=east0-west0; 01008 G4RotationMatrix* wireRot0=new G4RotationMatrix(); 01009 wireRot0->rotateZ(-line0.phi()); 01010 wireRot0->rotateY(-line0.theta()); 01011 G4VPhysicalVolume* fieldWire0_phys; 01012 fieldWire0_phys=new G4PVPlacement(wireRot0,G4ThreeVector(posX,posY,0),fieldWire_log, 01013 osnameFieldWire0Phys.str(),twistTub_log,false,0); 01014 01015 std::ostringstream osnameFieldWire1Phys; 01016 osnameFieldWire1Phys<<"physicalStereoLayer"<<i<<"FieldWire1"; 01017 eastX=midR*cos(innerTwistAngle)+shiftR*cos(90*deg-innerTwistAngle); 01018 eastY=midR*sin(-innerTwistAngle)+shiftR*sin(90*deg-innerTwistAngle); 01019 westX=midR*cos(innerTwistAngle)+shiftR*cos(90*deg+innerTwistAngle); 01020 westY=midR*sin(innerTwistAngle)+shiftR*sin(90*deg+innerTwistAngle); 01021 G4ThreeVector east1(eastX,eastY,innerLength); 01022 G4ThreeVector west1(westX,westY,-innerLength); 01023 east1.rotateZ(-spanAngle/2.); 01024 west1.rotateZ(-spanAngle/2.); 01025 posX=(east1.x()+west1.x())/2.; 01026 posY=(east1.y()+west1.y())/2.; 01027 G4ThreeVector line1=east1-west1; 01028 G4RotationMatrix* wireRot1=new G4RotationMatrix(); 01029 wireRot1->rotateZ(-line1.phi()); 01030 wireRot1->rotateY(-line1.theta()); 01031 G4VPhysicalVolume* fieldWire1_phys; 01032 fieldWire1_phys=new G4PVPlacement(wireRot1,G4ThreeVector(posX,posY,0),fieldWire_log, 01033 osnameFieldWire1Phys.str(),twistTub_log,false,1); 01034 01035 std::ostringstream osnameFieldWire3Phys; 01036 osnameFieldWire3Phys<<"physicalStereoLayer"<<i<<"FieldWire3"; 01037 01038 eastX=(innerR+shiftR/cos(innerTwistAngle))*cos(innerTwistAngle); 01039 eastY=(innerR+shiftR/cos(innerTwistAngle))*sin(-innerTwistAngle); 01040 westX=(innerR+shiftR/cos(innerTwistAngle))*cos(innerTwistAngle); 01041 westY=(innerR+shiftR/cos(innerTwistAngle))*sin(innerTwistAngle); 01042 01043 G4ThreeVector east3(eastX,eastY,innerLength); 01044 G4ThreeVector west3(westX,westY,-innerLength); 01045 01046 posX=(east3.x()+west3.x())/2.; 01047 posY=(east3.y()+west3.y())/2.; 01048 G4ThreeVector line3=east3-west3; 01049 G4RotationMatrix* wireRot3=new G4RotationMatrix(); 01050 wireRot3->rotateZ(-line3.phi()); 01051 wireRot3->rotateY(-line3.theta()); 01052 G4VPhysicalVolume* fieldWire3_phys; 01053 fieldWire3_phys=new G4PVPlacement(wireRot3,G4ThreeVector(posX,posY,0),fieldWire_log, 01054 osnameFieldWire3Phys.str(),twistTub_log,false,3); 01055 01056 std::ostringstream osnameSignalWire4Phys; 01057 osnameSignalWire4Phys<<"physicalStereoLayer"<<i<<"SignalWire4"; 01058 01059 eastX=midR*cos(innerTwistAngle); 01060 eastY=midR*sin(-innerTwistAngle); 01061 westX=midR*cos(innerTwistAngle); 01062 westY=midR*sin(innerTwistAngle); 01063 01064 G4ThreeVector east4(eastX,eastY,innerLength); 01065 G4ThreeVector west4(westX,westY,-innerLength); 01066 01067 posX=(east4.x()+west4.x())/2.; 01068 posY=(east4.y()+west4.y())/2.; 01069 G4ThreeVector line4=east4-west4; 01070 G4RotationMatrix* wireRot4=new G4RotationMatrix(); 01071 wireRot4->rotateZ(-line4.phi()); 01072 wireRot4->rotateY(-line4.theta()); 01073 G4VPhysicalVolume* signalWire4_phys; 01074 signalWire4_phys=new G4PVPlacement(wireRot4,G4ThreeVector(posX,posY,0),signalWire_log, 01075 osnameSignalWire4Phys.str(),twistTub_log,false,4); 01076 01077 if(i==35){ 01078 std::ostringstream osnameFieldWire2Phys; 01079 osnameFieldWire2Phys<<"physicalStereoLayer"<<i<<"FieldWire2"; 01080 01081 eastX=(outR-shiftR/cos(innerTwistAngle))*cos(innerTwistAngle)+shiftR*cos(90*deg-innerTwistAngle); 01082 eastY=(outR-shiftR/cos(innerTwistAngle))*sin(-innerTwistAngle)+shiftR*sin(90*deg-innerTwistAngle); 01083 westX=(outR-shiftR/cos(innerTwistAngle))*cos(innerTwistAngle)+shiftR*cos(90*deg+innerTwistAngle); 01084 westY=(outR-shiftR/cos(innerTwistAngle))*sin(innerTwistAngle)+shiftR*sin(90*deg+innerTwistAngle); 01085 01086 G4ThreeVector east2(eastX,eastY,innerLength); 01087 G4ThreeVector west2(westX,westY,-innerLength); 01088 east2.rotateZ(-spanAngle/2.); 01089 west2.rotateZ(-spanAngle/2.); 01090 01091 posX=(east2.x()+west2.x())/2.; 01092 posY=(east2.y()+west2.y())/2.; 01093 G4ThreeVector line2=east2-west2; 01094 G4RotationMatrix* wireRot2=new G4RotationMatrix(); 01095 wireRot2->rotateZ(-line2.phi()); 01096 wireRot2->rotateY(-line2.theta()); 01097 G4VPhysicalVolume* fieldWire2_phys; 01098 fieldWire2_phys=new G4PVPlacement(wireRot2,G4ThreeVector(posX,posY,0),fieldWire_log, 01099 osnameFieldWire2Phys.str(),twistTub_log,false,2); 01100 01101 std::ostringstream osnameFieldWire5Phys; 01102 osnameFieldWire5Phys<<"physicalStereoLayer"<<i<<"FieldWire5"; 01103 01104 eastX=(outR-shiftR/cos(innerTwistAngle))*cos(innerTwistAngle); 01105 eastY=(outR-shiftR/cos(innerTwistAngle))*sin(-innerTwistAngle); 01106 westX=(outR-shiftR/cos(innerTwistAngle))*cos(innerTwistAngle); 01107 westY=(outR-shiftR/cos(innerTwistAngle))*sin(innerTwistAngle); 01108 01109 G4ThreeVector east5(eastX,eastY,innerLength); 01110 G4ThreeVector west5(westX,westY,-innerLength); 01111 01112 posX=(east5.x()+west5.x())/2.; 01113 posY=(east5.y()+west5.y())/2.; 01114 G4ThreeVector line5=east5-west5; 01115 G4RotationMatrix* wireRot5=new G4RotationMatrix(); 01116 wireRot5->rotateZ(-line5.phi()); 01117 wireRot5->rotateY(-line5.theta()); 01118 G4VPhysicalVolume* fieldWire5_phys; 01119 fieldWire5_phys=new G4PVPlacement(wireRot5,G4ThreeVector(posX,posY,0),fieldWire_log, 01120 osnameFieldWire5Phys.str(),twistTub_log,false,5); 01121 } 01122 } 01123 //Put cells into layer 01124 for(j=replicaNo-1;j>-1;j--){ 01125 G4RotationMatrix* cellRot=new G4RotationMatrix(); 01126 cellRot->rotateZ(-spanAngle*j); 01127 01128 std::ostringstream osnameCellPhys; 01129 osnameCellPhys<<"physical"<< "MdcStereoLayer"<<i<<"Cell"<<j; 01130 G4VPhysicalVolume* twistTub_phys; 01131 twistTub_phys=new G4PVPlacement(cellRot,0,twistTub_log, 01132 osnameCellPhys.str(),stereoLayer_log,false,j); 01133 } 01134 } 01135 01136 //----Axial layers 9-20 01137 for(i=19; i>7; i--){ 01138 signalLayer=mdc->Signal2Global(i); 01139 innerR=mdc->Layer(signalLayer-1).R()*mm-fieldWireR; 01140 outR=mdc->Layer(signalLayer+1).R()*mm-fieldWireR; 01141 if(i==19)outR=mdc->Layer(signalLayer+1).R()*mm+fieldWireR; 01142 length=(mdc->Layer(signalLayer).Length())/2.*mm; 01143 startAngle=0.*deg; 01144 spanAngle=360.*deg; 01145 firstWire=mdc->Layer(signalLayer).FirstWire(); 01146 posX = 0.*m; 01147 posY = 0.*m; 01148 posZ = 0.*m; 01149 01150 //Layer 01151 std::ostringstream osnameLayerSolid; 01152 osnameLayerSolid <<"solid"<< "MdcAxialLayer"<<i; 01153 G4Tubs* axialLayer_tube=new G4Tubs(osnameLayerSolid.str(),innerR,outR,length,startAngle,spanAngle); 01154 01155 std::ostringstream osnameLayerLogical; 01156 osnameLayerLogical <<"logical"<< "MdcAxialLayer"<<i; 01157 G4LogicalVolume* axialLayer_log=new G4LogicalVolume(axialLayer_tube, MdcGas,osnameLayerLogical.str(),0,0,0); 01158 axialLayer_log->SetVisAttributes(G4VisAttributes::Invisible); 01159 01160 replicaNo=mdc->Layer(signalLayer).WireNo()/2; 01161 spanAngle=360./replicaNo*deg; 01162 01163 offset=mdc->Layer(signalLayer).Phi()*rad-firstWire*spanAngle/2.; 01164 G4RotationMatrix* layerRot=new G4RotationMatrix(); 01165 layerRot->rotateZ(-offset); 01166 01167 std::ostringstream osnameLayerPhys; 01168 osnameLayerPhys<<"physical"<< "MdcAxialLayer"<<i; 01169 G4VPhysicalVolume* axialLayer_phys; 01170 axialLayer_phys=new G4PVPlacement(layerRot,0,axialLayer_log, 01171 osnameLayerPhys.str(),mdc_log,false,i); 01172 01173 //Cell 01174 std::ostringstream osnameCellSolid; 01175 osnameCellSolid<<"solid"<< "MdcAxialLayer"<<i<<"Cell"; 01176 G4Tubs* replica_tube=new G4Tubs(osnameCellSolid.str(),innerR,outR,length,startAngle,spanAngle); 01177 01178 std::ostringstream osnameCellLogical; 01179 osnameCellLogical<<"logical"<< "MdcAxialLayer"<<i<<"Cell"; 01180 G4LogicalVolume* replica_log=new G4LogicalVolume(replica_tube,MdcGas,osnameCellLogical.str(),0,0,0); 01181 01182 replica_log->SetSensitiveDetector( aTrackerSD ); 01183 visAtt= new G4VisAttributes(G4Colour(0.0,0.0,1.0)); 01184 replica_log->SetVisAttributes(visAtt); 01185 replica_log->SetVisAttributes(G4VisAttributes::Invisible); 01186 // replica_log->SetUserLimits(new G4UserLimits(maxStep)); 01187 //Wire 01188 if(ReadBoostRoot::GetMdc()==1){ 01189 std::ostringstream osnameFieldWireSolid; 01190 osnameFieldWireSolid<<"solid"<< "AxialLayer"<<i<<"FieldWire"; 01191 G4Tubs* fieldWire_tube=new G4Tubs(osnameFieldWireSolid.str(),0.,fieldWireR,length,0.,360*deg); 01192 std::ostringstream osnameFieldWireLogical; 01193 osnameFieldWireLogical<<"logical"<< "AxialLayer"<<i<<"FieldWire"; 01194 G4LogicalVolume* fieldWire_log=new G4LogicalVolume(fieldWire_tube,Au,osnameFieldWireLogical.str(),0,0,0); 01195 01196 std::ostringstream osnameFieldWireSubSolid; 01197 osnameFieldWireSubSolid<<"solid"<< "AxialLayer"<<i<<"FieldWireSub"; 01198 G4Tubs* fieldWireSub_tube=new G4Tubs(osnameFieldWireSubSolid.str(),0.,fieldWireR-thickOfAu,length,0.,360*deg); 01199 std::ostringstream osnameFieldWireSubLogical; 01200 osnameFieldWireSubLogical<<"logical"<< "AxialLayer"<<i<<"FieldWireSub"; 01201 G4LogicalVolume* fieldWireSub_log=new G4LogicalVolume(fieldWireSub_tube,Al,osnameFieldWireSubLogical.str(),0,0,0); 01202 std::ostringstream osnameFieldWireSubPhys; 01203 osnameFieldWireSubPhys<<"physical"<< "AxialLayer"<<i<<"FieldWireSub"; 01204 G4VPhysicalVolume* fieldWireSub_phys; 01205 fieldWireSub_phys=new G4PVPlacement(0,0,fieldWireSub_log, 01206 osnameFieldWireSubPhys.str(),fieldWire_log,false,0); 01207 01208 std::ostringstream osnameFieldWireHalfSolid; 01209 osnameFieldWireHalfSolid<<"solid"<< "AxialLayer"<<i<<"FieldWireHalf"; 01210 G4Tubs* fieldWireHalf_tube=new G4Tubs(osnameFieldWireHalfSolid.str(),0.,fieldWireR,length,0.,180*deg); 01211 std::ostringstream osnameFieldWireHalfLogical; 01212 osnameFieldWireHalfLogical<<"logical"<< "AxialLayer"<<i<<"FieldWireHalf"; 01213 G4LogicalVolume* fieldWireHalf_log=new G4LogicalVolume(fieldWireHalf_tube,Au,osnameFieldWireHalfLogical.str(),0,0,0); 01214 01215 std::ostringstream osnameFieldWireHalfSubSolid; 01216 osnameFieldWireHalfSubSolid<<"solid"<< "AxialLayer"<<i<<"FieldWireHalfSub"; 01217 G4Tubs* fieldWireHalfSub_tube=new G4Tubs(osnameFieldWireHalfSubSolid.str(),0.,fieldWireR-thickOfAu,length,0.,360*deg); 01218 std::ostringstream osnameFieldWireHalfSubLogical; 01219 osnameFieldWireHalfSubLogical<<"logical"<< "AxialLayer"<<i<<"FieldWireHalfSub"; 01220 G4LogicalVolume* fieldWireHalfSub_log=new G4LogicalVolume(fieldWireHalfSub_tube,Al,osnameFieldWireHalfSubLogical.str(),0,0,0); 01221 std::ostringstream osnameFieldWireHalfSubPhys; 01222 osnameFieldWireHalfSubPhys<<"physical"<< "AxialLayer"<<i<<"FieldWireHalfSub"; 01223 G4VPhysicalVolume* fieldWireHalfSub_phys; 01224 fieldWireHalfSub_phys=new G4PVPlacement(0,0,fieldWireHalfSub_log, 01225 osnameFieldWireHalfSubPhys.str(),fieldWireHalf_log,false,0); 01226 01227 std::ostringstream osnameSignalWireSolid; 01228 osnameSignalWireSolid<<"solid"<< "AxialLayer"<<i<<"SignalWire"; 01229 G4Tubs* signalWire_tube=new G4Tubs(osnameSignalWireSolid.str(),0.,signalWireR,length,0.,360*deg); 01230 std::ostringstream osnameSignalWireLogical; 01231 osnameSignalWireLogical<<"logical"<< "AxialLayer"<<i<<"SignalWire"; 01232 G4LogicalVolume* signalWire_log=new G4LogicalVolume(signalWire_tube,Au,osnameSignalWireLogical.str(),0,0,0); 01233 01234 std::ostringstream osnameSignalWireSubSolid; 01235 osnameSignalWireSubSolid<<"solid"<< "AxialLayer"<<i<<"SignalWireSub"; 01236 G4Tubs* signalWireSub_tube=new G4Tubs(osnameSignalWireSubSolid.str(),0.,signalWireR-thickOfAu,length,0.,360*deg); 01237 std::ostringstream osnameSignalWireSubLogical; 01238 osnameSignalWireSubLogical<<"logical"<< "AxialLayer"<<i<<"SignalWireSub"; 01239 G4LogicalVolume* signalWireSub_log=new G4LogicalVolume(signalWireSub_tube,W,osnameSignalWireSubLogical.str(),0,0,0); 01240 std::ostringstream osnameSignalWireSubPhys; 01241 osnameSignalWireSubPhys<<"physical"<< "AxialLayer"<<i<<"SignalWireSub"; 01242 G4VPhysicalVolume* signalWireSub_phys; 01243 signalWireSub_phys=new G4PVPlacement(0,0,signalWireSub_log, 01244 osnameSignalWireSubPhys.str(),signalWire_log,false,0); 01245 01246 //phi <------------------->-phi 01247 // |F8 F5 F2| There are 1 signal wire S4,1 full field wire F3, 01248 // | | 4 half field wire F0,1,6,7 in each cell except 01249 // |F7 S4 F1| layer 19 , each cell have 1 more full 01250 // | | field wire F5, 2 more half field wire F2,8 01251 // |F6 F3 F0| 01252 // ------------------- 01253 std::ostringstream osnameFieldWire0Phys; 01254 osnameFieldWire0Phys<<"physicalAxialLayer"<<i<<"FieldWire0"; 01255 posX=mdc->Layer(signalLayer-1).R()*mm; 01256 G4VPhysicalVolume* fieldWire0_phys; 01257 fieldWire0_phys=new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log, 01258 osnameFieldWire0Phys.str(),replica_log,false,0); 01259 01260 std::ostringstream osnameFieldWire1Phys; 01261 osnameFieldWire1Phys<<"physicalAxialLayer"<<i<<"FieldWire1"; 01262 posX=mdc->Layer(signalLayer).R()*mm; 01263 G4VPhysicalVolume* fieldWire1_phys; 01264 fieldWire1_phys=new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log, 01265 osnameFieldWire1Phys.str(),replica_log,false,1); 01266 01267 if(i==19){ 01268 std::ostringstream osnameFieldWire2Phys; 01269 osnameFieldWire2Phys<<"physicalAxialLayer"<<i<<"FieldWire2"; 01270 posX=mdc->Layer(signalLayer+1).R()*mm; 01271 G4VPhysicalVolume* fieldWire2_phys; 01272 fieldWire2_phys=new G4PVPlacement(0,G4ThreeVector(posX,0,0),fieldWireHalf_log, 01273 osnameFieldWire2Phys.str(),replica_log,false,2); 01274 } 01275 01276 std::ostringstream osnameFieldWire3Phys; 01277 osnameFieldWire3Phys<<"physicalAxialLayer"<<i<<"FieldWire3"; 01278 posX=mdc->Layer(signalLayer-1).R()*mm*cos(spanAngle/2.); 01279 posY=mdc->Layer(signalLayer-1).R()*mm*sin(spanAngle/2.); 01280 G4VPhysicalVolume* fieldWire3_phys; 01281 fieldWire3_phys=new G4PVPlacement(0,G4ThreeVector(posX,posY,0),fieldWire_log, 01282 osnameFieldWire3Phys.str(),replica_log,false,3); 01283 01284 std::ostringstream osnameSignalWirePhys; 01285 osnameSignalWirePhys<<"physicalAxialLayer"<<i<<"SignalWire4"; 01286 posX=mdc->Layer(signalLayer).R()*mm*cos(spanAngle/2.); 01287 posY=mdc->Layer(signalLayer).R()*mm*sin(spanAngle/2.); 01288 G4VPhysicalVolume* signalWire_phys; 01289 signalWire_phys=new G4PVPlacement(0,G4ThreeVector(posX,posY,0),signalWire_log, 01290 osnameSignalWirePhys.str(),replica_log,false,4); 01291 01292 if(i==19){ 01293 std::ostringstream osnameFieldWire5Phys; 01294 osnameFieldWire5Phys<<"physicalAxialLayer"<<i<<"FieldWire5"; 01295 posX=mdc->Layer(signalLayer+1).R()*mm*cos(spanAngle/2.); 01296 posY=mdc->Layer(signalLayer+1).R()*mm*sin(spanAngle/2.); 01297 G4VPhysicalVolume* fieldWire5_phys; 01298 fieldWire5_phys=new G4PVPlacement(0,G4ThreeVector(posX,posY,0),fieldWire_log, 01299 osnameFieldWire5Phys.str(),replica_log,false,5); 01300 } 01301 01302 std::ostringstream osnameFieldWire6Phys; 01303 osnameFieldWire6Phys<<"physicalAxialLayer"<<i<<"FieldWire6"; 01304 posX=mdc->Layer(signalLayer-1).R()*mm*cos(spanAngle); 01305 posY=mdc->Layer(signalLayer-1).R()*mm*sin(spanAngle); 01306 G4RotationMatrix* wireRot6=new G4RotationMatrix(); 01307 wireRot6->rotateZ(180*deg-spanAngle); 01308 G4VPhysicalVolume* fieldWire6_phys; 01309 fieldWire6_phys=new G4PVPlacement(wireRot6,G4ThreeVector(posX,posY,0),fieldWireHalf_log, 01310 osnameFieldWire6Phys.str(),replica_log,false,6); 01311 01312 std::ostringstream osnameFieldWire7Phys; 01313 osnameFieldWire7Phys<<"physicalAxialLayer"<<i<<"FieldWire7"; 01314 posX=mdc->Layer(signalLayer).R()*mm*cos(spanAngle); 01315 posY=mdc->Layer(signalLayer).R()*mm*sin(spanAngle); 01316 G4RotationMatrix* wireRot7=new G4RotationMatrix(); 01317 wireRot7->rotateZ(180*deg-spanAngle); 01318 G4VPhysicalVolume* fieldWire7_phys; 01319 fieldWire7_phys=new G4PVPlacement(wireRot7,G4ThreeVector(posX,posY,0),fieldWireHalf_log, 01320 osnameFieldWire7Phys.str(),replica_log,false,7); 01321 01322 if(i==19){ 01323 std::ostringstream osnameFieldWire8Phys; 01324 osnameFieldWire8Phys<<"physicalAxialLayer"<<i<<"FieldWire8"; 01325 posX=mdc->Layer(signalLayer+1).R()*mm*cos(spanAngle); 01326 posY=mdc->Layer(signalLayer+1).R()*mm*sin(spanAngle); 01327 G4RotationMatrix* wireRot8=new G4RotationMatrix(); 01328 wireRot8->rotateZ(180*deg-spanAngle); 01329 G4VPhysicalVolume* fieldWire8_phys; 01330 fieldWire8_phys=new G4PVPlacement(wireRot8,G4ThreeVector(posX,posY,0),fieldWireHalf_log, 01331 osnameFieldWire8Phys.str(),replica_log,false,8); 01332 } 01333 } 01334 //Put cells into layer 01335 for(j=replicaNo-1;j>-1;j--){ 01336 G4RotationMatrix* cellRot=new G4RotationMatrix(); 01337 cellRot->rotateZ(-spanAngle*j); 01338 01339 std::ostringstream osnameCellPhys; 01340 osnameCellPhys<<"physical"<< "MdcAxialLayer"<<i<<"Cell"<<j; 01341 G4VPhysicalVolume* replica_phys; 01342 replica_phys=new G4PVPlacement(cellRot,0,replica_log, 01343 osnameCellPhys.str(),axialLayer_log,false,j); 01344 } 01345 } 01346 01347 //----Stereo layers 1-8 01348 for(i=7; i>-1; i--){ 01349 signalLayer=mdc->Signal2Global(i); 01350 01351 innerR=mdc->Layer(signalLayer-1).R()*mm-fieldWireR; 01352 outR=mdc->Layer(signalLayer+1).R()*mm-fieldWireR; 01353 if(i==7)outR=mdc->Layer(signalLayer+1).R()*mm+fieldWireR; 01354 01355 innerLength=(mdc->Layer(signalLayer-1).Length())/2.*mm; 01356 outLength=(mdc->Layer(signalLayer+1).Length())/2.*mm; 01357 01358 innerTwistAngle=mdc->Layer(signalLayer-1).RotateAngle()*rad; 01359 outTwistAngle=mdc->Layer(signalLayer+1).RotateAngle()*rad; 01360 01361 innerTan=innerR/innerLength*sin(innerTwistAngle); 01362 01363 midInnerR=innerR*cos(innerTwistAngle); 01364 innerStereo=atan(innerTan); 01365 01366 outTan=outR/outLength*sin(outTwistAngle); 01367 outTwistAngleFixed=atan(innerLength/outLength*tan(outTwistAngle)); 01368 01369 if(abs(outTwistAngleFixed) >= abs(innerTwistAngle)){ 01370 midOutR=outR*cos(outTwistAngle); 01371 outRFixed=midOutR/cos(innerTwistAngle); 01372 outR=outRFixed; 01373 01374 outTanFixed=midOutR/innerLength*tan(innerTwistAngle); 01375 outStereo=atan(outTanFixed); 01376 }else{ 01377 outRFixed=sqrt(outR*outR+(innerLength*innerLength-outLength*outLength)*outTan*outTan); 01378 outR=outRFixed; 01379 midOutR=outR*cos(innerTwistAngle); 01380 01381 outTanFixed=outRFixed/innerLength*sin(innerTwistAngle); 01382 outStereo=atan(outTanFixed); 01383 } 01384 01385 //Layer 01386 std::ostringstream osnameLayerSolid; 01387 osnameLayerSolid <<"solid"<< "MdcStereoLayer"<<i; 01388 01389 G4Hype* stereoLayer_hype=new G4Hype(osnameLayerSolid.str(),midInnerR, midOutR,innerStereo, 01390 outStereo,innerLength); 01391 std::ostringstream osnameLayerLogical; 01392 osnameLayerLogical <<"logical"<< "MdcStereoLayer"<<i; 01393 G4LogicalVolume* stereoLayer_log=new G4LogicalVolume(stereoLayer_hype,MdcGas, 01394 osnameLayerLogical.str(),0,0,0); 01395 stereoLayer_log->SetVisAttributes(G4VisAttributes::Invisible); 01396 01397 replicaNo=mdc->Layer(signalLayer).WireNo()/2; 01398 spanAngle=360./replicaNo*deg; 01399 firstWire=mdc->Layer(signalLayer).FirstWire(); 01400 01401 G4RotationMatrix* layerRot=new G4RotationMatrix(); 01402 layerRot->rotateZ(-(spanAngle*(1-firstWire)/2.+innerTwistAngle)); 01403 01404 std::ostringstream osnameLayerPhys; 01405 osnameLayerPhys<<"physical"<< "MdcStereoLayer"<<i; 01406 01407 G4VPhysicalVolume* stereoLayer_phys; 01408 stereoLayer_phys=new G4PVPlacement(layerRot,0,stereoLayer_log,osnameLayerPhys.str(), 01409 mdc_log,false,i); 01410 01411 //Cell 01412 std::ostringstream osnameCellSolid; 01413 osnameCellSolid<<"solid"<< "MdcStereoLayer"<<i<<"Cell"; 01414 01415 G4TwistedTubs* twistTub=new G4TwistedTubs(osnameCellSolid.str(), -innerTwistAngle*2, innerR,outR-1.0*micrometer,innerLength,spanAngle); 01416 01417 std::ostringstream osnameCellLogical; 01418 osnameCellLogical<<"logical"<< "MdcStereoLayer"<<i<<"Cell"; 01419 G4LogicalVolume* twistTub_log=new G4LogicalVolume(twistTub, MdcGas,osnameCellLogical.str(),0,0,0); 01420 01421 twistTub_log->SetVisAttributes(G4VisAttributes::Invisible); 01422 twistTub_log->SetSensitiveDetector( aTrackerSD ); 01423 // twistTub_log->SetUserLimits(new G4UserLimits(maxStep)); 01424 //Wire 01425 if(ReadBoostRoot::GetMdc()==1){ 01426 std::ostringstream osnameFieldWireSolid; 01427 osnameFieldWireSolid<<"solid"<< "StereoLayer"<<i<<"FieldWire"; 01428 G4Tubs* fieldWire_tube=new G4Tubs(osnameFieldWireSolid.str(),0.,fieldWireR,innerLength,0.,360*deg); 01429 std::ostringstream osnameFieldWireLogical; 01430 osnameFieldWireLogical<<"logical"<< "StereoLayer"<<i<<"FieldWire"; 01431 G4LogicalVolume* fieldWire_log=new G4LogicalVolume(fieldWire_tube,Au,osnameFieldWireLogical.str(),0,0,0); 01432 01433 std::ostringstream osnameFieldWireSubSolid; 01434 osnameFieldWireSubSolid<<"solid"<< "StereoLayer"<<i<<"FieldWireSub"; 01435 G4Tubs* fieldWireSub_tube=new G4Tubs(osnameFieldWireSubSolid.str(),0.,fieldWireR-thickOfAu,innerLength,0.,360*deg); 01436 std::ostringstream osnameFieldWireSubLogical; 01437 osnameFieldWireSubLogical<<"logical"<< "StereoLayer"<<i<<"FieldWireSub"; 01438 G4LogicalVolume* fieldWireSub_log=new G4LogicalVolume(fieldWireSub_tube,Al,osnameFieldWireSubLogical.str(),0,0,0); 01439 std::ostringstream osnameFieldWireSubPhys; 01440 osnameFieldWireSubPhys<<"physical"<< "StereoLayer"<<i<<"FieldWireSub"; 01441 G4VPhysicalVolume* fieldWireSub_phys; 01442 fieldWireSub_phys=new G4PVPlacement(0,0,fieldWireSub_log, 01443 osnameFieldWireSubPhys.str(),fieldWire_log,false,0); 01444 01445 01446 std::ostringstream osnameSignalWireSolid; 01447 osnameSignalWireSolid<<"solid"<< "StereoLayer"<<i<<"SignalWire"; 01448 G4Tubs* signalWire_tube=new G4Tubs(osnameSignalWireSolid.str(),0.,signalWireR,innerLength,0.,360*deg); 01449 std::ostringstream osnameSignalWireLogical; 01450 osnameSignalWireLogical<<"logical"<< "StereoLayer"<<i<<"SignalWire"; 01451 G4LogicalVolume* signalWire_log=new G4LogicalVolume(signalWire_tube,Au,osnameSignalWireLogical.str(),0,0,0); 01452 01453 std::ostringstream osnameSignalWireSubSolid; 01454 osnameSignalWireSubSolid<<"solid"<< "StereoLayer"<<i<<"SignalWireSub"; 01455 G4Tubs* signalWireSub_tube=new G4Tubs(osnameSignalWireSubSolid.str(),0.,signalWireR-thickOfAu,innerLength,0.,360*deg); 01456 std::ostringstream osnameSignalWireSubLogical; 01457 osnameSignalWireSubLogical<<"logical"<< "StereoLayer"<<i<<"SignalWireSub"; 01458 G4LogicalVolume* signalWireSub_log=new G4LogicalVolume(signalWireSub_tube,W,osnameSignalWireSubLogical.str(),0,0,0); 01459 std::ostringstream osnameSignalWireSubPhys; 01460 osnameSignalWireSubPhys<<"physical"<< "StereoLayer"<<i<<"SignalWireSub"; 01461 G4VPhysicalVolume* signalWireSub_phys; 01462 signalWireSub_phys=new G4PVPlacement(0,0,signalWireSub_log, 01463 osnameSignalWireSubPhys.str(),signalWire_log,false,0); 01464 01465 //phi <------------------->-phi 01466 // | F5 F2| There are 1 signal wire S4,3 full field 01467 // | | wire F0,1,3 in each cell except layer 7 , 01468 // | S4 F1| 2 more full field wire F2,5. 01469 // | | In stereo cell we can't put half wire at edge because of 01470 // | F3 F0| overlap, so all wires are full wire,Positon of field 01471 // ----------------| wire is not at cell edge but move into cell avoid overlap 01472 G4double shiftR,midR,eastX,eastY,westX,westY; 01473 shiftR=fieldWireR+1*micrometer; 01474 midR=mdc->Layer(signalLayer).R()*mm; 01475 01476 std::ostringstream osnameFieldWire0Phys; 01477 osnameFieldWire0Phys<<"physicalStereoLayer"<<i<<"FieldWire0"; 01478 01479 eastX=(innerR+shiftR/cos(innerTwistAngle))*cos(innerTwistAngle)+shiftR*cos(90*deg-innerTwistAngle); 01480 eastY=(innerR+shiftR/cos(innerTwistAngle))*sin(-innerTwistAngle)+shiftR*sin(90*deg-innerTwistAngle); 01481 westX=(innerR+shiftR/cos(innerTwistAngle))*cos(innerTwistAngle)+shiftR*cos(90*deg+innerTwistAngle); 01482 westY=(innerR+shiftR/cos(innerTwistAngle))*sin(innerTwistAngle)+shiftR*sin(90*deg+innerTwistAngle); 01483 01484 G4ThreeVector east0(eastX,eastY,innerLength); 01485 G4ThreeVector west0(westX,westY,-innerLength); 01486 east0.rotateZ(-spanAngle/2.); 01487 west0.rotateZ(-spanAngle/2.); 01488 01489 posX=(east0.x()+west0.x())/2.; 01490 posY=(east0.y()+west0.y())/2.; 01491 G4ThreeVector line0=east0-west0; 01492 G4RotationMatrix* wireRot0=new G4RotationMatrix(); 01493 wireRot0->rotateZ(-line0.phi()); 01494 wireRot0->rotateY(-line0.theta()); 01495 G4VPhysicalVolume* fieldWire0_phys; 01496 fieldWire0_phys=new G4PVPlacement(wireRot0,G4ThreeVector(posX,posY,0),fieldWire_log, 01497 osnameFieldWire0Phys.str(),twistTub_log,false,0); 01498 01499 std::ostringstream osnameFieldWire1Phys; 01500 osnameFieldWire1Phys<<"physicalStereoLayer"<<i<<"FieldWire1"; 01501 eastX=midR*cos(innerTwistAngle)+shiftR*cos(90*deg-innerTwistAngle); 01502 eastY=midR*sin(-innerTwistAngle)+shiftR*sin(90*deg-innerTwistAngle); 01503 westX=midR*cos(innerTwistAngle)+shiftR*cos(90*deg+innerTwistAngle); 01504 westY=midR*sin(innerTwistAngle)+shiftR*sin(90*deg+innerTwistAngle); 01505 G4ThreeVector east1(eastX,eastY,innerLength); 01506 G4ThreeVector west1(westX,westY,-innerLength); 01507 east1.rotateZ(-spanAngle/2.); 01508 west1.rotateZ(-spanAngle/2.); 01509 posX=(east1.x()+west1.x())/2.; 01510 posY=(east1.y()+west1.y())/2.; 01511 G4ThreeVector line1=east1-west1; 01512 G4RotationMatrix* wireRot1=new G4RotationMatrix(); 01513 wireRot1->rotateZ(-line1.phi()); 01514 wireRot1->rotateY(-line1.theta()); 01515 G4VPhysicalVolume* fieldWire1_phys; 01516 fieldWire1_phys=new G4PVPlacement(wireRot1,G4ThreeVector(posX,posY,0),fieldWire_log, 01517 osnameFieldWire1Phys.str(),twistTub_log,false,1); 01518 01519 std::ostringstream osnameFieldWire3Phys; 01520 osnameFieldWire3Phys<<"physicalStereoLayer"<<i<<"FieldWire3"; 01521 01522 eastX=(innerR+shiftR/cos(innerTwistAngle))*cos(innerTwistAngle); 01523 eastY=(innerR+shiftR/cos(innerTwistAngle))*sin(-innerTwistAngle); 01524 westX=(innerR+shiftR/cos(innerTwistAngle))*cos(innerTwistAngle); 01525 westY=(innerR+shiftR/cos(innerTwistAngle))*sin(innerTwistAngle); 01526 01527 G4ThreeVector east3(eastX,eastY,innerLength); 01528 G4ThreeVector west3(westX,westY,-innerLength); 01529 01530 posX=(east3.x()+west3.x())/2.; 01531 posY=(east3.y()+west3.y())/2.; 01532 G4ThreeVector line3=east3-west3; 01533 G4RotationMatrix* wireRot3=new G4RotationMatrix(); 01534 wireRot3->rotateZ(-line3.phi()); 01535 wireRot3->rotateY(-line3.theta()); 01536 G4VPhysicalVolume* fieldWire3_phys; 01537 fieldWire3_phys=new G4PVPlacement(wireRot3,G4ThreeVector(posX,posY,0),fieldWire_log, 01538 osnameFieldWire3Phys.str(),twistTub_log,false,3); 01539 01540 std::ostringstream osnameSignalWire4Phys; 01541 osnameSignalWire4Phys<<"physicalStereoLayer"<<i<<"SignalWire4"; 01542 01543 eastX=midR*cos(innerTwistAngle); 01544 eastY=midR*sin(-innerTwistAngle); 01545 westX=midR*cos(innerTwistAngle); 01546 westY=midR*sin(innerTwistAngle); 01547 01548 G4ThreeVector east4(eastX,eastY,innerLength); 01549 G4ThreeVector west4(westX,westY,-innerLength); 01550 01551 posX=(east4.x()+west4.x())/2.; 01552 posY=(east4.y()+west4.y())/2.; 01553 G4ThreeVector line4=east4-west4; 01554 G4RotationMatrix* wireRot4=new G4RotationMatrix(); 01555 wireRot4->rotateZ(-line4.phi()); 01556 wireRot4->rotateY(-line4.theta()); 01557 G4VPhysicalVolume* signalWire4_phys; 01558 signalWire4_phys=new G4PVPlacement(wireRot4,G4ThreeVector(posX,posY,0),signalWire_log, 01559 osnameSignalWire4Phys.str(),twistTub_log,false,4); 01560 01561 if(i==7){ 01562 std::ostringstream osnameFieldWire2Phys; 01563 osnameFieldWire2Phys<<"physicalStereoLayer"<<i<<"FieldWire2"; 01564 01565 eastX=(outR-shiftR/cos(innerTwistAngle))*cos(innerTwistAngle)+shiftR*cos(90*deg-innerTwistAngle); 01566 eastY=(outR-shiftR/cos(innerTwistAngle))*sin(-innerTwistAngle)+shiftR*sin(90*deg-innerTwistAngle); 01567 westX=(outR-shiftR/cos(innerTwistAngle))*cos(innerTwistAngle)+shiftR*cos(90*deg+innerTwistAngle); 01568 westY=(outR-shiftR/cos(innerTwistAngle))*sin(innerTwistAngle)+shiftR*sin(90*deg+innerTwistAngle); 01569 01570 G4ThreeVector east2(eastX,eastY,innerLength); 01571 G4ThreeVector west2(westX,westY,-innerLength); 01572 east2.rotateZ(-spanAngle/2.); 01573 west2.rotateZ(-spanAngle/2.); 01574 01575 posX=(east2.x()+west2.x())/2.; 01576 posY=(east2.y()+west2.y())/2.; 01577 G4ThreeVector line2=east2-west2; 01578 G4RotationMatrix* wireRot2=new G4RotationMatrix(); 01579 wireRot2->rotateZ(-line2.phi()); 01580 wireRot2->rotateY(-line2.theta()); 01581 G4VPhysicalVolume* fieldWire2_phys; 01582 fieldWire2_phys=new G4PVPlacement(wireRot2,G4ThreeVector(posX,posY,0),fieldWire_log, 01583 osnameFieldWire2Phys.str(),twistTub_log,false,2); 01584 01585 std::ostringstream osnameFieldWire5Phys; 01586 osnameFieldWire5Phys<<"physicalStereoLayer"<<i<<"FieldWire5"; 01587 01588 eastX=(outR-shiftR/cos(innerTwistAngle))*cos(innerTwistAngle); 01589 eastY=(outR-shiftR/cos(innerTwistAngle))*sin(-innerTwistAngle); 01590 westX=(outR-shiftR/cos(innerTwistAngle))*cos(innerTwistAngle); 01591 westY=(outR-shiftR/cos(innerTwistAngle))*sin(innerTwistAngle); 01592 01593 G4ThreeVector east5(eastX,eastY,innerLength); 01594 G4ThreeVector west5(westX,westY,-innerLength); 01595 01596 posX=(east5.x()+west5.x())/2.; 01597 posY=(east5.y()+west5.y())/2.; 01598 G4ThreeVector line5=east5-west5; 01599 G4RotationMatrix* wireRot5=new G4RotationMatrix(); 01600 wireRot5->rotateZ(-line5.phi()); 01601 wireRot5->rotateY(-line5.theta()); 01602 G4VPhysicalVolume* fieldWire5_phys; 01603 fieldWire5_phys=new G4PVPlacement(wireRot5,G4ThreeVector(posX,posY,0),fieldWire_log, 01604 osnameFieldWire5Phys.str(),twistTub_log,false,5); 01605 } 01606 } 01607 //Put cells into layer 01608 for(j=replicaNo-1;j>-1;j--){ 01609 G4RotationMatrix* cellRot=new G4RotationMatrix(); 01610 cellRot->rotateZ(-spanAngle*j); 01611 01612 std::ostringstream osnameCellPhys; 01613 osnameCellPhys<<"physical"<< "MdcStereoLayer"<<i<<"Cell"<<j; 01614 G4VPhysicalVolume* twistTub_phys; 01615 twistTub_phys=new G4PVPlacement(cellRot,0,twistTub_log, 01616 osnameCellPhys.str(),stereoLayer_log,false,j); 01617 } 01618 } 01619 01620 } 01621 }
G4LogicalVolume * BesSubdetector::FindLogicalVolume | ( | const G4String & | vn | ) | [inline, inherited] |
Definition at line 38 of file BesSubdetector.hh.
Referenced by BesTofConstruction::Construct(), BesMucConstruction::Construct(), and BesEmcConstruction::GetLogicalVolume().
00038 { 00039 return const_cast<G4LogicalVolume*>( GDMLProcessor::GetInstance()->GetLogicalVolume(vn) ); 00040 }
void BesMdcConstruction::StereoLayerConstruct | ( | G4LogicalVolume * | , | |
G4int | ||||
) | [private] |
void BesMdcConstruction::TubeConstruct | ( | G4LogicalVolume * | ) | [private] |
BesMdcSD* BesMdcConstruction::aTrackerSD [private] |
G4double BesMdcConstruction::fieldWireR [private] |
G4double BesMdcConstruction::innerR [private] |
G4double BesMdcConstruction::length [private] |
ProcessingConfigurator BesSubdetector::m_config [protected, inherited] |
Definition at line 33 of file BesSubdetector.hh.
SAXProcessor BesSubdetector::m_sxp [protected, inherited] |
Definition at line 32 of file BesSubdetector.hh.
BesMdcGeoParameter* BesMdcConstruction::mdc [private] |
Definition at line 45 of file BesMdcConstruction.hh.
Referenced by BesMdcConstruction(), and Construct().
G4LogicalVolume* BesMdcConstruction::mdc_log [private] |
G4VPhysicalVolume* BesMdcConstruction::mdc_phys [private] |
G4double BesMdcConstruction::outR [private] |
G4double BesMdcConstruction::posX [private] |
G4double BesMdcConstruction::posY [private] |
G4double BesMdcConstruction::posZ [private] |
G4RotationMatrix* BesMdcConstruction::Rot [private] |
Definition at line 53 of file BesMdcConstruction.hh.
G4double BesMdcConstruction::signalWireR [private] |
G4double BesMdcConstruction::spanAngle [private] |
G4double BesMdcConstruction::startAngle [private] |
G4VisAttributes* BesMdcConstruction::visAtt [private] |