#include <PixelVertexProducerClusters.h>
Public Member Functions | |
int | getContainedHits (std::vector< VertexHit > hits, float z0, float &chi) |
PixelVertexProducerClusters (const edm::ParameterSet &ps) | |
virtual void | produce (edm::Event &ev, const edm::EventSetup &es) |
~PixelVertexProducerClusters () | |
Private Member Functions | |
void | beginRun (edm::Run const &run, edm::EventSetup const &es) |
Private Attributes | |
edm::ParameterSet | theConfig |
const TrackerGeometry * | theTracker |
Definition at line 12 of file PixelVertexProducerClusters.h.
PixelVertexProducerClusters::PixelVertexProducerClusters | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 47 of file PixelVertexProducerClusters.cc.
: theConfig(ps) { // Product produces<reco::VertexCollection>(); }
PixelVertexProducerClusters::~PixelVertexProducerClusters | ( | ) |
Definition at line 55 of file PixelVertexProducerClusters.cc.
{ }
void PixelVertexProducerClusters::beginRun | ( | edm::Run const & | run, |
edm::EventSetup const & | es | ||
) | [private] |
Definition at line 61 of file PixelVertexProducerClusters.cc.
References edm::EventSetup::get(), and edm::ESHandle< T >::product().
{ // Get tracker geometry edm::ESHandle<TrackerGeometry> trackerHandle; es.get<TrackerDigiGeometryRecord>().get(trackerHandle); theTracker = trackerHandle.product(); }
int PixelVertexProducerClusters::getContainedHits | ( | std::vector< VertexHit > | hits, |
float | z0, | ||
float & | chi | ||
) |
Definition at line 71 of file PixelVertexProducerClusters.cc.
References n, L1TEmulatorMonitor_cff::p, and hit::z.
void PixelVertexProducerClusters::produce | ( | edm::Event & | ev, |
const edm::EventSetup & | es | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 94 of file PixelVertexProducerClusters.cc.
References edmNew::DetSetVector< T >::data(), ExpressReco_HICollisions_FallBack::e, edm::Event::getByLabel(), PixelTopology::isItEdgePixelInX(), PixelTopology::isItEdgePixelInY(), LogTrace, evf::utils::pid, PixelSubdetector::PixelBarrel, edm::Handle< T >::product(), edm::Event::put(), VertexHit::r, edmNew::DetSetVector< T >::size(), PixelGeomDetUnit::specificTopology(), cmsDownloadME::ver, ExpressReco_HICollisions_FallBack::vertices, VertexHit::w, and VertexHit::z.
{ // Get pixel hit collections edm::Handle<SiPixelRecHitCollection> pixelColl; ev.getByLabel("siPixelRecHits", pixelColl); const SiPixelRecHitCollection* thePixelHits = pixelColl.product(); std::auto_ptr<reco::VertexCollection> vertices(new reco::VertexCollection); if(thePixelHits->size() > 0) { vector<VertexHit> hits; for(SiPixelRecHitCollection::DataContainer::const_iterator recHit = thePixelHits->data().begin(), recHitEnd = thePixelHits->data().end(); recHit != recHitEnd; ++recHit) { if(recHit->isValid()) { // if(!(recHit->isOnEdge() || recHit->hasBadPixels())) DetId id = recHit->geographicalId(); const PixelGeomDetUnit* pgdu = dynamic_cast<const PixelGeomDetUnit*>(theTracker->idToDetUnit(id)); const PixelTopology* theTopol = ( &(pgdu->specificTopology()) ); vector<SiPixelCluster::Pixel> pixels = recHit->cluster()->pixels(); bool pixelOnEdge = false; for(vector<SiPixelCluster::Pixel>::const_iterator pixel = pixels.begin(); pixel!= pixels.end(); pixel++) { int pos_x = (int)pixel->x; int pos_y = (int)pixel->y; if(theTopol->isItEdgePixelInX(pos_x) || theTopol->isItEdgePixelInY(pos_y)) { pixelOnEdge = true; break; } } if(!pixelOnEdge) if(id.subdetId() == int(PixelSubdetector::PixelBarrel)) { PXBDetId pid(id); LocalPoint lpos = LocalPoint(recHit->localPosition().x(), recHit->localPosition().y(), recHit->localPosition().z()); GlobalPoint gpos = theTracker->idToDet(id)->toGlobal(lpos); VertexHit hit; hit.z = gpos.z(); hit.r = gpos.perp(); hit.w = recHit->cluster()->sizeY(); hits.push_back(hit); } } } int nhits; int nhits_max = 0; float chi; float chi_max = 1e+9; float zest = 0; for(float z0 = -15.9; z0 <= 15.95; z0 += 0.1) { nhits = getContainedHits(hits, z0, chi); if(nhits > 0) { if(nhits > nhits_max) { chi_max = 1e+9; nhits_max = nhits; } if(nhits >= nhits_max) if(chi < chi_max) { chi_max = chi; zest = z0; } } } LogTrace("MinBiasTracking") << " [vertex position] estimated = " << zest << " | pixel barrel hits = " << thePixelHits->size(); reco::Vertex::Error err; err(2,2) = 0.6 * 0.6; reco::Vertex ver(reco::Vertex::Point(0,0,zest), err, 0, 1, 1); vertices->push_back(ver); } ev.put(vertices); }
Definition at line 23 of file PixelVertexProducerClusters.h.
const TrackerGeometry* PixelVertexProducerClusters::theTracker [private] |
Definition at line 25 of file PixelVertexProducerClusters.h.