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
MuonDetCleaner Class Reference

#include <MuonDetCleaner.h>

Inheritance diagram for MuonDetCleaner:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MuonDetCleaner (const edm::ParameterSet &)
 
 ~MuonDetCleaner ()
 
- 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 Types

typedef std::map< uint32_t, int > detIdToIntMap
 

Private Member Functions

void fillHitMap (edm::Event &, const edm::EventSetup &, const reco::Candidate *, detIdToIntMap &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

edm::InputTag srcSelectedMuons_
 
TrackDetectorAssociator trackAssociator_
 
TrackAssociatorParameters trackAssociatorParameters_
 
int verbosity_
 

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

Produce collections of recHits in muon detectors from which the hits of the two muons from the Z -> mu+ mu- decay are subtracted (the remaining hits may be due to pile-up/heavy quark decays in Z+jets events)

Author
Christian Veelken, LLR
Version
Revision:
1.2
Id:
MuonDetCleaner.h,v 1.2 2012/11/25 15:43:12 veelken Exp

Definition at line 31 of file MuonDetCleaner.h.

Member Typedef Documentation

typedef std::map<uint32_t, int> MuonDetCleaner::detIdToIntMap
private

Definition at line 40 of file MuonDetCleaner.h.

Constructor & Destructor Documentation

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

Definition at line 13 of file MuonDetCleaner.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), TrackAssociatorParameters::loadParameters(), trackAssociator_, trackAssociatorParameters_, TrackDetectorAssociator::useDefaultPropagator(), and verbosity_.

14  : srcSelectedMuons_(cfg.getParameter<edm::InputTag>("selectedMuons"))
15 {
16  edm::ParameterSet cfgTrackAssociator = cfg.getParameter<edm::ParameterSet>("trackAssociator");
17  trackAssociatorParameters_.loadParameters(cfgTrackAssociator);
19 
20  // maps of detId to number of hits attributed to muon
21  produces<detIdToIntMap>("hitsMuPlus");
22  produces<detIdToIntMap>("hitsMuMinus");
23 
24  verbosity_ = ( cfg.exists("verbosity") ) ?
25  cfg.getParameter<int>("verbosity") : 0;
26 }
T getParameter(std::string const &) const
TrackAssociatorParameters trackAssociatorParameters_
edm::InputTag srcSelectedMuons_
void useDefaultPropagator()
use the default propagator
bool exists(std::string const &parameterName) const
checks if a parameter exists
TrackDetectorAssociator trackAssociator_
void loadParameters(const edm::ParameterSet &)
MuonDetCleaner::~MuonDetCleaner ( )

Definition at line 28 of file MuonDetCleaner.cc.

29 {
30 // nothing to be done yet...
31 }

Member Function Documentation

void MuonDetCleaner::fillHitMap ( edm::Event evt,
const edm::EventSetup es,
const reco::Candidate muon,
detIdToIntMap hitMap 
)
private

Definition at line 75 of file MuonDetCleaner.cc.

References TrackDetectorAssociator::Any, TrackDetectorAssociator::associate(), TrackDetMatchInfo::chambers, reco::Candidate::charge(), gather_cfg::cout, reco::Candidate::eta(), edm::Ref< C, T, F >::isNonnull(), metsig::muon, reco::Muon::outerTrack(), reco::Candidate::phi(), reco::Candidate::pt(), reco::Candidate::px(), reco::Candidate::py(), reco::Candidate::pz(), TrackingRecHit::rawId(), AlCaHLTBitMon_QueryRunRegistry::string, trackAssociator_, trackAssociatorParameters_, verbosity_, and reco::Candidate::vertex().

Referenced by produce().

