00001
00002
00003
00004
00005
00006 #include "BDSGlobalConstants.hh"
00007 #include "BDSSpoiler.hh"
00008 #include "BDSMaterials.hh"
00009
00010 #include "G4Box.hh"
00011 #include "G4VisAttributes.hh"
00012 #include "G4LogicalVolume.hh"
00013 #include "G4VPhysicalVolume.hh"
00014 #include "G4PVPlacement.hh"
00015 #include "G4UserLimits.hh"
00016
00017 class BDSTiltOffset;
00018
00019 BDSSpoiler::BDSSpoiler(G4String name,
00020 G4double length,
00021 G4double xAperIn,
00022 G4double yAperIn,
00023 G4Material* SpoilerMaterial,
00024 BDSTiltOffset tiltOffset):
00025 BDSAcceleratorComponent(name, length, 0, "spoiler", tiltOffset),
00026 itsPhysiComp(NULL), itsPhysiComp2(NULL), itsSolidLogVol(NULL),
00027 itsInnerLogVol(NULL), itsSpoilerMaterial(SpoilerMaterial),
00028 xAper(xAperIn),
00029 yAper(yAperIn)
00030 {
00031 }
00032
00033 void BDSSpoiler::Build()
00034 {
00035 BDSAcceleratorComponent::Build();
00036 BuildInnerSpoiler();
00037 }
00038
00039 void BDSSpoiler::BuildMarkerLogicalVolume()
00040 {
00041 containerSolid = new G4Box(name,
00042 BDSGlobalConstants::Instance()->GetComponentBoxSize()/2,
00043 BDSGlobalConstants::Instance()->GetComponentBoxSize()/2,
00044 chordLength/2);
00045 containerLogicalVolume = new G4LogicalVolume(containerSolid,
00046 emptyMaterial,
00047 name + "_container_lv");
00048 }
00049
00050 void BDSSpoiler::BuildInnerSpoiler()
00051 {
00052 itsSolidLogVol=
00053 new G4LogicalVolume(new G4Box(name+"_solid",
00054 BDSGlobalConstants::Instance()->GetComponentBoxSize()/2,
00055 BDSGlobalConstants::Instance()->GetComponentBoxSize()/2,
00056 chordLength/2),
00057 itsSpoilerMaterial,
00058 name+"_solid");
00059
00060 itsInnerLogVol=
00061 new G4LogicalVolume(new G4Box(name+"_inner",
00062 xAper,
00063 yAper,
00064 chordLength/2),
00065 BDSMaterials::Instance()->GetMaterial(BDSGlobalConstants::Instance()->GetVacuumMaterial()),
00066 name+"_inner");
00067
00068 itsPhysiComp2 =
00069 new G4PVPlacement(
00070 (G4RotationMatrix*)0,
00071 (G4ThreeVector)0,
00072 itsInnerLogVol,
00073 name+"_combined",
00074 itsSolidLogVol,
00075 false,
00076 0, BDSGlobalConstants::Instance()->GetCheckOverlaps());
00077
00078 if(BDSGlobalConstants::Instance()->GetSensitiveComponents())
00079 {RegisterSensitiveVolume(itsSolidLogVol);}
00080
00081 #ifndef NOUSERLIMITS
00082 itsSolidLogVol->
00083 SetUserLimits(new G4UserLimits(DBL_MAX,DBL_MAX,BDSGlobalConstants::Instance()->GetMaxTime(),
00084 BDSGlobalConstants::Instance()-> GetThresholdCutCharged()));
00085 #endif
00086 itsPhysiComp =
00087 new G4PVPlacement(
00088 (G4RotationMatrix*)0,
00089 (G4ThreeVector)0,
00090 itsSolidLogVol,
00091 name+"_solid",
00092 containerLogicalVolume,
00093 false,
00094 0, BDSGlobalConstants::Instance()->GetCheckOverlaps());
00095 }
00096
00097
00098 BDSSpoiler::~BDSSpoiler()
00099 {
00100 }