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 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 &)
 
virtual void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 
virtual ~MuonLinksProducerForHLT ()
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::global::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 Attributes

edm::EDGetTokenT
< reco::MuonTrackLinksCollection
linkToken_
 
double pMin
 
double ptMin
 
double shareHitFraction
 
edm::InputTag theInclusiveTrackCollectionInInput
 
edm::InputTag theLinkCollectionInInput
 
edm::EDGetTokenT
< reco::TrackCollection
trackToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase 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::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 ( )
virtual

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
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 41 of file MuonLinksProducerForHLT.cc.

References newFWLiteAna::found, HLT_25ns10e33_v2_cff::fraction, edm::Event::getByToken(), MainPageGenerator::link, electronStore::links, linkToken_, convertSQLitetoXML_cfg::output, pMin, ptMin, edm::Event::put(), shareHitFraction, TrackingRecHit::some, and trackToken_.

42 {
43  std::auto_ptr<reco::MuonTrackLinksCollection> output(new 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( output );
92 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
std::vector< MuonTrackLinks > MuonTrackLinksCollection
collection of MuonTrackLinks
Definition: MuonFwd.h:22
edm::EDGetTokenT< reco::TrackCollection > trackToken_
edm::EDGetTokenT< reco::MuonTrackLinksCollection > linkToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121

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().