OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
FlexibleCollimator.h
Go to the documentation of this file.
1 //
2 // Class FlexibleCollimator
3 // Defines the abstract interface for a collimator.
4 //
5 // Copyright (c) 200x - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
6 // All rights reserved.
7 //
8 // This file is part of OPAL.
9 //
10 // OPAL is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
17 //
18 #ifndef CLASSIC_FlexibleCollimator_HH
19 #define CLASSIC_FlexibleCollimator_HH
20 
21 #include "AbsBeamline/Component.h"
22 #include "Utilities/MSLang.h"
25 
26 #include <memory>
27 
28 class BeamlineVisitor;
29 class LossDataSink;
30 
32 
33 public:
34 
36  explicit FlexibleCollimator(const std::string &name);
37 
40  virtual ~FlexibleCollimator();
41 
43  virtual void accept(BeamlineVisitor &) const override;
44 
45  virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B) override;
46 
47  virtual bool applyToReferenceParticle(const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) override;
48 
49  virtual bool checkCollimator(PartBunchBase<double, 3> *bunch, const int turnnumber, const double t, const double tstep);
50 
51  virtual void initialise(PartBunchBase<double, 3> *bunch, double &startField, double &endField) override;
52 
53  virtual void initialise(PartBunchBase<double, 3> *bunch);
54 
55  virtual void finalise() override;
56 
57  virtual bool bends() const override;
58 
59  virtual void goOnline(const double &kineticEnergy) override;
60 
61  virtual void goOffline() override;
62 
63  virtual ElementBase::ElementType getType() const override;
64 
65  virtual void getDimensions(double &zBegin, double &zEnd) const override;
66 
67  void print();
68 
69  unsigned int getLosses() const;
70 
71  void setDescription(const std::string &desc);
72  std::string getDescription() const;
73 
74  bool isStopped(const Vector_t &R);
75 
76  void writeHolesAndQuadtree(const std::string &baseFilename) const;
77 
78 private:
79 
80  // Not implemented.
82 
83  std::string description_m;
84  std::vector<std::shared_ptr<mslang::Base> > holes_m;
87 
88  bool informed_m;
89  unsigned int losses_m;
90  std::unique_ptr<LossDataSink> lossDs_m;
91 
93 };
94 
95 inline
96 unsigned int FlexibleCollimator::getLosses() const {
97  return losses_m;
98 }
99 
100 inline
102  return false;
103 }
104 
105 inline
107  return description_m;
108 }
109 
110 #endif // CLASSIC_FlexibleCollimator_HH
const std::string name
Interface for a single beam element.
Definition: Component.h:50
std::unique_ptr< LossDataSink > lossDs_m
bool isStopped(const Vector_t &R)
std::vector< std::shared_ptr< mslang::Base > > holes_m
virtual ElementBase::ElementType getType() const override
Get element type std::string.
virtual bool bends() const override
ParticleMatterInteractionHandler * parmatint_m
void operator=(const FlexibleCollimator &)
std::string getDescription() const
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B) override
virtual bool checkCollimator(PartBunchBase< double, 3 > *bunch, const int turnnumber, const double t, const double tstep)
virtual void finalise() override
virtual bool applyToReferenceParticle(const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) override
void setDescription(const std::string &desc)
virtual void goOffline() override
virtual void goOnline(const double &kineticEnergy) override
virtual void accept(BeamlineVisitor &) const override
Apply visitor to FlexibleCollimator.
void writeHolesAndQuadtree(const std::string &baseFilename) const
unsigned int getLosses() const
mslang::BoundingBox bb_m
mslang::QuadTree tree_m
virtual void getDimensions(double &zBegin, double &zEnd) const override