CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
RadialInterval Class Reference

#include <RadialInterval.h>

Public Member Functions

void addInterval (double, double)
 
void compute ()
 
unsigned getNumberOfSpots (unsigned i) const
 Number of spots in a given interval. More...
 
double getSpotEnergy (unsigned i) const
 Spot energy in a given interval. More...
 
double getUmax (unsigned i) const
 Upper limit of the argument in the radius generator. More...
 
double getUmin (unsigned i) const
 Lower limit of the argument in the radius generator. More...
 
unsigned nIntervals () const
 Number of intervals. More...
 
 RadialInterval (double RC, unsigned nSpots, double energy, const RandomEngineAndDistribution *engine)
 Standard constructor Rc: mean Radius. More...
 
 ~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 RandomEngineAndDistributionrandom
 
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 12 of file RadialInterval.h.

Constructor & Destructor Documentation

◆ RadialInterval()

RadialInterval::RadialInterval ( double  RC,
unsigned  nSpots,
double  energy,
const RandomEngineAndDistribution engine 
)

Standard constructor Rc: mean Radius.

Definition at line 7 of file RadialInterval.cc.

8  : theR(RC), theNumberOfSpots(nSpots), theSpotEnergy(energy), random(engine) {
9  currentRad = 0.;
11  currentUlim = 0.;
12  nInter = 0;
13 }

References currentEnergyFraction, currentRad, currentUlim, and nInter.

◆ ~RadialInterval()

RadialInterval::~RadialInterval ( )
inline

Definition at line 16 of file RadialInterval.h.

16 { ; }

Member Function Documentation

◆ addInterval()

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 15 of file RadialInterval.cc.

15  {
16  double radiussq = radius * radius;
17  double enFrac = energyFractionInRadius(radius);
18  if (radius > 10)
19  enFrac = 1.;
20  double energyFrac = enFrac - currentEnergyFraction;
21  currentEnergyFraction = enFrac;
22  // std::cout << " Rad " << nInter << " Energy frac " << energyFrac << std::endl;
23 
24  // Calculates the number of spots. Add binomial fluctuations
25  double dspot =
26  random->gaussShoot(theNumberOfSpots * energyFrac, sqrt(energyFrac * (1. - energyFrac) * theNumberOfSpots));
27  // std::cout << " Normal : " << theNumberOfSpots*energyFrac << " "<< dspot << std::endl;
28  unsigned nspot = (unsigned)(dspot * spotf + 0.5);
29  // if(nspot<100)
30  // {
31  // spotf=1.;
32  // nspot=(unsigned)(theNumberOfSpots*energyFrac+0.5);
33  // }
34 
35  dspotsunscaled.push_back(dspot);
36  spotfraction.push_back(spotf);
37 
38  double spotEnergy = theSpotEnergy / spotf;
39  // std::cout << " The number of spots " << theNumberOfSpots << " " << nspot << std::endl;
40 
41  // This is not correct for the last interval, but will be overriden later
42  nspots.push_back(nspot);
43  spotE.push_back(spotEnergy);
44  // computes the limits
45  double umax = radiussq / (radiussq + theR * theR);
46  if (radius > 10) {
47  umax = 1.;
48  }
49 
50  // Stores the limits
51  uMax.push_back(umax);
52  uMin.push_back(currentUlim);
53  currentUlim = umax;
54 
55  // Stores the energy
56  // std::cout << " SpotE " << theSpotEnergy<< " " << spotf << " " << theSpotEnergy/spotf<< std::endl;
57 
58  ++nInter;
59 }

References currentEnergyFraction, currentUlim, dspotsunscaled, energyFractionInRadius(), RandomEngineAndDistribution::gaussShoot(), nInter, nspots, CosmicsPD_Skims::radius, random, spotE, spotfraction, mathSSE::sqrt(), theNumberOfSpots, theR, theSpotEnergy, uMax, and uMin.

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

◆ compute()

void RadialInterval::compute ( )

Most of the calculation are made in addInterval but the normal number of spots has to be set

Definition at line 66 of file RadialInterval.cc.

66  {
67  // std::cout << " The number of Spots " << theNumberOfSpots << std::endl;
68  // std::cout << " Size : " << nInter << " " << nspots.size() << " " << dspotsunscaled.size() << std::endl;
69  double ntotspots = 0.;
70  for (unsigned irad = 0; irad < nInter - 1; ++irad) {
71  ntotspots += dspotsunscaled[irad];
72  // std::cout << " In the loop " << ntotspots << std::endl;
73  }
74 
75  // This can happen (fluctuations)
76  if (ntotspots > theNumberOfSpots)
77  ntotspots = (double)theNumberOfSpots;
78  // std::cout << " Sous-total " << ntotspots << std::endl;
79  dspotsunscaled[nInter - 1] = (double)theNumberOfSpots - ntotspots;
80 
81  nspots[nInter - 1] = (unsigned)(dspotsunscaled[nInter - 1] * spotfraction[nInter - 1] + 0.5);
82  // std::cout << " Nlast " << nspots[nInter-1] << std::endl;
83 }

References dspotsunscaled, nInter, nspots, spotfraction, and theNumberOfSpots.

Referenced by EMShower::compute().

◆ energyFractionInRadius()

double RadialInterval::energyFractionInRadius ( double  rm)
private

Definition at line 61 of file RadialInterval.cc.

61  {
62  double rm2 = rm * rm;
63  return (rm2 / (rm2 + theR * theR));
64 }

References submit::rm, and theR.

Referenced by addInterval().

◆ getNumberOfSpots()

unsigned RadialInterval::getNumberOfSpots ( unsigned  i) const
inline

Number of spots in a given interval.

Definition at line 32 of file RadialInterval.h.

