Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-27 07:03:38

0001 
0002 /*
0003     <one line to give the program's name and a brief idea of what it does.>
0004     Copyright (C) <year>  <name of author>
0005 
0006     This program is free software: you can redistribute it and/or modify
0007     it under the terms of the GNU General Public License as published by
0008     the Free Software Foundation, either version 3 of the License, or
0009     (at your option) any later version.
0010 
0011     This program is distributed in the hope that it will be useful,
0012     but WITHOUT ANY WARRANTY; without even the implied warranty of
0013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014     GNU General Public License for more details.
0015 
0016     You should have received a copy of the GNU General Public License
0017     along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018 
0019 */
0020 
0021 #ifndef SPECTRUM_H
0022 #define SPECTRUM_H
0023 
0024 #include <vector>
0025 #include "randomgenerator.h"
0026 class beamBeamSystem;
0027 //class randomGenerator;
0028 
0029 class spectrum
0030 {
0031 public:
0032 
0033     /** Spectrum must be constructed with beam-beam system, default constructor disallowed */
0034     spectrum(const randomGenerator &randy, beamBeamSystem *bbs);
0035 
0036     /**
0037     * Generate a table of photon energy probabilities
0038     * Use NK+1 logarithmic steps between Et_min and Eg_max
0039     */
0040     int generateKsingle();
0041 
0042     /**
0043     * Generate a 2-D table of photon energy probabilities
0044     * Use NK+1 x NK+1 logarithmic steps between Et_min and Eg_max
0045     */
0046     int generateKdouble();
0047 
0048     /**
0049     * Get the energy of a single gamma
0050     * @return energy of the gamma
0051     */
0052     double drawKsingle();
0053 
0054     /**
0055     * Get the energy of a single gamma
0056     * @param egamma1 variable passed by reference to get the energy of the frst gamma
0057     * @param egamma2 variable passed by reference to get the energy of the second gamma
0058     * @return energy of the gamma
0059     */
0060     void drawKdouble(float &egamma1, float &egamma2);
0061 
0062     /** Set the beam beam system */
0063     void setBeamBeamSystem(beamBeamSystem *bbs) {
0064         _beamBeamSystem = bbs;
0065     }
0066 
0067     /** Set the minimum gamma energy */
0068     void setMinGammaEnergy(double energy) { _eGammaMin = energy; }
0069 
0070     /** Set the maximum gamma energy */
0071     void setMaxGammaEnergy(double energy) { _eGammaMax = energy; }
0072 
0073     /** Set minimum impact parameter */
0074     void setBmin(double bmin) { _bMin = bmin; }
0075 
0076     /** Set maximum impact parameter */
0077     void setBmax(double bmax) { _bMax = bmax; }
0078     
0079 protected:
0080 
0081     /** Generate the hadron breakup probability table */
0082     virtual bool generateBreakupProbabilities();
0083 
0084     /** Needs some explanation */
0085     virtual double getSigma(double /*egamma*/) const {
0086         return 1.05;
0087     }
0088     
0089     virtual double getTransformedNofe(double egamma, double b);
0090     
0091     /** Minimum impact parameter */
0092     double _bMin;
0093 
0094     /** Maximum impact parameter */
0095     double _bMax;
0096     
0097     /** Number of bins in impact parameter */
0098     int _nBbins;
0099     
0100     /** Vector containing the probability of breakup */
0101     std::vector<double> _probOfBreakup;
0102     
0103     /** Beam beam system */
0104     beamBeamSystem *_beamBeamSystem;
0105 
0106 private:
0107     double getFnSingle(double egamma) const;
0108 
0109     double getFnDouble(double egamma1, double egamma2) const;
0110 
0111     /** NK */
0112     int _nK;
0113 
0114     /** Contains the 1 photon probabilities */
0115     std::vector<double> _fnSingle;
0116 
0117     /** Contains the 2 photon probabilities */
0118     std::vector<std::vector<double> > _fnDouble;
0119 
0120     /** Contains the cumulative distribution */
0121     std::vector<double> _fnSingleCumulative;
0122 
0123     /** Contains the cumulative distribution */
0124     std::vector<std::vector<double> > _fnDoubleCumulative;
0125 
0126     /**  */
0127     std::vector<double> _fnDoubleInt;
0128 
0129     /** */
0130     std::vector<double> _fnDoubleIntCumulative;
0131     
0132     /** Vecotr of gamma energies */
0133     std::vector<double> _eGamma;
0134 
0135     /** Min gamma energy */
0136     double _eGammaMin;
0137 
0138     /** Max gamma energy */
0139     double _eGammaMax;
0140 
0141     /** Z of target */
0142     int _zTarget;
0143 
0144     /** A of target */
0145     int _aTarget;
0146 
0147     /** Hadron breakup probability is calculated */
0148     bool _hadBreakProbCalculated;
0149 
0150     /** random number generator **/
0151     randomGenerator _randy;
0152 
0153     /** Default constructed disallowed (not implemented) */
0154     spectrum();
0155 
0156 };
0157 
0158 #endif // SPECTRUM_H