30 #include <boost/filesystem.hpp>
46 filename_m(right.filename_m),
47 plane_m(right.plane_m),
76 if (dt *
R(2) < 0.0 &&
77 dt * (
R(2) + singleStep(2)) > 0.0) {
78 double frac =
R(2) / singleStep(2);
81 R + frac * singleStep,
102 if (dt *
R(2) < 0.0 &&
103 dt * (
R(2) + singleStep(2)) > 0.0) {
104 double frac = -
R(2) / singleStep(2);
105 double time = t + frac * dt;
117 for (
unsigned int i = 0; i < localNum; ++ i) {
148 double currentPosition = endField;
150 currentPosition = bunch->
get_sPos();
156 currentPosition < startField) {
158 namespace fs = boost::filesystem;
160 fs::path lossFileName = fs::path(
filename_m +
".h5");
161 if (fs::exists(lossFileName)) {
164 fs::remove(lossFileName);
183 for (
auto &stat: stats) {
211 bool hasPriorTrack = instance->hasPriorTrack();
212 bool inRestartRun = instance->inRestartRun();
215 double spos = it->first;
221 writer.
addRow(entry.second);
T euclidean_norm(const Vector< T > &)
Euclidean norm.
constexpr double c
The velocity of light in m/s.
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
Vector_t getBeta(Vector_t p)
size_t getLocalNum() const
ParticleAttrib< double > M
size_t getTotalNum() const
ParticleAttrib< Vector_t > P
ParticleAttrib< double > Q
ParticleAttrib< double > dt
long long getGlobalTrackStep() const
std::string getInputBasename()
get input file name without extension
OPENMODE getOpenMode() const
OPENMODE
Enum for writing to files.
static OpalData * getInstance()
virtual void visitMonitor(const Monitor &)=0
Apply the algorithm to a beam position monitor.
Interface for a single beam element.
PartBunchBase< double, 3 > * RefPartBunch_m
std::string getOutputFN() const
Get output filename.
CoordinateSystemTrafo csTrafoGlobal2Local_m
static void writeStatistics()
virtual void accept(BeamlineVisitor &) const override
Apply visitor to Monitor.
virtual void goOnline(const double &kineticEnergy) override
virtual bool applyToReferenceParticle(const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) override
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
virtual void goOffline() override
std::unique_ptr< LossDataSink > lossDs_m
virtual void getDimensions(double &zBegin, double &zEnd) const override
static std::map< double, SetStatistics > statFileEntries_sm
virtual void finalise() override
unsigned int numPassages_m
static const double halfLength_s
virtual bool bends() const override
virtual ElementBase::ElementType getType() const override
Get element type std::string.
virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B) override
Vector_t rotateFrom(const Vector_t &r) const
Vector_t transformFrom(const Vector_t &r) const
void addRow(const SetStatistics &set)
static Communicate * Comm