CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
ClusterCompatibilityProducer Class Reference
Inheritance diagram for ClusterCompatibilityProducer:
edm::stream::EDProducer<>

Classes

struct  ContainedHits
 
struct  VertexHit
 

Public Member Functions

 ClusterCompatibilityProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~ClusterCompatibilityProducer () 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

ContainedHits getContainedHits (const std::vector< VertexHit > &hits, double z0) const
 

Private Attributes

edm::InputTag inputTag_
 
edm::EDGetTokenT
< SiPixelRecHitCollection
inputToken_
 
double maxZ_
 
double minZ_
 
edm::ESGetToken
< TrackerGeometry,
TrackerDigiGeometryRecord
trackerToken_
 
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 37 of file ClusterCompatibilityProducer.cc.

Constructor & Destructor Documentation

ClusterCompatibilityProducer::ClusterCompatibilityProducer ( const edm::ParameterSet config)
explicit

Definition at line 67 of file ClusterCompatibilityProducer.cc.

References inputTag_, inputToken_, LogDebug, and trackerToken_.

68  : inputTag_(config.getParameter<edm::InputTag>("inputTag")),
69  minZ_(config.getParameter<double>("minZ")),
70  maxZ_(config.getParameter<double>("maxZ")),
71  zStep_(config.getParameter<double>("zStep")) {
72  inputToken_ = consumes<SiPixelRecHitCollection>(inputTag_);
73  trackerToken_ = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>();
74  LogDebug("") << "Using the " << inputTag_ << " input collection";
75  produces<reco::ClusterCompatibility>();
76 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerToken_
edm::EDGetTokenT< SiPixelRecHitCollection > inputToken_
#define LogDebug(id)
ClusterCompatibilityProducer::~ClusterCompatibilityProducer ( )
override

Definition at line 78 of file ClusterCompatibilityProducer.cc.

78 {}

Member Function Documentation

ClusterCompatibilityProducer::ContainedHits ClusterCompatibilityProducer::getContainedHits ( const std::vector< VertexHit > &  hits,
double  z0 
) const
private

Definition at line 140 of file ClusterCompatibilityProducer.cc.

References ClusterCompatibilityProducer::ContainedHits::chi, dqmiodumpmetadata::n, ClusterCompatibilityProducer::ContainedHits::nHit, convertSQLitetoXML_cfg::output, AlCaHLTBitMon_ParallelJobs::p, hit::z, and ClusterCompatibilityProducer::ContainedHits::z0.

Referenced by produce().

141  {
142  // Calculate number of hits contained in v-shaped window in cluster y-width vs. z-position.
143  int n = 0;
144  double chi = 0.;
145 
146  for (std::vector<VertexHit>::const_iterator hit = hits.begin(); hit != hits.end(); hit++) {
147  // the calculation of the predicted cluster width p was
148  // marked 'FIXME' in the HLTPixelClusterShapeFilter. It should
149  // be revisited but is retained as it was for compatibility with the
150  // older filter.
151  double p = 2 * fabs(hit->z - z0) / hit->r + 0.5;
152  if (fabs(p - hit->w) <= 1.) {
153  chi += fabs(p - hit->w);
154  n++;
155  }
156  }
158  output.z0 = z0;
159  output.nHit = n;
160  output.chi = chi;
161  return output;
162 }
void ClusterCompatibilityProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 80 of file ClusterCompatibilityProducer.cc.

References c, ClusterCompatibilityProducer::ContainedHits::chi, edmNew::DetSetVector< T >::data(), dataset::end, edm::Event::getByToken(), getContainedHits(), edm::EventSetup::getHandle(), gpuClustering::id, TrackerGeometry::idToDet(), inputToken_, PixelTopology::isItEdgePixelInX(), PixelTopology::isItEdgePixelInY(), maxZ_, minZ_, eostools::move(), ClusterCompatibilityProducer::ContainedHits::nHit, digitizers_cfi::pixel, PixelSubdetector::PixelBarrel, edm::ESHandle< class >::product(), edm::Event::put(), ClusterCompatibilityProducer::VertexHit::r, PixelGeomDetUnit::specificTopology(), GeomDet::toGlobal(), trackerToken_, vh, ClusterCompatibilityProducer::VertexHit::w, hit::x, hit::y, ClusterCompatibilityProducer::VertexHit::z, hit::z, ClusterCompatibilityProducer::ContainedHits::z0, and zStep_.

80  {
81  auto creco = std::make_unique<reco::ClusterCompatibility>();
82 
83  // get hold of products from Event
85  iEvent.getByToken(inputToken_, hRecHits);
86 
87  // get tracker geometry
88  if (hRecHits.isValid()) {
90  const TrackerGeometry *tgeo = trackerHandle.product();
91  const SiPixelRecHitCollection *hits = hRecHits.product();
92 
93  // loop over pixel rechits
94  int nPxlHits = 0;
95  std::vector<VertexHit> vhits;
96  for (SiPixelRecHitCollection::DataContainer::const_iterator hit = hits->data().begin(), end = hits->data().end();
97  hit != end;
98  ++hit) {
99  if (!hit->isValid())
100  continue;
101  ++nPxlHits;
102  DetId id(hit->geographicalId());
103  if (id.subdetId() != int(PixelSubdetector::PixelBarrel))
104  continue;
105  const PixelGeomDetUnit *pgdu = static_cast<const PixelGeomDetUnit *>(tgeo->idToDet(id));
106  const PixelTopology *pixTopo = &(pgdu->specificTopology());
107  std::vector<SiPixelCluster::Pixel> pixels(hit->cluster()->pixels());
108  bool pixelOnEdge = false;
109  for (std::vector<SiPixelCluster::Pixel>::const_iterator pixel = pixels.begin(); pixel != pixels.end(); ++pixel) {
110  int pixelX = pixel->x;
111  int pixelY = pixel->y;
112  if (pixTopo->isItEdgePixelInX(pixelX) || pixTopo->isItEdgePixelInY(pixelY)) {
113  pixelOnEdge = true;
114  break;
115  }
116  }
117  if (pixelOnEdge)
118  continue;
119 
120  LocalPoint lpos = LocalPoint(hit->localPosition().x(), hit->localPosition().y(), hit->localPosition().z());
121  GlobalPoint gpos = pgdu->toGlobal(lpos);
122  VertexHit vh;
123  vh.z = gpos.z();
124  vh.r = gpos.perp();
125  vh.w = hit->cluster()->sizeY();
126  vhits.push_back(vh);
127  }
128 
129  creco->setNValidPixelHits(nPxlHits);
130 
131  // append cluster compatibility for each z-position
132  for (double z0 = minZ_; z0 <= maxZ_; z0 += zStep_) {
133  ContainedHits c = getContainedHits(vhits, z0);
134  creco->append(c.z0, c.nHit, c.chi);
135  }
136  }
137  iEvent.put(std::move(creco));
138 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const edm::EventSetup & c
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
uint16_t *__restrict__ id
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
virtual bool isItEdgePixelInX(int ixbin) const =0
ContainedHits getContainedHits(const std::vector< VertexHit > &hits, double z0) const
def move
Definition: eostools.py:511
data_type const * data(size_t cell) const
const TrackerGeomDet * idToDet(DetId) const override
ValidHit vh
Definition: classes.h:14
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetId.h:17
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
T const * product() const
Definition: ESHandle.h:86
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerToken_
edm::EDGetTokenT< SiPixelRecHitCollection > inputToken_
virtual bool isItEdgePixelInY(int iybin) const =0
string end
Definition: dataset.py:937
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157

Member Data Documentation

edm::InputTag ClusterCompatibilityProducer::inputTag_
private

Definition at line 47 of file ClusterCompatibilityProducer.cc.

Referenced by ClusterCompatibilityProducer().

edm::EDGetTokenT<SiPixelRecHitCollection> ClusterCompatibilityProducer::inputToken_
private

Definition at line 45 of file ClusterCompatibilityProducer.cc.

Referenced by ClusterCompatibilityProducer(), and produce().

double ClusterCompatibilityProducer::maxZ_
private

Definition at line 49 of file ClusterCompatibilityProducer.cc.

Referenced by produce().

double ClusterCompatibilityProducer::minZ_
private

Definition at line 48 of file ClusterCompatibilityProducer.cc.

Referenced by produce().

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

Definition at line 46 of file ClusterCompatibilityProducer.cc.

Referenced by ClusterCompatibilityProducer(), and produce().

double ClusterCompatibilityProducer::zStep_
private

Definition at line 50 of file ClusterCompatibilityProducer.cc.

Referenced by produce().