BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
BesMagneticField Class Reference

#include <BesMagneticField.hh>

+ Inheritance diagram for BesMagneticField:

Public Member Functions

 BesMagneticField ()
 
 ~BesMagneticField ()
 
void GetFieldValue (const double Point[3], double *Bfield) const
 
void SetStepperType (G4int i)
 
void SetStepper ()
 
void SetMinStep (G4double s)
 
void InitialiseAll ()
 
void CreateStepperAndChordFinder ()
 
void SetDeltaOneStep (double newvalue)
 
void SetDeltaIntersection (double newvalue)
 
void SetMinimumEpsilonStep (double newvalue)
 
void SetMaximumEpsilonStep (double newvalue)
 

Protected Attributes

G4FieldManager * fFieldManager
 
G4ChordFinder * fChordFinder
 
G4Mag_UsualEqRhs * fEquation
 
G4MagIntegratorStepper * fStepper
 
G4int fStepperType
 
G4double fMinStep
 
BesMagneticFieldMessengerfFieldMessenger
 
IMagneticFieldSvcm_pIMF
 

Detailed Description

Definition at line 56 of file BesMagneticField.hh.

Constructor & Destructor Documentation

◆ BesMagneticField()

BesMagneticField::BesMagneticField ( )

Definition at line 86 of file BesMagneticField.cc.

87 : fChordFinder(0), fStepper(0),m_pIMF(0)
88{
89 ISvcLocator* svcLocator = Gaudi::svcLocator();
90 StatusCode sc = svcLocator->service("MagneticFieldSvc",m_pIMF);
91 if(sc!=StatusCode::SUCCESS) {
92 G4cout<< "Unable to open Magnetic field service"<<G4endl;
93 }
95}
G4MagIntegratorStepper * fStepper
IMagneticFieldSvc * m_pIMF
G4ChordFinder * fChordFinder

◆ ~BesMagneticField()

BesMagneticField::~BesMagneticField ( )

Definition at line 97 of file BesMagneticField.cc.

98{
100 if(fChordFinder) delete fChordFinder;
101 if(fEquation) delete fEquation;
102 if(fStepper) delete fStepper;
103}
G4Mag_UsualEqRhs * fEquation
BesMagneticFieldMessenger * fFieldMessenger

Member Function Documentation

◆ CreateStepperAndChordFinder()

void BesMagneticField::CreateStepperAndChordFinder ( )

Definition at line 152 of file BesMagneticField.cc.

153{
154 SetStepper();
155 G4cout<<"The minimal step is equal to "<<fMinStep/mm<<" mm"<<G4endl ;
156
157 fFieldManager->SetDetectorField(this );
158
159 if(fChordFinder) delete fChordFinder;
160
161 fChordFinder = new G4ChordFinder(this , fMinStep,fStepper);
162
163 fChordFinder->SetDeltaChord(0.25*mm);
164 fFieldManager->SetChordFinder( fChordFinder );
165 fFieldManager->SetDeltaOneStep(1.0e-2*mm);
166 fFieldManager->SetDeltaIntersection(1.0e-3*mm);
167 fFieldManager->SetMinimumEpsilonStep(5.0e-5);
168 fFieldManager->SetMaximumEpsilonStep(1.0e-3);
169
170 G4PropagatorInField* fieldPropagator
171 = G4TransportationManager::GetTransportationManager()
172 ->GetPropagatorInField();
173 G4cout<<"LargestAcceptableStep is "<<fieldPropagator->GetLargestAcceptableStep()/m<<G4endl;
174//read some values
175 G4cout<<"field has created"<<G4endl;
176 G4cout<<"fDelta_One_Step_Value is "<<fFieldManager->GetDeltaOneStep()<<G4endl;
177 G4cout<<"fDelta_Intersection_Val is "<<fFieldManager->GetDeltaIntersection()<<G4endl;
178 G4cout<<"fEpsilonMin is "<<fFieldManager->GetMinimumEpsilonStep()<<G4endl;
179 G4cout<<"fEpsilonMax is "<< fFieldManager->GetMaximumEpsilonStep()<<G4endl;
180 return;
181}
G4FieldManager * fFieldManager

