CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
FastPrimaryVertexWithWeightsProducer Class Reference

#include <RecoBTag/FastPrimaryVertexWithWeightsProducer/src/FastPrimaryVertexWithWeightsProducer.cc>

Inheritance diagram for FastPrimaryVertexWithWeightsProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 FastPrimaryVertexWithWeightsProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpotbeamSpotToken
 
edm::EDGetTokenT
< SiPixelClusterCollectionNew
clustersToken
 
edm::EDGetTokenT< edm::View
< reco::Jet > > 
jetsToken
 
bool m_barrel
 
edm::InputTag m_beamSpot
 
edm::InputTag m_clusters
 
double m_EC_weight
 
bool m_endCap
 
edm::InputTag m_jets
 
double m_maxDeltaPhi
 
double m_maxDeltaPhi_EC
 
double m_maxJetEta
 
double m_maxJetEta_EC
 
double m_maxSizeX
 
double m_maxSizeY_q
 
double m_maxZ
 
double m_minJetEta_EC
 
double m_minJetPt
 
double m_minSizeY_q
 
int m_njets
 
double m_peakSizeY_q
 
double m_PixelCellHeightOverWidth
 
std::string m_pixelCPE
 
bool m_ptWeighting
 
double m_ptWeighting_offset
 
double m_ptWeighting_slope
 
double m_weight_charge_down
 
double m_weight_charge_peak
 
double m_weight_charge_up
 
double m_weight_dPhi
 
double m_weight_dPhi_EC
 
double m_weight_rho_up
 
double m_weight_SizeX1
 
double m_weightCut_step2
 
double m_weightCut_step3
 
double m_zClusterSearchArea_step2
 
double m_zClusterSearchArea_step3
 
double m_zClusterWidth_step1
 
double m_zClusterWidth_step2
 
double m_zClusterWidth_step3
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: The FastPrimaryVertex is an algorithm used to find the primary vertex of an event . It takes the pixel clusters compabible with a jet and project it to the beamSpot with the eta-angle of the jet. The peak on the z-projected clusters distribution is our FastPrimaryVertex.

Implementation: [Notes on implementation]

Definition at line 56 of file FastPrimaryVertexWithWeightsProducer.cc.

Constructor & Destructor Documentation

FastPrimaryVertexWithWeightsProducer::FastPrimaryVertexWithWeightsProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 127 of file FastPrimaryVertexWithWeightsProducer.cc.

References edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

