musrsim/include/musrTabulatedElementField.hh
Kamil Sedlak fcd5eea567 Kamil Sedlak 2009-05-18
This is the first version of the muSR simulation code (musrSim)
based on the merged codes of Kamil Sedlak and Toni Shiroka.
It should be a running version of the simulation code, however 
it has not been very well tested, therefore it will probably
need some further development.
2009-05-18 09:59:52 +00:00

69 lines
2.5 KiB
C++

#ifndef musrTabulatedElementField_h
#define musrTabulatedElementField_h 1
#include "globals.hh"
#include "F04ElementField.hh"
#include "F04GlobalField.hh"
#include "G4ios.hh"
#include <fstream>
#include <vector>
#include <cmath>
class musrTabulatedElementField : public F04ElementField
{
public:
musrTabulatedElementField(const char* filename, const char* fldTableType, G4double fieldValue, G4LogicalVolume* logVolume, G4ThreeVector positionOfTheCenter);
// "lenUnit" is the unit in which the grid coordinates are specified in the table
// "fieldNormalisation" is the normalisation that has to be applied on the field values in the table
// such that the values correspond do 1T nominal value
// "fieldValue" is the field value (in T) that is required (i.e. values normalised to 1T will be
// multiplied by this value).
/// Destructor.
virtual ~musrTabulatedElementField() {}
/// addFieldValue() adds the field for this solenoid into field[].
/// point[] is in global coordinates.
void addFieldValue( const G4double Point[4], G4double* field) const;
void addFieldValue2D( const G4double Point[4], G4double* field) const;
void addFieldValue3D( const G4double Point[4], G4double* field) const;
G4double GetNominalFieldValue();
void SetNominalFieldValue(G4double newFieldValue);
// getWidth(), getHeight(), getLength(), return the dimensions of the field
// (used to define the boundary of the field)
virtual G4double getWidth() {return maximumWidth;} // x coordinate
virtual G4double getHeight() {return maximumHeight;} // y coordinate
virtual G4double getLength() {return maximumLength;} // z coordinate
private:
// Storage space for the table
std::vector< std::vector< std::vector< double > > > xField;
std::vector< std::vector< std::vector< double > > > yField;
std::vector< std::vector< std::vector< double > > > zField;
std::vector< std::vector< double > > xField2D;
std::vector< std::vector< double > > zField2D;
// The dimensions of the table
int nx,ny,nz;
// The units of the field
char fieldTableType[100];
G4String fUnit;
double fieUnit;
char fldType;
int fldDim;
// The physical limits of the defined region
double minimumx, maximumx, minimumy, maximumy, minimumz, maximumz;
// The physical extent of the defined region
double dx, dy, dz;
double ffieldValue;
double maximumWidth, maximumHeight, maximumLength;
void Invert(const char* indexToInvert);
};
#endif