16 if(n_cache_id != noise_cache_id) {
18 noise_cache_id = n_cache_id;
20 if(t_cache_id != threshold_cache_id) {
22 threshold_cache_id = t_cache_id;
27 suppress(in, selectedSignal, detID, noiseHandle, thresholdHandle);
34 int inSize = in.size();
39 selectedSignal.clear();
40 selectedSignal.reserve(inSize);
41 for (i = 0; i < inSize; i++) {
43 const uint32_t
strip = (uint32_t) in[i].
strip();
48 theFEDlowThresh =
static_cast<int16_t
>(thresholds.
getLth()*noiseHandle->getNoiseFast(strip,detNoiseRange)+0.5);
49 theFEDhighThresh =
static_cast<int16_t
>(thresholds.
getHth()*noiseHandle->getNoiseFast(strip,detNoiseRange)+0.5);
62 theNextFEDlowThresh = theFEDlowThresh;
63 theNext2FEDlowThresh = theFEDlowThresh;
64 thePrevFEDlowThresh = theFEDlowThresh;
65 thePrev2FEDlowThresh = theFEDlowThresh;
66 theNeighFEDlowThresh = theFEDlowThresh;
68 theNextFEDhighThresh = theFEDhighThresh;
69 thePrevFEDhighThresh = theFEDhighThresh;
70 theNeighFEDhighThresh = theFEDhighThresh;
72 if ( ((strip)%128) == 127){
74 theNextFEDlowThresh = 9999;
75 theNextFEDhighThresh = 9999;
76 }
else if (i + 1 < inSize && in[i+1].
strip() == strip + 1) {
77 adcNext = in[i+1].adc();
79 theNextFEDlowThresh =
static_cast<int16_t
>(thresholds_1.
getLth()*noiseHandle->getNoiseFast(strip+1,detNoiseRange)+0.5);
80 theNextFEDhighThresh =
static_cast<int16_t
>(thresholds_1.
getHth()*noiseHandle->getNoiseFast(strip+1,detNoiseRange)+0.5);
81 if ( ((strip)%128) == 126){
83 theNext2FEDlowThresh = 9999;
84 }
else if (i + 2 < inSize && in[i+2].
strip() == strip + 2) {
85 adcNext2 = in[i+2].adc();
86 theNext2FEDlowThresh =
static_cast<int16_t
>(thresholdHandle->getData(strip+2,detThRange).getLth()*noiseHandle->getNoiseFast(strip+2,detNoiseRange)+0.5);
90 if ( ((strip)%128) == 0){
92 thePrevFEDlowThresh = 9999;
93 thePrevFEDhighThresh = 9999;
94 }
else if (i - 1 >= 0 && in[i-1].
strip() == strip - 1) {
95 adcPrev = in[i-1].adc();
97 thePrevFEDlowThresh =
static_cast<int16_t
>(thresholds_1.
getLth()*noiseHandle->getNoiseFast(strip-1,detNoiseRange)+0.5);
98 thePrevFEDhighThresh =
static_cast<int16_t
>(thresholds_1.
getHth()*noiseHandle->getNoiseFast(strip-1,detNoiseRange)+0.5);
99 if ( ((strip)%128) == 1){
101 thePrev2FEDlowThresh = 9999;
102 }
else if (i - 2 >= 0 && in[i-2].
strip() == strip - 2) {
103 adcPrev2 = in[i-2].adc();
104 thePrev2FEDlowThresh =
static_cast<int16_t
>(thresholdHandle->getData(strip-2,detThRange).getLth()*noiseHandle->getNoiseFast(strip-2,detNoiseRange)+0.5);
108 if ( adcNext <= adcPrev){
109 adcMaxNeigh = adcPrev;
110 theNeighFEDlowThresh = thePrevFEDlowThresh;
111 theNeighFEDhighThresh = thePrevFEDhighThresh;
113 adcMaxNeigh = adcNext;
114 theNeighFEDlowThresh = theNextFEDlowThresh;
115 theNeighFEDhighThresh = theNextFEDhighThresh;
126 const uint32_t detID = out.
id;
129 #ifdef DEBUG_SiStripZeroSuppression_
131 LogTrace(
"SiStripZeroSuppression") <<
"[SiStripFedZeroSuppression::suppress] Zero suppression on edm::DetSet<SiStripRawDigi>: detID " << detID <<
" size = " << in.
data.size();
134 for (;in_iter!=in.
data.end();in_iter++){
136 const uint32_t
strip = (uint32_t) (in_iter-in.
data.begin());
138 #ifdef DEBUG_SiStripZeroSuppression_
140 LogTrace(
"SiStripZeroSuppression") <<
"[SiStripFedZeroSuppression::suppress] detID= " << detID <<
" strip= " << strip <<
" adc= " << in_iter->adc();
142 adc = in_iter->adc();
145 theFEDlowThresh =
static_cast<int16_t
>(thresholds.
getLth()*noiseHandle->getNoiseFast(strip,detNoiseRange)+0.5);
146 theFEDhighThresh =
static_cast<int16_t
>(thresholds.
getHth()*noiseHandle->getNoiseFast(strip,detNoiseRange)+0.5);
156 if ( strip%128 == 127 ) {
158 theNextFEDlowThresh = 9999;
159 theNextFEDhighThresh = 9999;
162 adcNext = (in_iter+1)->
adc();
164 theNextFEDlowThresh =
static_cast<int16_t
>(thresholds_1.
getLth()*noiseHandle->getNoiseFast(strip+1,detNoiseRange)+0.5);
165 theNextFEDhighThresh =
static_cast<int16_t
>(thresholds_1.
getHth()*noiseHandle->getNoiseFast(strip+1,detNoiseRange)+0.5);
171 if ( strip%128 == 0 ) {
173 thePrevFEDlowThresh = 9999;
174 thePrevFEDhighThresh = 9999;
177 adcPrev = (in_iter-1)->
adc();
179 thePrevFEDlowThresh =
static_cast<int16_t
>(thresholds_1.
getLth()*noiseHandle->getNoiseFast(strip-1,detNoiseRange)+0.5);
180 thePrevFEDhighThresh =
static_cast<int16_t
>(thresholds_1.
getHth()*noiseHandle->getNoiseFast(strip-1,detNoiseRange)+0.5);
182 if ( adcNext < adcPrev){
183 adcMaxNeigh = adcPrev;
184 theNeighFEDlowThresh = thePrevFEDlowThresh;
185 theNeighFEDhighThresh = thePrevFEDhighThresh;
187 adcMaxNeigh = adcNext;
188 theNeighFEDlowThresh = theNextFEDlowThresh;
189 theNeighFEDhighThresh = theNextFEDhighThresh;
195 thePrev2FEDlowThresh = 1;
196 theNext2FEDlowThresh = 1;
197 if ( strip%128 >= 126 ) {
199 theNext2FEDlowThresh = 9999;
201 else if ( strip%128 < 126 ) {
202 adcNext2 = (in_iter+2)->
adc();
203 theNext2FEDlowThresh =
static_cast<int16_t
>(thresholdHandle->getData(strip+2,detThRange).getLth()*noiseHandle->getNoiseFast(strip+2,detNoiseRange)+0.5);
205 if ( strip%128 <= 1 ) {
207 thePrev2FEDlowThresh = 9999;
209 else if ( strip%128 > 1 ) {
210 adcPrev2 = (in_iter-2)->
adc();
211 thePrev2FEDlowThresh =
static_cast<int16_t
>(thresholdHandle->getData(strip-2,detThRange).getLth()*noiseHandle->getNoiseFast(strip-2,detNoiseRange)+0.5);
223 if (highThr_.size() !=
size) {
224 highThr_.resize(size);
225 lowThr_.resize(size);
226 noises_.resize(size);
227 highThrSN_.resize(size);
228 lowThrSN_.resize(size);
231 noiseHandle->allNoises(noises_, detNoiseRange);
232 thresholdHandle->allThresholds(lowThrSN_, highThrSN_, detThRange);
234 float noise = noises_[
strip];
237 highThr_[
strip] =
static_cast<int16_t
>(highThrSN_[
strip]*noise+0.5+1e-6);
238 lowThr_[
strip] =
static_cast<int16_t
>( lowThrSN_[
strip]*noise+0.5+1e-6);
248 const uint32_t detID = out.
id;
249 size_t size = in.size();
250 #ifdef DEBUG_SiStripZeroSuppression_
252 LogTrace(
"SiStripZeroSuppression") <<
"[SiStripFedZeroSuppression::suppress] Zero suppression on std::vector<int16_t>: detID " << detID <<
" size = " << in.size();
255 fillThresholds_(detID, size);
257 std::vector<int16_t>::const_iterator in_iter=in.begin();
260 size_t strip_mod_128 =
strip & 127;
261 #ifdef DEBUG_SiStripZeroSuppression_
263 LogTrace(
"SiStripZeroSuppression") <<
"[SiStripFedZeroSuppression::suppress] detID= " << detID <<
" strip= " <<
strip <<
" adc= " << *in_iter;
267 theFEDlowThresh = lowThr_[
strip];
268 theFEDhighThresh = highThr_[
strip];
281 if ( strip_mod_128 == 127 ) {
283 theNextFEDlowThresh = 9999;
284 theNextFEDhighThresh = 9999;
286 adcNext = *(in_iter+1);
287 theNextFEDlowThresh = lowThr_[
strip+1];
288 theNextFEDhighThresh = highThr_[
strip+1];
295 if ( strip_mod_128 == 0 ) {
297 thePrevFEDlowThresh = 9999;
298 thePrevFEDhighThresh = 9999;
300 adcPrev = *(in_iter-1);
301 thePrevFEDlowThresh = lowThr_[
strip-1];
302 thePrevFEDhighThresh = highThr_[
strip-1];
305 if ( adcNext < adcPrev){
306 adcMaxNeigh = adcPrev;
307 theNeighFEDlowThresh = thePrevFEDlowThresh;
308 theNeighFEDhighThresh = thePrevFEDhighThresh;
310 adcMaxNeigh = adcNext;
311 theNeighFEDlowThresh = theNextFEDlowThresh;
312 theNeighFEDhighThresh = theNextFEDhighThresh;
320 if ( strip_mod_128 >=126 ) {
322 theNext2FEDlowThresh = 9999;
325 adcNext2 = *(in_iter+2);
326 theNext2FEDlowThresh = lowThr_[
strip+2];
328 if ( strip_mod_128 <= 1 ) {
330 thePrev2FEDlowThresh = 9999;
333 adcPrev2 = *(in_iter-2);
334 thePrev2FEDlowThresh = lowThr_[
strip-2];;
338 #ifdef DEBUG_SiStripZeroSuppression_
340 LogTrace(
"SiStripZeroSuppression") <<
"[SiStripFedZeroSuppression::suppress] DetId " << out.
id <<
" strip " <<
strip <<
" adc " << *in_iter <<
" digiCollection size " << out.
data.size() ;
352 #ifdef DEBUG_SiStripZeroSuppression_
357 LogTrace(
"SiStripZeroSuppression") <<
"[SiStripFedZeroSuppression::suppress] "
358 <<
"\n\t adc " <<
adc
359 <<
"\n\t adcPrev " << adcPrev
360 <<
"\n\t adcNext " << adcNext
361 <<
"\n\t adcMaxNeigh " << adcMaxNeigh
362 <<
"\n\t adcPrev2 " << adcPrev2
363 <<
"\n\t adcNext2 " << adcNext2
366 LogTrace(
"SiStripZeroSuppression") <<
"[SiStripFedZeroSuppression::suppress] "
367 <<
"\n\t theFEDlowThresh " << theFEDlowThresh
368 <<
"\n\t theFEDhighThresh " << theFEDhighThresh
369 <<
"\n\t thePrevFEDlowThresh " << thePrevFEDlowThresh
370 <<
"\n\t thePrevFEDhighThresh " << thePrevFEDhighThresh
371 <<
"\n\t theNextFEDlowThresh " << theNextFEDlowThresh
372 <<
"\n\t theNextFEDhighThresh " << theNextFEDhighThresh
373 <<
"\n\t theNeighFEDlowThresh " << theNeighFEDlowThresh
374 <<
"\n\t theNeighFEDhighThresh " << theNeighFEDhighThresh
375 <<
"\n\t thePrev2FEDlowThresh " << thePrev2FEDlowThresh
376 <<
"\n\t theNext2FEDlowThresh " << theNext2FEDlowThresh
382 switch (theFEDalgorithm) {
384 accept = (
adc >= theFEDlowThresh);
387 accept = (
adc >= theFEDhighThresh || (
adc >= theFEDlowThresh &&
388 adcMaxNeigh >= theNeighFEDlowThresh));
391 accept = (
adc >= theFEDhighThresh || (
adc >= theFEDlowThresh &&
392 adcMaxNeigh >= theNeighFEDhighThresh));
396 (
adc >= theFEDhighThresh)
399 (
adc >= theFEDlowThresh)
401 (adcMaxNeigh >= theNeighFEDlowThresh)
405 (
adc < theFEDlowThresh)
409 (adcPrev >= thePrevFEDhighThresh)
411 (adcNext >= theNextFEDhighThresh)
415 (adcPrev >= thePrevFEDhighThresh)
417 (adcNext >= theNextFEDlowThresh)
419 (adcNext2 >= theNext2FEDlowThresh)
423 (adcNext >= theNextFEDhighThresh)
425 (adcPrev >= thePrevFEDlowThresh)
427 (adcPrev2 >= thePrev2FEDlowThresh)
431 (adcNext >= theNextFEDlowThresh)
433 (adcNext2 >= theNext2FEDlowThresh)
435 (adcPrev >= thePrevFEDlowThresh)
437 (adcPrev2 >= thePrev2FEDlowThresh)
int adc(sample_type sample)
get the ADC sample (12 bits)
void init(const edm::EventSetup &es)
void push_back(const T &t)
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
void suppress(const std::vector< SiStripDigi > &, std::vector< SiStripDigi > &, const uint32_t &, edm::ESHandle< SiStripNoises > &, edm::ESHandle< SiStripThreshold > &)
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
std::pair< ContainerIterator, ContainerIterator > Range
std::pair< ContainerIterator, ContainerIterator > Range
collection_type::const_iterator const_iterator
void fillThresholds_(const uint32_t detID, size_t size)
tuple size
Write out results.