1 | #ifndef PARTICLEBEAM_SEEN |
---|
2 | #define PARTICLEBEAM_SEEN |
---|
3 | #include <iostream> |
---|
4 | #include <sstream> |
---|
5 | #include <stdio.h> |
---|
6 | #include<cmath> |
---|
7 | #include <vector> |
---|
8 | |
---|
9 | #include "bareParticle.h" |
---|
10 | #include "nomdElements.h" |
---|
11 | #include "beam2Moments.h" |
---|
12 | |
---|
13 | using namespace std; |
---|
14 | |
---|
15 | class particleBeam |
---|
16 | { |
---|
17 | bool particleRepresentationOk_; |
---|
18 | bool momentRepresentationOk_; |
---|
19 | beam2Moments rij_; |
---|
20 | double P0Transport_; |
---|
21 | |
---|
22 | // la representation du faisceau de particules sera a preciser ulterieurement |
---|
23 | // Pour l'instant une particule courante est definie par : |
---|
24 | // x |
---|
25 | // y |
---|
26 | // deltaz = z - z0 (z0 est le z de la particule de reference) |
---|
27 | // gamma.betax |
---|
28 | // gamma.betay |
---|
29 | // gamma.betaz |
---|
30 | vector<bareParticle> goodPartic_; |
---|
31 | |
---|
32 | // par ailleurs, la particules de reference est definie par x,y,z,gamma.betax, gamma.betay, gamma.betaz |
---|
33 | // elle est dupliquee dans le faisceau prorement dit (goodPartic_) avec z = z-z0 et ne doit, par consequent, |
---|
34 | // pas etre prise en compte dans les calculs de trajectoire. |
---|
35 | bareParticle referenceParticle_; |
---|
36 | |
---|
37 | |
---|
38 | vector<double> centroid_; |
---|
39 | |
---|
40 | void impressionDesMoments() const; |
---|
41 | void razDesMoments(); |
---|
42 | void particlesPhaseSpaceComponent(vector<double>& coord, unsigned index); |
---|
43 | |
---|
44 | public: |
---|
45 | |
---|
46 | particleBeam(); |
---|
47 | virtual ~particleBeam() {;} |
---|
48 | |
---|
49 | void buildMomentRepresentation(); |
---|
50 | void clear(); |
---|
51 | int getNbParticles() const; |
---|
52 | const beam2Moments& getTransportMoments() const; |
---|
53 | double getSigmaTransportij(unsigned i, unsigned j); |
---|
54 | double getUnnormalizedEmittanceX(); |
---|
55 | double getP0Transport() const; |
---|
56 | double referenceKineticEnergyMeV() const; |
---|
57 | bool particleRepresentationOk() const; |
---|
58 | bool momentRepresentationOk() const; |
---|
59 | void addParticle( bareParticle p); |
---|
60 | const vector<bareParticle>& getParticleVector() const; |
---|
61 | vector<bareParticle>& getParticleVector(); |
---|
62 | double getXmaxRms(); |
---|
63 | void getVariance(double& varx, double& vary, double& varz) const; |
---|
64 | void set2Moments(beam2Moments& moments); |
---|
65 | void setWithParticles(vector<double>& centroid, bareParticle& referencePart, vector<bareParticle>& particles); |
---|
66 | void printAllXYZ() const; |
---|
67 | void Zrange(double& zmin, double& zmax) const; |
---|
68 | // void donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor); |
---|
69 | void donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd); |
---|
70 | void particlesPhaseSpaceData(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd); |
---|
71 | virtual string FileOutputFlow() const; |
---|
72 | virtual bool FileInput(ifstream& ifs); |
---|
73 | void histogramme(vector<double>&xcor,vector<int>& hist,int& cnts,double out[3]); |
---|
74 | }; |
---|
75 | #endif |
---|