Commit e49b8232 authored by adelmann's avatar adelmann 🎗
Browse files

for my weeekend at home ...

parent a4588c31
......@@ -61,19 +61,14 @@ void Corrector::accept(BeamlineVisitor &visitor) const {
}
bool Corrector::apply(const size_t &i, const double &t, double E[], double B[]) {
Inform m("Corrector::apply 1" );
const double xk = GetKickX();
const double yk = GetKickY();
B[0] = xk;
B[1] = yk;
B[0] = kickField_m(0);
B[1] = kickField_m(1);
return false;
}
bool Corrector::apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B) {
const double xk = GetKickX();
const double yk = GetKickY();
B = Vector_t(xk,yk,0.0);
B = kickField_m;
return false;
}
......@@ -82,9 +77,15 @@ bool Corrector::apply(const Vector_t &R, const Vector_t &centroid, const double
}
void Corrector::initialise(PartBunch *bunch, double &startField, double &endField, const double &scaleFactor) {
Inform m("Corrector::initialise ");
endField_m = endField = startField + getElementLength();
RefPartBunch_m = bunch;
startField_m = startField;
BDipoleField f = getField();
kickField_m = Vector_t(f.getBx(),f.getBy(),0.0);
m << "B= " << kickField_m << endl;
}
void Corrector::finalise()
......
......@@ -108,6 +108,8 @@ public:
double kickX_m;
double kickY_m;
Vector_t kickField_m;
protected:
// Not implemented.
......
......@@ -20,6 +20,7 @@
#include "Distribution/Distribution.h"
#include "AbstractObjects/Expressions.h"
#include "AbstractObjects/OpalData.h"
#include "Attributes/Attributes.h"
#include "Utilities/Options.h"
#include "halton1d_sequence.hh"
......@@ -1818,7 +1819,8 @@ void Distribution::CreateOpalT(PartBunch &beam,
size_t &numberOfParticles,
bool scan) {
// This is PC from BEAM
avrgpz_m = beam.getP()/beam.getM();
avrgpz_m = OpalData::getInstance()->getP0(); // beam.getP()/beam.getM();
addedDistributions_m = addedDistributions;
CreateOpalT(beam, numberOfParticles, scan);
}
......@@ -2730,7 +2732,7 @@ void Distribution::GenerateGaussZ(size_t numberOfParticles) {
gsl_matrix_set (m,0,4, distCorr_m.at(5));
gsl_matrix_set (m,4,1, distCorr_m.at(6));
gsl_matrix_set (m,1,4, distCorr_m.at(6));
#define DISTDBG1
#ifdef DISTDBG1
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 6; j++) {
......@@ -2757,6 +2759,7 @@ void Distribution::GenerateGaussZ(size_t numberOfParticles) {
}
}
gsl_matrix_transpose(m);
#define DISTDBG2
#ifdef DISTDBG2
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 6; j++) {
......@@ -2809,15 +2812,21 @@ void Distribution::GenerateGaussZ(size_t numberOfParticles) {
INFOMSG("oops... something wrong with GSL matvec\n");
exit(1);
}
xDist_m.push_back(sigmaR_m[0]*gsl_vector_get(ry, 0));
pxDist_m.push_back(sigmaP_m[0]*gsl_vector_get(ry, 1));
yDist_m.push_back(sigmaR_m[1]*gsl_vector_get(ry, 2));
pyDist_m.push_back(sigmaP_m[1]*gsl_vector_get(ry, 3));
tOrZDist_m.push_back(sigmaR_m[2]*gsl_vector_get(ry, 4));
xDist_m.push_back( sigmaR_m[0]*gsl_vector_get(ry, 0));
pxDist_m.push_back( sigmaP_m[0]*gsl_vector_get(ry, 1));
yDist_m.push_back( sigmaR_m[1]*gsl_vector_get(ry, 2));
pyDist_m.push_back( sigmaP_m[1]*gsl_vector_get(ry, 3));
tOrZDist_m.push_back( sigmaR_m[2]*gsl_vector_get(ry, 4));
pzDist_m.push_back(avrgpz_m +(sigmaP_m[2]*gsl_vector_get(ry, 5)));
}
}
//std::for_each(v.rbegin(), v.rend(), [&](int n) { sum_of_elements += n; });
double pxm = std::accumulate(pxDist_m.begin(), pxDist_m.end(), 0.0);
double pym = std::accumulate(pyDist_m.begin(), pyDist_m.end(), 0.0);
double pzm = std::accumulate(pzDist_m.begin(), pzDist_m.end(), 0.0);
*gmsg << "pxm= " << pxm << " pym= " << pym << " pzm= " << pzm << endl;
if (randGen)
delete randGen;
}
......
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