CMS 3D CMS Logo

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
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Types

using QualityMaskCollection = std::vector< unsigned char >
 

Private Attributes

const int minNumberOfLayersWithMeasBeforeFiltering_
 
edm::EDGetTokenT< std::vector< bool > > oldHitMaskToken_
 
edm::EDGetTokenT< FastTrackerRecHitCollectionrecHits_
 
edm::EDGetTokenT< QualityMaskCollectionsrcQuals
 
const reco::TrackBase::TrackQuality trackQuality_
 
const TrackCollectionTokens trajectories_
 

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

Member Typedef Documentation

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

Definition at line 37 of file FastTrackerRecHitMaskProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 52 of file FastTrackerRecHitMaskProducer.cc.

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

53  : minNumberOfLayersWithMeasBeforeFiltering_(iConfig.getParameter<int>("minNumberOfLayersWithMeasBeforeFiltering"))
55  , trajectories_(iConfig.getParameter<edm::InputTag>("trajectories"),consumesCollector())
56  , recHits_(consumes<FastTrackerRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHits")))
57 {
58 
59  produces<std::vector<bool> >();
60 
61  auto const & classifier = iConfig.getParameter<edm::InputTag>("trackClassifier");
62  if ( !classifier.label().empty())
63  srcQuals = consumes<QualityMaskCollection>(classifier);
64 
65  auto const & oldHitRemovalInfo = iConfig.getParameter<edm::InputTag>("oldHitRemovalInfo");
66  if (!oldHitRemovalInfo.label().empty()) {
67  oldHitMaskToken_ = consumes<std::vector<bool> >(oldHitRemovalInfo);
68  }
69 }
T getParameter(std::string const &) const
const reco::TrackBase::TrackQuality trackQuality_
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:125
edm::EDGetTokenT< QualityMaskCollection > srcQuals
const TrackCollectionTokens trajectories_
edm::EDGetTokenT< FastTrackerRecHitCollection > recHits_
edm::EDGetTokenT< std::vector< bool > > oldHitMaskToken_
FastTrackerRecHitMaskProducer::~FastTrackerRecHitMaskProducer ( )
inlineoverride

Definition at line 29 of file FastTrackerRecHitMaskProducer.cc.

References produce().

29 {}

Member Function Documentation

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

Definition at line 71 of file FastTrackerRecHitMaskProducer.cc.

References DEFINE_FWK_MODULE, 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(), recHits_, reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), edm::OwnVector< T, P >::size(), srcQuals, HiIsolationCommonParameters_cff::track, reco::HitPattern::trackerLayersWithMeasurement(), trackQuality_, l1t::tracks, TrackCollectionTokens::tracks(), trajectories_, mitigatedMETSequence_cff::U, and reco::TrackBase::undefQuality.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), HTMLExport.HTMLExportStatic::export(), and ~FastTrackerRecHitMaskProducer().

72 {
73  // the product
74 
75  std::unique_ptr<std::vector<bool> > collectedHits(new std::vector<bool>());
76 
77  // input
78 
80  iEvent.getByToken(recHits_,recHits);
81 
83  edm::Handle<std::vector<bool> > oldHitMasks;
84  iEvent.getByToken(oldHitMaskToken_,oldHitMasks);
85  collectedHits->insert(collectedHits->begin(),oldHitMasks->begin(),oldHitMasks->end());
86  }
87  collectedHits->resize(recHits->size(),false);
88 
89  auto const & tracks = trajectories_.tracks(iEvent);
90 
91  QualityMaskCollection const * pquals=nullptr;
92  if (!srcQuals.isUninitialized()) {
94  iEvent.getByToken(srcQuals, hqual);
95  pquals = hqual.product();
96  }
97 
98  // required quality
99  unsigned char qualMask = ~0;
101 
102  // loop over tracks and mask hits of selected tracks
103  for (auto i=0U; i<tracks.size(); ++i){
104  const reco::Track & track = tracks[i];
105  bool goodTk = (pquals) ? (*pquals)[i] & qualMask : track.quality(trackQuality_);
106  if ( !goodTk) continue;
108  for (auto hitIt = track.recHitsBegin() ; hitIt != track.recHitsEnd(); ++hitIt) {
109  if(!(*hitIt)->isValid())
110  continue;
111  const FastTrackerRecHit & hit = static_cast<const FastTrackerRecHit &>(*(*hitIt));
112  // note: for matched hits nIds() returns 2, otherwise 1
113  for(unsigned id_index = 0;id_index < hit.nIds();id_index++){
114  (*collectedHits)[unsigned(hit.id(id_index))] = true;
115  }
116  }
117 
118  }
119 
120  iEvent.put(std::move(collectedHits));
121 
122 }
std::vector< unsigned char > QualityMaskCollection
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
virtual size_t nIds() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
size_type size() const
Definition: OwnVector.h:264
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:518
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:104
reco::TrackCollection const & tracks(edm::Event &evt) const
const reco::TrackBase::TrackQuality trackQuality_
T const * product() const
Definition: Handle.h:81
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:446
edm::EDGetTokenT< QualityMaskCollection > srcQuals
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:510
const TrackCollectionTokens trajectories_
edm::EDGetTokenT< FastTrackerRecHitCollection > recHits_
virtual int32_t id(size_t i=0) const
bool isUninitialized() const
Definition: EDGetToken.h:73
def move(src, dest)
Definition: eostools.py:510
edm::EDGetTokenT< std::vector< bool > > oldHitMaskToken_
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:109

Member Data Documentation

const int FastTrackerRecHitMaskProducer::minNumberOfLayersWithMeasBeforeFiltering_
private

Definition at line 40 of file FastTrackerRecHitMaskProducer.cc.

Referenced by produce().

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

Definition at line 48 of file FastTrackerRecHitMaskProducer.cc.

Referenced by FastTrackerRecHitMaskProducer(), and produce().

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

Definition at line 46 of file FastTrackerRecHitMaskProducer.cc.

Referenced by produce().

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

Definition at line 44 of file FastTrackerRecHitMaskProducer.cc.

Referenced by FastTrackerRecHitMaskProducer(), and produce().

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

Definition at line 41 of file FastTrackerRecHitMaskProducer.cc.

Referenced by produce().

const TrackCollectionTokens FastTrackerRecHitMaskProducer::trajectories_
private

Definition at line 43 of file FastTrackerRecHitMaskProducer.cc.

Referenced by produce().