19 vector<const RawParticle*>*
const myPart,
27 thePreshower(myPresh),
29 myGammaGenerator(
gamma),
49 for (
unsigned int i = 0;
i <
nPart; ++
i) {
59 double theMeanT = myParam->
meanT(lny);
60 double theMeanAlpha = myParam->
meanAlpha(lny);
61 double theMeanLnT = myParam->
meanLnT(lny);
63 double theSigmaLnT = myParam->
sigmaLnT(lny);
68 double rhop =
std::sqrt((1. + theCorrelation) / 2.);
89 aa =
std::exp(theMeanLnAlpha + theSigmaLnAlpha * (z1 * rhop -
z2 *
rhom));
93 T.push_back(
std::exp(theMeanLnT + theSigmaLnT * (z1 * rhop +
z2 *
rhom)));
94 b.push_back((
a[
i] - 1.) /
T[
i]);
129 int first_Ecal_step = 0;
130 int last_Ecal_step = 0;
175 stps = (
int)((radlen + 2.5) / 5.);
179 dt = radlen / (double)stps;
181 first_Ecal_step =
steps.size();
182 for (
int ist = 0; ist < stps; ++ist)
184 last_Ecal_step =
steps.size() - 1;
188 stps =
static_cast<int>(radlen);
192 first_Ecal_step =
steps.size();
193 for (
int ist = 0; ist < stps; ++ist)
198 steps.push_back(stepLast);
200 last_Ecal_step =
steps.size() - 1;
213 if (dtFrontHcal < 30.) {
214 dt = 30. - dtFrontHcal;
223 double ESliceTot = 0.;
224 double MeanDepth = 0.;
230 for (
unsigned iStep = 0; iStep <
nSteps; ++iStep) {
233 double realTotalEnergy = 0;
236 for (
unsigned int i = 0;
i <
nPart; ++
i) {
244 MeanDepth /= ESliceTot;
249 if (realTotalEnergy < 0.001) {
255 if (last_Ecal_step +
offset >= 0)
284 for (
unsigned iStep = 0; iStep <
nSteps; ++iStep) {
322 double tt =
t - 0.5 *
dt;
324 double realTotalEnergy = 0.;
325 for (
unsigned int i = 0;
i <
nPart; ++
i) {
334 bool usePreviousGrid = (realTotalEnergy < 0.001);
340 if (iStep > 2 && realTotalEnergy < 0.000001)
343 if (
ecal && !usePreviousGrid) {
352 bool detailedShowerTail =
false;
354 if (
ecal && !usePreviousGrid) {
359 for (
unsigned int i = 0;
i <
nPart; ++
i) {
366 if (dE *
E[
i] < 0.000001)
387 if (dE *
E[
i] < 0.000001)
427 if (nSo > 0. && nS / nSo < 10.)
457 if (detailedShowerTail)
465 double eSpot = (nS > 0.) ? dE / nS : 0.;
466 double SpotEnergy = eSpot *
E[
i];
476 int nSpot = (
int)(nS + 0.5);
482 double taui =
tt /
Ti[
i];
497 unsigned nSpots_core = (unsigned)(dSpotsCore + 0.5);
498 unsigned nSpots_tail = ((unsigned)nSpot > nSpots_core) ? nSpot - nSpots_core : 0;
500 for (
unsigned icomp = 0; icomp < 2; ++icomp) {
501 double theR = (icomp == 0) ? theRC : theRT;
502 unsigned ncompspots = (icomp == 0) ? nSpots_core : nSpots_tail;
520 for (
unsigned irad = 0; irad < nrad; ++irad) {
527 double umin = radInterval.
getUmin(irad);
528 double umax = radInterval.
getUmax(irad);
532 for (
unsigned ispot = 0; ispot < nradspots; ++ispot) {
534 double ri = theR *
std::sqrt(z3 / (1. - z3));
543 if (detailedShowerTail) {
649 unsigned nvals = myValues.size() / 2;
650 for (
unsigned iv = 0;
iv < nvals; ++
iv) {
657 if (myPresh !=
nullptr) {
670 if (fabs(
b2) < 1.
e-9)
bool addHit(double r, double phi, unsigned layer=0) override
std::vector< const RawParticle * > *const thePart
double getUmin(unsigned i) const
Lower limit of the argument in the radius generator.
std::vector< double > theNumberOfSpots
bool isHom() const
a rough estimate of ECAL resolution sigma/E = resE/sqrt(E)
double meanLnAlpha(double lny) const
void prepareSteps()
Computes the steps before the real compute.
std::vector< double > maximumOfShower
double criticalEnergy() const override
Critical energy in GeV (2.66E-3*(x0*Z/A)^1.1): 8.74E-3 for Standard ECAL.
std::vector< double > aSpot
const HCALProperties * hcalProperties() const
EMShower(RandomEngineAndDistribution const *engine, GammaFunctionGenerator *gamma, EMECALShowerParametrization *const myParam, std::vector< const RawParticle *> *const myPart, EcalHitMaker *const myGrid=nullptr, PreshowerHitMaker *const myPreshower=nullptr, bool bFixedLength=false)
double deposit(double t, double a, double b, double dt)
double ps1TotalX0() const
const RandomEngineAndDistribution * random
const std::vector< double > & getCoreIntervals() const
const HCALProperties * theHCAL
double rC(double tau, double E) const
void setPreshower(PreshowerHitMaker *const myPresh)
set the preshower address
const PreshowerLayer2Properties * layer2Properties() const
double x0DepthOffset() const
get the offset (e.g the number of X0 after which the shower starts)
const ECALProperties * theECAL
void setIntervals(unsigned icomp, RadialInterval &rad)
double meanT(double lny) const
void compute()
Compute the shower longitudinal and lateral development.
std::vector< double > Etot
double mipsPerGeV() const override
Number of Mips/GeV [Default : 41.7 Mips/GeV or 24 MeV/Mips].
unsigned nIntervals() const
Number of intervals.
double hcalTotalX0() const
in the HCAL
bool addHit(double r, double phi, unsigned layer=0) override
add the hit in the HCAL in local coordinates
PreshowerHitMaker * thePreshower
std::vector< std::vector< double > > depositedEnergy
bool addHitDepth(double r, double phi, double depth=-1)
double getSpotEnergy(unsigned i) const
Spot energy in a given interval.
double nSpots(double E) const
double meanAlpha(double lny) const
double ecalTotalX0() const
in the ECAL
bool addHit(double r, double phi, unsigned layer=0) override
double p(double tau, double E) const
HcalHitMaker * theHcalHitMaker
double gam(double x, double a) const
const PreshowerLayer1Properties * layer1Properties() const
std::vector< double > meanDepth
void setSpotEnergy(double e) override
Set the spot energy.
double spotFraction() const
Spot fraction wrt ECAL.
double sigmaLnAlpha(double lny) const
double rT(double tau, double E) const
void setParameters(double a, double b, double xm)
The parameters must be set before shooting.
std::vector< double > photos
double gaussShoot(double mean=0.0, double sigma=1.0) const
const std::vector< double > & getTailIntervals() const
const ECALProperties * ecalProperties() const
double ps2eeTotalX0() const
double mipsPerGeV() const override
Number of Mips/GeV [Default : 59.5 Mips/GeV or 0.7*24 MeV/Mips].
double resE() const
a rough estimate of ECAL resolution sigma/E = resE/sqrt(E)
double meanAlphaSpot(double alpha) const
const PreshowerLayer2Properties * theLayer2
bool getPads(double depth, bool inCm=false)
unsigned int poissonShoot(double mean) const
virtual double lightCollectionEfficiency() const =0
Light Collection efficiency.
const PreshowerLayer1Properties * theLayer1
double shoot(RandomEngineAndDistribution const *) const
double ps2TotalX0() const
total number of X0 in the PS (Layer2).
double meanTSpot(double T) const
virtual double lightCollectionUniformity() const =0
Light Collection uniformity.
EMECALShowerParametrization *const theParam
unsigned getNumberOfSpots(unsigned i) const
Number of spots in a given interval.
GammaFunctionGenerator * myGammaGenerator
double correlationAlphaT(double lny) const
std::vector< double > TSpot
double flatShoot(double xmin=0.0, double xmax=1.0) const
Genfun::IncompleteGamma myIncompleteGamma
virtual double photoStatistics() const =0
Photostatistics (photons/GeV) in the homegeneous material.
double getUmax(unsigned i) const
Upper limit of the argument in the radius generator.
std::pair< unsigned int, double > Step
Power< A, B >::type pow(const A &a, const B &b)
bool setDepth(double, bool inCm=false)
set the depth in X0 or Lambda0 units depending on showerType
void setSpotEnergy(double e) override
double meanLnT(double lny) const
double sigmaLnT(double lny) const
void addInterval(double, double)
void setHcal(HcalHitMaker *const myHcal)
set the HCAL address
void setSpotEnergy(double e) override
std::vector< double > bSpot