CMS 3D CMS Logo

HitExtractorPIX.cc
Go to the documentation of this file.
1 #include "HitExtractorPIX.h"
5 
8 
11 
12 #include <iostream>
13 using namespace ctfseeding;
14 using namespace std;
15 
17  int idLayer,
18  const std::string& hitProducer,
20  : theHitProducer(iC.consumes<SiPixelRecHitCollection>(hitProducer)), theSide(side), theIdLayer(idLayer) {}
21 
24 }
25 
27  const edm::Event& ev,
28  const edm::EventSetup& es) const {
30 
32  es.get<TrackerTopologyRcd>().get(httopo);
33  const TrackerTopology& ttopo = *httopo;
34 
36  ev.getByToken(theHitProducer, pixelHits);
39  } else {
40  range2SeedingHits(*pixelHits, result, ttopo.pxfDetIdDiskComparator(static_cast<unsigned int>(theSide), theIdLayer));
41  }
42 
43  if (skipClusters) {
44  LogDebug("HitExtractorPIX") << "getting : " << result.size() << " pixel hits.";
45  //std::cout<<" skipping"<<std::endl;
46  edm::Handle<SkipClustersCollection> pixelClusterMask;
47  ev.getByToken(theSkipClusters, pixelClusterMask);
48  unsigned int skipped = 0;
49  for (unsigned int iH = 0; iH != result.size(); ++iH) {
50  if (result[iH]->isValid()) { // can be NOT valid???
51  auto const& concrete = (SiPixelRecHit const&)(*result[iH]);
52  assert(pixelClusterMask->refProd().id() == concrete.cluster().id());
53  if (pixelClusterMask->mask(concrete.cluster().key())) {
54  //too much debug LogDebug("HitExtractorPIX")<<"skipping a pixel hit on: "<< result[iH]->hit()->geographicalId().rawId()<<" key: "<<find(f->begin(),f->end(),concrete->cluster())->key();
55  skipped++;
56  result[iH].reset();
57  }
58  }
59  }
60  LogDebug("HitExtractorPIX") << "skipped :" << skipped << " pixel clusters";
61  // std::cout << "HitExtractorPIX " <<"skipped :"<<skipped<<" pixel clusters out of " << result.size() << std::endl;
62  if (skipped > 0) {
63  auto last = std::remove_if(result.begin(), result.end(), [](HitPointer const& p) { return p.empty(); });
64  result.resize(last - result.begin());
65  }
66  }
67  LogDebug("HitExtractorPIX") << "giving :" << result.size() << " rechits out";
68  // std::cout << "HitExtractorPIX "<<"giving :"<<result.size()<<" rechits out" << std::endl;
69  return result;
70 }
Handle.h
edm::RefProd::id
ProductID id() const
Accessor for product ID.
Definition: RefProd.h:124
ESHandle.h
HitExtractorPIX.h
ctfseeding::HitExtractor::skipClusters
bool skipClusters
Definition: HitExtractor.h:44
TrackerTopology
Definition: TrackerTopology.h:16
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
cms::cuda::assert
assert(be >=bs)
mayown_ptr
Definition: mayown_ptr.h:13
TrackerTopology::pxfDetIdDiskComparator
std::pair< DetId, SameLayerComparator > pxfDetIdDiskComparator(uint32_t side, uint32_t disk) const
Definition: TrackerTopology.h:536
edm::ContainerMask
Definition: ContainerMask.h:36
ctfseeding::HitExtractorPIX::useSkipClusters_
void useSkipClusters_(const edm::InputTag &m, edm::ConsumesCollector &iC) override
Definition: HitExtractorPIX.cc:22
edm::Handle
Definition: AssociativeIterator.h:50
SiPixelRecHit
Our base class.
Definition: SiPixelRecHit.h:23
TkTransientTrackingRecHitBuilder
Definition: TkTransientTrackingRecHitBuilder.h:15
ctfseeding::HitExtractorPIX::theHitProducer
edm::EDGetTokenT< SiPixelRecHitCollection > theHitProducer
Definition: HitExtractorPIX.h:28
TrackerTopology.h
dqmdumpme.last
last
Definition: dqmdumpme.py:56
TrackerDetSide::Barrel
TrackerTopologyRcd.h
ctfseeding::HitExtractorPIX::theIdLayer
int theIdLayer
Definition: HitExtractorPIX.h:30
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
edm::ESHandle< TrackerTopology >
TrackerDetSide
TrackerDetSide
Definition: TrackerDetSide.h:4
ctfseeding::HitExtractorPIX::hits
HitExtractor::Hits hits(const TkTransientTrackingRecHitBuilder &ttrhBuilder, const edm::Event &, const edm::EventSetup &) const override
Definition: HitExtractorPIX.cc:26
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ctfseeding::range2SeedingHits
void range2SeedingHits(DSTV const &dstv, HitExtractor::Hits &v, std::pair< A, B > const &sel)
Definition: HitExtractor.h:54
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
Event.h
TrackerTopology::pxbDetIdLayerComparator
std::pair< DetId, SameLayerComparator > pxbDetIdLayerComparator(uint32_t layer) const
Definition: TrackerTopology.h:532
edm::ContainerMask::refProd
const edm::RefProd< T > & refProd() const
Definition: ContainerMask.h:55
edm::EventSetup
Definition: EventSetup.h:57
ctfseeding
Definition: SeedingLayerSetsBuilder.h:23
get
#define get
ctfseeding::HitExtractor::Hits
std::vector< HitPointer > Hits
Definition: HitExtractor.h:28
edmNew::DetSetVector
Definition: DetSetNew.h:13
std
Definition: JetResolutionObject.h:76
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
DetLayer.h
EventSetup.h
ctfseeding::HitExtractorPIX::HitExtractorPIX
HitExtractorPIX(TrackerDetSide side, int idLayer, const std::string &hitProducer, edm::ConsumesCollector &iC)
Definition: HitExtractorPIX.cc:16
mps_fire.result
result
Definition: mps_fire.py:311
edm::ContainerMask::mask
bool mask(unsigned int iIndex) const
Definition: ContainerMask.h:43
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
runEdmFileComparison.skipped
skipped
Definition: runEdmFileComparison.py:225
ctfseeding::HitExtractorPIX::theSkipClusters
edm::EDGetTokenT< SkipClustersCollection > theSkipClusters
Definition: HitExtractorPIX.h:27
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
ctfseeding::HitExtractorPIX::theSide
TrackerDetSide theSide
Definition: HitExtractorPIX.h:29
edm::ProductID::id
ProductIndex id() const
Definition: ProductID.h:35