22 <<
"[PedestalsTask::" << __func__ <<
"]" 23 <<
" Constructing object...";
30 <<
"[PedestalsTask::" << __func__ <<
"]" 31 <<
" Destructing object...";
47 peds_[0].isProfile_ =
true;
57 peds_[0].histo(
dqm()->bookProfile( title, title,
58 nbins, -0.5, nbins*1.-0.5,
61 peds_[0].vNumOfEntries_.resize(nbins,0);
62 peds_[0].vSumOfContents_.resize(nbins,0);
63 peds_[0].vSumOfSquares_.resize(nbins,0);
67 peds_[1].isProfile_ =
true;
77 peds_[1].histo(
dqm()->bookProfile( title, title,
78 nbins, -0.5, nbins*1.-0.5,
81 peds_[1].vNumOfEntries_.resize(nbins,0);
82 peds_[1].vSumOfContents_.resize(nbins,0);
83 peds_[1].vSumOfSquares_.resize(nbins,0);
88 for ( uint16_t iapv = 0; iapv < 2; iapv++ ) {
98 cm_[iapv].histo(
dqm()->book1D( title, title, nbins, -0.5, nbins*1.-0.5 ) );
99 cm_[iapv].isProfile_ =
false;
101 cm_[iapv].vNumOfEntries_.resize(nbins,0);
102 cm_[iapv].vNumOfEntries_.resize(nbins,0);
113 if ( digis.
data.size() !=
peds_[0].vNumOfEntries_.size() ) {
115 <<
"[PedestalsTask::" << __func__ <<
"]" 116 <<
" Unexpected number of digis: " 117 << digis.
data.size();
122 uint16_t
nbins =
peds_[0].vNumOfEntries_.size();
123 if ( digis.
data.size() <
nbins ) { nbins = digis.
data.size(); }
126 uint16_t napvs = nbins / 128;
127 std::vector<uint32_t> cm; cm.resize(napvs,0);
130 std::vector<uint16_t>
adc;
131 for ( uint16_t iapv = 0; iapv < napvs; iapv++ ) {
132 adc.clear(); adc.reserve(128);
133 for ( uint16_t ibin = 0; ibin < 128; ibin++ ) {
134 if ( (iapv*128)+ibin < nbins ) {
135 adc.push_back( digis.
data[(iapv*128)+ibin].adc() );
138 sort( adc.begin(), adc.end() );
139 uint16_t
index = adc.size()%2 ? adc.size()/2 : adc.size()/2-1;
140 if ( !adc.empty() ) { cm[iapv] =
static_cast<uint32_t
>( adc[
index] ); }
143 for ( uint16_t ibin = 0; ibin <
nbins; ibin++ ) {
145 float diff =
static_cast<float>( digis.
data[ibin].adc() ) - static_cast<float>( cm[ibin/128] );
149 if ( cm.size() <
cm_.size() ) {
151 <<
"[PedestalsTask::" << __func__ <<
"]" 152 <<
" Fewer CM values than expected: " << cm.size();
169 for ( uint16_t
ii = 0;
ii <
peds_[1].vNumOfEntries_.size(); ++
ii ) {
173 float entries =
peds_[1].vNumOfEntries_[
ii];
174 if ( entries > 0. ) {
175 mean =
peds_[1].vSumOfContents_[
ii] / entries;
176 spread =
sqrt(
peds_[1].vSumOfSquares_[
ii] / entries - mean * mean );
179 float noise = spread;
void fill(const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &) override
Utility class that holds histogram title.
const std::string & title() const
static const char mlDqmSource_[]
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
PedestalsTask(DQMStore *, const FedChannelConnection &)
Class containning control, module, detector and connection information, at the level of a FED channel...
std::vector< HistoSet > peds_
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)
DQMStore *const dqm() const
const uint32_t & fedKey() const
const FedChannelConnection & connection() const
~PedestalsTask() override