128 {
129  m_maxZ = iConfig.getParameter<double>("maxZ");
130  m_clusters = iConfig.getParameter<edm::InputTag>("clusters");
131  clustersToken = consumes<SiPixelClusterCollectionNew>(m_clusters);
132  m_pixelCPE = iConfig.getParameter<std::string>("pixelCPE");
133  m_beamSpot = iConfig.getParameter<edm::InputTag>("beamSpot");
134  beamSpotToken = consumes<reco::BeamSpot>(m_beamSpot);
135  m_jets = iConfig.getParameter<edm::InputTag>("jets");
136  jetsToken = consumes<edm::View<reco::Jet> >(m_jets);
137 
138  m_njets = iConfig.getParameter<int>("njets");
139  m_maxJetEta = iConfig.getParameter<double>("maxJetEta");
140  m_minJetPt = iConfig.getParameter<double>("minJetPt");
141 
142  m_barrel = iConfig.getParameter<bool>("barrel");
143  m_maxSizeX = iConfig.getParameter<double>("maxSizeX");
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");
150 
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");
156 
157  m_endCap = iConfig.getParameter<bool>("endCap");
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");
163 
164  m_zClusterWidth_step1 = iConfig.getParameter<double>("zClusterWidth_step1");
165 
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");
169 
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");
173 
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");
177 
178  produces<reco::VertexCollection>();
179  produces<float>();
180 
181 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::Jet > > jetsToken
edm::EDGetTokenT< SiPixelClusterCollectionNew > clustersToken

Member Function Documentation

void FastPrimaryVertexWithWeightsProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 184 of file FastPrimaryVertexWithWeightsProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and AlCaHLTBitMon_QueryRunRegistry::string.

185 {
187  desc.add<edm::InputTag> ("clusters",edm::InputTag("hltSiPixelClusters"));
188  desc.add<edm::InputTag> ("beamSpot",edm::InputTag("hltOnlineBeamSpot"));
189  desc.add<edm::InputTag> ("jets",edm::InputTag("hltCaloJetL1FastJetCorrected"));
190  desc.add<std::string>("pixelCPE","hltESPPixelCPEGeneric");
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); // <---- newMethod
222  desc.add<double>("ptWeighting_slope",1/20.);
223  desc.add<double>("ptWeighting_offset",-1);
224  descriptions.add("fastPrimaryVertexWithWeightsProducer",desc);
225 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void FastPrimaryVertexWithWeightsProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

if it is a cluster to project

Implements edm::EDProducer.

Definition at line 228 of file FastPrimaryVertexWithWeightsProducer.cc.

References funct::abs(), SiPixelRawToDigiRegional_cfi::beamSpot, SiPixelCluster::charge(), SiPixelRawToDigiRegional_cfi::deltaPhi, alignCSCRings::e, eta(), create_public_lumi_plots::exp, FindPeakFastPV(), edm::EventSetup::get(), edm::Event::getByToken(), i, j, fwrapper::jets, AlCaHLTBitMon_ParallelJobs::p, PV3DBase< T, PVType, FrameType >::phi(), clustersummaryproducer_cfg::pixelClusters, createTree::pp, EnergyCorrector::pt, edm::Event::put(), dt_dqm_sourceclient_common_cff::reco, rho, edmNew::DetSet< T >::size(), SiPixelCluster::sizeX(), SiPixelCluster::sizeY(), mathSSE::sqrt(), patCandidatesForDimuonsSequences_cff::tracker, findQualityFiles::v, histoStyle::weight, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

229 {
230 
231  using namespace edm;
232  using namespace reco;
233  using namespace std;
234 
235  const float barrel_lenght=30; //half lenght of the pixel barrel 30 cm
236 
237  //get pixel cluster
239  iEvent.getByToken(clustersToken,cH);
240  const SiPixelClusterCollectionNew & pixelClusters = *cH.product();
241 
242  //get jets
244  iEvent.getByToken(jetsToken,jH);
245  const edm::View<reco::Jet> & jets = *jH.product();
246 
247  vector<const reco::Jet*> selectedJets;
248  int countjet=0;
249  for(edm::View<reco::Jet>::const_iterator it = jets.begin() ; it != jets.end() && countjet<m_njets ; it++)
250  {
251  if( //select jets used in barrel or endcap pixel cluster projections
252  ((it->pt() >= m_minJetPt) && std::abs(it->eta()) <= m_maxJetEta) || //barrel
253  ((it->pt() >= m_minJetPt) && std::abs(it->eta()) <= m_maxJetEta_EC && std::abs(it->eta()) >= m_minJetEta_EC) //endcap
254  )
255  {
256  selectedJets.push_back(&(*it));
257  countjet++;
258  }
259  }
260 
261  //get PixelClusterParameterEstimator
264  iSetup.get<TkPixelCPERecord>().get(m_pixelCPE , pe );
265  pp = pe.product();
266 
267  //get beamSpot
270 
271  //get TrackerGeometry
273  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
274  const TrackerGeometry * trackerGeometry = tracker.product();
275 
276 // PART I: get z-projections with z-weights
277  std::vector<float> zProjections;
278  std::vector<float> zWeights;
279  int jet_count=0;
280  for(vector<const reco::Jet*>::iterator jit = selectedJets.begin() ; jit != selectedJets.end() ; jit++)
281  {//loop on selected jets
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;
289  for(SiPixelClusterCollectionNew::const_iterator it = pixelClusters.begin() ; it != pixelClusters.end() ; it++) //Loop on pixel modules with clusters
290  {//loop on pixel modules
291  DetId id = it->detId();
292  const edmNew::DetSet<SiPixelCluster> & detset = (*it);
293  Point3DBase<float, GlobalTag> modulepos=trackerGeometry->idToDet(id)->position();
294  float zmodule = modulepos.z() - ((modulepos.x()-beamSpot->x0())*px+(modulepos.y()-beamSpot->y0())*py)/pt * pz/pt;
295  if ((std::abs(deltaPhi((*jit)->momentum().Phi(),modulepos.phi()))< m_maxDeltaPhi*2)&&(std::abs(zmodule)<(m_maxZ+barrel_lenght))){//if it is a compatible module
296  for(size_t j = 0 ; j < detset.size() ; j ++)
297  {//loop on pixel clusters on this module
298  const SiPixelCluster & aCluster = detset[j];
299  if(//it is a cluster to project
300  (// barrel
301  m_barrel &&
302  std::abs(modulepos.z())<barrel_lenght &&
303  pt>=m_minJetPt &&
304  jet_count<m_njets &&
305  std::abs(eta)<=m_maxJetEta &&
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
309  )
310  ||
311  (// EC
312  m_endCap &&
313  std::abs(modulepos.z())>barrel_lenght &&
314  pt > m_minJetPt &&
315  jet_count<m_njets &&
316  std::abs(eta) <= m_maxJetEta_EC &&
317  std::abs(eta) >= m_minJetEta_EC &&
318  aCluster.sizeX() <= m_maxSizeX
319  )
320  ){
321  Point3DBase<float, GlobalTag> v = trackerGeometry->idToDet(id)->surface().toGlobal(pp->localParametersV( aCluster,( *trackerGeometry->idToDetUnit(id)))[0].first) ;
322  GlobalPoint v_bs(v.x()-beamSpot->x0(),v.y()-beamSpot->y0(),v.z());
323  if(//it pass DeltaPhi(Jet,Cluster) requirements
324  (m_barrel && std::abs(modulepos.z())<barrel_lenght && std::abs(deltaPhi((*jit)->momentum().Phi(),v_bs.phi())) <= m_maxDeltaPhi ) || //barrel
325  (m_endCap && std::abs(modulepos.z())>barrel_lenght && std::abs(deltaPhi((*jit)->momentum().Phi(),v_bs.phi())) <= m_maxDeltaPhi_EC ) //EC
326  )
327  {
328  float z = v.z() - ((v.x()-beamSpot->x0())*px+(v.y()-beamSpot->y0())*py)/pt * pz/pt; //calculate z-projection
329  if(std::abs(z) < m_maxZ)
330  {
331  zProjections.push_back(z); //add z-projection in zProjections
332  float weight=0;
333  //calculate zWeight
334  if(std::abs(modulepos.z())<barrel_lenght)
335  { //barrel
336  //calculate weight_sizeY
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;
346 
347  //calculate weight_rho
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);
350 
351  //calculate weight_dPhi
352  float weight_dPhi = exp(- std::abs(deltaPhi((*jit)->momentum().Phi(),v_bs.phi()))/m_weight_dPhi );
353 
354  //calculate weight_sizeX1
355  float weight_sizeX1= (aCluster.sizeX()==2) + (aCluster.sizeX()==1)*m_weight_SizeX1;
356 
357  //calculate weight_charge
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;
364 
365  //calculate the final weight
366  weight = weight_dPhi * weight_sizeY * weight_rho * weight_sizeX1 * weight_charge ;
367  }
368  else if(std::abs(modulepos.z())>barrel_lenght) // EC
369  {// EC
370  //calculate weight_dPhi
371  float weight_dPhi = exp(- std::abs(deltaPhi((*jit)->momentum().Phi(),v_bs.phi())) /m_weight_dPhi_EC );
372  //calculate the final weight
373  weight= m_EC_weight*(weight_dPhi) ;
374  }
375  if(m_ptWeighting) weight=weight*pt_weight;
376  zWeights.push_back(weight); //add the weight to zWeights
377  }
378  }//if it pass DeltaPhi(Jet,Cluster) requirements
379  }
380  }//loop on pixel clusters on this module
381  }//if it is a compatible module
382  }//loop on pixel modules
383  jet_count++;
384  }//loop on selected jets
385 
386  //order zProjections and zWeights by z
387  std::multimap<float,float> zWithW;
388  size_t i=0;
389  for(i=0;i<zProjections.size();i++) zWithW.insert(std::pair<float,float>(zProjections[i],zWeights[i]));
390  i=0;
391  for(std::multimap<float,float>::iterator it=zWithW.begin(); it!=zWithW.end(); it++,i++) { zProjections[i]=it->first; zWeights[i]=it->second; } //order zProjections and zWeights by z
392 
393 
394  //calculate zWeightsSquared
395  std::vector<float> zWeightsSquared;
396  for(std::vector<float>::iterator it=zWeights.begin();it!=zWeights.end();it++) {zWeightsSquared.push_back((*it)*(*it));}
397 
398  //do multi-step peak searching
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);
402 
403  float centerWMax=res_step3;
404  //End of PART II
405 
406  //Make the output
407  float res=0;
408  if(zProjections.size() > 2)
409  {
410  res=centerWMax;
411  Vertex::Error e;
412  e(0, 0) = 0.0015 * 0.0015;
413  e(1, 1) = 0.0015 * 0.0015;
414  e(2, 2) = 1.5 * 1.5;
415  Vertex::Point p(beamSpot->x(res), beamSpot->y(res), res);
416  Vertex thePV(p, e, 1, 1, 0);
417  std::auto_ptr<reco::VertexCollection> pOut(new reco::VertexCollection());
418  pOut->push_back(thePV);
419  iEvent.put(pOut);
420  } else
421  {
423  e(0, 0) = 0.0015 * 0.0015;
424  e(1, 1) = 0.0015 * 0.0015;
425  e(2, 2) = 1.5 * 1.5;
426  Vertex::Point p(beamSpot->x(res), beamSpot->y(res), res);
427  Vertex thePV(p, e, 0, 0, 0);
428  std::auto_ptr<reco::VertexCollection> pOut(new reco::VertexCollection());
429  pOut->push_back(thePV);
430  iEvent.put(pOut);
431  }
432 
433 //Finally, calculate the zClusterQuality as Sum(weights near the fastPV)/sqrt(Sum(total weights)) [a kind of zCluster significance]
434 
435 
436 
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++)
441  {
442  nWeightedTot+=zWeights[it-zProjections.begin()];
443  if((res-half_width_peak)<=(*it) && (*it)<=(res+half_width_peak))
444  {
445  nWeightedTotPeak+=zWeights[it-zProjections.begin()];
446  }
447  }
448 
449 std::auto_ptr<float > zClusterQuality(new float());
450 *zClusterQuality=-1;
451 if(nWeightedTot!=0)
452 {
453  *zClusterQuality=nWeightedTotPeak / sqrt(nWeightedTot/(2*half_width_peak)); // where 30 is the beam spot lenght
454  iEvent.put(zClusterQuality);
455 }
456 else
457  iEvent.put(zClusterQuality);
458 
459 }
int i
Definition: DBlmapReader.cc:9
float charge() const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
tuple pp
Definition: createTree.py:15
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
Definition: DDAxes.h:10
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:43
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
T eta() const
float float float z
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
T sqrt(T t)
Definition: SSEVec.h:48
vector< PseudoJet > jets
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
edm::EDGetTokenT< edm::View< reco::Jet > > jetsToken
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:55
int sizeY() const
Pixel cluster – collection of neighboring pixels above threshold.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
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)
int weight
Definition: histoStyle.py:50
size_type size() const
Definition: DetSetNew.h:86
int sizeX() const
edm::EDGetTokenT< SiPixelClusterCollectionNew > clustersToken
T x() const
Definition: PV3DBase.h:62

