OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
DistributionMoments.h
Go to the documentation of this file.
1 //
2 // Class DistributionMoments
3 // Computes the statistics of particle distributions.
4 //
5 // Copyright (c) 2021, Christof Metzger-Kraus
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 DISTRIBUTIONMOMENTS_H
19 #define DISTRIBUTIONMOMENTS_H
20 
21 #include "FixedAlgebra/FMatrix.h"
22 
23 #include "Vektor.h"
24 
25 #include <vector>
26 
27 class OpalParticle;
28 template<class T, unsigned Dim>
29 class PartBunchBase;
30 
32 public:
34 
35  void compute(const std::vector<OpalParticle>::const_iterator &,
36  const std::vector<OpalParticle>::const_iterator &);
37  void compute(PartBunchBase<double, 3> const&);
39 
40  Vector_t getMeanPosition() const;
42  Vector_t getMeanMomentum() const;
47  Vector_t getHalo() const;
48  double getMeanTime() const;
49  double getStdTime() const;
50  double getMeanGamma() const;
51  double getMeanKineticEnergy() const;
52  double getStdKineticEnergy() const;
53  double getDx() const;
54  double getDDx() const;
55  double getDy() const;
56  double getDDy() const;
57  double getTotalCharge() const;
58  double getTotalMass() const;
59  double getTotalNumParticles() const;
60 private:
61  bool isParticleExcluded(const OpalParticle &) const;
62  template<class InputIt>
63  void computeMeans(const InputIt &, const InputIt &);
64  template<class InputIt>
65  void computeStatistics(const InputIt &, const InputIt &);
66  void fillMembers(std::vector<double> const&);
67  void reset();
68 
77 
78  double meanTime_m;
79  double stdTime_m;
82  double meanGamma_m;
83  double Dx_m;
84  double DDx_m;
85  double Dy_m;
86  double DDy_m;
87  double centroid_m[6];
89 
90  double totalCharge_m;
91  double totalMass_m;
92  unsigned int totalNumParticles_m;
93 };
94 
95 inline
97 {
98  return meanR_m;
99 }
100 
101 inline
103 {
104  return stdR_m;
105 }
106 
107 inline
109 {
110  return meanP_m;
111 }
112 
113 inline
115 {
116  return stdP_m;
117 }
118 
119 inline
121 {
122  return normalizedEps_m;
123 }
124 
125 inline
127 {
128  return geometricEps_m;
129 }
130 
131 inline
133 {
134  return stdRP_m;
135 }
136 
137 inline
139 {
140  return halo_m;
141 }
142 
143 inline
145 {
146  return meanTime_m;
147 }
148 
149 inline
151 {
152  return stdTime_m;
153 }
154 
155 inline
157 {
158  return meanGamma_m;
159 }
160 
161 inline
163 {
164  return meanKineticEnergy_m;
165 }
166 
167 inline
169 {
170  return stdKineticEnergy_m;
171 }
172 
173 inline
175 {
176  return Dx_m;
177 }
178 
179 inline
181 {
182  return DDx_m;
183 }
184 
185 inline
187 {
188  return Dy_m;
189 }
190 
191 inline
193 {
194  return DDy_m;
195 }
196 
197 inline
199 {
200  return totalCharge_m;
201 }
202 
203 inline
205 {
206  return totalMass_m;
207 }
208 
209 inline
211 {
212  return totalNumParticles_m;
213 }
214 
215 #endif
Vector_t getStandardDeviationMomentum() const
double getMeanKineticEnergy() const
Vector_t getStandardDeviationPosition() const
double getMeanGamma() const
Vector_t getHalo() const
FMatrix< double, 6, 6 > moments_m
double getTotalCharge() const
Vector_t getStandardDeviationRP() const
Vector_t getMeanPosition() const
void computeMeans(const InputIt &, const InputIt &)
void computeMeanKineticEnergy(PartBunchBase< double, 3 > const &)
unsigned int totalNumParticles_m
void compute(const std::vector< OpalParticle >::const_iterator &, const std::vector< OpalParticle >::const_iterator &)
double getStdKineticEnergy() const
Vector_t getNormalizedEmittance() const
double getTotalMass() const
Vector_t getMeanMomentum() const
void computeStatistics(const InputIt &, const InputIt &)
double getTotalNumParticles() const
bool isParticleExcluded(const OpalParticle &) const
void fillMembers(std::vector< double > const &)
double getMeanTime() const
Vector_t getGeometricEmittance() const