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

#include <MuonCaloCleanerByDistance.h>

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

Public Member Functions

 MuonCaloCleanerByDistance (const edm::ParameterSet &)
 
 ~MuonCaloCleanerByDistance ()
 
- 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) 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 (const reco::Candidate &muon, const detIdToFloatMap &, detIdToFloatMap &, double &, double &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

DetNaming detNaming_
 
std::map< std::string, double > energyDepositCorrection_
 
std::string moduleLabel_
 
edm::InputTag srcDistanceMapMuMinus_
 
edm::InputTag srcDistanceMapMuPlus_
 
edm::InputTag srcSelectedMuons_
 
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 calorimeter recHits from which energy deposits of muons are subtracted.

This module attributes to the muon energy proportional to the distance traversed by the muon through each calorimeter cell.

Author
Tomasz Maciej Frueboes; Christian Veelken, LLR
Version
Revision:
1.4
Id:
MuonCaloCleanerByDistance.h,v 1.4 2013/02/05 20:01:19 veelken Exp

Definition at line 36 of file MuonCaloCleanerByDistance.h.

Member Typedef Documentation

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

Definition at line 45 of file MuonCaloCleanerByDistance.h.

Constructor & Destructor Documentation

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

Definition at line 11 of file MuonCaloCleanerByDistance.cc.

References energyDepositCorrection_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), and verbosity_.

12  : moduleLabel_(cfg.getParameter<std::string>("@module_label")),
14  srcDistanceMapMuPlus_(cfg.getParameter<edm::InputTag>("distanceMapMuPlus")),
15  srcDistanceMapMuMinus_(cfg.getParameter<edm::InputTag>("distanceMapMuMinus"))
16 {
17  edm::ParameterSet cfgEnergyDepositCorrection = cfg.getParameter<edm::ParameterSet>("energyDepositCorrection");
18  typedef std::vector<std::string> vstring;
19  vstring detNames = cfgEnergyDepositCorrection.getParameterNamesForType<double>();
20  for ( vstring::const_iterator detName = detNames.begin();
21  detName != detNames.end(); ++detName ) {
22  energyDepositCorrection_[*detName] = cfgEnergyDepositCorrection.getParameter<double>(*detName);
23  }
24 
25  verbosity_ = ( cfg.exists("verbosity") ) ?
26  cfg.getParameter<int>("verbosity") : 0;
27 
28  // maps of detId to expected energy deposits of muon
29  produces<detIdToFloatMap>("energyDepositsMuPlus");
30  produces<double>("totalDistanceMuPlus");
31  produces<double>("totalEnergyDepositMuPlus");
32  produces<detIdToFloatMap>("energyDepositsMuMinus");
33  produces<double>("totalDistanceMuMinus");
34  produces<double>("totalEnergyDepositMuMinus");
35 }
T getParameter(std::string const &) const
vector< string > vstring
Definition: ExoticaDQM.cc:75
std::map< std::string, double > energyDepositCorrection_
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:192
MuonCaloCleanerByDistance::~MuonCaloCleanerByDistance ( )

Definition at line 37 of file MuonCaloCleanerByDistance.cc.

38 {
39 // nothing to be done yet...
40 }

Member Function Documentation

void MuonCaloCleanerByDistance::fillEnergyDepositMap ( const reco::Candidate muon,
const detIdToFloatMap distanceMap,
detIdToFloatMap energyDepositMap,
double &  totalDistance,
double &  totalEnergyDeposit 
)
private

Definition at line 77 of file MuonCaloCleanerByDistance.cc.

References DENSITY_BRASS, DENSITY_IRON, DENSITY_PBWO4, DetId::det(), detNaming_, DetId::Ecal, energyDepositCorrection_, edm::hlt::Exception, getDeDxForPbWO4(), DetNaming::getKey(), DetId::Hcal, HcalOuter, combine::key, reco::Candidate::p(), DetId::rawId(), rho, funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, DetId::subdetId(), reco::Candidate::theta(), and theta().

Referenced by produce().

