29 "faBarrel",
"[0]+((([1]+([2]/sqrt(x)))*exp(-(x^[6]/[3])))-([4]*exp(-(x^[7]/[5]))))", 0., 1000.);
34 faBarrel->SetParameter(4, 0.0613696);
35 faBarrel->SetParameter(5, 0.000104857);
37 faBarrel->SetParameter(7, -0.743082);
39 "fbBarrel",
"[0]+((([1]+([2]/sqrt(x)))*exp(-(x^[6]/[3])))-([4]*exp(-(x^[7]/[5]))))", 0., 1000.);
47 fbBarrel->SetParameter(7, -0.607392);
49 "fcBarrel",
"[0]+((([1]+([2]/sqrt(x)))*exp(-(x^[6]/[3])))-([4]*exp(-(x^[7]/[5]))))", 0., 1000.);
50 fcBarrel->SetParameter(0, 1.5125962);
55 fcBarrel->SetParameter(5, 0.0291232);
58 faEtaBarrelEH = std::make_unique<TF1>(
"faEtaBarrelEH",
"[0]+[1]*exp(-x/[2])", 0., 1000.);
62 fbEtaBarrelEH = std::make_unique<TF1>(
"fbEtaBarrelEH",
"[0]+[1]*exp(-x/[2])", 0., 1000.);
66 faEtaBarrelH = std::make_unique<TF1>(
"faEtaBarrelH",
"[0]+[1]*x", 0., 1000.);
69 fbEtaBarrelH = std::make_unique<TF1>(
"fbEtaBarrelH",
"[0]+[1]*exp(-x/[2])", 0., 1000.);
75 "faEndcap",
"[0]+((([1]+([2]/sqrt(x)))*exp(-(x^[6]/[3])))-([4]*exp(-(x^[7]/[5]))))", 0., 1000.);
80 faEndcap->SetParameter(4, 0.0426363);
85 "fbEndcap",
"[0]+((([1]+([2]/sqrt(x)))*exp(-(x^[6]/[3])))-([4]*exp(-(x^[7]/[5]))))", 0., 1000.);
86 fbEndcap->SetParameter(0, -0.974251);
88 fbEndcap->SetParameter(2, 0.0629183);
90 fbEndcap->SetParameter(4, -0.774289);
95 "fcEndcap",
"[0]+((([1]+([2]/sqrt(x)))*exp(-(x^[6]/[3])))-([4]*exp(-(x^[7]/[5]))))", 0., 1000.);
100 fcEndcap->SetParameter(4, 0.810195);
101 fcEndcap->SetParameter(5, 0.234134);
103 fcEndcap->SetParameter(7, -0.0997326);
104 faEtaEndcapEH = std::make_unique<TF1>(
"faEtaEndcapEH",
"[0]+[1]*exp(-x/[2])", 0., 1000.);
108 fbEtaEndcapEH = std::make_unique<TF1>(
"fbEtaEndcapEH",
"[0]+[1]*exp(-x/[2])", 0., 1000.);
112 faEtaEndcapH = std::make_unique<TF1>(
"faEtaEndcapH",
"[0]+[1]*exp(-x/[2])+[3]*[3]*exp(-x*x/([4]*[4]))", 0., 1000.);
118 fbEtaEndcapH = std::make_unique<TF1>(
"fbEtaEndcapH",
"[0]+[1]*exp(-x/[2])+[3]*[3]*exp(-x*x/([4]*[4]))", 0., 1000.);
127 fcEtaBarrelH = std::make_unique<TF1>(
"fcEtaBarrelH",
"[3]*((x-[0])^[1])+[2]", 0., 1000.);
133 fcEtaEndcapH = std::make_unique<TF1>(
"fcEtaEndcapH",
"[3]*((x-[0])^[1])+[2]", 0., 1000.);
139 fdEtaEndcapH = std::make_unique<TF1>(
"fdEtaEndcapH",
"[3]*((x-[0])^[1])+[2]", 0., 1000.);
145 fcEtaBarrelEH = std::make_unique<TF1>(
"fcEtaBarrelEH",
"[3]*((x-[0])^[1])+[2]", 0., 1000.);
151 fcEtaEndcapEH = std::make_unique<TF1>(
"fcEtaEndcapEH",
"[3]*((x-[0])^[1])+[2]", 0., 1000.);
157 fdEtaEndcapEH = std::make_unique<TF1>(
"fdEtaEndcapEH",
"[3]*((x-[0])^[1])+[2]", 0., 1000.);
171 double etaCorrE = 1.;
172 double etaCorrH = 1.;
174 t =
min(999.9,
max(tt, e + h));
186 if (a < -0.25 || b < -0.25) {
193 t =
min(999.9,
max(tt, thresh + a * e + b * h));
196 if (e > 0. && thresh > 0.) {
203 if (e > 0. && thresh > 0.)
205 if (h > 0. && thresh > 0.) {
217 if (a < -0.25 || b < -0.25) {
224 t =
min(999.9,
max(tt, thresh + a * e + b * h));
228 double etaPow = dEta * dEta * dEta *
dEta;
230 if (e > 0. && thresh > 0.) {
249 if (e > 0. && thresh > 0.)
251 if (h > 0. && thresh > 0.) {
257 if (e < 0. || h < 0.) {
490 std::vector<double>& EclustersPS1,
491 std::vector<double>& EclustersPS2,
492 bool crackCorrection)
const {
493 double ePS1(std::accumulate(EclustersPS1.begin(), EclustersPS1.end(), 0.0));
494 double ePS2(std::accumulate(EclustersPS2.begin(), EclustersPS2.end(), 0.0));
495 return energyEm(clusterEcal, ePS1, ePS2, crackCorrection);
501 bool crackCorrection)
const {
502 double eEcal = clusterEcal.
energy();
509 double calibrated =
Ecorr(eEcal, ePS1, ePS2, eta, phi, crackCorrection);
515 std::vector<double>& EclustersPS1,
516 std::vector<double>& EclustersPS2,
519 bool crackCorrection)
const {
520 double ePS1(std::accumulate(EclustersPS1.begin(), EclustersPS1.end(), 0.0));
521 double ePS2(std::accumulate(EclustersPS2.begin(), EclustersPS2.end(), 0.0));
522 return energyEm(clusterEcal, ePS1, ePS2, ps1, ps2, crackCorrection);
529 bool crackCorrection)
const {
530 double eEcal = clusterEcal.
energy();
537 double calibrated =
Ecorr(eEcal, ePS1, ePS2, eta, phi, ps1, ps2, crackCorrection);
546 out <<
"PFEnergyCalibration -- " << endl;
549 static const std::map<std::string, PerformanceResult::ResultType> functType = {
573 for (std::map<std::string, PerformanceResult::ResultType>::const_iterator
func = functType.begin();
574 func != functType.end();
576 cout <<
"Function: " <<
func->first << endl;
582 std::cout <<
"Default calibration functions : " << std::endl;
633 std::vector<double> fillcPhi() {
634 std::vector<double> retValue;
635 retValue.resize(18, 0);
636 retValue[0] = 2.97025;
637 for (
unsigned i = 1;
i <= 17; ++
i)
638 retValue[
i] = retValue[0] - 2 *
i * pi / 18;
644 const std::vector<double> cPhi = fillcPhi();
658 if (phi >= -
pi && phi <=
pi) {
660 if (phi < cPhi[17] || phi >= cPhi[0]) {
663 m =
minimum(phi - cPhi[0], phi - cPhi[17] - 2 *
pi);
672 m =
minimum(phi - cPhi[i + 1], phi - cPhi[i]);
680 std::cout <<
"Problem in dminphi" << std::endl;
705 (1 + p1 * TMath::Gaus(dminphi, p2, p3) + p4 * TMath::Gaus(dminphi, p5, p6) + p7 * TMath::Gaus(dminphi, p8, p9));
713 constexpr double a[] = {6.13349e-01, 5.08146e-01, 4.44480e-01, 3.3487e-01, 7.65627e-01};
714 constexpr double m[] = {-1.79514e-02, 4.44747e-01, 7.92824e-01, 1.14090e+00, 1.47464e+00};
715 constexpr double s[] = {7.92382e-03, 3.06028e-03, 3.36139e-03, 3.94521e-03, 8.63950e-04};
716 constexpr double sa[] = {1.27228e+01, 3.81517e-02, 1.63507e-01, -6.56480e-02, 1.87160e-01};
717 constexpr double ss[] = {5.48753e-02, -1.00223e-02, 2.22866e-03, 4.26288e-04, 2.67937e-03};
720 for (
unsigned i = 0;
i <= 4;
i++)
721 result += a[
i] * TMath::Gaus(eta, m[
i], s[i]) *
753 (p0 + 1 / (p1 + p2 * TMath::Power(E, p3)) + p4 * TMath::Exp(-E / p5) + p6 * TMath::Exp(-E * E / (p7 * p7))) *
754 (1 + p8 * eta * eta);
780 constexpr double norm = (p1 + p2 * (2.6 + 1.656) / 2);
782 double result = p0 * (p1 + p2 *
eta) / norm;
799 constexpr double norm = (p4 + p5 * (2.6 + 1.656) / 2);
801 double result = (1.0012 + p0 * TMath::Exp(-E / p3) + p1 * TMath::Exp(-E / p2)) * (p4 + p5 * eta) / norm;
814 constexpr double norm = (p1 + p2 * (2.6 + 1.656) / 2);
816 double result = p0 * (p1 + p2 * etaEcal) / norm;
854 double result = E * (p0 + p1 * TMath::Exp(-E / p2)) * (p3 + p4 * TMath::Gaus(eta, p6, p5) + p7 *
eta) / norm;
863 double E =
Beta(1.0155 * eEcal + 0.025 * (ePS1 + 0.5976 * ePS2) / 9
e-5, etaEcal) * eEcal +
864 Gamma(etaEcal) * (ePS1 +
Alpha(etaEcal) * ePS2) / 9
e-5;
873 double result = E * (p0 + p1 * TMath::Exp(-E / p2) - p3 * TMath::Exp(-E / p4));
881 double eEcal,
double ePS1,
double ePS2,
double etaEcal,
double& outputPS1,
double& outputPS2)
const {
883 double gammaprime =
Gamma(etaEcal) / 9
e-5;
890 }
else if (outputPS1 == 0 && outputPS2 == -1 &&
esEEInterCalib_ !=
nullptr) {
894 outputPS2 = corrTotES - outputPS1;
895 }
else if (outputPS1 == -1 && outputPS2 == 0 &&
esEEInterCalib_ !=
nullptr) {
900 outputPS1 = corrTotES - outputPS2;
903 outputPS1 = gammaprime * ePS1;
904 outputPS2 = gammaprime *
Alpha(etaEcal) * ePS2;
907 double E =
Beta(1.0155 * eEcal + 0.025 * (ePS1 + 0.5976 * ePS2) / 9
e-5, etaEcal) * eEcal + outputPS1 + outputPS2;
916 double corrfac = (p0 + p1 * TMath::Exp(-E / p2) - p3 * TMath::Exp(-E / p4));
917 outputPS1 *= corrfac;
918 outputPS2 *= corrfac;
919 double result = E * corrfac;
938 constexpr double norm = (p4 + p5 * (2.6 + 1.656) / 2);
940 double result = eEcal * (p0 + p1 * TMath::Exp(-
TMath::Abs(eEcal - p3) / p2)) * (p4 + p5 * eta) / norm;
968 double result = E * (p0 + p1 * TMath::Exp(-(E - p3) / p2) + 1 / (p4 + p5 * TMath::Power(E, p6))) *
969 (p7 + p8 * TMath::Gaus(eta, p9, p10) + p11 * TMath::Gaus(eta, p12, p13)) / norm;
976 double eEcal,
double ePS1,
double ePS2,
double eta,
double phi,
bool crackCorrection)
const {
987 if (eta <= endBarrel)
988 result =
EcorrBarrel(eEcal, eta, phi, crackCorrection);
989 else if (eta <= beginingPS)
991 else if ((eta < endPS) && ePS1 == 0 && ePS2 == 0)
993 else if (eta < endPS)
994 result =
EcorrPS(eEcal, ePS1, ePS2, eta);
995 else if (eta < endEndCap)
1016 bool crackCorrection)
const {
1027 if (eta <= endBarrel)
1028 result =
EcorrBarrel(eEcal, eta, phi, crackCorrection);
1029 else if (eta <= beginingPS)
1031 else if ((eta < endPS) && ePS1 == 0 && ePS2 == 0)
1033 else if (eta < endPS)
1034 result =
EcorrPS(eEcal, ePS1, ePS2, eta, ps1, ps2);
1035 else if (eta < endEndCap)
std::unique_ptr< TF1 > faEtaBarrelH
std::unique_ptr< TF1 > fcEtaEndcapEH
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const PerformancePayloadFromTFormula * pfCalibrations
double aEtaEndcapEH(double x) const
std::unique_ptr< TF1 > faEtaBarrelEH
double bBarrel(double x) const
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
double cEtaEndcapEH(double x) const
double aEtaBarrelEH(double x) const
double aEndcap(double x) const
double bEndcap(double x) const
const ESEEIntercalibConstants * esEEInterCalib_
double bEtaEndcapH(double x) const
double Ecorr(double eEcal, double ePS1, double ePS2, double eta, double phi, bool crackCorrection=true) const
std::unique_ptr< TF1 > fbEtaBarrelEH
float getGammaLow2() const
double aEtaBarrelH(double x) const
double EcorrZoneBeforePS(double E, double eta) const
double cEtaBarrelH(double x) const
double Alpha(double eta) const
void energyEmHad(double t, double &e, double &h, double eta, double phi) const
double cEtaBarrelEH(double x) const
std::unique_ptr< TF1 > fcEtaBarrelEH
void calculatePositionREP()
computes posrep_ once and for all
double bEtaBarrelEH(double x) const
std::unique_ptr< TF1 > fbBarrel
std::unique_ptr< TF1 > faEtaEndcapEH
friend std::ostream & operator<<(std::ostream &out, const PFEnergyCalibration &calib)
double cEndcap(double x) const
const REPPoint & positionREP() const
cluster position: rho, eta, phi
double Beta(double E, double eta) const
std::unique_ptr< TF1 > faBarrel
Abs< T >::type abs(const T &t)
std::unique_ptr< TF1 > faEndcap
double dEtaEndcapEH(double x) const
std::unique_ptr< TF1 > fcEtaBarrelH
double energy() const
cluster energy
double bEtaEndcapEH(double x) const
double EcorrZoneAfterPS(double E, double eta) const
std::pair< int, edm::FunctionWithDict > OK
float getGammaLow3() const
bool insert(BinningVariables::BinningVariablesType, float)
float getGammaLow0() const
double bEtaBarrelH(double x) const
double dEtaEndcapH(double x) const
std::unique_ptr< TF1 > fbEtaBarrelH
std::unique_ptr< TF1 > fdEtaEndcapEH
std::unique_ptr< TF1 > faEtaEndcapH
double CorrBarrel(double E, double eta) const
double Gamma(double etaEcal) const
float getGammaLow1() const
double energyEm(const reco::PFCluster &clusterEcal, std::vector< double > &EclustersPS1, std::vector< double > &EclustersPS2, bool crackCorrection=true) const
double dCrackPhi(double phi, double eta) const
std::unique_ptr< TF1 > fcEtaEndcapH
std::unique_ptr< TF1 > fbEndcap
std::unique_ptr< TF1 > fcBarrel
std::unique_ptr< TF1 > fdEtaEndcapH
double CorrEta(double eta) const
void initializeCalibrationFunctions()
double aEtaEndcapH(double x) const
double aBarrel(double x) const
double CorrPhi(double phi, double eta) const
double EcorrPS_ePSNil(double eEcal, double eta) const
std::unique_ptr< TF1 > fbEtaEndcapEH
double cBarrel(double x) const
double cEtaEndcapH(double x) const
double EcorrBarrel(double E, double eta, double phi, bool crackCorrection=true) const
std::unique_ptr< TF1 > fcEndcap
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
std::unique_ptr< TF1 > fbEtaEndcapH
double EcorrPS(double eEcal, double ePS1, double ePS2, double etaEcal) const
double minimum(double a, double b) const