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
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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
 
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)
 
 ~ProducerBase () 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 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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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::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

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 25 of file MuonLinksProducerForHLT.h.

Constructor & Destructor Documentation

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

Definition at line 23 of file MuonLinksProducerForHLT.cc.

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

24 {
25  produces<reco::MuonTrackLinksCollection>();
26  theLinkCollectionInInput = iConfig.getParameter<edm::InputTag>("LinkCollection");
27  theInclusiveTrackCollectionInInput = iConfig.getParameter<edm::InputTag>("InclusiveTrackerTrackCollection");
28  ptMin = iConfig.getParameter<double>("ptMin");
29  pMin = iConfig.getParameter<double>("pMin");
30  shareHitFraction = iConfig.getParameter<double>("shareHitFraction");
31 
32  linkToken_ = consumes<reco::MuonTrackLinksCollection>(theLinkCollectionInInput);
33  trackToken_ = consumes<reco::TrackCollection>(theInclusiveTrackCollectionInInput);
34 
35 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::TrackCollection > trackToken_
edm::EDGetTokenT< reco::MuonTrackLinksCollection > linkToken_
edm::InputTag theInclusiveTrackCollectionInInput
MuonLinksProducerForHLT::~MuonLinksProducerForHLT ( )
override

Definition at line 37 of file MuonLinksProducerForHLT.cc.

38 {
39 }

Member Function Documentation

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

Definition at line 41 of file MuonLinksProducerForHLT.cc.

References runEdmFileComparison::found, dedxEstimators_cff::fraction, edm::Event::getByToken(), linkToken_, eostools::move(), convertSQLitetoXML_cfg::output, pMin, ptMin, edm::Event::put(), shareHitFraction, TrackingRecHit::some, HiIsolationCommonParameters_cff::track, and trackToken_.

42 {
43  auto output = std::make_unique<reco::MuonTrackLinksCollection>();
44 
46  iEvent.getByToken(linkToken_, links);
47 
49  iEvent.getByToken(trackToken_, incTracks);
50 
51  for(reco::MuonTrackLinksCollection::const_iterator link = links->begin();
52  link != links->end(); ++link){
53  bool found = false;
54  unsigned int trackIndex = 0;
55  unsigned int muonTrackHits = link->trackerTrack()->extra()->recHitsSize();
56  for(reco::TrackCollection::const_iterator track = incTracks->begin();
57  track != incTracks->end(); ++track, ++trackIndex){
58  if ( track->pt() < ptMin ) continue;
59  if ( track->p() < pMin ) continue;
60  //std::cout << "pt (muon/track) " << link->trackerTrack()->pt() << " " << track->pt() << std::endl;
61  unsigned trackHits = track->extra()->recHitsSize();
62  //std::cout << "hits (muon/track) " << muonTrackHits << " " << trackHits() << std::endl;
63  unsigned int smallestNumberOfHits = trackHits < muonTrackHits ? trackHits : muonTrackHits;
64  int numberOfCommonDetIds = 0;
65  for ( auto hit = track->extra()->recHitsBegin();
66  hit != track->extra()->recHitsEnd(); ++hit ) {
67  for ( auto mit = link->trackerTrack()->extra()->recHitsBegin();
68  mit != link->trackerTrack()->extra()->recHitsEnd(); ++mit ) {
69  if ( (*hit)->geographicalId() == (*mit)->geographicalId() &&
70  (*hit)->sharesInput((*mit),TrackingRecHit::some) ) {
71  numberOfCommonDetIds++;
72  break;
73  }
74  }
75  }
76  double fraction = (double)numberOfCommonDetIds/smallestNumberOfHits;
77  // std::cout << "Overlap/Smallest/fraction = " << numberOfCommonDetIds << " " << smallestNumberOfHits << " " << fraction << std::endl;
78  if( fraction > shareHitFraction ) {
79  output->push_back(reco::MuonTrackLinks(reco::TrackRef(incTracks,trackIndex),
80  link->standAloneTrack(),
81  link->globalTrack() ) );
82  found = true;
83  break;
84  }
85  }
86  if (!found)
87  output->push_back(reco::MuonTrackLinks(link->trackerTrack(),
88  link->standAloneTrack(),
89  link->globalTrack() ) );
90  }
91  iEvent.put(std::move(output));
92 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
edm::EDGetTokenT< reco::TrackCollection > trackToken_
edm::EDGetTokenT< reco::MuonTrackLinksCollection > linkToken_
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

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

Definition at line 36 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT(), and produce().

double MuonLinksProducerForHLT::pMin
private

Definition at line 39 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT(), and produce().

double MuonLinksProducerForHLT::ptMin
private

Definition at line 38 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT(), and produce().

double MuonLinksProducerForHLT::shareHitFraction
private

Definition at line 40 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT(), and produce().

edm::InputTag MuonLinksProducerForHLT::theInclusiveTrackCollectionInInput
private

Definition at line 35 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT().

edm::InputTag MuonLinksProducerForHLT::theLinkCollectionInInput
private

Definition at line 34 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT().

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

Definition at line 37 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT(), and produce().