44 m_energyLossMeasurement(true),
45 m_forceIsolationFailure(false),
47 m_MOPparametrization(true),
48 m_trackIsolation(false),
56 declareInterface<IMuidCaloEnergy>(
this);
78 ATH_MSG_INFO(
"Initializing MuidCaloEnergyTool - measured calorimeter energy deposition ");
80 ATH_MSG_INFO(
"Initializing MuidCaloEnergyTool - parametrized calorimeter energy deposition ");
103 return StatusCode::SUCCESS;
111 return StatusCode::SUCCESS;
117 std::unique_ptr<CaloEnergy> caloEnergy;
120 std::unique_ptr<CaloMeas> caloMeas{
m_caloMeasTool->energyMeasurement(ctx, eta, phi, eta, phi)};
137 std::string eLossType =
" no Calo !!";
147 <<
" energyLoss with"
149 <<
" phi =" << std::setw(6) << std::setprecision(3) << phi <<
" eta =" << std::setw(6) << std::setprecision(3)
150 << eta <<
". CaloEnergy: deltaE = " << std::setw(8) << std::setprecision(3) << caloEnergy->
deltaE() /
Units::GeV
153 << std::setprecision(3) << caloEnergy->
sigmaDeltaE() /
Units::GeV <<
") GeV, CaloEnergy::Type " << eLossType);
163 << middleParameters.
position().phi() <<
" Eta = " << middleParameters.
position().eta());
165 std::unique_ptr<CaloEnergy> caloEnergy;
168 const double eta = middleParameters.
position().eta();
169 const double phi = middleParameters.
position().phi();
170 const double etaEM = innerParameters ? innerParameters->
position().eta() : eta;
171 const double phiEM = innerParameters ? innerParameters->
position().phi() : phi;
172 const double etaHad = outerParameters ? outerParameters->
position().eta() : eta;
173 const double phiHad = outerParameters ? outerParameters->
position().phi() : phi;
174 std::unique_ptr<CaloMeas> caloMeas{
m_caloMeasTool->energyMeasurement(ctx, etaEM, phiEM, etaHad, phiHad)};
175 if (caloMeas) { caloEnergy =
measurement(ctx, middleParameters.
momentum().mag(), eta, phi, *caloMeas); }
188 <<
" eta " << middleParameters.
position().eta());
191 std::bitset<Trk::MaterialEffectsBase::NumberOfMaterialEffectsTypes> typePattern(0);
197 std::unique_ptr<Trk::TrackParameters> middle_clone = middleParameters.
uniqueClone();
199 const CaloEnergy* calo_observer = caloEnergy.get();
200 auto materialEffects =
201 std::make_unique<Trk::MaterialEffectsOnTrack>(
203 std::move(caloEnergy),
208 std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes>
pattern(0);
213 std::string eLossType =
" no Calo !!";
223 <<
" trackStateOnSurface with"
224 <<
" momentum =" << std::setw(6) << std::setprecision(1) << middleParameters.
momentum().mag() /
Units::GeV
225 <<
" phi =" << std::setw(6) << std::setprecision(3) << middleParameters.
position().phi()
226 <<
" eta =" << std::setw(6) << std::setprecision(3) << middleParameters.
position().eta()
227 <<
". CaloEnergy: deltaE = " << std::setw(8) << std::setprecision(3) << calo_observer->
deltaE() /
Units::GeV
230 << std::setprecision(3) << calo_observer->
sigmaDeltaE() /
Units::GeV <<
") GeV, CaloEnergy::Type " << eLossType);
232 return std::make_unique<Trk::TrackStateOnSurface>(
233 nullptr, std::move(middle_clone), std::move(materialEffects),
pattern);
254 double MopLoss = std::abs(caloParamMop->deltaE());
256 double MopError = mopPeak->sigmaDeltaE();
267 double MaterialCorrection =
InertMaterial * MopLossCorrected;
282 double ForwardHECCorrection = 0.;
284 ForwardHECCorrection = (1. - LArHECMeasurementMaterial) * HECMaterial * MopLossCorrected;
287 double TotalMeasuredEnergy = TileEnergy + EmEnergy + LArHECEnergy;
290 <<
",EM= " << EmEnergy /
Units::GeV <<
" ForwardHECCorrection "
291 << ForwardHECCorrection /
Units::GeV <<
" HECMaterial " << HECMaterial
292 <<
" MopLossCorrected " << MopLossCorrected /
Units::GeV);
298 if (std::abs(eta) < 1.4) {
299 if (LArHECEnergy + TileEnergy > 0.1 * MopLoss * HECMaterial) bHEC =
true;
300 }
else if (std::abs(eta) > 1.8) {
301 if (LArHECEnergy + TileEnergy > 0.2 * MopLoss * HECMaterial) bHEC =
true;
303 if (LArHECEnergy + TileEnergy > 0.25 * MopLoss * HECMaterial) bHEC =
true;
305 if (EmEnergy > 0.5 * MopLoss * EmMaterial) bEM =
true;
316 double MeasCorrected = TotalMeasuredEnergy + MaterialCorrection;
321 const double IonizationLoss = (1. / 1.4) * std::abs(caloParamMip->deltaE());
323 double eOverMipCorrectionEm = 0.;
324 double eOverMipCorrectionHEC = 0.;
329 const double emipEM = 0.78;
330 eOverMipCorrectionEm = -(1. / emipEM - 1.) * IonizationLoss * EmMaterial * LArEmMeasurementMaterial;
331 if (EmEnergy + eOverMipCorrectionEm < 0.) eOverMipCorrectionEm = 0.;
334 const double emipTile = 0.86;
335 const double emipLAr = 0.94;
336 const double HECEnergy = TileEnergy + LArHECEnergy;
337 const double eOverMipCorrectionTile =
338 -(1. / emipTile - 1.) * TileEnergy / HECEnergy * IonizationLoss * HECMaterial * TileMeasurementMaterial;
339 const double eOverMipCorrectionLAr =
340 -(1. / emipLAr - 1.) * LArHECEnergy / HECEnergy * IonizationLoss * HECMaterial * LArHECMeasurementMaterial;
341 eOverMipCorrectionHEC = eOverMipCorrectionTile + eOverMipCorrectionLAr;
342 if (LArHECEnergy + TileEnergy + eOverMipCorrectionHEC < 0.) eOverMipCorrectionHEC = 0.;
344 const double eOverMipCorrection = eOverMipCorrectionEm + eOverMipCorrectionHEC;
348 constexpr
double fix1FromPeter[26] = {0.424104, 0.479637, 0.483419, 0.490242, 0.52806, 0.573582, 0.822098,
349 0.767301, 0.809919, 0.658745, 0.157187, 0.413214, 0.771074, 0.61815,
350 0.350113, 0.322785, 0.479294, 0.806183, 0.822161, 0.757731, -0.0857186,
351 -0.0992693, -0.0492252, 0.0650174, 0.261538, 0.360413};
353 constexpr
double fix2FromPeter[26] = {-0.647703, -0.303498, -0.268645, -0.261292, -0.260152, -0.269253, -0.266212,
354 -0.240837, -0.130172, -0.111638, -0.329423, -0.321011, -0.346050, -0.305592,
355 -0.313293, -0.317111, -0.428393, -0.524839, -0.599547, -0.464013, -0.159663,
356 -0.140879, -0.0975618, 0.0225352, 0.0701925, -0.24778};
357 int ieta =
static_cast<int>(std::abs(eta) / 0.10);
358 if (ieta > 25) ieta = 25;
359 double FinalMeasuredEnergy = MeasCorrected + eOverMipCorrection + (fix1FromPeter[ieta] + fix2FromPeter[ieta]) *
Units::GeV;
362 << TotalMeasuredEnergy /
Units::GeV <<
" corrected energy deposition " << MeasCorrected /
Units::GeV
363 <<
" e/mip corre " << FinalMeasuredEnergy /
Units::GeV << std::endl
364 <<
"\nFinal Energy Measurement = "
368 <<
"\nMop Energy Deposition = " << MopLoss /
Units::GeV <<
" +- "
380 const double sinTheta = 1. / std::cosh(eta);
383 constexpr
double OneOver85 = 1. / 85;
384 constexpr
double FifteenGeV = 15. *
Units::GeV;
396 nTracks = inner.first;
398 if (pT < 100. * Units::GeV && nTracks >
m_maxNTracksIso) PassCut =
false;
402 <<
", nTracks= " << nTracks <<
",PassCut= " << PassCut);
405 std::unique_ptr<CaloEnergy> caloEnergy;
409 if (FinalMeasuredEnergy < MopLoss + 2. * MopError && FinalMeasuredEnergy >
m_minFinalEnergy) {
411 caloEnergy.swap(mopPeak);
412 }
else if (PassCut) {
421 double FinalEnergyErrorMinus = FinalEnergyErrorPlus;
425 FinalEnergyErrorMinus = FinalEnergyErrorPlus = 0.50 * std::sqrt(FinalMeasuredEnergy /
Units::GeV) *
Units::GeV;
427 double FinalEnergyError = 0.5 * (FinalEnergyErrorMinus + FinalEnergyErrorPlus);
429 caloEnergy = std::make_unique<CaloEnergy>(FinalMeasuredEnergy, FinalEnergyError, FinalEnergyErrorMinus,
430 FinalEnergyErrorPlus, lossType);
435 double FinalMeasuredEnergyNoEm = FinalMeasuredEnergy - EmEnergy + MopLossEm;
438 ATH_MSG_VERBOSE(
" CaloEnergy FSR : EmEnergy " << EmEnergy <<
" FinalMeasuredEnergy " << FinalMeasuredEnergy
439 <<
" MopLossEm " << MopLossEm <<
" MopErrorEm " << MopErrorEm
440 <<
" FinalMeasuredEnergyNoEm " << FinalMeasuredEnergyNoEm);
441 if (FinalMeasuredEnergyNoEm < MopLoss + 2. * MopError) {
447 std::make_unique<CaloEnergy>(caloParamMop->deltaE(), caloParamMop->sigmaDeltaE(),
448 caloParamMop->sigmaMinusDeltaE(), caloParamMop->sigmaPlusDeltaE(), lossType);
452 std::make_unique<CaloEnergy>(caloParamMean->deltaE(), caloParamMean->sigmaDeltaE(),
453 caloParamMean->sigmaMinusDeltaE(), caloParamMean->sigmaPlusDeltaE(), lossType);
455 ATH_MSG_VERBOSE(
" CaloEnergy FSR : Small deposit, FinalMeasuredEnergyNoEm " << FinalMeasuredEnergyNoEm
456 <<
" using Eloss " << caloEnergy->
deltaE());
461 double FinalEnergyErrorNoEm = 0.50 * std::sqrt(FinalMeasuredEnergyNoEm /
Units::GeV) *
Units::GeV;
462 FinalEnergyErrorNoEm = std::hypot(FinalEnergyErrorNoEm, MopErrorEm);
463 caloEnergy = std::make_unique<CaloEnergy>(FinalMeasuredEnergyNoEm, FinalEnergyErrorNoEm, FinalEnergyErrorNoEm,
464 FinalEnergyErrorNoEm, lossType);
465 ATH_MSG_VERBOSE(
" CaloEnergy FSR : Large deposit, FinalMeasuredEnergyNoEm " << FinalMeasuredEnergyNoEm);
472 caloEnergy = std::make_unique<CaloEnergy>(caloParamMop->deltaE(), caloParamMop->sigmaDeltaE(),
473 caloParamMop->sigmaMinusDeltaE(), caloParamMop->sigmaPlusDeltaE(), lossType);
476 caloEnergy = std::make_unique<CaloEnergy>(caloParamMean->deltaE(), caloParamMean->sigmaDeltaE(),
477 caloParamMean->sigmaMinusDeltaE(), caloParamMean->sigmaPlusDeltaE(), lossType);
489 if (std::abs(eta) < 1.) {
492 }
else if (std::abs(eta) > 1. && std::abs(eta) < 2.) {
499 return std::hypot(
a, (
b *
pT));
503 const double Nsigma = 2.;
506 double sigma = std::hypot(MSsigma, MopLossSigma);
509 double xlow = MopLoss - Nsigma *
sigma;
510 if (xlow < 0.) xlow = 0.;
511 double xup = MopLoss + Nsigma *
sigma;
513 const double inv_Na = 1. /
static_cast<double>(Na);
514 for (
int j = 0; j < Na; ++j) {
515 double x = xlow + j * (xup - xlow) * inv_Na;
516 double w =
landau(
x, MopLoss, MopLossSigma,
true);
529 constexpr
double p1[5] = {0.4259894875, -0.1249762550, 0.03984243700, -0.006298287635, 0.001511162253};
530 constexpr
double q1[5] = {1.0, -0.3388260629, 0.09594393323, -0.01608042283, 0.003778942063};
532 constexpr
double p2[5] = {0.1788541609, 0.1173957403, 0.01488850518, -0.001394989411, 0.0001283617211};
533 constexpr
double q2[5] = {1.0, 0.7428795082, 0.3153932961, 0.06694219548, 0.008790609714};
535 constexpr
double p3[5] = {0.1788544503, 0.09359161662, 0.006325387654, 0.00006611667319, -0.000002031049101};
536 constexpr
double q3[5] = {1.0, 0.6097809921, 0.2560616665, 0.04746722384, 0.006957301675};
538 constexpr
double p4[5] = {0.9874054407, 118.6723273, 849.2794360, -743.7792444, 427.0262186};
539 constexpr
double q4[5] = {1.0, 106.8615961, 337.6496214, 2016.712389, 1597.063511};
541 constexpr
double p5[5] = {1.003675074, 167.5702434, 4789.711289, 21217.86767, -22324.94910};
542 constexpr
double q5[5] = {1.0, 156.9424537, 3745.310488, 9834.698876, 66924.28357};
544 constexpr
double p6[5] = {1.000827619, 664.9143136, 62972.92665, 475554.6998, -5743609.109};
545 constexpr
double q6[5] = {1.0, 651.4101098, 56974.73333, 165917.4725, -2815759.939};
547 constexpr
double a1[3] = {0.04166666667, -0.01996527778, 0.02709538966};
549 constexpr
double a2[2] = {-1.845568670, -4.284640743};
551 if (
sigma <= 0)
return 0.;
553 double u, ue, us, den;
556 if (
u < 1
e-10)
return 0.0;
559 den = 0.3989422803 * (ue / us) * (1 + (a1[0] + (a1[1] + a1[2] *
u) *
u) *
u);
562 den =
exp(-
u) * std::sqrt(
u) * (
p1[0] + (
p1[1] + (
p1[2] + (
p1[3] +
p1[4] *
v) *
v) *
v) *
v) /
563 (q1[0] + (q1[1] + (q1[2] + (q1[3] + q1[4] *
v) *
v) *
v) *
v);
565 den = (
p2[0] + (
p2[1] + (
p2[2] + (
p2[3] +
p2[4] *
v) *
v) *
v) *
v) /
566 (q2[0] + (q2[1] + (q2[2] + (q2[3] + q2[4] *
v) *
v) *
v) *
v);
568 den = (
p3[0] + (
p3[1] + (
p3[2] + (
p3[3] +
p3[4] *
v) *
v) *
v) *
v) /
569 (q3[0] + (q3[1] + (q3[2] + (q3[3] + q3[4] *
v) *
v) *
v) *
v);
572 den =
u *
u * (p4[0] + (p4[1] + (p4[2] + (p4[3] + p4[4] *
u) *
u) *
u) *
u) /
573 (q4[0] + (q4[1] + (q4[2] + (q4[3] + q4[4] *
u) *
u) *
u) *
u);
576 den =
u *
u * (p5[0] + (p5[1] + (p5[2] + (p5[3] + p5[4] *
u) *
u) *
u) *
u) /
577 (q5[0] + (q5[1] + (q5[2] + (q5[3] + q5[4] *
u) *
u) *
u) *
u);
578 }
else if (
v < 300) {
580 den =
u *
u * (p6[0] + (p6[1] + (p6[2] + (p6[3] + p6[4] *
u) *
u) *
u) *
u) /
581 (q6[0] + (q6[1] + (q6[2] + (q6[3] + q6[4] *
u) *
u) *
u) *
u);
584 den =
u *
u * (1 + (a2[0] + a2[1] *
u) *
u);
586 if (!
norm)
return den;