20#include "elementtype.h"
21#include "parameters.h"
35 void print(
const std::list<Element>& l,
int ident=0)
87 publish(
"fieldModulator", &Element::fieldModulator);
136 publish(
"magnetGeometryType", &Element::magnetGeometryType);
137 publish(
"horizontalWidth", &Element::horizontalWidth);
138 publish(
"outerDiameter", &Element::horizontalWidth);
140 publish(
"yokeOnInside", &Element::yokeOnInside);
146 publish(
"xsize", &Element::xsize);
148 publish(
"xsizeOut", &Element::xsizeOut);
150 publish(
"xsizeLeft", &Element::xsizeLeft);
154 publish(
"jawTiltLeft", &Element::jawTiltLeft);
162 publish(
"screenXSize", &Element::screenXSize);
190 publish(
"theta", &Element::theta);
192 publish(
"axisX", &Element::axisX);
193 publish(
"axisY", &Element::axisY);
194 publish(
"axisZ", &Element::axisZ);
195 publish(
"axisAngle", &Element::axisAngle);
243 publish(
"material", &Element::material);
244 publish(
"outerMaterial", &Element::material);
247 publish(
"markAsCollimator", &Element::markAsCollimator);
257 publish(
"crystalLeft", &Element::crystalLeft);
258 publish(
"crystalRight", &Element::crystalRight);
259 publish(
"crystalBoth", &Element::crystalBoth);
260 publish(
"crystalAngleYAxisLeft" , &Element::crystalAngleYAxisLeft);
261 publish(
"crystalAngleYAxisRight", &Element::crystalAngleYAxisRight);
275 return (
type == ElementType::_TRANSFORM3D ||
276 type == ElementType::_MARKER ||
277 type == ElementType::_LINE ||
278 type == ElementType::_REV_LINE);
283 for(
int i=0;i<ident;i++)
286 std::cout << name <<
" : " <<
type << std::endl;
288 {std::cout <<
"l = " <<
l <<
"m" << std::endl;}
289 if (horizontalWidth > 0)
290 {std::cout <<
"horizontalWidth = " << horizontalWidth <<
"m" << std::endl;}
293 std::cout <<
"samplerType = " <<
samplerType <<
"\n"
301 case ElementType::_SBEND:
302 case ElementType::_RBEND:
304 std::cout <<
"B = " <<
B << std::endl
305 <<
"angle = " <<
angle << std::endl
306 <<
"k1 = " <<
k1 << std::endl;
309 case ElementType::_QUAD:
310 {std::cout <<
"k1 = " <<
k1 << std::endl;
break;}
311 case ElementType::_SEXTUPOLE:
312 {std::cout <<
"k2 = " <<
k2 << std::endl;
break;}
313 case ElementType::_OCTUPOLE:
314 {std::cout <<
"k3 = " <<
k3 << std::endl;
break;}
315 case ElementType::_DECAPOLE:
316 {std::cout <<
"k4 = " <<
k4 << std::endl;
break;}
317 case ElementType::_SOLENOID:
318 {std::cout <<
"ks = " <<
ks << std::endl;
break;}
319 case ElementType::_MULT:
320 case ElementType::_THINMULT:
322 std::cout <<
" , knl={";
323 for (
auto value :
knl)
324 {std::cout << value <<
", ";}
325 std::cout <<
"}, ksl={";
326 for (
auto value :
ksl)
327 {std::cout << value <<
", ";}
328 std::cout <<
"}" << std::endl;
331 case ElementType::_ECOL:
332 case ElementType::_RCOL:
333 case ElementType::_JCOL:
335 std::cout <<
"x half aperture = " << xsize <<
" m" << std::endl
336 <<
"y half aperture = " <<
ysize <<
" m" << std::endl
337 <<
"material = \"" << material <<
"\"" << std::endl;
340 case ElementType::_ELEMENT:
342 std::cout <<
"horizontalWidth: " << horizontalWidth <<
"m" << std::endl
344 <<
"fieldAll: " <<
fieldAll << std::endl;
347 case ElementType::_CT:
349 std::cout <<
"dicomDataPath: " <<
dicomDataPath << std::endl;
350 std::cout <<
"dicomDataFile: " <<
dicomDataFile << std::endl;
353 case ElementType::_AWAKESCREEN:
355 std::cout <<
"twindow = " <<
twindow*1e6 <<
" um" << std::endl
356 <<
"tscint = " <<
tscint*1e6 <<
" um" << std::endl
362 case ElementType::_AWAKESPECTROMETER:
364 std::cout <<
"twindow = " <<
twindow*1e6 <<
" um" << std::endl
365 <<
"tscint = " <<
tscint*1e6 <<
" um" << std::endl
366 <<
"screenPSize = " <<
screenPSize*1e6 <<
" um" << std::endl
369 <<
"tmount = " <<
tmount*1e6 <<
" um" << std::endl
374 case ElementType::_LASER:
376 std::cout <<
"lambda= " <<
waveLength <<
"m" << std::endl
377 <<
"xSigma= " << xsize <<
"m" << std::endl
378 <<
"ySigma= " <<
ysize <<
"m" << std::endl
379 <<
"xdir= " <<
xdir << std::endl
380 <<
"ydir= " <<
ydir << std::endl
381 <<
"zdir= " <<
zdir << std::endl;
384 case ElementType::_SCREEN:
386 std::cout <<
"angle= " <<
angle <<
"rad" << std::endl;
389 case ElementType::_TRANSFORM3D:
391 std::cout <<
"xdir= " <<
xdir <<
"m" << std::endl
392 <<
"ydir= " <<
ydir <<
"m" << std::endl
393 <<
"zdir= " <<
zdir <<
"m" << std::endl
394 <<
"phi= " << phi <<
"rad" << std::endl
395 <<
"theta= " << theta <<
"rad" << std::endl
396 <<
"psi= " <<
psi <<
"rad" << std::endl;
405 case ElementType::_RBEND:
406 case ElementType::_SBEND:
407 case ElementType::_QUAD:
408 case ElementType::_SEXTUPOLE:
409 case ElementType::_OCTUPOLE:
410 case ElementType::_DECAPOLE:
411 case ElementType::_SOLENOID:
412 case ElementType::_MULT:
413 case ElementType::_THINMULT:
414 case ElementType::_AWAKESPECTROMETER:
415 case ElementType::_MUONSPOILER:
416 case ElementType::_HKICKER:
417 case ElementType::_VKICKER:
418 case ElementType::_KICKER:
419 case ElementType::_TKICKER:
420 case ElementType::_UNDULATOR:
421 case ElementType::_RF:
422 case ElementType::_RFX:
423 case ElementType::_RFY:
425 std::cout <<
"scaling = " <<
scaling << std::endl;
428 std::cout <<
"fieldModulator = \"" << fieldModulator <<
"\"" << std::endl;
441 type = ElementType::_NONE;
509 magnetGeometryType =
"";
608 markAsCollimator =
false;
621 crystalAngleYAxisLeft = 0;
622 crystalAngleYAxisRight = 0;
625 scalingFieldOuterSet =
false;
634 {value = get<double>(
this,property_name);}
635 catch (
const std::runtime_error&)
637 std::cerr <<
"element.cc> Error: unknown property \"" << property_name
638 <<
"\" (only works on numerical properties)" << std::endl;
652 if (params.
setMap.at(
"angle"))
654 else if (params.
setMap.at(
"scalingFieldOuter"))
655 {scalingFieldOuterSet =
true;}
660 for (
auto& i : params.
setMap)
664 std::string
property = i.first;
669 catch(
const std::runtime_error&)
671 std::cerr <<
"Error: parser> unknown property \"" <<
property
672 <<
"\" for element " << name << std::endl;
677 if (property ==
"bias")
679 std::stringstream ss(
bias);
687 else if (property ==
"biasMaterial")
693 else if (property ==
"biasVacuum")
704 std::string samplerNameIn,
705 double samplerRadiusIn,
709 {std::cout <<
"WARNING: overwriting already defined sampler info for element: " << name << std::endl;}
std::string current_line
Name of beamline.
static Parser * Instance()
Access method.
void publish(const std::string &name, T C::*mp)
Make pointer to member from class C and type T with accessible with a name.
void set(C *instance, const std::string &name, double value)
Parser namespace for GMAD language. Combination of Geant4 and MAD.
ElementType
types of elements
double property_lookup(std::string property_name) const
double hkick
fractional delta px for hkicker
std::string dicomDataFile
for CT, file for DICOM construction data
std::string spec
Arbitrary specification to pass to beamline builder.
void print(int ident=0) const
print method
std::string biasMaterial
temporary string for bias setting
double twindow
thickness of window
double aper4
beampipe information, new aperture model
double hgap
half distance of pole separation for purposes of fringe fields - 'half gap'
void set(const Parameters ¶ms)
set method from Parameters structure
void PublishMembers()
publish members so these can be looked up from parser
std::string beampipeMaterial
beampipe information, new aperture model
std::string samplerType
element has a sampler of this type (default "none")
double rmat33
rmatrix elements, only 4x4
double rmat11
rmatrix elements, only 4x4
double rmat43
rmatrix elements, only 4x4
std::list< std::string > layerMaterials
for screen
std::string userParameters
String for passing user parameters through.
double scaling
Overall scaling of field strength.
std::string cavityFieldType
Name for type of field to use in a cavity.
double windowScreenGap
air gap between window and screen
double gradient
for rf cavities in V / m
double degraderOffset
for degrader
bool isSpecial() const
check if element is of a special type
double wireAngle
for wirescanner
double aper2
beampipe information, new aperture model
double fintx
fringe field integral at the dipole exit
double kick4
rmatrix elements, only 4x4
std::list< Element > * lst
in case the element is a list itself (line)
double rmat42
rmatrix elements, only 4x4
double aper1
beampipe information, new aperture model
double rmat41
rmatrix elements, only 4x4
double h2
output pole face curvature for bends
double awakeMagnetOffsetX
for AWAKE spectrometer
double zdir
for 3d transform and laser
double h1
input pole face curvature for bends
std::string namedVacuumVolumes
For imported geometry - identify vacuum volumes.
bool stripOuterVolume
For Element. Make it an assembly.
double screenPSize
for AWAKE spectrometer
double xdir
for 3d transform and laser
double rmat34
rmatrix elements, only 4x4
double psi
for 3d transforms
double wireOffsetX
for wirescanner
double rmat31
rmatrix elements, only 4x4
double wedgeLength
for degrader
double vhRatio
ratio of vertial to horizontal for some magnets
double waveLength
for laser wire and 3d transforms
double rmat22
rmatrix elements, only 4x4
double fintxK2
second fringe field integral at the dipole exit - for TRANSPORT matching
std::string userTypeName
User component element type name.
double wireOffsetY
for wirescanner
double kick3
rmatrix elements, only 4x4
double rmat24
rmatrix elements, only 4x4
double tOffset
time offset used for phase calculation (ns)
std::list< std::string > biasMaterialList
double fint
fringe field integral at the dipole entrance
double xsizeRight
individual collimator jaw half widths
std::string bias
temporary string for bias setting
double coilWidthFraction
Fraction of available h space the coil will take up.
double rmat44
rmatrix elements, only 4x4
std::string fieldAll
Field for everything.
double jawTiltRight
jaw collimator jaw tilts (angle in x-z plane)
std::string region
region with range cuts
double wireDiameter
for wirescanner
double tmount
thickness of the screen mount
double wireOffsetZ
for wirescanner
std::list< double > ksl
skew multipole expansion
int numberWedges
for degrader
double kick1
rmatrix elements, only 4x4
std::string getPublishedName(const std::string &name) const
returns 'official' member name for property
std::list< double > knl
multipole expansion coefficients
std::string windowmaterial
for AWAKE spectrometer
double e2
output pole face rotation for bends
double phase
phase of rf cavity (rad)
double ysizeOut
collimator aperture or laser spotsize for laser
std::string fieldVacuum
Vacuum field.
bool autoColour
Automagically colour the external geometry.
double angle
bending angle
int hStyle
-1 = unset; 0 = false (ie c style); 1 = true, use hstyle
std::string geometryFile
For Element. File for external geometry.
std::string vacuumMaterial
beampipe information, new aperture model
double vkick
fractional delta py for vkicker
double E
voltage for rf cavities in V that will be assumed over length l
double coilHeightFraction
Fraction of availalbe v space the coil will take up.
std::list< int > layerIsSampler
for screen
bool elementLengthIsArcLength
For Element. Treat the length as arc length, if not chord.
double screenEndZ
for AWAKE spectrometer
double ysize
collimator aperture or laser spotsize for laser
double rmat23
rmatrix elements, only 4x4
std::string colour
Override colour for certain items.
double rmat13
rmatrix elements, only 4x4
double materialThickness
for degrader
double kick
fractional delta p for either h or v kicker
double rmat14
rmatrix elements, only 4x4
double beampipeThickness
beampipe information, new aperture model
std::string dicomDataPath
for CT, file for DICOM construction data
double minimumKineticEnergy
minimum kinetic energy for user limits - respected on element by element basis
std::string scintmaterial
for AWAKE spectrometer
double ydir
for 3d transform and laser
double undulatorMagnetHeight
for undulator
void setSamplerInfo(std::string samplerType, std::string samplerName, double samplerRadius, int samplerParticleSetIDIn=-1)
set sampler info
std::string cavityModel
Name of geometry model object for rfconstantinz cavities.
double e1
input pole face rotation for bends
std::string fieldOuter
Outer field.
double undulatorPeriod
for undulator
std::string biasVacuum
temporary string for bias setting
double wireLength
for wirescanner
std::map< std::string, std::string > alternativeNames
map that translates between alternative parser names for members, could be made static
double undulatorGap
for undulator
double poleStartZ
for AWAKE spectrometer
double fintK2
second fringe field integral at the dipole entrance - for TRANSPORT matching
std::string mountmaterial
for AWAKE spectrometer
double aper3
beampipe information, new aperture model
ElementType type
element enum
std::list< std::string > biasVacuumList
physics biasing list for the vacuum
std::list< double > layerThicknesses
for screen
double scalingFieldOuter
Extra arbitrary scaling for outer field - compounded with 'scaling'.
std::string samplerName
name of sampler (default empty)
double degraderHeight
for degrader
double tscint
thickness of scintillating part of screen
double screenWidth
for AWAKE spectrometer
double frequency
frequency for rf cavity in Hz
double kick2
rmatrix elements, only 4x4
double rmat12
rmatrix elements, only 4x4
std::string apertureType
beampipe information, new aperture model
double rmat21
rmatrix elements, only 4x4
double rmat32
rmatrix elements, only 4x4
Parameters - Element class with booleans.
std::map< std::string, bool > setMap
Map that holds booleans for every member of element.