13 if (noiseWatcher_.check(es)) {
16 if (thresholdWatcher_.check(es)) {
17 threshold_ = &es.
getData(thresholdToken_);
22 std::vector<SiStripDigi>& selectedSignal,
28 std::vector<SiStripDigi>& selectedSignal,
33 int inSize =
in.size();
38 selectedSignal.clear();
39 selectedSignal.reserve(inSize);
40 for (
i = 0;
i < inSize;
i++) {
47 theFEDlowThresh =
static_cast<int16_t
>(
thresholds.getLth() *
noise.getNoiseFast(
strip, detNoiseRange) + 0.5);
48 theFEDhighThresh =
static_cast<int16_t
>(
thresholds.getHth() *
noise.getNoiseFast(
strip, detNoiseRange) + 0.5);
61 theNextFEDlowThresh = theFEDlowThresh;
62 theNext2FEDlowThresh = theFEDlowThresh;
63 thePrevFEDlowThresh = theFEDlowThresh;
64 thePrev2FEDlowThresh = theFEDlowThresh;
65 theNeighFEDlowThresh = theFEDlowThresh;
67 theNextFEDhighThresh = theFEDhighThresh;
68 thePrevFEDhighThresh = theFEDhighThresh;
69 theNeighFEDhighThresh = theFEDhighThresh;
71 if (((
strip) % 128) == 127) {
73 theNextFEDlowThresh = 9999;
74 theNextFEDhighThresh = 9999;
76 adcNext =
in[
i + 1].adc();
79 static_cast<int16_t
>(thresholds_1.
getLth() *
noise.getNoiseFast(
strip + 1, detNoiseRange) + 0.5);
80 theNextFEDhighThresh =
81 static_cast<int16_t
>(thresholds_1.
getHth() *
noise.getNoiseFast(
strip + 1, detNoiseRange) + 0.5);
82 if (((
strip) % 128) == 126) {
84 theNext2FEDlowThresh = 9999;
86 adcNext2 =
in[
i + 2].adc();
87 theNext2FEDlowThresh =
static_cast<int16_t
>(
92 if (((
strip) % 128) == 0) {
94 thePrevFEDlowThresh = 9999;
95 thePrevFEDhighThresh = 9999;
97 adcPrev =
in[
i - 1].adc();
100 static_cast<int16_t
>(thresholds_1.
getLth() *
noise.getNoiseFast(
strip - 1, detNoiseRange) + 0.5);
101 thePrevFEDhighThresh =
102 static_cast<int16_t
>(thresholds_1.
getHth() *
noise.getNoiseFast(
strip - 1, detNoiseRange) + 0.5);
103 if (((
strip) % 128) == 1) {
105 thePrev2FEDlowThresh = 9999;
107 adcPrev2 =
in[
i - 2].adc();
108 thePrev2FEDlowThresh =
static_cast<int16_t
>(
113 if (adcNext <= adcPrev) {
114 adcMaxNeigh = adcPrev;
115 theNeighFEDlowThresh = thePrevFEDlowThresh;
116 theNeighFEDhighThresh = thePrevFEDhighThresh;
118 adcMaxNeigh = adcNext;
119 theNeighFEDlowThresh = theNextFEDlowThresh;
120 theNeighFEDhighThresh = theNextFEDhighThresh;
123 if (isAValidDigi()) {
130 const uint32_t detID =
out.id;
133 #ifdef DEBUG_SiStripZeroSuppression_ 136 <<
"[SiStripFedZeroSuppression::suppress] Zero suppression on edm::DetSet<SiStripRawDigi>: detID " << detID
137 <<
" size = " <<
in.data.size();
140 for (; in_iter !=
in.data.end(); in_iter++) {
141 const uint32_t
strip = (uint32_t)(in_iter -
in.data.begin());
143 #ifdef DEBUG_SiStripZeroSuppression_ 145 LogTrace(
"SiStripZeroSuppression") <<
"[SiStripFedZeroSuppression::suppress] detID= " << detID
146 <<
" strip= " <<
strip <<
" adc= " << in_iter->adc();
148 adc = in_iter->adc();
151 theFEDlowThresh =
static_cast<int16_t
>(
thresholds.getLth() *
noise_->getNoiseFast(
strip, detNoiseRange) + 0.5);
152 theFEDhighThresh =
static_cast<int16_t
>(
thresholds.getHth() *
noise_->getNoiseFast(
strip, detNoiseRange) + 0.5);
162 if (
strip % 128 == 127) {
164 theNextFEDlowThresh = 9999;
165 theNextFEDhighThresh = 9999;
167 adcNext = (in_iter + 1)->
adc();
169 theNextFEDlowThresh =
170 static_cast<int16_t
>(thresholds_1.
getLth() *
noise_->getNoiseFast(
strip + 1, detNoiseRange) + 0.5);
171 theNextFEDhighThresh =
172 static_cast<int16_t
>(thresholds_1.
getHth() *
noise_->getNoiseFast(
strip + 1, detNoiseRange) + 0.5);
178 if (
strip % 128 == 0) {
180 thePrevFEDlowThresh = 9999;
181 thePrevFEDhighThresh = 9999;
183 adcPrev = (in_iter - 1)->
adc();
185 thePrevFEDlowThresh =
186 static_cast<int16_t
>(thresholds_1.
getLth() *
noise_->getNoiseFast(
strip - 1, detNoiseRange) + 0.5);
187 thePrevFEDhighThresh =
188 static_cast<int16_t
>(thresholds_1.
getHth() *
noise_->getNoiseFast(
strip - 1, detNoiseRange) + 0.5);
190 if (adcNext < adcPrev) {
191 adcMaxNeigh = adcPrev;
192 theNeighFEDlowThresh = thePrevFEDlowThresh;
193 theNeighFEDhighThresh = thePrevFEDhighThresh;
195 adcMaxNeigh = adcNext;
196 theNeighFEDlowThresh = theNextFEDlowThresh;
197 theNeighFEDhighThresh = theNextFEDhighThresh;
203 thePrev2FEDlowThresh = 1;
204 theNext2FEDlowThresh = 1;
205 if (
strip % 128 >= 126) {
207 theNext2FEDlowThresh = 9999;
208 }
else if (
strip % 128 < 126) {
209 adcNext2 = (in_iter + 2)->
adc();
210 theNext2FEDlowThresh =
static_cast<int16_t
>(
211 threshold_->getData(
strip + 2, detThRange).getLth() *
noise_->getNoiseFast(
strip + 2, detNoiseRange) + 0.5);
213 if (
strip % 128 <= 1) {
215 thePrev2FEDlowThresh = 9999;
216 }
else if (
strip % 128 > 1) {
217 adcPrev2 = (in_iter - 2)->
adc();
218 thePrev2FEDlowThresh =
static_cast<int16_t
>(
219 threshold_->getData(
strip - 2, detThRange).getLth() *
noise_->getNoiseFast(
strip - 2, detNoiseRange) + 0.5);
231 if (highThr_.size() !=
size) {
232 highThr_.resize(
size);
233 lowThr_.resize(
size);
234 noises_.resize(
size);
235 highThrSN_.resize(
size);
236 lowThrSN_.resize(
size);
239 noise_->allNoises(noises_, detNoiseRange);
240 threshold_->allThresholds(lowThrSN_, highThrSN_, detThRange);
245 highThr_[
strip] =
static_cast<int16_t
>(highThrSN_[
strip] *
noise + 0.5 + 1
e-6);
246 lowThr_[
strip] =
static_cast<int16_t
>(lowThrSN_[
strip] *
noise + 0.5 + 1
e-6);
257 const uint32_t detID =
out.id;
259 #ifdef DEBUG_SiStripZeroSuppression_ 262 <<
"[SiStripFedZeroSuppression::suppress] Zero suppression on std::vector<int16_t>: detID " << detID
263 <<
" size = " <<
in.size();
266 fillThresholds_(detID,
size + firstAPV * 128);
268 std::vector<int16_t>::const_iterator in_iter =
in.begin();
269 uint16_t
strip = firstAPV * 128;
271 size_t strip_mod_128 =
strip & 127;
272 #ifdef DEBUG_SiStripZeroSuppression_ 274 LogTrace(
"SiStripZeroSuppression") <<
"[SiStripFedZeroSuppression::suppress] detID= " << detID
275 <<
" strip= " <<
strip <<
" adc= " << *in_iter;
279 theFEDlowThresh = lowThr_[
strip];
280 theFEDhighThresh = highThr_[
strip];
293 if (strip_mod_128 == 127) {
295 theNextFEDlowThresh = 9999;
296 theNextFEDhighThresh = 9999;
298 adcNext = *(in_iter + 1);
299 theNextFEDlowThresh = lowThr_[
strip + 1];
300 theNextFEDhighThresh = highThr_[
strip + 1];
307 if (strip_mod_128 == 0) {
309 thePrevFEDlowThresh = 9999;
310 thePrevFEDhighThresh = 9999;
312 adcPrev = *(in_iter - 1);
313 thePrevFEDlowThresh = lowThr_[
strip - 1];
314 thePrevFEDhighThresh = highThr_[
strip - 1];
317 if (adcNext < adcPrev) {
318 adcMaxNeigh = adcPrev;
319 theNeighFEDlowThresh = thePrevFEDlowThresh;
320 theNeighFEDhighThresh = thePrevFEDhighThresh;
322 adcMaxNeigh = adcNext;
323 theNeighFEDlowThresh = theNextFEDlowThresh;
324 theNeighFEDhighThresh = theNextFEDhighThresh;
332 if (strip_mod_128 >= 126) {
334 theNext2FEDlowThresh = 9999;
337 adcNext2 = *(in_iter + 2);
338 theNext2FEDlowThresh = lowThr_[
strip + 2];
340 if (strip_mod_128 <= 1) {
342 thePrev2FEDlowThresh = 9999;
345 adcPrev2 = *(in_iter - 2);
346 thePrev2FEDlowThresh = lowThr_[
strip - 2];
350 if (isAValidDigi()) {
351 #ifdef DEBUG_SiStripZeroSuppression_ 354 <<
"[SiStripFedZeroSuppression::suppress] DetId " <<
out.id <<
" strip " <<
strip <<
" adc " << *in_iter
355 <<
" digiCollection size " <<
out.data.size();
364 #ifdef DEBUG_SiStripZeroSuppression_ 367 LogTrace(
"SiStripZeroSuppression") <<
"[SiStripFedZeroSuppression::suppress] " 368 <<
"\n\t adc " <<
adc <<
"\n\t adcPrev " << adcPrev <<
"\n\t adcNext " << adcNext
369 <<
"\n\t adcMaxNeigh " << adcMaxNeigh <<
"\n\t adcPrev2 " << adcPrev2
370 <<
"\n\t adcNext2 " << adcNext2 << std::endl;
372 LogTrace(
"SiStripZeroSuppression") <<
"[SiStripFedZeroSuppression::suppress] " 373 <<
"\n\t theFEDlowThresh " << theFEDlowThresh <<
"\n\t theFEDhighThresh " 374 << theFEDhighThresh <<
"\n\t thePrevFEDlowThresh " << thePrevFEDlowThresh
375 <<
"\n\t thePrevFEDhighThresh " << thePrevFEDhighThresh
376 <<
"\n\t theNextFEDlowThresh " << theNextFEDlowThresh
377 <<
"\n\t theNextFEDhighThresh " << theNextFEDhighThresh
378 <<
"\n\t theNeighFEDlowThresh " << theNeighFEDlowThresh
379 <<
"\n\t theNeighFEDhighThresh " << theNeighFEDhighThresh
380 <<
"\n\t thePrev2FEDlowThresh " << thePrev2FEDlowThresh
381 <<
"\n\t theNext2FEDlowThresh " << theNext2FEDlowThresh << std::endl;
386 switch (theFEDalgorithm) {
391 accept = (
adc >= theFEDhighThresh || (
adc >= theFEDlowThresh && adcMaxNeigh >= theNeighFEDlowThresh));
394 accept = (
adc >= theFEDhighThresh || (
adc >= theFEDlowThresh && adcMaxNeigh >= theNeighFEDhighThresh));
398 ((
adc >= theFEDhighThresh)
399 || ((
adc >= theFEDlowThresh)
400 && (adcMaxNeigh >= theNeighFEDlowThresh)) ||
401 ((
adc < theFEDlowThresh)
402 && (((adcPrev >= thePrevFEDhighThresh)
403 && (adcNext >= theNextFEDhighThresh)) ||
404 ((adcPrev >= thePrevFEDhighThresh)
405 && (adcNext >= theNextFEDlowThresh)
406 && (adcNext2 >= theNext2FEDlowThresh)) ||
407 ((adcNext >= theNextFEDhighThresh)
408 && (adcPrev >= thePrevFEDlowThresh)
409 && (adcPrev2 >= thePrev2FEDlowThresh)) ||
410 ((adcNext >= theNextFEDlowThresh)
411 && (adcNext2 >= theNext2FEDlowThresh)
412 && (adcPrev >= thePrevFEDlowThresh) && (adcPrev2 >= thePrev2FEDlowThresh)))));
void init(const edm::EventSetup &es)
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
bool getData(T &iHolder) const
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
std::pair< ContainerIterator, ContainerIterator > Range
void suppress(const std::vector< SiStripDigi > &in, std::vector< SiStripDigi > &selectedSignal, uint32_t detId, const SiStripNoises &, const SiStripThreshold &)
std::pair< ContainerIterator, ContainerIterator > Range
collection_type::const_iterator const_iterator
void fillThresholds_(const uint32_t detID, size_t size)
uint16_t *__restrict__ uint16_t const *__restrict__ adc