79 {
80  for ( detIdToFloatMap::const_iterator rawDetId_and_distance = distanceMap.begin();
81  rawDetId_and_distance != distanceMap.end(); ++rawDetId_and_distance ) {
82  DetId detId(rawDetId_and_distance->first);
83 
85 
86  if ( energyDepositCorrection_.find(key) == energyDepositCorrection_.end() )
87  throw cms::Exception("MuonCaloCleanerByDistance")
88  << "No energy deposit correction defined for detId = " << detId.rawId() << " (key = " << key << ") !!\n";
89 
90  double distance = rawDetId_and_distance->second;
91  double energyDepositCorrection_value = energyDepositCorrection_[key];
92 
93  double dEdx = 0.;
94  double rho = 0.;
95  switch ( detId.det() ) {
96  case DetId::Ecal:
97  dEdx = getDeDxForPbWO4(muon.p());
98  rho = DENSITY_PBWO4;
99  break;
100  case DetId::Hcal:
101  // AB: We don't have a dedx curve for the HCAL. Use the PbWO4 one as an approximation,
102  // the correction factors should be determined with respect to the PbWO4 curve.
103  dEdx = getDeDxForPbWO4(muon.p());
104  if ( detId.subdetId() == HcalOuter ) {
105  rho = DENSITY_IRON; // iron coil and return yoke
106  // HO uses magnet coil as additional absorber, add to flight distance:
107  const double theta = muon.theta();
108  distance += 31.2 / sin(theta); // 31.2cm is dr of cold mass of the magnet coil
109  } else {
110  rho = DENSITY_BRASS; // brass absorber
111  }
112  break;
113  default:
114  throw cms::Exception("MuonCaloCleanerByDistance")
115  << "Unknown detector type: " << key << ", detId = " << static_cast<unsigned int>(detId);
116  }
117 
118  double energyDeposit = distance*dEdx*rho*energyDepositCorrection_value;
119  energyDepositMap[rawDetId_and_distance->first] += energyDeposit;
120  totalDistance += distance;
121  totalEnergyDeposit += energyDeposit;
122  }
123 }
const double DENSITY_PBWO4
const double DENSITY_IRON
std::map< std::string, double > energyDepositCorrection_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Geom::Theta< T > theta() const
virtual double p() const =0
magnitude of momentum vector
const double DENSITY_BRASS
virtual double theta() const =0
momentum polar angle
double getDeDxForPbWO4(double)
Definition: DetId.h:18
list key
Definition: combine.py:13
std::string getKey(const DetId &)
Definition: DetNaming.cc:36
void MuonCaloCleanerByDistance::produce ( edm::Event evt,
const edm::EventSetup es 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 42 of file MuonCaloCleanerByDistance.cc.

References gather_cfg::cout, fillEnergyDepositMap(), edm::Event::getByLabel(), getSelMuons(), getTheMuMinus(), getTheMuPlus(), edm::RefToBase< T >::isNonnull(), moduleLabel_, edm::Event::put(), srcDistanceMapMuMinus_, srcDistanceMapMuPlus_, srcSelectedMuons_, and verbosity_.

43 {
44  std::auto_ptr<detIdToFloatMap> energyDepositsMuPlus(new detIdToFloatMap());
45  std::auto_ptr<detIdToFloatMap> energyDepositsMuMinus(new detIdToFloatMap());
46 
47  edm::Handle<detIdToFloatMap> distanceMapMuPlus;
48  evt.getByLabel(srcDistanceMapMuPlus_, distanceMapMuPlus);
49  edm::Handle<detIdToFloatMap> distanceMapMuMinus;
50  evt.getByLabel(srcDistanceMapMuMinus_, distanceMapMuMinus);
51 
52  std::vector<reco::CandidateBaseRef> selMuons = getSelMuons(evt, srcSelectedMuons_);
53  const reco::CandidateBaseRef muPlus = getTheMuPlus(selMuons);
54  const reco::CandidateBaseRef muMinus = getTheMuMinus(selMuons);
55 
56  std::auto_ptr<double> totalDistanceMuPlus(new double(0.));
57  std::auto_ptr<double> totalEnergyDepositMuPlus(new double(0.));
58  if ( muPlus.isNonnull() ) fillEnergyDepositMap(*muPlus, *distanceMapMuPlus, *energyDepositsMuPlus, *totalDistanceMuPlus, *totalEnergyDepositMuPlus);
59  std::auto_ptr<double> totalDistanceMuMinus(new double(0.));
60  std::auto_ptr<double> totalEnergyDepositMuMinus(new double(0.));
61  if ( muMinus.isNonnull() ) fillEnergyDepositMap(*muMinus, *distanceMapMuMinus, *energyDepositsMuMinus, *totalDistanceMuMinus, *totalEnergyDepositMuMinus);
62 
63  if ( verbosity_ ) {
64  std::cout << "<MuonCaloCleanerByDistance::produce (" << moduleLabel_ << ")>:" << std::endl;
65  std::cout << " mu+: distance = " << (*totalDistanceMuPlus) << ", expected(EnergyDeposits) = " << (*totalEnergyDepositMuPlus) << std::endl;
66  std::cout << " mu-: distance = " << (*totalDistanceMuMinus) << ", expected(EnergyDeposits) = " << (*totalEnergyDepositMuMinus) << std::endl;
67  }
68 
69  evt.put(energyDepositsMuPlus, "energyDepositsMuPlus");
70  evt.put(totalDistanceMuPlus, "totalDistanceMuPlus");
71  evt.put(totalEnergyDepositMuPlus, "totalEnergyDepositMuPlus");
72  evt.put(energyDepositsMuMinus, "energyDepositsMuMinus");
73  evt.put(totalDistanceMuMinus, "totalDistanceMuMinus");
74  evt.put(totalEnergyDepositMuMinus, "totalEnergyDepositMuMinus");
75 }
reco::CandidateBaseRef getTheMuMinus(const std::vector< reco::CandidateBaseRef > &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
std::map< uint32_t, float > detIdToFloatMap
void fillEnergyDepositMap(const reco::Candidate &muon, const detIdToFloatMap &, detIdToFloatMap &, double &, double &)
tuple cout
Definition: gather_cfg.py:121
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

DetNaming MuonCaloCleanerByDistance::detNaming_
private

Definition at line 54 of file MuonCaloCleanerByDistance.h.

Referenced by fillEnergyDepositMap().

std::map<std::string, double> MuonCaloCleanerByDistance::energyDepositCorrection_
private

Definition at line 56 of file MuonCaloCleanerByDistance.h.

Referenced by fillEnergyDepositMap(), and MuonCaloCleanerByDistance().

std::string MuonCaloCleanerByDistance::moduleLabel_
private
edm::InputTag MuonCaloCleanerByDistance::srcDistanceMapMuMinus_
private

Definition at line 52 of file MuonCaloCleanerByDistance.h.

Referenced by produce().

edm::InputTag MuonCaloCleanerByDistance::srcDistanceMapMuPlus_
private

Definition at line 51 of file MuonCaloCleanerByDistance.h.

Referenced by produce().

edm::InputTag MuonCaloCleanerByDistance::srcSelectedMuons_
private

Definition at line 50 of file MuonCaloCleanerByDistance.h.

Referenced by produce().

int MuonCaloCleanerByDistance::verbosity_
private

Definition at line 58 of file MuonCaloCleanerByDistance.h.

Referenced by MuonCaloCleanerByDistance(), and produce().