projects/lcdd/branches/v00-00-01_LCDD-104-dev/src/lcdd/bfield
--- projects/lcdd/branches/v00-00-01_LCDD-104-dev/src/lcdd/bfield/Cartesian3DMagneticFieldMap.cc 2014-03-06 23:14:36 UTC (rev 3042)
+++ projects/lcdd/branches/v00-00-01_LCDD-104-dev/src/lcdd/bfield/Cartesian3DMagneticFieldMap.cc 2014-03-07 00:52:12 UTC (rev 3043)
@@ -11,14 +11,18 @@
#include <iostream>
#include <cmath>
+// Geant4
+#include "G4SystemOfUnits.hh"
+
using namespace std;
Cartesian3DMagneticFieldMap::Cartesian3DMagneticFieldMap(const char* filename, double xOffset, double yOffset, double zOffset) :
_xOffset(xOffset), _yOffset(yOffset), _zOffset(zOffset), _invertX(false), _invertY(false), _invertZ(false) {
- cout << "\n-----------------------------------------------------------" << "\n Magnetic field"
+ G4cout << "\n-----------------------------------------------------------" << "\n Magnetic field"
<< "\n-----------------------------------------------------------";
- cout << "\n ---> " "Reading the field grid from " << filename << " ... " << endl;
+ G4cout << "\n ---> " "Reading the field grid from " << filename << " ... " << endl;
+ G4cout << " xoffset, yoffset, zoffset: " << xOffset << " " << yOffset << " " << zOffset << G4endl;
ifstream file(filename); // Open the file for reading.
// Ignore first blank line
@@ -28,7 +32,7 @@
// Read table dimensions
file >> _nx >> _ny >> _nz; // Note dodgy order
- cout << " [ Number of values x,y,z: " << _nx << " " << _ny << " " << _nz << " ] " << endl;
+ G4cout << " [ Number of values x,y,z: " << _nx << " " << _ny << " " << _nz << " ] " << endl;
// Set up storage space for table
_xField.resize(_nx);
@@ -76,12 +80,12 @@
_maxy = yval;
_maxz = zval;
- cout << "\n ---> ... done reading " << endl;
+ G4cout << "\n ---> ... done reading " << endl;
- cout << " Read values of field from file " << filename << endl;
- cout << " ---> assumed the order: x, y, z, Bx, By, Bz " << "\n ---> Min values x,y,z: " << _minx << " " << _miny << " " << _minz << " cm "
- << "\n ---> Max values x,y,z: " << _maxx << " " << _maxy << " " << _maxz << " cm " << "\n ---> The field will be offset by " << _xOffset
- << " " << _yOffset << " " << _zOffset << " cm " << endl;
+ G4cout << " Read values of field from file " << filename << endl;
+ G4cout << " ---> assumed the order: x, y, z, Bx, By, Bz " << "\n ---> Min values x,y,z: " << _minx << " " << _miny << " " << _minz/cm << " cm "
+ << "\n ---> Max values x,y,z: " << _maxx/cm << " " << _maxy/cm << " " << _maxz/cm << " cm " << "\n ---> The field will be offset by " << _xOffset/cm
+ << " " << _yOffset/cm << " " << _zOffset/cm << " cm " << endl;
// Should really check that the limits are not the wrong way around.
if (_maxx < _minx) {
@@ -97,15 +101,15 @@
_invertZ = true;
}
- cout << "\nAfter reordering if necessary" << "\n ---> Min values x,y,z: " << _minx << " " << _miny << " " << _minz << " cm "
- << " \n ---> Max values x,y,z: " << _maxx << " " << _maxy << " " << _maxz << " cm ";
+ G4cout << "\nAfter reordering if necessary" << "\n ---> Min values x,y,z: " << _minx/cm << " " << _miny/cm << " " << _minz << " cm "
+ << " \n ---> Max values x,y,z: " << _maxx/cm << " " << _maxy/cm << " " << _maxz/cm << " cm ";
_dx = _maxx - _minx;
_dy = _maxy - _miny;
_dz = _maxz - _minz;
- cout << "\n ---> Range of values x,y,z: " << _dx << " " << _dy << " " << _dz << " cm in z "
+ G4cout << "\n ---> Range of values x,y,z: " << _dx/cm << " " << _dy/cm << " " << _dz/cm << " cm"
<< "\n-----------------------------------------------------------" << endl;
- cout << "done loading field map" << endl;
+ G4cout << "done loading field map" << endl;
}
void Cartesian3DMagneticFieldMap::GetFieldValue(const double point[4], double *Bfield) const {
@@ -150,8 +154,8 @@
int zindex = static_cast<int>(zdindex);
#ifdef DEBUG_INTERPOLATING_FIELD
- cout << "Local x,y,z: " << xlocal << " " << ylocal << " " << zlocal << endl;
- cout << "Index x,y,z: " << xindex << " " << yindex << " " << zindex << endl;
+ G4cout << "Local x,y,z: " << xlocal << " " << ylocal << " " << zlocal << endl;
+ G4cout << "Index x,y,z: " << xindex << " " << yindex << " " << zindex << endl;
double valx0z0, mulx0z0, valx1z0, mulx1z0;
double valx0z1, mulx0z1, valx1z1, mulx1z1;
valx0z0= table[xindex ][0][zindex]; mulx0z0= (1-xlocal) * (1-zlocal);
@@ -214,7 +218,7 @@
pos[1] =y;
pos[2] = z;
field.GetFieldValue(pos, B);
- //cout << pos[0] << " " << pos[1] << " " << pos[2] << " " << B[0] << " " << B[1] << " " << B[2] << endl;
+ //G4cout << pos[0] << " " << pos[1] << " " << pos[2] << " " << B[0] << " " << B[1] << " " << B[2] << endl;
}
}
}
@@ -223,7 +227,7 @@
pos[1]=0.038;
pos[2]=-0.02;
field.GetFieldValue(pos, B);
- //cout << pos[0] << " " << pos[1] << " " << pos[2] << " " << B[0] << " " << B[1] << " " << B[2] << endl;
+ //G4cout << pos[0] << " " << pos[1] << " " << pos[2] << " " << B[0] << " " << B[1] << " " << B[2] << endl;
return 0;
}
*/