15 #define infinity 10000
30 theHcalHitMaker(myHcalHitMaker),
80 if(
e < emin) effective = emin;
86 if(effective > 0.5 * emax) {
88 if(effective > emax) {
98 LogInfo(
"FastCalorimetry") <<
" HDShower : " << std::endl
99 <<
" Energy " <<
e << std::endl
100 <<
" lossesOpt " <<
lossesOpt << std::endl
102 <<
" nTRsteps " <<
nTRsteps << std::endl
104 <<
" eSpotSize " <<
eSpotSize << std::endl
107 <<
" balanceEH " <<
balanceEH << std::endl
132 LogInfo(
"FastCalorimetry") <<
" HDShower : " << std::endl
133 <<
" edpar " << edpar <<
" aedep " << aedep << std::endl
134 <<
" alpEM1 " << alpEM1 << std::endl
135 <<
" alpEM2 " << alpEM2 << std::endl
136 <<
" betEM1 " << betEM1 << std::endl
137 <<
" betEM2 " << betEM2 << std::endl
138 <<
" alpHD1 " << alpHD1 << std::endl
139 <<
" alpHD2 " << alpHD2 << std::endl
140 <<
" betHD1 " << betHD1 << std::endl
141 <<
" betHD2 " << betHD2 << std::endl
142 <<
" part1 " << part1 << std::endl
143 <<
" part2 " << part2 << std::endl;
150 alpEM = alpEM1 + alpEM2 * aedep;
152 betEM = betEM1 - betEM2 * aedep;
153 alpHD = alpHD1 + alpHD2 * aedep;
155 betHD = betHD1 - betHD2 * aedep;
156 part = part1 - part2 * aedep;
160 LogInfo(
"FastCalorimetry") <<
" HDShower : " << std::endl
161 <<
" alpEM " <<
alpEM << std::endl
162 <<
" tgamEM " <<
tgamEM << std::endl
163 <<
" betEM " <<
betEM << std::endl
164 <<
" alpHD " <<
alpHD << std::endl
165 <<
" tgamHD " <<
tgamHD << std::endl
166 <<
" betHD " <<
betHD << std::endl
167 <<
" part " <<
part << std::endl;
182 LogInfo(
"FastCalorimetry") <<
" HDShower e " <<
e << std::endl
183 <<
" x0EM = " <<
x0EM << std::endl
184 <<
" x0HD = " <<
x0HD << std::endl
185 <<
" lamEM = " <<
lambdaEM << std::endl
186 <<
" lamHD = " <<
lambdaHD << std::endl;
231 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : e <emin -> depthStart = 0" << std::endl;
235 if(depthStart > maxDepth) {
236 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : depthStart too big ... = " << depthStart << std::endl;
238 if(depthStart < 0.) depthStart = 0.;
239 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : depthStart re-calculated = " << depthStart << std::endl;
242 if(onECAL &&
e < emid) {
245 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : small energy, " <<
" depthStart reduced to = " << depthStart << std::endl;
250 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : depthHCAL too small ... = " <<
depthHCAL <<
" depthStart -> forced to 0 !!!" << std::endl;
256 LogInfo(
"FastCalorimetry") <<
" FamosHDShower : too small ECAL and HCAL depths - " <<
" particle is lost !!! " << std::endl;
261 LogInfo(
"FastCalorimetry") <<
" FamosHDShower depths(lam) - " << std::endl
263 <<
" GAP = " << depthGAP << std::endl
265 <<
" starting point = " << depthStart << std::endl;
268 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : onECAL" << std::endl;
270 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : depthStart < depthECAL" << std::endl;
272 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : enough space to make ECAL step" << std::endl;
288 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : " <<
" in ECAL sum1, sum2 " << sum1 <<
" " << sum2 << std::endl;
298 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : goto HCAL" << std::endl;
309 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : goto HCAL" << std::endl;
313 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : forward" << std::endl;
318 for (
int i = 0;
i < nmoresteps ;
i++) {
343 std::vector<double>
temp;
346 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::makeSteps - "
347 <<
" nsteps required : " << nsteps << std::endl;
350 for (
int i = 0;
i < nsteps;
i++) {
355 double y =
betHD * deplam;
358 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::makeSteps "
360 <<
" depx0, x = " << depx0 <<
", " << x
361 <<
" deplam, y = " << deplam <<
", "
370 LogInfo(
"FastCalorimetry") <<
"*** FamosHDShower::makeSteps " <<
" - negative step energy !!!"
378 int nPest = (int) (est *
e / sum /
eSpotSize) ;
381 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::makeSteps - nPoints estimate = "
382 << nPest << std::endl;
384 if(nPest <= 1 && count !=0 )
break;
398 double oldECALenergy = temp[0];
399 double oldHCALenergy = sumes - oldECALenergy ;
400 double newECALenergy = 2. * sumes;
401 for (
int i = 0; newECALenergy > sumes &&
i <
infinity;
i++)
405 LogInfo(
"FastCalorimetry") <<
"*** FamosHDShower::makeSteps " <<
" ECAL fraction : old/new - "
406 << oldECALenergy/sumes <<
"/" << newECALenergy/sumes << std::endl;
408 temp[0] = newECALenergy;
409 double newHCALenergy = sumes - newECALenergy;
410 double newHCALreweight = newHCALenergy / oldHCALenergy;
413 temp[
i] *= newHCALreweight;
420 eStep.push_back(temp[
i] *
e / sumes );
427 <<
" xO and lamdepth at the end of step = "
441 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::makeSteps - " <<
"ECAL energy = " <<
eStep[0]
442 <<
" out of total = " <<
e << std::endl;
452 int numLongit =
eStep.size();
454 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - "
455 <<
" N_long.steps required : " << numLongit << std::endl;
461 std::vector<double> Fhist;
462 std::vector<double> rhist;
466 if(
debug == 3)
LogInfo(
"FastCalorimetry") <<
"indexFinder - i, Fhist[i] = " << j <<
" " << Fhist[
j] << std::endl;
470 for (
int i = 0;
i < numLongit ;
i++) {
475 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - detector = " <<
detector[
i] <<
" currentDepthL0 = " << currentDepthL0 << std::endl;
478 double rbinsize = maxTRsize /
nTRsteps;
481 if(espot > 2. || espot < 0. )
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - unphysical espot = " << espot << std::endl;
487 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - status of " <<
" theHcalHitMaker->setDepth(currentDepthL0) is "
488 << setHDdepth << std::endl;
495 if(!setHDdepth)
continue;
505 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - status of Grid = " << status << std::endl;
507 if(!status)
continue;
512 espot *= 0.1 * (double)ntry /
double(
nspots[
i]);
531 if(
nspots[
i] > inf )
std::cout <<
" FamosHDShower::compute - at long.step " <<
i <<
" too many spots required : " <<
nspots[
i] <<
" !!! " << std::endl;
533 for (
int j = 0;
j <
inf;
j++) {
542 if(
debug == 2)
LogInfo(
"FastCalorimetry") << std::endl <<
" FamosHDShower::compute " <<
" r = " << radius
543 <<
" phi = " << phi << std::endl;
549 if(
debug == 2)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - " <<
" theGrid->addHit result = " << result << std::endl;
556 if(
debug == 2)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - " <<
" theHcalHitMaker->addHit result = " << result << std::endl;
569 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute " <<
" maximum number of"
570 <<
" transverse points " << count <<
" is used !!!" << std::endl;
573 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute " <<
" long.step No."
574 <<
i <<
" Ntry, Nok = " << count <<
" " << nok << std::endl;
584 int size = Fhist.size();
592 for (iter = 0; iter <
size ; iter++) {
594 if( curr >= size || curr < 1 )
595 LogWarning(
"FastCalorimetry") <<
" FamosHDShower::indexFinder - wrong current index = "
596 << curr <<
" !!!" << std::endl;
598 if ((x <= Fhist[curr]) && (x > Fhist[curr-1]))
break;
600 if(x > Fhist[curr]) {actudir = 1;}
602 if(prevdir * actudir < 0) {
if(step > 1) step /= 2;}
603 curr += actudir *
step;
604 if(curr > size) curr =
size;
605 else {
if(curr < 1) {curr = 1;}}
608 LogInfo(
"FastCalorimetry") <<
" indexFinder - end of iter." << iter
609 <<
" curr, F[curr-1], F[curr] = "
610 << curr <<
" " << Fhist[curr-1] <<
" " << Fhist[curr] << std::endl;
615 LogInfo(
"FastCalorimetry") <<
" indexFinder x = " << x <<
" found index = " << curr-1
void setSpotEnergy(double e)
Set the spot energy.
HDShower(const RandomEngineAndDistribution *engine, HDShowerParametrization *myParam, EcalHitMaker *myGrid, HcalHitMaker *myHcalHitMaker, int onECAL, double epart, double pmip)
bool addHit(double r, double phi, unsigned layer=0)
void setSpotEnergy(double e)
double flatShoot(double xmin=0.0, double xmax=1.0) const
double radLenIncm() const
Radiation length in cm.
const ECALProperties * theECALproperties
int getHDnTRsteps() const
double getHDeSpotSize() const
std::vector< double > lamstep
bool compute()
Compute the shower longitudinal and lateral development.
std::vector< double > x0curr
double getHDhcalDepthFactor() const
double interactionLength() const
Interaction length in cm.
std::vector< double > lamdepth
int getHDlossesOpt() const
std::vector< double > lamcurr
const HSParameters * hsParameters() const
int getHDnDepthSteps() const
double gam(double x, double a) const
double transProb(double factor, double R, double r)
std::vector< double > x0depth
HDShowerParametrization * theParam
double getHDdepthStep() const
double radLenIncm() const
Radiation length in cm.
double getHDbalanceEH() const
double ecalHcalGapTotalX0() const
ECAL-HCAL transition.
std::vector< int > nspots
HcalHitMaker * theHcalHitMaker
std::vector< int > detector
std::vector< double > lamtotal
bool getPads(double depth, bool inCm=false)
const HCALProperties * hcalProperties() const
double getHDcriticalEnergy() const
const ECALProperties * ecalProperties() const
double getHDmaxTRfactor() const
const RandomEngineAndDistribution * random
double getHDtransParam() const
const HCALProperties * theHCALproperties
std::vector< double > eStep
int indexFinder(double x, const std::vector< double > &Fhist)
std::vector< double > rlamStep
double ecalTotalL0() const
in the ECAL
bool addHit(double r, double phi, unsigned layer=0)
add the hit in the HCAL in local coordinates
void makeSteps(int nsteps)
tuple size
Write out results.
bool setDepth(double, bool inCm=false)
set the depth in X0 or Lambda0 units depending on showerType
double ecalHcalGapTotalL0() const
ECAL-HCAL transition.
double interactionLength() const
Interaction length in cm: 18.5 for Standard ECAL.
double hcalTotalL0() const
in the HCAL