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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MuonLinksProducerForHLT (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
virtual ~MuonLinksProducerForHLT ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 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
 
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::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 24 of file MuonLinksProducerForHLT.cc.

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

25 {
26  produces<reco::MuonTrackLinksCollection>();
27  theLinkCollectionInInput = iConfig.getParameter<edm::InputTag>("LinkCollection");
28  theInclusiveTrackCollectionInInput = iConfig.getParameter<edm::InputTag>("InclusiveTrackerTrackCollection");
29  ptMin = iConfig.getParameter<double>("ptMin");
30  pMin = iConfig.getParameter<double>("pMin");
31  shareHitFraction = iConfig.getParameter<double>("shareHitFraction");
32 
33  linkToken_ = consumes<reco::MuonTrackLinksCollection>(theLinkCollectionInInput);
34  trackToken_ = consumes<reco::TrackCollection>(theInclusiveTrackCollectionInInput);
35 
36 }
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 38 of file MuonLinksProducerForHLT.cc.

39 {
40 }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 42 of file MuonLinksProducerForHLT.cc.

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

43 {
44  std::auto_ptr<reco::MuonTrackLinksCollection> output(new reco::MuonTrackLinksCollection());
45 
47  iEvent.getByToken(linkToken_, links);
48 
50  iEvent.getByToken(trackToken_, incTracks);
51 
52  for(reco::MuonTrackLinksCollection::const_iterator link = links->begin();
53  link != links->end(); ++link){
54  bool found = false;
55  unsigned int trackIndex = 0;
56  unsigned int muonTrackHits = link->trackerTrack()->extra()->recHits().size();
57  for(reco::TrackCollection::const_iterator track = incTracks->begin();
58  track != incTracks->end(); ++track, ++trackIndex){
59  if ( track->pt() < ptMin ) continue;
60  if ( track->p() < pMin ) continue;
61  //std::cout << "pt (muon/track) " << link->trackerTrack()->pt() << " " << track->pt() << std::endl;
62  unsigned trackHits = track->extra()->recHits().size();
63  //std::cout << "hits (muon/track) " << muonTrackHits << " " << trackHits() << std::endl;
64  unsigned int smallestNumberOfHits = trackHits < muonTrackHits ? trackHits : muonTrackHits;
65  int numberOfCommonDetIds = 0;
66  for ( TrackingRecHitRefVector::const_iterator hit = track->extra()->recHitsBegin();
67  hit != track->extra()->recHitsEnd(); ++hit ) {
68  for ( TrackingRecHitRefVector::const_iterator mit = link->trackerTrack()->extra()->recHitsBegin();
69  mit != link->trackerTrack()->extra()->recHitsEnd(); ++mit ) {
70  if ( hit->get()->geographicalId() == mit->get()->geographicalId() &&
71  hit->get()->sharesInput(mit->get(),TrackingRecHit::some) ) {
72  numberOfCommonDetIds++;
73  break;
74  }
75  }
76  }
77  double fraction = (double)numberOfCommonDetIds/smallestNumberOfHits;
78  // std::cout << "Overlap/Smallest/fraction = " << numberOfCommonDetIds << " " << smallestNumberOfHits << " " << fraction << std::endl;
79  if( fraction > shareHitFraction ) {
80  output->push_back(reco::MuonTrackLinks(reco::TrackRef(incTracks,trackIndex),
81  link->standAloneTrack(),
82  link->globalTrack() ) );
83  found = true;
84  break;
85  }
86  }
87  if (!found)
88  output->push_back(reco::MuonTrackLinks(link->trackerTrack(),
89  link->standAloneTrack(),
90  link->globalTrack() ) );
91  }
92  iEvent.put( output );
93 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
std::vector< MuonTrackLinks > MuonTrackLinksCollection
collection of MuonTrackLinks
Definition: MuonFwd.h:22
std::string link(std::string &nm, std::string &ns)
Definition: hierarchy.cc:24
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:116

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