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 hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () 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 22 of file FastTrackerRecHitMaskProducer.cc.

Member Typedef Documentation

◆ QualityMaskCollection

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

Definition at line 32 of file FastTrackerRecHitMaskProducer.cc.

Constructor & Destructor Documentation

◆ FastTrackerRecHitMaskProducer()

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

Definition at line 46 of file FastTrackerRecHitMaskProducer.cc.

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 }

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

◆ ~FastTrackerRecHitMaskProducer()

FastTrackerRecHitMaskProducer::~FastTrackerRecHitMaskProducer ( )
inlineoverride

Definition at line 26 of file FastTrackerRecHitMaskProducer.cc.

26 {}

Member Function Documentation

◆ produce()

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

Definition at line 63 of file FastTrackerRecHitMaskProducer.cc.

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;
100  if (track.hitPattern().trackerLayersWithMeasurement() < minNumberOfLayersWithMeasBeforeFiltering_)
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 }

References mps_fire::i, hit::id, iEvent, edm::EDGetTokenT< T >::isUninitialized(), minNumberOfLayersWithMeasBeforeFiltering_, eostools::move(), oldHitMaskToken_, edm::Handle< T >::product(), FastTrackerRecHitMaskProducer_cfi::recHits, recHits_, srcQuals, HLT_2018_cff::track, trackQuality_, TrackCollectionTokens::tracks(), PDWG_EXOHSCP_cff::tracks, trajectories_, mitigatedMETSequence_cff::U, and reco::TrackBase::undefQuality.

Member Data Documentation

◆ minNumberOfLayersWithMeasBeforeFiltering_

const int FastTrackerRecHitMaskProducer::minNumberOfLayersWithMeasBeforeFiltering_
private

Definition at line 35 of file FastTrackerRecHitMaskProducer.cc.

Referenced by produce().

◆ oldHitMaskToken_

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

Definition at line 43 of file FastTrackerRecHitMaskProducer.cc.

Referenced by FastTrackerRecHitMaskProducer(), and produce().

◆ recHits_

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

Definition at line 41 of file FastTrackerRecHitMaskProducer.cc.

Referenced by produce().

◆ srcQuals

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

Definition at line 39 of file FastTrackerRecHitMaskProducer.cc.

Referenced by FastTrackerRecHitMaskProducer(), and produce().

◆ trackQuality_

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

Definition at line 36 of file FastTrackerRecHitMaskProducer.cc.

Referenced by produce().

◆ trajectories_

const TrackCollectionTokens FastTrackerRecHitMaskProducer::trajectories_
private

Definition at line 38 of file FastTrackerRecHitMaskProducer.cc.

Referenced by produce().

PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:355
FastTrackerRecHitMaskProducer::minNumberOfLayersWithMeasBeforeFiltering_
const int minNumberOfLayersWithMeasBeforeFiltering_
Definition: FastTrackerRecHitMaskProducer.cc:35
hit::id
unsigned int id
Definition: SiStripHitEffFromCalibTree.cc:92
edm::Handle::product
T const * product() const
Definition: Handle.h:70
reco::TrackBase::undefQuality
Definition: TrackBase.h:151
FastTrackerRecHitMaskProducer::QualityMaskCollection
std::vector< unsigned char > QualityMaskCollection
Definition: FastTrackerRecHitMaskProducer.cc:32
FastTrackerRecHit
Definition: FastTrackerRecHit.h:40
edm::Handle
Definition: AssociativeIterator.h:50
edm::EDGetTokenT::isUninitialized
bool isUninitialized() const
Definition: EDGetToken.h:70
reco::Track
Definition: Track.h:27
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
MixedTripletStep_cff.oldHitRemovalInfo
oldHitRemovalInfo
Definition: MixedTripletStep_cff.py:486
FastTrackerRecHitMaskProducer::srcQuals
edm::EDGetTokenT< QualityMaskCollection > srcQuals
Definition: FastTrackerRecHitMaskProducer.cc:39
TrackCollectionTokens::tracks
reco::TrackCollection const & tracks(edm::Event &evt) const
Definition: TrackCollectionTokens.h:26
iEvent
int iEvent
Definition: GenABIO.cc:224
FastTrackerRecHitMaskProducer::trackQuality_
const reco::TrackBase::TrackQuality trackQuality_
Definition: FastTrackerRecHitMaskProducer.cc:36
reco::TrackBase::qualityByName
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
FastTrackerRecHitMaskProducer::oldHitMaskToken_
edm::EDGetTokenT< std::vector< bool > > oldHitMaskToken_
Definition: FastTrackerRecHitMaskProducer.cc:43
FastTrackerRecHitMaskProducer::trajectories_
const TrackCollectionTokens trajectories_
Definition: FastTrackerRecHitMaskProducer.cc:38
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
edm::InputTag
Definition: InputTag.h:15
FastTrackerRecHitMaskProducer::recHits_
edm::EDGetTokenT< FastTrackerRecHitCollection > recHits_
Definition: FastTrackerRecHitMaskProducer.cc:41
hit
Definition: SiStripHitEffFromCalibTree.cc:88