77 double correction_factor = 1.;
87 double Theta = -position_.theta() + 0.5 *
M_PI;
88 double Eta = position_.eta();
89 double Phi = TVector2::Phi_mpi_pi(position_.phi());
93 const float X0 = 0.89;
99 std::vector<std::pair<DetId, float> > crystals_vector = basicCluster.
hitsAndFractions();
100 float dphimin = 999.;
101 float detamin = 999.;
105 for (
unsigned int icry = 0; icry != crystals_vector.size(); ++icry) {
107 auto cell =
geom->getGeometry(crystal);
109 double EtaCentr = center_pos.
eta();
110 double PhiCentr = TVector2::Phi_mpi_pi(center_pos.
phi());
111 if (
std::abs(EtaCentr - Eta) < detamin) {
113 ietaclosest = crystal.ieta();
115 if (
std::abs(TVector2::Phi_mpi_pi(PhiCentr -
Phi)) < dphimin) {
116 dphimin =
std::abs(TVector2::Phi_mpi_pi(PhiCentr -
Phi));
117 iphiclosest = crystal.iphi();
121 EBDetId crystalseed(ietaclosest, iphiclosest);
124 auto cell =
geom->getGeometry(crystalseed);
128 double PhiCentr = TVector2::Phi_mpi_pi(center_pos.
phi());
129 double PhiWidth = (
M_PI / 180.);
130 double PhiCry = (TVector2::Phi_mpi_pi(
Phi - PhiCentr)) / PhiWidth;
140 double ThetaCentr = -center_pos.
theta() + 0.5 *
M_PI;
141 double ThetaWidth = (
M_PI / 180.) *
std::cos(ThetaCentr);
142 double EtaCry = (Theta - ThetaCentr) / ThetaWidth;
155 if (payloadsize < nparams)
156 edm::LogError(
"Invalid Payload") <<
"Parametrization requires " << nparams <<
" parameters but only " << payloadsize
157 <<
" are found in DB. Perhaps incompatible Global Tag" << std::endl;
159 if (payloadsize > nparams)
160 edm::LogWarning(
"Size mismatch ") <<
"Parametrization requires " << nparams <<
" parameters but " << payloadsize
161 <<
" are found in DB. Perhaps incompatible Global Tag" << std::endl;
163 std::pair<double, double> localPosition(EtaCry, PhiCry);
166 float localEta = localPosition.first;
167 float localPhi = localPosition.second;
182 fetacor = pe[0] + pe[1] * localEta + pe[2] * localEta * localEta;
185 fphicor =
pp[0] +
pp[1] * localPhi +
pp[2] * localPhi * localPhi;
188 int iphimod20 =
std::abs(iphiclosest % 20);
192 correction_factor = (1. / fetacor) * (1. / fphicor);
195 return correction_factor;