20 vector<const RawParticle*>*
const myPart,
28 thePreshower(myPresh),
30 myGammaGenerator(gamma),
31 bFixedLength_(bFixedLength)
54 for (
unsigned int i=0;
i<
nPart; ++
i ) {
64 double theMeanT = myParam->
meanT(lny);
65 double theMeanAlpha = myParam->
meanAlpha(lny);
66 double theMeanLnT = myParam->
meanLnT(lny);
68 double theSigmaLnT = myParam->
sigmaLnT(lny);
74 double rhop =
std::sqrt( (1.+theCorrelation)/2. );
95 aa =
std::exp(theMeanLnAlpha + theSigmaLnAlpha * (z1*rhop-z2*rhom));
99 T.push_back(
std::exp(theMeanLnT + theSigmaLnT * (z1*rhop+z2*rhom)));
100 b.push_back((
a[i]-1.)/
T[i]);
103 meanDepth +=
a[
i]/
b[
i]*E[
i];
137 int first_Ecal_step=0;
138 int last_Ecal_step=0;
184 stps=(
int)((radlen+2.5)/5.);
186 if ( stps == 0 ) stps = 1;
187 dt = radlen/(double)stps;
189 first_Ecal_step=
steps.size();
190 for (
int ist=0; ist<stps; ++ist )
191 steps.push_back(step);
192 last_Ecal_step=
steps.size()-1;
196 stps =
static_cast<int>(radlen);
197 if (stps == 0) stps = 1;
199 first_Ecal_step=
steps.size();
200 for (
int ist=0; ist<stps; ++ist )
steps.push_back(step);
203 Step stepLast (2,dt);
204 steps.push_back(stepLast);
206 last_Ecal_step=
steps.size()-1;
224 steps.push_back(step);
237 for(
unsigned iStep=0;iStep<
nSteps;++iStep)
241 double realTotalEnergy=0;
242 dt=
steps[iStep].second;
244 for (
unsigned int i=0;
i<
nPart; ++
i ) {
252 MeanDepth/=ESliceTot;
257 if(realTotalEnergy<0.001)
264 if(last_Ecal_step+offset>=0)
296 for (
unsigned iStep=0; iStep<
nSteps; ++iStep ) {
299 dt =
steps[iStep].second;
309 bool presh1 = detector==0;
310 bool presh2 = detector==1;
311 bool ecal = detector==2;
312 bool hcal = detector==3;
313 bool vfcal = detector==4;
314 bool gap = detector==5;
317 if (
theHCAL==
nullptr) hcal=
false;
320 if ( vfcal )
continue;
333 double tt = t-0.5*
dt;
335 double realTotalEnergy=0.;
336 for (
unsigned int i=0;
i<
nPart; ++
i ) {
345 bool usePreviousGrid=(realTotalEnergy<0.001);
351 if(iStep>2&&realTotalEnergy<0.000001)
continue;
353 if (ecal && !usePreviousGrid)
361 if((ecal || hcal) && !status)
continue;
363 bool detailedShowerTail=
false;
365 if(ecal && !usePreviousGrid)
371 for (
unsigned int i=0;
i<
nPart; ++
i ) {
379 if(dE*
E[i]<0.000001)
continue;
400 if (dE*E[i] < 0.000001)
continue;
439 / tgamma(
aSpot[i]) );
451 if( nSo > 0. && nS/nSo < 10.) dE *= nS/nSo;
471 }
else if ( presh2 ) {
484 if(detailedShowerTail)
494 double eSpot = (nS>0.) ? dE/nS : 0.;
495 double SpotEnergy=eSpot*
E[
i];
505 int nSpot = (
int)(nS+0.5);
512 double taui = tt/
Ti[
i];
525 if(dSpotsCore<0) dSpotsCore=0;
527 unsigned nSpots_core = (unsigned)(dSpotsCore+0.5);
528 unsigned nSpots_tail = ((unsigned)nSpot>nSpots_core) ? nSpot-nSpots_core : 0;
530 for(
unsigned icomp=0;icomp<2;++icomp)
533 double theR=(icomp==0) ? theRC : theRT ;
534 unsigned ncompspots=(icomp==0) ? nSpots_core : nSpots_tail;
558 for(
unsigned irad=0;irad<nrad;++irad)
564 double umin=radInterval.
getUmin(irad);
565 double umax=radInterval.
getUmax(irad);
569 for (
unsigned ispot=0; ispot<nradspots; ++ispot )
582 if(detailedShowerTail)
696 unsigned nvals=myValues.size()/2;
697 for(
unsigned iv=0;iv<nvals;++iv)
725 if(fabs(b2) < 1.
e-9 ) 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
double sigmaLnT(double lny) const
const HCALProperties * hcalProperties() const
double meanLnT(double lny) const
double mipsPerGeV() const override
Number of Mips/GeV [Default : 41.7 Mips/GeV or 24 MeV/Mips].
void prepareSteps()
Computes the steps before the real compute.
std::vector< double > maximumOfShower
double meanAlphaSpot(double alpha) const
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
virtual double lightCollectionEfficiency() const =0
Light Collection efficiency.
double rC(double tau, double E) const
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 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
double hcalTotalX0() const
in the HCAL
virtual double photoStatistics() const =0
Photostatistics (photons/GeV) in the homegeneous material.
std::vector< double > meanDepth
void setSpotEnergy(double e) override
Set the spot energy.
double rT(double tau, double E) const
double mipsPerGeV() const override
Number of Mips/GeV [Default : 59.5 Mips/GeV or 0.7*24 MeV/Mips].
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 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
const PreshowerLayer1Properties * theLayer1
double meanTSpot(double T) const
double meanAlpha(double lny) const
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.
Genfun::IncompleteGamma myIncompleteGamma
double ps1TotalX0() const
double getUmax(unsigned i) const
Upper limit of the argument in the radius generator.
double x0DepthOffset() const
get the offset (e.g the number of X0 after which the shower starts)
virtual double lightCollectionUniformity() const =0
Light Collection uniformity.
std::pair< unsigned int, double > Step
Power< A, B >::type pow(const A &a, const B &b)
double criticalEnergy() const override
Critical energy in GeV (2.66E-3*(x0*Z/A)^1.1): 8.74E-3 for Standard ECAL.
bool setDepth(double, bool inCm=false)
set the depth in X0 or Lambda0 units depending on showerType
void setSpotEnergy(double e) override
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)