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_
 
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 17 of file HIPixelClusterVtxProducer.h.

Constructor & Destructor Documentation

◆ HIPixelClusterVtxProducer()

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

Definition at line 28 of file HIPixelClusterVtxProducer.cc.

29  : srcPixelsString_(ps.getParameter<std::string>("pixelRecHits")),
30  minZ_(ps.getParameter<double>("minZ")),
31  maxZ_(ps.getParameter<double>("maxZ")),
32  zStep_(ps.getParameter<double>("zStep"))
33 
34 {
35  // Constructor
36  produces<reco::VertexCollection>();
37  srcPixels_ = (consumes<SiPixelRecHitCollection>(srcPixelsString_));
38 }

References srcPixels_, and srcPixelsString_.

◆ ~HIPixelClusterVtxProducer()

HIPixelClusterVtxProducer::~HIPixelClusterVtxProducer ( )
override

Definition at line 41 of file HIPixelClusterVtxProducer.cc.

41  {
42  // Destructor
43 }

Member Function Documentation

◆ getContainedHits()

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

Definition at line 130 of file HIPixelClusterVtxProducer.cc.

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

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

Referenced by produce().

◆ produce()

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

Definition at line 46 of file HIPixelClusterVtxProducer.cc.

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

References MillePedeFileConverter_cfg::e, mps_fire::end, submitPVResolutionJobs::err, ev, edm::EventSetup::get(), get, getContainedHits(), hfClusterShapes_cfi::hits, triggerObjects_cff::id, TrackerGeometry::idToDet(), createfilelist::int, PixelTopology::isItEdgePixelInX(), PixelTopology::isItEdgePixelInY(), edm::HandleBase::isValid(), LogTrace, maxZ_, minZ_, eostools::move(), nhits, muonClassificationByHits_cfi::pixel, PixelSubdetector::PixelBarrel, edm::Handle< T >::product(), edm::ESHandle< T >::product(), PixelGeomDetUnit::specificTopology(), srcPixels_, GeomDet::toGlobal(), AlignmentTracksFromVertexSelector_cfi::vertices, vh, hit::x, hit::y, hit::z, HLTMuonOfflineAnalyzer_cfi::z0, and zStep_.

Member Data Documentation

◆ maxZ_

double HIPixelClusterVtxProducer::maxZ_
private

Definition at line 36 of file HIPixelClusterVtxProducer.h.

Referenced by produce().

◆ minZ_

double HIPixelClusterVtxProducer::minZ_
private

Definition at line 35 of file HIPixelClusterVtxProducer.h.

Referenced by produce().

◆ srcPixels_

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

Definition at line 33 of file HIPixelClusterVtxProducer.h.

Referenced by HIPixelClusterVtxProducer(), and produce().

◆ srcPixelsString_

std::string HIPixelClusterVtxProducer::srcPixelsString_
private

Definition at line 32 of file HIPixelClusterVtxProducer.h.

Referenced by HIPixelClusterVtxProducer().

◆ zStep_

double HIPixelClusterVtxProducer::zStep_
private

Definition at line 37 of file HIPixelClusterVtxProducer.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
HIPixelClusterVtxProducer::getContainedHits
int getContainedHits(const std::vector< VertexHit > &hits, double z0, double &chi)
Definition: HIPixelClusterVtxProducer.cc:130
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
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
hit::y
double y
Definition: SiStripHitEffFromCalibTree.cc:90
PixelTopology::isItEdgePixelInX
virtual bool isItEdgePixelInX(int ixbin) const =0
reco::Vertex::Error
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
vh
ValidHit vh
Definition: classes.h:14
edmNew::DetSetVector::const_iterator
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetSetVectorNew.h:197
muonClassificationByHits_cfi.pixel
pixel
Definition: muonClassificationByHits_cfi.py:9
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
HIPixelClusterVtxProducer::minZ_
double minZ_
Definition: HIPixelClusterVtxProducer.h:35
edm::Handle
Definition: AssociativeIterator.h:50
AlignmentTracksFromVertexSelector_cfi.vertices
vertices
Definition: AlignmentTracksFromVertexSelector_cfi.py:5
PixelTopology::isItEdgePixelInY
virtual bool isItEdgePixelInY(int iybin) const =0
hit::x
double x
Definition: SiStripHitEffFromCalibTree.cc:89
DetId
Definition: DetId.h:17
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
Abs
T Abs(T a)
Definition: MathUtil.h:49
HIPixelClusterVtxProducer::srcPixelsString_
std::string srcPixelsString_
Definition: HIPixelClusterVtxProducer.h:32
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:16
HIPixelClusterVtxProducer::maxZ_
double maxZ_
Definition: HIPixelClusterVtxProducer.h:36
mps_fire.end
end
Definition: mps_fire.py:242
edm::ESHandle< TrackerGeometry >
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
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
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
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
get
#define get
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HIPixelClusterVtxProducer::zStep_
double zStep_
Definition: HIPixelClusterVtxProducer.h:37
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
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
ev
bool ev
Definition: Hydjet2Hadronizer.cc:97
HIPixelClusterVtxProducer::srcPixels_
edm::EDGetTokenT< SiPixelRecHitCollection > srcPixels_
Definition: HIPixelClusterVtxProducer.h:33
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
reco::Vertex
Definition: Vertex.h:35
hit
Definition: SiStripHitEffFromCalibTree.cc:88
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
TrackerGeometry
Definition: TrackerGeometry.h:14