232 using namespace reco;
235 const float barrel_lenght=30;
247 vector<const reco::Jet*> selectedJets;
256 selectedJets.push_back(&(*it));
277 std::vector<float> zProjections;
278 std::vector<float> zWeights;
280 for(vector<const reco::Jet*>::iterator jit = selectedJets.begin() ; jit != selectedJets.end() ; jit++)
282 float px=(*jit)->px();
283 float py=(*jit)->py();
284 float pz=(*jit)->pz();
285 float pt=(*jit)->pt();
286 float eta=(*jit)->eta();
287 float jetZOverRho = (*jit)->momentum().Z()/(*jit)->momentum().Rho();
291 DetId id = it->detId();
294 float zmodule = modulepos.
z() - ((modulepos.
x()-
beamSpot->x0())*px+(modulepos.
y()-
beamSpot->y0())*py)/pt * pz/
pt;
296 for(
size_t j = 0 ;
j < detset.
size() ;
j ++)
321 Point3DBase<float, GlobalTag> v = trackerGeometry->idToDet(
id)->surface().toGlobal(
pp->localParametersV( aCluster,( *trackerGeometry->idToDetUnit(
id)))[0].first) ;
331 zProjections.push_back(z);
334 if(
std::abs(modulepos.
z())<barrel_lenght)
337 float sizeY=aCluster.
sizeY();
341 float weight_sizeY_up = (sizeY_up-sizeY)/(sizeY_up-sizeY_peak);
342 float weight_sizeY_down = (sizeY-sizeY_down)/(sizeY_peak-sizeY_down);
343 weight_sizeY_down = weight_sizeY_down *(weight_sizeY_down>0)*(weight_sizeY_down<1);
344 weight_sizeY_up = weight_sizeY_up *(weight_sizeY_up>0)*(weight_sizeY_up<1);
345 float weight_sizeY = weight_sizeY_up + weight_sizeY_down;
348 float rho =
sqrt(v_bs.x()*v_bs.x() + v_bs.y()*v_bs.y());
358 float charge=aCluster.
charge();
361 weightCluster_down = weightCluster_down *(weightCluster_down>0)*(weightCluster_down<1);
362 weightCluster_up = weightCluster_up *(weightCluster_up>0)*(weightCluster_up<1);
363 float weight_charge = weightCluster_up + weightCluster_down;
366 weight = weight_dPhi * weight_sizeY * weight_rho * weight_sizeX1 * weight_charge ;
368 else if(
std::abs(modulepos.
z())>barrel_lenght)
376 zWeights.push_back(weight);
387 std::multimap<float,float> zWithW;
389 for(
i=0;
i<zProjections.size();
i++) zWithW.insert(std::pair<float,float>(zProjections[
i],zWeights[i]));
391 for(std::multimap<float,float>::iterator it=zWithW.begin(); it!=zWithW.end(); it++,i++) { zProjections[
i]=it->first; zWeights[
i]=it->second; }
395 std::vector<float> zWeightsSquared;
396 for(std::vector<float>::iterator it=zWeights.begin();it!=zWeights.end();it++) {zWeightsSquared.push_back((*it)*(*it));}
403 float centerWMax=res_step3;
408 if(zProjections.size() > 2)
412 e(0, 0) = 0.0015 * 0.0015;
413 e(1, 1) = 0.0015 * 0.0015;
418 pOut->push_back(thePV);
423 e(0, 0) = 0.0015 * 0.0015;
424 e(1, 1) = 0.0015 * 0.0015;
429 pOut->push_back(thePV);
437 const float half_width_peak=1;
438 float nWeightedTot=0;
439 float nWeightedTotPeak=0;
440 for(std::vector<float>::iterator it = zProjections.begin();it!=zProjections.end(); it++)
442 nWeightedTot+=zWeights[it-zProjections.begin()];
443 if((res-half_width_peak)<=(*it) && (*it)<=(res+half_width_peak))
445 nWeightedTotPeak+=zWeights[it-zProjections.begin()];
449 std::auto_ptr<float > zClusterQuality(
new float());
453 *zClusterQuality=nWeightedTotPeak /
sqrt(nWeightedTot/(2*half_width_peak));
454 iEvent.
put(zClusterQuality);
457 iEvent.
put(zClusterQuality);
double m_weight_charge_up
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
double m_ptWeighting_offset
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
double m_zClusterWidth_step1
Geom::Phi< T > phi() const
math::Error< dimension >::type Error
covariance error matrix (3x3)
double m_weight_charge_peak
std::vector< Vertex > VertexCollection
collection of Vertex objects
double m_zClusterSearchArea_step3
double m_ptWeighting_slope
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
double m_weight_charge_down
Abs< T >::type abs(const T &t)
math::XYZPoint Point
point in the space
edm::EDGetTokenT< edm::View< reco::Jet > > jetsToken
double m_PixelCellHeightOverWidth
Pixel cluster – collection of neighboring pixels above threshold.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
double m_zClusterWidth_step3
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)
double m_zClusterSearchArea_step2
double m_zClusterWidth_step2
edm::EDGetTokenT< SiPixelClusterCollectionNew > clustersToken