#include <RadialInterval.h>
Public Member Functions | |
void | addInterval (double, double) |
void | compute () |
unsigned | getNumberOfSpots (unsigned i) const |
Number of spots in a given interval. | |
double | getSpotEnergy (unsigned i) const |
Spot energy in a given interval. | |
double | getUmax (unsigned i) const |
Upper limit of the argument in the radius generator. | |
double | getUmin (unsigned i) const |
Lower limit of the argument in the radius generator. | |
unsigned | nIntervals () const |
Number of intervals. | |
RadialInterval (double RC, unsigned nSpots, double energy, const RandomEngine *engine) | |
Standard constructor Rc: mean Radius. | |
~RadialInterval () | |
Private Member Functions | |
double | energyFractionInRadius (double rm) |
Private Attributes | |
double | currentEnergyFraction |
double | currentRad |
double | currentUlim |
std::vector< double > | dspotsunscaled |
unsigned | nInter |
std::vector< unsigned > | nspots |
const RandomEngine * | random |
std::vector< double > | spotE |
std::vector< double > | spotfraction |
unsigned | theNumberOfSpots |
double | theR |
double | theSpotEnergy |
std::vector< double > | uMax |
std::vector< double > | uMin |
Definition at line 13 of file RadialInterval.h.
RadialInterval::RadialInterval | ( | double | RC, |
unsigned | nSpots, | ||
double | energy, | ||
const RandomEngine * | engine | ||
) |
Standard constructor Rc: mean Radius.
Definition at line 7 of file RadialInterval.cc.
References currentEnergyFraction, currentRad, currentUlim, and nInter.
: theR(RC),theNumberOfSpots(nSpots),theSpotEnergy(energy),random(engine) { currentRad=0.; currentEnergyFraction=0.; currentUlim=0.; nInter=0; }
RadialInterval::~RadialInterval | ( | ) | [inline] |
Definition at line 19 of file RadialInterval.h.
{;}
void RadialInterval::addInterval | ( | double | radius, |
double | spotf | ||
) |
Add an interval : first argument is the radius, the second is the fraction of spots in this interval R>10 <-> infinity
Definition at line 19 of file RadialInterval.cc.
References currentEnergyFraction, currentUlim, dspotsunscaled, energyFractionInRadius(), RandomEngine::gaussShoot(), nInter, nspots, CosmicsPD_Skims::radius, random, spotE, spotfraction, mathSSE::sqrt(), theNumberOfSpots, theR, theSpotEnergy, uMax, and uMin.
Referenced by EMShower::compute(), and EMShower::setIntervals().
{ double radiussq=radius*radius; double enFrac=energyFractionInRadius(radius); if(radius>10) enFrac=1.; double energyFrac=enFrac-currentEnergyFraction; currentEnergyFraction=enFrac; // std::cout << " Rad " << nInter << " Energy frac " << energyFrac << std::endl; // Calculates the number of spots. Add binomial fluctuations double dspot = random->gaussShoot(theNumberOfSpots*energyFrac, sqrt(energyFrac*(1.-energyFrac)*theNumberOfSpots)); // std::cout << " Normal : " << theNumberOfSpots*energyFrac << " "<< dspot << std::endl; unsigned nspot=(unsigned)(dspot*spotf+0.5); // if(nspot<100) // { // spotf=1.; // nspot=(unsigned)(theNumberOfSpots*energyFrac+0.5); // } dspotsunscaled.push_back(dspot); spotfraction.push_back(spotf); double spotEnergy=theSpotEnergy/spotf; // std::cout << " The number of spots " << theNumberOfSpots << " " << nspot << std::endl; // This is not correct for the last interval, but will be overriden later nspots.push_back(nspot); spotE.push_back(spotEnergy); // computes the limits double umax = radiussq/(radiussq+theR*theR); if(radius>10) { umax=1.; } // Stores the limits uMax.push_back(umax); uMin.push_back(currentUlim); currentUlim=umax; // Stores the energy // std::cout << " SpotE " << theSpotEnergy<< " " << spotf << " " << theSpotEnergy/spotf<< std::endl; ++nInter; }
void RadialInterval::compute | ( | ) |
Most of the calculation are made in addInterval but the normal number of spots has to be set
Definition at line 72 of file RadialInterval.cc.
References dspotsunscaled, nInter, nspots, spotfraction, and theNumberOfSpots.
Referenced by EMShower::compute().
{ // std::cout << " The number of Spots " << theNumberOfSpots << std::endl; // std::cout << " Size : " << nInter << " " << nspots.size() << " " << dspotsunscaled.size() << std::endl; double ntotspots=0.; for(unsigned irad=0;irad<nInter-1;++irad) { ntotspots+=dspotsunscaled[irad]; // std::cout << " In the loop " << ntotspots << std::endl; } // This can happen (fluctuations) if(ntotspots>theNumberOfSpots) ntotspots=(double)theNumberOfSpots; // std::cout << " Sous-total " << ntotspots << std::endl; dspotsunscaled[nInter-1]=(double)theNumberOfSpots-ntotspots; nspots[nInter-1]=(unsigned)(dspotsunscaled[nInter-1]*spotfraction[nInter-1]+0.5); // std::cout << " Nlast " << nspots[nInter-1] << std::endl; }
double RadialInterval::energyFractionInRadius | ( | double | rm | ) | [private] |
Definition at line 66 of file RadialInterval.cc.
References submit::rm, and theR.
Referenced by addInterval().
unsigned RadialInterval::getNumberOfSpots | ( | unsigned | i | ) | const [inline] |
Number of spots in a given interval.
Definition at line 34 of file RadialInterval.h.
Referenced by EMShower::compute().
double RadialInterval::getSpotEnergy | ( | unsigned | i | ) | const [inline] |
Spot energy in a given interval.
Definition at line 30 of file RadialInterval.h.
Referenced by EMShower::compute().
double RadialInterval::getUmax | ( | unsigned | i | ) | const [inline] |
Upper limit of the argument in the radius generator.
Definition at line 44 of file RadialInterval.h.
Referenced by EMShower::compute().
double RadialInterval::getUmin | ( | unsigned | i | ) | const [inline] |
Lower limit of the argument in the radius generator.
Definition at line 39 of file RadialInterval.h.
Referenced by EMShower::compute().
unsigned RadialInterval::nIntervals | ( | ) | const [inline] |
Number of intervals.
Definition at line 28 of file RadialInterval.h.
References nInter.
Referenced by EMShower::compute().
{ return nInter;}
double RadialInterval::currentEnergyFraction [private] |
Definition at line 51 of file RadialInterval.h.
Referenced by addInterval(), and RadialInterval().
double RadialInterval::currentRad [private] |
Definition at line 50 of file RadialInterval.h.
Referenced by RadialInterval().
double RadialInterval::currentUlim [private] |
Definition at line 52 of file RadialInterval.h.
Referenced by addInterval(), and RadialInterval().
std::vector<double> RadialInterval::dspotsunscaled [private] |
Definition at line 62 of file RadialInterval.h.
Referenced by addInterval(), and compute().
unsigned RadialInterval::nInter [private] |
Definition at line 56 of file RadialInterval.h.
Referenced by addInterval(), compute(), nIntervals(), and RadialInterval().
std::vector<unsigned> RadialInterval::nspots [private] |
Definition at line 60 of file RadialInterval.h.
Referenced by addInterval(), compute(), and getNumberOfSpots().
const RandomEngine* RadialInterval::random [private] |
Definition at line 70 of file RadialInterval.h.
Referenced by addInterval().
std::vector<double> RadialInterval::spotE [private] |
Definition at line 61 of file RadialInterval.h.
Referenced by addInterval(), and getSpotEnergy().
std::vector<double> RadialInterval::spotfraction [private] |
Definition at line 63 of file RadialInterval.h.
Referenced by addInterval(), and compute().
unsigned RadialInterval::theNumberOfSpots [private] |
Definition at line 54 of file RadialInterval.h.
Referenced by addInterval(), and compute().
double RadialInterval::theR [private] |
Definition at line 53 of file RadialInterval.h.
Referenced by addInterval(), and energyFractionInRadius().
double RadialInterval::theSpotEnergy [private] |
Definition at line 55 of file RadialInterval.h.
Referenced by addInterval().
std::vector<double> RadialInterval::uMax [private] |
Definition at line 59 of file RadialInterval.h.
Referenced by addInterval(), and getUmax().
std::vector<double> RadialInterval::uMin [private] |
Definition at line 58 of file RadialInterval.h.
Referenced by addInterval(), and getUmin().