BOSS 7.0.4
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)
 
 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

Constructor & Destructor Documentation

◆ BesMagneticField() [1/2]

BesMagneticField::BesMagneticField ( )

Definition at line 83 of file BesMagneticField.cc.

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

◆ ~BesMagneticField() [1/2]

BesMagneticField::~BesMagneticField ( )

Definition at line 94 of file BesMagneticField.cc.

95{
97 if(fChordFinder) delete fChordFinder;
98 if(fEquation) delete fEquation;
99 if(fStepper) delete fStepper;
100}

◆ BesMagneticField() [2/2]

BesMagneticField::BesMagneticField ( )

◆ ~BesMagneticField() [2/2]

BesMagneticField::~BesMagneticField ( )

Member Function Documentation

◆ CreateStepperAndChordFinder() [1/2]

void BesMagneticField::CreateStepperAndChordFinder ( )

Definition at line 149 of file BesMagneticField.cc.

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

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

◆ CreateStepperAndChordFinder() [2/2]

void BesMagneticField::CreateStepperAndChordFinder ( )

◆ GetFieldValue() [1/2]

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

Definition at line 103 of file BesMagneticField.cc.

104{
105 double x=Point[0];
106 double y=Point[1];
107 double z=Point[2];
108
109 HepPoint3D r(x,y,z);
110 HepVector3D b;
111
113 m_pIMF->fieldVector(r,b);
114 else
116
117 Bfield[0]=b.x();
118 Bfield[1]=b.y();
119 Bfield[2]=b.z();
120
121//caogf debug
122// ofstream haha("field_out.dat",ios_base::app);
123// haha<<x/mm<<" "<<y/mm<<" "<<z/mm<<" "<<Bfield[0]/tesla<<" "<<Bfield[1]/tesla<<" "<<Bfield[2]/tesla<<G4endl;
124// haha.close();
125}
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

◆ GetFieldValue() [2/2]

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

◆ InitialiseAll() [1/2]

void BesMagneticField::InitialiseAll ( )

Definition at line 130 of file BesMagneticField.cc.

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

Referenced by BesMagneticField().

◆ InitialiseAll() [2/2]

void BesMagneticField::InitialiseAll ( )

◆ SetDeltaIntersection() [1/2]

void BesMagneticField::SetDeltaIntersection ( double  newvalue)

Definition at line 243 of file BesMagneticField.cc.

244{
245 fFieldManager = G4TransportationManager::GetTransportationManager()->GetFieldManager();
246 fFieldManager->SetDeltaIntersection(newvalue);
247}

Referenced by BesMagneticFieldMessenger::SetNewValue().

◆ SetDeltaIntersection() [2/2]

void BesMagneticField::SetDeltaIntersection ( double  newvalue)

◆ SetDeltaOneStep() [1/2]

void BesMagneticField::SetDeltaOneStep ( double  newvalue)

Definition at line 237 of file BesMagneticField.cc.

238{
239 fFieldManager = G4TransportationManager::GetTransportationManager()
240 ->GetFieldManager();
241 fFieldManager->SetDeltaOneStep(newvalue);
242}

Referenced by BesMagneticFieldMessenger::SetNewValue().

◆ SetDeltaOneStep() [2/2]

void BesMagneticField::SetDeltaOneStep ( double  newvalue)

◆ SetMaximumEpsilonStep() [1/2]

void BesMagneticField::SetMaximumEpsilonStep ( double  newvalue)

Definition at line 253 of file BesMagneticField.cc.

254{
255 fFieldManager =G4TransportationManager::GetTransportationManager()->GetFieldManager();
256 fFieldManager->SetMaximumEpsilonStep(newvalue);
257}

Referenced by BesMagneticFieldMessenger::SetNewValue().

◆ SetMaximumEpsilonStep() [2/2]

void BesMagneticField::SetMaximumEpsilonStep ( double  newvalue)

◆ SetMinimumEpsilonStep() [1/2]

void BesMagneticField::SetMinimumEpsilonStep ( double  newvalue)

Definition at line 248 of file BesMagneticField.cc.

249{
250 fFieldManager = G4TransportationManager::GetTransportationManager()->GetFieldManager();
251 fFieldManager->SetMinimumEpsilonStep(newvalue);
252}

Referenced by BesMagneticFieldMessenger::SetNewValue().

◆ SetMinimumEpsilonStep() [2/2]

void BesMagneticField::SetMinimumEpsilonStep ( double  newvalue)

◆ SetMinStep() [1/2]

void BesMagneticField::SetMinStep ( G4double  s)
inline

Definition at line 71 of file InstallArea/include/BesSim/BesSim/BesMagneticField.hh.

71{ fMinStep = s ; }
XmlRpcServer s
Definition: HelloServer.cpp:11

Referenced by BesMagneticFieldMessenger::SetNewValue().

◆ SetMinStep() [2/2]

void BesMagneticField::SetMinStep ( G4double  s)
inline

◆ SetStepper() [1/2]

void BesMagneticField::SetStepper ( )

Definition at line 185 of file BesMagneticField.cc.

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

Referenced by CreateStepperAndChordFinder().

◆ SetStepper() [2/2]

void BesMagneticField::SetStepper ( )

◆ SetStepperType() [1/2]

void BesMagneticField::SetStepperType ( G4int  i)
inline

◆ SetStepperType() [2/2]

void BesMagneticField::SetStepperType ( G4int  i)
inline

Member Data Documentation

◆ fChordFinder

G4ChordFinder * BesMagneticField::fChordFinder
protected

◆ fEquation

G4Mag_UsualEqRhs * BesMagneticField::fEquation
protected

◆ fFieldManager

◆ fFieldMessenger

BesMagneticFieldMessenger * BesMagneticField::fFieldMessenger
protected

◆ fMinStep

G4double BesMagneticField::fMinStep
protected

◆ fStepper

G4MagIntegratorStepper * BesMagneticField::fStepper
protected

◆ fStepperType

G4int BesMagneticField::fStepperType
protected

◆ m_pIMF

IMagneticFieldSvc * BesMagneticField::m_pIMF
protected

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