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

#include <MuonCaloCleanerAllCrossed.h>

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

Public Member Functions

 MuonCaloCleanerAllCrossed (const edm::ParameterSet &)
 
 ~MuonCaloCleanerAllCrossed ()
 
- 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, float > detIdToFloatMap
 

Private Member Functions

void fillEnergyDepositMap (edm::Event &, const edm::EventSetup &, const reco::Candidate *, detIdToFloatMap &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

edm::InputTag srcESrecHits_
 
edm::InputTag srcSelectedMuons_
 
TrackDetectorAssociator trackAssociator_
 
TrackAssociatorParameters trackAssociatorParameters_
 

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 calorimeter recHits from which energy deposits of muons are subtracted.

This module attributes to the muon all energy deposited in calorimeter cells crossed by the muon.

WARNING: this module is to be used only for calorimeter types for which the assumption that no other particle deposited energy close to the muon track is a good approximation (e.g. HO)

Author
Tomasz Maciej Frueboes; Christian Veelken, LLR
Version
Revision:
1.2
Id:
MuonCaloCleanerAllCrossed.h,v 1.2 2012/11/25 15:43:12 veelken Exp

Definition at line 37 of file MuonCaloCleanerAllCrossed.h.

Member Typedef Documentation

typedef std::map<uint32_t, float> MuonCaloCleanerAllCrossed::detIdToFloatMap
private

Definition at line 46 of file MuonCaloCleanerAllCrossed.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file MuonCaloCleanerAllCrossed.cc.

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

19  : srcSelectedMuons_(cfg.getParameter<edm::InputTag>("selectedMuons")),
20  srcESrecHits_(cfg.getParameter<edm::InputTag>("esRecHits"))
21 {
22  edm::ParameterSet cfgTrackAssociator = cfg.getParameter<edm::ParameterSet>("trackAssociator");
23  trackAssociatorParameters_.loadParameters(cfgTrackAssociator);
25 
26  // maps of detId to energy deposit attributed to muon
27  produces<detIdToFloatMap>("energyDepositsMuPlus");
28  produces<detIdToFloatMap>("energyDepositsMuMinus");
29 }
T getParameter(std::string const &) const
void useDefaultPropagator()
use the default propagator
TrackAssociatorParameters trackAssociatorParameters_
TrackDetectorAssociator trackAssociator_
void loadParameters(const edm::ParameterSet &)
MuonCaloCleanerAllCrossed::~MuonCaloCleanerAllCrossed ( )

Definition at line 31 of file MuonCaloCleanerAllCrossed.cc.

32 {
33 // nothing to be done yet...
34 }

Member Function Documentation

void MuonCaloCleanerAllCrossed::fillEnergyDepositMap ( edm::Event evt,
const edm::EventSetup es,
const reco::Candidate muon,
detIdToFloatMap energyDepositMap 
)
private

Definition at line 52 of file MuonCaloCleanerAllCrossed.cc.

References TrackDetMatchInfo::crossedEcalRecHits, TrackDetMatchInfo::crossedHcalRecHits, TrackDetMatchInfo::crossedHORecHits, TrackDetMatchInfo::crossedPreshowerIds, edm::Event::getByLabel(), getTrackDetMatchInfo(), srcESrecHits_, trackAssociator_, and trackAssociatorParameters_.

Referenced by produce().

53 {
55 
56  for ( std::vector<const EcalRecHit*>::const_iterator rh = trackDetMatchInfo.crossedEcalRecHits.begin();
57  rh != trackDetMatchInfo.crossedEcalRecHits.end(); ++rh ) {
58  energyDepositMap[(*rh)->detid().rawId()] += (*rh)->energy();
59  }
60 
61  for ( std::vector<const HBHERecHit*>::const_iterator rh = trackDetMatchInfo.crossedHcalRecHits.begin();
62  rh != trackDetMatchInfo.crossedHcalRecHits.end(); ++rh ) {
63  energyDepositMap[(*rh)->detid().rawId()] += (*rh)->energy();
64  }
65 
66  for ( std::vector<const HORecHit*>::const_iterator rh = trackDetMatchInfo.crossedHORecHits.begin();
67  rh != trackDetMatchInfo.crossedHORecHits.end(); ++rh ) {
68  energyDepositMap[(*rh)->detid().rawId()] += (*rh)->energy();
69  }
70 
71  // TF: there exists no better way
73  evt.getByLabel(srcESrecHits_, esRecHits);
74  for ( std::vector<DetId>::const_iterator detId = trackDetMatchInfo.crossedPreshowerIds.begin();
75  detId != trackDetMatchInfo.crossedPreshowerIds.end(); ++detId ) {
76  ESRecHitCollection::const_iterator rh = esRecHits->find(*detId);
77  if ( rh != esRecHits->end() ) {
78  energyDepositMap[rh->detid().rawId()] += rh->energy();
79  }
80  }
81 }
std::vector< DetId > crossedPreshowerIds
std::vector< const HBHERecHit * > crossedHcalRecHits
std::vector< EcalRecHit >::const_iterator const_iterator
TrackDetMatchInfo getTrackDetMatchInfo(const edm::Event &, const edm::EventSetup &, TrackDetectorAssociator &, const TrackAssociatorParameters &, const reco::Candidate *)
std::vector< const EcalRecHit * > crossedEcalRecHits
hits in detector elements crossed by a track
TrackAssociatorParameters trackAssociatorParameters_
TrackDetectorAssociator trackAssociator_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
std::vector< const HORecHit * > crossedHORecHits
void MuonCaloCleanerAllCrossed::produce ( edm::Event evt,
const edm::EventSetup es 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 36 of file MuonCaloCleanerAllCrossed.cc.

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

37 {
38  std::auto_ptr<detIdToFloatMap> energyDepositsMuPlus(new detIdToFloatMap());
39  std::auto_ptr<detIdToFloatMap> energyDepositsMuMinus(new detIdToFloatMap());
40 
41  std::vector<reco::CandidateBaseRef> selMuons = getSelMuons(evt, srcSelectedMuons_);
42  const reco::CandidateBaseRef muPlus = getTheMuPlus(selMuons);
43  const reco::CandidateBaseRef muMinus = getTheMuMinus(selMuons);
44 
45  if ( muPlus.isNonnull() ) fillEnergyDepositMap(evt, es, &(*muPlus), *energyDepositsMuPlus);
46  if ( muMinus.isNonnull() ) fillEnergyDepositMap(evt, es, &(*muMinus), *energyDepositsMuMinus);
47 
48  evt.put(energyDepositsMuPlus, "energyDepositsMuPlus");
49  evt.put(energyDepositsMuMinus, "energyDepositsMuMinus");
50 }
reco::CandidateBaseRef getTheMuMinus(const std::vector< reco::CandidateBaseRef > &)
void fillEnergyDepositMap(edm::Event &, const edm::EventSetup &, const reco::Candidate *, detIdToFloatMap &)
std::map< uint32_t, float > detIdToFloatMap
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 MuonCaloCleanerAllCrossed::srcESrecHits_
private

Definition at line 50 of file MuonCaloCleanerAllCrossed.h.

Referenced by fillEnergyDepositMap().

edm::InputTag MuonCaloCleanerAllCrossed::srcSelectedMuons_
private

Definition at line 49 of file MuonCaloCleanerAllCrossed.h.

Referenced by produce().

TrackDetectorAssociator MuonCaloCleanerAllCrossed::trackAssociator_
private

Definition at line 52 of file MuonCaloCleanerAllCrossed.h.

Referenced by fillEnergyDepositMap(), and MuonCaloCleanerAllCrossed().

TrackAssociatorParameters MuonCaloCleanerAllCrossed::trackAssociatorParameters_
private

Definition at line 53 of file MuonCaloCleanerAllCrossed.h.

Referenced by fillEnergyDepositMap(), and MuonCaloCleanerAllCrossed().