24 vector<const RawParticle*>*
const myPart,
33 thePreshower(myPresh),
35 myGammaGenerator(gamma),
36 bFixedLength_(bFixedLength)
63 if (!
dbe->
get(
"EMShower/NumberOfParticles")) {}
70 for (
unsigned int i=0;
i<
nPart; ++
i ) {
81 if (!
dbe->
get(
"EMShower/ParticlesEnergy")) {}
83 dbe->
get(
"EMShower/ParticlesEnergy")->
Fill(log10(
E[i]));
96 double theMeanT = myParam->
meanT(lny);
97 double theMeanAlpha = myParam->
meanAlpha(lny);
98 double theMeanLnT = myParam->
meanLnT(lny);
100 double theSigmaLnT = myParam->
sigmaLnT(lny);
106 double rhop =
std::sqrt( (1.+theCorrelation)/2. );
107 double rhom =
std::sqrt( (1.-theCorrelation)/2. );
115 photos.push_back(
E[i] * fotos);
127 aa =
std::exp(theMeanLnAlpha + theSigmaLnAlpha * (z1*rhop-z2*rhom));
131 T.push_back(
std::exp(theMeanLnT + theSigmaLnT * (z1*rhop+z2*rhom)));
132 b.push_back((
a[i]-1.)/
T[i]);
135 meanDepth +=
a[
i]/
b[
i]*E[
i];
169 int first_Ecal_step=0;
170 int last_Ecal_step=0;
216 stps=(int)((radlen+2.5)/5.);
218 if ( stps == 0 ) stps = 1;
219 dt = radlen/(double)stps;
221 first_Ecal_step=
steps.size();
222 for (
int ist=0; ist<stps; ++ist )
223 steps.push_back(step);
224 last_Ecal_step=
steps.size()-1;
228 stps =
static_cast<int>(radlen);
229 if (stps == 0) stps = 1;
231 first_Ecal_step=
steps.size();
232 for (
int ist=0; ist<stps; ++ist )
steps.push_back(step);
235 Step stepLast (2,dt);
236 steps.push_back(stepLast);
238 last_Ecal_step=
steps.size()-1;
256 steps.push_back(step);
269 for(
unsigned iStep=0;iStep<
nSteps;++iStep)
273 double realTotalEnergy=0;
274 dt=
steps[iStep].second;
276 for (
unsigned int i=0;
i<
nPart; ++
i ) {
284 MeanDepth/=ESliceTot;
289 if(realTotalEnergy<0.001)
296 if(last_Ecal_step+offset>=0)
337 for (
unsigned iStep=0; iStep<
nSteps; ++iStep ) {
340 dt =
steps[iStep].second;
348 unsigned detector=
steps[iStep].first;
350 bool presh1 = detector==0;
351 bool presh2 = detector==1;
352 bool ecal = detector==2;
353 bool hcal = detector==3;
354 bool vfcal = detector==4;
355 bool gap = detector==5;
361 if ( vfcal )
continue;
374 double tt = t-0.5*
dt;
376 double realTotalEnergy=0.;
377 for (
unsigned int i=0;
i<
nPart; ++
i ) {
386 bool usePreviousGrid=(realTotalEnergy<0.001);
392 if(iStep>2&&realTotalEnergy<0.000001)
continue;
394 if (ecal && !usePreviousGrid)
402 if((ecal || hcal) && !status)
continue;
404 bool detailedShowerTail=
false;
406 if(ecal && !usePreviousGrid)
412 for (
unsigned int i=0;
i<
nPart; ++
i ) {
420 if(dE*
E[i]<0.000001)
continue;
441 if (dE*E[i] < 0.000001)
continue;
461 if (
dbe && fabs(dt-1.)< 1
e-5 && ecal) {
463 if (!
dbe->
get(
"EMShower/LongitudinalShape")) {}
467 dbe->
get(
"EMShower/LongitudinalShape")->
Fill(t, dE/dx);
469 double step = theECALX0/samplingWidth;
470 double binMin =
abs((t-1)*step)+1;
471 double binMax =
abs(t*step)+1;
472 double dBins = binMax-binMin;
481 dbe->
get(
"EMShower/LongitudinalShapeLayers")->
Fill(binMin, dE/dx);
487 double w1 = (binMin + 1 - (t-1)*step - 1)/
step;
489 double w3 = (t*step+1-binMax)/step;
501 dbe->
get(
"EMShower/LongitudinalShapeLayers")->
Fill(binMin, dE/dx*w1);
504 for (
int iBin = 1; iBin < dBins; iBin++){
506 dbe->
get(
"EMShower/LongitudinalShapeLayers")->
Fill(binMin+iBin, dE/dx*w2);
511 dbe->
get(
"EMShower/LongitudinalShapeLayers")->
Fill(binMax, dE/dx*w3);
540 / tgamma(
aSpot[i]) );
552 if( nSo > 0. && nS/nSo < 10.) dE *= nS/nSo;
572 }
else if ( presh2 ) {
585 if(detailedShowerTail)
595 double eSpot = (nS>0.) ? dE/nS : 0.;
596 double SpotEnergy=eSpot*
E[
i];
606 int nSpot = (int)(nS+0.5);
613 double taui = tt/
Ti[
i];
626 if(dSpotsCore<0) dSpotsCore=0;
628 unsigned nSpots_core = (unsigned)(dSpotsCore+0.5);
629 unsigned nSpots_tail = ((unsigned)nSpot>nSpots_core) ? nSpot-nSpots_core : 0;
631 for(
unsigned icomp=0;icomp<2;++icomp)
634 double theR=(icomp==0) ? theRC : theRT ;
635 unsigned ncompspots=(icomp==0) ? nSpots_core : nSpots_tail;
659 for(
unsigned irad=0;irad<nrad;++irad)
665 double umin=radInterval.
getUmin(irad);
666 double umax=radInterval.
getUmax(irad);
670 for (
unsigned ispot=0; ispot<nradspots; ++ispot )
687 if (
dbe && fabs(dt-1.)< 1
e-5 && ecal) {
689 if (!
dbe->
get(
"EMShower/TransverseShape")) {}
694 dbe->
get(
"EMShower/TransverseShape")->
Fill(ri,1/E[i]*spote/drho);
695 dbe->
get(
"EMShower/ShapeRhoZ")->
Fill(ri, t, 1/E[i]*spote/(drho*dx));
710 if(detailedShowerTail)
824 unsigned nvals=myValues.size()/2;
825 for(
unsigned iv=0;iv<nvals;++iv)
853 if(fabs(b2) < 1.
e-9 ) b2 = 1.e-9;
void setSpotEnergy(double e)
Set the spot energy.
double ps2TotalX0() const
total number of X0 in the PS (Layer2).
std::vector< const RawParticle * > *const thePart
std::vector< double > theNumberOfSpots
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
bool addHit(double r, double phi, unsigned layer=0)
double meanAlphaSpot(double alpha) const
common ppss p3p6s2 common epss epspn46 common const1 w2
void setSpotEnergy(double e)
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 radLenIncm() const
Radiation length in cm.
double meanT(double lny) const
bool addHit(double r, double phi, unsigned layer=0)
double deposit(double t, double a, double b, double dt)
void cd(void)
go to top directory (ie. root)
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
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.
PreshowerHitMaker * thePreshower
std::vector< std::vector< double > > depositedEnergy
double ecalTotalX0() const
in the ECAL
EMShower(RandomEngineAndDistribution const *engine, GammaFunctionGenerator *gamma, EMECALShowerParametrization *const myParam, std::vector< const RawParticle * > *const myPart, DQMStore *const dbeIn=NULL, EcalHitMaker *const myGrid=NULL, PreshowerHitMaker *const myPreshower=NULL, bool bFixedLength=false)
double dp() const
the width of the passive layer in the case of the homogeneous detector
bool addHitDepth(double r, double phi, double depth=-1)
double da() const
the width of the active layer in the case of the homogeneous detector
double getUmin(unsigned i) const
Lower limit of the argument in the radius generator.
Abs< T >::type abs(const T &t)
HcalHitMaker * theHcalHitMaker
double hcalTotalX0() const
in the HCAL
std::vector< double > meanDepth
double rT(double tau, double E) const
void setParameters(double a, double b, double xm)
The parameters must be set before shooting.
unsigned int offset(bool)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
std::vector< double > photos
const PreshowerLayer1Properties * layer1Properties() const
double shoot(RandomEngineAndDistribution const *) const
void setSpotEnergy(double e)
double correlationAlphaT(double lny) const
const ECALProperties * ecalProperties() const
unsigned nIntervals() const
Number of intervals.
double mipsPerGeV() const
Number of Mips/GeV [Default : 41.7 Mips/GeV or 24 MeV/Mips].
double mipsPerGeV() const
Number of Mips/GeV [Default : 59.5 Mips/GeV or 0.7*24 MeV/Mips].
double criticalEnergy() const
Critical energy in GeV (2.66E-3*(x0*Z/A)^1.1): 8.74E-3 for Standard ECAL.
double p(double tau, double E) const
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
common ppss p3p6s2 common epss epspn46 common const1 w3
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.
Genfun::IncompleteGamma myIncompleteGamma
double ps1TotalX0() const
bool addHit(double r, double phi, unsigned layer=0)
add the hit in the HCAL in local coordinates
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 addInterval(double, double)
void setHcal(HcalHitMaker *const myHcal)
set the HCAL address
std::vector< double > bSpot
double resE() const
a rough estimate of ECAL resolution sigma/E = resE/sqrt(E)