CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
MuonLinksProducerForHLT Class Reference

#include <MuonLinksProducerForHLT.h>

Inheritance diagram for MuonLinksProducerForHLT:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MuonLinksProducerForHLT (const edm::ParameterSet &)
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 
 ~MuonLinksProducerForHLT () override
 
- Public Member Functions inherited from edm::global::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
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::EDGetTokenT< reco::MuonTrackLinksCollectionlinkToken_
 
double pMin
 
double ptMin
 
double shareHitFraction
 
edm::InputTag theInclusiveTrackCollectionInInput
 
edm::InputTag theLinkCollectionInInput
 
edm::EDGetTokenT< reco::TrackCollectiontrackToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Author
R. Bellan - UCSB ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Simple producer to make reco::MuonTrackLinks collection out of the global muons from "muons" collection to restore dropped links used as input for MuonIdProducer.

Author
R. Bellan - UCSB ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Definition at line 24 of file MuonLinksProducerForHLT.h.

Constructor & Destructor Documentation

◆ MuonLinksProducerForHLT()

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

Definition at line 22 of file MuonLinksProducerForHLT.cc.

22  {
23  produces<reco::MuonTrackLinksCollection>();
24  theLinkCollectionInInput = iConfig.getParameter<edm::InputTag>("LinkCollection");
25  theInclusiveTrackCollectionInInput = iConfig.getParameter<edm::InputTag>("InclusiveTrackerTrackCollection");
26  ptMin = iConfig.getParameter<double>("ptMin");
27  pMin = iConfig.getParameter<double>("pMin");
28  shareHitFraction = iConfig.getParameter<double>("shareHitFraction");
29 
30  linkToken_ = consumes<reco::MuonTrackLinksCollection>(theLinkCollectionInInput);
31  trackToken_ = consumes<reco::TrackCollection>(theInclusiveTrackCollectionInInput);
32 }

References edm::ParameterSet::getParameter(), linkToken_, pMin, ptMin, shareHitFraction, theInclusiveTrackCollectionInInput, theLinkCollectionInInput, and trackToken_.

◆ ~MuonLinksProducerForHLT()

MuonLinksProducerForHLT::~MuonLinksProducerForHLT ( )
override

Definition at line 34 of file MuonLinksProducerForHLT.cc.

34 {}

Member Function Documentation

◆ produce()

void MuonLinksProducerForHLT::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 36 of file MuonLinksProducerForHLT.cc.

36  {
37  auto output = std::make_unique<reco::MuonTrackLinksCollection>();
38 
40  iEvent.getByToken(linkToken_, links);
41 
43  iEvent.getByToken(trackToken_, incTracks);
44 
45  for (reco::MuonTrackLinksCollection::const_iterator link = links->begin(); link != links->end(); ++link) {
46  bool found = false;
47  unsigned int trackIndex = 0;
48  unsigned int muonTrackHits = link->trackerTrack()->extra()->recHitsSize();
49  for (reco::TrackCollection::const_iterator track = incTracks->begin(); track != incTracks->end();
50  ++track, ++trackIndex) {
51  if (track->pt() < ptMin)
52  continue;
53  if (track->p() < pMin)
54  continue;
55  //std::cout << "pt (muon/track) " << link->trackerTrack()->pt() << " " << track->pt() << std::endl;
56  unsigned trackHits = track->extra()->recHitsSize();
57  //std::cout << "hits (muon/track) " << muonTrackHits << " " << trackHits() << std::endl;
58  unsigned int smallestNumberOfHits = trackHits < muonTrackHits ? trackHits : muonTrackHits;
59  int numberOfCommonDetIds = 0;
60  for (auto hit = track->extra()->recHitsBegin(); hit != track->extra()->recHitsEnd(); ++hit) {
61  for (auto mit = link->trackerTrack()->extra()->recHitsBegin();
62  mit != link->trackerTrack()->extra()->recHitsEnd();
63  ++mit) {
64  if ((*hit)->geographicalId() == (*mit)->geographicalId() &&
65  (*hit)->sharesInput((*mit), TrackingRecHit::some)) {
66  numberOfCommonDetIds++;
67  break;
68  }
69  }
70  }
71  double fraction = (double)numberOfCommonDetIds / smallestNumberOfHits;
72  // std::cout << "Overlap/Smallest/fraction = " << numberOfCommonDetIds << " " << smallestNumberOfHits << " " << fraction << std::endl;
73  if (fraction > shareHitFraction) {
74  output->push_back(
75  reco::MuonTrackLinks(reco::TrackRef(incTracks, trackIndex), link->standAloneTrack(), link->globalTrack()));
76  found = true;
77  break;
78  }
79  }
80  if (!found)
81  output->push_back(reco::MuonTrackLinks(link->trackerTrack(), link->standAloneTrack(), link->globalTrack()));
82  }
83  iEvent.put(std::move(output));
84 }

