if it is a cluster to project
Definition at line 220 of file FastPrimaryVertexWithWeightsProducer.cc.
222 using namespace reco;
225 const float barrel_lenght = 30;
266 std::vector<float> zProjections;
267 std::vector<float> zWeights;
271 float px = (*jit)->px();
272 float py = (*jit)->py();
273 float pz = (*jit)->pz();
274 float pt = (*jit)->pt();
275 float eta = (*jit)->eta();
276 float jetZOverRho = (*jit)->momentum().Z() / (*jit)->momentum().Rho();
281 DetId id = it->detId();
284 float zmodule = modulepos.
z() -
288 for (
size_t j = 0;
j < detset.
size();
j++) {
301 pp->localParametersV(aCluster, (*trackerGeometry->
idToDetUnit(
id)))[0].first);
312 zProjections.push_back(
z);
315 if (
std::abs(modulepos.
z()) < barrel_lenght) {
321 float weight_sizeY_up = (sizeY_up -
sizeY) / (sizeY_up - sizeY_peak);
322 float weight_sizeY_down = (
sizeY - sizeY_down) / (sizeY_peak - sizeY_down);
323 weight_sizeY_down = weight_sizeY_down * (weight_sizeY_down > 0) * (weight_sizeY_down < 1);
324 weight_sizeY_up = weight_sizeY_up * (weight_sizeY_up > 0) * (weight_sizeY_up < 1);
325 float weight_sizeY = weight_sizeY_up + weight_sizeY_down;
328 float rho =
sqrt(v_bs.x() * v_bs.x() + v_bs.y() * v_bs.y());
340 float weightCluster_down =
342 weightCluster_down = weightCluster_down * (weightCluster_down > 0) * (weightCluster_down < 1);
343 weightCluster_up = weightCluster_up * (weightCluster_up > 0) * (weightCluster_up < 1);
344 float weight_charge = weightCluster_up + weightCluster_down;
347 weight =
weight_dPhi * weight_sizeY * weight_rho * weight_sizeX1 * weight_charge;
348 }
else if (
std::abs(modulepos.
z()) > barrel_lenght)
357 zWeights.push_back(
weight);
368 std::multimap<float, float> zWithW;
370 for (
i = 0;
i < zProjections.size();
i++)
371 zWithW.insert(std::pair<float, float>(zProjections[
i], zWeights[
i]));
373 for (std::multimap<float, float>::iterator it = zWithW.begin(); it != zWithW.end(); it++,
i++) {
374 zProjections[
i] = it->first;
375 zWeights[
i] = it->second;
379 std::vector<float> zWeightsSquared;
380 for (std::vector<float>::iterator it = zWeights.begin(); it != zWeights.end(); it++) {
381 zWeightsSquared.push_back((*it) * (*it));
395 float centerWMax = res_step3;
400 if (zProjections.size() > 2) {
403 e(0, 0) = 0.0015 * 0.0015;
404 e(1, 1) = 0.0015 * 0.0015;
408 auto pOut = std::make_unique<reco::VertexCollection>();
409 pOut->push_back(thePV);
413 e(0, 0) = 0.0015 * 0.0015;
414 e(1, 1) = 0.0015 * 0.0015;
418 auto pOut = std::make_unique<reco::VertexCollection>();
419 pOut->push_back(thePV);
425 const float half_width_peak = 1;
426 float nWeightedTot = 0;
427 float nWeightedTotPeak = 0;
428 for (std::vector<float>::iterator it = zProjections.begin(); it != zProjections.end(); it++) {
429 nWeightedTot += zWeights[it - zProjections.begin()];
430 if ((
res - half_width_peak) <= (*it) && (*it) <= (
res + half_width_peak)) {
431 nWeightedTotPeak += zWeights[it - zProjections.begin()];
435 auto zClusterQuality = std::make_unique<float>();
436 *zClusterQuality = -1;
437 if (nWeightedTot != 0) {
439 *zClusterQuality = nWeightedTotPeak /
sqrt(nWeightedTot / (2 * half_width_peak));
References funct::abs(), pwdgSkimBPark_cfi::beamSpot, beamSpotToken, ALCARECOTkAlJpsiMuMu_cff::charge, SiPixelCluster::charge(), clustersToken, SiPixelRawToDigiRegional_cfi::deltaPhi, MillePedeFileConverter_cfg::e, PVValHelper::eta, JetChargeProducer_cfi::exp, FindPeakFastPV(), edm::EventSetup::get(), get, mps_fire::i, TrackerGeometry::idToDet(), TrackerGeometry::idToDetUnit(), iEvent, dqmiolumiharvest::j, singleTopDQM_cfi::jets, jetsToken, m_barrel, m_EC_weight, m_endCap, m_maxDeltaPhi, m_maxDeltaPhi_EC, m_maxJetEta, m_maxJetEta_EC, m_maxSizeX, m_maxSizeY_q, m_maxZ, m_minJetEta_EC, m_minJetPt, m_minSizeY_q, m_njets, m_peakSizeY_q, m_PixelCellHeightOverWidth, m_pixelCPE, m_ptWeighting, m_ptWeighting_offset, m_ptWeighting_slope, m_weight_charge_down, m_weight_charge_peak, m_weight_charge_up, m_weight_dPhi, m_weight_dPhi_EC, m_weight_rho_up, m_weight_SizeX1, m_weightCut_step2, m_weightCut_step3, m_zClusterSearchArea_step2, m_zClusterSearchArea_step3, m_zClusterWidth_step1, m_zClusterWidth_step2, m_zClusterWidth_step3, eostools::move(), AlCaHLTBitMon_ParallelJobs::p, PV3DBase< T, PVType, FrameType >::phi(), LumiMonitor_cff::pixelClusters, GeomDet::position(), createTree::pp, edm::Handle< T >::product(), edm::ESHandle< T >::product(), DiDispStaMuonMonitor_cfi::pt, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, rho, objectSelection_cff::selectedJets, edmNew::DetSet< T >::size(), SiPixelCluster::sizeX(), SiPixelCluster::sizeY(), RecoTauValidation_cfi::sizeY, mathSSE::sqrt(), GeomDet::surface(), Surface::toGlobal(), PbPb_ZMuSkimMuonDPG_cff::tracker, findQualityFiles::v, HLT_2018_cff::weight_dPhi, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), z, and PV3DBase< T, PVType, FrameType >::z().