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 Attributes
DetNaming Class Reference

#include <DetNaming.h>

Public Member Functions

 DetNaming ()
 
std::vector< std::string > getAllKeys ()
 
std::string getKey (const DetId &)
 
 ~DetNaming ()
 

Private Types

typedef std::map< int,
std::string > 
TMyMainMap
 
typedef std::map< int,
std::map< int, std::string > > 
TMySubMap
 

Private Attributes

TMyMainMap detMap_
 
TMySubMap subDetMap_
 

Detailed Description

Definition at line 13 of file DetNaming.h.

Member Typedef Documentation

typedef std::map<int, std::string > DetNaming::TMyMainMap
private

Definition at line 23 of file DetNaming.h.

typedef std::map<int, std::map<int, std::string> > DetNaming::TMySubMap
private

Definition at line 24 of file DetNaming.h.

Constructor & Destructor Documentation

DetNaming::DetNaming ( )

Definition at line 17 of file DetNaming.cc.

References detMap_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalLaserPnDiode, EcalPreshower, EcalTriggerTower, DetId::Hcal, HcalBarrel, HcalEmpty, HcalEndcap, HcalForward, HcalOther, HcalOuter, HcalTriggerTower, and subDetMap_.

18 {
19  detMap_[DetId::Ecal] = "Ecal";
20  subDetMap_[DetId::Ecal][EcalBarrel] = "EcalBarrel";
21  subDetMap_[DetId::Ecal][EcalEndcap] = "EcalEndcap";
22  subDetMap_[DetId::Ecal][EcalPreshower] = "EcalPreshower";
23  subDetMap_[DetId::Ecal][EcalTriggerTower] = "EcalTriggerTower";
24  subDetMap_[DetId::Ecal][EcalLaserPnDiode] = "EcalLaserPnDiode";
25 
26  detMap_[DetId::Hcal] = "Hcal";
27  subDetMap_[DetId::Hcal][HcalEmpty] = "HcalEmpty";
28  subDetMap_[DetId::Hcal][HcalBarrel] = "HcalBarrel";
29  subDetMap_[DetId::Hcal][HcalEndcap] = "HcalEndcap";
30  subDetMap_[DetId::Hcal][HcalOuter] = "HcalOuter";
31  subDetMap_[DetId::Hcal][HcalForward] = "HcalForward";
32  subDetMap_[DetId::Hcal][HcalTriggerTower] = "HcalTriggerTower";
33  subDetMap_[DetId::Hcal][HcalOther] = "HcalOther";
34 }
TMySubMap subDetMap_
Definition: DetNaming.h:26
TMyMainMap detMap_
Definition: DetNaming.h:25
DetNaming::~DetNaming ( )
inline

Definition at line 17 of file DetNaming.h.

17 {}

Member Function Documentation

std::vector< std::string > DetNaming::getAllKeys ( )

Definition at line 49 of file DetNaming.cc.

References detMap_, relativeConstraints::keys, mergeVDriftHistosByStation::name, AlCaHLTBitMon_QueryRunRegistry::string, and subDetMap_.

50 {
51  std::vector<std::string> keys;
52  keys.push_back("H__");
53  BOOST_FOREACH(TMyMainMap::value_type& entry, detMap_) {
54  BOOST_FOREACH(TMySubMap::mapped_type::value_type& subEntry, subDetMap_[entry.first]) {
55  std::string name = Form("H_%s_%s", entry.second.data(), subEntry.second.data());
56  keys.push_back(name);
57  }
58  }
59 
60  return keys;
61 }
TMySubMap subDetMap_
Definition: DetNaming.h:26
TMyMainMap detMap_
Definition: DetNaming.h:25
Container::value_type value_type
std::string DetNaming::getKey ( const DetId detId)

Definition at line 36 of file DetNaming.cc.

References DetId::det(), detMap_, Exception, DetId::rawId(), AlCaHLTBitMon_QueryRunRegistry::string, DetId::subdetId(), and subDetMap_.

Referenced by MuonCaloCleanerByDistance::fillEnergyDepositMap().

37 {
38  if ( detMap_.find(detId.det()) != detMap_.end() &&
39  subDetMap_.find(detId.det()) != subDetMap_.end() &&
40  subDetMap_[detId.det()].find(detId.subdetId()) != subDetMap_[detId.det()].end() ) {
41  return Form("H_%s_%s", detMap_[detId.det()].data(), subDetMap_[detId.det()][detId.subdetId()].data());
42  } else {
43  throw cms::Exception("DetNaming")
44  << "Invalid detId = " << detId.rawId() << " !!\n";
45  return std::string();
46  }
47 }
TMySubMap subDetMap_
Definition: DetNaming.h:26
TMyMainMap detMap_
Definition: DetNaming.h:25
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Detector det() const
get the detector field from this detid
Definition: DetId.h:35

Member Data Documentation

TMyMainMap DetNaming::detMap_
private

Definition at line 25 of file DetNaming.h.

Referenced by DetNaming(), getAllKeys(), and getKey().

TMySubMap DetNaming::subDetMap_
private

Definition at line 26 of file DetNaming.h.

Referenced by DetNaming(), getAllKeys(), and getKey().