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 Member Functions | Private Attributes
PixelVertexProducerClusters Class Reference

#include <PixelVertexProducerClusters.h>

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

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 ()
 
- 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 Member Functions

void beginRun (edm::Run const &run, edm::EventSetup const &es)
 

Private Attributes

edm::ParameterSet theConfig
 
const TrackerGeometrytheTracker
 

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)
 
static void prevalidate (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

Definition at line 12 of file PixelVertexProducerClusters.h.

Constructor & Destructor Documentation

PixelVertexProducerClusters::PixelVertexProducerClusters ( const edm::ParameterSet ps)
explicit

Definition at line 47 of file PixelVertexProducerClusters.cc.

47  : theConfig(ps)
48 {
49  // Product
50  produces<reco::VertexCollection>();
51 }
PixelVertexProducerClusters::~PixelVertexProducerClusters ( )

Definition at line 55 of file PixelVertexProducerClusters.cc.

56 {
57 }

Member Function Documentation

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< class >::product().

62 {
63  // Get tracker geometry
64  edm::ESHandle<TrackerGeometry> trackerHandle;
65  es.get<TrackerDigiGeometryRecord>().get(trackerHandle);
66  theTracker = trackerHandle.product();
67 }
T const * product() const
Definition: ESHandle.h:62
int PixelVertexProducerClusters::getContainedHits ( std::vector< VertexHit hits,
float  z0,
float &  chi 
)

Definition at line 71 of file PixelVertexProducerClusters.cc.

References n, AlCaHLTBitMon_ParallelJobs::p, and hit::z.

72 {
73  int n = 0;
74  chi = 0.;
75 
76  for(vector<VertexHit>::const_iterator hit = hits.begin();
77  hit!= hits.end(); hit++)
78  {
79  // Predicted cluster width in y direction
80  float p = 2 * fabs(hit->z - z0)/hit->r + 0.5; // FIXME
81 
82  if(fabs(p - hit->w) <= 1.)
83  {
84  chi += fabs(p - hit->w);
85  n++;
86  }
87  }
88 
89  return n;
90 }
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(), alignCSCRings::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(), VertexHit::w, and VertexHit::z.

95 {
96  // Get pixel hit collections
98  ev.getByLabel("siPixelRecHits", pixelColl);
99 
100  const SiPixelRecHitCollection* thePixelHits = pixelColl.product();
101 
102  std::auto_ptr<reco::VertexCollection> vertices(new reco::VertexCollection);
103 
104  if(thePixelHits->size() > 0)
105  {
106  vector<VertexHit> hits;
107 
109  recHit = thePixelHits->data().begin(),
110  recHitEnd = thePixelHits->data().end();
111  recHit != recHitEnd; ++recHit)
112  {
113  if(recHit->isValid())
114  {
115 // if(!(recHit->isOnEdge() || recHit->hasBadPixels()))
116  DetId id = recHit->geographicalId();
117  const PixelGeomDetUnit* pgdu =
118  dynamic_cast<const PixelGeomDetUnit*>(theTracker->idToDetUnit(id));
119  const PixelTopology* theTopol = ( &(pgdu->specificTopology()) );
120  vector<SiPixelCluster::Pixel> pixels = recHit->cluster()->pixels();
121 
122  bool pixelOnEdge = false;
123  for(vector<SiPixelCluster::Pixel>::const_iterator
124  pixel = pixels.begin(); pixel!= pixels.end(); pixel++)
125  {
126  int pos_x = (int)pixel->x;
127  int pos_y = (int)pixel->y;
128 
129  if(theTopol->isItEdgePixelInX(pos_x) ||
130  theTopol->isItEdgePixelInY(pos_y))
131  { pixelOnEdge = true; break; }
132  }
133 
134  if(!pixelOnEdge)
135  if(id.subdetId() == int(PixelSubdetector::PixelBarrel))
136  {
137  PXBDetId pid(id);
138 
139  LocalPoint lpos = LocalPoint(recHit->localPosition().x(),
140  recHit->localPosition().y(),
141  recHit->localPosition().z());
142 
143  GlobalPoint gpos = theTracker->idToDet(id)->toGlobal(lpos);
144 
145  VertexHit hit;
146  hit.z = gpos.z();
147  hit.r = gpos.perp();
148  hit.w = recHit->cluster()->sizeY();
149 
150  hits.push_back(hit);
151  }
152  }
153  }
154 
155  int nhits; int nhits_max = 0;
156  float chi; float chi_max = 1e+9;
157 
158  float zest = 0;
159 
160  for(float z0 = -15.9; z0 <= 15.95; z0 += 0.1)
161  {
162  nhits = getContainedHits(hits, z0, chi);
163 
164  if(nhits > 0)
165  {
166  if(nhits > nhits_max)
167  { chi_max = 1e+9; nhits_max = nhits; }
168 
169  if(nhits >= nhits_max)
170  if(chi < chi_max)
171  { chi_max = chi; zest = z0; }
172  }
173  }
174 
175  LogTrace("MinBiasTracking")
176  << " [vertex position] estimated = " << zest
177  << " | pixel barrel hits = " << thePixelHits->size();
178 
180  err(2,2) = 0.6 * 0.6;
181  reco::Vertex ver(reco::Vertex::Point(0,0,zest), err, 0, 1, 1);
182  vertices->push_back(ver);
183  }
184 
185  ev.put(vertices);
186 }
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
virtual bool isItEdgePixelInX(int ixbin) const =0
int getContainedHits(std::vector< VertexHit > hits, float z0, float &chi)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
data_type const * data(size_t cell) const
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
virtual const GeomDet * idToDet(DetId) const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
#define LogTrace(id)
Definition: DetId.h:20
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
T const * product() const
Definition: Handle.h:74
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
size_type size() const
virtual bool isItEdgePixelInY(int iybin) const =0
Local3DPoint LocalPoint
Definition: LocalPoint.h:11

Member Data Documentation

edm::ParameterSet PixelVertexProducerClusters::theConfig
private

Definition at line 23 of file PixelVertexProducerClusters.h.

const TrackerGeometry* PixelVertexProducerClusters::theTracker
private

Definition at line 25 of file PixelVertexProducerClusters.h.