4 modified files
lcdd/include
diff -u -r1.2 -r1.3
--- G4Dipole.hh 5 May 2006 23:29:15 -0000 1.2
+++ G4Dipole.hh 1 Aug 2006 23:52:07 -0000 1.3
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/G4Dipole.hh,v 1.2 2006/05/05 23:29:15 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/G4Dipole.hh,v 1.3 2006/08/01 23:52:07 jeremy Exp $
#ifndef G4Dipole_hh
#define G4Dipole_hh 1
@@ -32,10 +32,18 @@
void addCoeff(double coeff);
const std::vector<double>& getCoeffs();
+ void setFieldUnit(double unit);
+ double getFieldUnit();
+
+ void setLengthUnit(double unit);
+ double getLengthUnit();
+
private:
double m_zmin;
double m_zmax;
double m_rmax;
+ double m_lunit;
+ double m_funit;
std::vector<double> m_coeffs;
};
lcdd/src
diff -u -r1.3 -r1.4
--- G4Dipole.cc 5 May 2006 23:29:16 -0000 1.3
+++ G4Dipole.cc 1 Aug 2006 23:52:08 -0000 1.4
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/G4Dipole.cc,v 1.3 2006/05/05 23:29:16 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/G4Dipole.cc,v 1.4 2006/08/01 23:52:08 jeremy Exp $
#include "G4Dipole.hh"
@@ -13,6 +13,9 @@
{
//std::cout << "G4Dipole::GetFieldValue" << std::endl;
+ //std::cout << "point = " << Point[0] << " " << Point[1] << " " << Point[2] << std::endl;
+ //std::cout << "BEFORE --> bfield = " << Bfield[0] << " " << Bfield[1] << " " << Bfield[2] << std::endl;
+
double bx = 0;
double z = Point[2];
double r = sqrt(Point[0] * Point[0] + Point[1] * Point[1]);
@@ -20,15 +23,25 @@
// Check if z coordinate is within dipole z bounds.
if (z > m_zmin && z < m_zmax && r < m_rmax) {
+ // Convert to absolute value z and apply specified length unit.
+ double zc = fabs(z) / m_lunit;
+
+ //std::cout << "zc = " << zc << std::endl;
+
// Apply all coefficients to this z coordinate.
for (size_t i=0; i<m_coeffs.size(); ++i) {
- bx += m_coeffs[i] * pow(z,i);
+ bx += m_coeffs[i] * pow(zc,i) ;
}
- // Apply Bx to input array.
+ // Convert to specified field unit.
+ bx *= m_funit;
+
+ // Add Bx to the input Bfield.
Bfield[0] += bx;
}
+ //std::cout << "AFTER --> bfield = " << Bfield[0] << " " << Bfield[1] << " " << Bfield[2] << std::endl << std::endl;
+
return;
}
@@ -71,3 +84,23 @@
{
return m_coeffs;
}
+
+void G4Dipole::setFieldUnit(double unit)
+{
+ m_funit = unit;
+}
+
+double G4Dipole::getFieldUnit()
+{
+ return m_funit;
+}
+
+void G4Dipole::setLengthUnit(double unit)
+{
+ m_lunit = unit;
+}
+
+double G4Dipole::getLengthUnit()
+{
+ return m_lunit;
+}
lcdd/src
diff -u -r1.7 -r1.8
--- G4Solenoid.cc 9 May 2006 01:56:35 -0000 1.7
+++ G4Solenoid.cc 1 Aug 2006 23:52:08 -0000 1.8
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/G4Solenoid.cc,v 1.7 2006/05/09 01:56:35 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/G4Solenoid.cc,v 1.8 2006/08/01 23:52:08 jeremy Exp $
#include "G4Solenoid.hh"
@@ -24,9 +24,9 @@
// TODO: use inner/outer Z
void G4Solenoid::GetFieldValue( const double Point[3], double* Bfield ) const
{
- // std::cout << "G4Solenoid::GetFieldValue" << std::endl;
- // std::cout << "x y z: " << Point[0] << " " << Point[1] << " " << Point[2] << std::endl;
- // std::cout << "BEFORE: bx, by, bz: " << Bfield[0] << " " << Bfield[1] << " " << Bfield[2] << std::endl;
+ //std::cout << "G4Solenoid::GetFieldValue" << std::endl;
+ //std::cout << "point: " << Point[0] << " " << Point[1] << " " << Point[2] << std::endl;
+ //std::cout << "BEFORE --> bfield " << Bfield[0] << " " << Bfield[1] << " " << Bfield[2] << std::endl;
double this_radius = sqrt( Point[0] * Point[0] + Point[1] * Point[1] );
@@ -37,7 +37,7 @@
Bfield[2] += _outerField;
}
- // std::cout << "AFTER: bx, by, bz: " << Bfield[0] << " " << Bfield[1] << " " << Bfield[2] << std::endl << std::endl;
+ //std::cout << "AFTER --> bfield = " << Bfield[0] << " " << Bfield[1] << " " << Bfield[2] << std::endl << std::endl;
return;
}
lcdd/src
diff -u -r1.3 -r1.4
--- dipoleSubscriber.cc 5 Jun 2006 17:41:30 -0000 1.3
+++ dipoleSubscriber.cc 1 Aug 2006 23:52:08 -0000 1.4
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/dipoleSubscriber.cc,v 1.3 2006/06/05 17:41:30 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/dipoleSubscriber.cc,v 1.4 2006/08/01 23:52:08 jeremy Exp $
#include "Saxana/SAXSubscriber.h"
#include "Saxana/SAXComponentFactory.h"
@@ -12,7 +12,7 @@
#include "dipole.hh"
#include "dipole_coeff.hh"
-// Geant4
+// lcdd
#include "G4Dipole.hh"
/**
@@ -68,6 +68,12 @@
// Create the Geant4 dipole object.
G4Dipole* g4d = new G4Dipole();
+ // Set the field unit's value.
+ g4d->setFieldUnit(calc->Eval(funit));
+
+ // Set the length unit's value.
+ g4d->setLengthUnit(calc->Eval(lunit));
+
// Set zmin and zmax.
g4d->setZMax(zmax);
g4d->setZMin(zmin);
@@ -80,8 +86,6 @@
const ContentGroup::ContentItem& elem = seq->content(i);
if (elem.tag == "dipole_coeff") {
dipole_coeff* coeff = dynamic_cast<dipole_coeff*>(elem.object);
-
- // Coefficients are unitless, so don't * with funit. (f/ N. Graf)
g4d->addCoeff(calc->Eval(coeff->get_value()));
}
else {
CVSspam 0.2.8