BOSS 7.0.8
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 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}
G4MagIntegratorStepper * fStepper
IMagneticFieldSvc * m_pIMF
G4ChordFinder * fChordFinder

◆ ~BesMagneticField()

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}
G4Mag_UsualEqRhs * fEquation
BesMagneticFieldMessenger * fFieldMessenger

Member Function Documentation

◆ CreateStepperAndChordFinder()

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}
G4FieldManager * fFieldManager

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

◆ GetFieldValue()

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);
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
static G4int GetField()
double y[1000]
const double b
Definition: slope.cxx:9

◆ InitialiseAll()

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().

◆ SetDeltaIntersection()

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().

◆ SetDeltaOneStep()

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().

◆ SetMaximumEpsilonStep()

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().

◆ SetMinimumEpsilonStep()

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().

◆ SetMinStep()

void BesMagneticField::SetMinStep ( G4double  s)
inline

Definition at line 71 of file BesMagneticField.hh.

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

Referenced by BesMagneticFieldMessenger::SetNewValue().

◆ SetStepper()

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().

◆ 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: