20#include "elementtype.h"
21#include "parameters.h"
35 void print(
const std::list<Element>& l,
int ident=0)
87 publish(
"fieldModulator", &Element::fieldModulator);
137 publish(
"magnetGeometryType", &Element::magnetGeometryType);
138 publish(
"horizontalWidth", &Element::horizontalWidth);
139 publish(
"outerDiameter", &Element::horizontalWidth);
141 publish(
"yokeOnInside", &Element::yokeOnInside);
147 publish(
"xsize", &Element::xsize);
149 publish(
"xsizeOut", &Element::xsizeOut);
151 publish(
"xsizeLeft", &Element::xsizeLeft);
155 publish(
"jawTiltLeft", &Element::jawTiltLeft);
159 publish(
"xsize2", &Element::xsize2);
161 publish(
"offsetX2", &Element::offsetX2);
171 publish(
"screenXSize", &Element::screenXSize);
199 publish(
"theta", &Element::theta);
201 publish(
"axisX", &Element::axisX);
202 publish(
"axisY", &Element::axisY);
203 publish(
"axisZ", &Element::axisZ);
204 publish(
"axisAngle", &Element::axisAngle);
226 publish(
"wireLength", &Element::wireLength);
227 publish(
"wireOffsetX", &Element::wireOffsetX);
228 publish(
"wireOffsetY", &Element::wireOffsetY);
229 publish(
"wireOffsetZ", &Element::wireOffsetZ);
230 publish(
"wireAngle", &Element::wireAngle);
276 publish(
"material", &Element::material);
277 publish(
"outerMaterial", &Element::material);
280 publish(
"markAsCollimator", &Element::markAsCollimator);
290 publish(
"crystalLeft", &Element::crystalLeft);
291 publish(
"crystalRight", &Element::crystalRight);
292 publish(
"crystalBoth", &Element::crystalBoth);
293 publish(
"crystalAngleYAxisLeft" , &Element::crystalAngleYAxisLeft);
294 publish(
"crystalAngleYAxisRight", &Element::crystalAngleYAxisRight);
310 return (
type == ElementType::_TRANSFORM3D ||
311 type == ElementType::_MARKER ||
312 type == ElementType::_LINE ||
313 type == ElementType::_REV_LINE);
318 for(
int i=0;i<ident;i++)
321 std::cout << name <<
" : " <<
type << std::endl;
323 {std::cout <<
"l = " <<
l <<
"m" << std::endl;}
324 if (horizontalWidth > 0)
325 {std::cout <<
"horizontalWidth = " << horizontalWidth <<
"m" << std::endl;}
328 std::cout <<
"samplerType = " <<
samplerType <<
"\n"
335 case ElementType::_SBEND:
336 case ElementType::_RBEND:
338 std::cout <<
"B = " <<
B << std::endl
339 <<
"angle = " <<
angle << std::endl
340 <<
"k1 = " <<
k1 << std::endl;
343 case ElementType::_QUAD:
344 {std::cout <<
"k1 = " <<
k1 << std::endl;
break;}
345 case ElementType::_SEXTUPOLE:
346 {std::cout <<
"k2 = " <<
k2 << std::endl;
break;}
347 case ElementType::_OCTUPOLE:
348 {std::cout <<
"k3 = " <<
k3 << std::endl;
break;}
349 case ElementType::_DECAPOLE:
350 {std::cout <<
"k4 = " <<
k4 << std::endl;
break;}
351 case ElementType::_SOLENOID:
352 {std::cout <<
"ks = " <<
ks << std::endl;
break;}
353 case ElementType::_MULT:
354 case ElementType::_THINMULT:
356 std::cout <<
" , knl={";
357 for (
auto value :
knl)
358 {std::cout << value <<
", ";}
359 std::cout <<
"}, ksl={";
360 for (
auto value :
ksl)
361 {std::cout << value <<
", ";}
362 std::cout <<
"}" << std::endl;
365 case ElementType::_ECOL:
366 case ElementType::_RCOL:
367 case ElementType::_BMCOL:
368 case ElementType::_JCOL:
369 case ElementType::_JCOLTIP:
371 std::cout <<
"x half aperture = " << xsize <<
" m" << std::endl
372 <<
"y half aperture = " <<
ysize <<
" m" << std::endl
373 <<
"material = \"" << material <<
"\"" << std::endl;
376 case ElementType::_ELEMENT:
378 std::cout <<
"horizontalWidth: " << horizontalWidth <<
"m" << std::endl
380 <<
"fieldAll: " <<
fieldAll << std::endl;
383 case ElementType::_RF:
384 case ElementType::_RFX:
385 case ElementType::_RFY:
387 std::cout <<
"E (voltage): " <<
E <<
" V" << std::endl
388 <<
"gradient (e field): " <<
gradient <<
" V/m" << std::endl
391 <<
"frequency: " <<
frequency <<
" Hz" << std::endl
392 <<
"phase: " <<
phase <<
" rad" << std::endl;
395 case ElementType::_CT:
397 std::cout <<
"dicomDataPath: " <<
dicomDataPath << std::endl;
398 std::cout <<
"dicomDataFile: " <<
dicomDataFile << std::endl;
401 case ElementType::_AWAKESCREEN:
403 std::cout <<
"twindow = " <<
twindow*1e6 <<
" um" << std::endl
404 <<
"tscint = " <<
tscint*1e6 <<
" um" << std::endl
410 case ElementType::_AWAKESPECTROMETER:
412 std::cout <<
"twindow = " <<
twindow*1e6 <<
" um" << std::endl
413 <<
"tscint = " <<
tscint*1e6 <<
" um" << std::endl
414 <<
"screenPSize = " <<
screenPSize*1e6 <<
" um" << std::endl
417 <<
"tmount = " <<
tmount*1e6 <<
" um" << std::endl
422 case ElementType::_LASERWIREOLD:
424 std::cout <<
"lambda= " <<
waveLength <<
"m" << std::endl
425 <<
"xSigma= " << xsize <<
"m" << std::endl
426 <<
"ySigma= " <<
ysize <<
"m" << std::endl
427 <<
"xdir= " <<
xdir << std::endl
428 <<
"ydir= " <<
ydir << std::endl
429 <<
"zdir= " <<
zdir << std::endl;
432 case ElementType::_SCREEN:
434 std::cout <<
"angle= " <<
angle <<
"rad" << std::endl;
437 case ElementType::_TRANSFORM3D:
439 std::cout <<
"xdir= " <<
xdir <<
"m" << std::endl
440 <<
"ydir= " <<
ydir <<
"m" << std::endl
441 <<
"zdir= " <<
zdir <<
"m" << std::endl
442 <<
"phi= " << phi <<
"rad" << std::endl
443 <<
"theta= " << theta <<
"rad" << std::endl
444 <<
"psi= " <<
psi <<
"rad" << std::endl;
447 case ElementType::_GABORLENS:
449 std::cout <<
"b= " <<
B <<
"T" << std::endl
450 <<
"kg= " <<
kg << std::endl;
459 case ElementType::_RBEND:
460 case ElementType::_SBEND:
461 case ElementType::_QUAD:
462 case ElementType::_SEXTUPOLE:
463 case ElementType::_OCTUPOLE:
464 case ElementType::_DECAPOLE:
465 case ElementType::_SOLENOID:
466 case ElementType::_MULT:
467 case ElementType::_THINMULT:
468 case ElementType::_AWAKESPECTROMETER:
469 case ElementType::_MUONSPOILER:
470 case ElementType::_HKICKER:
471 case ElementType::_VKICKER:
472 case ElementType::_KICKER:
473 case ElementType::_TKICKER:
474 case ElementType::_UNDULATOR:
475 case ElementType::_RF:
476 case ElementType::_RFX:
477 case ElementType::_RFY:
479 std::cout <<
"scaling = " <<
scaling << std::endl;
482 std::cout <<
"fieldModulator = \"" << fieldModulator <<
"\"" << std::endl;
485 case ElementType::_MUONCOOLER:
501 type = ElementType::_NONE;
570 magnetGeometryType =
"";
696 markAsCollimator =
false;
709 crystalAngleYAxisLeft = 0;
710 crystalAngleYAxisRight = 0;
715 scalingFieldOuterSet =
false;
724 {value = get<double>(
this,property_name);}
725 catch (
const std::runtime_error&)
727 std::cerr <<
"element.cc> Error: unknown property \"" << property_name
728 <<
"\" (only works on numerical properties)" << std::endl;
742 if (params.
setMap.at(
"angle"))
744 else if (params.
setMap.at(
"scalingFieldOuter"))
745 {scalingFieldOuterSet =
true;}
750 for (
auto& i : params.
setMap)
754 std::string
property = i.first;
759 catch(
const std::runtime_error&)
761 std::cerr <<
"Error: parser> unknown property \"" <<
property
762 <<
"\" for element " << name << std::endl;
767 if (property ==
"bias")
769 std::stringstream ss(
bias);
778 else if (property ==
"biasMaterial")
784 else if (property ==
"biasVacuum")
790 else if (property ==
"biasMaterialLV")
801 std::string samplerNameIn,
802 double samplerRadiusIn,
806 {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 ysize2
size of the beam mask second aperture
double laserOffsetTheta
for laserwire
double rmat33
rmatrix elements, only 4x4
double rmat11
rmatrix elements, only 4x4
double rmat43
rmatrix elements, only 4x4
double laserOffsetPhi
for laserwire
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
std::string tipMaterial
tip material
double gradient
for rf cavities in V / m
double degraderOffset
for degrader
bool isSpecial() const
check if element is of a special type
double aper2
beampipe information, new aperture model
double anodeLength
for gabor lens
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
std::string outerShape
'rectangular' or 'circular'. used in gascap and bmcol
double laserOffsetY
for laserwire
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.
std::string biasMaterialLV
temporary string for bias setting
double anodeThickness
for gabor lens
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 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 offsetY2
offset of the beam mask second aperture
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 electrodeRadius
for gabor lens
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
std::list< double > ksl
skew multipole expansion
int numberWedges
for degrader
double kick1
rmatrix elements, only 4x4
std::list< std::string > biasMaterialLVList
physics biasing list for specific LVs
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
double electrodeThickness
for gabor lens
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 laserOffsetZ
for laserwire
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
double laserOffsetX
for laserwire
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
std::string coolingDefinition
For muon cooler.
double rmat23
rmatrix elements, only 4x4
std::string colour
Override colour for certain items.
double rmat13
rmatrix elements, only 4x4
double anodeRadius
for gabor lens
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
double tipThickness
for jaw collimator with tip
std::string cavityModel
Name of geometry model object for rfconstantinz cavities.
double e1
input pole face rotation for bends
std::string fieldOuter
Outer field.
std::string laserBeam
for laserwire
double undulatorPeriod
for undulator
std::string biasVacuum
temporary string for bias setting
double electrodeLength
for gabor lens
std::map< std::string, std::string > alternativeNames
map that translates between alternative parser names for members, could be made static
double tilt2
tilt of the beam mask second aperture
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.