CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
HIPixelClusterVtxProducer Class Reference

#include <HIPixelClusterVtxProducer.h>

Inheritance diagram for HIPixelClusterVtxProducer:
edm::stream::EDProducer<>

Classes

struct  VertexHit
 

Public Member Functions

 HIPixelClusterVtxProducer (const edm::ParameterSet &ps)
 
 ~HIPixelClusterVtxProducer () override
 
- Public Member Functions inherited from edm::stream::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
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

int getContainedHits (const std::vector< VertexHit > &hits, double z0, double &chi)
 
void produce (edm::Event &ev, const edm::EventSetup &es) override
 

Private Attributes

double maxZ_
 
double minZ_
 
edm::EDGetTokenT< SiPixelRecHitCollectionsrcPixels_
 
std::string srcPixelsString_
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtrackerToken_
 
double zStep_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 19 of file HIPixelClusterVtxProducer.h.

Constructor & Destructor Documentation

◆ HIPixelClusterVtxProducer()

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

Definition at line 25 of file HIPixelClusterVtxProducer.cc.

References srcPixels_, and srcPixelsString_.

26  : srcPixelsString_(ps.getParameter<std::string>("pixelRecHits")),
28  minZ_(ps.getParameter<double>("minZ")),
29  maxZ_(ps.getParameter<double>("maxZ")),
30  zStep_(ps.getParameter<double>("zStep"))
31 
32 {
33  // Constructor
34  produces<reco::VertexCollection>();
35  srcPixels_ = (consumes<SiPixelRecHitCollection>(srcPixelsString_));
36 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerToken_
edm::EDGetTokenT< SiPixelRecHitCollection > srcPixels_

◆ ~HIPixelClusterVtxProducer()

HIPixelClusterVtxProducer::~HIPixelClusterVtxProducer ( )
override

Definition at line 39 of file HIPixelClusterVtxProducer.cc.

39  {
40  // Destructor
41 }

Member Function Documentation

◆ getContainedHits()

int HIPixelClusterVtxProducer::getContainedHits ( const std::vector< VertexHit > &  hits,
double  z0,
double &  chi 
)
private

Definition at line 126 of file HIPixelClusterVtxProducer.cc.

References hfClusterShapes_cfi::hits, dqmiodumpmetadata::n, AlCaHLTBitMon_ParallelJobs::p, hit::z, and HLTMuonOfflineAnalyzer_cfi::z0.

Referenced by produce().

126  {
127  // Calculate number of hits contained in v-shaped window in cluster y-width vs. z-position.
128  int n = 0;
129  chi = 0.;
130 
131  for (std::vector<VertexHit>::const_iterator hit = hits.begin(); hit != hits.end(); hit++) {
132  double p = 2 * fabs(hit->z - z0) / hit->r + 0.5; // FIXME
133  if (TMath::Abs(p - hit->w) <= 1.) {
134  chi += fabs(p - hit->w);
135  n++;
136  }
137  }
138  return n;
139 }

◆ produce()

void HIPixelClusterVtxProducer::produce ( edm::Event ev,
const edm::EventSetup es 
)
overrideprivate

Definition at line 44 of file HIPixelClusterVtxProducer.cc.

References MillePedeFileConverter_cfg::e, mps_fire::end, submitPVResolutionJobs::err, makeMEIFBenchmarkPlots::ev, getContainedHits(), edm::EventSetup::getData(), hfClusterShapes_cfi::hits, l1ctLayer2EG_cff::id, TrackerGeometry::idToDet(), createfilelist::int, PixelTopology::isItEdgePixelInX(), PixelTopology::isItEdgePixelInY(), LogTrace, maxZ_, minZ_, eostools::move(), nhits, muonClassificationByHits_cfi::pixel, PixelSubdetector::PixelBarrel, HIPixelClusterVtxProducer::VertexHit::r, PixelGeomDetUnit::specificTopology(), srcPixels_, GeomDet::toGlobal(), trackerToken_, AlignmentTracksFromVertexSelector_cfi::vertices, HIPixelClusterVtxProducer::VertexHit::w, hit::x, hit::y, HIPixelClusterVtxProducer::VertexHit::z, hit::z, HLTMuonOfflineAnalyzer_cfi::z0, and zStep_.

44  {
45  // new vertex collection
46  auto vertices = std::make_unique<reco::VertexCollection>();
47 
48  // get pixel rechits
50  ev.getByToken(srcPixels_, hRecHits);
51 
52  // get tracker geometry
53  if (hRecHits.isValid()) {
54  const TrackerGeometry *tgeo = &es.getData(trackerToken_);
55  const SiPixelRecHitCollection *hits = hRecHits.product();
56 
57  // loop over pixel rechits
58  std::vector<VertexHit> vhits;
59  for (SiPixelRecHitCollection::DataContainer::const_iterator hit = hits->data().begin(), end = hits->data().end();
60  hit != end;
61  ++hit) {
62  if (!hit->isValid())
63  continue;
64  DetId id(hit->geographicalId());
65  if (id.subdetId() != int(PixelSubdetector::PixelBarrel))
66  continue;
67  const PixelGeomDetUnit *pgdu = static_cast<const PixelGeomDetUnit *>(tgeo->idToDet(id));
68  if (true) {
69  const PixelTopology *pixTopo = &(pgdu->specificTopology());
70  std::vector<SiPixelCluster::Pixel> pixels(hit->cluster()->pixels());
71  bool pixelOnEdge = false;
72  for (std::vector<SiPixelCluster::Pixel>::const_iterator pixel = pixels.begin(); pixel != pixels.end();
73  ++pixel) {
74  int pixelX = pixel->x;
75  int pixelY = pixel->y;
76  if (pixTopo->isItEdgePixelInX(pixelX) || pixTopo->isItEdgePixelInY(pixelY)) {
77  pixelOnEdge = true;
78  break;
79  }
80  }
81  if (pixelOnEdge)
82  continue;
83  }
84 
85  LocalPoint lpos = LocalPoint(hit->localPosition().x(), hit->localPosition().y(), hit->localPosition().z());
86  GlobalPoint gpos = pgdu->toGlobal(lpos);
87  VertexHit vh;
88  vh.z = gpos.z();
89  vh.r = gpos.perp();
90  vh.w = hit->cluster()->sizeY();
91  vhits.push_back(vh);
92  }
93 
94  // estimate z-position from cluster lengths
95  double zest = 0.0;
96  int nhits = 0, nhits_max = 0;
97  double chi = 0, chi_max = 1e+9;
98  for (double z0 = minZ_; z0 <= maxZ_; z0 += zStep_) {
99  nhits = getContainedHits(vhits, z0, chi);
100  if (nhits == 0)
101  continue;
102  if (nhits > nhits_max) {
103  chi_max = 1e+9;
104  nhits_max = nhits;
105  }
106  if (nhits >= nhits_max && chi < chi_max) {
107  chi_max = chi;
108  zest = z0;
109  }
110  }
111 
112  LogTrace("MinBiasTracking") << " [vertex position] estimated = " << zest
113  << " | pixel barrel hits = " << vhits.size();
114 
115  // put 1-d vertex and dummy errors into collection
117  err(2, 2) = 0.6 * 0.6;
118  reco::Vertex ver(reco::Vertex::Point(0, 0, zest), err, 0, 1, 1);
119  vertices->push_back(ver);
120  }
121 
122  ev.put(std::move(vertices));
123 }
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
int getContainedHits(const std::vector< VertexHit > &hits, double z0, double &chi)
T z() const
Definition: PV3DBase.h:61
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
bool getData(T &iHolder) const
Definition: EventSetup.h:122
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerToken_
edm::EDGetTokenT< SiPixelRecHitCollection > srcPixels_
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
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

◆ maxZ_

double HIPixelClusterVtxProducer::maxZ_
private

Definition at line 39 of file HIPixelClusterVtxProducer.h.

Referenced by produce().

◆ minZ_

double HIPixelClusterVtxProducer::minZ_
private

Definition at line 38 of file HIPixelClusterVtxProducer.h.

Referenced by produce().

◆ srcPixels_

edm::EDGetTokenT<SiPixelRecHitCollection> HIPixelClusterVtxProducer::srcPixels_
private

Definition at line 35 of file HIPixelClusterVtxProducer.h.

Referenced by HIPixelClusterVtxProducer(), and produce().

◆ srcPixelsString_

std::string HIPixelClusterVtxProducer::srcPixelsString_
private

Definition at line 34 of file HIPixelClusterVtxProducer.h.

Referenced by HIPixelClusterVtxProducer().

◆ trackerToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> HIPixelClusterVtxProducer::trackerToken_
private

Definition at line 36 of file HIPixelClusterVtxProducer.h.

Referenced by produce().

◆ zStep_

double HIPixelClusterVtxProducer::zStep_
private

Definition at line 40 of file HIPixelClusterVtxProducer.h.

Referenced by produce().