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 ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

double pMin
 
double ptMin
 
double shareHitFraction
 
edm::InputTag theInclusiveTrackCollectionInInput
 
edm::InputTag theLinkCollectionInInput
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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

Date:
2011/05/03 09:17:45
Revision:
1.3
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.

Date:
2011/05/03 09:17:49
Revision:
1.2
Author
R. Bellan - UCSB ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Definition at line 22 of file MuonLinksProducerForHLT.h.

Constructor & Destructor Documentation

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

Definition at line 31 of file MuonLinksProducerForHLT.cc.

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

32 {
33  produces<reco::MuonTrackLinksCollection>();
34  theLinkCollectionInInput = iConfig.getParameter<edm::InputTag>("LinkCollection");
35  theInclusiveTrackCollectionInInput = iConfig.getParameter<edm::InputTag>("InclusiveTrackerTrackCollection");
36  ptMin = iConfig.getParameter<double>("ptMin");
37  pMin = iConfig.getParameter<double>("pMin");
38  shareHitFraction = iConfig.getParameter<double>("shareHitFraction");
39 }
T getParameter(std::string const &) const
edm::InputTag theInclusiveTrackCollectionInInput
MuonLinksProducerForHLT::~MuonLinksProducerForHLT ( )
virtual

Definition at line 41 of file MuonLinksProducerForHLT.cc.

42 {
43 }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 45 of file MuonLinksProducerForHLT.cc.

References newFWLiteAna::found, edm::Event::getByLabel(), link(), electronStore::links, convertSQLitetoXML_cfg::output, pMin, ptMin, edm::Event::put(), shareHitFraction, TrackingRecHit::some, theInclusiveTrackCollectionInInput, and theLinkCollectionInInput.

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

Member Data Documentation

double MuonLinksProducerForHLT::pMin
private

Definition at line 34 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT(), and produce().

double MuonLinksProducerForHLT::ptMin
private

Definition at line 33 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT(), and produce().

double MuonLinksProducerForHLT::shareHitFraction
private

Definition at line 35 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT(), and produce().

edm::InputTag MuonLinksProducerForHLT::theInclusiveTrackCollectionInInput
private

Definition at line 32 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT(), and produce().

edm::InputTag MuonLinksProducerForHLT::theLinkCollectionInInput
private

Definition at line 31 of file MuonLinksProducerForHLT.h.

Referenced by MuonLinksProducerForHLT(), and produce().