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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 FastTrackerRecHitMaskProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
virtual ~FastTrackerRecHitMaskProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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_, 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
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
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_
virtual FastTrackerRecHitMaskProducer::~FastTrackerRecHitMaskProducer ( )
inlinevirtual

Definition at line 29 of file FastTrackerRecHitMaskProducer.cc.

References produce().

29 {}

Member Function Documentation

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

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:122
virtual size_t nIds() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
size_type size() const
Definition: OwnVector.h:264
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:512
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().