228 using namespace reco;
231 const float barrel_lenght=30;
252 selectedJets.push_back(&(*it));
273 std::vector<float> zProjections;
274 std::vector<float> zWeights;
276 for(vector<const reco::Jet*>::iterator jit = selectedJets.begin() ; jit != selectedJets.end() ; jit++)
278 float px=(*jit)->px();
279 float py=(*jit)->py();
280 float pz=(*jit)->pz();
281 float pt=(*jit)->pt();
282 float eta=(*jit)->eta();
283 float jetZOverRho = (*jit)->momentum().Z()/(*jit)->momentum().Rho();
287 DetId id = it->detId();
290 float zmodule = modulepos.
z() - ((modulepos.
x()-beamSpot->
x0())*px+(modulepos.
y()-beamSpot->
y0())*py)/pt * pz/
pt;
292 for(
size_t j = 0 ; j < detset.
size() ; j ++)
324 float z = v.
z() - ((v.
x()-beamSpot->
x0())*px+(v.
y()-beamSpot->
y0())*py)/pt * pz/
pt;
327 zProjections.push_back(z);
330 if(
std::abs(modulepos.
z())<barrel_lenght)
337 float weight_sizeY_up = (sizeY_up-
sizeY)/(sizeY_up-sizeY_peak);
338 float weight_sizeY_down = (sizeY-sizeY_down)/(sizeY_peak-sizeY_down);
339 weight_sizeY_down = weight_sizeY_down *(weight_sizeY_down>0)*(weight_sizeY_down<1);
340 weight_sizeY_up = weight_sizeY_up *(weight_sizeY_up>0)*(weight_sizeY_up<1);
341 float weight_sizeY = weight_sizeY_up + weight_sizeY_down;
344 float rho =
sqrt(v_bs.x()*v_bs.x() + v_bs.y()*v_bs.y());
357 weightCluster_down = weightCluster_down *(weightCluster_down>0)*(weightCluster_down<1);
358 weightCluster_up = weightCluster_up *(weightCluster_up>0)*(weightCluster_up<1);
359 float weight_charge = weightCluster_up + weightCluster_down;
362 weight = weight_dPhi * weight_sizeY * weight_rho * weight_sizeX1 * weight_charge ;
364 else if(
std::abs(modulepos.
z())>barrel_lenght)
372 zWeights.push_back(weight);
383 std::multimap<float,float> zWithW;
385 for(i=0;i<zProjections.size();i++) zWithW.insert(std::pair<float,float>(zProjections[i],zWeights[i]));
387 for(std::multimap<float,float>::iterator it=zWithW.begin(); it!=zWithW.end(); it++,i++) { zProjections[
i]=it->first; zWeights[
i]=it->second; }
391 std::vector<float> zWeightsSquared;
392 for(std::vector<float>::iterator it=zWeights.begin();it!=zWeights.end();it++) {zWeightsSquared.push_back((*it)*(*it));}
399 float centerWMax=res_step3;
404 if(zProjections.size() > 2)
408 e(0, 0) = 0.0015 * 0.0015;
409 e(1, 1) = 0.0015 * 0.0015;
413 auto pOut = std::make_unique<reco::VertexCollection>();
414 pOut->push_back(thePV);
419 e(0, 0) = 0.0015 * 0.0015;
420 e(1, 1) = 0.0015 * 0.0015;
424 auto pOut = std::make_unique<reco::VertexCollection>();
425 pOut->push_back(thePV);
433 const float half_width_peak=1;
434 float nWeightedTot=0;
435 float nWeightedTotPeak=0;
436 for(std::vector<float>::iterator it = zProjections.begin();it!=zProjections.end(); it++)
438 nWeightedTot+=zWeights[it-zProjections.begin()];
439 if((res-half_width_peak)<=(*it) && (*it)<=(res+half_width_peak))
441 nWeightedTotPeak+=zWeights[it-zProjections.begin()];
445 auto zClusterQuality = std::make_unique<float>();
449 *zClusterQuality=nWeightedTotPeak /
sqrt(nWeightedTot/(2*half_width_peak));
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) 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.
const double m_weightCut_step2
const double m_weightCut_step3
const double m_weight_charge_down
const double m_weight_dPhi_EC
const double m_maxJetEta_EC
const double m_weight_charge_up
const double m_zClusterWidth_step3
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const double m_maxDeltaPhi_EC
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
Geom::Phi< T > phi() const
math::Error< dimension >::type Error
covariance error matrix (3x3)
const double m_zClusterWidth_step2
const double m_weight_charge_peak
const double m_PixelCellHeightOverWidth
const Plane & surface() const
The nominal surface of the GeomDet.
const double m_weight_dPhi
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
const double m_ptWeighting_slope
const Surface::PositionType & position() const
The position (origin of the R.F.)
const_iterator begin() const
const double m_weight_SizeX1
const double m_peakSizeY_q
Abs< T >::type abs(const T &t)
math::XYZPoint Point
point in the space
const double m_weight_rho_up
edm::EDGetTokenT< edm::View< reco::Jet > > jetsToken
virtual VLocalValues localParametersV(const SiPixelCluster &cluster, const GeomDetUnit &gd) const
const double m_zClusterSearchArea_step3
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 double m_maxDeltaPhi
const double m_zClusterSearchArea_step2
const TrackerGeomDet * idToDet(DetId) const override
const double m_ptWeighting_offset
double y0() const
y coordinate
const double m_maxSizeY_q
const_iterator end() const
float FindPeakFastPV(const std::vector< float > &zProjections, const std::vector< float > &zWeights, const float oldVertex, const float m_zClusterWidth, const float m_zClusterSearchArea, const float m_weightCut)
edm::EDGetTokenT< SiPixelClusterCollectionNew > clustersToken
T const * product() const
const double m_zClusterWidth_step1
const double m_minSizeY_q
const_iterator begin(bool update=false) const
const double m_minJetEta_EC
double x0() const
x coordinate