Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
TauAnalysis
MCEmbeddingTools
src
DetNaming.cc
Go to the documentation of this file.
1
#include "
TauAnalysis/MCEmbeddingTools/interface/DetNaming.h
"
2
3
#include "
FWCore/Utilities/interface/Exception.h
"
4
5
#include "
DataFormats/DetId/interface/DetId.h
"
6
#include "
DataFormats/EcalDetId/interface/EcalSubdetector.h
"
7
#include "
DataFormats/HcalDetId/interface/HcalSubdetector.h
"
8
9
#include <boost/foreach.hpp>
10
11
#include <TString.h>
12
13
#include <vector>
14
#include <string>
15
#include <map>
16
17
DetNaming::DetNaming
()
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
}
35
36
std::string
DetNaming::getKey
(
const
DetId
& detId)
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
}
48
49
std::vector<std::string>
DetNaming::getAllKeys
()
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
}
62
63
64
HcalTriggerTower
Definition:
HcalAssistant.h:31
EcalSubdetector.h
DetId::Hcal
Definition:
DetId.h:24
HcalSubdetector.h
EcalTriggerTower
Definition:
EcalSubdetector.h:11
DetNaming::subDetMap_
TMySubMap subDetMap_
Definition:
DetNaming.h:26
DetNaming::detMap_
TMyMainMap detMap_
Definition:
DetNaming.h:25
mergeVDriftHistosByStation.name
string name
Definition:
mergeVDriftHistosByStation.py:77
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
DetId::rawId
uint32_t rawId() const
get the raw id
Definition:
DetId.h:43
EcalPreshower
Definition:
EcalSubdetector.h:11
DetId::Ecal
Definition:
DetId.h:24
HcalEndcap
Definition:
HcalAssistant.h:31
HcalBarrel
Definition:
HcalAssistant.h:31
HcalForward
Definition:
HcalAssistant.h:31
cond::ecalcond::value_type
Container::value_type value_type
Definition:
EcalChannelStatusPyWrapper.cc:33
DetId::subdetId
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
Definition:
DetId.h:37
DetId
Definition:
DetId.h:18
Exception.h
edm::hlt::Exception
error
Definition:
HLTenums.h:21
HcalOuter
Definition:
HcalAssistant.h:31
DetNaming::getAllKeys
std::vector< std::string > getAllKeys()
Definition:
DetNaming.cc:49
EcalLaserPnDiode
Definition:
EcalSubdetector.h:11
DetNaming.h
DetNaming::getKey
std::string getKey(const DetId &)
Definition:
DetNaming.cc:36
EcalBarrel
Definition:
EcalSubdetector.h:11
DetNaming::DetNaming
DetNaming()
Definition:
DetNaming.cc:17
EcalEndcap
Definition:
EcalSubdetector.h:11
DetId::det
Detector det() const
get the detector field from this detid
Definition:
DetId.h:35
relativeConstraints.keys
tuple keys
Definition:
relativeConstraints.py:88
HcalOther
Definition:
HcalAssistant.h:31
DetId.h
HcalEmpty
Definition:
HcalAssistant.h:31
Generated for CMSSW Reference Manual by
1.8.5