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