CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules 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)
 
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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordgeomToken_
 
edm::EDGetTokenT< SiPixelRecHitCollectionpixelToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 18 of file PixelVertexProducerClusters.h.

Constructor & Destructor Documentation

◆ PixelVertexProducerClusters()

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

Definition at line 55 of file PixelVertexProducerClusters.cc.

56  : geomToken_(esConsumes()), pixelToken_(consumes<SiPixelRecHitCollection>(edm::InputTag("siPixelRecHits"))) {
57  // Product
58  produces<reco::VertexCollection>();
59 }
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
edm::EDGetTokenT< SiPixelRecHitCollection > pixelToken_

◆ ~PixelVertexProducerClusters()

PixelVertexProducerClusters::~PixelVertexProducerClusters ( )
override

Definition at line 62 of file PixelVertexProducerClusters.cc.

62 {}

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 65 of file PixelVertexProducerClusters.cc.

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

65  {
66  // Get tracker geometry
67  const TrackerGeometry* theTracker = &es.getData(geomToken_);
68 
69  // Get pixel hit collections
71  ev.getByToken(pixelToken_, pixelColl);
72 
73  const SiPixelRecHitCollection* thePixelHits = pixelColl.product();
74 
75  auto vertices = std::make_unique<reco::VertexCollection>();
76 
77  if (!thePixelHits->empty()) {
78  vector<VertexHit> hits;
79 
81  recHitEnd = thePixelHits->data().end();
82  recHit != recHitEnd;
83  ++recHit) {
84  if (recHit->isValid()) {
85  // if(!(recHit->isOnEdge() || recHit->hasBadPixels()))
86  DetId id = recHit->geographicalId();
87  const PixelGeomDetUnit* pgdu = dynamic_cast<const PixelGeomDetUnit*>(theTracker->idToDetUnit(id));
88  const PixelTopology* theTopol = (&(pgdu->specificTopology()));
89  vector<SiPixelCluster::Pixel> pixels = recHit->cluster()->pixels();
90 
91  bool pixelOnEdge = false;
92  for (vector<SiPixelCluster::Pixel>::const_iterator pixel = pixels.begin(); pixel != pixels.end(); pixel++) {
93  int pos_x = (int)pixel->x;
94  int pos_y = (int)pixel->y;
95 
96  if (theTopol->isItEdgePixelInX(pos_x) || theTopol->isItEdgePixelInY(pos_y)) {
97  pixelOnEdge = true;
98  break;
99  }
100  }
101 
102  if (!pixelOnEdge)
103  if (id.subdetId() == int(PixelSubdetector::PixelBarrel)) {
104  LocalPoint lpos =
105  LocalPoint(recHit->localPosition().x(), recHit->localPosition().y(), recHit->localPosition().z());
106 
107  GlobalPoint gpos = theTracker->idToDet(id)->toGlobal(lpos);
108 
109  VertexHit hit;
110  hit.z = gpos.z();
111  hit.r = gpos.perp();
112  hit.w = recHit->cluster()->sizeY();
113 
114  hits.push_back(hit);
115  }
116  }
117  }
118 
119  int nhits;
120  int nhits_max = 0;
121  float chi;
122  float chi_max = 1e+9;
123 
124  float zest = 0;
125 
126  for (float z0 = -15.9; z0 <= 15.95; z0 += 0.1) {
127  nhits = getContainedHits(hits, z0, chi);
128 
129  if (nhits > 0) {
130  if (nhits > nhits_max) {
131  chi_max = 1e+9;
132  nhits_max = nhits;
133  }
134 
135  if (nhits >= nhits_max)
136  if (chi < chi_max) {
137  chi_max = chi;
138  zest = z0;
139  }
140  }
141  }
142 
143  LogTrace("MinBiasTracking") << " [vertex position] estimated = " << zest
144  << " | pixel barrel hits = " << thePixelHits->size();
145 
147  err(2, 2) = 0.6 * 0.6;
148  reco::Vertex ver(reco::Vertex::Point(0, 0, zest), err, 0, 1, 1);
149  vertices->push_back(ver);
150  }
151 
152  ev.put(std::move(vertices));
153 }
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
edm::EDGetTokenT< SiPixelRecHitCollection > pixelToken_
T const * product() const
Definition: Handle.h:70
data_type const * data(size_t cell) const
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
#define LogTrace(id)
virtual bool isItEdgePixelInX(int ixbin) const =0
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
const TrackerGeomDet * idToDet(DetId) const override
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetId.h:17
size_type size() const
virtual bool isItEdgePixelInY(int iybin) const =0
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ geomToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> PixelVertexProducerClusters::geomToken_
private

Definition at line 25 of file PixelVertexProducerClusters.h.

Referenced by produce().

◆ pixelToken_

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

Definition at line 26 of file PixelVertexProducerClusters.h.

Referenced by produce().