CMS 3D CMS Logo

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

Public Member Functions

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

using QualityMaskCollection = std::vector< unsigned char >
 

Private Attributes

const int minNumberOfLayersWithMeasBeforeFiltering_
 
edm::EDGetTokenT< std::vector
< bool > > 
oldHitMaskToken_
 
edm::EDGetTokenT
< FastTrackerRecHitCollection
recHits_
 
edm::EDGetTokenT
< QualityMaskCollection
srcQuals
 
const reco::TrackBase::TrackQuality trackQuality_
 
const TrackCollectionTokens trajectories_
 

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 22 of file FastTrackerRecHitMaskProducer.cc.

Member Typedef Documentation

using FastTrackerRecHitMaskProducer::QualityMaskCollection = std::vector<unsigned char>
private

Definition at line 32 of file FastTrackerRecHitMaskProducer.cc.

Constructor & Destructor Documentation

FastTrackerRecHitMaskProducer::FastTrackerRecHitMaskProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 46 of file FastTrackerRecHitMaskProducer.cc.

References edm::ParameterSet::getParameter(), oldHitMaskToken_, and srcQuals.

47  : minNumberOfLayersWithMeasBeforeFiltering_(iConfig.getParameter<int>("minNumberOfLayersWithMeasBeforeFiltering")),
49  trajectories_(iConfig.getParameter<edm::InputTag>("trajectories"), consumesCollector()),
50  recHits_(consumes<FastTrackerRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHits"))) {
51  produces<std::vector<bool> >();
52 
53  auto const& classifier = iConfig.getParameter<edm::InputTag>("trackClassifier");
54  if (!classifier.label().empty())
55  srcQuals = consumes<QualityMaskCollection>(classifier);
56 
57  auto const& oldHitRemovalInfo = iConfig.getParameter<edm::InputTag>("oldHitRemovalInfo");
58  if (!oldHitRemovalInfo.label().empty()) {
59  oldHitMaskToken_ = consumes<std::vector<bool> >(oldHitRemovalInfo);
60  }
61 }
const reco::TrackBase::TrackQuality trackQuality_
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
edm::EDGetTokenT< QualityMaskCollection > srcQuals
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const TrackCollectionTokens trajectories_
edm::EDGetTokenT< FastTrackerRecHitCollection > recHits_
edm::EDGetTokenT< std::vector< bool > > oldHitMaskToken_
FastTrackerRecHitMaskProducer::~FastTrackerRecHitMaskProducer ( )
inlineoverride

Definition at line 26 of file FastTrackerRecHitMaskProducer.cc.

26 {}

Member Function Documentation

void FastTrackerRecHitMaskProducer::produce ( edm::Event iEvent,
const edm::EventSetup es 
)
override

Definition at line 63 of file FastTrackerRecHitMaskProducer.cc.

References edm::Event::getByToken(), reco::TrackBase::hitPattern(), mps_fire::i, FastTrackerRecHit::id(), edm::EDGetTokenT< T >::isUninitialized(), minNumberOfLayersWithMeasBeforeFiltering_, eostools::move(), FastTrackerRecHit::nIds(), oldHitMaskToken_, edm::Handle< T >::product(), edm::Event::put(), reco::TrackBase::quality(), HLT_FULL_cff::recHits, recHits_, reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), srcQuals, HLT_FULL_cff::track, reco::HitPattern::trackerLayersWithMeasurement(), trackQuality_, TrackCollectionTokens::tracks(), tracks, trajectories_, and reco::TrackBase::undefQuality.

63  {
64  // the product
65 
66  std::unique_ptr<std::vector<bool> > collectedHits(new std::vector<bool>());
67 
68  // input
69 
71  iEvent.getByToken(recHits_, recHits);
72 
74  edm::Handle<std::vector<bool> > oldHitMasks;
75  iEvent.getByToken(oldHitMaskToken_, oldHitMasks);
76  collectedHits->insert(collectedHits->begin(), oldHitMasks->begin(), oldHitMasks->end());
77  }
78  collectedHits->resize(recHits->size(), false);
79 
80  auto const& tracks = trajectories_.tracks(iEvent);
81 
82  QualityMaskCollection const* pquals = nullptr;
83  if (!srcQuals.isUninitialized()) {
85  iEvent.getByToken(srcQuals, hqual);
86  pquals = hqual.product();
87  }
88 
89  // required quality
90  unsigned char qualMask = ~0;
92  qualMask = 1 << trackQuality_;
93 
94  // loop over tracks and mask hits of selected tracks
95  for (auto i = 0U; i < tracks.size(); ++i) {
96  const reco::Track& track = tracks[i];
97  bool goodTk = (pquals) ? (*pquals)[i] & qualMask : track.quality(trackQuality_);
98  if (!goodTk)
99  continue;
101  continue;
102  for (auto hitIt = track.recHitsBegin(); hitIt != track.recHitsEnd(); ++hitIt) {
103  if (!(*hitIt)->isValid())
104  continue;
105  const FastTrackerRecHit& hit = static_cast<const FastTrackerRecHit&>(*(*hitIt));
106  // note: for matched hits nIds() returns 2, otherwise 1
107  for (unsigned id_index = 0; id_index < hit.nIds(); id_index++) {
108  (*collectedHits)[unsigned(hit.id(id_index))] = true;
109  }
110  }
111  }
112 
113  iEvent.put(std::move(collectedHits));
114 }
std::vector< unsigned char > QualityMaskCollection
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
virtual size_t nIds() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:99
auto const & tracks
cannot be loose
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:534
def move
Definition: eostools.py:511
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:88
reco::TrackCollection const & tracks(edm::Event &evt) const
const reco::TrackBase::TrackQuality trackQuality_
T const * product() const
Definition: Handle.h:70
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:504
edm::EDGetTokenT< QualityMaskCollection > srcQuals
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:552
const TrackCollectionTokens trajectories_
edm::EDGetTokenT< FastTrackerRecHitCollection > recHits_
virtual int32_t id(size_t i=0) const
edm::EDGetTokenT< std::vector< bool > > oldHitMaskToken_
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:91

Member Data Documentation

const int FastTrackerRecHitMaskProducer::minNumberOfLayersWithMeasBeforeFiltering_
private

Definition at line 35 of file FastTrackerRecHitMaskProducer.cc.

Referenced by produce().

edm::EDGetTokenT<std::vector<bool> > FastTrackerRecHitMaskProducer::oldHitMaskToken_
private

Definition at line 43 of file FastTrackerRecHitMaskProducer.cc.

Referenced by FastTrackerRecHitMaskProducer(), and produce().

edm::EDGetTokenT<FastTrackerRecHitCollection> FastTrackerRecHitMaskProducer::recHits_
private

Definition at line 41 of file FastTrackerRecHitMaskProducer.cc.

Referenced by produce().

edm::EDGetTokenT<QualityMaskCollection> FastTrackerRecHitMaskProducer::srcQuals
private

Definition at line 39 of file FastTrackerRecHitMaskProducer.cc.

Referenced by FastTrackerRecHitMaskProducer(), and produce().

const reco::TrackBase::TrackQuality FastTrackerRecHitMaskProducer::trackQuality_
private

Definition at line 36 of file FastTrackerRecHitMaskProducer.cc.

Referenced by produce().

const TrackCollectionTokens FastTrackerRecHitMaskProducer::trajectories_
private

Definition at line 38 of file FastTrackerRecHitMaskProducer.cc.

Referenced by produce().