FastSimulation
CalorimeterProperties
src
HCALProperties.cc
Go to the documentation of this file.
1
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
2
3
//This class header
4
#include "
FastSimulation/CalorimeterProperties/interface/HCALProperties.h
"
5
#include <cmath>
6
#include <iostream>
7
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
8
9
HCALProperties::HCALProperties
(
const
edm::ParameterSet
& fastDet) :
CalorimeterProperties
() {
10
edm::ParameterSet
fastDetHCAL = fastDet.
getParameter
<
edm::ParameterSet
>(
"HadronicCalorimeterProperties"
);
11
hOPi
= fastDetHCAL.
getParameter
<
double
>(
"HCAL_PiOverE"
);
12
spotFrac
= fastDetHCAL.
getParameter
<
double
>(
"HCAL_Sampling"
);
13
HCALAeff_
= fastDetHCAL.
getParameter
<
double
>(
"HCALAeff"
);
14
HCALZeff_
= fastDetHCAL.
getParameter
<
double
>(
"HCALZeff"
);
15
HCALrho_
= fastDetHCAL.
getParameter
<
double
>(
"HCALrho"
);
16
HCALradiationLengthIncm_
= fastDetHCAL.
getParameter
<
double
>(
"HCALradiationLengthIncm"
);
17
HCALradLenIngcm2_
= fastDetHCAL.
getParameter
<
double
>(
"HCALradLenIngcm2"
);
18
HCALmoliereRadius_
= fastDetHCAL.
getParameter
<
double
>(
"HCALmoliereRadius"
);
19
HCALcriticalEnergy_
= fastDetHCAL.
getParameter
<
double
>(
"HCALcriticalEnergy"
);
20
HCALinteractionLength_
= fastDetHCAL.
getParameter
<
double
>(
"HCALinteractionLength"
);
21
etatow_
= fastDetHCAL.
getParameter
<std::vector<double>>(
"HCALetatow"
);
22
hcalDepthLam_
= fastDetHCAL.
getParameter
<std::vector<double>>(
"HCALDepthLam"
);
23
24
// in principle this splitting into 42 bins may change with future detectors, but let's add a protection to make sure that differences are not typos in the configuration file:
25
if
(
etatow_
.size() != 42)
26
std::cout
<<
" HCALProperties::eta2ieta - WARNING: here we expect 42 entries instead of "
<<
etatow_
.size()
27
<<
"; is the change intentional?"
<< std::endl;
28
// splitting of 28-th tower is taken into account (2.65-2.853-3.0)
29
if
(
hcalDepthLam_
.size() !=
etatow_
.size() - 1)
30
std::cout
<<
" HCALProperties::eta2ieta - WARNING: the sizes of HCALetatow and HCALDepthLam should differ by 1 "
31
"unit! HCALDepthLam has size "
32
<<
hcalDepthLam_
.size() <<
" and HCALetatow has size "
<<
etatow_
.size() << std::endl;
33
}
34
35
double
HCALProperties::getHcalDepth
(
double
eta
)
const
{
36
int
ieta
=
eta2ieta
(
eta
);
37
38
/*
39
std::cout << " HCALProperties::getHcalDepth for eta = " << eta
40
<< " returns lam.thickness = " << hcalDepthLam_[ieta] << std::endl;
41
*/
42
43
return
hcalDepthLam_
[
ieta
];
44
}
45
46
int
HCALProperties::eta2ieta
(
double
eta
)
const
{
47
// binary search in the array of towers eta edges
48
int
size
=
etatow_
.size();
49
50
double
x
= fabs(
eta
);
51
int
curr =
size
/ 2;
52
int
step
=
size
/ 4;
53
int
iter;
54
int
prevdir = 0;
55
int
actudir = 0;
56
57
for
(iter = 0; iter <
size
; iter++) {
58
if
(curr >=
size
|| curr < 1)
59
std::cout
<<
" HCALProperties::eta2ieta - wrong current index = "
<< curr <<
" !!!"
<< std::endl;
60
61
if
((
x
<=
etatow_
[curr]) && (
x
>
etatow_
[curr - 1]))
62
break
;
63
prevdir = actudir;
64
if
(
x
>
etatow_
[curr]) {
65
actudir = 1;
66
}
else
{
67
actudir = -1;
68
}
69
if
(prevdir * actudir < 0) {
70
if
(
step
> 1)
71
step
/= 2;
72
}
73
curr += actudir *
step
;
74
if
(curr >
size
)
75
curr =
size
;
76
else
{
77
if
(curr < 1) {
78
curr = 1;
79
}
80
}
81
82
/*
83
std::cout << " HCALProperties::eta2ieta end of iter." << iter
84
<< " curr, etatow_[curr-1], etatow_[curr] = "
85
<< curr << " " << etatow_[curr-1] << " " << etatow_[curr] << std::endl;
86
*/
87
}
88
89
/*
90
std::cout << " HCALProperties::eta2ieta for input x = " << x
91
<< " found index = " << curr-1
92
<< std::endl;
93
*/
94
95
return
curr - 1;
96
}
MessageLogger.h
step
step
Definition:
StallMonitor.cc:94
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
HCALProperties::getHcalDepth
double getHcalDepth(double) const
Definition:
HCALProperties.cc:35
DDAxes::x
HCALProperties::HCALZeff_
double HCALZeff_
Definition:
HCALProperties.h:75
PVValHelper::eta
Definition:
PVValidationHelpers.h:69
HCALProperties::HCALmoliereRadius_
double HCALmoliereRadius_
Definition:
HCALProperties.h:79
LEDCalibrationChannels.ieta
ieta
Definition:
LEDCalibrationChannels.py:63
edm::ParameterSet
Definition:
ParameterSet.h:36
CalorimeterProperties
Definition:
CalorimeterProperties.h:11
HCALProperties::HCALcriticalEnergy_
double HCALcriticalEnergy_
Definition:
HCALProperties.h:80
HCALProperties::etatow_
std::vector< double > etatow_
Definition:
HCALProperties.h:82
HCALProperties::HCALradiationLengthIncm_
double HCALradiationLengthIncm_
Definition:
HCALProperties.h:77
HCALProperties.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
HCALProperties::HCALradLenIngcm2_
double HCALradLenIngcm2_
Definition:
HCALProperties.h:78
HCALProperties::spotFrac
double spotFrac
Definition:
HCALProperties.h:71
HCALProperties::HCALinteractionLength_
double HCALinteractionLength_
Definition:
HCALProperties.h:81
ParameterSet.h
HCALProperties::hcalDepthLam_
std::vector< double > hcalDepthLam_
Definition:
HCALProperties.h:83
HCALProperties::eta2ieta
int eta2ieta(double eta) const
Definition:
HCALProperties.cc:46
HCALProperties::hOPi
double hOPi
Definition:
HCALProperties.h:70
HCALProperties::HCALAeff_
double HCALAeff_
Definition:
HCALProperties.h:74
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
HCALProperties::HCALrho_
double HCALrho_
Definition:
HCALProperties.h:76
HCALProperties::HCALProperties
HCALProperties(const edm::ParameterSet &fastDet)
Definition:
HCALProperties.cc:9
Generated for CMSSW Reference Manual by
1.8.16