1 | #ifndef PARTICLEBEAM_SEEN |
---|
2 | #define PARTICLEBEAM_SEEN |
---|
3 | #include <iostream> |
---|
4 | #include <sstream> |
---|
5 | #include <stdio.h> |
---|
6 | |
---|
7 | #include<cmath> |
---|
8 | |
---|
9 | #include <vector> |
---|
10 | |
---|
11 | #include "bareParticle.h" |
---|
12 | //#include "mathematicalTools.h" |
---|
13 | #include "nomdElements.h" |
---|
14 | #include "beam2Moments.h" |
---|
15 | |
---|
16 | using namespace std; |
---|
17 | |
---|
18 | /* typedef struct */ |
---|
19 | /* { */ |
---|
20 | /* float xx, xxp, begamx,yy,yyp,begamy,z, begamz,phi,wz; */ |
---|
21 | /* float phi0, ksi1,ksi2,ksi3; */ |
---|
22 | /* int ne,np,ngood,npart; */ |
---|
23 | |
---|
24 | /* int readFromParmelaFile(FILE* fp) */ |
---|
25 | /* { */ |
---|
26 | /* return fscanf(fp, " %e %e %e %e %e %e %e %e %e %e %d %d %d %d %e %e %e %e \n", &xx, &xxp, &begamx,&yy,&yyp,&begamy,&z, &begamz,&phi,&wz,&ne,&np,&ngood,&npart,&phi0, &ksi1,&ksi2,&ksi3); */ |
---|
27 | /* } */ |
---|
28 | /* void imprim() */ |
---|
29 | /* { */ |
---|
30 | /* printf( " %e %e %e %e %e %e %e %e %e %e %d %d %d, %d %e %e %e %e \n", xx, xxp, begamx,yy,yyp,begamy,z, begamz,phi,wz,ne,np,ngood,npart,phi0, ksi1,ksi2,ksi3); */ |
---|
31 | /* } */ |
---|
32 | /* } parmelaParticle; */ |
---|
33 | |
---|
34 | |
---|
35 | |
---|
36 | class particleBeam |
---|
37 | { |
---|
38 | |
---|
39 | bool particleRepresentationOk_; |
---|
40 | bool momentRepresentationOk_; |
---|
41 | |
---|
42 | bareParticle referenceParticle_; |
---|
43 | |
---|
44 | vector<bareParticle> goodPartic_; |
---|
45 | |
---|
46 | beam2Moments rij_; |
---|
47 | |
---|
48 | |
---|
49 | vector<double> centroid_; |
---|
50 | double P0Transport_; |
---|
51 | |
---|
52 | |
---|
53 | |
---|
54 | |
---|
55 | void impressionDesMoments() const; |
---|
56 | void razDesMoments(); |
---|
57 | |
---|
58 | |
---|
59 | public: |
---|
60 | |
---|
61 | particleBeam(); |
---|
62 | |
---|
63 | virtual ~particleBeam() {;} |
---|
64 | |
---|
65 | // bool setFromParmela(string workingDir,unsigned numeroElement,double referencefrequency); |
---|
66 | void buildMomentRepresentation(); |
---|
67 | |
---|
68 | |
---|
69 | void clear(); |
---|
70 | |
---|
71 | int getNbParticles() const; |
---|
72 | |
---|
73 | const beam2Moments& getTransportMoments() const; |
---|
74 | double getSigmaTransportij(unsigned i, unsigned j); |
---|
75 | double getUnnormalizedEmittanceX(); |
---|
76 | double getP0Transport() const; |
---|
77 | bool particleRepresentationOk() const; |
---|
78 | bool momentRepresentationOk() const; |
---|
79 | |
---|
80 | |
---|
81 | void addParticle( bareParticle p); |
---|
82 | |
---|
83 | |
---|
84 | |
---|
85 | const vector<bareParticle>& getParticleVector() const; |
---|
86 | |
---|
87 | vector<bareParticle>& getParticleVector(); |
---|
88 | |
---|
89 | double getXmaxRms(); |
---|
90 | |
---|
91 | void getVariance(double& varx, double& vary, double& varz) const; |
---|
92 | |
---|
93 | void set2Moments(beam2Moments& moments); |
---|
94 | void setWithParticles(vector<double>& centroid, bareParticle& referencePart, vector<bareParticle>& particles); |
---|
95 | void printAllXYZ() const; |
---|
96 | |
---|
97 | |
---|
98 | void Zrange(double& zmin, double& zmax) const; |
---|
99 | |
---|
100 | void donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor); |
---|
101 | |
---|
102 | |
---|
103 | virtual string FileOutputFlow() const; |
---|
104 | |
---|
105 | |
---|
106 | virtual bool FileInput(ifstream& ifs); |
---|
107 | |
---|
108 | void histogramme(vector<double>&xcor,vector<int>& hist,int& cnts); |
---|
109 | }; |
---|
110 | |
---|
111 | |
---|
112 | #endif |
---|