CMS 3D CMS Logo

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

#include <PixelVertexFinding/interface/PixelVertexProducer.h>

Inheritance diagram for PixelVertexProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 PixelVertexProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~PixelVertexProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

edm::ParameterSet conf_
 
DivisiveVertexFinderdvf_
 
double ptMin_
 
int verbose_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Description: This produces 1D (z only) primary vertexes using only pixel information.

Implementation: This producer can use either the Divisive Primary Vertex Finder or the Histogramming Primary Vertex Finder (currently not implemented). It relies on the PixelTripletProducer and PixelTrackProducer having already been run upstream. This is code ported from ORCA originally written by S Cucciarelli, M Konecki, D Kotlinski.

Definition at line 34 of file PixelVertexProducer.h.

Constructor & Destructor Documentation

PixelVertexProducer::PixelVertexProducer ( const edm::ParameterSet conf)
explicit

Definition at line 13 of file PixelVertexProducer.cc.

References conf_, dvf_, edm::ParameterSet::getParameter(), ptMin_, and verbose_.

14  : conf_(conf), verbose_(0), dvf_(0), ptMin_(1.0)
15 {
16  // Register my product
17  produces<reco::VertexCollection>();
18 
19  // Setup shop
20  verbose_ = conf.getParameter<int>("Verbosity"); // 0 silent, 1 chatty, 2 loud
21  std::string finder = conf.getParameter<std::string>("Finder"); // DivisiveVertexFinder
22  bool useError = conf.getParameter<bool>("UseError"); // true
23  bool wtAverage = conf.getParameter<bool>("WtAverage"); // true
24  double zOffset = conf.getParameter<double>("ZOffset"); // 5.0 sigma
25  double zSeparation = conf.getParameter<double>("ZSeparation"); // 0.05 cm
26  int ntrkMin = conf.getParameter<int>("NTrkMin"); // 3
27  // Tracking requirements before sending a track to be considered for vtx
28  ptMin_ = conf_.getParameter<double>("PtMin"); // 1.0 GeV
29 
30  if (finder == "DivisiveVertexFinder") {
31  if (verbose_ > 0) edm::LogInfo("PixelVertexProducer") << ": Using the DivisiveVertexFinder\n";
32  dvf_ = new DivisiveVertexFinder(zOffset, ntrkMin, useError, zSeparation, wtAverage, verbose_);
33  }
34  else { // Finder not supported, or you made a mistake in your request
35  // throw an exception once I figure out how CMSSW does this
36  }
37 }
T getParameter(std::string const &) const
edm::ParameterSet conf_
DivisiveVertexFinder * dvf_
PixelVertexProducer::~PixelVertexProducer ( )

Definition at line 40 of file PixelVertexProducer.cc.

References dvf_.

40  {
41  delete dvf_;
42 }
DivisiveVertexFinder * dvf_

Member Function Documentation

