Commit df6b327d authored by ext-calvo_p's avatar ext-calvo_p

Resolve "output info cyclotron type BANDRF"

parent bc5873b2
......@@ -505,7 +505,7 @@ void ParallelCyclotronTracker::visitCyclotron(const Cyclotron &cycl) {
*gmsg << "* " << sym << "-fold field symmetry " << endl;
// ckr: this just returned the default value as defined in Component.h
// double rff = cycl_m->getRfFrequ();
// double rff = cycl_m->getRfFrequ(0);
// *gmsg << "* Rf frequency= " << rff << " [MHz]" << endl;
std::string fmfn = cycl_m->getFieldMapFN();
......@@ -526,6 +526,15 @@ void ParallelCyclotronTracker::visitCyclotron(const Cyclotron &cycl) {
*gmsg << "* Number of trimcoils = " << cycl_m->getNumberOfTrimcoils() << endl;
*gmsg << "* Harmonic number h = " << h << " " << endl;
if (type == std::string("BANDRF")) {
double escale = cycl_m->getEScale(0);
*gmsg << "* RF field scale factor = " << escale << endl;
double rfphi= cycl_m->getRfPhi(0);
*gmsg << "* RF inital phase = " << rfphi * Physics::rad2deg << " [deg]" << endl;
bool superpose = cycl_m->getSuperpose(0);
*gmsg << std::boolalpha << "* Superpose electric field maps -> " << superpose << endl;
}
/**
* To ease the initialise() function, set a integral parameter fieldflag internally.
* Its value is by the option "TYPE" of the element "CYCLOTRON"
......
......@@ -216,13 +216,22 @@ void Cyclotron::setRfPhi(std::vector<double> f) {
rfphi_m = f;
}
double Cyclotron::getRfPhi(unsigned int i) const {
if (i < rfphi_m.size())
return rfphi_m[i];
else {
throw GeneralClassicException("Cyclotron::getRfPhi",
"RFPHI not defined for CYCLOTRON!");
}
}
void Cyclotron::setRfFrequ(std::vector<double> f) {
rffrequ_m = f;
}
double Cyclotron::getRfFrequ() const {
if (rffrequ_m.empty() == false)
return rffrequ_m[0];
double Cyclotron::getRfFrequ(unsigned int i) const {
if (i < rffrequ_m.size())
return rffrequ_m[i];
else {
throw GeneralClassicException("Cyclotron::getRfFrequ",
"RFFREQ not defined for CYCLOTRON!");
......@@ -233,9 +242,14 @@ void Cyclotron::setSuperpose(std::vector<bool> flag) {
superpose_m = flag;
}
//bool Cyclotron::getSuperpose() const {
// return superpose_m;
//}
bool Cyclotron::getSuperpose(unsigned int i) const {
if (i < superpose_m.size())
return superpose_m[i];
else {
throw GeneralClassicException("Cyclotron::getSuperpose",
"SUPERPOSE not defined for CYCLOTRON!");
}
}
void Cyclotron::setSymmetry(double s) {
symmetry_m = s;
......@@ -274,6 +288,15 @@ void Cyclotron::setEScale(std::vector<double> s) {
escale_m = s;
}
double Cyclotron::getEScale(unsigned int i) const {
if (i < escale_m.size())
return escale_m[i];
else {
throw GeneralClassicException("Cyclotron::EScale",
"EScale not defined for CYCLOTRON!");
}
}
unsigned int Cyclotron::getNumberOfTrimcoils() const {
return trimcoils_m.size();
}
......@@ -760,7 +783,7 @@ void Cyclotron::read(const int &fieldflag, const double &scaleFactor) {
getFieldFromFile_FFA(scaleFactor);
} else if(fieldflag == 6) {
*gmsg << "* Read both median plane B field map and 3D E field map of RF cavity for compact cyclotron" << getBScale() << endl;
*gmsg << "* Read both median plane B field map and 3D E field map of RF cavity for compact cyclotron" << endl;
myBFieldType_m = BANDRF;
getFieldFromFile_BandRF(scaleFactor);
......@@ -977,7 +1000,7 @@ void Cyclotron::getFieldFromFile(const double &scaleFactor) {
Bfield.dbttt.resize(Bfield.ntot);
*gmsg << "* Read-in loop one block per radius" << endl;
*gmsg << "* Rescaling of the fields with factor: " << BP.Bfact << endl;
*gmsg << "* Rescaling of the magnetic fields with factor: " << BP.Bfact << endl;
for(int i = 0; i < Bfield.nrad; i++) {
if(i > 0) {
......@@ -1122,7 +1145,7 @@ void Cyclotron::getFieldFromFile_FFA(const double &/*scaleFactor*/) {
Bfield.dbtt.resize(Bfield.ntot);
Bfield.dbttt.resize(Bfield.ntot);
*gmsg << "* Rescaling of the fields with factor: " << BP.Bfact << endl;
*gmsg << "* Rescaling of the magnetic fields with factor: " << BP.Bfact << endl;
int count = 0;
if((Ippl::getNodes()) == 1 && Options::info) {
......@@ -1215,7 +1238,7 @@ void Cyclotron::getFieldFromFile_AVFEQ(const double &scaleFactor) {
Bfield.dbtt.resize(Bfield.ntot);
Bfield.dbttt.resize(Bfield.ntot);
*gmsg << "* rescaling of the fields with factor: " << BP.Bfact << endl;
*gmsg << "* Rescaling of the magnetic fields with factor: " << BP.Bfact << endl;
std::fstream fp;
if((Ippl::getNodes()) == 1 && Options::info)
......@@ -1296,7 +1319,7 @@ void Cyclotron::getFieldFromFile_Carbon(const double &scaleFactor) {
Bfield.dbtt.resize(Bfield.ntot);
Bfield.dbttt.resize(Bfield.ntot);
*gmsg << "* rescaling of the fields with factor: " << BP.Bfact << endl;
*gmsg << "* Rescaling of the magnetic fields with factor: " << BP.Bfact << endl;
for(int i = 0; i < Bfield.nrad; i++) {
for(int k = 0; k < Bfield.ntet; k++) {
......@@ -1389,7 +1412,7 @@ void Cyclotron::getFieldFromFile_CYCIAE(const double &scaleFactor) {
Bfield.dbtt.resize(Bfield.ntot);
Bfield.dbttt.resize(Bfield.ntot);
*gmsg << "* rescaling of the fields with factor: " << BP.Bfact << endl;
*gmsg << "* Rescaling of the magnetic fields with factor: " << BP.Bfact << endl;
int nHalfPoints = Bfield.ntet / 2.0 + 1;
......@@ -1420,16 +1443,15 @@ void Cyclotron::getFieldFromFile_CYCIAE(const double &scaleFactor) {
void Cyclotron::getFieldFromFile_BandRF(const double &scaleFactor) {
// read 3D E&B field data file
// loop over all field maps and superpose fields
for(auto& fm: RFfilename_m) {
*gmsg << "* Reading " << fm << endl;
Fieldmap *f = Fieldmap::getFieldmap(fm, false);
if(f == NULL) {
throw GeneralClassicException(
"Cyclotron::getFieldFromFile_BandRF",
"failed to open file '" + fm + "', please check if it exists");
}
*gmsg << "* Reading " << fm << endl;
f->readMap();
RFfields_m.push_back(f);
}
......@@ -1531,4 +1553,4 @@ void Cyclotron::getDimensions(double &/*zBegin*/, double &/*zEnd*/) const
// c-basic-offset: 4
// indent-tabs-mode: nil
// require-final-newline: nil
// End:
// End:
\ No newline at end of file
......@@ -131,9 +131,10 @@ public:
virtual double getCyclHarm() const;
void setRfPhi(std::vector<double> f);
double getRfPhi(unsigned int i) const;
void setRfFrequ(std::vector<double> f);
double getRfFrequ() const;
double getRfFrequ(unsigned int i) const;
void setSymmetry(double symmetry);
virtual double getSymmetry() const;
......@@ -157,11 +158,12 @@ public:
virtual double getBScale() const;
void setEScale(std::vector<double> bs);
virtual double getEScale(unsigned int i) const;
void setTrimCoils(const std::vector<TrimCoil*> &trimcoils);
void setSuperpose(std::vector<bool> flag);
// virtual bool getSuperpose() const;
virtual bool getSuperpose(unsigned int i) const;
void setMinR(double r);
virtual double getMinR() const;
......
......@@ -249,7 +249,7 @@ ClosedOrbitFinder<Value_type,
: nxcross_m(0)
, nzcross_m(0)
, E0_m(E0)
, wo_m(cycl->getRfFrequ()*1E6/cycl->getCyclHarm()*2.0*Physics::pi)
, wo_m(cycl->getRfFrequ(0)*1E6/cycl->getCyclHarm()*2.0*Physics::pi)
, N_m(N)
, dtheta_m(Physics::two_pi/value_type(N))
, ravg_m(0)
......
......@@ -332,7 +332,7 @@ SigmaGenerator<Value_type, Size_type>::SigmaGenerator(value_type I,
size_type truncOrder,
bool write)
: I_m(I)
, wo_m(cycl->getRfFrequ()*1E6/cycl->getCyclHarm()*2.0*Physics::pi)
, wo_m(cycl->getRfFrequ(0)*1E6/cycl->getCyclHarm()*2.0*Physics::pi)
, E_m(E)
, gamma_m(E/m+1.0)
, gamma2_m(gamma_m*gamma_m)
......
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