28 #define infinity 10000
44 theHcalHitMaker(myHcalHitMaker),
88 if (!
dbe->
get(
"HDShower/ParticlesEnergy")) {}
90 dbe->
get(
"HDShower/ParticlesEnergy")->
Fill(log10(
e));
102 if(
e < emin) effective = emin;
108 if(effective > 0.5 * emax) {
110 if(effective > emax) {
114 if(effective > 1000.)
120 LogInfo(
"FastCalorimetry") <<
" HDShower : " << std::endl
121 <<
" Energy " <<
e << std::endl
122 <<
" lossesOpt " <<
lossesOpt << std::endl
124 <<
" nTRsteps " <<
nTRsteps << std::endl
126 <<
" eSpotSize " <<
eSpotSize << std::endl
129 <<
" balanceEH " <<
balanceEH << std::endl
154 LogInfo(
"FastCalorimetry") <<
" HDShower : " << std::endl
155 <<
" edpar " << edpar <<
" aedep " << aedep << std::endl
156 <<
" alpEM1 " << alpEM1 << std::endl
157 <<
" alpEM2 " << alpEM2 << std::endl
158 <<
" betEM1 " << betEM1 << std::endl
159 <<
" betEM2 " << betEM2 << std::endl
160 <<
" alpHD1 " << alpHD1 << std::endl
161 <<
" alpHD2 " << alpHD2 << std::endl
162 <<
" betHD1 " << betHD1 << std::endl
163 <<
" betHD2 " << betHD2 << std::endl
164 <<
" part1 " << part1 << std::endl
165 <<
" part2 " << part2 << std::endl;
172 alpEM = alpEM1 + alpEM2 * aedep;
174 betEM = betEM1 - betEM2 * aedep;
175 alpHD = alpHD1 + alpHD2 * aedep;
177 betHD = betHD1 - betHD2 * aedep;
178 part = part1 - part2 * aedep;
182 LogInfo(
"FastCalorimetry") <<
" HDShower : " << std::endl
183 <<
" alpEM " <<
alpEM << std::endl
184 <<
" tgamEM " <<
tgamEM << std::endl
185 <<
" betEM " <<
betEM << std::endl
186 <<
" alpHD " <<
alpHD << std::endl
187 <<
" tgamHD " <<
tgamHD << std::endl
188 <<
" betHD " <<
betHD << std::endl
189 <<
" part " <<
part << std::endl;
204 LogInfo(
"FastCalorimetry") <<
" HDShower e " <<
e << std::endl
205 <<
" x0EM = " <<
x0EM << std::endl
206 <<
" x0HD = " <<
x0HD << std::endl
207 <<
" lamEM = " <<
lambdaEM << std::endl
208 <<
" lamHD = " <<
lambdaHD << std::endl;
253 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : e <emin -> depthStart = 0" << std::endl;
257 if(depthStart > maxDepth) {
258 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : depthStart too big ... = " << depthStart << std::endl;
260 if(depthStart < 0.) depthStart = 0.;
261 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : depthStart re-calculated = " << depthStart << std::endl;
264 if(onECAL &&
e < emid) {
267 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : small energy, " <<
" depthStart reduced to = " << depthStart << std::endl;
272 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : depthHCAL too small ... = " <<
depthHCAL <<
" depthStart -> forced to 0 !!!" << std::endl;
278 LogInfo(
"FastCalorimetry") <<
" FamosHDShower : too small ECAL and HCAL depths - " <<
" particle is lost !!! " << std::endl;
283 LogInfo(
"FastCalorimetry") <<
" FamosHDShower depths(lam) - " << std::endl
285 <<
" GAP = " << depthGAP << std::endl
287 <<
" starting point = " << depthStart << std::endl;
290 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : onECAL" << std::endl;
292 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : depthStart < depthECAL" << std::endl;
294 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : enough space to make ECAL step" << std::endl;
310 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : " <<
" in ECAL sum1, sum2 " << sum1 <<
" " << sum2 << std::endl;
320 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : goto HCAL" << std::endl;
331 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : goto HCAL" << std::endl;
335 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower : forward" << std::endl;
340 for (
int i = 0;
i < nmoresteps ;
i++) {
365 std::vector<double>
temp;
368 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::makeSteps - "
369 <<
" nsteps required : " << nsteps << std::endl;
372 for (
int i = 0;
i < nsteps;
i++) {
377 double y =
betHD * deplam;
380 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::makeSteps "
382 <<
" depx0, x = " << depx0 <<
", " << x
383 <<
" deplam, y = " << deplam <<
", "
392 LogInfo(
"FastCalorimetry") <<
"*** FamosHDShower::makeSteps " <<
" - negative step energy !!!"
400 int nPest = (int) (est *
e / sum /
eSpotSize) ;
403 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::makeSteps - nPoints estimate = "
404 << nPest << std::endl;
406 if(nPest <= 1 && count !=0 )
break;
420 double oldECALenergy = temp[0];
421 double oldHCALenergy = sumes - oldECALenergy ;
422 double newECALenergy = 2. * sumes;
423 for (
int i = 0; newECALenergy > sumes &&
i <
infinity;
i++)
427 LogInfo(
"FastCalorimetry") <<
"*** FamosHDShower::makeSteps " <<
" ECAL fraction : old/new - "
428 << oldECALenergy/sumes <<
"/" << newECALenergy/sumes << std::endl;
430 temp[0] = newECALenergy;
431 double newHCALenergy = sumes - newECALenergy;
432 double newHCALreweight = newHCALenergy / oldHCALenergy;
435 temp[
i] *= newHCALreweight;
442 eStep.push_back(temp[
i] *
e / sumes );
449 <<
" xO and lamdepth at the end of step = "
463 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::makeSteps - " <<
"ECAL energy = " <<
eStep[0]
464 <<
" out of total = " <<
e << std::endl;
474 int numLongit =
eStep.size();
476 LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - "
477 <<
" N_long.steps required : " << numLongit << std::endl;
483 std::vector<double> Fhist;
484 std::vector<double> rhist;
488 if(
debug == 3)
LogInfo(
"FastCalorimetry") <<
"indexFinder - i, Fhist[i] = " << j <<
" " << Fhist[
j] << std::endl;
492 for (
int i = 0;
i < numLongit ;
i++) {
497 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - detector = " <<
detector[
i] <<
" currentDepthL0 = " << currentDepthL0 << std::endl;
500 double rbinsize = maxTRsize /
nTRsteps;
503 if(espot > 2. || espot < 0. )
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - unphysical espot = " << espot << std::endl;
509 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - status of " <<
" theHcalHitMaker->setDepth(currentDepthL0) is "
510 << setHDdepth << std::endl;
517 if(!setHDdepth)
continue;
524 if (!
dbe->
get(
"HDShower/LongitudinalShapeHCAL")) {}
539 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - status of Grid = " << status << std::endl;
541 if(!status)
continue;
546 espot *= 0.1 * (double)ntry /
double(
nspots[
i]);
559 if (!
dbe->
get(
"HDShower/LongitudinalShapeECAL")) {}
564 dbe->
get(
"HDShower/LongitudinalShapeECAL")->
Fill(currentDepthL0, 1/
e*
eStep[
i]/dt);
575 if(
nspots[
i] > inf )
std::cout <<
" FamosHDShower::compute - at long.step " <<
i <<
" too many spots required : " <<
nspots[
i] <<
" !!! " << std::endl;
577 for (
int j = 0;
j <
inf;
j++) {
586 if(
debug == 2)
LogInfo(
"FastCalorimetry") << std::endl <<
" FamosHDShower::compute " <<
" r = " << radius
587 <<
" phi = " << phi << std::endl;
593 if(
debug == 2)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - " <<
" theGrid->addHit result = " << result << std::endl;
598 if (!
dbe->
get(
"HDShower/TransverseShapeECAL")) {}
602 dbe->
get(
"HDShower/TransverseShapeECAL")->
Fill(radius,1/
e*espot/drho);
609 if(
debug == 2)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute - " <<
" theHcalHitMaker->addHit result = " << result << std::endl;
614 if (!
dbe->
get(
"HDShower/TransverseShapeHCAL")) {}
618 dbe->
get(
"HDShower/TransverseShapeHCAL")->
Fill(radius,1/
e*espot/drho);
631 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute " <<
" maximum number of"
632 <<
" transverse points " << count <<
" is used !!!" << std::endl;
635 if(
debug)
LogInfo(
"FastCalorimetry") <<
" FamosHDShower::compute " <<
" long.step No."
636 <<
i <<
" Ntry, Nok = " << count <<
" " << nok << std::endl;
646 int size = Fhist.size();
654 for (iter = 0; iter <
size ; iter++) {
656 if( curr >= size || curr < 1 )
657 LogWarning(
"FastCalorimetry") <<
" FamosHDShower::indexFinder - wrong current index = "
658 << curr <<
" !!!" << std::endl;
660 if ((x <= Fhist[curr]) && (x > Fhist[curr-1]))
break;
662 if(x > Fhist[curr]) {actudir = 1;}
664 if(prevdir * actudir < 0) {
if(step > 1) step /= 2;}
665 curr += actudir *
step;
666 if(curr > size) curr =
size;
667 else {
if(curr < 1) {curr = 1;}}
670 LogInfo(
"FastCalorimetry") <<
" indexFinder - end of iter." << iter
671 <<
" curr, F[curr-1], F[curr] = "
672 << curr <<
" " << Fhist[curr-1] <<
" " << Fhist[curr] << std::endl;
677 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 flatShoot(double xmin=0.0, double xmax=1.0) const
double radLenIncm() const
Radiation length in cm.
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
HDShower(const RandomEngineAndDistribution *engine, HDShowerParametrization *myParam, EcalHitMaker *myGrid, HcalHitMaker *myHcalHitMaker, int onECAL, double epart, double pmip, DQMStore *const dbeIn)
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