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

00001 /* BDSIM code.    Version 1.0
00002    Author: Grahame A. Blair, Royal Holloway, Univ. of London.
00003    Last modified 24.7.2002
00004    Copyright (c) 2002 by G.A.Blair.  ALL RIGHTS RESERVED. 
00005 
00006    Modified 22.03.05 by J.C.Carter, Royal Holloway, Univ. of London.
00007    Changed StringFromInt to be the BDSGlobal version
00008 */
00009 
00010 #include "BDSGlobalConstants.hh" 
00011 
00012 #include "BDSDecapole.hh"
00013 #include "BDSDecMagField.hh"
00014 #include "BDSDecStepper.hh"
00015 #include "BDSMagnet.hh"
00016 #include "BDSMagnetOuterInfo.hh"
00017 
00018 #include "G4FieldManager.hh"
00019 #include "G4LogicalVolume.hh"
00020 #include "G4Tubs.hh"
00021 #include "G4UserLimits.hh"
00022 #include "G4VisAttributes.hh"
00023 #include "G4VPhysicalVolume.hh"
00024 
00025 class BDSTiltOffset;
00026 
00027 BDSDecapole::BDSDecapole(G4String           name,
00028                          G4double           length,
00029                          G4double           bQuadPrime,
00030                          BDSBeamPipeInfo*   beamPipeInfo,
00031                          BDSMagnetOuterInfo magnetOuterInfo,
00032                          BDSTiltOffset      tiltOffset):
00033   BDSMagnet(BDSMagnetType::decapole, name, length,
00034             beamPipeInfo,magnetOuterInfo, tiltOffset),
00035   itsBQuadPrime(bQuadPrime)
00036 {;}
00037 
00038 void BDSDecapole::Build() {
00039   BDSMagnet::Build();
00040   if(BDSGlobalConstants::Instance()->GetIncludeIronMagFields())
00041     {
00042       G4double polePos[4];
00043       G4double Bfield[3];
00044       
00045       //coordinate in GetFieldValue
00046       polePos[0]=-BDSGlobalConstants::Instance()->GetMagnetPoleRadius()*sin(CLHEP::pi/10);
00047       polePos[1]=BDSGlobalConstants::Instance()->GetMagnetPoleRadius()*cos(CLHEP::pi/10);
00048       polePos[2]=0.;
00049       polePos[3]=-999.;//flag to use polePos rather than local track
00050       
00051       itsMagField->GetFieldValue(polePos,Bfield);
00052       G4double BFldIron=
00053         sqrt(Bfield[0]*Bfield[0]+Bfield[1]*Bfield[1])*
00054         BDSGlobalConstants::Instance()->GetMagnetPoleSize()/
00055         (BDSGlobalConstants::Instance()->GetComponentBoxSize()/2-
00056          BDSGlobalConstants::Instance()->GetMagnetPoleRadius());
00057       
00058       // Magnetic flux from a pole is divided in two directions
00059       BFldIron/=2.;
00060       
00061       BuildOuterFieldManager(10, BFldIron,CLHEP::pi/10);
00062     }
00063 }
00064 
00065 void BDSDecapole::BuildBPFieldAndStepper()
00066 {
00067   // set up the magnetic field and stepper
00068   itsMagField=new BDSDecMagField(itsBQuadPrime);
00069   itsEqRhs=new G4Mag_UsualEqRhs(itsMagField);
00070   
00071   BDSDecStepper* decStepper=new BDSDecStepper(itsEqRhs);
00072   decStepper->SetBQuadPrime(itsBQuadPrime);
00073   itsStepper = decStepper;
00074 }

Generated on 28 Jun 2015 for BDSIM by  doxygen 1.4.7