128 : m_maxZ(iConfig.getParameter<double>(
"maxZ")),
129 m_pixelCPE(iConfig.getParameter<
std::
string>(
"pixelCPE")),
131 m_njets(iConfig.getParameter<
int>(
"njets")),
132 m_maxJetEta(iConfig.getParameter<double>(
"maxJetEta")),
133 m_minJetPt(iConfig.getParameter<double>(
"minJetPt")),
135 m_barrel(iConfig.getParameter<
bool>(
"barrel")),
136 m_maxSizeX(iConfig.getParameter<double>(
"maxSizeX")),
137 m_maxDeltaPhi(iConfig.getParameter<double>(
"maxDeltaPhi")),
138 m_weight_charge_down(iConfig.getParameter<double>(
"weight_charge_down")),
139 m_weight_charge_up(iConfig.getParameter<double>(
"weight_charge_up")),
140 m_PixelCellHeightOverWidth(iConfig.getParameter<double>(
"PixelCellHeightOverWidth")),
141 m_minSizeY_q(iConfig.getParameter<double>(
"minSizeY_q")),
142 m_maxSizeY_q(iConfig.getParameter<double>(
"maxSizeY_q")),
144 m_weight_dPhi(iConfig.getParameter<double>(
"weight_dPhi")),
145 m_weight_SizeX1(iConfig.getParameter<double>(
"weight_SizeX1")),
146 m_weight_rho_up(iConfig.getParameter<double>(
"weight_rho_up")),
147 m_weight_charge_peak(iConfig.getParameter<double>(
"weight_charge_peak")),
148 m_peakSizeY_q(iConfig.getParameter<double>(
"peakSizeY_q")),
150 m_endCap(iConfig.getParameter<
bool>(
"endCap")),
151 m_minJetEta_EC(iConfig.getParameter<double>(
"minJetEta_EC")),
152 m_maxJetEta_EC(iConfig.getParameter<double>(
"maxJetEta_EC")),
153 m_maxDeltaPhi_EC(iConfig.getParameter<double>(
"maxDeltaPhi_EC")),
154 m_EC_weight(iConfig.getParameter<double>(
"EC_weight")),
155 m_weight_dPhi_EC(iConfig.getParameter<double>(
"weight_dPhi_EC")),
157 m_zClusterWidth_step1(iConfig.getParameter<double>(
"zClusterWidth_step1")),
159 m_zClusterWidth_step2(iConfig.getParameter<double>(
"zClusterWidth_step2")),
160 m_zClusterSearchArea_step2(iConfig.getParameter<double>(
"zClusterSearchArea_step2")),
161 m_weightCut_step2(iConfig.getParameter<double>(
"weightCut_step2")),
163 m_zClusterWidth_step3(iConfig.getParameter<double>(
"zClusterWidth_step3")),
164 m_zClusterSearchArea_step3(iConfig.getParameter<double>(
"zClusterSearchArea_step3")),
165 m_weightCut_step3(iConfig.getParameter<double>(
"weightCut_step3")),
167 m_ptWeighting(iConfig.getParameter<
bool>(
"ptWeighting")),
168 m_ptWeighting_slope(iConfig.getParameter<double>(
"ptWeighting_slope")),
169 m_ptWeighting_offset(iConfig.getParameter<double>(
"ptWeighting_offset")) {
174 produces<reco::VertexCollection>();
184 desc.
add<
double>(
"maxZ", 19.0);
185 desc.
add<
int>(
"njets", 999);
186 desc.
add<
double>(
"maxJetEta", 2.6);
187 desc.
add<
double>(
"minJetPt", 40.);
188 desc.
add<
bool>(
"barrel",
true);
189 desc.
add<
double>(
"maxSizeX", 2.1);
190 desc.
add<
double>(
"maxDeltaPhi", 0.21);
191 desc.
add<
double>(
"PixelCellHeightOverWidth", 1.8);
192 desc.
add<
double>(
"weight_charge_down", 11. * 1000.);
193 desc.
add<
double>(
"weight_charge_up", 190. * 1000.);
194 desc.
add<
double>(
"maxSizeY_q", 2.0);
195 desc.
add<
double>(
"minSizeY_q", -0.6);
196 desc.
add<
double>(
"weight_dPhi", 0.13888888);
197 desc.
add<
double>(
"weight_SizeX1", 0.88);
198 desc.
add<
double>(
"weight_rho_up", 22.);
199 desc.
add<
double>(
"weight_charge_peak", 22. * 1000.);
200 desc.
add<
double>(
"peakSizeY_q", 1.0);
201 desc.
add<
bool>(
"endCap",
true);
202 desc.
add<
double>(
"minJetEta_EC", 1.3);
203 desc.
add<
double>(
"maxJetEta_EC", 2.6);
204 desc.
add<
double>(
"maxDeltaPhi_EC", 0.14);
205 desc.
add<
double>(
"EC_weight", 0.008);
206 desc.
add<
double>(
"weight_dPhi_EC", 0.064516129);
207 desc.
add<
double>(
"zClusterWidth_step1", 2.0);
208 desc.
add<
double>(
"zClusterWidth_step2", 0.65);
209 desc.
add<
double>(
"zClusterSearchArea_step2", 3.0);
210 desc.
add<
double>(
"weightCut_step2", 0.05);
211 desc.
add<
double>(
"zClusterWidth_step3", 0.3);
212 desc.
add<
double>(
"zClusterSearchArea_step3", 0.55);
213 desc.
add<
double>(
"weightCut_step3", 0.1);
214 desc.
add<
bool>(
"ptWeighting",
false);
215 desc.
add<
double>(
"ptWeighting_slope", 1 / 20.);
216 desc.
add<
double>(
"ptWeighting_offset", -1);
217 descriptions.
add(
"fastPrimaryVertexWithWeightsProducer", desc);
222 using namespace reco;
225 const float barrel_lenght = 30;
245 selectedJets.push_back(&(*it));
266 std::vector<float> zProjections;
267 std::vector<float> zWeights;
269 for (vector<const reco::Jet*>::iterator jit = selectedJets.begin(); jit != selectedJets.end();
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() -
285 ((modulepos.
x() - beamSpot->
x0()) * px + (modulepos.
y() - beamSpot->
y0()) * py) / pt * pz /
pt;
288 for (
size_t j = 0;
j < detset.
size();
j++) {
310 float z = v.
z() - ((v.
x() - beamSpot->
x0()) * px + (v.
y() - beamSpot->
y0()) * py) / pt * pz /
pt;
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)
356 weight = weight * pt_weight;
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));
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.
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
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
math::Error< dimension >::type Error
covariance error matrix (3x3)
const double m_zClusterWidth_step2
const double m_weight_charge_peak
const double m_PixelCellHeightOverWidth
FastPrimaryVertexWithWeightsProducer(const edm::ParameterSet &)
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
#define DEFINE_FWK_MODULE(type)
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 edm::InputTag m_clusters
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const double m_weight_rho_up
edm::EDGetTokenT< edm::View< reco::Jet > > jetsToken
virtual VLocalValues localParametersV(const SiPixelCluster &cluster, const GeomDetUnit &gd) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const double m_zClusterSearchArea_step3
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
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) ...
void add(std::string const &label, ParameterSetDescription const &psetDescription)
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 TrackerGeomDet * idToDet(DetId) const override
const double m_zClusterSearchArea_step2
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
void produce(edm::Event &, const edm::EventSetup &) override
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