test
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 Types | Private Member Functions | Private Attributes
GlobalMuonTrackCleaner Class Reference
Inheritance diagram for GlobalMuonTrackCleaner:
MuonTrackCleanerBase edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 GlobalMuonTrackCleaner (const edm::ParameterSet &)
 
 ~GlobalMuonTrackCleaner ()
 
- Public Member Functions inherited from MuonTrackCleanerBase
 MuonTrackCleanerBase (const edm::ParameterSet &)
 
 ~MuonTrackCleanerBase ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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 Types

typedef std::vector
< reco::MuonTrackLinks
MuonTrackLinksCollection
 

Private Member Functions

virtual void produceTrackExtras (edm::Event &, const edm::EventSetup &)
 

Private Attributes

edm::InputTag srcMuons_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Types inherited from MuonTrackCleanerBase
enum  { kInnerTrack, kOuterTrack, kLink, kTeV }
 
- Protected Member Functions inherited from MuonTrackCleanerBase
muonMomentumType getMuonMomentum (const reco::Candidate &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
virtual void produceTracks (edm::Event &, const edm::EventSetup &)
 
- 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)
 
- Protected Attributes inherited from MuonTrackCleanerBase
double dRmatch_
 
int maxWarnings_tooFew_
 
int maxWarnings_tooMany_
 
std::string moduleLabel_
 
int numWarnings_tooFew_
 
int numWarnings_tooMany_
 
bool removeDuplicates_
 
edm::InputTag srcSelectedMuons_
 
std::vector< todoListEntryTypetodoList_
 
int type_
 
int verbosity_
 

Detailed Description

Definition at line 37 of file GlobalMuonTrackCleaner.cc.

Member Typedef Documentation

Definition at line 48 of file GlobalMuonTrackCleaner.cc.

Constructor & Destructor Documentation

GlobalMuonTrackCleaner::GlobalMuonTrackCleaner ( const edm::ParameterSet cfg)
explicit

Definition at line 51 of file GlobalMuonTrackCleaner.cc.

References MuonTrackCleanerBase::todoList_.

52  : MuonTrackCleanerBase(cfg),
53  srcMuons_(cfg.getParameter<edm::InputTag>("srcMuons"))
54 {
55  for ( typename std::vector<todoListEntryType>::const_iterator todoItem = todoList_.begin();
56  todoItem != todoList_.end(); ++todoItem ) {
57  produces<MuonTrackLinksCollection>(todoItem->srcTracks_.instance());
58  }
59 }
T getParameter(std::string const &) const
MuonTrackCleanerBase(const edm::ParameterSet &)
std::vector< todoListEntryType > todoList_
GlobalMuonTrackCleaner::~GlobalMuonTrackCleaner ( )
inline

Definition at line 41 of file GlobalMuonTrackCleaner.cc.

41 {}

Member Function Documentation

void GlobalMuonTrackCleaner::produceTrackExtras ( edm::Event evt,
const edm::EventSetup es 
)
privatevirtual

Implements MuonTrackCleanerBase.

Definition at line 61 of file GlobalMuonTrackCleaner.cc.

References gather_cfg::cout, reco::deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, alignCSCRings::e, edm::Event::getByLabel(), reco::MuonTrackLinks::globalTrack(), edm::Ref< C, T, F >::id(), reco::Muon::innerTrack(), edm::Ref< C, T, F >::key(), MuonTrackCleanerBase::moduleLabel_, metsig::muon, patZpeak::muons, reco::Muon::outerTrack(), edm::Event::put(), reco::MuonTrackLinks::setGlobalTrack(), reco::MuonTrackLinks::setStandAloneTrack(), reco::MuonTrackLinks::setTrackerTrack(), srcMuons_, reco::MuonTrackLinks::standAloneTrack(), MuonTrackCleanerBase::todoList_, reco::MuonTrackLinks::trackerTrack(), and MuonTrackCleanerBase::verbosity_.

62 {
63  if ( verbosity_ ) std::cout << "<GlobalMuonTrackCleaner::produceTrackExtras (" << moduleLabel_ << ")>:" << std::endl;
64 
66  evt.getByLabel(srcMuons_, muons);
67 
68  for ( typename std::vector<todoListEntryType>::const_iterator todoItem = todoList_.begin();
69  todoItem != todoList_.end(); ++todoItem ) {
70  std::auto_ptr<MuonTrackLinksCollection> trackLinks_cleaned(new MuonTrackLinksCollection());
71 
72  for ( std::map<reco::TrackRef, reco::TrackRef>::const_iterator cleanedToUncleanedTrackAssociation = todoItem->trackRefMap_.begin();
73  cleanedToUncleanedTrackAssociation != todoItem->trackRefMap_.end(); ++cleanedToUncleanedTrackAssociation ) {
74  const reco::Muon* matchedMuon = 0;
75  double dRmatch = 1.e+3;
76  for ( reco::MuonCollection::const_iterator muon = muons->begin();
77  muon != muons->end(); ++muon ) {
78  if ( muon->globalTrack().isNull() ) continue;
79  if ( muon->globalTrack() == cleanedToUncleanedTrackAssociation->second ) { // match by edm::Ref
80  matchedMuon = &(*muon);
81  dRmatch = 0.;
82  break;
83  } else { // match by dR
84  double dR = reco::deltaR(muon->globalTrack()->eta(), muon->globalTrack()->phi(), cleanedToUncleanedTrackAssociation->second->eta(), cleanedToUncleanedTrackAssociation->second->phi());
85  if ( dR < 1.e-2 && dR < dRmatch ) {
86  matchedMuon = &(*muon);
87  dRmatch = dR;
88  }
89  }
90  }
91  if ( matchedMuon ) {
92  reco::MuonTrackLinks trackLink;
93  trackLink.setTrackerTrack(matchedMuon->innerTrack());
94  trackLink.setStandAloneTrack(matchedMuon->outerTrack());
95  trackLink.setGlobalTrack(cleanedToUncleanedTrackAssociation->first);
96  if ( verbosity_ ) {
97  std::cout << "creating new MuonTrackLinks:" << std::endl;
98  std::cout << " innerTrack = " << trackLink.trackerTrack().id() << ":" << trackLink.trackerTrack().key() << std::endl;
99  std::cout << " outerTrack = " << trackLink.standAloneTrack().id() << ":" << trackLink.standAloneTrack().key() << std::endl;
100  std::cout << " globalTrack = " << trackLink.globalTrack().id() << ":" << trackLink.globalTrack().key() << std::endl;
101  }
102  trackLinks_cleaned->push_back(trackLink);
103  }
104  }
105 
106  evt.put(trackLinks_cleaned, todoItem->srcTracks_.instance());
107  }
108 }
virtual TrackRef innerTrack() const
Definition: Muon.h:48
key_type key() const
Accessor for product key.
Definition: Ref.h:264
ProductID id() const
Accessor for product ID.
Definition: Ref.h:258
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
std::vector< reco::MuonTrackLinks > MuonTrackLinksCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
Definition: Muon.h:51
tuple muons
Definition: patZpeak.py:38
tuple cout
Definition: gather_cfg.py:145
std::vector< todoListEntryType > todoList_

Member Data Documentation

edm::InputTag GlobalMuonTrackCleaner::srcMuons_
private

Definition at line 46 of file GlobalMuonTrackCleaner.cc.

Referenced by produceTrackExtras().