/scratch0/jsnuveri/BDSIM/BDSIMgit/bdsim/src/BDSLens.cc

00001 #include "BDSGlobalConstants.hh" 
00002 #include "BDSLens.hh"
00003 #include "BDSMaterials.hh"
00004 #include "G4VisAttributes.hh"
00005 #include "G4LogicalVolume.hh"
00006 #include "G4VPhysicalVolume.hh"
00007 #include "G4Tubs.hh"
00008 #include "BDSDebug.hh"
00009 #include "G4SubtractionSolid.hh"
00010 #include "G4IntersectionSolid.hh"
00011 #include "G4Orb.hh"
00012 
00013 #include "BDSDebug.hh"
00014 
00015 //============================================================
00016 BDSLens::BDSLens (G4String name, G4double diameter, G4double rho, G4double centreThickness):
00017 _name(name+"_Lens"), _diameter(diameter), _rho(rho), _centreThickness(centreThickness)
00018 {
00019   G4cout << __METHOD_NAME__ << G4endl;
00020   build();
00021 }
00022 
00023 
00024 void BDSLens::visAtt()
00025 {
00026   G4cout << __METHOD_NAME__ << G4endl;
00027   _visAtt=new G4VisAttributes(G4Colour(0.5,0.8,0.5,0.3));
00028   _visAtt->SetForceSolid(true);
00029   _log->SetVisAttributes(_visAtt);
00030 }
00031 
00032 void BDSLens::build(){
00033   G4cout << __METHOD_NAME__ << G4endl;
00034   G4Tubs* tube = new G4Tubs(_name+"_tempTube", _diameter, _rho,_rho,0,CLHEP::twopi*CLHEP::radian);
00035   G4SubtractionSolid* sideA = new G4SubtractionSolid(_name+"_sideA",new G4Orb(_name+"_tempOrbA",_rho),tube);
00036   G4SubtractionSolid* sideB = new G4SubtractionSolid(_name+"_sideB",new G4Orb(_name+"_tempOrbB",_rho),tube);
00037 
00038   //  G4SubtractionSolid* sideA = new G4Orb(_name+"_tempOrbA",_rho);
00039   //  G4SubtractionSolid* sideB = new G4Orb(_name+"_tempOrbB",_rho);
00040 
00041   G4ThreeVector transVec;
00042   transVec.setZ(2*_rho-_centreThickness);
00043   G4IntersectionSolid* intersectionA = new G4IntersectionSolid(_name+"_intersectionA", sideA, sideB, (G4RotationMatrix*)NULL,transVec);
00044   transVec.setZ(-1*_rho+_centreThickness/2.0);
00045   //  _solid = new G4IntersectionSolid(_name+"_solid", new G4Box(_name+"tempBox",_diameter/2.0,_diameter/2.0,_centreThickness/2.0), intersectionA,(G4RotationMatrix*)NULL,transVec);
00046   _solid = new G4IntersectionSolid(_name+"_solid", new G4Tubs(_name+"tempTube2",0,_diameter/2.0,_centreThickness/2.0,0,CLHEP::twopi*CLHEP::radian), intersectionA,(G4RotationMatrix*)NULL,transVec);
00047   _log = new G4LogicalVolume(_solid,BDSMaterials::Instance()->GetMaterial("n-bk7"),(_name+"_log").c_str(),0,0,0);
00048   visAtt();
00049 }
00050 
00051 G4String BDSLens::name(){
00052   G4cout << __METHOD_NAME__ << G4endl;
00053   return _name;
00054 }
00055 
00056 G4LogicalVolume* BDSLens::log(){
00057   G4cout << __METHOD_NAME__ << G4endl;
00058   return _log;
00059 }
00060 
00061 BDSLens::~BDSLens(){
00062 }

Generated on 28 Jun 2015 for BDSIM by  doxygen 1.4.7