00001
00002
00003
00004
00005
00006 #include "BDSGlobalConstants.hh"
00007
00008 #include "BDSLaserWire.hh"
00009 #include "G4Box.hh"
00010 #include "G4Tubs.hh"
00011 #include "G4VisAttributes.hh"
00012 #include "G4LogicalVolume.hh"
00013 #include "G4VPhysicalVolume.hh"
00014 #include "G4PVPlacement.hh"
00015 #include "G4UserLimits.hh"
00016
00017 #include <map>
00018
00019 typedef std::map<G4String,int> LogVolCountMap;
00020 extern LogVolCountMap* LogVolCount;
00021
00022 typedef std::map<G4String,G4LogicalVolume*> LogVolMap;
00023 extern LogVolMap* LogVol;
00024
00025 extern BDSMaterials* theMaterials;
00026
00027
00028 BDSLaserWire::BDSLaserWire (G4String aName,G4double aLength,
00029 G4double aWavelength, G4ThreeVector aDirection,
00030 G4ThreeVector aPosition, G4double xSigma, G4double ySigma):
00031 BDSAcceleratorComponent(
00032 aName,
00033 aLength,0,0,0,
00034 SetVisAttributes())
00035 {
00036 LaserWireLogicalVolume();
00037
00038
00039
00040
00041 BDSGlobals->
00042 SetLaserwireWavelength(itsMarkerLogicalVolume->GetName(),aWavelength);
00043 BDSGlobals->
00044 SetLaserwireDir(itsMarkerLogicalVolume->GetName(),aDirection);
00045 }
00046
00047 void BDSLaserWire::LaserWireLogicalVolume()
00048 {
00049 if(!(*LogVolCount)[itsName])
00050 {
00051 itsMarkerLogicalVolume=new G4LogicalVolume(
00052 new G4Box(itsName+"_solid",
00053 BDSGlobals->
00054 GetBeampipeRadius(),
00055 BDSGlobals->
00056 GetBeampipeRadius(),
00057 itsLength/2),
00058 theMaterials->GetMaterial("LaserVac"),
00059 itsName);
00060 (*LogVolCount)[itsName]=1;
00061 (*LogVol)[itsName]=itsMarkerLogicalVolume;
00062 }
00063 else
00064 {
00065 (*LogVolCount)[itsName]++;
00066 itsMarkerLogicalVolume=(*LogVol)[itsName];
00067 }
00068 }
00069
00070 G4VisAttributes* BDSLaserWire::SetVisAttributes()
00071 {
00072 itsVisAttributes=new G4VisAttributes(G4Colour(1.,0.,0.));
00073 return itsVisAttributes;
00074 }
00075
00076 BDSLaserWire::~BDSLaserWire()
00077 {
00078 delete itsVisAttributes;
00079
00080
00081 }