Referenced by InitialiseAll(), and BesMagneticFieldMessenger::SetNewValue().

◆ GetFieldValue()

void BesMagneticField::GetFieldValue ( const double Point[3],
double * Bfield ) const

Definition at line 106 of file BesMagneticField.cc.

107{
108 double x=Point[0];
109 double y=Point[1];
110 double z=Point[2];
111
112 HepPoint3D r(x,y,z);
114
116 m_pIMF->fieldVector(r,b);
117 else
119
120 Bfield[0]=b.x();
121 Bfield[1]=b.y();
122 Bfield[2]=b.z();
123
124//caogf debug
125// ofstream haha("field_out.dat",ios_base::app);
126// haha<<x/mm<<" "<<y/mm<<" "<<z/mm<<" "<<Bfield[0]/tesla<<" "<<Bfield[1]/tesla<<" "<<Bfield[2]/tesla<<G4endl;
127// haha.close();
128}
Double_t x[10]
virtual StatusCode uniFieldVector(const HepGeom::Point3D< double > &xyz, HepGeom::Vector3D< double > &fvec) const =0
virtual StatusCode fieldVector(const HepGeom::Point3D< double > &xyz, HepGeom::Vector3D< double > &fvec) const =0
static G4int GetField()
double y[1000]
const double b
Definition slope.cxx:9

◆ InitialiseAll()

void BesMagneticField::InitialiseAll ( )

Definition at line 133 of file BesMagneticField.cc.

134{
135
137 fEquation = new G4Mag_UsualEqRhs(this);
138
139 fMinStep = 0.01*mm ; // minimal step of 1 mm is default
140
141 fStepperType =4; // ClassicalRK4 is default stepper
142 fFieldManager = G4TransportationManager::GetTransportationManager()
143 ->GetFieldManager();
144 G4cout<<"before CreateStepperAndChordFinder"<<G4endl;
146}

Referenced by BesMagneticField().

◆ SetDeltaIntersection()

void BesMagneticField::SetDeltaIntersection ( double newvalue)

Definition at line 246 of file BesMagneticField.cc.

247{
248 fFieldManager = G4TransportationManager::GetTransportationManager()->GetFieldManager();
249 fFieldManager->SetDeltaIntersection(newvalue);
250}

Referenced by BesMagneticFieldMessenger::SetNewValue().

◆ SetDeltaOneStep()

void BesMagneticField::SetDeltaOneStep ( double newvalue)

Definition at line 240 of file BesMagneticField.cc.

241{
242 fFieldManager = G4TransportationManager::GetTransportationManager()
243 ->GetFieldManager();
244 fFieldManager->SetDeltaOneStep(newvalue);
245}

Referenced by BesMagneticFieldMessenger::SetNewValue().

◆ SetMaximumEpsilonStep()

void BesMagneticField::SetMaximumEpsilonStep ( double newvalue)

Definition at line 256 of file BesMagneticField.cc.

257{
258 fFieldManager =G4TransportationManager::GetTransportationManager()->GetFieldManager();
259 fFieldManager->SetMaximumEpsilonStep(newvalue);
260}

Referenced by BesMagneticFieldMessenger::SetNewValue().

◆ SetMinimumEpsilonStep()

void BesMagneticField::SetMinimumEpsilonStep ( double newvalue)

Definition at line 251 of file BesMagneticField.cc.

252{
253 fFieldManager = G4TransportationManager::GetTransportationManager()->GetFieldManager();
254 fFieldManager->SetMinimumEpsilonStep(newvalue);
255}

Referenced by BesMagneticFieldMessenger::SetNewValue().

◆ SetMinStep()

void BesMagneticField::SetMinStep ( G4double s)
inline

Definition at line 71 of file BesMagneticField.hh.

71{ fMinStep = s ; }
XmlRpcServer s

Referenced by BesMagneticFieldMessenger::SetNewValue().

◆ SetStepper()

