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;
392 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::makeSteps - nPoints estimate = " << nPest << std::endl;
394 if (nPest <= 1 &&
count != 0)
408 double oldECALenergy =
temp[0];
409 double oldHCALenergy = sumes - oldECALenergy;
410 double newECALenergy = 2. * sumes;
411 for (
int i = 0; newECALenergy > sumes &&
i <
infinity;
i++)
415 LogInfo(
"FastCalorimetry") <<
"*** FamosHDShower::makeSteps " 416 <<
" ECAL fraction : old/new - " << oldECALenergy / sumes <<
"/" 417 << newECALenergy / sumes << std::endl;
419 temp[0] = newECALenergy;
420 double newHCALenergy = sumes - newECALenergy;
421 double newHCALreweight = newHCALenergy / oldHCALenergy;
424 temp[
i] *= newHCALreweight;
447 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::makeSteps - " 448 <<
"ECAL energy = " <<
eStep[0] <<
" out of total = " <<
e << std::endl;
456 int numLongit =
eStep.size();
458 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - " 459 <<
" N_long.steps required : " << numLongit << std::endl;
464 std::vector<double> Fhist;
465 std::vector<double> rhist;
470 LogInfo(
"FastCalorimetry") <<
"indexFinder - i, Fhist[i] = " <<
j <<
" " << Fhist[
j] << std::endl;
474 for (
int i = 0;
i < numLongit;
i++) {
480 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - detector = " <<
detector[
i]
481 <<
" currentDepthL0 = " << currentDepthL0 << std::endl;
484 double rbinsize = maxTRsize /
nTRsteps;
487 if (espot > 2. || espot < 0.)
488 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - unphysical espot = " << espot << std::endl;
495 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - status of " 496 <<
" theHcalHitMaker->setDepth(currentDepthL0) is " << setHDdepth << std::endl;
514 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - status of Grid = " <<
status << std::endl;
522 espot *= 0.1 * (double)ntry /
double(
nspots[
i]);
542 std::cout <<
" FamosHDShower::compute - at long.step " <<
i <<
" too many spots required : " <<
nspots[
i]
543 <<
" !!! " << std::endl;
545 for (
int j = 0;
j <
inf;
j++) {
556 LogInfo(
"FastCalorimetry") << std::endl
557 <<
" FamosHDShower::compute " 558 <<
" r = " <<
radius <<
" phi = " <<
phi << std::endl;
565 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - " 566 <<
" theGrid->addHit result = " <<
result << std::endl;
573 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - " 574 <<
" theHcalHitMaker->addHit result = " <<
result << std::endl;
586 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute " 587 <<
" maximum number of" 588 <<
" transverse points " <<
count <<
" is used !!!" << std::endl;
592 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute " 593 <<
" long.step No." <<
i <<
" Ntry, Nok = " <<
count <<
" " << nok << std::endl;
602 int size = Fhist.size();
610 for (iter = 0; iter <
size; iter++) {
611 if (curr >=
size || curr < 1)
612 LogWarning(
"FastCalorimetry") <<
" FamosHDShower::indexFinder - wrong current index = " << curr <<
" !!!" 615 if ((
x <= Fhist[curr]) && (
x > Fhist[curr - 1]))
618 if (
x > Fhist[curr]) {
623 if (prevdir * actudir < 0) {
627 curr += actudir *
step;
637 LogInfo(
"FastCalorimetry") <<
" indexFinder - end of iter." << iter <<
" curr, F[curr-1], F[curr] = " << curr
638 <<
" " << Fhist[curr - 1] <<
" " << Fhist[curr] << std::endl;
642 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