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