void BesMagneticField::SetStepper ( )

Definition at line 188 of file BesMagneticField.cc.

189{
190 if(fStepper) delete fStepper;
191
192 switch ( fStepperType )
193 {
194 case 0:
195 fStepper = new G4ExplicitEuler( fEquation );
196 G4cout<<"G4ExplicitEuler is called"<<G4endl;
197 break;
198 case 1:
199 fStepper = new G4ImplicitEuler( fEquation );
200 G4cout<<"G4ImplicitEuler is called"<<G4endl;
201 break;
202 case 2:
203 fStepper = new G4SimpleRunge( fEquation );
204 G4cout<<"G4SimpleRunge is called"<<G4endl;
205 break;
206 case 3:
207 fStepper = new G4SimpleHeum( fEquation );
208 G4cout<<"G4SimpleHeum is called"<<G4endl;
209 break;
210 case 4:
211 fStepper = new G4ClassicalRK4( fEquation );
212 G4cout<<"G4ClassicalRK4 (default) is called"<<G4endl;
213 break;
214 case 5:
215 fStepper = new G4HelixExplicitEuler( fEquation );
216 G4cout<<"G4HelixExplicitEuler is called"<<G4endl;
217 break;
218 case 6:
219 fStepper = new G4HelixImplicitEuler( fEquation );
220 G4cout<<"G4HelixImplicitEuler is called"<<G4endl;
221 break;
222 case 7:
223 fStepper = new G4HelixSimpleRunge( fEquation );
224 G4cout<<"G4HelixSimpleRunge is called"<<G4endl;
225 break;
226 case 8:
227 fStepper = new G4CashKarpRKF45( fEquation );
228 G4cout<<"G4CashKarpRKF45 is called"<<G4endl;
229 break;
230 case 9:
231 fStepper = new G4RKG3_Stepper( fEquation );
232 G4cout<<"G4RKG3_Stepper is called"<<G4endl;
233 break;
234 default: fStepper = 0;
235 }
236 return;
237}

Referenced by CreateStepperAndChordFinder().

◆ SetStepperType()

void BesMagneticField::SetStepperType ( G4int i)
inline

Definition at line 67 of file BesMagneticField.hh.

67{ fStepperType = i ; }

Referenced by BesMagneticFieldMessenger::SetNewValue().

Member Data Documentation

◆ fChordFinder

G4ChordFinder* BesMagneticField::fChordFinder
protected

Definition at line 85 of file BesMagneticField.hh.

Referenced by CreateStepperAndChordFinder(), and ~BesMagneticField().

◆ fEquation

G4Mag_UsualEqRhs* BesMagneticField::fEquation
protected

Definition at line 86 of file BesMagneticField.hh.

Referenced by InitialiseAll(), SetStepper(), and ~BesMagneticField().

◆ fFieldManager

G4FieldManager* BesMagneticField::fFieldManager
protected

◆ fFieldMessenger

BesMagneticFieldMessenger* BesMagneticField::fFieldMessenger
protected

Definition at line 94 of file BesMagneticField.hh.

Referenced by InitialiseAll(), and ~BesMagneticField().

◆ fMinStep

G4double BesMagneticField::fMinStep
protected

Definition at line 92 of file BesMagneticField.hh.

Referenced by CreateStepperAndChordFinder(), InitialiseAll(), and SetMinStep().

◆ fStepper

G4MagIntegratorStepper* BesMagneticField::fStepper
protected

Definition at line 89 of file BesMagneticField.hh.

Referenced by CreateStepperAndChordFinder(), SetStepper(), and ~BesMagneticField().

◆ fStepperType

G4int BesMagneticField::fStepperType
protected

Definition at line 90 of file BesMagneticField.hh.

Referenced by InitialiseAll(), SetStepper(), and SetStepperType().

◆ m_pIMF

IMagneticFieldSvc* BesMagneticField::m_pIMF
protected

Definition at line 95 of file BesMagneticField.hh.

Referenced by BesMagneticField(), and GetFieldValue().


The documentation for this class was generated from the following files: