96 m_maxDeltaPhi = iConfig.
getParameter<
double>(
"maxDeltaPhi");
97 m_clusterLength = iConfig.
getParameter<
double>(
"clusterLength");
98 produces<reco::VertexCollection>();
103 using namespace reco;
107 iEvent.getByToken(m_clusters, cH);
111 iEvent.getByToken(m_jets, jH);
116 if (it->pt() > 40 && fabs(it->eta()) < 1.6) {
117 const CaloJet* ca = dynamic_cast<const CaloJet*>(&(*it));
137 float lengthBmodule = 6.66;
138 std::vector<float> zProjections;
140 float px = jit->px();
141 float py = jit->py();
142 float pz = jit->pz();
143 float pt = jit->pt();
145 float jetZOverRho = jit->momentum().Z() / jit->momentum().Rho();
146 int minSizeY = fabs(2. * jetZOverRho) - 1;
147 int maxSizeY = fabs(2. * jetZOverRho) + 2;
148 if (fabs(jit->eta()) > 1.6) {
155 DetId id = it->detId();
158 float zmodule = modulepos.
z() -
160 if ((fabs(
deltaPhi(jit->momentum().Phi(), modulepos.
phi())) < m_maxDeltaPhi * 2) &&
161 (fabs(zmodule) < (m_maxZ + lengthBmodule / 2))) {
162 for (
size_t j = 0;
j < detset.
size();
j++)
165 if (aCluster.
sizeX() < m_maxSizeX && aCluster.
sizeY() >= minSizeY && aCluster.
sizeY() <= maxSizeY) {
167 pp->localParametersV(aCluster, (*trackerGeometry->
idToDetUnit(
id)))[0].first);
169 if (fabs(
deltaPhi(jit->momentum().Phi(), v_bs.phi())) < m_maxDeltaPhi) {
171 if (fabs(z) < m_maxZ) {
172 zProjections.push_back(z);
181 std::sort(zProjections.begin(), zProjections.end());
183 std::vector<float>::iterator itCenter = zProjections.begin();
184 std::vector<float>::iterator itLeftSide = zProjections.begin();
185 std::vector<float>::iterator itRightSide = zProjections.begin();
187 float zCluster = m_clusterLength / 2.0;
189 std::vector<float>::iterator left, right;
190 for (; itCenter != zProjections.end(); itCenter++) {
191 while (itLeftSide != zProjections.end() && (*itCenter - *itLeftSide) > zCluster)
193 while (itRightSide != zProjections.end() && (*itRightSide - *itCenter) < zCluster)
196 int n = itRightSide - itLeftSide;
211 if (!zProjections.empty()) {
212 res = *(left + (right - left) / 2);
215 e(0, 0) = 0.0015 * 0.0015;
216 e(1, 1) = 0.0015 * 0.0015;
220 auto pOut = std::make_unique<reco::VertexCollection>();
221 pOut->push_back(thePV);
227 e(0, 0) = 0.0015 * 0.0015;
228 e(1, 1) = 0.0015 * 0.0015;
232 auto pOut = std::make_unique<reco::VertexCollection>();
233 pOut->push_back(thePV);