32  {
33  // std::cout << " getNumberOfSpots " << i << " " << nspots.size() << std::endl;
34  return nspots[i];
35  }

References mps_fire::i, and nspots.

Referenced by EMShower::compute().

◆ getSpotEnergy()

double RadialInterval::getSpotEnergy ( unsigned  i) const
inline

Spot energy in a given interval.

Definition at line 27 of file RadialInterval.h.

27  {
28  // std::cout << " getSpotEnergy " << i << " " << spotE.size() << std::endl;
29  return spotE[i];
30  }

References mps_fire::i, and spotE.

Referenced by EMShower::compute().

◆ getUmax()

double RadialInterval::getUmax ( unsigned  i) const
inline

Upper limit of the argument in the radius generator.

Definition at line 42 of file RadialInterval.h.

42  {
43  // std::cout << " getUmax " << i << " " << uMax.size() << std::endl;
44  return uMax[i];
45  }

References mps_fire::i, and uMax.

Referenced by EMShower::compute().

◆ getUmin()

double RadialInterval::getUmin ( unsigned  i) const
inline

Lower limit of the argument in the radius generator.

Definition at line 37 of file RadialInterval.h.

37  {
38  // std::cout << " getUmin " << i << " " << uMin.size() << std::endl;
39  return uMin[i];
40  }

References mps_fire::i, and uMin.

Referenced by EMShower::compute().

◆ nIntervals()

unsigned RadialInterval::nIntervals ( ) const
inline

Number of intervals.

Definition at line 25 of file RadialInterval.h.

25 { return nInter; }

References nInter.

Referenced by EMShower::compute().

Member Data Documentation

◆ currentEnergyFraction

double RadialInterval::currentEnergyFraction
private

Definition at line 49 of file RadialInterval.h.

Referenced by addInterval(), and RadialInterval().

◆ currentRad

double RadialInterval::currentRad
private

Definition at line 48 of file RadialInterval.h.

Referenced by RadialInterval().

◆ currentUlim

double RadialInterval::currentUlim
private

Definition at line 50 of file RadialInterval.h.

Referenced by addInterval(), and RadialInterval().

◆ dspotsunscaled

std::vector<double> RadialInterval::dspotsunscaled
private

Definition at line 60 of file RadialInterval.h.

Referenced by addInterval(), and compute().

◆ nInter

unsigned RadialInterval::nInter
private

Definition at line 54 of file RadialInterval.h.

Referenced by addInterval(), compute(), nIntervals(), and RadialInterval().

◆ nspots

std::vector<unsigned> RadialInterval::nspots
private

Definition at line 58 of file RadialInterval.h.

Referenced by addInterval(), compute(), and getNumberOfSpots().

◆ random

const RandomEngineAndDistribution* RadialInterval::random
private

Definition at line 68 of file RadialInterval.h.

Referenced by addInterval().

◆ spotE

std::vector<double> RadialInterval::spotE
private

Definition at line 59 of file RadialInterval.h.

Referenced by addInterval(), and getSpotEnergy().

◆ spotfraction

std::vector<double> RadialInterval::spotfraction
private

Definition at line 61 of file RadialInterval.h.

Referenced by addInterval(), and compute().

◆ theNumberOfSpots

unsigned RadialInterval::theNumberOfSpots
private

Definition at line 52 of file RadialInterval.h.

Referenced by addInterval(), and compute().

◆ theR

double RadialInterval::theR
private

Definition at line 51 of file RadialInterval.h.

Referenced by addInterval(), and energyFractionInRadius().

◆ theSpotEnergy

double RadialInterval::theSpotEnergy
private

Definition at line 53 of file RadialInterval.h.

Referenced by addInterval().

◆ uMax

std::vector<double> RadialInterval::uMax
private

Definition at line 57 of file RadialInterval.h.

Referenced by addInterval(), and getUmax().

◆ uMin

std::vector<double> RadialInterval::uMin
private

Definition at line 56 of file RadialInterval.h.

Referenced by addInterval(), and getUmin().

RadialInterval::theSpotEnergy
double theSpotEnergy
Definition: RadialInterval.h:53
mps_fire.i
i
Definition: mps_fire.py:428
RadialInterval::currentEnergyFraction
double currentEnergyFraction
Definition: RadialInterval.h:49
RadialInterval::uMin
std::vector< double > uMin
Definition: RadialInterval.h:56
RadialInterval::nspots
std::vector< unsigned > nspots
Definition: RadialInterval.h:58
RadialInterval::energyFractionInRadius
double energyFractionInRadius(double rm)
Definition: RadialInterval.cc:61
RadialInterval::uMax
std::vector< double > uMax
Definition: RadialInterval.h:57
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
submit.rm
rm
Definition: submit.py:77
RadialInterval::theR
double theR
Definition: RadialInterval.h:51
RadialInterval::random
const RandomEngineAndDistribution * random
Definition: RadialInterval.h:68
RadialInterval::theNumberOfSpots
unsigned theNumberOfSpots
Definition: RadialInterval.h:52
RadialInterval::spotE
std::vector< double > spotE
Definition: RadialInterval.h:59
RadialInterval::nInter
unsigned nInter
Definition: RadialInterval.h:54
RadialInterval::currentUlim
double currentUlim
Definition: RadialInterval.h:50
RadialInterval::spotfraction
std::vector< double > spotfraction
Definition: RadialInterval.h:61
RadialInterval::dspotsunscaled
std::vector< double > dspotsunscaled
Definition: RadialInterval.h:60
RadialInterval::currentRad
double currentRad
Definition: RadialInterval.h:48
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
RandomEngineAndDistribution::gaussShoot
double gaussShoot(double mean=0.0, double sigma=1.0) const
Definition: RandomEngineAndDistribution.h:29