CMS 3D CMS Logo

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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Member Functions

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

Private Attributes

edm::InputTag inputTag_
 
edm::EDGetTokenT< SiPixelRecHitCollectioninputToken_
 
double maxZ_
 
double minZ_
 
double zStep_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 36 of file ClusterCompatibilityProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 65 of file ClusterCompatibilityProducer.cc.

References inputTag_, inputToken_, and LogDebug.

66  : inputTag_(config.getParameter<edm::InputTag>("inputTag")),
67  minZ_(config.getParameter<double>("minZ")),
68  maxZ_(config.getParameter<double>("maxZ")),
69  zStep_(config.getParameter<double>("zStep")) {
70  inputToken_ = consumes<SiPixelRecHitCollection>(inputTag_);
71  LogDebug("") << "Using the " << inputTag_ << " input collection";
72  produces<reco::ClusterCompatibility>();
73 }
#define LogDebug(id)
T getParameter(std::string const &) const
edm::EDGetTokenT< SiPixelRecHitCollection > inputToken_
ClusterCompatibilityProducer::~ClusterCompatibilityProducer ( )
override

Definition at line 75 of file ClusterCompatibilityProducer.cc.

75 {}

Member Function Documentation

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

Definition at line 138 of file ClusterCompatibilityProducer.cc.

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

Referenced by produce().

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

Definition at line 77 of file ClusterCompatibilityProducer.cc.

References HltBtagPostValidation_cff::c, ClusterCompatibilityProducer::ContainedHits::chi, edmNew::DetSetVector< T >::data(), end, edm::EventSetup::get(), edm::Event::getByToken(), getContainedHits(), hfClusterShapes_cfi::hits, triggerObjects_cff::id, TrackerGeometry::idToDet(), inputToken_, createfilelist::int, PixelTopology::isItEdgePixelInX(), PixelTopology::isItEdgePixelInY(), maxZ_, minZ_, eostools::move(), ClusterCompatibilityProducer::ContainedHits::nHit, muonClassificationByHits_cfi::pixel, PixelSubdetector::PixelBarrel, edm::ESHandle< T >::product(), edm::Event::put(), ClusterCompatibilityProducer::VertexHit::r, PixelGeomDetUnit::specificTopology(), GeomDet::toGlobal(), ClusterCompatibilityProducer::VertexHit::w, hit::x, hit::y, ClusterCompatibilityProducer::VertexHit::z, hit::z, ClusterCompatibilityProducer::ContainedHits::z0, HLTMuonOfflineAnalyzer_cfi::z0, and zStep_.

77  {
78  auto creco = std::make_unique<reco::ClusterCompatibility>();
79 
80  // get hold of products from Event
82  iEvent.getByToken(inputToken_, hRecHits);
83 
84  // get tracker geometry
85  if (hRecHits.isValid()) {
86  edm::ESHandle<TrackerGeometry> trackerHandle;
87  iSetup.get<TrackerDigiGeometryRecord>().get(trackerHandle);
88  const TrackerGeometry *tgeo = trackerHandle.product();
89  const SiPixelRecHitCollection *hits = hRecHits.product();
90 
91  // loop over pixel rechits
92  int nPxlHits = 0;
93  std::vector<VertexHit> vhits;
94  for (SiPixelRecHitCollection::DataContainer::const_iterator hit = hits->data().begin(), end = hits->data().end();
95  hit != end;
96  ++hit) {
97  if (!hit->isValid())
98  continue;
99  ++nPxlHits;
100  DetId id(hit->geographicalId());
101  if (id.subdetId() != int(PixelSubdetector::PixelBarrel))
102  continue;
103  const PixelGeomDetUnit *pgdu = static_cast<const PixelGeomDetUnit *>(tgeo->idToDet(id));
104  const PixelTopology *pixTopo = &(pgdu->specificTopology());
105  std::vector<SiPixelCluster::Pixel> pixels(hit->cluster()->pixels());
106  bool pixelOnEdge = false;
107  for (std::vector<SiPixelCluster::Pixel>::const_iterator pixel = pixels.begin(); pixel != pixels.end(); ++pixel) {
108  int pixelX = pixel->x;
109  int pixelY = pixel->y;
110  if (pixTopo->isItEdgePixelInX(pixelX) || pixTopo->isItEdgePixelInY(pixelY)) {
111  pixelOnEdge = true;
112  break;
113  }
114  }
115  if (pixelOnEdge)
116  continue;
117 
118  LocalPoint lpos = LocalPoint(hit->localPosition().x(), hit->localPosition().y(), hit->localPosition().z());
119  GlobalPoint gpos = pgdu->toGlobal(lpos);
120  VertexHit vh;
121  vh.z = gpos.z();
122  vh.r = gpos.perp();
123  vh.w = hit->cluster()->sizeY();
124  vhits.push_back(vh);
125  }
126 
127  creco->setNValidPixelHits(nPxlHits);
128 
129  // append cluster compatibility for each z-position
130  for (double z0 = minZ_; z0 <= maxZ_; z0 += zStep_) {
131  ContainedHits c = getContainedHits(vhits, z0);
132  creco->append(c.z0, c.nHit, c.chi);
133  }
134  }
135  iEvent.put(std::move(creco));
136 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
virtual bool isItEdgePixelInX(int ixbin) const =0
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 isItEdgePixelInY(int iybin) const =0
ContainedHits getContainedHits(const std::vector< VertexHit > &hits, double z0) const
T z() const
Definition: PV3DBase.h:61
data_type const * data(size_t cell) const
#define end
Definition: vmac.h:39
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.
edm::EDGetTokenT< SiPixelRecHitCollection > inputToken_
T get() const
Definition: EventSetup.h:73
const TrackerGeomDet * idToDet(DetId) const override
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

edm::InputTag ClusterCompatibilityProducer::inputTag_
private

Definition at line 45 of file ClusterCompatibilityProducer.cc.

Referenced by ClusterCompatibilityProducer().

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

Definition at line 44 of file ClusterCompatibilityProducer.cc.

Referenced by ClusterCompatibilityProducer(), and produce().

double ClusterCompatibilityProducer::maxZ_
private

Definition at line 47 of file ClusterCompatibilityProducer.cc.

Referenced by produce().

double ClusterCompatibilityProducer::minZ_
private

Definition at line 46 of file ClusterCompatibilityProducer.cc.

Referenced by produce().

double ClusterCompatibilityProducer::zStep_
private

Definition at line 48 of file ClusterCompatibilityProducer.cc.

Referenced by produce().