15 #define infinity 10000 30 theHcalHitMaker(myHcalHitMaker),
85 if (effective > 0.5 * emax) {
87 if (effective > emax) {
91 if (effective > 1000.)
97 LogInfo(
"FastCalorimetry") <<
" HDShower : " << std::endl
98 <<
" Energy " <<
e << std::endl
99 <<
" lossesOpt " <<
lossesOpt << std::endl
101 <<
" nTRsteps " <<
nTRsteps << std::endl
103 <<
" eSpotSize " <<
eSpotSize << std::endl
106 <<
" balanceEH " <<
balanceEH << std::endl
130 LogInfo(
"FastCalorimetry") <<
" HDShower : " << std::endl
131 <<
" edpar " << edpar <<
" aedep " << aedep << std::endl
132 <<
" alpEM1 " << alpEM1 << std::endl
133 <<
" alpEM2 " << alpEM2 << std::endl
134 <<
" betEM1 " << betEM1 << std::endl
135 <<
" betEM2 " << betEM2 << std::endl
136 <<
" alpHD1 " << alpHD1 << std::endl
137 <<
" alpHD2 " << alpHD2 << std::endl
138 <<
" betHD1 " << betHD1 << std::endl
139 <<
" betHD2 " << betHD2 << std::endl
140 <<
" part1 " << part1 << std::endl
141 <<
" part2 " << part2 << std::endl;
148 alpEM = alpEM1 + alpEM2 * aedep;
150 betEM = betEM1 - betEM2 * aedep;
151 alpHD = alpHD1 + alpHD2 * aedep;
153 betHD = betHD1 - betHD2 * aedep;
154 part = part1 - part2 * aedep;
159 LogInfo(
"FastCalorimetry") <<
" HDShower : " << std::endl
160 <<
" alpEM " <<
alpEM << std::endl
161 <<
" tgamEM " <<
tgamEM << std::endl
162 <<
" betEM " <<
betEM << std::endl
163 <<
" alpHD " <<
alpHD << std::endl
164 <<
" tgamHD " <<
tgamHD << std::endl
165 <<
" betHD " <<
betHD << std::endl
166 <<
" part " <<
part << std::endl;
179 LogInfo(
"FastCalorimetry") <<
" HDShower e " <<
e << std::endl
180 <<
" x0EM = " <<
x0EM << std::endl
181 <<
" x0HD = " <<
x0HD << std::endl
182 <<
" lamEM = " <<
lambdaEM << std::endl
183 <<
" lamHD = " <<
lambdaHD << std::endl;
232 LogInfo(
"FastCalorimetry") <<
" FamosHDShower : e <emin -> depthStart = 0" << std::endl;
238 LogInfo(
"FastCalorimetry") <<
" FamosHDShower : depthStart too big ... = " <<
depthStart << std::endl;
243 LogInfo(
"FastCalorimetry") <<
" FamosHDShower : depthStart re-calculated = " <<
depthStart << std::endl;
246 if (onECAL &&
e < emid) {
250 LogInfo(
"FastCalorimetry") <<
" FamosHDShower : small energy, " 251 <<
" depthStart reduced to = " <<
depthStart << std::endl;
257 LogInfo(
"FastCalorimetry") <<
" FamosHDShower : depthHCAL too small ... = " <<
depthHCAL 258 <<
" depthStart -> forced to 0 !!!" << std::endl;
264 LogInfo(
"FastCalorimetry") <<
" FamosHDShower : too small ECAL and HCAL depths - " 265 <<
" particle is lost !!! " << std::endl;
270 LogInfo(
"FastCalorimetry") <<
" FamosHDShower depths(lam) - " << std::endl
272 <<
" GAP = " <<
depthGAP << std::endl
274 <<
" starting point = " <<
depthStart << std::endl;
278 LogInfo(
"FastCalorimetry") <<
" FamosHDShower : onECAL" << std::endl;
281 LogInfo(
"FastCalorimetry") <<
" FamosHDShower : depthStart < depthECAL" << std::endl;
284 LogInfo(
"FastCalorimetry") <<
" FamosHDShower : enough space to make ECAL step" << std::endl;
301 LogInfo(
"FastCalorimetry") <<
" FamosHDShower : " 302 <<
" in ECAL sum1, sum2 " << sum1 <<
" " << sum2 << std::endl;
312 LogInfo(
"FastCalorimetry") <<
" FamosHDShower : goto HCAL" << std::endl;
323 LogInfo(
"FastCalorimetry") <<
" FamosHDShower : goto HCAL" << std::endl;
327 LogInfo(
"FastCalorimetry") <<
" FamosHDShower : forward" << std::endl;
332 for (
int i = 0;
i < nmoresteps;
i++) {
358 std::vector<double>
temp;
361 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::makeSteps - " 362 <<
" nsteps required : " << nsteps << std::endl;
365 for (
int i = 0;
i < nsteps;
i++) {
369 double y =
betHD * deplam;
372 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::makeSteps " 373 <<
" - step " <<
i <<
" depx0, x = " << depx0 <<
", " <<
x 374 <<
" deplam, y = " << deplam <<
", " <<
y << std::endl;
382 LogInfo(
"FastCalorimetry") <<
"*** FamosHDShower::makeSteps " 383 <<
" - negative step energy !!!" << std::endl;
393 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::makeSteps - nPoints estimate = " << nPest << std::endl;
395 if (nPest <= 1 &&
count != 0)
409 double oldECALenergy =
temp[0];
410 double oldHCALenergy = sumes - oldECALenergy;
411 double newECALenergy = 2. * sumes;
412 for (
int i = 0; newECALenergy > sumes &&
i <
infinity;
i++)
416 LogInfo(
"FastCalorimetry") <<
"*** FamosHDShower::makeSteps " 417 <<
" ECAL fraction : old/new - " << oldECALenergy / sumes <<
"/" 418 << newECALenergy / sumes << std::endl;
420 temp[0] = newECALenergy;
421 double newHCALenergy = sumes - newECALenergy;
422 double newHCALreweight = newHCALenergy / oldHCALenergy;
425 temp[
i] *= newHCALreweight;
448 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::makeSteps - " 449 <<
"ECAL energy = " <<
eStep[0] <<
" out of total = " <<
e << std::endl;
457 int numLongit =
eStep.size();
459 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - " 460 <<
" N_long.steps required : " << numLongit << std::endl;
465 std::vector<double> Fhist;
466 std::vector<double> rhist;
471 LogInfo(
"FastCalorimetry") <<
"indexFinder - i, Fhist[i] = " <<
j <<
" " << Fhist[
j] << std::endl;
475 for (
int i = 0;
i < numLongit;
i++) {
481 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - detector = " <<
detector[
i]
482 <<
" currentDepthL0 = " << currentDepthL0 << std::endl;
485 double rbinsize = maxTRsize /
nTRsteps;
488 if (espot > 2. || espot < 0.)
489 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - unphysical espot = " << espot << std::endl;
496 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - status of " 497 <<
" theHcalHitMaker->setDepth(currentDepthL0) is " << setHDdepth << std::endl;
515 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - status of Grid = " <<
status << std::endl;
523 espot *= 0.1 * (double)ntry /
double(
nspots[
i]);
543 std::cout <<
" FamosHDShower::compute - at long.step " <<
i <<
" too many spots required : " <<
nspots[
i]
544 <<
" !!! " << std::endl;
546 for (
int j = 0;
j <
inf;
j++) {
557 LogInfo(
"FastCalorimetry") << std::endl
558 <<
" FamosHDShower::compute " 559 <<
" r = " <<
radius <<
" phi = " <<
phi << std::endl;
566 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - " 567 <<
" theGrid->addHit result = " <<
result << std::endl;
574 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - " 575 <<
" theHcalHitMaker->addHit result = " <<
result << std::endl;
587 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute " 588 <<
" maximum number of" 589 <<
" transverse points " <<
count <<
" is used !!!" << std::endl;
593 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute " 594 <<
" long.step No." <<
i <<
" Ntry, Nok = " <<
count <<
" " << nok << std::endl;
603 int size = Fhist.size();
611 for (iter = 0; iter <
size; iter++) {
612 if (curr >=
size || curr < 1)
613 LogWarning(
"FastCalorimetry") <<
" FamosHDShower::indexFinder - wrong current index = " << curr <<
" !!!" 616 if ((
x <= Fhist[curr]) && (
x > Fhist[curr - 1]))
619 if (
x > Fhist[curr]) {
624 if (prevdir * actudir < 0) {
628 curr += actudir *
step;
638 LogInfo(
"FastCalorimetry") <<
" indexFinder - end of iter." << iter <<
" curr, F[curr-1], F[curr] = " << curr
639 <<
" " << Fhist[curr - 1] <<
" " << Fhist[curr] << std::endl;
643 LogInfo(
"FastCalorimetry") <<
" indexFinder x = " <<
x <<
" found index = " << curr - 1 << std::endl;
double ecalHcalGapTotalL0() const
ECAL-HCAL transition.
HDShower(const RandomEngineAndDistribution *engine, HDShowerParametrization *myParam, EcalHitMaker *myGrid, HcalHitMaker *myHcalHitMaker, int onECAL, double epart, double pmip)
double radLenIncm() const override
Radiation length in cm.
bool addHit(double r, double phi, unsigned layer=0) override
double radLenIncm() const override
Radiation length in cm.
double getHDtransParam() const
const ECALProperties * theECALproperties
double ecalTotalL0() const
in the ECAL
std::vector< double > lamstep
bool compute()
Compute the shower longitudinal and lateral development.
std::vector< double > x0curr
double getHDmaxTRfactor() const
double interactionLength() const override
Interaction length in cm.
double getHDcriticalEnergy() const
double getHDbalanceEH() const
int getHDnDepthSteps() const
std::vector< double > lamdepth
bool addHit(double r, double phi, unsigned layer=0) override
add the hit in the HCAL in local coordinates
std::vector< double > lamcurr
int getHDlossesOpt() const
double transProb(double factor, double R, double r)
std::vector< double > x0depth
HDShowerParametrization * theParam
double gam(double x, double a) const
void setSpotEnergy(double e) override
Set the spot energy.
const HSParameters * hsParameters() const
double getHDdepthStep() const
double ecalHcalGapTotalX0() const
ECAL-HCAL transition.
Log< level::Info, false > LogInfo
std::vector< int > nspots
const HCALProperties * hcalProperties() const
HcalHitMaker * theHcalHitMaker
std::vector< int > detector
std::vector< double > lamtotal
bool getPads(double depth, bool inCm=false)
double hcalTotalL0() const
in the HCAL
double getHDeSpotSize() const
const RandomEngineAndDistribution * random
double getHDhcalDepthFactor() const
const ECALProperties * ecalProperties() const
const HCALProperties * theHCALproperties
std::vector< double > eStep
int indexFinder(double x, const std::vector< double > &Fhist)
double flatShoot(double xmin=0.0, double xmax=1.0) const
Log< level::Warning, false > LogWarning
std::vector< double > rlamStep
double interactionLength() const override
Interaction length in cm: 18.5 for Standard ECAL.
void makeSteps(int nsteps)
int getHDnTRsteps() const
bool setDepth(double, bool inCm=false)
set the depth in X0 or Lambda0 units depending on showerType
void setSpotEnergy(double e) override