59 peds_[0].isProfile_ =
true;
68 peds_[0].histo(
dqm()->bookProfile( title, title,
78 peds_[1].isProfile_ =
true;
88 peds_[1].histo(
dqm()->bookProfile( title, title,
100 for ( uint16_t iapv = 0; iapv < 2; iapv++ ) {
109 cm_[iapv].histo(
dqm()->book1D( title, title, nbins, -0.5, nbins*1.-0.5 ) );
110 cm_[iapv].isProfile_ =
false;
112 cm_[iapv].vNumOfEntries_.resize(nbins,0);
113 cm_[iapv].vNumOfEntries_.resize(nbins,0);
177 <<
"[DaqScopeModeTask::" << __func__ <<
"]" 178 <<
" Unexpected number of digis (" 180 <<
") wrt number of histogram bins (" 187 for ( uint16_t ibin = 0; ibin <
bins; ibin++ ) {
194 uint16_t
nbins =
peds_[0].vNumOfEntries_.size();
195 if ( digis.
data.size() <
nbins ) { nbins = digis.
data.size(); }
197 uint16_t napvs = nbins / 128;
198 std::vector<uint32_t> cm; cm.resize(napvs,0);
201 std::vector<uint16_t>
adc;
202 for ( uint16_t iapv = 0; iapv < napvs; iapv++ ) {
203 adc.clear(); adc.reserve(128);
205 for ( uint16_t ibin = 0; ibin < 128; ibin++ ) {
206 if ( (iapv*128)+ibin < nbins ) {
207 adc.push_back( digis.
data[(iapv*128)+ibin].adc() );
211 sort( adc.begin(), adc.end() );
212 uint16_t
index = adc.size()%2 ? adc.size()/2 : adc.size()/2-1;
213 if ( !adc.empty() ) { cm[iapv] =
static_cast<uint32_t
>( adc[
index] ); }
216 for ( uint16_t ibin = 0; ibin <
nbins; ibin++ ) {
217 float digiVal = digis.
data[ibin].adc();
219 float diff = digiVal -
static_cast<float>( cm[ibin/128] );
223 if ( cm.size() <
cm_.size() ) {
225 <<
"[PedestalsTask::" << __func__ <<
"]" 226 <<
" Fewer CM values than expected: " << cm.size();
247 <<
"[DaqScopeModeTask::" << __func__ <<
"]" 248 <<
" Unexpected number of digis (" 250 <<
") wrt number of histogram bins (" 256 for ( uint16_t ibin = 0; ibin <
bins; ibin++ ) {
264 uint16_t
nbins =
peds_[0].vNumOfEntries_.size();
265 if ( digis.
data.size() <
nbins ) { nbins = digis.
data.size(); }
267 uint16_t napvs = nbins / 128;
268 std::vector<uint32_t> cm; cm.resize(napvs,0);
271 std::vector<uint16_t>
adc;
272 for ( uint16_t iapv = 0; iapv < napvs; iapv++ ) {
273 adc.clear(); adc.reserve(128);
274 for ( uint16_t ibin = 0; ibin < 128; ibin++ ) {
275 if ( (iapv*128)+ibin < nbins ) {
276 adc.push_back( digis.
data[(iapv*128)+ibin].adc() );
279 sort( adc.begin(), adc.end() );
280 uint16_t
index = adc.size()%2 ? adc.size()/2 : adc.size()/2-1;
281 if ( !adc.empty() ) { cm[iapv] =
static_cast<uint32_t
>( adc[
index] ); }
285 for ( uint16_t ibin = 0; ibin <
nbins; ibin++ ) {
286 float digiVal = digis.
data[ibin].adc();
288 float diff = digiVal -
static_cast<float>( cm[ibin/128] );
292 if ( cm.size() <
cm_.size() ) {
294 <<
"[PedestalsTask::" << __func__ <<
"]" 295 <<
" Fewer CM values than expected: " << cm.size();
302 for ( uint16_t ibin = 0; ibin <
bins; ibin++ ) {
307 std::vector<uint32_t> adcHeader_high;
308 std::vector<uint32_t> adcHeader_low;
310 float threshold_high = (digisAlt.
data[286].adc() + digisAlt.
data[287].adc())/4;
311 float threshold_low = 100;
312 int minNumberForHeader = 4;
313 bool goodHeaderFound =
false;
314 int nConsecutiveHigh = 0;
315 adcHeader_high.clear();
316 adcHeader_high.reserve(30);
317 adcHeader_low.clear();
318 adcHeader_low.reserve(30);
320 for ( uint16_t ibin = 6; ibin < 11; ibin++ ) {
321 if (digisAlt.
data[ibin].adc() > threshold_high) {
326 if(nConsecutiveHigh > minNumberForHeader) goodHeaderFound =
true;
327 if(goodHeaderFound ==
false)
return;
328 for ( uint16_t ibin = 0; ibin < 30; ibin++ ) {
329 if(digisAlt.
data[ibin].adc() > threshold_high && goodHeaderFound){
330 adcHeader_high.push_back( digisAlt.
data[ibin].adc() );
332 if (digisAlt.
data[ibin].adc() < threshold_low && goodHeaderFound){
333 adcHeader_low.push_back( digisAlt.
data[ibin].adc() );
336 if(adcHeader_low.empty() || adcHeader_high.empty()) {
339 for ( uint16_t
i = 0;
i<adcHeader_low.size();
i++){
342 for ( uint16_t
i = 0;
i<adcHeader_high.size();
i++){
358 const std::vector<uint16_t> & stripOnCluster ) {
367 <<
"[DaqScopeModeTask::" << __func__ <<
"]" 368 <<
" Unexpected number of digis (" 370 <<
") wrt number of histogram bins (" 376 for ( uint16_t ibin = 0; ibin <
bins; ibin++ ) {
382 uint16_t
nbins =
peds_[0].vNumOfEntries_.size();
383 if ( digis.
data.size() <
nbins ) { nbins = digis.
data.size(); }
384 uint16_t napvs = nbins / 128;
385 std::vector<uint32_t> cm; cm.resize(napvs,0);
387 std::vector<uint16_t>
adc;
388 for ( uint16_t iapv = 0; iapv < napvs; iapv++ ) {
389 adc.clear(); adc.reserve(128);
390 for ( uint16_t ibin = 0; ibin < 128; ibin++ ) {
391 if ( (iapv*128)+ibin < nbins ) {
392 if(
std::find(stripOnCluster.begin(),stripOnCluster.end(),(iapv*128)+ibin) == stripOnCluster.end())
393 adc.push_back( digis.
data[(iapv*128)+ibin].adc() );
396 sort( adc.begin(), adc.end() );
397 uint16_t
index = adc.size()%2 ? adc.size()/2 : adc.size()/2-1;
398 if ( !adc.empty() ) { cm[iapv] =
static_cast<uint32_t
>( adc[
index] ); }
402 for ( uint16_t ibin = 0; ibin <
nbins; ibin++ ) {
403 if(
std::find(stripOnCluster.begin(),stripOnCluster.end(),ibin) != stripOnCluster.end()){
406 float digiVal = digis.
data[ibin].adc();
408 float diff = digiVal -
static_cast<float>( cm[ibin/128] );
412 if ( cm.size() <
cm_.size() ) {
414 <<
"[PedestalsTask::" << __func__ <<
"]" 415 <<
" Fewer CM values than expected: " << cm.size();
422 for ( uint16_t ibin = 0; ibin <
bins; ibin++ ) {
426 std::vector<uint32_t> adcHeader_high;
427 std::vector<uint32_t> adcHeader_low;
429 float threshold_high = (digisAlt.
data[286].adc() + digisAlt.
data[287].adc())/4;
430 float threshold_low = 120;
431 int minNumberForHeader = 4;
432 bool goodHeaderFound =
false;
433 int nConsecutiveHigh = 0;
434 adcHeader_high.clear();
435 adcHeader_high.reserve(30);
436 adcHeader_low.clear();
437 adcHeader_low.reserve(30);
439 for ( uint16_t ibin = 6; ibin < 11; ibin++ ) {
440 if (digisAlt.
data[ibin].adc() > threshold_high) {
445 if(nConsecutiveHigh > minNumberForHeader) goodHeaderFound =
true;
446 if(goodHeaderFound ==
false)
return;
447 for ( uint16_t ibin = 0; ibin < 30; ibin++ ) {
448 if(digisAlt.
data[ibin].adc() > threshold_high && goodHeaderFound){
449 adcHeader_high.push_back( digisAlt.
data[ibin].adc() );
451 if (digisAlt.
data[ibin].adc() < threshold_low && goodHeaderFound){
452 adcHeader_low.push_back( digisAlt.
data[ibin].adc() );
455 if(adcHeader_low.empty() || adcHeader_high.empty()) {
458 for ( uint16_t
i = 0;
i<adcHeader_low.size();
i++){
461 for ( uint16_t
i = 0;
i<adcHeader_high.size();
i++){
479 for ( uint16_t
ii = 0;
ii <
peds_[1].vNumOfEntries_.size(); ++
ii ) {
483 float entries =
peds_[1].vNumOfEntries_[
ii];
484 if ( entries > 0. ) {
485 mean =
peds_[1].vSumOfContents_[
ii] / entries;
486 spread =
sqrt(
peds_[1].vSumOfSquares_[
ii] / entries - mean * mean );
489 float noise = spread;
T getParameter(std::string const &) const
std::vector< float > vNumOfEntries_
edm::ParameterSet parameters_
parameters useful for the spy
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
Utility class that holds histogram title.
const std::string & title() const
DaqScopeModeTask(DQMStore *, const FedChannelConnection &, const edm::ParameterSet &)
static const char mlDqmSource_[]
std::vector< float > vSumOfContents_
const uint32_t & updateFreq() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
std::vector< HistoSet > peds_
Class containning control, module, detector and connection information, at the level of a FED channel...
void fill(const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &) override
static void setBinContent(TProfile *const profile, const uint32_t &bin, const double &entries, const double &mean, const double &spread)
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
std::vector< HistoSet > cm_
int extract(std::vector< int > *output, const std::string &dati)
~DaqScopeModeTask() override
DQMStore *const dqm() const
const uint32_t & fillCntr() const
void histo(MonitorElement *)
const uint32_t & fedKey() const
std::vector< double > vSumOfSquares_
const FedChannelConnection & connection() const