Member Data Documentation

edm::EDGetTokenT<reco::BeamSpot> FastPrimaryVertexWithWeightsProducer::beamSpotToken
private

Definition at line 72 of file FastPrimaryVertexWithWeightsProducer.cc.

edm::EDGetTokenT<SiPixelClusterCollectionNew> FastPrimaryVertexWithWeightsProducer::clustersToken
private

Definition at line 71 of file FastPrimaryVertexWithWeightsProducer.cc.

edm::EDGetTokenT<edm::View<reco::Jet> > FastPrimaryVertexWithWeightsProducer::jetsToken
private

Definition at line 73 of file FastPrimaryVertexWithWeightsProducer.cc.

bool FastPrimaryVertexWithWeightsProducer::m_barrel
private

Definition at line 79 of file FastPrimaryVertexWithWeightsProducer.cc.

edm::InputTag FastPrimaryVertexWithWeightsProducer::m_beamSpot
private

Definition at line 69 of file FastPrimaryVertexWithWeightsProducer.cc.

edm::InputTag FastPrimaryVertexWithWeightsProducer::m_clusters
private

Definition at line 67 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_EC_weight
private

Definition at line 104 of file FastPrimaryVertexWithWeightsProducer.cc.

bool FastPrimaryVertexWithWeightsProducer::m_endCap
private

