99 m_maxDeltaPhi = iConfig.
getParameter<
double>(
"maxDeltaPhi");
100 m_clusterLength = iConfig.
getParameter<
double>(
"clusterLength");
101 produces<reco::VertexCollection>();
110 using namespace reco;
124 if(it->pt() > 40 && fabs(it->eta()) < 1.6)
127 if(ca ==
nullptr) abort();
128 selectedJets.push_back(*ca);
146 float lengthBmodule=6.66;
147 std::vector<float> zProjections;
148 for(CaloJetCollection::const_iterator jit = selectedJets.begin() ; jit != selectedJets.end() ; jit++)
155 float jetZOverRho = jit->momentum().Z()/jit->momentum().Rho();
156 int minSizeY = fabs(2.*jetZOverRho)-1;
157 int maxSizeY = fabs(2.*jetZOverRho)+2;
158 if( fabs(jit->eta()) > 1.6)
165 DetId id = it->detId();
168 float zmodule = modulepos.
z() - ((modulepos.
x()-beamSpot->
x0())*px+(modulepos.
y()-beamSpot->
y0())*py)/pt * pz/
pt;
169 if ((fabs(
deltaPhi(jit->momentum().Phi(),modulepos.
phi()))< m_maxDeltaPhi*2)&&(fabs(zmodule)<(m_maxZ+lengthBmodule/2))){
171 for(
size_t j = 0 ; j < detset.
size() ; j ++)
174 if(aCluster.
sizeX() < m_maxSizeX && aCluster.
sizeY() >= minSizeY && aCluster.
sizeY() <= maxSizeY) {
177 if(fabs(
deltaPhi(jit->momentum().Phi(),v_bs.phi())) < m_maxDeltaPhi)
179 float z = v.
z() - ((v.
x()-beamSpot->
x0())*px+(v.
y()-beamSpot->
y0())*py)/pt * pz/
pt;
182 zProjections.push_back(z);
191 std::sort(zProjections.begin(),zProjections.end());
193 std::vector<float>::iterator itCenter = zProjections.begin();
194 std::vector<float>::iterator itLeftSide = zProjections.begin();
195 std::vector<float>::iterator itRightSide = zProjections.begin();
196 std::vector<int> counts;
197 float zCluster = m_clusterLength/2.0;
199 std::vector<float>::iterator left,right;
200 for(;itCenter!=zProjections.end(); itCenter++)
203 while(itLeftSide != zProjections.end() && (*itCenter - *itLeftSide) > zCluster ) itLeftSide++;
204 while(itRightSide != zProjections.end() && (*itRightSide - *itCenter) < zCluster ) itRightSide++;
206 int n= itRightSide-itLeftSide;
224 if(!zProjections.empty())
226 res=*(left+(right-left)/2);
229 e(0, 0) = 0.0015 * 0.0015;
230 e(1, 1) = 0.0015 * 0.0015;
234 auto pOut = std::make_unique<reco::VertexCollection>();
235 pOut->push_back(thePV);
242 e(0, 0) = 0.0015 * 0.0015;
243 e(1, 1) = 0.0015 * 0.0015;
247 auto pOut = std::make_unique<reco::VertexCollection>();
248 pOut->push_back(thePV);
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
T getParameter(std::string const &) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
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
#define DEFINE_FWK_MODULE(type)
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.
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
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