Commit 71fe312b authored by frey_m's avatar frey_m
Browse files

SigmaGenerator: no template class, split into *.h and *.cpp file

parent f0154eb5
set (_SRCS set (_SRCS
Distribution.cpp Distribution.cpp
LaserProfile.cpp LaserProfile.cpp
SigmaGenerator.cpp
) )
include_directories ( include_directories (
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "Utilities/Options.h" #include "Utilities/Options.h"
#include "Utilities/Options.h" #include "Utilities/Options.h"
#include "Utilities/OpalException.h" #include "Utilities/OpalException.h"
#include "Physics/Physics.h"
#include "AbstractObjects/OpalData.h" #include "AbstractObjects/OpalData.h"
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "Distribution/Distribution.h" #include "Distribution/Distribution.h"
#include "Distribution/SigmaGenerator.h" #include "Distribution/SigmaGenerator.h"
#include "Distribution/ClosedOrbitFinder.h"
#include "AbsBeamline/SpecificElementVisitor.h" #include "AbsBeamline/SpecificElementVisitor.h"
#include <cmath> #include <cmath>
...@@ -212,16 +213,6 @@ Distribution::~Distribution() { ...@@ -212,16 +213,6 @@ Distribution::~Distribution() {
delete laserProfile_m; delete laserProfile_m;
} }
/*
void Distribution::printSigma(SigmaGenerator<double,unsigned int>::matrix_type& M, Inform& out) {
for (int i=0; i<M.size1(); ++i) {
for (int j=0; j<M.size2(); ++j) {
*gmsg << M(i,j) << " ";
}
*gmsg << endl;
}
}
*/
/** /**
* Calculate the local number of particles evenly and adjust node 0 * Calculate the local number of particles evenly and adjust node 0
...@@ -1278,18 +1269,18 @@ void Distribution::createMatchedGaussDistribution(size_t numberOfParticles, doub ...@@ -1278,18 +1269,18 @@ void Distribution::createMatchedGaussDistribution(size_t numberOfParticles, doub
bool writeMap = true; bool writeMap = true;
typedef SigmaGenerator<double, unsigned int> sGenerator_t; std::unique_ptr<SigmaGenerator> siggen = std::unique_ptr<SigmaGenerator>(
sGenerator_t *siggen = new sGenerator_t(I_m, new SigmaGenerator(I_m,
Attributes::getReal(itsAttr[Attrib::Distribution::EX])*1E6, Attributes::getReal(itsAttr[Attrib::Distribution::EX])*1E6,
Attributes::getReal(itsAttr[Attrib::Distribution::EY])*1E6, Attributes::getReal(itsAttr[Attrib::Distribution::EY])*1E6,
Attributes::getReal(itsAttr[Attrib::Distribution::ET])*1E6, Attributes::getReal(itsAttr[Attrib::Distribution::ET])*1E6,
E_m*1E-6, E_m*1E-6,
massIneV*1E-6, massIneV*1E-6,
CyclotronElement, CyclotronElement,
Nint, Nint,
Nsectors, Nsectors,
Attributes::getReal(itsAttr[Attrib::Distribution::ORDERMAPS]), Attributes::getReal(itsAttr[Attrib::Distribution::ORDERMAPS]),
writeMap); writeMap));
if (siggen->match(accuracy, if (siggen->match(accuracy,
Attributes::getReal(itsAttr[Attrib::Distribution::MAXSTEPSSI]), Attributes::getReal(itsAttr[Attrib::Distribution::MAXSTEPSSI]),
...@@ -1375,13 +1366,9 @@ void Distribution::createMatchedGaussDistribution(size_t numberOfParticles, doub ...@@ -1375,13 +1366,9 @@ void Distribution::createMatchedGaussDistribution(size_t numberOfParticles, doub
else { else {
*gmsg << "* Not converged for " << E_m*1E-6 << " MeV" << endl; *gmsg << "* Not converged for " << E_m*1E-6 << " MeV" << endl;
delete siggen;
throw OpalException("Distribution::CreateMatchedGaussDistribution", throw OpalException("Distribution::CreateMatchedGaussDistribution",
"didn't find any matched distribution."); "didn't find any matched distribution.");
} }
delete siggen;
} }
void Distribution::createDistributionGauss(size_t numberOfParticles, double massIneV) { void Distribution::createDistributionGauss(size_t numberOfParticles, double massIneV) {
......
...@@ -279,7 +279,6 @@ private: ...@@ -279,7 +279,6 @@ private:
void eraseTOrZDist(); void eraseTOrZDist();
void eraseBGzDist(); void eraseBGzDist();
// void printSigma(SigmaGenerator<double,unsigned int>::matrix_type& M, Inform& out);
void addDistributions(); void addDistributions();
void applyEmissionModel(double lowEnergyLimit, double &px, double &py, double &pz, std::vector<double> &additionalRNs); void applyEmissionModel(double lowEnergyLimit, double &px, double &py, double &pz, std::vector<double> &additionalRNs);
void applyEmissModelAstra(double &px, double &py, double &pz, std::vector<double> &additionalRNs); void applyEmissModelAstra(double &px, double &py, double &pz, std::vector<double> &additionalRNs);
......
This diff is collapsed.
This diff is collapsed.
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