Definition at line 98 of file FastPrimaryVertexWithWeightsProducer.cc.

edm::InputTag FastPrimaryVertexWithWeightsProducer::m_jets
private

Definition at line 70 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_maxDeltaPhi
private

Definition at line 81 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_maxDeltaPhi_EC
private

Definition at line 101 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_maxJetEta
private

Definition at line 77 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_maxJetEta_EC
private

Definition at line 100 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_maxSizeX
private

Definition at line 80 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_maxSizeY_q
private

Definition at line 86 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_maxZ
private

Definition at line 66 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_minJetEta_EC
private

Definition at line 99 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_minJetPt
private

Definition at line 78 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_minSizeY_q
private

Definition at line 85 of file FastPrimaryVertexWithWeightsProducer.cc.

int FastPrimaryVertexWithWeightsProducer::m_njets
private

Definition at line 76 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_peakSizeY_q
private

Definition at line 95 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_PixelCellHeightOverWidth
private

Definition at line 84 of file FastPrimaryVertexWithWeightsProducer.cc.

std::string FastPrimaryVertexWithWeightsProducer::m_pixelCPE
private

Definition at line 68 of file FastPrimaryVertexWithWeightsProducer.cc.

bool FastPrimaryVertexWithWeightsProducer::m_ptWeighting
private

Definition at line 122 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_ptWeighting_offset
private

Definition at line 124 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_ptWeighting_slope
private

Definition at line 123 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_weight_charge_down
private

Definition at line 82 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_weight_charge_peak
private

Definition at line 94 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_weight_charge_up
private

Definition at line 83 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_weight_dPhi
private

Definition at line 91 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_weight_dPhi_EC
private

Definition at line 105 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_weight_rho_up
private

Definition at line 93 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_weight_SizeX1
private

Definition at line 92 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_weightCut_step2
private

Definition at line 114 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_weightCut_step3
private

Definition at line 119 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_zClusterSearchArea_step2
private

Definition at line 113 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_zClusterSearchArea_step3
private

Definition at line 118 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_zClusterWidth_step1
private

Definition at line 109 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_zClusterWidth_step2
private

Definition at line 112 of file FastPrimaryVertexWithWeightsProducer.cc.

double FastPrimaryVertexWithWeightsProducer::m_zClusterWidth_step3
private

Definition at line 117 of file FastPrimaryVertexWithWeightsProducer.cc.