44 filename_m(right.filename_m),
45 plane_m(right.plane_m),
74 if (dt *
R(2) < 0.0 &&
75 dt * (
R(2) + singleStep(2)) > 0.0) {
77 double frac = -
R(2) / singleStep(2);
80 R + frac * singleStep,
94 const double tau = -refR(2) / driftPerTimeStep(2);
100 Vector_t dS = (tau - 0.5) * cdt * beta;
101 particle.setR(refToLocalCSTrafo.
transformTo(particle.getR()) + dS);
116 if (dt *
R(2) < 0.0 &&
117 dt * (
R(2) + singleStep(2)) > 0.0) {
118 double frac = -
R(2) / singleStep(2);
119 double time = t + frac * dt;
130 auto stats =
lossDs_m->computeStatistics(1);
131 if (!stats.empty()) {
155 double currentPosition = endField;
157 currentPosition = bunch->
get_sPos();
163 currentPosition < startField) {
165 namespace fs = std::filesystem;
167 fs::path lossFileName = fs::path(
filename_m +
".h5");
168 if (fs::exists(lossFileName)) {
171 fs::remove(lossFileName);
190 for (
auto &stat: stats) {
218 bool hasPriorTrack = instance->hasPriorTrack();
219 bool inRestartRun = instance->inRestartRun();
222 double spos =
it->first;
228 writer.
addRow(entry.second);
231 statFileEntries_sm.clear();
static OpalData * getInstance()
constexpr double c
The velocity of light in m/s.
static void writeStatistics()
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of it
virtual void getDimensions(double &zBegin, double &zEnd) const override
void driftToCorrectPositionAndSave(const Vector_t &R, const Vector_t &P)
CoordinateSystemTrafo getCSTrafoGlobal2Local() const
static std::map< double, SetStatistics > statFileEntries_sm
ParticleAttrib< Vector_t > P
Vektor< double, 3 > Vector_t
ParticleAttrib< double > M
unsigned int rewindLinesSDDS(const std::string &fileName, double maxSPos, bool checkForTime)
rewind the SDDS file such that the spos of the last step is less or equal to maxSPos ...
PartBunchBase< double, 3 > * RefPartBunch_m
virtual void visitMonitor(const Monitor &)=0
Apply the algorithm to a beam position monitor.
Vector_t transformFrom(const Vector_t &r) const
CoordinateSystemTrafo toLabTrafo_m
Vector_t rotateFrom(const Vector_t &r) const
T euclidean_norm(const Vector< T > &)
Euclidean norm.
virtual void goOffline() override
size_t getTotalNum() const
static Communicate * Comm
CoordinateSystemTrafo csTrafoGlobal2Local_m
Vector_t rotateTo(const Vector_t &r) const
virtual void finalise() override
Vector_t getBeta(Vector_t p)
long long getGlobalTrackStep() const
virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B) override
ParticleAttrib< double > Q
OpenMode
Enum for writing to files.
Vector_t transformTo(const Vector_t &r) const
ParticleAttrib< double > dt
OpenMode getOpenMode() const
std::unique_ptr< LossDataSink > lossDs_m
unsigned int numPassages_m
virtual bool applyToReferenceParticle(const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) override
Quaternion getQuaternion(Vector_t u, Vector_t ref)
static const double halfLength_s
void addRow(const SetStatistics &set)
std::string getInputBasename()
get input file name without extension
virtual bool bends() const override
bool update(const AttributeSet &)
Update element.
Interface for a single beam element.
std::string getOutputFN() const
Get output filename.
virtual void goOnline(const double &kineticEnergy) override
virtual void accept(BeamlineVisitor &) const override
Apply visitor to Monitor.
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
virtual ElementType getType() const override
Get element type std::string.