SimRomanPot
SimFP420
src
ZeroSuppressFP420.cc
Go to the documentation of this file.
1
// File: ZeroSuppressFP420.cc
3
// Date: 12.2006
4
// Description: ZeroSuppressFP420 for FP420
5
// Modifications:
7
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
8
#include "
SimRomanPot/SimFP420/interface/ZeroSuppressFP420.h
"
9
10
ZeroSuppressFP420::ZeroSuppressFP420
(
const
edm::ParameterSet
&conf,
float
noise
) : conf_(conf), theNumFEDalgos(4) {
11
noiseInAdc
=
noise
;
12
initParams
(
conf_
);
13
verbosity
=
conf_
.
getUntrackedParameter
<
int
>(
"VerbosityLevel"
);
14
// initParams();
15
if
(
verbosity
> 0) {
16
std::cout
<<
"ZeroSuppressFP420: constructor: noiseInAdc= "
<<
noiseInAdc
<< std::endl;
17
}
18
}
19
20
/*
21
* The zero suppression algorithm, implemented in the trkFEDclusterizer method.
22
* The class publically inherits from the ZSuppressFP420 class, which requires
23
* the use of a method named zeroSuppress.
24
*/
25
26
void
ZeroSuppressFP420::initParams
(
edm::ParameterSet
const
&conf_) {
27
verbosity
=
conf_
.
getUntrackedParameter
<
int
>(
"VerbosityLevel"
);
28
algoConf
=
conf_
.
getParameter
<
int
>(
"FedFP420Algorithm"
);
// FedFP420Algorithm: =1 (,2,3,4)
29
lowthreshConf
=
conf_
.
getParameter
<
double
>(
"FedFP420LowThreshold"
);
// FedFP420LowThreshold =3.
30
highthreshConf
=
conf_
.
getParameter
<
double
>(
"FedFP420HighThreshold"
);
// FedFP420HighThreshold =4.
31
32
/*
33
* There are four possible algorithms, the default of which (4)
34
* has different thresholds for isolated channels and ones in clusters.
35
* It also merges clusters (single or multi channels) that are only separated
36
* by one hole. This channel is selected as signal even though it is below
37
* both thresholds.
38
*/
39
40
theFEDalgorithm
=
algoConf
;
41
theFEDlowThresh
=
lowthreshConf
*
noiseInAdc
;
42
theFEDhighThresh
=
highthreshConf
*
noiseInAdc
;
43
44
if
(
verbosity
> 0) {
45
std::cout
<<
"ZeroSuppressFP420: initParams: !!! theFEDalgorithm= "
<<
theFEDalgorithm
<< std::endl;
46
std::cout
<<
" lowthreshConf= "
<<
lowthreshConf
<<
" highthreshConf= "
<<
highthreshConf
47
<<
" theFEDlowThresh= "
<<
theFEDlowThresh
<<
" theFEDhighThresh= "
<<
theFEDhighThresh
<< std::endl;
48
}
49
50
// Check zero suppress algorithm
51
if
(theFEDalgorithm < 1 || theFEDalgorithm >
theNumFEDalgos
) {
52
edm::LogError
(
"FP420DigiInfo"
) <<
"ZeroSuppressFP420 FATAL ERROR: Unknown zero suppress algorithm "
53
<<
theFEDalgorithm
;
54
exit
(1);
55
}
56
57
// Check thresholds
58
if
(
theFEDlowThresh
>
theFEDhighThresh
) {
59
edm::LogError
(
"FP420DigiInfo"
) <<
"ZeroSuppressFP420 FATAL ERROR: Low threshold exceeds high "
60
"threshold: "
61
<<
theFEDlowThresh
<<
" > "
<<
theFEDhighThresh
;
62
exit
(2);
63
}
64
}
65
66
ZSuppressFP420::DigitalMapType
ZeroSuppressFP420::zeroSuppress
(
const
DigitalMapType
¬ZeroSuppressedMap,
int
vrb) {
67
return
trkFEDclusterizer
(notZeroSuppressedMap, vrb);
68
if
(vrb > 0) {
69
std::cout
<<
"zeroSuppress: return trkFEDclusterizer(notZeroSuppressedMap)"
<< std::endl;
70
}
71
}
72
73
// This performs the zero suppression
74
ZSuppressFP420::DigitalMapType
ZeroSuppressFP420::trkFEDclusterizer
(
const
DigitalMapType
&
in
,
int
vrb) {
75
const
std::string
s2
(
"ZeroSuppressFP420::trkFEDclusterizer1"
);
76
77
DigitalMapType
selectedSignal;
78
DigitalMapType::const_iterator
i
, iPrev, iNext, iPrev2, iNext2;
79
80
if
(vrb > 0) {
81
std::cout
<<
"Before For loop"
<< std::endl;
82
}
83
84
for
(
i
=
in
.begin();
i
!=
in
.end();
i
++) {
85
// Find adc values for neighbouring strips
86
int
strip
=
i
->first;
87
int
adc
=
i
->second;
88
iPrev =
in
.find(
strip
- 1);
89
iNext =
in
.find(
strip
+ 1);
90
if
(vrb > 0) {
91
std::cout
<<
"Inside For loop trkFEDclusterizer: strip= "
<<
strip
<<
" adc= "
<<
adc
<< std::endl;
92
}
93
// Set values for channels just outside module to infinity.
94
// This is to avoid losing channels at the edges,
95
// which otherwise would pass cuts if strips were next to each other.
96
int
adcPrev = -99999;
97
int
adcNext = -99999;
98
if
(((
strip
) % 128) == 127)
99
adcNext = 99999;
100
if
(((
strip
) % 128) == 0)
101
adcPrev = 99999;
102
// Otherwise if channel was found then find it's ADC count.
103
if
(iPrev !=
in
.end())
104
adcPrev = iPrev->second;
105
if
(iNext !=
in
.end())
106
adcNext = iNext->second;
107
int
adcMaxNeigh =
std::max
(adcPrev, adcNext);
108
if
(vrb > 0) {
109
std::cout
<<
"adcPrev= "
<< adcPrev <<
" adcNext= "
<< adcNext <<
" adcMaxNeigh= "
<< adcMaxNeigh << std::endl;
110
}
111
112
// Find adc values for next neighbouring channes
113
iPrev2 =
in
.find(
strip
- 2);
114
iNext2 =
in
.find(
strip
+ 2);
115
// See above
116
int
adcPrev2 = -99999;
117
int
adcNext2 = -99999;
118
if
(((
strip
) % 128) == 126)
119
adcNext2 = 99999;
120
if
(((
strip
) % 128) == 1)
121
adcPrev2 = 99999;
122
if
(iPrev2 !=
in
.end())
123
adcPrev2 = iPrev2->second;
124
if
(iNext2 !=
in
.end())
125
adcNext2 = iNext2->second;
126
127
if
(vrb > 0) {
128
std::cout
<<
"adcPrev2= "
<< adcPrev2 <<
" adcNext2= "
<< adcNext2 << std::endl;
129
std::cout
<<
"To be accepted or not? adc= "
<<
adc
<<
" >= theFEDlowThresh="
<<
theFEDlowThresh
<< std::endl;
130
}
131
// Decide if this channel should be accepted.
132
bool
accept
=
false
;
133
switch
(
theFEDalgorithm
) {
134
case
1:
135
accept
= (
adc
>=
theFEDlowThresh
);
136
break
;
137
138
case
2:
139
accept
= (
adc
>=
theFEDhighThresh
|| (
adc
>=
theFEDlowThresh
&& adcMaxNeigh >=
theFEDlowThresh
));
140
break
;
141
142
case
3:
143
accept
= (
adc
>=
theFEDhighThresh
|| (
adc
>=
theFEDlowThresh
&& adcMaxNeigh >=
theFEDhighThresh
));
144
break
;
145
146
case
4:
147
accept
= ((
adc
>=
theFEDhighThresh
) ||
// Test for adc>highThresh (same as
148
// algorithm 2)
149
((
adc
>=
theFEDlowThresh
) &&
// Test for adc>lowThresh, with neighbour
150
// adc>lowThresh (same as algorithm 2)
151
(adcMaxNeigh >=
theFEDlowThresh
)) ||
152
((
adc
<
theFEDlowThresh
) &&
// Test for adc<lowThresh
153
(((adcPrev >=
theFEDhighThresh
) &&
// with both neighbours>highThresh
154
(adcNext >=
theFEDhighThresh
)) ||
155
((adcPrev >=
theFEDhighThresh
) &&
// OR with previous neighbour>highThresh and
156
(adcNext >=
theFEDlowThresh
) &&
// both the next neighbours>lowThresh
157
(adcNext2 >=
theFEDlowThresh
)) ||
158
((adcNext >=
theFEDhighThresh
) &&
// OR with next neighbour>highThresh and
159
(adcPrev >=
theFEDlowThresh
) &&
// both the previous neighbours>lowThresh
160
(adcPrev2 >=
theFEDlowThresh
)) ||
161
((adcNext >=
theFEDlowThresh
) &&
// OR with both next neighbours>lowThresh and
162
(adcNext2 >=
theFEDlowThresh
) &&
// both the previous neighbours>lowThresh
163
(adcPrev >=
theFEDlowThresh
) && (adcPrev2 >=
theFEDlowThresh
)))));
164
break
;
165
}
166
167
/*
168
* When a channel satisfying only the lower threshold is at the edge of an
169
* APV or module, the trkFEDclusterizer method assumes that every channel
170
* just outside an APV or module has a hit on it. This is to avoid channel
171
* inefficiencies at the edges of APVs and modules.
172
*/
173
if
(
accept
) {
174
selectedSignal[
strip
] =
adc
;
175
176
if
(vrb > 0) {
177
std::cout
<<
"selected strips = "
<<
strip
<<
" adc= "
<<
adc
<< std::endl;
178
}
179
}
180
}
181
182
if
(vrb > 0) {
183
std::cout
<<
"last line of trkFEDclusterizer: return selectedSignal"
<< std::endl;
184
}
185
return
selectedSignal;
186
}
mps_fire.i
i
Definition:
mps_fire.py:428
MessageLogger.h
ZeroSuppressFP420::theNumFEDalgos
short theNumFEDalgos
Definition:
ZeroSuppressFP420.h:26
ZeroSuppressFP420::highthreshConf
double highthreshConf
Definition:
ZeroSuppressFP420.h:30
gpuClustering::adc
uint16_t *__restrict__ uint16_t const *__restrict__ adc
Definition:
gpuClusterChargeCut.h:20
ZeroSuppressFP420::theFEDalgorithm
short theFEDalgorithm
Definition:
ZeroSuppressFP420.h:22
digitizers_cfi.strip
strip
Definition:
digitizers_cfi.py:19
ZSuppressFP420::DigitalMapType
DConverterFP420::DigitalMapType DigitalMapType
Definition:
ZSuppressFP420.h:8
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
if
if(0==first)
Definition:
CAHitNtupletGeneratorKernelsImpl.h:48
ZeroSuppressFP420::zeroSuppress
ZSuppressFP420::DigitalMapType zeroSuppress(const DigitalMapType &, int) override
Definition:
ZeroSuppressFP420.cc:66
ZeroSuppressFP420::conf_
edm::ParameterSet conf_
Definition:
ZeroSuppressFP420.h:25
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
indexGen.s2
s2
Definition:
indexGen.py:107
accept
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition:
TopDQMHelpers.h:31
ZeroSuppressFP420::ZeroSuppressFP420
ZeroSuppressFP420(const edm::ParameterSet &conf, float noise)
Definition:
ZeroSuppressFP420.cc:10
ZeroSuppressFP420::trkFEDclusterizer
ZSuppressFP420::DigitalMapType trkFEDclusterizer(const DigitalMapType &, int)
Definition:
ZeroSuppressFP420.cc:74
ZeroSuppressFP420::algoConf
int algoConf
Definition:
ZeroSuppressFP420.h:28
ZeroSuppressFP420::noiseInAdc
float noiseInAdc
Definition:
ZeroSuppressFP420.h:21
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition:
ParameterSet.h:47
SiStripPI::max
Definition:
SiStripPayloadInspectorHelper.h:169
recoMuon::in
Definition:
RecoMuonEnumerators.h:6
ZeroSuppressFP420::theFEDlowThresh
float theFEDlowThresh
Definition:
ZeroSuppressFP420.h:23
ZeroSuppressFP420::theFEDhighThresh
float theFEDhighThresh
Definition:
ZeroSuppressFP420.h:24
edm::LogError
Log< level::Error, false > LogError
Definition:
MessageLogger.h:123
gpuVertexFinder::noise
__shared__ int noise
Definition:
gpuFitVertices.h:50
ZeroSuppressFP420.h
ZeroSuppressFP420::lowthreshConf
double lowthreshConf
Definition:
ZeroSuppressFP420.h:29
ZeroSuppressFP420::verbosity
int verbosity
Definition:
ZeroSuppressFP420.h:28
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
beamvalidation.exit
def exit(msg="")
Definition:
beamvalidation.py:53
ZeroSuppressFP420::initParams
void initParams(const edm::ParameterSet &conf_)
Definition:
ZeroSuppressFP420.cc:26
Generated for CMSSW Reference Manual by
1.8.16