131 clustersToken = consumes<SiPixelClusterCollectionNew>(m_clusters);
134 beamSpotToken = consumes<reco::BeamSpot>(m_beamSpot);
136 jetsToken = consumes<edm::View<reco::Jet> >(m_jets);
139 m_maxJetEta = iConfig.
getParameter<
double>(
"maxJetEta");
144 m_maxDeltaPhi = iConfig.
getParameter<
double>(
"maxDeltaPhi");
145 m_PixelCellHeightOverWidth = iConfig.
getParameter<
double>(
"PixelCellHeightOverWidth");
146 m_weight_charge_down = iConfig.
getParameter<
double>(
"weight_charge_down");
147 m_weight_charge_up = iConfig.
getParameter<
double>(
"weight_charge_up");
148 m_minSizeY_q = iConfig.
getParameter<
double>(
"minSizeY_q");
149 m_maxSizeY_q = iConfig.
getParameter<
double>(
"maxSizeY_q");
151 m_weight_dPhi = iConfig.
getParameter<
double>(
"weight_dPhi");
152 m_weight_SizeX1 = iConfig.
getParameter<
double>(
"weight_SizeX1");
153 m_weight_rho_up = iConfig.
getParameter<
double>(
"weight_rho_up");
154 m_weight_charge_peak = iConfig.
getParameter<
double>(
"weight_charge_peak");
155 m_peakSizeY_q = iConfig.
getParameter<
double>(
"peakSizeY_q");
158 m_minJetEta_EC = iConfig.
getParameter<
double>(
"minJetEta_EC");
159 m_maxJetEta_EC = iConfig.
getParameter<
double>(
"maxJetEta_EC");
160 m_maxDeltaPhi_EC = iConfig.
getParameter<
double>(
"maxDeltaPhi_EC");
161 m_EC_weight = iConfig.
getParameter<
double>(
"EC_weight");
162 m_weight_dPhi_EC = iConfig.
getParameter<
double>(
"weight_dPhi_EC");
164 m_zClusterWidth_step1 = iConfig.
getParameter<
double>(
"zClusterWidth_step1");
166 m_zClusterWidth_step2 = iConfig.
getParameter<
double>(
"zClusterWidth_step2");
167 m_zClusterSearchArea_step2 = iConfig.
getParameter<
double>(
"zClusterSearchArea_step2");
168 m_weightCut_step2 = iConfig.
getParameter<
double>(
"weightCut_step2");
170 m_zClusterWidth_step3 = iConfig.
getParameter<
double>(
"zClusterWidth_step3");
171 m_zClusterSearchArea_step3 = iConfig.
getParameter<
double>(
"zClusterSearchArea_step3");
172 m_weightCut_step3 = iConfig.
getParameter<
double>(
"weightCut_step3");
174 m_ptWeighting = iConfig.
getParameter<
bool>(
"ptWeighting");
175 m_ptWeighting_slope = iConfig.
getParameter<
double>(
"ptWeighting_slope");
176 m_ptWeighting_offset = iConfig.
getParameter<
double>(
"ptWeighting_offset");
178 produces<reco::VertexCollection>();
191 desc.
add<
double>(
"maxZ",19.0);
192 desc.
add<
int>(
"njets",999);
193 desc.
add<
double>(
"maxJetEta",2.6);
194 desc.
add<
double>(
"minJetPt",40.);
195 desc.
add<
bool>(
"barrel",
true);
196 desc.
add<
double>(
"maxSizeX",2.1);
197 desc.
add<
double>(
"maxDeltaPhi",0.21);
198 desc.
add<
double>(
"PixelCellHeightOverWidth",1.8);
199 desc.
add<
double>(
"weight_charge_down",11.*1000.);
200 desc.
add<
double>(
"weight_charge_up",190.*1000.);
201 desc.
add<
double>(
"maxSizeY_q",2.0);
202 desc.
add<
double>(
"minSizeY_q",-0.6);
203 desc.
add<
double>(
"weight_dPhi",0.13888888);
204 desc.
add<
double>(
"weight_SizeX1",0.88);
205 desc.
add<
double>(
"weight_rho_up",22.);
206 desc.
add<
double>(
"weight_charge_peak",22.*1000.);
207 desc.
add<
double>(
"peakSizeY_q",1.0);
208 desc.
add<
bool>(
"endCap",
true);
209 desc.
add<
double>(
"minJetEta_EC",1.3);
210 desc.
add<
double>(
"maxJetEta_EC",2.6);
211 desc.
add<
double>(
"maxDeltaPhi_EC",0.14);
212 desc.
add<
double>(
"EC_weight",0.008);
213 desc.
add<
double>(
"weight_dPhi_EC",0.064516129);
214 desc.
add<
double>(
"zClusterWidth_step1",2.0);
215 desc.
add<
double>(
"zClusterWidth_step2",0.65);
216 desc.
add<
double>(
"zClusterSearchArea_step2",3.0);
217 desc.
add<
double>(
"weightCut_step2",0.05);
218 desc.
add<
double>(
"zClusterWidth_step3",0.3);
219 desc.
add<
double>(
"zClusterSearchArea_step3",0.55);
220 desc.
add<
double>(
"weightCut_step3",0.1);
221 desc.
add<
bool>(
"ptWeighting",
false);
222 desc.
add<
double>(
"ptWeighting_slope",1/20.);
223 desc.
add<
double>(
"ptWeighting_offset",-1);
224 descriptions.
add(
"fastPrimaryVertexWithWeightsProducer",desc);
232 using namespace reco;
235 const float barrel_lenght=30;
247 vector<const reco::Jet*> selectedJets;
252 ((it->pt() >= m_minJetPt) &&
std::abs(it->eta()) <= m_maxJetEta) ||
253 ((it->pt() >= m_minJetPt) &&
std::abs(it->eta()) <= m_maxJetEta_EC &&
std::abs(it->eta()) >= m_minJetEta_EC)
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();
288 float pt_weight= pt*m_ptWeighting_slope +m_ptWeighting_offset;
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 ++)
306 aCluster.
sizeX() <= m_maxSizeX &&
307 aCluster.
sizeY() >= m_PixelCellHeightOverWidth*
std::abs(jetZOverRho)+m_minSizeY_q &&
308 aCluster.
sizeY() <= m_PixelCellHeightOverWidth*
std::abs(jetZOverRho)+m_maxSizeY_q
318 aCluster.
sizeX() <= m_maxSizeX
321 Point3DBase<float, GlobalTag> v = trackerGeometry->idToDet(
id)->surface().toGlobal(
pp->localParametersV( aCluster,( *trackerGeometry->idToDetUnit(
id)))[0].first) ;
324 (m_barrel &&
std::abs(modulepos.
z())<barrel_lenght &&
std::abs(
deltaPhi((*jit)->momentum().Phi(),v_bs.phi())) <= m_maxDeltaPhi ) ||
325 (m_endCap &&
std::abs(modulepos.
z())>barrel_lenght &&
std::abs(
deltaPhi((*jit)->momentum().Phi(),v_bs.phi())) <= m_maxDeltaPhi_EC )
331 zProjections.push_back(z);
334 if(
std::abs(modulepos.
z())<barrel_lenght)
337 float sizeY=aCluster.
sizeY();
338 float sizeY_up = m_PixelCellHeightOverWidth*
std::abs(jetZOverRho)+m_maxSizeY_q;
339 float sizeY_peak = m_PixelCellHeightOverWidth*
std::abs(jetZOverRho)+m_peakSizeY_q;
340 float sizeY_down = m_PixelCellHeightOverWidth*
std::abs(jetZOverRho)+m_minSizeY_q;
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());
349 float weight_rho = ((m_weight_rho_up -
rho)/m_weight_rho_up);
352 float weight_dPhi =
exp(-
std::abs(
deltaPhi((*jit)->momentum().Phi(),v_bs.phi()))/m_weight_dPhi );
355 float weight_sizeX1= (aCluster.
sizeX()==2) + (aCluster.
sizeX()==1)*m_weight_SizeX1;
358 float charge=aCluster.
charge();
359 float weightCluster_up = (m_weight_charge_up-charge)/(m_weight_charge_up-m_weight_charge_peak);
360 float weightCluster_down = (charge-m_weight_charge_down)/(m_weight_charge_peak-m_weight_charge_down);
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)
371 float weight_dPhi =
exp(-
std::abs(
deltaPhi((*jit)->momentum().Phi(),v_bs.phi())) /m_weight_dPhi_EC );
373 weight= m_EC_weight*(weight_dPhi) ;
375 if(m_ptWeighting) weight=weight*pt_weight;
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));}
399 float res_step1 =
FindPeakFastPV( zProjections, zWeights, 0.0, m_zClusterWidth_step1, 999.0, -1.0);
400 float res_step2 =
FindPeakFastPV( zProjections, zWeights, res_step1, m_zClusterWidth_step2, m_zClusterSearchArea_step2, m_weightCut_step2);
401 float res_step3 =
FindPeakFastPV( zProjections, zWeightsSquared, res_step2, m_zClusterWidth_step3, m_zClusterSearchArea_step3, m_weightCut_step3*m_weightCut_step3);
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);
T getParameter(std::string const &) const
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
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
double m_zClusterWidth_step1
Geom::Phi< T > phi() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
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
FastPrimaryVertexWithWeightsProducer(const edm::ParameterSet &)
virtual void produce(edm::Event &, const edm::EventSetup &)
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
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< edm::View< reco::Jet > > jetsToken
double m_PixelCellHeightOverWidth
void add(std::string const &label, ParameterSetDescription const &psetDescription)
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