void PixelVertexProducer::produce ( edm::Event e,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 44 of file PixelVertexProducer.cc.

References reco::Vertex::add(), conf_, dvf_, reco::BeamSpot::dxdz(), reco::BeamSpot::dydz(), error, DivisiveVertexFinder::findVertexes(), DivisiveVertexFinder::findVertexesAlt(), edm::Event::getByLabel(), edm::ParameterSet::getParameter(), i, edm::HandleBase::isValid(), convertSQLiteXML::ok, edm::Handle< T >::product(), ptMin_, edm::RefVector< C, T, F >::push_back(), edm::Event::put(), edm::RefVector< C, T, F >::size(), mathSSE::sqrt(), testEve_cfg::tracks, v, verbose_, x, reco::BeamSpot::x0(), detailsBasic3DVector::y, reco::BeamSpot::y0(), detailsBasic3DVector::z, and reco::BeamSpot::z0().

44  {
45 
46  // First fish the pixel tracks out of the event
47  edm::Handle<reco::TrackCollection> trackCollection;
48  edm::InputTag trackCollName = conf_.getParameter<edm::InputTag>("TrackCollection");
49  e.getByLabel(trackCollName,trackCollection);
50  const reco::TrackCollection tracks = *(trackCollection.product());
51  if (verbose_ > 0) edm::LogInfo("PixelVertexProducer") << ": Found " << tracks.size() << " tracks in TrackCollection called " << trackCollName << "\n";
52 
53 
54  // Second, make a collection of pointers to the tracks we want for the vertex finder
56  for (unsigned int i=0; i<tracks.size(); i++) {
57  if (tracks[i].pt() > ptMin_)
58  trks.push_back( reco::TrackRef(trackCollection, i) );
59  }
60  if (verbose_ > 0) edm::LogInfo("PixelVertexProducer") << ": Selected " << trks.size() << " of these tracks for vertexing\n";
61 
63  edm::InputTag bsName = conf_.getParameter<edm::InputTag>("beamSpot");
64  e.getByLabel(bsName,bsHandle);
65  math::XYZPoint myPoint(0.,0.,0.);
66  if (bsHandle.isValid()) myPoint = math::XYZPoint(bsHandle->x0(),bsHandle->y0(), 0. ); //FIXME: fix last coordinate with vertex.z() at same time
67 
68  // Third, ship these tracks off to be vertexed
69  std::auto_ptr<reco::VertexCollection> vertexes(new reco::VertexCollection);
70  bool ok;
71  if (conf_.getParameter<bool>("Method2")) {
72  ok = dvf_->findVertexesAlt(trks, // input
73  *vertexes,myPoint); // output
74  if (verbose_ > 0) edm::LogInfo("PixelVertexProducer") << "Method2 returned status of " << ok;
75  }
76  else {
77  ok = dvf_->findVertexes(trks, // input
78  *vertexes); // output
79  if (verbose_ > 0) edm::LogInfo("PixelVertexProducer") << "Method1 returned status of " << ok;
80  }
81 
82  if (verbose_ > 0) {
83  edm::LogInfo("PixelVertexProducer") << ": Found " << vertexes->size() << " vertexes\n";
84  for (unsigned int i=0; i<vertexes->size(); ++i) {
85  edm::LogInfo("PixelVertexProducer") << "Vertex number " << i << " has " << (*vertexes)[i].tracksSize() << " tracks with a position of " << (*vertexes)[i].z() << " +- " << std::sqrt( (*vertexes)[i].covariance(2,2) );
86  }
87  }
88 
89 
90  if(bsHandle.isValid())
91  {
92  const reco::BeamSpot & bs = *bsHandle;
93 
94  for (unsigned int i=0; i<vertexes->size(); ++i) {
95  double z=(*vertexes)[i].z();
96  double x=bs.x0()+bs.dxdz()*(z-bs.z0());
97  double y=bs.y0()+bs.dydz()*(z-bs.z0());
98  reco::Vertex v( reco::Vertex::Point(x,y,z), (*vertexes)[i].error(),(*vertexes)[i].chi2() , (*vertexes)[i].ndof() , (*vertexes)[i].tracksSize());
99  //Copy also the tracks
100  for (std::vector<reco::TrackBaseRef >::const_iterator it = (*vertexes)[i].tracks_begin();
101  it !=(*vertexes)[i].tracks_end(); it++) {
102  v.add( *it );
103  }
104  (*vertexes)[i]=v;
105 
106  }
107  }
108  else
109  {
110  edm::LogWarning("PixelVertexProducer") << "No beamspot found. Using returning vertexes with (0,0,Z) ";
111  }
112 
113  e.put(vertexes);
114 }
T getParameter(std::string const &) const
double z0() const
z coordinate
Definition: BeamSpot.h:69
int i
Definition: DBlmapReader.cc:9
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
bool findVertexesAlt(const reco::TrackRefVector &trks, reco::VertexCollection &vertexes, const math::XYZPoint &bs)
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::ParameterSet conf_
double double double z
double dydz() const
dydz slope
Definition: BeamSpot.h:85
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
T sqrt(T t)
Definition: SSEVec.h:28
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
bool findVertexes(const reco::TrackRefVector &trks, reco::VertexCollection &vertexes)
Run the divisive algorithm and return a vector of vertexes for the input track collection.
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
double dxdz() const
dxdz slope
Definition: BeamSpot.h:83
tuple tracks
Definition: testEve_cfg.py:39
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
T const * product() const
Definition: Handle.h:74
DivisiveVertexFinder * dvf_
double y0() const
y coordinate
Definition: BeamSpot.h:67
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:60
size_type size() const
Size of the RefVector.
Definition: RefVector.h:84
Definition: DDAxes.h:10
mathSSE::Vec4< T > v
double x0() const
x coordinate
Definition: BeamSpot.h:65

Member Data Documentation

edm::ParameterSet PixelVertexProducer::conf_
private

Definition at line 42 of file PixelVertexProducer.h.

Referenced by PixelVertexProducer(), and produce().

DivisiveVertexFinder* PixelVertexProducer::dvf_
private

Definition at line 45 of file PixelVertexProducer.h.

Referenced by PixelVertexProducer(), produce(), and ~PixelVertexProducer().

double PixelVertexProducer::ptMin_
private

Definition at line 47 of file PixelVertexProducer.h.

Referenced by PixelVertexProducer(), and produce().

int PixelVertexProducer::verbose_
private

Definition at line 44 of file PixelVertexProducer.h.

Referenced by PixelVertexProducer(), and produce().