Particle.h

Ivan Muzalevsky, 02/26/2018 09:35 AM

Download (5.31 KB)

 
1
//
2
//
3
// This class enables you to set  mass and impulse of particle,
4
// change values and get them back
5
//
6

    
7
#ifndef __PARTICLE_H__
8
#define __PARTICLE_H__
9
#include "TLorentzVector.h"
10
#include <iostream>
11
#include "TMath.h"
12
#include "TString.h"
13
#include "TTree.h"
14
#include "TH1I.h"
15
#include "TF1.h"
16
#include "../Utilities/ConfigDictionary.h"
17

    
18
using std::cout;
19
using std::endl;
20

    
21
using TMath::Sqrt;
22
using TMath::Power;
23

    
24
///////////////////////////////////////////////////////////////////////////////
25
// ExcitationState - minor class helpful to hold information
26
// of excited state of particle in one place.
27
// It consists of four data fields:
28
// fMean - mean value of energy state
29
// fWidth - width of energy state
30
// fShape - type of function modelling state shape
31
// fStrength - unitless, not normalized number telling
32
// how probable comparing to other this state is.
33
//////////////////////////////////////////////////////////////////////////////
34

    
35
class ExcitationState {
36
        //Excitation state class represents single distribution
37
        //of mass of the excited particle.
38
        //Implemented only standard, most useful functions.
39

    
40
public:
41
        ExcitationState();
42
        ExcitationState(Double_t mean, Double_t width, TString shape,
43
                        Int_t strength);
44
        TString CreateConfigString();
45
        int ReadConfigString(TString cs);
46
        Double_t GetMean(){return fMean;};
47
        Double_t GetWidth(){return fWidth;};
48
        TString GetShape(){return fShape;};
49
        Int_t GetStrength(){return fStrength;};
50
private:
51
        Double_t fMean;
52
        Double_t fWidth;
53
        TString fShape;
54
        Int_t fStrength;
55
};
56

    
57
class Particle: public TNamed {
58

    
59
private:
60

    
61
        //Particle owns excitation states array:
62
        std::vector<ExcitationState> fExcitationStates;                //!array of excitation states of particle
63

    
64
        //This static field is used to count created particles instances.
65
        //With that we can make sure everyone has it's own unique name based on
66
        //string representation of its number. Most useful in Gui.
67
        static Int_t numberOfParticles;                //number of all created particles
68

    
69
        Double_t fMass; //rest-mass
70
        Double_t fGroundStateMass;        //it is necessary for excited states
71
        TLorentzVector fImpulse;        //Lorentz four-vector of momentum
72

    
73
        //Z & A numbers
74
        Int_t fZ;        //Z num. default 0
75
        Int_t fA;        //A num. default 0
76
        Bool_t fObservable;                //whether particle can be registered
77
        // TString fName;
78

    
79
        //mass spectrum
80
        std::vector<TF1*> fState;        //!
81
        TH1I fStatesWeigths;                        //!
82

    
83
        void CreateStatesWeigthsHist();
84

    
85
// Checks energy conservation
86
        Bool_t CheckEnergyConservation();
87
// Kinetic energy function
88
        Double_t CalcT(Double_t m, Double_t px, Double_t py, Double_t pz);
89
// Impulse function
90
        Double_t CalcP(Double_t m, Double_t T);
91

    
92
public:
93
        Particle();
94
        Particle(const char *name, Double_t mass, Int_t A, Int_t Z, Bool_t obs);
95
        Particle(TString cs);
96
        virtual ~Particle();
97
        ClassDef(Particle, 1);
98

    
99
        //Excitation states:
100
        void AddExcitationState(ExcitationState exstate);
101
        void ClearExcitationStates();
102
        Int_t GetNumberOfExStates();
103
        ExcitationState GetExcitationState(Int_t index);
104
        //mass spectrum
105
        void CreateStateMassFunctions();
106
        void GenerateMass();
107
        void DrawWeigths();
108
        void DrawMassDistribution(Int_t i, Option_t *option = "");
109
//  Particle(const Particle &) {};
110

    
111

    
112

    
113
        // Set mass and impulse of particle at zero value
114
        void Reset();
115
        int CopyValues(Particle * other);
116

    
117
        void SetMPxPyPz(Double_t m, Double_t px, Double_t py, Double_t pz);
118
        void SetMTNxNyNz(Double_t m, Double_t T, Double_t nx, Double_t ny,
119
                        Double_t nz);
120
        // Set mass, kinetic energy and direction vector (Nx,Ny,Nz)
121
        void SetMTDir(Double_t m, Double_t T, TVector3 dir);
122
        //        void SetMass(Double_t mass);
123
        void SetE(Double_t E);
124

    
125
        // Cartesian x coordinate of impulse
126
        void SetPx(Double_t px);
127
        // Cartesian y coordinate of impulse
128
        void SetPy(Double_t py);
129
        // Cartesian z coordinate of impulse
130
        void SetPz(Double_t pz);
131

    
132
        void SetObservable(Bool_t obs);
133
        void SetMass(Double_t mass);
134
        void SetP(TVector3 P);
135
        void SetT(Double_t T);
136
        // void SetPhiTheta(Double_t phi, Double_t theta);
137
        void SetTPhiTheta(Double_t T, Double_t phi, Double_t theta);
138
        void BoostTransform(TVector3 beta);
139
        void SetImpulse(TLorentzVector *P);
140

    
141

    
142

    
143
        // Get rest-mass value
144
        Double_t GetM() { return fMass; };
145
        Double_t GetMgs() { return fGroundStateMass; };
146
        // Get energy value
147
        Double_t GetE() { return fImpulse.Energy(); };
148
        // Get value of x coordinate of impulse
149
        Double_t GetPx() { return fImpulse.Px(); };
150
        // Get value of y coordinate of impulse
151
        Double_t GetPy() { return fImpulse.Py(); };
152
        // Get value of z coordinate of impulse
153
        Double_t GetPz() { return fImpulse.Pz(); };
154
        // Get value of radial distance of impulse
155
        Double_t GetP() { return fImpulse.Rho(); };
156
        // Get value of azimuthal angle of impulse
157
        Double_t GetPhi() { return fImpulse.Phi(); };
158
        // Get value of polar angle of impulse
159
        Double_t GetTheta() { return fImpulse.Theta(); };
160

    
161
        //whether object is observable or not
162
        Bool_t IsObservable();
163
        //get kinetic energy
164
        Double_t GetT() { return fImpulse.E() - fMass; };
165

    
166
        //Get vector beta
167
        TVector3 GetBoost();
168

    
169
        //Get impulse components
170
        TLorentzVector Get4Vector() {
171
                return fImpulse;
172
        }
173

    
174

    
175
        //Set A & Z of particle
176
        void SetAZ(Int_t A, Int_t Z) {
177
                fA = A;
178
                fZ = Z;
179
        };
180
        void SetA(Int_t A) { fA = A; };
181
        void SetZ(Int_t Z) { fZ = Z; };
182

    
183
        TString CreateConfigString();
184
        void ReadConfigString(TString);
185

    
186
        //Get A number
187
        Int_t GetA() { return fA; };
188
        //Get Z number
189
        Int_t GetZ() { return fZ; };
190
        Double_t CalcE();
191

    
192
        virtual void Print(Option_t * option=0);
193

    
194
};
195

    
196
#endif