27 #define infinity 10000
42 theHcalHitMaker(myHcalHitMaker),
85 if (!
dbe->
get(
"HDShower/ParticlesEnergy")) {}
87 dbe->
get(
"HDShower/ParticlesEnergy")->
Fill(log10(
e));
99 if(
e < emin) effective = emin;
105 if(effective > 0.5 * emax) {
107 if(effective > emax) {
111 if(effective > 1000.)
117 LogInfo(
"FastCalorimetry") <<
" HDShower : " << std::endl
118 <<
" Energy " <<
e << std::endl
119 <<
" lossesOpt " <<
lossesOpt << std::endl
121 <<
" nTRsteps " <<
nTRsteps << std::endl
123 <<
" eSpotSize " <<
eSpotSize << std::endl
126 <<
" balanceEH " <<
balanceEH << std::endl
151 LogInfo(
"FastCalorimetry") <<
" HDShower : " << std::endl
152 <<
" edpar " << edpar <<
" aedep " << aedep << std::endl
153 <<
" alpEM1 " << alpEM1 << std::endl
154 <<
" alpEM2 " << alpEM2 << std::endl
155 <<
" betEM1 " << betEM1 << std::endl
156 <<
" betEM2 " << betEM2 << std::endl
157 <<
" alpHD1 " << alpHD1 << std::endl
158 <<
" alpHD2 " << alpHD2 << std::endl
159 <<
" betHD1 " << betHD1 << std::endl
160 <<
" betHD2 " << betHD2 << std::endl
161 <<
" part1 " << part1 << std::endl
162 <<
" part2 " << part2 << std::endl;
169 alpEM = alpEM1 + alpEM2 * aedep;
171 betEM = betEM1 - betEM2 * aedep;
172 alpHD = alpHD1 + alpHD2 * aedep;
174 betHD = betHD1 - betHD2 * aedep;
175 part = part1 - part2 * aedep;
179 LogInfo(
"FastCalorimetry") <<
" HDShower : " << std::endl
180 <<
" alpEM " <<
alpEM << std::endl
181 <<
" tgamEM " <<
tgamEM << std::endl
182 <<
" betEM " <<
betEM << std::endl
183 <<
" alpHD " <<
alpHD << std::endl
184 <<
" tgamHD " <<
tgamHD << std::endl
185 <<
" betHD " <<
betHD << std::endl
186 <<
" part " <<
part << std::endl;
201 LogInfo(
"FastCalorimetry") <<
" HDShower e " <<
e << std::endl
202 <<
" x0EM = " <<
x0EM << std::endl
203 <<
" x0HD = " <<
x0HD << std::endl
204 <<
" lamEM = " <<
lambdaEM << std::endl
205 <<
" lamHD = " <<
lambdaHD << std::endl;
245 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : e <emin -> depthStart = 0" << std::endl;
249 if(depthStart > maxDepth) {
250 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : depthStart too big ... = " << depthStart << std::endl;
252 if(depthStart < 0.) depthStart = 0.;
253 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : depthStart re-calculated = " << depthStart << std::endl;
256 if(onECAL &&
e < emid) {
259 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : small energy, " <<
" depthStart reduced to = " << depthStart << std::endl;
264 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : depthHCAL too small ... = " <<
depthHCAL <<
" depthStart -> forced to 0 !!!" << std::endl;
270 LogInfo(
"FastCalorimetry") <<
" FamosHDShower : too small ECAL and HCAL depths - " <<
" particle is lost !!! " << std::endl;
275 LogInfo(
"FastCalorimetry") <<
" FamosHDShower depths(lam) - " << std::endl
277 <<
" GAP = " << depthGAP << std::endl
279 <<
" starting point = " << depthStart << std::endl;
282 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : onECAL" << std::endl;
284 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : depthStart < depthECAL" << std::endl;
286 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : enough space to make ECAL step" << std::endl;
302 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : " <<
" in ECAL sum1, sum2 " << sum1 <<
" " << sum2 << std::endl;
312 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : goto HCAL" << std::endl;
323 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : goto HCAL" << std::endl;
327 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : forward" << std::endl;
332 for (
int i = 0;
i < nmoresteps ;
i++) {
357 std::vector<double>
temp;
360 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::makeSteps - "
361 <<
" nsteps required : " << nsteps << std::endl;
364 for (
int i = 0;
i < nsteps;
i++) {
369 double y =
betHD * deplam;
372 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::makeSteps "
374 <<
" depx0, x = " << depx0 <<
", " << x
375 <<
" deplam, y = " << deplam <<
", "
384 LogInfo(
"FastCalorimetry") <<
"*** FamosHDShower::makeSteps " <<
" - negative step energy !!!"
392 int nPest = (int) (est *
e / sum /
eSpotSize) ;
395 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::makeSteps - nPoints estimate = "
396 << nPest << std::endl;
398 if(nPest <= 1 && count !=0 )
break;
412 double oldECALenergy = temp[0];
413 double oldHCALenergy = sumes - oldECALenergy ;
414 double newECALenergy = 2. * sumes;
415 for (
int i = 0; newECALenergy > sumes &&
i <
infinity;
i++)
419 LogInfo(
"FastCalorimetry") <<
"*** FamosHDShower::makeSteps " <<
" ECAL fraction : old/new - "
420 << oldECALenergy/sumes <<
"/" << newECALenergy/sumes << std::endl;
422 temp[0] = newECALenergy;
423 double newHCALenergy = sumes - newECALenergy;
424 double newHCALreweight = newHCALenergy / oldHCALenergy;
427 temp[
i] *= newHCALreweight;
434 eStep.push_back(temp[
i] *
e / sumes );
441 <<
" xO and lamdepth at the end of step = "
455 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::makeSteps - " <<
"ECAL energy = " <<
eStep[0]
456 <<
" out of total = " <<
e << std::endl;
466 int numLongit =
eStep.size();
468 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - "
469 <<
" N_long.steps required : " << numLongit << std::endl;
475 std::vector<double> Fhist;
476 std::vector<double> rhist;
480 if(
debug == 3)
LogInfo(
"FastCalorimetry") <<
"indexFinder - i, Fhist[i] = " << j <<
" " << Fhist[
j] << std::endl;
484 for (
int i = 0;
i < numLongit ;
i++) {
489 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - detector = " <<
detector[
i] <<
" currentDepthL0 = " << currentDepthL0 << std::endl;
492 double rbinsize = maxTRsize /
nTRsteps;
495 if(espot > 2. || espot < 0. )
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - unphysical espot = " << espot << std::endl;
501 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - status of " <<
" theHcalHitMaker->setDepth(currentDepthL0) is "
502 << setHDdepth << std::endl;
509 if(!setHDdepth)
continue;
516 if (!
dbe->
get(
"HDShower/LongitudinalShapeHCAL")) {}
531 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - status of Grid = " << status << std::endl;
533 if(!status)
continue;
538 espot *= 0.1 * (double)ntry /
double(
nspots[
i]);
551 if (!
dbe->
get(
"HDShower/LongitudinalShapeECAL")) {}
556 dbe->
get(
"HDShower/LongitudinalShapeECAL")->
Fill(currentDepthL0, 1/
e*
eStep[
i]/dt);
567 if(
nspots[
i] > inf )
std::cout <<
" FamosHDShower::compute - at long.step " <<
i <<
" too many spots required : " <<
nspots[
i] <<
" !!! " << std::endl;
569 for (
int j = 0;
j <
inf;
j++) {
578 if(
debug == 2)
LogInfo(
"FastCalorimetry") << std::endl <<
" FamosHDShower::compute " <<
" r = " << radius
579 <<
" phi = " << phi << std::endl;
585 if(
debug == 2)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - " <<
" theGrid->addHit result = " << result << std::endl;
590 if (!
dbe->
get(
"HDShower/TransverseShapeECAL")) {}
594 dbe->
get(
"HDShower/TransverseShapeECAL")->
Fill(radius,1/
e*espot/drho);
601 if(
debug == 2)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - " <<
" theHcalHitMaker->addHit result = " << result << std::endl;
606 if (!
dbe->
get(
"HDShower/TransverseShapeHCAL")) {}
610 dbe->
get(
"HDShower/TransverseShapeHCAL")->
Fill(radius,1/
e*espot/drho);
623 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute " <<
" maximum number of"
624 <<
" transverse points " << count <<
" is used !!!" << std::endl;
627 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute " <<
" long.step No."
628 <<
i <<
" Ntry, Nok = " << count <<
" " << nok << std::endl;
638 int size = Fhist.size();
646 for (iter = 0; iter <
size ; iter++) {
648 if( curr >= size || curr < 1 )
649 LogWarning(
"FastCalorimetry") <<
" FamosHDShower::indexFinder - wrong current index = "
650 << curr <<
" !!!" << std::endl;
652 if ((x <= Fhist[curr]) && (x > Fhist[curr-1]))
break;
654 if(x > Fhist[curr]) {actudir = 1;}
656 if(prevdir * actudir < 0) {
if(step > 1) step /= 2;}
657 curr += actudir *
step;
658 if(curr > size) curr =
size;
659 else {
if(curr < 1) {curr = 1;}}
662 LogInfo(
"FastCalorimetry") <<
" indexFinder - end of iter." << iter
663 <<
" curr, F[curr-1], F[curr] = "
664 << curr <<
" " << Fhist[curr-1] <<
" " << Fhist[curr] << std::endl;
669 LogInfo(
"FastCalorimetry") <<
" indexFinder x = " << x <<
" found index = " << curr-1
void setSpotEnergy(double e)
Set the spot energy.
bool addHit(double r, double phi, unsigned layer=0)
void setSpotEnergy(double e)
double radLenIncm() const
Radiation length in cm.
HDShower(const RandomEngine *engine, HDShowerParametrization *myParam, EcalHitMaker *myGrid, HcalHitMaker *myHcalHitMaker, int onECAL, double epart, DQMStore *const dbeIn)
const ECALProperties * theECALproperties
void cd(void)
go to top directory (ie. root)
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
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
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
double flatShoot(double xmin=0.0, double xmax=1.0) const
std::vector< double > lamtotal
bool getPads(double depth, bool inCm=false)
const RandomEngine * random
const HCALProperties * hcalProperties() const
double getHDcriticalEnergy() const
const ECALProperties * ecalProperties() const
double getHDmaxTRfactor() const
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