96 m_maxDeltaPhi = iConfig.
getParameter<
double>(
"maxDeltaPhi");
97 m_clusterLength = iConfig.
getParameter<
double>(
"clusterLength");
98 produces<reco::VertexCollection>();
103 using namespace reco;
116 if (it->pt() > 40 && fabs(it->eta()) < 1.6) {
120 selectedJets.push_back(*ca);
137 float lengthBmodule = 6.66;
138 std::vector<float> zProjections;
139 for (CaloJetCollection::const_iterator jit = selectedJets.begin(); jit != selectedJets.end(); jit++) {
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() -
159 ((modulepos.
x() - beamSpot->
x0()) * px + (modulepos.
y() - beamSpot->
y0()) * py) / pt * pz /
pt;
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) {
169 if (fabs(
deltaPhi(jit->momentum().Phi(), v_bs.phi())) < m_maxDeltaPhi) {
170 float z = v.
z() - ((v.
x() - beamSpot->
x0()) * px + (v.
y() - beamSpot->
y0()) * py) / pt * pz /
pt;
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);
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
T getParameter(std::string const &) const
const_iterator end(bool update=false) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Jets made from CaloTowers.
edm::EDGetTokenT< edm::View< reco::Jet > > m_jets
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Geom::Phi< T > phi() const
math::Error< dimension >::type Error
covariance error matrix (3x3)
const Plane & surface() const
The nominal surface of the GeomDet.
edm::EDGetTokenT< SiPixelClusterCollectionNew > m_clusters
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
#define DEFINE_FWK_MODULE(type)
const Surface::PositionType & position() const
The position (origin of the R.F.)
const_iterator begin() const
math::XYZPoint Point
point in the space
FastPrimaryVertexProducer(const edm::ParameterSet &)
edm::EDGetTokenT< reco::BeamSpot > m_beamSpot
virtual VLocalValues localParametersV(const SiPixelCluster &cluster, const GeomDetUnit &gd) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
T const * product() const
double x(const double z) const
x coordinate of the beeam spot position at a given z value (it takes into account the dxdz slope) ...
Pixel cluster – collection of neighboring pixels above threshold.
double y(const double z) const
y coordinate of the beeam spot position at a given z value (it takes into account the dydz slope) ...
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
const TrackerGeomDet * idToDet(DetId) const override
double y0() const
y coordinate
const_iterator end() const
T const * product() const
const_iterator begin(bool update=false) const
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
double x0() const
x coordinate
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override