CMS 3D CMS Logo

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)
 
void produce (edm::StreamID, edm::Event &ev, const edm::EventSetup &es) const override
 
 ~PixelVertexProducerClusters () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::EDGetTokenT< SiPixelRecHitCollectionpixelToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
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::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 17 of file PixelVertexProducerClusters.h.

Constructor & Destructor Documentation

◆ PixelVertexProducerClusters()

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

Definition at line 58 of file PixelVertexProducerClusters.cc.

59  : pixelToken_(consumes<SiPixelRecHitCollection>(edm::InputTag("siPixelRecHits"))) {
60  // Product
61  produces<reco::VertexCollection>();
62 }

◆ ~PixelVertexProducerClusters()

PixelVertexProducerClusters::~PixelVertexProducerClusters ( )
override

Definition at line 65 of file PixelVertexProducerClusters.cc.

65 {}

Member Function Documentation

◆ produce()

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

Implements edm::global::EDProducerBase.

Definition at line 68 of file PixelVertexProducerClusters.cc.

68  {
69  //Retrieve tracker topology from geometry
71  es.get<TrackerTopologyRcd>().get(tTopo);
72 
73  // Get tracker geometry
74  edm::ESHandle<TrackerGeometry> trackerHandle;
75  es.get<TrackerDigiGeometryRecord>().get(trackerHandle);
76  const TrackerGeometry* theTracker = trackerHandle.product();
77 
78  // Get pixel hit collections
80  ev.getByToken(pixelToken_, pixelColl);
81 
82  const SiPixelRecHitCollection* thePixelHits = pixelColl.product();
83 
84  auto vertices = std::make_unique<reco::VertexCollection>();
85 
86  if (!thePixelHits->empty()) {
87  vector<VertexHit> hits;
88 
90  recHitEnd = thePixelHits->data().end();
91  recHit != recHitEnd;
92  ++recHit) {
93  if (recHit->isValid()) {
94  // if(!(recHit->isOnEdge() || recHit->hasBadPixels()))
95  DetId id = recHit->geographicalId();
96  const PixelGeomDetUnit* pgdu = dynamic_cast<const PixelGeomDetUnit*>(theTracker->idToDetUnit(id));
97  const PixelTopology* theTopol = (&(pgdu->specificTopology()));
98  vector<SiPixelCluster::Pixel> pixels = recHit->cluster()->pixels();
99 
100  bool pixelOnEdge = false;
101  for (vector<SiPixelCluster::Pixel>::const_iterator pixel = pixels.begin(); pixel != pixels.end(); pixel++) {
102  int pos_x = (int)pixel->x;
103  int pos_y = (int)pixel->y;
104 
105  if (theTopol->isItEdgePixelInX(pos_x) || theTopol->isItEdgePixelInY(pos_y)) {
106  pixelOnEdge = true;
107  break;
108  }
109  }
110 
111  if (!pixelOnEdge)
112  if (id.subdetId() == int(PixelSubdetector::PixelBarrel)) {
113  LocalPoint lpos =
114  LocalPoint(recHit->localPosition().x(), recHit->localPosition().y(), recHit->localPosition().z());
115 
116  GlobalPoint gpos = theTracker->idToDet(id)->toGlobal(lpos);
117 
118  VertexHit hit;
119  hit.z = gpos.z();
120  hit.r = gpos.perp();
121  hit.w = recHit->cluster()->sizeY();
122 
123  hits.push_back(hit);
124  }
125  }
126  }
127 
128  int nhits;
129  int nhits_max = 0;
130  float chi;
131  float chi_max = 1e+9;
132 
133  float zest = 0;
134 
135  for (float z0 = -15.9; z0 <= 15.95; z0 += 0.1) {
136  nhits = getContainedHits(hits, z0, chi);
137 
138  if (nhits > 0) {
139  if (nhits > nhits_max) {
140  chi_max = 1e+9;
141  nhits_max = nhits;
142  }
143 
144  if (nhits >= nhits_max)
145  if (chi < chi_max) {
146  chi_max = chi;
147  zest = z0;
148  }
149  }
150  }
151 
152  LogTrace("MinBiasTracking") << " [vertex position] estimated = " << zest
153  << " | pixel barrel hits = " << thePixelHits->size();
154 
156  err(2, 2) = 0.6 * 0.6;
157  reco::Vertex ver(reco::Vertex::Point(0, 0, zest), err, 0, 1, 1);
158  vertices->push_back(ver);
159  }
160 
161  ev.put(std::move(vertices));
162 }

References edmNew::DetSetVector< T >::data(), MillePedeFileConverter_cfg::e, edmNew::DetSetVector< T >::empty(), runTheMatrix::err, ev, edm::EventSetup::get(), get, hfClusterShapes_cfi::hits, TrackerGeometry::idToDet(), TrackerGeometry::idToDetUnit(), createfilelist::int, LogTrace, eostools::move(), nhits, muonClassificationByHits_cfi::pixel, PixelSubdetector::PixelBarrel, pixelToken_, edm::Handle< T >::product(), edm::ESHandle< T >::product(), rpcPointValidation_cfi::recHit, edmNew::DetSetVector< T >::size(), PixelGeomDetUnit::specificTopology(), GeomDet::toGlobal(), pwdgSkimBPark_cfi::vertices, hit::z, and HLTMuonOfflineAnalyzer_cfi::z0.

Member Data Documentation

◆ pixelToken_

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

Definition at line 24 of file PixelVertexProducerClusters.h.

Referenced by produce().

TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
PixelVertexProducerClusters::pixelToken_
edm::EDGetTokenT< SiPixelRecHitCollection > pixelToken_
Definition: PixelVertexProducerClusters.h:24
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
edm::Handle::product
T const * product() const
Definition: Handle.h:70
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
edmNew::DetSetVector::size
size_type size() const
Definition: DetSetVectorNew.h:596
reco::Vertex::Error
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
edmNew::DetSetVector::const_iterator
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetSetVectorNew.h:231
muonClassificationByHits_cfi.pixel
pixel
Definition: muonClassificationByHits_cfi.py:9
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
edm::Handle
Definition: AssociativeIterator.h:50
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
TrackerGeometry::idToDetUnit
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: TrackerGeometry.cc:183
DetId
Definition: DetId.h:17
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
edm::ESHandle< TrackerTopology >
HLTMuonOfflineAnalyzer_cfi.z0
z0
Definition: HLTMuonOfflineAnalyzer_cfi.py:98
Point3DBase< float, LocalTag >
nhits
Definition: HIMultiTrackSelector.h:42
PixelTopology
Definition: PixelTopology.h:10
hit::z
double z
Definition: SiStripHitEffFromCalibTree.cc:91
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
runTheMatrix.err
err
Definition: runTheMatrix.py:288
edmNew::DetSetVector::empty
bool empty() const
Definition: DetSetVectorNew.h:592
PixelGeomDetUnit::specificTopology
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
Definition: PixelGeomDetUnit.cc:17
createfilelist.int
int
Definition: createfilelist.py:10
get
#define get
edmNew::DetSetVector
Definition: DetSetNew.h:13
reco::Vertex::Point
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
eostools.move
def move(src, dest)
Definition: eostools.py:511
edmNew::DetSetVector::data
data_type const * data(size_t cell) const
Definition: DetSetVectorNew.h:602
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
edm::InputTag
Definition: InputTag.h:15
reco::Vertex
Definition: Vertex.h:35
hit
Definition: SiStripHitEffFromCalibTree.cc:88
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
TrackerGeometry
Definition: TrackerGeometry.h:14