Commit 9aa76f0f authored by snuverink_j's avatar snuverink_j
Browse files

remove unused member width for probe and stripper

parent ec3f1923
......@@ -75,13 +75,13 @@
#include "Physics/Physics.h"
#include "Utilities/OpalException.h"
#include "Utilities/Options.h"
#include "BasicActions/DumpFields.h"
#include "BasicActions/DumpEMFields.h"
#include "Structure/H5PartWrapperForPC.h"
#include "Structure/BoundaryGeometry.h"
#include "Utilities/Options.h"
#include "Ctunes.h"
#include <cassert>
......@@ -462,11 +462,11 @@ void ParallelCyclotronTracker::visitCyclotron(const Cyclotron &cycl) {
if(insqrt > -1.0e-10) {
referencePt = 0.0;
referencePt = 0.0;
} else {
throw OpalException("Error in ParallelCyclotronTracker::visitCyclotron",
throw OpalException("Error in ParallelCyclotronTracker::visitCyclotron",
"Pt imaginary!");
}
......@@ -773,10 +773,6 @@ void ParallelCyclotronTracker::visitProbe(const Probe &prob) {
double yend = elptr->getYend();
*gmsg << "YEnd= " << yend << " [mm]" << endl;
double width = elptr->getWidth();
*gmsg << "Width= " << width << " [mm]" << endl;
// initialise, do nothing
elptr->initialise(itsBunch_m);
......@@ -786,7 +782,7 @@ void ParallelCyclotronTracker::visitProbe(const Probe &prob) {
BcParameter[1] = 0.001 * xend;
BcParameter[2] = 0.001 * ystart ;
BcParameter[3] = 0.001 * yend;
BcParameter[4] = 0.001 * width ;
BcParameter[4] = 0.001 ; // width
// store probe parameters in the list
buildupFieldList(BcParameter, ElementBase::PROBE, elptr);
......@@ -1077,9 +1073,6 @@ void ParallelCyclotronTracker::visitStripper(const Stripper &stripper) {
double yend = elptr->getYend();
*gmsg << "YEnd= " << yend << " [mm]" << endl;
double width = elptr->getWidth();
*gmsg << "Width= " << width << " [mm]" << endl;
double opcharge = elptr->getOPCharge();
*gmsg << "Charge of outcoming particle = +e * " << opcharge << endl;
......@@ -1094,7 +1087,7 @@ void ParallelCyclotronTracker::visitStripper(const Stripper &stripper) {
BcParameter[1] = 0.001 * xend;
BcParameter[2] = 0.001 * ystart ;
BcParameter[3] = 0.001 * yend;
BcParameter[4] = 0.001 * width ;
BcParameter[4] = 0.001; // width
BcParameter[5] = opcharge;
BcParameter[6] = opmass;
......@@ -1222,9 +1215,8 @@ void ParallelCyclotronTracker::execute() {
*gmsg << "* Multiple time stepping (MTS) integrator" << endl;
break;
case stepper::INTEGRATOR::UNDEFINED:
itsStepper_mp.reset(nullptr);
// continue here and throw exception
default:
itsStepper_mp.reset(nullptr);
throw OpalException("ParallelCyclotronTracker::execute",
"Invalid name of TIMEINTEGRATOR in Track command");
}
......@@ -1996,8 +1988,8 @@ inline void ParallelCyclotronTracker::rotateAroundX(ParticleAttrib<Vector_t> & p
// Clockwise rotation of particles 'particleVectors' by 'psi' around X axis
Tenzor<double, 3> const rotation(1, 0, 0,
0, cos(psi), sin(psi),
0, -sin(psi), cos(psi));
0, cos(psi), sin(psi),
0, -sin(psi), cos(psi));
for(unsigned int i = 0; i < itsBunch_m->getLocalNum(); ++i) {
......@@ -2009,8 +2001,8 @@ inline void ParallelCyclotronTracker::rotateAroundX(Vector_t & myVector, double
// Clockwise rotation of single vector 'myVector' by 'psi' around X axis
Tenzor<double, 3> const rotation(1, 0, 0,
0, cos(psi), sin(psi),
0, -sin(psi), cos(psi));
0, cos(psi), sin(psi),
0, -sin(psi), cos(psi));
myVector = dot(rotation, myVector);
}
......@@ -2034,9 +2026,9 @@ inline void ParallelCyclotronTracker::getQuaternionTwoVectors(Vector_t u, Vector
resultVectorComponent = cross(u, xaxis);
// If by chance u is parallel to xaxis, use zaxis instead
if (dot(resultVectorComponent, resultVectorComponent) < tolerance2) {
if (dot(resultVectorComponent, resultVectorComponent) < tolerance2) {
resultVectorComponent = cross(u, zaxis);
resultVectorComponent = cross(u, zaxis);
}
double halfAngle = 0.5 * pi;
......@@ -2164,12 +2156,10 @@ void ParallelCyclotronTracker::borisExternalFields(double h) {
push(0.5 * h);
// apply the plugin elements: probe, collimator, stripper, septum
//itsBunch_m->R *= Vector_t(1000.0); // applyPluginElements expects [R] = mm
applyPluginElements(h);
// destroy particles if they are marked as Bin=-1 in the plugin elements or out of global apeture
bool const flagNeedUpdate = deleteParticle();
//itsBunch_m->R *= Vector_t(0.001);
if(itsBunch_m->weHaveBins() && flagNeedUpdate) itsBunch_m->resetPartBinID2(eta_m);
}
......@@ -2208,7 +2198,6 @@ void ParallelCyclotronTracker::applyPluginElements(const double dt) {
}
itsBunch_m->R *= Vector_t(0.001);
}
bool ParallelCyclotronTracker::deleteParticle(){
......@@ -2290,7 +2279,7 @@ void ParallelCyclotronTracker::initDistInGlobalFrame() {
double const initialReferenceTheta = referenceTheta * Physics::deg2rad;
PathLength_m = 0.0;
// TODO: Replace with TracerParticle
// TODO: Replace with TracerParticle
// Force the initial phase space values of the particle with ID = 0 to zero,
// to set it as a reference particle.
if(initialTotalNum_m > 2) {
......@@ -2305,7 +2294,7 @@ void ParallelCyclotronTracker::initDistInGlobalFrame() {
// Initialize global R
//itsBunch_m->R *= Vector_t(1000.0); // m --> mm
// NEW OPAL 2.0: Immediately change to m -DW
// NEW OPAL 2.0: Immediately change to m -DW
Vector_t const initMeanR = Vector_t(0.001 * referenceR * cosRefTheta_m, // mm --> m
0.001 * referenceR * sinRefTheta_m, // mm --> m
0.001 * referenceZ); // mm --> m
......@@ -2967,11 +2956,7 @@ void ParallelCyclotronTracker::finalizeTracking_m(dvector_t& Ttime,
closeFiles();
// no break, continue here!
}
case MODE::BUNCH:
{
// we do nothing
// no break, continue here!
}
case MODE::BUNCH: // we do nothing
case MODE::UNDEFINED:
default:
{
......@@ -2992,17 +2977,10 @@ void ParallelCyclotronTracker::finalizeTracking_m(dvector_t& Ttime,
*gmsg << endl << "* *********************** Bunch information in global frame: ***********************";
if (itsBunch_m->getTotalNum() > 0){
// Print out the Bunch information at end of the run. Because the bunch information
// displays in units of m we have to change back and forth one more time.
// Furthermore it is my opinion that the same units should be used throughout OPAL. -DW
//itsBunch_m->R *= Vector_t(0.001); // mm --> m
// Print out the Bunch information at end of the run.
itsBunch_m->calcBeamParameters();
*gmsg << *itsBunch_m << endl;
//itsBunch_m->R *= Vector_t(1000.0); // m --> mm
} else {
*gmsg << endl << "* No Particles left in bunch!" << endl;
......
......@@ -39,7 +39,7 @@ Probe::Probe():
filename_m(""),
position_m(0.0),
step_m(0.0){
setDimensions(0.0, 0.0, 0.0, 0.0, 0.0);
setDimensions(0.0, 0.0, 0.0, 0.0);
}
......@@ -48,7 +48,7 @@ Probe::Probe(const Probe &right):
filename_m(right.filename_m),
position_m(right.position_m),
step_m(right.step_m){
setDimensions(right.xstart_m, right.xend_m, right.ystart_m, right.yend_m, right.width_m);
setDimensions(right.xstart_m, right.xend_m, right.ystart_m, right.yend_m);
}
......@@ -57,7 +57,7 @@ Probe::Probe(const std::string &name):
filename_m(""),
position_m(0.0),
step_m(0.0){
setDimensions(0.0, 0.0, 0.0, 0.0, 0.0);
setDimensions(0.0, 0.0, 0.0, 0.0);
}
Probe::~Probe() {}
......@@ -103,12 +103,11 @@ void Probe::goOffline() {
lossDs_m->save();
}
void Probe::setDimensions(double xstart, double xend, double ystart, double yend, double width) {
void Probe::setDimensions(double xstart, double xend, double ystart, double yend) {
xstart_m = xstart;
ystart_m = ystart;
xend_m = xend;
yend_m = yend;
width_m = width;
rstart_m = std::sqrt(xstart*xstart + ystart * ystart);
rend_m = std::sqrt(xend * xend + yend * yend);
// start position is the one with lowest radius
......@@ -144,10 +143,6 @@ double Probe::getYend() const {
return yend_m;
}
double Probe::getWidth() const {
return width_m;
}
double Probe::getStep() const {
return step_m;
}
......@@ -179,7 +174,7 @@ void Probe::setGeom(const double dist) {
geom_m[4].y = geom_m[0].y;
}
bool Probe::checkProbe(PartBunchBase<double, 3> *bunch, const int turnnumber, const double t, const double tstep) {
bool Probe::checkProbe(PartBunchBase<double, 3> *bunch, const int turnnumber, const double t, const double tstep) {
bool flagprobed = false;
Vector_t rmin, rmax, probepoint;
......@@ -200,6 +195,7 @@ bool Probe::checkProbe(PartBunchBase<double, 3> *bunch, const int turnnumber, c
reduce(meanP, meanP, OpAddAssign());
meanP = meanP / Vector_t(bunch->getTotalNum());
// change probe width depending on step size and angle of particle
double sk1, sk2, stangle = 0.0;
if ( B_m == 0.0 ){
sk1 = meanP(1)/meanP(0);
......@@ -218,7 +214,6 @@ bool Probe::checkProbe(PartBunchBase<double, 3> *bunch, const int turnnumber, c
sk2 = - A_m/B_m;
stangle = std::abs(( sk1-sk2 )/(1 + sk1*sk2));
}
// change probe width depending on step size on angle of particle
double lstep = (sqrt(1.0-1.0/(1.0+dot(meanP, meanP))) * Physics::c) * tstep*1.0e-6; // [mm]
double Swidth = lstep / sqrt( 1 + 1/stangle/stangle );
setGeom(Swidth);
......@@ -254,7 +249,7 @@ bool Probe::checkProbe(PartBunchBase<double, 3> *bunch, const int turnnumber, c
probepoint(2) = bunch->R[i](2);
lossDs_m->addParticle(probepoint, bunch->P[i], bunch->ID[i], t+dt, turnnumber);
flagprobed = true;
peakfinder_m->addParticle(bunch->R[i]);
}
}
......
......@@ -60,7 +60,7 @@ public:
virtual void goOffline();
/// Set dimensions and consistency checks
void setDimensions(double xstart, double xend, double ystart, double yend, double width);
void setDimensions(double xstart, double xend, double ystart, double yend);
void setStep(double step);
......@@ -70,7 +70,6 @@ public:
virtual double getYstart() const;
virtual double getYend() const;
virtual double getWidth() const;
virtual double getStep() const;
bool checkProbe(PartBunchBase<double, 3> *bunch, const int turnnumber, const double t, const double tstep);
......@@ -89,7 +88,6 @@ private:
double rstart_m;
double rend_m;
///@}
double width_m; ///< bin width, not used
Point geom_m[5]; ///< actual geometry positions with adaptive width such that each particle hits probe once per turn
double step_m; ///< Step size of the probe (bin width in histogram file)
......
......@@ -43,7 +43,7 @@ Stripper::Stripper():
opyield_m(1.0),
stop_m(true),
step_m(0) {
setDimensions(0.0, 0.0, 0.0, 0.0, 0.0);
setDimensions(0.0, 0.0, 0.0, 0.0);
}
......@@ -56,7 +56,7 @@ Stripper::Stripper(const Stripper &right):
opyield_m(right.opyield_m),
stop_m(right.stop_m),
step_m(right.step_m) {
setDimensions(right.xstart_m, right.xend_m, right.ystart_m, right.yend_m, right.width_m);
setDimensions(right.xstart_m, right.xend_m, right.ystart_m, right.yend_m);
}
......@@ -69,7 +69,7 @@ Stripper::Stripper(const std::string &name):
opyield_m(1.0),
stop_m(true),
step_m(0){
setDimensions(0.0, 0.0, 0.0, 0.0, 0.0);
setDimensions(0.0, 0.0, 0.0, 0.0);
}
void Stripper::setGeom(const double dist) {
......@@ -137,12 +137,11 @@ void Stripper::goOffline() {
lossDs_m->save();
}
void Stripper::setDimensions(double xstart, double xend, double ystart, double yend, double width) {
void Stripper::setDimensions(double xstart, double xend, double ystart, double yend) {
xstart_m = xstart;
ystart_m = ystart;
xend_m = xend;
yend_m = yend;
width_m = width;
rstart_m = std::sqrt(xstart*xstart + ystart * ystart);
rend_m = std::sqrt(xend * xend + yend * yend);
// start position is the one with lowest radius
......@@ -190,9 +189,6 @@ double Stripper::getYstart() const {
double Stripper::getYend() const {
return yend_m;
}
double Stripper::getWidth() const {
return width_m;
}
double Stripper::getOPCharge() const {
return opcharge_m;
......
......@@ -52,7 +52,7 @@ public:
virtual void goOffline();
/// Set dimensions and consistency checks
void setDimensions(double xstart, double xend, double ystart, double yend, double width);
void setDimensions(double xstart, double xend, double ystart, double yend);
virtual double getXstart() const;
......@@ -71,9 +71,6 @@ public:
void setOPYield(double yield);
virtual double getOPYield() const;
void setWidth(double width);
virtual double getWidth() const;
void setStop(bool stopflag);
virtual bool getStop() const;
......@@ -93,7 +90,6 @@ private:
double yend_m;
double rstart_m;
double rend_m;
double width_m;
///@}
double opcharge_m;
double opmass_m;
......
......@@ -90,7 +90,6 @@ void OpalProbe::update() {
double xend = Attributes::getReal(itsAttr[XEND]);
double ystart = Attributes::getReal(itsAttr[YSTART]);
double yend = Attributes::getReal(itsAttr[YEND]);
double width = Attributes::getReal(itsAttr[WIDTH]);
double step = Attributes::getReal(itsAttr[STEP]);
if(itsAttr[WAKEF] && owk_m == nullptr) {
......@@ -99,7 +98,7 @@ void OpalProbe::update() {
prob->setWake(owk_m->wf_m);
}
prob->setElementLength(length); // is this needed here?
prob->setDimensions(xstart, xend, ystart, yend, width);
prob->setDimensions(xstart, xend, ystart, yend);
prob->setStep(step);
// Transmit "unknown" attributes.
......
......@@ -39,7 +39,7 @@ OpalStripper::OpalStripper():
itsAttr[YEND] = Attributes::makeReal
("YEND", "End of y coordinate, [mm]");
itsAttr[WIDTH] = Attributes::makeReal
("WIDTH", "Width of the stripper [mm], NOT used yet");
("WIDTH", "Width of the stripper [mm], NOT used");
itsAttr[OPCHARGE] = Attributes::makeReal
("OPCHARGE", "Charge number of the outcome particle");
itsAttr[OPMASS] = Attributes::makeReal
......@@ -94,14 +94,13 @@ void OpalStripper::update() {
double xend = Attributes::getReal(itsAttr[XEND]);
double ystart = Attributes::getReal(itsAttr[YSTART]);
double yend = Attributes::getReal(itsAttr[YEND]);
double width = Attributes::getReal(itsAttr[WIDTH]);
double opcharge = Attributes::getReal(itsAttr[OPCHARGE]);
double opmass = Attributes::getReal(itsAttr[OPMASS]);
double opyield = Attributes::getReal(itsAttr[OPYIELD]);
bool stop = Attributes::getBool(itsAttr[STOP]);
strp->setElementLength(length);
strp->setDimensions(xstart, xend, ystart, yend, width);
strp->setDimensions(xstart, xend, ystart, yend);
strp->setOPCharge(opcharge);
strp->setOPMass(opmass);
strp->setOPYield(opyield);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment