35 namespace UnitConvertion
39 inline double au2m() {
return 5.29177210818E-11;}
41 inline double au2s() {
return 2.41888432650516E-17;}
43 inline double au2mPs() {
return 2.187691263373E6;}
45 inline double au2kg() {
return 9.10938215E-31;}
55 inline double VPcm2mmPns() {
return 0.17588201489603770767263287993687e-1;}
57 inline double amu2kg() {
return 1.66053878283E-27;}
63 inline double Pi() {
return 3.1415;}
88 double &px_au,
double &py_au)
91 const double mass_au (particle.
mass_au());
98 const double wt_total ((2.*
Pi()*tof_ns) / (tgyr_ns));
100 const double wt (fmod(wt_total,2.*
Pi()));
101 const double p_total (( sqrt(x_au*x_au + y_au*y_au) * mass_au *
Pi() ) / ( sin(0.5*wt) * tgyr_au ));
104 double theta = ( atan2(y_mm,x_mm)<0 ) ? atan2(y_mm,x_mm)+ 2.*
Pi() : atan2(y_mm,x_mm);
106 double phi = (rotationClockwise)? theta + 0.5*wt : theta - 0.5*wt;
108 px_au = p_total * cos(phi);
109 py_au = p_total * sin(phi);
158 double p_au (v_au * mass_au);
180 for (
size_t nReg=0; nReg<sr.size(); ++nReg)
184 double s = sr[nReg].length_mm();
188 if (std::abs(a) > 1e-8)
189 tt = (-v + sqrt(v*v + 2.*a*s))/a;
243 const double eField_Vpcm (spectrometer.
regions()[0].EField_Vpcm());
244 const double length_mm (spectrometer.
regions()[0].length_mm());
249 double x0 (length_mm/tof_ns - 0.5*a*tof_ns);
250 double fx0 (
evalFunc(x0,mass_au,charge_au,spectrometer));
252 while(std::abs(fx0 - tof_ns) > 0.01)
256 double x1 (1.1 * x0);
257 double fx1 (
evalFunc(x1,mass_au,charge_au,spectrometer));
259 double m ((fx0-fx1)/(x0-x1));
262 x0 = x0 + 0.7*(tof_ns-fx0)/m;
263 fx0 =
evalFunc(x0,mass_au,charge_au,spectrometer);
266 double p_au (v_au * mass_au);
442 _pos0 = make_pair(s.
value(
"CorrectX",0).toDouble(),
443 s.
value(
"CorrectY",0).toDouble());
445 s.
value(
"ScaleY",1).toDouble());
447 _angle = _angle *
Pi()/180.;
454 particlehit[
x_mm] = dethit[
x];
455 particlehit[
y_mm] = dethit[
y];
456 particlehit[
tof_ns] = dethit[
t];
471 std::tr1::shared_ptr<MomentumCalculator> momcalc;
483 case PzMultipleRegions:
487 throw invalid_argument(
"MomentumCalculator::instance(): Momentum calculator type '" +
488 toString(type) +
"' not available");
503 double &px_au (particlehit[
px]);
504 double &py_au (particlehit[
py]);
std::vector< double > detectorHit_t
define a detector hit
void loadSettings(CASSSettings &s)
load the settings
double _t0
the correction factor of the time of flight
particleHit_t operator()(const detectorHit_t &dethit) const
correct the position in the detector plane
const regions_t & regions() const
retrieve the regions of the spectrometer
double VPcm2mmPns()
convert V/cm * C[a.u.
file contains the classes that calculate the momenta of particles from their detector hits...
double _angle
the angle to rotate the position
double mass_au() const
retrieve the particle properties
double getZMom(double tof_ns, double mass_au, double charge_au, const SpectrometerRegion &sr)
Momentum along time of flight.
double getZMomIter(double tof_ns, double mass_au, double charge_au, const Spectrometer &spectrometer)
Momentum along time of flight.
double kg2au()
SI Units -> Atomic Units.
a region of a spectrometer
particleHit_t & operator()(const Particle &particle, particleHit_t &particlehit) const
calculate the momenta
double au2s()
Atomic Units -> SI Units.
double amu2kg()
Atomic mass unit -> SI Unit.
double getDetPlaneMomentum(double axis_mm, double tof_ns, double mass_au)
calculate the momentum in the detector plane
particleHit_t & operator()(const Particle &particle, particleHit_t &particlehit) const
calculate the momenta
std::pair< double, double > _pos0
the correction of the position
double length_mm() const
retrieve region properties
double au2m()
Atomic Units -> SI Units.
double evalFunc(double v0, double mass_au, double charge_au, const Spectrometer &spec)
helper function for endless SpectrometerRegions
std::vector< double > particleHit_t
define a particle hit
bool rotationClockWise() const
retrieve magnetic field parameter
const Spectrometer & spectrometer() const
retrive the spectormeter
void getDetPlaneMomenta(double x_mm, double y_mm, double tof_ns, const Particle &particle, double &px_au, double &py_au)
calculate Momentum in Detektor Plane
particleHit_t & operator()(const Particle &particle, particleHit_t &particlehit) const
calculate the momenta
static std::tr1::shared_ptr< MomentumCalculator > instance(const MomCalcType &type)
create instance of requested type
std::vector< SpectrometerRegion > regions_t
typef for better readable code
particleHit_t & operator()(const Particle &particle, particleHit_t &particlehit) const
calculate the momenta
double charge_au() const
retrieve the particle properties
double amu2au()
Atomic mass unit -> Atomic Units.
double au2mm()
Atomic Units -> SI Units.
double au2amu()
Atomic Units ->Atomic mass unit.
MomCalcType
enum for the types of momcalculators
std::string toString(const Type &t)
convert any type to a string
double au2kg()
Atomic Units -> SI Units.
double au2ns()
Atomic Units -> SI Units.
value(const QString &key, const QVariant &defaultValue=QVariant()
double EField_Vpcm() const
retrieve region properties
double cyclotronPeriod_ns() const
retrieve magnetic field parameter
file contains specialized class that do the settings for cass
file contains the classes that describe a particle that hit a delayline detector. ...
double au2mmPns()
Atomic Units -> SI Units.
double mmPns2au()
SI Units -> Atomic Units.
contains the classes that describe a REMI type spectrometer.
double mm2au()
SI Units -> Atomic Units.
std::pair< double, double > _scalefactors
the correction of the scale
double ns2au()
SI Units -> Atomic Units.
double au2mPs()
Atomic Units -> SI Units.
beginGroup(const QString &prefix)