]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STARLIGHT/starlight/include/spectrum.h
STARLIGHT code and interface
[u/mrichter/AliRoot.git] / STARLIGHT / starlight / include / spectrum.h
1
2 /*
3     <one line to give the program's name and a brief idea of what it does.>
4     Copyright (C) <year>  <name of author>
5
6     This program is free software: you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation, either version 3 of the License, or
9     (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 #ifndef SPECTRUM_H
22 #define SPECTRUM_H
23
24 #include <vector>
25 class beamBeamSystem;
26 class randomGenerator;
27
28 class spectrum
29 {
30 public:
31
32     /** Spectrum must be constructed with beam-beam system, default constructor disallowed */
33     spectrum(beamBeamSystem *bbs);
34
35     /**
36     * Generate a table of photon energy probabilities
37     * Use NK+1 logarithmic steps between Et_min and Eg_max
38     */
39     int generateKsingle();
40
41     /**
42     * Generate a 2-D table of photon energy probabilities
43     * Use NK+1 x NK+1 logarithmic steps between Et_min and Eg_max
44     */
45     int generateKdouble();
46
47     /**
48     * Get the energy of a single gamma
49     * @return energy of the gamma
50     */
51     double drawKsingle();
52
53     /**
54     * Get the energy of a single gamma
55     * @param egamma1 variable passed by reference to get the energy of the frst gamma
56     * @param egamma2 variable passed by reference to get the energy of the second gamma
57     * @return energy of the gamma
58     */
59     void drawKdouble(float &egamma1, float &egamma2);
60
61     /** Set the beam beam system */
62     void setBeamBeamSystem(beamBeamSystem *bbs) {
63         _beamBeamSystem = bbs;
64     }
65
66     /** Set the minimum gamma energy */
67     void setMinGammaEnergy(double energy) { _eGammaMin = energy; }
68
69     /** Set the maximum gamma energy */
70     void setMaxGammaEnergy(double energy) { _eGammaMax = energy; }
71
72     /** Set minimum impact parameter */
73     void setBmin(double bmin) { _bMin = bmin; }
74
75     /** Set maximum impact parameter */
76     void setBmax(double bmax) { _bMax = bmax; }
77     
78 protected:
79
80     /** Generate the hadron breakup probability table */
81     virtual bool generateBreakupProbabilities();
82
83     /** Needs some explanation */
84     virtual double getSigma(double /*egamma*/) const {
85         return 1.05;
86     }
87     
88     virtual double getTransformedNofe(double egamma, double b);
89     
90     /** Minimum impact parameter */
91     double _bMin;
92
93     /** Maximum impact parameter */
94     double _bMax;
95     
96     /** Number of bins in impact parameter */
97     int _nBbins;
98     
99     /** Vector containing the probability of breakup */
100     std::vector<double> _probOfBreakup;
101     
102     /** Beam beam system */
103     beamBeamSystem *_beamBeamSystem;
104
105 private:
106     double getFnSingle(double egamma) const;
107
108     double getFnDouble(double egamma1, double egamma2) const;
109
110     /** NK */
111     int _nK;
112
113     /** Contains the 1 photon probabilities */
114     std::vector<double> _fnSingle;
115
116     /** Contains the 2 photon probabilities */
117     std::vector<std::vector<double> > _fnDouble;
118
119     /** Contains the cumulative distribution */
120     std::vector<double> _fnSingleCumulative;
121
122     /** Contains the cumulative distribution */
123     std::vector<std::vector<double> > _fnDoubleCumulative;
124
125     /**  */
126     std::vector<double> _fnDoubleInt;
127
128     /** */
129     std::vector<double> _fnDoubleIntCumulative;
130     
131     /** Vecotr of gamma energies */
132     std::vector<double> _eGamma;
133
134     /** Min gamma energy */
135     double _eGammaMin;
136
137     /** Max gamma energy */
138     double _eGammaMax;
139
140     /** Z of target */
141     int _zTarget;
142
143     /** A of target */
144     int _aTarget;
145
146     /** Hadron breakup probability is calculated */
147     bool _hadBreakProbCalculated;
148
149     /** Default constructed disallowed (not implemented) */
150     spectrum();
151
152 };
153
154 #endif // SPECTRUM_H