CMS 3D CMS Logo

RadialInterval Class Reference

#include <FastSimulation/ShowerDevelopment/interface/RadialInterval.h>

List of all members.

Public Member Functions

void addInterval (double, double)
 Add an interval : first argument is the radius, the second is the fraction of spots in this interval R>10 <-> infinity.
void compute ()
 Most of the calculation are made in addInterval but the normal number of spots has to be set.
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 RandomEnginerandom
std::vector< double > spotE
std::vector< double > spotfraction
unsigned theNumberOfSpots
double theR
double theSpotEnergy
std::vector< double > uMax
std::vector< double > uMin


Detailed Description

Definition at line 13 of file RadialInterval.h.


Constructor & Destructor Documentation

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.

00009   :
00010   theR(RC),theNumberOfSpots(nSpots),theSpotEnergy(energy),random(engine)
00011 {
00012 
00013   currentRad=0.;
00014   currentEnergyFraction=0.;
00015   currentUlim=0.;
00016   nInter=0;
00017 }

RadialInterval::~RadialInterval (  )  [inline]

Definition at line 19 of file RadialInterval.h.

00019 {;}


Member Function Documentation

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, random, spotE, spotfraction, funct::sqrt(), theNumberOfSpots, theR, theSpotEnergy, uMax, and uMin.

Referenced by EMShower::compute(), and EMShower::setIntervals().

00020 {
00021   double radiussq=radius*radius;
00022   double enFrac=energyFractionInRadius(radius);
00023   if(radius>10) enFrac=1.;
00024   double energyFrac=enFrac-currentEnergyFraction;
00025   currentEnergyFraction=enFrac;
00026   //  std::cout << " Rad " << nInter << " Energy frac " << energyFrac << std::endl;
00027   
00028   // Calculates the number of spots. Add binomial fluctuations
00029   double dspot = random->gaussShoot(theNumberOfSpots*energyFrac,
00030                             sqrt(energyFrac*(1.-energyFrac)*theNumberOfSpots));
00031   //  std::cout << " Normal : " << theNumberOfSpots*energyFrac << " "<< dspot << std::endl;
00032   unsigned nspot=(unsigned)(dspot*spotf+0.5);
00033 //  if(nspot<100) 
00034 //    {
00035 //      spotf=1.;
00036 //      nspot=(unsigned)(theNumberOfSpots*energyFrac+0.5);
00037 //    }
00038   
00039   dspotsunscaled.push_back(dspot);
00040   spotfraction.push_back(spotf);
00041 
00042   double spotEnergy=theSpotEnergy/spotf;
00043   //  std::cout << " The number of spots " << theNumberOfSpots << " " << nspot << std::endl;
00044 
00045   // This is not correct for the last interval, but will be overriden later
00046   nspots.push_back(nspot);
00047   spotE.push_back(spotEnergy);
00048   // computes the limits
00049   double umax = radiussq/(radiussq+theR*theR);
00050   if(radius>10)
00051     {
00052       umax=1.;
00053     }
00054 
00055   // Stores the limits
00056   uMax.push_back(umax);          
00057   uMin.push_back(currentUlim);           
00058   currentUlim=umax;
00059 
00060   // Stores the energy
00061   //  std::cout << " SpotE " << theSpotEnergy<< " " << spotf << " " << theSpotEnergy/spotf<< std::endl;
00062 
00063   ++nInter;
00064 }

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().

00073 {
00074   //  std::cout << " The number of Spots " << theNumberOfSpots << std::endl;
00075   //  std::cout << " Size : " << nInter << " " << nspots.size() << " " << dspotsunscaled.size() << std::endl;
00076   double ntotspots=0.;
00077   for(unsigned irad=0;irad<nInter-1;++irad)
00078     {
00079       ntotspots+=dspotsunscaled[irad];
00080       //    std::cout << " In the loop " << ntotspots << std::endl;
00081     }
00082 
00083   // This can happen (fluctuations)
00084   if(ntotspots>theNumberOfSpots) ntotspots=(double)theNumberOfSpots;
00085   //  std::cout << " Sous-total " << ntotspots << std::endl;
00086   dspotsunscaled[nInter-1]=(double)theNumberOfSpots-ntotspots;
00087   
00088   nspots[nInter-1]=(unsigned)(dspotsunscaled[nInter-1]*spotfraction[nInter-1]+0.5);
00089   //    std::cout << " Nlast " << nspots[nInter-1] << std::endl;
00090 }

double RadialInterval::energyFractionInRadius ( double  rm  )  [private]

Definition at line 66 of file RadialInterval.cc.

References theR.

Referenced by addInterval().

00067 {
00068   double rm2=rm*rm;
00069   return (rm2/(rm2+theR*theR));
00070 }

unsigned RadialInterval::getNumberOfSpots ( unsigned  i  )  const [inline]

Number of spots in a given interval.

Definition at line 34 of file RadialInterval.h.

References nspots.

Referenced by EMShower::compute().

00034                                                      { 
00035     //    std::cout << " getNumberOfSpots " << i << " " << nspots.size() << std::endl;
00036     return nspots[i];
00037   }

double RadialInterval::getSpotEnergy ( unsigned  i  )  const [inline]

Spot energy in a given interval.

Definition at line 30 of file RadialInterval.h.

References spotE.

Referenced by EMShower::compute().

00030                                                 { 
00031     //    std::cout << " getSpotEnergy " << i << " " << spotE.size() << std::endl;
00032     return spotE[i];}

double RadialInterval::getUmax ( unsigned  i  )  const [inline]

Upper limit of the argument in the radius generator.

Definition at line 44 of file RadialInterval.h.

References uMax.

Referenced by EMShower::compute().

00044                                           {
00045     //    std::cout << " getUmax " << i << " " << uMax.size() << std::endl;
00046     return uMax[i];
00047   }

double RadialInterval::getUmin ( unsigned  i  )  const [inline]

Lower limit of the argument in the radius generator.

Definition at line 39 of file RadialInterval.h.

References uMin.

Referenced by EMShower::compute().

00039                                           {
00040     //    std::cout << " getUmin " << i << " " << uMin.size() << std::endl;
00041     return uMin[i];
00042   }

unsigned RadialInterval::nIntervals (  )  const [inline]

Number of intervals.

Definition at line 28 of file RadialInterval.h.

References nInter.

Referenced by EMShower::compute().

00028 { return nInter;}


Member Data Documentation

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().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:30:37 2009 for CMSSW by  doxygen 1.5.4