19 vector<const RawParticle*>*
const myPart,
27 thePreshower(myPresh),
29 myGammaGenerator(gamma),
30 bFixedLength_(bFixedLength) {
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]);
97 meanDepth +=
a[
i] /
b[
i] * E[
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)
183 steps.push_back(step);
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)
194 steps.push_back(step);
197 Step stepLast(2, dt);
198 steps.push_back(stepLast);
200 last_Ecal_step =
steps.size() - 1;
213 if (dtFrontHcal < 30.) {
214 dt = 30. - dtFrontHcal;
216 steps.push_back(step);
223 double ESliceTot = 0.;
224 double MeanDepth = 0.;
230 for (
unsigned iStep = 0; iStep <
nSteps; ++iStep) {
233 double realTotalEnergy = 0;
234 dt =
steps[iStep].second;
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) {
286 dt =
steps[iStep].second;
294 unsigned detector =
steps[iStep].first;
296 bool presh1 = detector == 0;
297 bool presh2 = detector == 1;
298 bool ecal = detector == 2;
299 bool hcal = detector == 3;
300 bool vfcal = detector == 4;
301 bool gap = detector == 5;
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) {
349 if ((ecal || hcal) && !status)
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) {
584 for (
unsigned i = 0;
i <
nPart; ++
i) {
634 double b1 = b * (t -
dt);
639 result = (rb2 - rb1);
647 unsigned nvals = myValues.size() / 2;
648 for (
unsigned iv = 0;
iv < nvals; ++
iv) {
655 if (myPresh !=
nullptr) {
668 if (fabs(b2) < 1.
e-9)
double ps2TotalX0() const
total number of X0 in the PS (Layer2).
bool addHit(double r, double phi, unsigned layer=0) override
std::vector< const RawParticle * > *const thePart
std::vector< double > theNumberOfSpots
static std::vector< std::string > checklist log
double sigmaLnT(double lny) const
const HCALProperties * hcalProperties() const
double meanLnT(double lny) const
void prepareSteps()
Computes the steps before the real compute.
std::vector< double > maximumOfShower
double meanAlphaSpot(double alpha) const
double criticalEnergy() const override
Critical energy in GeV (2.66E-3*(x0*Z/A)^1.1): 8.74E-3 for Standard ECAL.
double flatShoot(double xmin=0.0, double xmax=1.0) const
std::vector< double > aSpot
unsigned getNumberOfSpots(unsigned i) const
Number of spots in a given interval.
double meanT(double lny) const
double deposit(double t, double a, double b, double dt)
const RandomEngineAndDistribution * random
double gam(double x, double a) const
const HCALProperties * theHCAL
void setPreshower(PreshowerHitMaker *const myPresh)
set the preshower address
double rC(double tau, double E) const
Exp< T >::type exp(const T &t)
bool isHom() const
a rough estimate of ECAL resolution sigma/E = resE/sqrt(E)
const ECALProperties * theECAL
double ps2eeTotalX0() const
void setIntervals(unsigned icomp, RadialInterval &rad)
const std::vector< double > & getTailIntervals() const
void compute()
Compute the shower longitudinal and lateral development.
const std::vector< double > & getCoreIntervals() const
std::vector< double > Etot
double mipsPerGeV() const override
Number of Mips/GeV [Default : 41.7 Mips/GeV or 24 MeV/Mips].
double spotFraction() const
Spot fraction wrt ECAL.
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
double ecalTotalX0() const
in the ECAL
bool addHitDepth(double r, double phi, double depth=-1)
double getUmin(unsigned i) const
Lower limit of the argument in the radius generator.
bool addHit(double r, double phi, unsigned layer=0) override
HcalHitMaker * theHcalHitMaker
uint16_t const *__restrict__ x
double hcalTotalX0() const
in the HCAL
std::vector< double > meanDepth
void setSpotEnergy(double e) override
Set the spot energy.
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
const PreshowerLayer1Properties * layer1Properties() const
double shoot(RandomEngineAndDistribution const *) const
double correlationAlphaT(double lny) const
const ECALProperties * ecalProperties() const
unsigned nIntervals() const
Number of intervals.
double mipsPerGeV() const override
Number of Mips/GeV [Default : 59.5 Mips/GeV or 0.7*24 MeV/Mips].
double p(double tau, double E) 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)
const PreshowerLayer2Properties * layer2Properties() const
const PreshowerLayer2Properties * theLayer2
bool getPads(double depth, bool inCm=false)
double meanLnAlpha(double lny) const
double nSpots(double E) const
virtual double lightCollectionEfficiency() const =0
Light Collection efficiency.
const PreshowerLayer1Properties * theLayer1
double meanTSpot(double T) const
double meanAlpha(double lny) const
virtual double lightCollectionUniformity() const =0
Light Collection uniformity.
double gaussShoot(double mean=0.0, double sigma=1.0) const
unsigned int poissonShoot(double mean) const
EMECALShowerParametrization *const theParam
GammaFunctionGenerator * myGammaGenerator
double sigmaLnAlpha(double lny) const
std::vector< double > TSpot
double getSpotEnergy(unsigned i) const
Spot energy in a given interval.
static constexpr float b2
Genfun::IncompleteGamma myIncompleteGamma
double ps1TotalX0() const
double getUmax(unsigned i) const
Upper limit of the argument in the radius generator.
virtual double photoStatistics() const =0
Photostatistics (photons/GeV) in the homegeneous material.
double x0DepthOffset() const
get the offset (e.g the number of X0 after which the shower starts)
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
static constexpr float b1
void addInterval(double, double)
void setHcal(HcalHitMaker *const myHcal)
set the HCAL address
void setSpotEnergy(double e) override
std::vector< double > bSpot
double resE() const
a rough estimate of ECAL resolution sigma/E = resE/sqrt(E)