References newFWLiteAna::found, HLT_FULL_cff::fraction, iEvent, MainPageGenerator::link, electronStore::links, linkToken_, eostools::move(), convertSQLitetoXML_cfg::output, pMin, ptMin, shareHitFraction, TrackingRecHit::some, HLT_FULL_cff::track, and trackToken_.

Member Data Documentation

◆ linkToken_

edm::EDGetTokenT<reco::MuonTrackLinksCollection> MuonLinksProducerForHLT::linkToken_
private

Definition at line 35 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT(), and produce().

◆ pMin

double MuonLinksProducerForHLT::pMin
private

Definition at line 38 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT(), and produce().

◆ ptMin

double MuonLinksProducerForHLT::ptMin
private

Definition at line 37 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT(), and produce().

◆ shareHitFraction

double MuonLinksProducerForHLT::shareHitFraction
private

Definition at line 39 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT(), and produce().

◆ theInclusiveTrackCollectionInInput

edm::InputTag MuonLinksProducerForHLT::theInclusiveTrackCollectionInInput
private

Definition at line 34 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT().

◆ theLinkCollectionInInput

edm::InputTag MuonLinksProducerForHLT::theLinkCollectionInInput
private

Definition at line 33 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT().

◆ trackToken_

edm::EDGetTokenT<reco::TrackCollection> MuonLinksProducerForHLT::trackToken_
private

Definition at line 36 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT(), and produce().

HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
MuonLinksProducerForHLT::theInclusiveTrackCollectionInInput
edm::InputTag theInclusiveTrackCollectionInInput
Definition: MuonLinksProducerForHLT.h:34
MainPageGenerator.link
link
Definition: MainPageGenerator.py:271
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
MuonLinksProducerForHLT::pMin
double pMin
Definition: MuonLinksProducerForHLT.h:38
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::Handle< reco::MuonTrackLinksCollection >
edm::Ref< TrackCollection >
HLT_FULL_cff.fraction
fraction
Definition: HLT_FULL_cff.py:52795
TrackingRecHit::some
Definition: TrackingRecHit.h:59
MuonLinksProducerForHLT::ptMin
double ptMin
Definition: MuonLinksProducerForHLT.h:37
MuonLinksProducerForHLT::linkToken_
edm::EDGetTokenT< reco::MuonTrackLinksCollection > linkToken_
Definition: MuonLinksProducerForHLT.h:35
iEvent
int iEvent
Definition: GenABIO.cc:224
MuonLinksProducerForHLT::trackToken_
edm::EDGetTokenT< reco::TrackCollection > trackToken_
Definition: MuonLinksProducerForHLT.h:36
MuonLinksProducerForHLT::shareHitFraction
double shareHitFraction
Definition: MuonLinksProducerForHLT.h:39
eostools.move
def move(src, dest)
Definition: eostools.py:511
electronStore.links
links
Definition: electronStore.py:149
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MuonLinksProducerForHLT::theLinkCollectionInInput
edm::InputTag theLinkCollectionInInput
Definition: MuonLinksProducerForHLT.h:33
edm::InputTag
Definition: InputTag.h:15
hit
Definition: SiStripHitEffFromCalibTree.cc:88