CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
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.

29 {}

Member Function Documentation

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

Implements edm::stream::EDProducerBase.

Definition at line 71 of file FastTrackerRecHitMaskProducer.cc.

References edm::Event::getByToken(), reco::TrackBase::hitPattern(), 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, reco::HitPattern::trackerLayersWithMeasurement(), trackQuality_, TrackCollectionTokens::tracks(), testEve_cfg::tracks, trajectories_, and reco::TrackBase::undefQuality.

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

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 }
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned char > QualityMaskCollection
virtual size_t nIds() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:527
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
def move
Definition: eostools.py:510
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:445
tuple tracks
Definition: testEve_cfg.py:39
edm::EDGetTokenT< QualityMaskCollection > srcQuals
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:505
const TrackCollectionTokens trajectories_
edm::EDGetTokenT< FastTrackerRecHitCollection > recHits_
virtual int32_t id(size_t i=0) const
bool isUninitialized() const
Definition: EDGetToken.h:73
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().