20#include "elementtype.h"
21#include "parameters.h"
35 void print(
const std::list<Element>& l,
int ident=0)
38 {std::cout <<
"using line " << Parser::Instance()->current_line << std::endl;}
135 publish(
"magnetGeometryType", &Element::magnetGeometryType);
136 publish(
"horizontalWidth", &Element::horizontalWidth);
137 publish(
"outerDiameter", &Element::horizontalWidth);
139 publish(
"yokeOnInside", &Element::yokeOnInside);
145 publish(
"xsize", &Element::xsize);
147 publish(
"xsizeOut", &Element::xsizeOut);
149 publish(
"xsizeLeft", &Element::xsizeLeft);
159 publish(
"screenXSize", &Element::screenXSize);
187 publish(
"theta", &Element::theta);
189 publish(
"axisX", &Element::axisX);
190 publish(
"axisY", &Element::axisY);
191 publish(
"axisZ", &Element::axisZ);
192 publish(
"axisAngle", &Element::axisAngle);
239 publish(
"material", &Element::material);
240 publish(
"outerMaterial", &Element::material);
243 publish(
"markAsCollimator", &Element::markAsCollimator);
252 publish(
"crystalLeft", &Element::crystalLeft);
253 publish(
"crystalRight", &Element::crystalRight);
254 publish(
"crystalBoth", &Element::crystalBoth);
255 publish(
"crystalAngleYAxisLeft" , &Element::crystalAngleYAxisLeft);
256 publish(
"crystalAngleYAxisRight", &Element::crystalAngleYAxisRight);
270 return (
type == ElementType::_TRANSFORM3D ||
271 type == ElementType::_MARKER ||
272 type == ElementType::_LINE ||
273 type == ElementType::_REV_LINE);
278 for(
int i=0;i<ident;i++)
281 std::cout << name <<
" : " <<
type << std::endl;
283 {std::cout <<
"l = " <<
l <<
"m" << std::endl;}
284 if (horizontalWidth > 0)
285 {std::cout <<
"horizontalWidth = " << horizontalWidth <<
"m" << std::endl;}
288 std::cout <<
"samplerType = " <<
samplerType <<
"\n"
296 case ElementType::_SBEND:
297 case ElementType::_RBEND:
299 std::cout <<
"B = " <<
B << std::endl
300 <<
"angle = " <<
angle << std::endl
301 <<
"k1 = " <<
k1 << std::endl;
304 case ElementType::_QUAD:
305 {std::cout <<
"k1 = " <<
k1 << std::endl;
break;}
306 case ElementType::_SEXTUPOLE:
307 {std::cout <<
"k2 = " <<
k2 << std::endl;
break;}
308 case ElementType::_OCTUPOLE:
309 {std::cout <<
"k3 = " <<
k3 << std::endl;
break;}
310 case ElementType::_DECAPOLE:
311 {std::cout <<
"k4 = " <<
k4 << std::endl;
break;}
312 case ElementType::_SOLENOID:
313 {std::cout <<
"ks = " <<
ks << std::endl;
break;}
314 case ElementType::_MULT:
315 case ElementType::_THINMULT:
317 std::cout <<
" , knl={";
318 for (
auto value :
knl)
319 {std::cout << value <<
", ";}
320 std::cout <<
"}, ksl={";
321 for (
auto value :
ksl)
322 {std::cout << value <<
", ";}
323 std::cout <<
"}" << std::endl;
326 case ElementType::_ECOL:
327 case ElementType::_RCOL:
328 case ElementType::_JCOL:
330 std::cout <<
"x half aperture = " << xsize <<
" m" << std::endl
331 <<
"y half aperture = " <<
ysize <<
" m" << std::endl
332 <<
"material = \"" << material <<
"\"" << std::endl;
335 case ElementType::_ELEMENT:
337 std::cout <<
"horizontalWidth: " << horizontalWidth <<
"m" << std::endl
339 <<
"fieldAll: " <<
fieldAll << std::endl;
342 case ElementType::_CT:
344 std::cout <<
"dicomDataPath: " <<
dicomDataPath << std::endl;
345 std::cout <<
"dicomDataFile: " <<
dicomDataFile << std::endl;
348 case ElementType::_AWAKESCREEN:
350 std::cout <<
"twindow = " <<
twindow*1e6 <<
" um" << std::endl
351 <<
"tscint = " <<
tscint*1e6 <<
" um" << std::endl
357 case ElementType::_AWAKESPECTROMETER:
359 std::cout <<
"twindow = " <<
twindow*1e6 <<
" um" << std::endl
360 <<
"tscint = " <<
tscint*1e6 <<
" um" << std::endl
361 <<
"screenPSize = " <<
screenPSize*1e6 <<
" um" << std::endl
364 <<
"tmount = " <<
tmount*1e6 <<
" um" << std::endl
369 case ElementType::_LASER:
371 std::cout <<
"lambda= " <<
waveLength <<
"m" << std::endl
372 <<
"xSigma= " << xsize <<
"m" << std::endl
373 <<
"ySigma= " <<
ysize <<
"m" << std::endl
374 <<
"xdir= " <<
xdir << std::endl
375 <<
"ydir= " <<
ydir << std::endl
376 <<
"zdir= " <<
zdir << std::endl;
379 case ElementType::_SCREEN:
381 std::cout <<
"angle= " <<
angle <<
"rad" << std::endl;
384 case ElementType::_TRANSFORM3D:
386 std::cout <<
"xdir= " <<
xdir <<
"m" << std::endl
387 <<
"ydir= " <<
ydir <<
"m" << std::endl
388 <<
"zdir= " <<
zdir <<
"m" << std::endl
389 <<
"phi= " << phi <<
"rad" << std::endl
390 <<
"theta= " << theta <<
"rad" << std::endl
391 <<
"psi= " <<
psi <<
"rad" << std::endl;
400 case ElementType::_RBEND:
401 case ElementType::_SBEND:
402 case ElementType::_QUAD:
403 case ElementType::_SEXTUPOLE:
404 case ElementType::_OCTUPOLE:
405 case ElementType::_DECAPOLE:
406 case ElementType::_SOLENOID:
407 case ElementType::_MULT:
408 case ElementType::_THINMULT:
409 case ElementType::_AWAKESPECTROMETER:
410 case ElementType::_MUONSPOILER:
411 case ElementType::_HKICKER:
412 case ElementType::_VKICKER:
413 case ElementType::_KICKER:
414 case ElementType::_TKICKER:
415 case ElementType::_UNDULATOR:
416 case ElementType::_RF:
418 std::cout <<
"scaling = " <<
scaling << std::endl;
433 type = ElementType::_NONE;
500 magnetGeometryType =
"";
596 markAsCollimator =
false;
608 crystalAngleYAxisLeft = 0;
609 crystalAngleYAxisRight = 0;
612 scalingFieldOuterSet =
false;
621 {value = get<double>(
this,property_name);}
622 catch (
const std::runtime_error&)
624 std::cerr <<
"element.cc> Error: unknown property \"" << property_name
625 <<
"\" (only works on numerical properties)" << std::endl;
639 if (params.
setMap.at(
"angle"))
641 else if (params.
setMap.at(
"scalingFieldOuter"))
642 {scalingFieldOuterSet =
true;}
647 for (
auto& i : params.
setMap)
651 std::string
property = i.first;
656 catch(
const std::runtime_error&)
658 std::cerr <<
"Error: parser> unknown property \"" <<
property
659 <<
"\" for element " << name << std::endl;
664 if (property ==
"bias")
666 std::stringstream ss(
bias);
674 else if (property ==
"biasMaterial")
680 else if (property ==
"biasVacuum")
691 std::string samplerNameIn,
692 double samplerRadiusIn,
696 {std::cout <<
"WARNING: overwriting already defined sampler info for element: " << name << std::endl;}
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.
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.
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
electric field amplitude for rf cavities in V
double coilHeightFraction
Fraction of availalbe v space the coil will take up.
std::list< int > layerIsSampler
for screen
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
model for rf 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.