BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
element.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2023.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#include "element.h"
20#include "elementtype.h"
21#include "parameters.h"
22#include "parser.h"
23
24#include <cstdio>
25#include <cstdlib>
26#include <iostream>
27#include <sstream>
28#include <string>
29
30using namespace GMAD;
31
32namespace
33{
35 void print(const std::list<Element>& l, int ident=0)
36 {
37 if (ident == 0)
38 {std::cout << "using line " << Parser::Instance()->current_line << std::endl;}
39
40 for (auto& el : l)
41 {el.print();}
42 }
43}
44
46 lst(nullptr)
47{
48 flush();
49
51}
52
54{
55 publish("userTypeName", &Element::userTypeName);
56 publish("userParameters", &Element::userParameters);
57
58 publish("l", &Element::l);
59 publish("scaling", &Element::scaling);
60 publish("scalingFieldOuter", &Element::scalingFieldOuter);
61 publish("ks", &Element::ks);
62 publish("k1", &Element::k1);
63 publish("k2", &Element::k2);
64 publish("k3", &Element::k3);
65 publish("k4", &Element::k4);
66 publish("angle", &Element::angle);
67 publish("B", &Element::B);
68 publish("e1", &Element::e1);
69 publish("e2", &Element::e2);
70 publish("fint", &Element::fint);
71 publish("fintx", &Element::fintx);
72 publish("fintK2", &Element::fintK2);
73 publish("fintxK2", &Element::fintxK2);
74 publish("hgap", &Element::hgap);
75 publish("h1", &Element::h1);
76 publish("h2", &Element::h2);
77 publish("kick", &Element::kick);
78 publish("hkick", &Element::hkick);
79 publish("vkick", &Element::vkick);
80 publish("knl", &Element::knl);
81 publish("ksl", &Element::ksl);
82 publish("gradient", &Element::gradient);
83 publish("E", &Element::E);
84 publish("frequency", &Element::frequency);
85 publish("phase", &Element::phase);
86 publish("tOffset", &Element::tOffset);
87 publish("fieldModulator", &Element::fieldModulator);
88
89 // rmatrix elements, only 4x4
90 publish("kick1", &Element::kick1);
91 publish("kick2", &Element::kick2);
92 publish("kick3", &Element::kick3);
93 publish("kick4", &Element::kick4);
94 publish("rmat11", &Element::rmat11);
95 publish("rmat12", &Element::rmat12);
96 publish("rmat13", &Element::rmat13);
97 publish("rmat14", &Element::rmat14);
98 publish("rmat21", &Element::rmat21);
99 publish("rmat22", &Element::rmat22);
100 publish("rmat23", &Element::rmat23);
101 publish("rmat24", &Element::rmat24);
102 publish("rmat31", &Element::rmat31);
103 publish("rmat32", &Element::rmat32);
104 publish("rmat33", &Element::rmat33);
105 publish("rmat34", &Element::rmat34);
106 publish("rmat41", &Element::rmat41);
107 publish("rmat42", &Element::rmat42);
108 publish("rmat43", &Element::rmat43);
109 publish("rmat44", &Element::rmat44);
110
111 // beampipe information, new aperture model
112 publish("beampipeThickness",&Element::beampipeThickness);
113 publish("aper1", &Element::aper1);
114 publish("aper", &Element::aper1);
115 alternativeNames["aper"] = "aper1";
116 publish("aperture", &Element::aper1);
117 alternativeNames["aperture"] = "aper1";
118 publish("aperture1", &Element::aper1);
119 alternativeNames["aperture1"] = "aper1";
120 publish("beampipeRadius", &Element::aper1);
121 alternativeNames["beampipeRadius"] = "aper1";
122 publish("aper2", &Element::aper2);
123 publish("aperture2", &Element::aper2);
124 alternativeNames["aperture2"] = "aper2";
125 publish("aper3", &Element::aper3);
126 publish("aperture3", &Element::aper3);
127 alternativeNames["aperture3"] = "aper3";
128 publish("aper4", &Element::aper4);
129 publish("aperture4", &Element::aper4);
130 alternativeNames["aperture4"] = "aper4";
131 publish("apertureType", &Element::apertureType);
132 publish("beampipeMaterial", &Element::beampipeMaterial);
133 publish("vacuumMaterial", &Element::vacuumMaterial);
134
135 // magnet geometry
136 publish("magnetGeometryType", &Element::magnetGeometryType);
137 publish("horizontalWidth", &Element::horizontalWidth);
138 publish("outerDiameter", &Element::horizontalWidth);
139 alternativeNames["outerDiameter"] = "horizontalWidth";
140 publish("yokeOnInside", &Element::yokeOnInside);
141 publish("hStyle", &Element::hStyle);
142 publish("vhRatio", &Element::vhRatio);
143 publish("coilWidthFraction", &Element::coilWidthFraction);
144 publish("coilHeightFraction", &Element::coilHeightFraction);
145 publish("tilt", &Element::tilt);
146 publish("xsize", &Element::xsize);
147 publish("ysize", &Element::ysize);
148 publish("xsizeOut", &Element::xsizeOut);
149 publish("ysizeOut", &Element::ysizeOut);
150 publish("xsizeLeft", &Element::xsizeLeft);
151 publish("xsizeRight", &Element::xsizeRight);
152 publish("offsetX", &Element::offsetX);
153 publish("offsetY", &Element::offsetY);
154 publish("jawTiltLeft", &Element::jawTiltLeft);
155 publish("jawTiltRight", &Element::jawTiltRight);
156
157 // screen parameters
158 publish("tscint", &Element::tscint);
159 publish("twindow", &Element::twindow);
160 publish("tmount", &Element::tmount);
161 publish("windowScreenGap", &Element::windowScreenGap);
162 publish("screenXSize", &Element::screenXSize);
163 publish("screenYSize", &Element::screenYSize);
164 publish("layerThicknesses",&Element::layerThicknesses);
165 publish("layerMaterials", &Element::layerMaterials);
166 publish("layerIsSampler", &Element::layerIsSampler);
167
168 // for AWAKE spectrometer
169 publish("screenPSize", &Element::screenPSize);
170 publish("screenEndZ", &Element::screenEndZ);
171 publish("poleStartZ", &Element::poleStartZ);
172 publish("screenWidth", &Element::screenWidth);
173 publish("awakeMagnetOffsetX", &Element::awakeMagnetOffsetX);
174 publish("windowmaterial", &Element::windowmaterial);
175 publish("scintmaterial", &Element::scintmaterial);
176 publish("mountmaterial", &Element::mountmaterial);
177
178 // for 3d transform and laser
179 publish("x", &Element::xdir);
180 alternativeNames["x"] = "xdir";
181 publish("y", &Element::ydir);
182 alternativeNames["y"] = "ydir";
183 publish("z", &Element::zdir);
184 alternativeNames["z"] = "zdir";
185 publish("xdir", &Element::xdir);
186 publish("ydir", &Element::ydir);
187 publish("zdir", &Element::zdir);
188 publish("waveLength", &Element::waveLength);
189 publish("phi", &Element::phi);
190 publish("theta", &Element::theta);
191 publish("psi", &Element::psi);
192 publish("axisX", &Element::axisX);
193 publish("axisY", &Element::axisY);
194 publish("axisZ", &Element::axisZ);
195 publish("axisAngle", &Element::axisAngle);
196
197 // for degrader
198 publish("numberWedges", &Element::numberWedges);
199 publish("wedgeLength", &Element::wedgeLength);
200 publish("degraderHeight", &Element::degraderHeight);
201 publish("materialThickness", &Element::materialThickness);
202 publish("degraderOffset", &Element::degraderOffset);
203
204 // for wirescanner
205 publish("wireDiameter", &Element::wireDiameter);
206 publish("wireLength", &Element::wireLength);
207 publish("wireOffsetX", &Element::wireOffsetX);
208 publish("wireOffsetY", &Element::wireOffsetY);
209 publish("wireOffsetZ", &Element::wireOffsetZ);
210 publish("wireAngle", &Element::wireAngle);
211
212 // for undulator
213 publish("undulatorPeriod", &Element::undulatorPeriod);
214 publish("undulatorGap", &Element::undulatorGap);
215 publish("undulatorMagnetHeight", &Element::undulatorMagnetHeight);
216
217 // bias
218 publish("bias", &Element::bias);
219 publish("biasMaterial", &Element::biasMaterial);
220 publish("biasVacuum", &Element::biasVacuum);
221
222 publish("minimumKineticEnergy",&Element::minimumKineticEnergy);
223
224 publish("samplerName", &Element::samplerName);
225 publish("samplerType", &Element::samplerType);
226 publish("r", &Element::samplerRadius); // historic
227 publish("samplerRadius", &Element::samplerRadius);
228 alternativeNames["r"] ="samplerRadius";
229
230 publish("region", &Element::region);
231 publish("fieldOuter", &Element::fieldOuter);
232 publish("fieldVacuum", &Element::fieldVacuum);
233 publish("fieldAll", &Element::fieldAll);
234 publish("bmap", &Element::fieldAll);
235 alternativeNames["bmap"] = "fieldAll";
236
237 publish("geometryFile", &Element::geometryFile);
238 publish("geometry", &Element::geometryFile);
239 alternativeNames["geometry"] = "geometryFile"; // backwards compatibility
240 publish("stripOuterVolume", &Element::stripOuterVolume);
241 publish("autoColour", &Element::autoColour);
242 publish("elementLengthIsArcLength", &Element::elementLengthIsArcLength);
243 publish("material", &Element::material);
244 publish("outerMaterial", &Element::material);
245 alternativeNames["outerMaterial"] = "material";
246 publish("namedVacuumVolumes", &Element::namedVacuumVolumes);
247 publish("markAsCollimator", &Element::markAsCollimator);
248 publish("spec", &Element::spec);
249 publish("cavityModel", &Element::cavityModel);
250 publish("cavityFieldType", &Element::cavityFieldType);
251
252 publish("dicomDataPath", &Element::dicomDataPath);
253 publish("dicomDataFile", &Element::dicomDataFile);
254
255 publish("colour", &Element::colour);
256
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);
262}
263
264std::string Element::getPublishedName(const std::string& nameIn) const
265{
266 auto it = alternativeNames.find(nameIn);
267 if (it != alternativeNames.end())
268 {return it->second;}
269 // if not found return name
270 return nameIn;
271}
272
274{
275 return (type == ElementType::_TRANSFORM3D ||
276 type == ElementType::_MARKER ||
277 type == ElementType::_LINE ||
278 type == ElementType::_REV_LINE);
279}
280
281void Element::print(int ident) const
282{
283 for(int i=0;i<ident;i++)
284 {std::cout << "--";}
285
286 std::cout << name << " : " << type << std::endl;
287 if (l>0.0)
288 {std::cout << "l = " << l << "m" << std::endl;}
289 if (horizontalWidth > 0)
290 {std::cout << "horizontalWidth = " << horizontalWidth << "m" << std::endl;}
291 if (samplerType != "none")
292 {
293 std::cout << "samplerType = " << samplerType << "\n"
294 << "samplerRadius = " << samplerRadius << "\n"
295 << "samplerarticleSetID = " << samplerParticleSetID << std::endl;
296 }
297
298
299 switch(type)
300 {
301 case ElementType::_SBEND:
302 case ElementType::_RBEND:
303 {
304 std::cout << "B = " << B << std::endl
305 << "angle = " << angle << std::endl
306 << "k1 = " << k1 << std::endl;
307 break;
308 }
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:
321 {
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;
329 break;
330 }
331 case ElementType::_ECOL:
332 case ElementType::_RCOL:
333 case ElementType::_JCOL:
334 {
335 std::cout << "x half aperture = " << xsize <<" m" << std::endl
336 << "y half aperture = " << ysize <<" m" << std::endl
337 << "material = \"" << material << "\"" << std::endl;
338 break;
339 }
340 case ElementType::_ELEMENT:
341 {
342 std::cout << "horizontalWidth: " << horizontalWidth << "m" << std::endl
343 << "geometryFile: " << geometryFile << std::endl
344 << "fieldAll: " << fieldAll << std::endl;
345 break;
346 }
347 case ElementType::_CT:
348 {
349 std::cout << "dicomDataPath: " << dicomDataPath << std::endl;
350 std::cout << "dicomDataFile: " << dicomDataFile << std::endl;
351 break;
352 }
353 case ElementType::_AWAKESCREEN:
354 {
355 std::cout << "twindow = " << twindow*1e6 << " um" << std::endl
356 << "tscint = " << tscint*1e6 << " um" << std::endl
357 << "windowScreenGap = " << windowScreenGap*1e6 << " um" << std::endl
358 << "windowmaterial = " << windowmaterial << std::endl
359 << "scintmaterial = " << scintmaterial << std::endl;
360 break;
361 }
362 case ElementType::_AWAKESPECTROMETER:
363 {
364 std::cout << "twindow = " << twindow*1e6 << " um" << std::endl
365 << "tscint = " << tscint*1e6 << " um" << std::endl
366 << "screenPSize = " << screenPSize*1e6 << " um" << std::endl
367 << "windowScreenGap = " << windowScreenGap*1e6 << " um" << std::endl
368 << "windowmaterial = " << windowmaterial << std::endl
369 << "tmount = " << tmount*1e6 << " um" << std::endl
370 << "mountmaterial = " << mountmaterial << std::endl
371 << "scintmaterial = " << scintmaterial << std::endl;
372 break;
373 }
374 case ElementType::_LASER:
375 {
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;
382 break;
383 }
384 case ElementType::_SCREEN:
385 {
386 std::cout << "angle= " << angle <<"rad" << std::endl;
387 break;
388 }
389 case ElementType::_TRANSFORM3D:
390 {
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;
397 break;
398 }
399 default:
400 {break;}
401 }
402
403 switch (type)
404 {
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:
424 {
425 std::cout << "scaling = " << scaling << std::endl;
426 if (scalingFieldOuter != 1)
427 {std::cout << "scalingFieldOuter = " << scalingFieldOuter << std::endl;}
428 std::cout << "fieldModulator = \"" << fieldModulator << "\"" << std::endl;
429 break;
430 }
431 default:
432 {break;}
433 }
434
435 if (lst)
436 {::print(*lst,++ident);}
437}
438
440{
441 type = ElementType::_NONE;
442 name = "";
443 userTypeName = "";
444 userParameters = "";
445 l = 0;
446 scaling = 1;
448 ks = 0;
449 k1 = 0;
450 k2 = 0;
451 k3 = 0;
452 k4 = 0;
453 angle = 0;
454 B = 0;
455 e1 = 0;
456 e2 = 0;
457 fint = 0;
458 fintx = -1;
459 fintK2 = 0;
460 fintxK2 = 0;
461 hgap = 0;
462 h1 = 0;
463 h2 = 0;
464 kick = 0;
465 hkick = 0;
466 vkick = 0;
467 knl.clear();
468 ksl.clear();
469 gradient = 0;
470 E = 0;
471 frequency = 0;
472 phase = 0;
473 tOffset = 0;
474 fieldModulator = "";
475
476 // rmatrix
477 kick1 = 0;
478 kick2 = 0;
479 kick3 = 0;
480 kick4 = 0;
481 rmat11= 1.0;
482 rmat12= 0;
483 rmat13= 0;
484 rmat14= 0;
485 rmat21= 0;
486 rmat22= 1.0;
487 rmat23= 0;
488 rmat24= 0;
489 rmat31= 0;
490 rmat32= 0;
491 rmat33= 1.0;
492 rmat34= 0;
493 rmat41= 0;
494 rmat42= 0;
495 rmat43= 0;
496 rmat44= 1.0;
497
498 // new aperture model
500 aper1 = 0;
501 aper2 = 0;
502 aper3 = 0;
503 aper4 = 0;
504 apertureType = "";
505 beampipeMaterial = "";
506 vacuumMaterial = "";
507
508 // magnet geometry
509 magnetGeometryType = "";
510 horizontalWidth = 0;
511 yokeOnInside = true;
512 hStyle = -1;
513 vhRatio = -1;
515 coilHeightFraction = -1; // signifies use default in factory
516 tilt = 0;
517 xsize = 0;
518 ysize = 0;
519 xsizeOut = 0;
520 ysizeOut = 0;
521 xsizeLeft = 0;
522 xsizeRight = 0;
523 offsetX = 0;
524 offsetY = 0;
525 jawTiltLeft = 0;
526 jawTiltRight = 0;
527
528 // screen parameters
529 tscint = 0.0003;
530 twindow = 0;
531 tmount = 0;
532 windowScreenGap = 0;
533 screenXSize = 0;
534 screenYSize = 0;
535 layerThicknesses.clear();
536 layerMaterials.clear();
537 layerIsSampler.clear();
538
539 // for AWAKE spectrometer
540 screenPSize = 0;
541 screenEndZ = 0;
542 poleStartZ = 0;
543 screenWidth = 0;
544 awakeMagnetOffsetX = 0.13;
545 windowmaterial = "vacuum";
546 scintmaterial = "";
547 mountmaterial = "";
548
549 // for 3d transform and laser
550 xdir = 0;
551 ydir = 0;
552 zdir = 0;
553 waveLength = 0;
554 gradient = 0;
555 phi = 0;
556 theta = 0;
557 psi = 0;
558 axisX = 0;
559 axisY = 0;
560 axisZ = 0;
561 axisAngle = false;
562
563 // for degrader
564 numberWedges = 1;
565 wedgeLength = 0;
566 degraderHeight = 0;
568 degraderOffset = 0;
569
570 // for wirescanner
571 wireDiameter = 0;
572 wireLength = 0;
573 wireOffsetX = 0;
574 wireOffsetY = 0;
575 wireOffsetZ = 0;
576 wireAngle = 0;
577
578 // undulator
579 undulatorPeriod = 1;
580 undulatorGap = 0;
582
583 // bias
584 bias = "";
585 biasMaterial = "";
586 biasVacuum = "";
587 biasMaterialList.clear();
588 biasVacuumList.clear();
589
591
592 samplerName = "";
593 samplerType = "none"; // allowed "none", "plane", "cylinder"
594 samplerRadius = 0;
595 samplerParticleSetID = -1; // -1 is code for none
596
597 region = "";
598 fieldOuter = "";
599 fieldVacuum = "";
600 fieldAll = "";
601
602 geometryFile = "";
603 stripOuterVolume = false;
604 autoColour = true;
606 material="";
608 markAsCollimator = false;
609 spec = "";
610 cavityModel = "";
611 cavityFieldType = "constantinz";
612
613 dicomDataFile = "";
614 dicomDataPath = "";
615
616 colour = "";
617
618 crystalLeft = "";
619 crystalRight = "";
620 crystalBoth = "";
621 crystalAngleYAxisLeft = 0;
622 crystalAngleYAxisRight = 0;
623
624 angleSet = false;
625 scalingFieldOuterSet = false;
626
627 lst = nullptr;
628}
629
630double Element::property_lookup(std::string property_name) const
631{
632 double value;
633 try
634 {value = get<double>(this,property_name);}
635 catch (const std::runtime_error&)
636 {
637 std::cerr << "element.cc> Error: unknown property \"" << property_name
638 << "\" (only works on numerical properties)" << std::endl;
639 exit(1);
640 }
641 return value;
642}
643
644void Element::set(const Parameters& params, std::string nameIn, ElementType typeIn)
645{
646 // common parameters for all elements
647 type = typeIn;
648 name = nameIn;
649
650 set(params);
651
652 if (params.setMap.at("angle"))
653 {angleSet = true;}
654 else if (params.setMap.at("scalingFieldOuter"))
655 {scalingFieldOuterSet = true;}
656}
657
658void Element::set(const Parameters& params)
659{
660 for (auto& i : params.setMap)
661 {
662 if (i.second)
663 {
664 std::string property = i.first;
665
666 // method can in theory throw runtime_error (shouldn't happen), catch and exit gracefully
667 try
668 {Published<Element>::set(this,(Element*)&params,property);}
669 catch(const std::runtime_error&)
670 {
671 std::cerr << "Error: parser> unknown property \"" << property
672 << "\" for element " << name << std::endl;
673 exit(1);
674 }
675
676 // split bias into tokens and add to both material and vacuum
677 if (property == "bias")
678 {
679 std::stringstream ss(bias);
680 std::string tok;
681 while(ss >> tok)
682 {
683 biasMaterialList.push_back(tok);
684 biasVacuumList.push_back(tok);
685 }
686 }
687 else if (property == "biasMaterial")
688 {
689 std::stringstream ss(biasMaterial);
690 std::string tok;
691 while(ss >> tok) {biasMaterialList.push_back(tok);}
692 }
693 else if (property == "biasVacuum")
694 {
695 std::stringstream ss(biasVacuum);
696 std::string tok;
697 while(ss >> tok) {biasVacuumList.push_back(tok);}
698 }
699 }
700 }
701}
702
703void Element::setSamplerInfo(std::string samplerTypeIn,
704 std::string samplerNameIn,
705 double samplerRadiusIn,
706 int particleSetIDIn)
707{
708 if (samplerType != "none")
709 {std::cout << "WARNING: overwriting already defined sampler info for element: " << name << std::endl;}
710
711 samplerType = samplerTypeIn;
712 samplerName = samplerNameIn;
713 samplerRadius = samplerRadiusIn;
714 samplerParticleSetID = particleSetIDIn;
715}
std::string current_line
Name of beamline.
Definition: parser.h:203
static Parser * Instance()
Access method.
Definition: parser.cc:94
void publish(const std::string &name, T C::*mp)
Make pointer to member from class C and type T with accessible with a name.
Definition: published.h:92
void set(C *instance, const std::string &name, double value)
Definition: published.h:99
Parser namespace for GMAD language. Combination of Geant4 and MAD.
ElementType
types of elements
Definition: elementtype.h:28
Element class.
Definition: element.h:43
double property_lookup(std::string property_name) const
Definition: element.cc:630
double hkick
fractional delta px for hkicker
Definition: element.h:70
std::string dicomDataFile
for CT, file for DICOM construction data
Definition: element.h:228
std::string spec
Arbitrary specification to pass to beamline builder.
Definition: element.h:223
void print(int ident=0) const
print method
Definition: element.cc:281
std::string biasMaterial
temporary string for bias setting
Definition: element.h:190
double twindow
thickness of window
Definition: element.h:134
double B
magnetic field
Definition: element.h:59
double aper4
beampipe information, new aperture model
Definition: element.h:110
double hgap
half distance of pole separation for purposes of fringe fields - 'half gap'
Definition: element.h:66
void set(const Parameters &params)
set method from Parameters structure
Definition: element.cc:658
void PublishMembers()
publish members so these can be looked up from parser
Definition: element.cc:53
std::string beampipeMaterial
beampipe information, new aperture model
Definition: element.h:112
std::string samplerType
element has a sampler of this type (default "none")
Definition: element.h:202
double rmat33
rmatrix elements, only 4x4
Definition: element.h:96
double rmat11
rmatrix elements, only 4x4
Definition: element.h:86
double rmat43
rmatrix elements, only 4x4
Definition: element.h:100
std::list< std::string > layerMaterials
for screen
Definition: element.h:140
std::string userParameters
String for passing user parameters through.
Definition: element.h:47
double scaling
Overall scaling of field strength.
Definition: element.h:50
std::string cavityFieldType
Name for type of field to use in a cavity.
Definition: element.h:225
double windowScreenGap
air gap between window and screen
Definition: element.h:136
double gradient
for rf cavities in V / m
Definition: element.h:74
double degraderOffset
for degrader
Definition: element.h:170
bool isSpecial() const
check if element is of a special type
Definition: element.cc:273
double wireAngle
for wirescanner
Definition: element.h:179
double aper2
beampipe information, new aperture model
Definition: element.h:108
double fintx
fringe field integral at the dipole exit
Definition: element.h:63
double kick4
rmatrix elements, only 4x4
Definition: element.h:85
std::list< Element > * lst
in case the element is a list itself (line)
Definition: element.h:247
double k2
sextupole
Definition: element.h:55
double rmat42
rmatrix elements, only 4x4
Definition: element.h:99
double aper1
beampipe information, new aperture model
Definition: element.h:107
double rmat41
rmatrix elements, only 4x4
Definition: element.h:98
double h2
output pole face curvature for bends
Definition: element.h:68
double awakeMagnetOffsetX
for AWAKE spectrometer
Definition: element.h:149
double zdir
for 3d transform and laser
Definition: element.h:158
double h1
input pole face curvature for bends
Definition: element.h:67
std::string namedVacuumVolumes
For imported geometry - identify vacuum volumes.
Definition: element.h:221
bool stripOuterVolume
For Element. Make it an assembly.
Definition: element.h:215
double screenPSize
for AWAKE spectrometer
Definition: element.h:145
double xdir
for 3d transform and laser
Definition: element.h:156
double rmat34
rmatrix elements, only 4x4
Definition: element.h:97
double psi
for 3d transforms
Definition: element.h:161
double wireOffsetX
for wirescanner
Definition: element.h:176
double rmat31
rmatrix elements, only 4x4
Definition: element.h:94
double wedgeLength
for degrader
Definition: element.h:167
double vhRatio
ratio of vertial to horizontal for some magnets
Definition: element.h:121
double waveLength
for laser wire and 3d transforms
Definition: element.h:160
double rmat22
rmatrix elements, only 4x4
Definition: element.h:91
double fintxK2
second fringe field integral at the dipole exit - for TRANSPORT matching
Definition: element.h:65
std::string userTypeName
User component element type name.
Definition: element.h:46
double wireOffsetY
for wirescanner
Definition: element.h:177
double kick3
rmatrix elements, only 4x4
Definition: element.h:84
double rmat24
rmatrix elements, only 4x4
Definition: element.h:93
double tOffset
time offset used for phase calculation (ns)
Definition: element.h:78
std::list< std::string > biasMaterialList
Definition: element.h:194
double fint
fringe field integral at the dipole entrance
Definition: element.h:62
double xsizeRight
individual collimator jaw half widths
Definition: element.h:127
std::string bias
temporary string for bias setting
Definition: element.h:189
double coilWidthFraction
Fraction of available h space the coil will take up.
Definition: element.h:122
double rmat44
rmatrix elements, only 4x4
Definition: element.h:101
double ks
solenoid
Definition: element.h:52
std::string fieldAll
Field for everything.
Definition: element.h:212
double jawTiltRight
jaw collimator jaw tilts (angle in x-z plane)
Definition: element.h:128
std::string region
region with range cuts
Definition: element.h:209
double wireDiameter
for wirescanner
Definition: element.h:174
int samplerParticleSetID
Definition: element.h:207
double tmount
thickness of the screen mount
Definition: element.h:135
double wireOffsetZ
for wirescanner
Definition: element.h:178
std::list< double > ksl
skew multipole expansion
Definition: element.h:73
int numberWedges
for degrader
Definition: element.h:166
double kick1
rmatrix elements, only 4x4
Definition: element.h:82
std::string getPublishedName(const std::string &name) const
returns 'official' member name for property
Definition: element.cc:264
std::list< double > knl
multipole expansion coefficients
Definition: element.h:72
std::string windowmaterial
for AWAKE spectrometer
Definition: element.h:150
double e2
output pole face rotation for bends
Definition: element.h:61
double phase
phase of rf cavity (rad)
Definition: element.h:77
double ysizeOut
collimator aperture or laser spotsize for laser
Definition: element.h:126
std::string fieldVacuum
Vacuum field.
Definition: element.h:211
bool autoColour
Automagically colour the external geometry.
Definition: element.h:216
double angle
bending angle
Definition: element.h:58
int hStyle
-1 = unset; 0 = false (ie c style); 1 = true, use hstyle
Definition: element.h:120
std::string geometryFile
For Element. File for external geometry.
Definition: element.h:214
std::string vacuumMaterial
beampipe information, new aperture model
Definition: element.h:113
double vkick
fractional delta py for vkicker
Definition: element.h:71
double E
voltage for rf cavities in V that will be assumed over length l
Definition: element.h:75
double coilHeightFraction
Fraction of availalbe v space the coil will take up.
Definition: element.h:123
std::list< int > layerIsSampler
for screen
Definition: element.h:141
bool elementLengthIsArcLength
For Element. Treat the length as arc length, if not chord.
Definition: element.h:218
double screenYSize
Definition: element.h:137
double offsetX
offset X
Definition: element.h:129
double screenEndZ
for AWAKE spectrometer
Definition: element.h:146
double ysize
collimator aperture or laser spotsize for laser
Definition: element.h:125
double rmat23
rmatrix elements, only 4x4
Definition: element.h:92
Element()
constructor
Definition: element.cc:45
std::string colour
Override colour for certain items.
Definition: element.h:231
double rmat13
rmatrix elements, only 4x4
Definition: element.h:88
double tilt
tilt
Definition: element.h:124
double materialThickness
for degrader
Definition: element.h:169
void flush()
flush method
Definition: element.cc:439
double l
length in metres
Definition: element.h:49
double kick
fractional delta p for either h or v kicker
Definition: element.h:69
double rmat14
rmatrix elements, only 4x4
Definition: element.h:89
double beampipeThickness
beampipe information, new aperture model
Definition: element.h:106
std::string dicomDataPath
for CT, file for DICOM construction data
Definition: element.h:227
double minimumKineticEnergy
minimum kinetic energy for user limits - respected on element by element basis
Definition: element.h:199
std::string scintmaterial
for AWAKE spectrometer
Definition: element.h:151
double ydir
for 3d transform and laser
Definition: element.h:157
double undulatorMagnetHeight
for undulator
Definition: element.h:185
void setSamplerInfo(std::string samplerType, std::string samplerName, double samplerRadius, int samplerParticleSetIDIn=-1)
set sampler info
Definition: element.cc:703
std::string cavityModel
Name of geometry model object for rfconstantinz cavities.
Definition: element.h:224
double e1
input pole face rotation for bends
Definition: element.h:60
double k1
quadrupole
Definition: element.h:54
std::string fieldOuter
Outer field.
Definition: element.h:210
double undulatorPeriod
for undulator
Definition: element.h:183
std::string biasVacuum
temporary string for bias setting
Definition: element.h:191
double wireLength
for wirescanner
Definition: element.h:175
std::map< std::string, std::string > alternativeNames
map that translates between alternative parser names for members, could be made static
Definition: element.h:282
double undulatorGap
for undulator
Definition: element.h:184
double poleStartZ
for AWAKE spectrometer
Definition: element.h:147
double fintK2
second fringe field integral at the dipole entrance - for TRANSPORT matching
Definition: element.h:64
bool angleSet
Definition: element.h:242
std::string mountmaterial
for AWAKE spectrometer
Definition: element.h:152
double k4
decapole
Definition: element.h:57
double samplerRadius
Definition: element.h:203
double aper3
beampipe information, new aperture model
Definition: element.h:109
ElementType type
element enum
Definition: element.h:44
std::list< std::string > biasVacuumList
physics biasing list for the vacuum
Definition: element.h:196
double offsetY
offset Y
Definition: element.h:130
std::list< double > layerThicknesses
for screen
Definition: element.h:139
double scalingFieldOuter
Extra arbitrary scaling for outer field - compounded with 'scaling'.
Definition: element.h:51
std::string samplerName
name of sampler (default empty)
Definition: element.h:201
double degraderHeight
for degrader
Definition: element.h:168
double tscint
thickness of scintillating part of screen
Definition: element.h:133
double k3
octupole
Definition: element.h:56
double screenWidth
for AWAKE spectrometer
Definition: element.h:148
double frequency
frequency for rf cavity in Hz
Definition: element.h:76
double kick2
rmatrix elements, only 4x4
Definition: element.h:83
double rmat12
rmatrix elements, only 4x4
Definition: element.h:87
std::string apertureType
beampipe information, new aperture model
Definition: element.h:111
double rmat21
rmatrix elements, only 4x4
Definition: element.h:90
double rmat32
rmatrix elements, only 4x4
Definition: element.h:95
Parameters - Element class with booleans.
Definition: parameters.h:44
std::map< std::string, bool > setMap
Map that holds booleans for every member of element.
Definition: parameters.h:47