76 {
77  int numHits = 0;
78 
79  const reco::Muon* recoMuon = dynamic_cast<const reco::Muon*>(muon);
80  if ( recoMuon && recoMuon->outerTrack().isNonnull() ) {
81  const reco::TrackRef muonOuterTrack = recoMuon->outerTrack();
83  for ( std::vector<TAMuonChamberMatch>::const_iterator rh = trackDetMatchInfo.chambers.begin();
84  rh != trackDetMatchInfo.chambers.end(); ++rh ) {
85  ++hitMap[rh->id.rawId()];
86  ++numHits;
87  }
88  for ( trackingRecHit_iterator rh = muonOuterTrack->recHitsBegin();
89  rh != muonOuterTrack->recHitsEnd(); ++rh ) {
90  fillHitMapRH(**rh, hitMap, numHits);
91  }
92  } else {
93  GlobalVector muonP3(muon->px(), muon->py(), muon->pz());
94  GlobalPoint muonVtx(muon->vertex().x(), muon->vertex().y(), muon->vertex().z());
95  TrackDetMatchInfo trackDetMatchInfo = trackAssociator_.associate(evt, es, muonP3, muonVtx, muon->charge(), trackAssociatorParameters_);
96  for ( std::vector<TAMuonChamberMatch>::const_iterator rh = trackDetMatchInfo.chambers.begin();
97  rh != trackDetMatchInfo.chambers.end(); ++rh ) {
98  ++hitMap[rh->id.rawId()];
99  ++numHits;
100  }
101  }
102 
103  if ( verbosity_ ) {
104  std::string muonCharge_string = "";
105  if ( muon->charge() > +0.5 ) muonCharge_string = "+";
106  else if ( muon->charge() < -0.5 ) muonCharge_string = "-";
107  std::cout << "Mu" << muonCharge_string << ": Pt = " << muon->pt() << ", eta = " << muon->eta() << ", phi = " << muon->phi()
108  << " --> #Hits = " << numHits << std::endl;
109  if ( verbosity_ >= 2 ) printHitMapRH(es, hitMap);
110  }
111 }
TrackAssociatorParameters trackAssociatorParameters_
virtual float eta() const =0
momentum pseudorapidity
virtual double pz() const =0
z coordinate of momentum vector
virtual float phi() const =0
momentum azimuthal angle
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
virtual float pt() const =0
transverse momentum
TrackDetectorAssociator trackAssociator_
std::vector< TAMuonChamberMatch > chambers
virtual const Point & vertex() const =0
vertex position
virtual int charge() const =0
electric charge
virtual double py() const =0
y coordinate of momentum vector
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
Definition: Muon.h:51
virtual double px() const =0
x coordinate of momentum vector
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
tuple cout
Definition: gather_cfg.py:121
void MuonDetCleaner::produce ( edm::Event evt,
const edm::EventSetup es 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 33 of file MuonDetCleaner.cc.

References fillHitMap(), getSelMuons(), getTheMuMinus(), getTheMuPlus(), edm::RefToBase< T >::isNonnull(), edm::Event::put(), and srcSelectedMuons_.

34 {
35  std::auto_ptr<detIdToIntMap> hitsMuPlus(new detIdToIntMap());
36  std::auto_ptr<detIdToIntMap> hitsMuMinus(new detIdToIntMap());
37 
38  std::vector<reco::CandidateBaseRef> selMuons = getSelMuons(evt, srcSelectedMuons_);
39  const reco::CandidateBaseRef muPlus = getTheMuPlus(selMuons);
40  const reco::CandidateBaseRef muMinus = getTheMuMinus(selMuons);
41 
42  if ( muPlus.isNonnull() ) fillHitMap(evt, es, &(*muPlus), *hitsMuPlus);
43  if ( muMinus.isNonnull() ) fillHitMap(evt, es, &(*muMinus), *hitsMuMinus);
44 
45  evt.put(hitsMuPlus, "hitsMuPlus");
46  evt.put(hitsMuMinus, "hitsMuMinus");
47 }
reco::CandidateBaseRef getTheMuMinus(const std::vector< reco::CandidateBaseRef > &)
void fillHitMap(edm::Event &, const edm::EventSetup &, const reco::Candidate *, detIdToIntMap &)
edm::InputTag srcSelectedMuons_
std::map< uint32_t, int > detIdToIntMap
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
std::vector< reco::CandidateBaseRef > getSelMuons(const edm::Event &, const edm::InputTag &)
reco::CandidateBaseRef getTheMuPlus(const std::vector< reco::CandidateBaseRef > &)
bool isNonnull() const
Checks for non-null.
Definition: RefToBase.h:279

Member Data Documentation

edm::InputTag MuonDetCleaner::srcSelectedMuons_
private

Definition at line 43 of file MuonDetCleaner.h.

Referenced by produce().

TrackDetectorAssociator MuonDetCleaner::trackAssociator_
private

Definition at line 45 of file MuonDetCleaner.h.

Referenced by fillHitMap(), and MuonDetCleaner().

TrackAssociatorParameters MuonDetCleaner::trackAssociatorParameters_
private

Definition at line 46 of file MuonDetCleaner.h.

Referenced by fillHitMap(), and MuonDetCleaner().

int MuonDetCleaner::verbosity_
private

Definition at line 48 of file MuonDetCleaner.h.

Referenced by fillHitMap(), and MuonDetCleaner().