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
PixelVertexProducerClusters Class Reference

#include <PixelVertexProducerClusters.h>

Inheritance diagram for PixelVertexProducerClusters:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PixelVertexProducerClusters (const edm::ParameterSet &ps)
 
virtual void produce (edm::StreamID, edm::Event &ev, const edm::EventSetup &es) const override
 
 ~PixelVertexProducerClusters ()
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::EDGetTokenT
< SiPixelRecHitCollection
pixelToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 13 of file PixelVertexProducerClusters.h.

Constructor & Destructor Documentation

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

Definition at line 65 of file PixelVertexProducerClusters.cc.

65  : pixelToken_(consumes<SiPixelRecHitCollection>(edm::InputTag("siPixelRecHits")))
66 {
67  // Product
68  produces<reco::VertexCollection>();
69 }
edm::EDGetTokenT< SiPixelRecHitCollection > pixelToken_
PixelVertexProducerClusters::~PixelVertexProducerClusters ( )

Definition at line 72 of file PixelVertexProducerClusters.cc.

73 {
74 }

Member Function Documentation

void PixelVertexProducerClusters::produce ( edm::StreamID  ,
edm::Event ev,
const edm::EventSetup es 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 79 of file PixelVertexProducerClusters.cc.

References edmNew::DetSetVector< T >::data(), alignCSCRings::e, edm::EventSetup::get(), edm::Event::getByToken(), TrackerGeometry::idToDet(), TrackerGeometry::idToDetUnit(), PixelTopology::isItEdgePixelInX(), PixelTopology::isItEdgePixelInY(), LogTrace, nhits, PixelSubdetector::PixelBarrel, edm::Handle< T >::product(), edm::ESHandle< class >::product(), edm::Event::put(), edmNew::DetSetVector< T >::size(), PixelGeomDetUnit::specificTopology(), GeomDet::toGlobal(), and HLT_FULL_cff::vertices.

80 {
81  //Retrieve tracker topology from geometry
83  es.get<TrackerTopologyRcd>().get(tTopo);
84 
85  // Get tracker geometry
86  edm::ESHandle<TrackerGeometry> trackerHandle;
87  es.get<TrackerDigiGeometryRecord>().get(trackerHandle);
88  const TrackerGeometry* theTracker = trackerHandle.product();
89 
90 
91  // Get pixel hit collections
93  ev.getByToken(pixelToken_, pixelColl);
94 
95  const SiPixelRecHitCollection* thePixelHits = pixelColl.product();
96 
97  std::auto_ptr<reco::VertexCollection> vertices(new reco::VertexCollection);
98 
99  if(thePixelHits->size() > 0)
100  {
101  vector<VertexHit> hits;
102 
104  recHit = thePixelHits->data().begin(),
105  recHitEnd = thePixelHits->data().end();
106  recHit != recHitEnd; ++recHit)
107  {
108  if(recHit->isValid())
109  {
110 // if(!(recHit->isOnEdge() || recHit->hasBadPixels()))
111  DetId id = recHit->geographicalId();
112  const PixelGeomDetUnit* pgdu =
113  dynamic_cast<const PixelGeomDetUnit*>(theTracker->idToDetUnit(id));
114  const PixelTopology* theTopol = ( &(pgdu->specificTopology()) );
115  vector<SiPixelCluster::Pixel> pixels = recHit->cluster()->pixels();
116 
117  bool pixelOnEdge = false;
118  for(vector<SiPixelCluster::Pixel>::const_iterator
119  pixel = pixels.begin(); pixel!= pixels.end(); pixel++)
120  {
121  int pos_x = (int)pixel->x;
122  int pos_y = (int)pixel->y;
123 
124  if(theTopol->isItEdgePixelInX(pos_x) ||
125  theTopol->isItEdgePixelInY(pos_y))
126  { pixelOnEdge = true; break; }
127  }
128 
129  if(!pixelOnEdge)
130  if(id.subdetId() == int(PixelSubdetector::PixelBarrel))
131  {
132 
133 
134  LocalPoint lpos = LocalPoint(recHit->localPosition().x(),
135  recHit->localPosition().y(),
136  recHit->localPosition().z());
137 
138  GlobalPoint gpos = theTracker->idToDet(id)->toGlobal(lpos);
139 
140  VertexHit hit;
141  hit.z = gpos.z();
142  hit.r = gpos.perp();
143  hit.w = recHit->cluster()->sizeY();
144 
145  hits.push_back(hit);
146  }
147  }
148  }
149 
150  int nhits; int nhits_max = 0;
151  float chi; float chi_max = 1e+9;
152 
153  float zest = 0;
154 
155  for(float z0 = -15.9; z0 <= 15.95; z0 += 0.1)
156  {
157  nhits = getContainedHits(hits, z0, chi);
158 
159  if(nhits > 0)
160  {
161  if(nhits > nhits_max)
162  { chi_max = 1e+9; nhits_max = nhits; }
163 
164  if(nhits >= nhits_max)
165  if(chi < chi_max)
166  { chi_max = chi; zest = z0; }
167  }
168  }
169 
170  LogTrace("MinBiasTracking")
171  << " [vertex position] estimated = " << zest
172  << " | pixel barrel hits = " << thePixelHits->size();
173 
175  err(2,2) = 0.6 * 0.6;
176  reco::Vertex ver(reco::Vertex::Point(0,0,zest), err, 0, 1, 1);
177  vertices->push_back(ver);
178  }
179 
180  ev.put(vertices);
181 }
virtual const TrackerGeomDet * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
edm::EDGetTokenT< SiPixelRecHitCollection > pixelToken_
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
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
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
data_type const * data(size_t cell) const
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
#define LogTrace(id)
Definition: DetId.h:18
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:56
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
T const * product() const
Definition: ESHandle.h:86
size_type size() const
virtual bool isItEdgePixelInY(int iybin) const =0
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
virtual const TrackerGeomDet * idToDet(DetId) const

Member Data Documentation

edm::EDGetTokenT<SiPixelRecHitCollection> PixelVertexProducerClusters::pixelToken_
private

Definition at line 21 of file PixelVertexProducerClusters.h.