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) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef LASER_H
20#define LASER_H
21
22#include <iomanip>
23#include <iostream>
24#include <string>
25
26#include "published.h"
27
28namespace GMAD {
34 class Laser : public Published<Laser>
35 {
36 public:
37 std::string name;
38 double wavelength{};
39 double m2{};
40 double pulseEnergy{};
41 double pulseDuration{};
42 double w0{};
43 double sigma0{};
44 double laserArrivalTime{};
45 double laserPolarization1{};
46 double laserPolarization2{};
47 double laserPolarization3{};
48 bool ignoreRayleighRange{};
49
50
52 Laser();
54 void clear();
56 void print() const;
58 template<typename T>
59 void set_value(std::string property, T value);
60
61 private:
63 void PublishMembers();
64 };
65
66 template<typename T>
67 void Laser::set_value(std::string property, T value) {
68#ifdef BDSDEBUG
69 std::cout << "Laser> Setting value " << std::setw(25) << std::left << property << value << std::endl;
70#endif
71 // member method can throw runtime_error, catch and exit gracefully
72 try {
73 set(this, property, value);
74 }
75 catch (const std::runtime_error&) {
76 std::cerr << "Error: placement> unknown option \"" << property << "\" with value " << value << std::endl;
77 exit(1);
78 }
79 }
80}
81
82#endif
Placement class for laser.
Definition laser.h:35
void print() const
print some properties
Definition laser.cc:60
std::string name
Name of this laser.
Definition laser.h:37
Laser()
constructor
Definition laser.cc:22
void PublishMembers()
publish members
Definition laser.cc:44
void clear()
reset
Definition laser.cc:28
void set_value(std::string property, T value)
set methods by property name and value
Definition laser.h:67
Class that provides introspection to its members.
Definition published.h:48
void set(Laser *instance, const std::string &name, double value)
Definition published.h:100
Parser namespace for GMAD language. Combination of Geant4 and MAD.