#include <TrackTools/BIntegrator.h>
Inheritance diagram for BIntegrator:
Public Member Functions | |
BIntegrator (const std::string &type, const std::string &name, const IInterface *parent) | |
Standard constructor. | |
virtual | ~BIntegrator () |
Destructor. | |
StatusCode | initialize () |
Initialization. | |
StatusCode | calculateBdlAndCenter (const HepPoint3D &beginPoint, const HepPoint3D &endPoint, const double tX, const double tY, double &zCenter, HepVector3D &Bdl) const |
Get the z of center and the total Bdl. | |
Private Member Functions | |
StatusCode | calculateBdlCenter () |
Private Attributes | |
IMagneticFieldSvc * | m_pIMF |
int | m_nSteps |
HepPoint3D | m_centerZ |
double | m_firstZ |
double | m_lastZ |
Definition at line 20 of file BIntegrator.h.
|
Standard constructor.
Definition at line 33 of file BIntegrator.cpp. References m_firstZ, m_lastZ, and m_nSteps. 00036 : GaudiTool ( type, name , parent ) 00037 { 00038 declareInterface<IBIntegrator>(this); 00039 00040 declareProperty( "NSteps", m_nSteps = 501 ); 00041 declareProperty( "FirstZ", m_firstZ = 0.1*mm ); 00042 declareProperty( "LastZ", m_lastZ = 9400.*mm ); 00043 }
|
|
Destructor.
Definition at line 47 of file BIntegrator.cpp. 00047 {};
|
|
Get the z of center and the total Bdl. Now do the steps again but find the half of the magnetic field.... Implements IBIntegrator. Definition at line 70 of file BIntegrator.cpp. References m_centerZ, m_nSteps, and m_pIMF. 00076 { 00077 // Point where field should be calculated 00078 HepPoint3D point(0.001,0.001,0.0001); 00079 HepVector3D bField; // returned field 00080 Bdl.setX(0.); 00081 Bdl.setY(0.); 00082 Bdl.setZ(0.); 00083 00084 //First get the Center by walking in two rays.. 00085 double zCen = m_centerZ.x(); // the Bdlx is the important component 00086 double xCen = endPoint.x() + tX*(zCen-endPoint.z()); 00087 double yCen = endPoint.y() + tY*(zCen-endPoint.z()); 00088 if (xCen/zCen>0.3) { 00089 xCen = 0.3*zCen; 00090 } 00091 else if (xCen/zCen< -0.3) { 00092 xCen = -0.3*zCen; 00093 } 00094 if( yCen/zCen>0.25) { 00095 yCen = 0.25*zCen; 00096 } 00097 else if (yCen/zCen< -0.25){ 00098 yCen = -0.25*zCen; 00099 } 00100 00101 double angleX = xCen/zCen; 00102 double angleY = yCen/zCen; 00103 double stepSize = (endPoint.z()-beginPoint.z())/(double)m_nSteps; 00104 int iStep; 00105 for(iStep=0;iStep<m_nSteps;iStep++) { 00106 00107 if(point.z()>zCen) { 00108 angleX = tX; 00109 angleY = tY; 00110 } 00111 double dX = angleX*stepSize; 00112 double dY = angleY*stepSize; 00113 double dZ = stepSize; 00114 point.setX( point.x()+ dX); 00115 point.setY( point.y()+ dY); 00116 point.setZ( point.z()+ dZ); 00117 m_pIMF->fieldVector(point,bField); 00118 00119 //Cacluate the Bdl 00120 Bdl.setX( Bdl.x() + dY* bField.z()- dZ*bField.y() ); 00121 Bdl.setY( Bdl.y() + dZ*bField.x() -dX*bField.z()); 00122 Bdl.setZ( Bdl.z() + dX*bField.y() -dY*bField.x()); 00123 00124 } // iStep 00125 00127 00128 double Bdlx_half =0.5*Bdl.x(); 00129 double Bdly_half =0.5*Bdl.y(); 00130 double Bdlz_half =0.5*Bdl.z(); 00131 00132 Bdl.setX( 0.); 00133 Bdl.setY( 0.); 00134 Bdl.setZ( 0.); 00135 00136 double min_Bdlx =10000.; 00137 double min_Bdly =10000.; 00138 double min_Bdlz =10000.; 00139 HepPoint3D centerZ(0.,0.,0.); 00140 //reset al the variables used 00141 angleX = xCen/zCen; 00142 angleY = yCen/zCen; 00143 point.setX(0.); 00144 point.setY(0.); 00145 point.setZ(0.); 00146 for(iStep=0;iStep<m_nSteps;iStep++) { 00147 00148 if(point.z()>zCen) { 00149 angleX = tX; 00150 angleY = tY; 00151 } 00152 double dX = angleX*stepSize; 00153 double dY = angleY*stepSize; 00154 double dZ = stepSize; 00155 point.setX( point.x()+ dX); 00156 point.setY( point.y()+ dY); 00157 point.setZ( point.z()+ dZ); 00158 m_pIMF->fieldVector(point,bField); 00159 00160 //Cacluate the Bdl 00161 Bdl.setX( Bdl.x() + dY* bField.z()- dZ*bField.y() ); 00162 Bdl.setY( Bdl.y() + dZ*bField.x() -dX*bField.z()); 00163 Bdl.setZ( Bdl.z() + dX*bField.y() -dY*bField.x()); 00164 00165 if(fabs(Bdl.x()-Bdlx_half)< min_Bdlx){ 00166 min_Bdlx=fabs(Bdl.x()-Bdlx_half); 00167 centerZ.setX(point.z()); 00168 } 00169 if(fabs(Bdl.y()-Bdly_half)< min_Bdly){ 00170 min_Bdly=fabs(Bdl.y()-Bdly_half); 00171 centerZ.setY(point.z()); 00172 } 00173 if(fabs(Bdl.z()-Bdlz_half)< min_Bdlz){ 00174 min_Bdlz=fabs(Bdl.z()-Bdlz_half); 00175 centerZ.setZ(point.z()); 00176 } 00177 00178 } 00179 00180 //take the x component of the zcenter..... 00181 zCenter = centerZ.x(); 00182 00183 return StatusCode::SUCCESS; 00184 }
|
|
Definition at line 189 of file BIntegrator.cpp. References m_centerZ, m_firstZ, m_lastZ, m_nSteps, and m_pIMF. Referenced by initialize(). 00190 { 00191 // Centre of the field 00192 HepVector3D bField; 00193 00194 HepVector3D BdlTotal(0.,0.,0.); 00195 HepPoint3D position = HepPoint3D(0.0,0.0,0.); 00196 00197 double stepSize = (m_lastZ-m_firstZ) / (double)m_nSteps; 00198 00199 // Get the integral field 00200 int iStep; 00201 for( iStep=0;iStep < m_nSteps;iStep++) { 00202 position.setX(0.1); 00203 position.setY(0.1); 00204 position.setZ( m_firstZ+((double)iStep+0.5)*stepSize ); 00205 m_pIMF -> fieldVector( position,bField ); 00206 00207 //Calculate the Bdl 00208 BdlTotal.setX( BdlTotal.x() - stepSize*bField.y() ); 00209 BdlTotal.setY( BdlTotal.y() + stepSize*bField.x() ); 00210 BdlTotal.setZ( BdlTotal.z() + 0.); 00211 } // iStep 00212 00213 double Bdlx_half = 0.5*BdlTotal.x(); 00214 double Bdly_half = 0.5*BdlTotal.y(); 00215 double Bdlz_half = 0.5*BdlTotal.z(); 00216 00217 BdlTotal.setX( 0.); 00218 BdlTotal.setY( 0.); 00219 BdlTotal.setZ( 0.); 00220 00221 double min_Bdlx = 10000.; 00222 double min_Bdly = 10000.; 00223 double min_Bdlz = 10000.; 00224 00225 //Loop again and find the middle of each of the components 00226 for ( iStep=0; iStep < m_nSteps; iStep++ ) { 00227 double z = m_firstZ+ (iStep+0.5)*stepSize; 00228 position.setX(0.1); 00229 position.setY(0.1); 00230 position.setZ(z); 00231 m_pIMF -> fieldVector( position,bField ); 00232 //Cacluate the Bdl 00233 BdlTotal.setX( BdlTotal.x() - stepSize*bField.y() ); 00234 BdlTotal.setY( BdlTotal.y() + stepSize*bField.x() ); 00235 BdlTotal.setZ( BdlTotal.z() + 0.); 00236 if ( fabs(BdlTotal.x()-Bdlx_half) < min_Bdlx ) { 00237 min_Bdlx = fabs( BdlTotal.x()-Bdlx_half ); 00238 m_centerZ.setX(z); 00239 } 00240 if ( fabs(BdlTotal.y()-Bdly_half)< min_Bdly ) { 00241 min_Bdly = fabs( BdlTotal.y()-Bdly_half ); 00242 m_centerZ.setY(z); 00243 } 00244 if ( fabs(BdlTotal.z()-Bdlz_half)< min_Bdlz ) { 00245 min_Bdlz = fabs( BdlTotal.z()-Bdlz_half ); 00246 m_centerZ.setZ(z); 00247 } 00248 } 00249 00250 return StatusCode::SUCCESS; 00251 }
|
|
Initialization.
Definition at line 52 of file BIntegrator.cpp. References calculateBdlCenter(), m_centerZ, and m_pIMF. 00053 { 00054 StatusCode sc = GaudiTool::initialize(); 00055 if (sc.isFailure()) return sc; // error already reported by base class 00056 00057 // Retrieve a pointer to the magnetic field service 00058 m_pIMF = svc<IMagneticFieldSvc>( "MagneticFieldSvc", true ); 00059 00060 calculateBdlCenter(); 00061 info() << "Center of the field is at the z positions " 00062 << m_centerZ << endreq; 00063 00064 return sc; 00065 }
|
|
Definition at line 48 of file BIntegrator.h. Referenced by calculateBdlAndCenter(), calculateBdlCenter(), and initialize(). |
|
Definition at line 49 of file BIntegrator.h. Referenced by BIntegrator(), and calculateBdlCenter(). |
|
Definition at line 50 of file BIntegrator.h. Referenced by BIntegrator(), and calculateBdlCenter(). |
|
Definition at line 47 of file BIntegrator.h. Referenced by BIntegrator(), calculateBdlAndCenter(), and calculateBdlCenter(). |
|
Definition at line 45 of file BIntegrator.h. Referenced by calculateBdlAndCenter(), calculateBdlCenter(), and initialize(). |