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::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

int getContainedHits (const std::vector< VertexHit > &hits, float z0, float &chi)
 
 PixelVertexProducerClusters (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &ev, const edm::EventSetup &es) override
 
 ~PixelVertexProducerClusters ()
 
- 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 ()
 

Private Member Functions

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

Private Attributes

edm::ParameterSet theConfig
 
const TrackerGeometrytheTracker
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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::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

Definition at line 12 of file PixelVertexProducerClusters.h.

Constructor & Destructor Documentation

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

Definition at line 48 of file PixelVertexProducerClusters.cc.

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

Definition at line 56 of file PixelVertexProducerClusters.cc.

57 {
58 }

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 62 of file PixelVertexProducerClusters.cc.

References edm::EventSetup::get(), and edm::ESHandle< class >::product().

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

Definition at line 72 of file PixelVertexProducerClusters.cc.

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

73 {
74  int n = 0;
75  chi = 0.;
76 
77  for(vector<VertexHit>::const_iterator hit = hits.begin();
78  hit!= hits.end(); hit++)
79  {
80  // Predicted cluster width in y direction
81  float p = 2 * fabs(hit->z - z0)/hit->r + 0.5; // FIXME
82 
83  if(fabs(p - hit->w) <= 1.)
84  {
85  chi += fabs(p - hit->w);
86  n++;
87  }
88  }
89 
90  return n;
91 }
void PixelVertexProducerClusters::produce ( edm::Event ev,
const edm::EventSetup es 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 95 of file PixelVertexProducerClusters.cc.

References edmNew::DetSetVector< T >::data(), alignCSCRings::e, edm::EventSetup::get(), edm::Event::getByLabel(), PixelTopology::isItEdgePixelInX(), PixelTopology::isItEdgePixelInY(), LogTrace, PixelSubdetector::PixelBarrel, edm::Handle< T >::product(), edm::Event::put(), VertexHit::r, edmNew::DetSetVector< T >::size(), PixelGeomDetUnit::specificTopology(), VertexHit::w, and VertexHit::z.

96 {
97  //Retrieve tracker topology from geometry
99  es.get<IdealGeometryRecord>().get(tTopo);
100 
101 
102  // Get pixel hit collections
104  ev.getByLabel("siPixelRecHits", pixelColl);
105 
106  const SiPixelRecHitCollection* thePixelHits = pixelColl.product();
107 
108  std::auto_ptr<reco::VertexCollection> vertices(new reco::VertexCollection);
109 
110  if(thePixelHits->size() > 0)
111  {
112  vector<VertexHit> hits;
113 
115  recHit = thePixelHits->data().begin(),
116  recHitEnd = thePixelHits->data().end();
117  recHit != recHitEnd; ++recHit)
118  {
119  if(recHit->isValid())
120  {
121 // if(!(recHit->isOnEdge() || recHit->hasBadPixels()))
122  DetId id = recHit->geographicalId();
123  const PixelGeomDetUnit* pgdu =
124  dynamic_cast<const PixelGeomDetUnit*>(theTracker->idToDetUnit(id));
125  const PixelTopology* theTopol = ( &(pgdu->specificTopology()) );
126  vector<SiPixelCluster::Pixel> pixels = recHit->cluster()->pixels();
127 
128  bool pixelOnEdge = false;
129  for(vector<SiPixelCluster::Pixel>::const_iterator
130  pixel = pixels.begin(); pixel!= pixels.end(); pixel++)
131  {
132  int pos_x = (int)pixel->x;
133  int pos_y = (int)pixel->y;
134 
135  if(theTopol->isItEdgePixelInX(pos_x) ||
136  theTopol->isItEdgePixelInY(pos_y))
137  { pixelOnEdge = true; break; }
138  }
139 
140  if(!pixelOnEdge)
141  if(id.subdetId() == int(PixelSubdetector::PixelBarrel))
142  {
143 
144 
145  LocalPoint lpos = LocalPoint(recHit->localPosition().x(),
146  recHit->localPosition().y(),
147  recHit->localPosition().z());
148 
149  GlobalPoint gpos = theTracker->idToDet(id)->toGlobal(lpos);
150 
151  VertexHit hit;
152  hit.z = gpos.z();
153  hit.r = gpos.perp();
154  hit.w = recHit->cluster()->sizeY();
155 
156  hits.push_back(hit);
157  }
158  }
159  }
160 
161  int nhits; int nhits_max = 0;
162  float chi; float chi_max = 1e+9;
163 
164  float zest = 0;
165 
166  for(float z0 = -15.9; z0 <= 15.95; z0 += 0.1)
167  {
168  nhits = getContainedHits(hits, z0, chi);
169 
170  if(nhits > 0)
171  {
172  if(nhits > nhits_max)
173  { chi_max = 1e+9; nhits_max = nhits; }
174 
175  if(nhits >= nhits_max)
176  if(chi < chi_max)
177  { chi_max = chi; zest = z0; }
178  }
179  }
180 
181  LogTrace("MinBiasTracking")
182  << " [vertex position] estimated = " << zest
183  << " | pixel barrel hits = " << thePixelHits->size();
184 
186  err(2,2) = 0.6 * 0.6;
187  reco::Vertex ver(reco::Vertex::Point(0,0,zest), err, 0, 1, 1);
188  vertices->push_back(ver);
189  }
190 
191  ev.put(vertices);
192 }
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:43
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
virtual bool isItEdgePixelInX(int ixbin) const =0
int getContainedHits(const std::vector< VertexHit > &hits, float z0, float &chi)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
data_type const * data(size_t cell) const
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
virtual const GeomDet * idToDet(DetId) const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
#define LogTrace(id)
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:55
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
T const * product() const
Definition: Handle.h:81
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.