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
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, 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::EDConsumerBase::consumesCollector(), 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");
24  trackAssociatorParameters_.loadParameters(cfgTrackAssociator, iC);
26 
27  // maps of detId to energy deposit attributed to muon
28  produces<detIdToFloatMap>("energyDepositsMuPlus");
29  produces<detIdToFloatMap>("energyDepositsMuMinus");
30 }
T getParameter(std::string const &) const
void useDefaultPropagator()
use the default propagator
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
TrackAssociatorParameters trackAssociatorParameters_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
TrackDetectorAssociator trackAssociator_
MuonCaloCleanerAllCrossed::~MuonCaloCleanerAllCrossed ( )

Definition at line 32 of file MuonCaloCleanerAllCrossed.cc.

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

Member Function Documentation

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

Definition at line 53 of file MuonCaloCleanerAllCrossed.cc.

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

Referenced by produce().

54 {
56 
57  for ( std::vector<const EcalRecHit*>::const_iterator rh = trackDetMatchInfo.crossedEcalRecHits.begin();
58  rh != trackDetMatchInfo.crossedEcalRecHits.end(); ++rh ) {
59  energyDepositMap[(*rh)->detid().rawId()] += (*rh)->energy();
60  }
61 
62  for ( std::vector<const HBHERecHit*>::const_iterator rh = trackDetMatchInfo.crossedHcalRecHits.begin();
63  rh != trackDetMatchInfo.crossedHcalRecHits.end(); ++rh ) {
64  energyDepositMap[(*rh)->detid().rawId()] += (*rh)->energy();
65  }
66 
67  for ( std::vector<const HORecHit*>::const_iterator rh = trackDetMatchInfo.crossedHORecHits.begin();
68  rh != trackDetMatchInfo.crossedHORecHits.end(); ++rh ) {
69  energyDepositMap[(*rh)->detid().rawId()] += (*rh)->energy();
70  }
71 
72  // TF: there exists no better way
74  evt.getByLabel(srcESrecHits_, esRecHits);
75  for ( std::vector<DetId>::const_iterator detId = trackDetMatchInfo.crossedPreshowerIds.begin();
76  detId != trackDetMatchInfo.crossedPreshowerIds.end(); ++detId ) {
77  ESRecHitCollection::const_iterator rh = esRecHits->find(*detId);
78  if ( rh != esRecHits->end() ) {
79  energyDepositMap[rh->detid().rawId()] += rh->energy();
80  }
81  }
82 }
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:405
std::vector< const HORecHit * > crossedHORecHits
void MuonCaloCleanerAllCrossed::produce ( edm::Event evt,
const edm::EventSetup es 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 37 of file MuonCaloCleanerAllCrossed.cc.

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

38 {
39  std::auto_ptr<detIdToFloatMap> energyDepositsMuPlus(new detIdToFloatMap());
40  std::auto_ptr<detIdToFloatMap> energyDepositsMuMinus(new detIdToFloatMap());
41 
42  std::vector<reco::CandidateBaseRef> selMuons = getSelMuons(evt, srcSelectedMuons_);
43  const reco::CandidateBaseRef muPlus = getTheMuPlus(selMuons);
44  const reco::CandidateBaseRef muMinus = getTheMuMinus(selMuons);
45 
46  if ( muPlus.isNonnull() ) fillEnergyDepositMap(evt, es, &(*muPlus), *energyDepositsMuPlus);
47  if ( muMinus.isNonnull() ) fillEnergyDepositMap(evt, es, &(*muMinus), *energyDepositsMuMinus);
48 
49  evt.put(energyDepositsMuPlus, "energyDepositsMuPlus");
50  evt.put(energyDepositsMuMinus, "energyDepositsMuMinus");
51 }
reco::CandidateBaseRef getTheMuMinus(const std::vector< reco::CandidateBaseRef > &)
bool isNonnull() const
Checks for non-null.
Definition: RefToBase.h:279
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:113
std::vector< reco::CandidateBaseRef > getSelMuons(const edm::Event &, const edm::InputTag &)
reco::CandidateBaseRef getTheMuPlus(const std::vector< reco::CandidateBaseRef > &)

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