BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
laser.h
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2024.
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
20#ifndef LASER_H
21#define LASER_H
22
23#include <iomanip>
24#include <iostream>
25#include <string>
26
27#include "published.h"
28
29namespace GMAD {
35 class Laser : public Published<Laser>
36 {
37 public:
38 std::string name;
39 double wavelength{};
40 double m2{};
41 double pulseEnergy{};
42 double pulseDuration{};
43 double w0{};
44 double sigma0{};
45 double laserArrivalTime{};
46 double laserPolarization1{};
47 double laserPolarization2{};
48 double laserPolarization3{};
49 bool ignoreRayleighRange{};
50
51
53 Laser();
55 void clear();
57 void print() const;
59 template<typename T>
60 void set_value(std::string property, T value);
61
62 private:
64 void PublishMembers();
65 };
66
67 template<typename T>
68 void Laser::set_value(std::string property, T value) {
69#ifdef BDSDEBUG
70 std::cout << "Laser> Setting value " << std::setw(25) << std::left << property << value << std::endl;
71#endif
72 // member method can throw runtime_error, catch and exit gracefully
73 try {
74 set(this, property, value);
75 }
76 catch (std::runtime_error) {
77 std::cerr << "Error: placement> unknown option \"" << property << "\" with value " << value << std::endl;
78 exit(1);
79 }
80 }
81}
82
83#endif
Placement class for laser.
Definition laser.h:36
void print() const
print some properties
Definition laser.cc:61
std::string name
Name of this laser.
Definition laser.h:38
Laser()
constructor
Definition laser.cc:23
void PublishMembers()
publish members
Definition laser.cc:45
void clear()
reset
Definition laser.cc:29
void set_value(std::string property, T value)
set methods by property name and value
Definition laser.h:68
Class that provides introspection to its members.
Definition published.h:49
void set(Laser *instance, const std::string &name, double value)
Definition published.h:101
Parser namespace for GMAD language. Combination of Geant4 and MAD.