src
SimCalorimetry
HcalSimAlgos
src
HcalShapes.cc
Go to the documentation of this file.
1
#include "
SimCalorimetry/HcalSimAlgos/interface/HcalShapes.h
"
2
#include "
SimCalorimetry/CaloSimAlgos/interface/CaloCachedShapeIntegrator.h
"
3
#include "
CondFormats/HcalObjects/interface/HcalMCParam.h
"
4
#include "
CondFormats/HcalObjects/interface/HcalMCParams.h
"
5
#include "
CondFormats/DataRecord/interface/HcalMCParamsRcd.h
"
6
#include "
DataFormats/HcalDetId/interface/HcalGenericDetId.h
"
7
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
8
#include "
Geometry/CaloTopology/interface/HcalTopology.h
"
9
10
HcalShapes::HcalShapes
() : theDbService(nullptr) {
11
/*
12
00 - not used (reserved)
13
101 - regular HPD HB/HE/HO shape
14
102 - "special" HB HPD#14 long shape
15
201 - SiPMs Zecotec shape (HO)
16
202 - SiPMs Hamamatsu shape (HO)
17
203 - SiPMs Hamamatsu shape (HE 2017)
18
205 - SiPMs from Data (HE data 2017)
19
206 - SiPMs Hamamatsu shape (HE 2018)
20
207 - SiPMs from Data (HE 2017)
21
208 - SiPMs from Data, 2021 MC phase scan
22
301 - regular HF PMT shape
23
401 - regular ZDC shape
24
*/
25
26
std::vector<int> theHcalShapeNums = {101, 102, 103, 104, 105, 123, 124, 125, 201, 202, 203, 205, 206, 207, 208, 301};
27
// use resize so vector won't invalidate pointers by reallocating memory while filling
28
theHcalShapes
.resize(theHcalShapeNums.size());
29
for
(
unsigned
inum = 0; inum < theHcalShapeNums.size(); ++inum) {
30
int
num
= theHcalShapeNums[inum];
31
theHcalShapes
[inum].setShape(
num
);
32
theShapesPrecise
[
num
] = &
theHcalShapes
[inum];
33
theShapes
[
num
] =
new
CaloCachedShapeIntegrator
(&
theHcalShapes
[inum]);
34
}
35
36
// ZDC not yet defined in CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc
37
theShapesPrecise
[
ZDC
] = &
theZDCShape
;
38
theShapes
[
ZDC
] =
new
CaloCachedShapeIntegrator
(&
theZDCShape
);
39
}
40
41
HcalShapes::~HcalShapes
() {
42
for
(
auto
& shapeItr :
theShapes
) {
43
delete
shapeItr.second;
44
}
45
theShapes
.clear();
46
}
47
48
const
CaloVShape
*
HcalShapes::shape
(
const
DetId
& detId,
bool
precise
)
const
{
49
if
(!
theDbService
) {
50
return
defaultShape
(detId);
51
}
52
int
shapeType =
theDbService
->
getHcalMCParam
(detId)->
signalShape
();
53
const
auto
& myShapes =
getShapeMap
(
precise
);
54
auto
shapeMapItr = myShapes.find(shapeType);
55
if
(shapeMapItr == myShapes.end()) {
56
edm::LogWarning
(
"HcalShapes"
) <<
"HcalShapes::shape - shapeType ? = "
<< shapeType << std::endl;
57
return
defaultShape
(detId,
precise
);
58
}
else
{
59
return
shapeMapItr->second;
60
}
61
}
62
63
const
CaloVShape
*
HcalShapes::defaultShape
(
const
DetId
& detId,
bool
precise
)
const
{
64
// try to figure the appropriate shape
65
const
CaloVShape
*
result
;
66
const
auto
& myShapes =
getShapeMap
(
precise
);
67
HcalGenericDetId::HcalGenericSubdetector
subdet =
HcalGenericDetId
(detId).
genericSubdet
();
68
if
(subdet ==
HcalGenericDetId::HcalGenBarrel
|| subdet ==
HcalGenericDetId::HcalGenEndcap
)
69
result
= myShapes.find(
HPD
)->second;
70
else
if
(subdet ==
HcalGenericDetId::HcalGenOuter
)
71
result
= myShapes.find(
HPD
)->second;
72
else
if
(subdet ==
HcalGenericDetId::HcalGenForward
)
73
result
= myShapes.find(
HF
)->second;
74
else
if
(subdet ==
HcalGenericDetId::HcalGenZDC
)
75
result
= myShapes.find(
ZDC
)->second;
76
else
77
result
=
nullptr
;
78
79
edm::LogWarning
(
"HcalShapes"
) <<
"Cannot find HCAL MC Params, so the default one is taken for subdet "
<< subdet;
80
81
return
result
;
82
}
83
84
const
HcalShapes::ShapeMap
&
HcalShapes::getShapeMap
(
bool
precise
)
const
{
85
return
precise
?
theShapesPrecise
:
theShapes
;
86
}
HcalShapes::HcalShapes
HcalShapes()
Definition:
HcalShapes.cc:10
HcalShapes::HPD
Definition:
HcalShapes.h:20
HcalShapes::ZDC
Definition:
HcalShapes.h:20
CaloCachedShapeIntegrator.h
MessageLogger.h
mps_fire.result
result
Definition:
mps_fire.py:311
HcalShapes::ShapeMap
std::map< int, const CaloVShape * > ShapeMap
Definition:
HcalShapes.h:29
hltPixelTracks_cff.precise
precise
Definition:
hltPixelTracks_cff.py:32
HcalShapes::defaultShape
const CaloVShape * defaultShape(const DetId &detId, bool precise=false) const
Definition:
HcalShapes.cc:63
HcalGenericDetId::HcalGenOuter
Definition:
HcalGenericDetId.h:21
HcalGenericDetId::HcalGenForward
Definition:
HcalGenericDetId.h:22
CaloVShape
Electronic response of the preamp.
Definition:
CaloVShape.h:11
HcalGenericDetId::HcalGenBarrel
Definition:
HcalGenericDetId.h:19
HcalGenericDetId::HcalGenEndcap
Definition:
HcalGenericDetId.h:20
HcalGenericDetId.h
HcalDbService::getHcalMCParam
const HcalMCParam * getHcalMCParam(const HcalGenericDetId &fId) const
Definition:
HcalDbService.cc:399
HcalShapes::getShapeMap
const ShapeMap & getShapeMap(bool precise) const
Definition:
HcalShapes.cc:84
HcalShapes::HF
Definition:
HcalShapes.h:20
HcalMCParamsRcd.h
HcalShapes::~HcalShapes
~HcalShapes() override
Definition:
HcalShapes.cc:41
CaloCachedShapeIntegrator
Definition:
CaloCachedShapeIntegrator.h:12
HcalMCParam::signalShape
unsigned int signalShape() const
Definition:
HcalMCParam.h:38
HcalGenericDetId
Definition:
HcalGenericDetId.h:15
HcalGenericDetId::genericSubdet
HcalGenericSubdetector genericSubdet() const
Definition:
HcalGenericDetId.cc:21
HcalShapes.h
EgammaValidation_cff.num
num
Definition:
EgammaValidation_cff.py:33
DetId
Definition:
DetId.h:17
HcalShapes::shape
const CaloVShape * shape(const DetId &detId, bool precise=false) const override
Definition:
HcalShapes.cc:48
HcalShapes::theZDCShape
ZDCShape theZDCShape
Definition:
HcalShapes.h:36
HcalGenericDetId::HcalGenericSubdetector
HcalGenericSubdetector
Definition:
HcalGenericDetId.h:17
HcalGenericDetId::HcalGenZDC
Definition:
HcalGenericDetId.h:24
HcalShapes::theDbService
const HcalDbService * theDbService
Definition:
HcalShapes.h:33
HcalMCParams.h
HcalShapes::theHcalShapes
std::vector< HcalShape > theHcalShapes
Definition:
HcalShapes.h:38
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition:
MessageLogger.h:122
HcalMCParam.h
HcalShapes::theShapes
ShapeMap theShapes
Definition:
HcalShapes.h:34
HcalTopology.h
HcalShapes::theShapesPrecise
ShapeMap theShapesPrecise
Definition:
HcalShapes.h:35
Generated for CMSSW Reference Manual by
1.8.14