00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "BDSBeamPipeInfo.hh"
00011 #include "BDSGlobalConstants.hh"
00012 #include "BDSMagnet.hh"
00013 #include "BDSMagnetOuterInfo.hh"
00014 #include "BDSMagnetType.hh"
00015 #include "BDSOctupole.hh"
00016 #include "BDSOctMagField.hh"
00017 #include "BDSOctStepper.hh"
00018
00019 #include "G4FieldManager.hh"
00020 #include "G4LogicalVolume.hh"
00021 #include "G4Tubs.hh"
00022 #include "G4UserLimits.hh"
00023 #include "G4VisAttributes.hh"
00024 #include "G4VPhysicalVolume.hh"
00025
00026 class BDSTiltOffset;
00027
00028 BDSOctupole::BDSOctupole(G4String name,
00029 G4double length,
00030 G4double bTriplePrime,
00031 BDSBeamPipeInfo* beamPipeInfo,
00032 BDSMagnetOuterInfo magnetOuterInfo,
00033 BDSTiltOffset tiltOffset):
00034 BDSMagnet(BDSMagnetType::octupole, name, length,
00035 beamPipeInfo, magnetOuterInfo, tiltOffset),
00036 itsBTriplePrime(bTriplePrime)
00037 {;}
00038
00039 void BDSOctupole::Build() {
00040 BDSMagnet::Build();
00041 if(BDSGlobalConstants::Instance()->GetIncludeIronMagFields())
00042 {
00043 G4double polePos[4];
00044 G4double Bfield[3];
00045
00046
00047 polePos[0]=-BDSGlobalConstants::Instance()->GetMagnetPoleRadius()*sin(CLHEP::pi/8);
00048 polePos[1]=BDSGlobalConstants::Instance()->GetMagnetPoleRadius()*cos(CLHEP::pi/8);
00049 polePos[2]=0.;
00050 polePos[3]=-999.;
00051
00052 itsMagField->GetFieldValue(polePos,Bfield);
00053 G4double BFldIron=
00054 sqrt(Bfield[0]*Bfield[0]+Bfield[1]*Bfield[1])*
00055 BDSGlobalConstants::Instance()->GetMagnetPoleSize()/
00056 (BDSGlobalConstants::Instance()->GetComponentBoxSize()/2-
00057 BDSGlobalConstants::Instance()->GetMagnetPoleRadius());
00058
00059
00060 BFldIron/=2.;
00061
00062 BuildOuterFieldManager(8, BFldIron,CLHEP::pi/8);
00063 }
00064 }
00065
00066 void BDSOctupole::BuildBPFieldAndStepper()
00067 {
00068
00069 itsMagField=new BDSOctMagField(itsBTriplePrime);
00070 itsEqRhs=new G4Mag_UsualEqRhs(itsMagField);
00071
00072 BDSOctStepper* octStepper=new BDSOctStepper(itsEqRhs);
00073 octStepper->SetBTrpPrime(itsBTriplePrime);
00074 itsStepper = octStepper;
00075 }