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
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 (const std::string &iProcessName, std::vector< const char * > &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::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
 
- 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 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::EDConsumerBase::consumesCollector(), 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");
18  trackAssociatorParameters_.loadParameters(cfgTrackAssociator, iC);
20 
21  // maps of detId to number of hits attributed to muon
22  produces<detIdToIntMap>("hitsMuPlus");
23  produces<detIdToIntMap>("hitsMuMinus");
24 
25  verbosity_ = ( cfg.exists("verbosity") ) ?
26  cfg.getParameter<int>("verbosity") : 0;
27 }
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
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
TrackDetectorAssociator trackAssociator_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
MuonDetCleaner::~MuonDetCleaner ( )

Definition at line 29 of file MuonDetCleaner.cc.

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

Member Function Documentation

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

Definition at line 76 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().

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

Implements edm::EDProducer.

Definition at line 34 of file MuonDetCleaner.cc.

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

35 {
36  std::auto_ptr<detIdToIntMap> hitsMuPlus(new detIdToIntMap());
37  std::auto_ptr<detIdToIntMap> hitsMuMinus(new detIdToIntMap());
38 
39  std::vector<reco::CandidateBaseRef> selMuons = getSelMuons(evt, srcSelectedMuons_);
40  const reco::CandidateBaseRef muPlus = getTheMuPlus(selMuons);
41  const reco::CandidateBaseRef muMinus = getTheMuMinus(selMuons);
42 
43  if ( muPlus.isNonnull() ) fillHitMap(evt, es, &(*muPlus), *hitsMuPlus);
44  if ( muMinus.isNonnull() ) fillHitMap(evt, es, &(*muMinus), *hitsMuMinus);
45 
46  evt.put(hitsMuPlus, "hitsMuPlus");
47  evt.put(hitsMuMinus, "hitsMuMinus");
48 }
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
bool isNonnull() const
Checks for non-null.
Definition: RefToBase.h:330
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
std::vector< reco::CandidateBaseRef > getSelMuons(const edm::Event &, const edm::InputTag &)
reco::CandidateBaseRef getTheMuPlus(const std::vector< reco::CandidateBaseRef > &)

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