Commit 8672ab0d authored by Andreas Adelmann's avatar Andreas Adelmann

initial condition matches specification, can obtain matched distribution at

azimutes other than zero
parent db1df4b4
This diff is collapsed.
......@@ -1329,7 +1329,7 @@ void Distribution::CreateMatchedGaussDistribution(size_t numberOfParticles, doub
Attributes::getReal(itsAttr[AttributesT::MAXSTEPSCO]),
CyclotronElement->getPHIinit(),
false)) {
std::array<double,3> Emit = siggen.getEmittances();
std::array<double,3> Emit = siggen.getEmittances();
*gmsg << "* Converged (Ex, Ey, Ez) = (" << Emit[0] << ", " << Emit[1] << ", " << Emit[2] << ") pi mm mrad for E= " << E_m*1E-6 << " (MeV)" << endl;
*gmsg << "* Sigma-Matrix " << endl;
......@@ -1376,13 +1376,13 @@ void Distribution::CreateMatchedGaussDistribution(size_t numberOfParticles, doub
}
}
correlationMatrix_m(1, 0) = sigma(0, 1) / sqrt(sigma(0, 0) * sigma(1, 1));
correlationMatrix_m(3, 2) = sigma(2, 3) / sqrt(sigma(2, 2) * sigma(3, 3));
correlationMatrix_m(5, 4) = sigma(4, 5) / sqrt(sigma(4, 4) * sigma(5, 5));
correlationMatrix_m(4, 0) = sigma(0, 4) / sqrt(sigma(0, 0) * sigma(4, 4));
correlationMatrix_m(4, 1) = sigma(1, 4) / sqrt(sigma(1, 1) * sigma(4, 4));
correlationMatrix_m(5, 0) = sigma(0, 5) / sqrt(sigma(0, 0) * sigma(5, 5));
correlationMatrix_m(5, 1) = sigma(1, 5) / sqrt(sigma(1, 1) * sigma(5, 5));
correlationMatrix_m(1, 0) = sigma(0, 1) / (sqrt(sigma(0, 0) * sigma(1, 1)));
correlationMatrix_m(3, 2) = sigma(2, 3) / (sqrt(sigma(2, 2) * sigma(3, 3)));
correlationMatrix_m(5, 4) = sigma(4, 5) / (sqrt(sigma(4, 4) * sigma(5, 5)));
correlationMatrix_m(4, 0) = sigma(0, 4) / (sqrt(sigma(0, 0) * sigma(4, 4)));
correlationMatrix_m(4, 1) = sigma(1, 4) / (sqrt(sigma(1, 1) * sigma(4, 4)));
correlationMatrix_m(5, 0) = sigma(0, 5) / (sqrt(sigma(0, 0) * sigma(5, 5)));
correlationMatrix_m(5, 1) = sigma(1, 5) / (sqrt(sigma(1, 1) * sigma(5, 5)));
} else {
*gmsg << "Not converged." << endl;
......
......@@ -361,12 +361,14 @@ bool SigmaGenerator<Value_type, Size_type>::match(value_type accuracy, size_type
// properties of one turn
container_type h_turn = cof.getInverseBendingRadius();
container_type r_turn = cof.getOrbit();
container_type r_turn = cof.getOrbit(angle);
container_type ds_turn = cof.getPathLength();
container_type fidx_turn = cof.getFieldIndex();
tunes = cof.getTunes(); // tunes = {nur, nuz}
ravg = cof.getAverageRadius(); // average radius
container_type peo = cof.getMomentum(angle);
// write properties to file (if write_m = true)
if (write_m) {
// write tunes
......@@ -378,12 +380,12 @@ bool SigmaGenerator<Value_type, Size_type>::match(value_type accuracy, size_type
writeTunes << E_m << std::setw(30) << std::setprecision(10) << tunes.first << std::setw(25) << tunes.second << std::endl;
// write average radius
std::ofstream writeAvgRadius("data/AverageRadius.dat", std::ios::app);
std::ofstream writeAvgRadius("data/AverageValues.dat", std::ios::app);
if(writeAvgRadius.tellp() == 0) // if nothing yet written --> write description
writeAvgRadius << "energy [MeV]" << std::setw(15) << "avg. radius [m]" << std::endl;
writeAvgRadius << "energy [MeV]" << std::setw(15) << "avg. radius [m]" << std::setw(15) << "r [m]" << std::setw(15) << "pr [m]" << std::endl;
writeAvgRadius << E_m << std::setw(25) << std::setprecision(10) << ravg << std::endl;
writeAvgRadius << E_m << std::setw(25) << std::setprecision(10) << ravg << std::setw(25) << std::setprecision(10) << r_turn[0] << std::setw(25) << std::setprecision(10) << peo[0] << std::endl;
// write frequency error
std::ofstream writePhase("data/FrequencyError.dat",std::ios::app);
......@@ -1023,4 +1025,4 @@ std::string SigmaGenerator<Value_type, Size_type>::float2string(value_type val)
return out.str();
}
#endif
\ No newline at end of file
#endif
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