CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PedestalsTask Class Reference

#include <PedestalsTask.h>

Inheritance diagram for PedestalsTask:
CommissioningTask

Public Member Functions

 PedestalsTask (DQMStore *, const FedChannelConnection &)
 
 ~PedestalsTask () override
 
- Public Member Functions inherited from CommissioningTask
void bookHistograms ()
 
 CommissioningTask (DQMStore *, const FedChannelConnection &, const std::string &my_name)
 
void eventSetup (const edm::EventSetup *)
 
const uint32_t & fillCntr () const
 
void fillHistograms (const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &)
 
void fillHistograms (const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &, const edm::DetSet< SiStripRawDigi > &)
 
void fillHistograms (const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &, const edm::DetSet< SiStripRawDigi > &, const std::vector< uint16_t > &)
 
void fillHistograms (const SiStripEventSummary &, const uint16_t &fed_id, const std::map< uint16_t, float > &fed_ch)
 
const std::string & myName () const
 
const uint32_t & updateFreq () const
 
void updateFreq (const uint32_t &)
 
void updateHistograms ()
 
virtual ~CommissioningTask ()
 

Private Member Functions

void book () override
 
void fill (const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &) override
 
void update () override
 

Private Attributes

std::vector< HistoSetcm_
 
std::vector< HistoSetpeds_
 

Additional Inherited Members

- Public Types inherited from CommissioningTask
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Protected Member Functions inherited from CommissioningTask
const FedChannelConnectionconnection () const
 
DQMStore *const dqm () const
 
const edm::EventSetup *const eventSetup () const
 
const uint32_t & fecKey () const
 
const uint32_t & fedKey () const
 
void updateHistoSet (CompactHistoSet &)
 
void updateHistoSet (CompactHistoSet &, const uint32_t &bin)
 
void updateHistoSet (CompactHistoSet &, const uint32_t &bin, const short &value)
 
void updateHistoSet (HistoSet &)
 
void updateHistoSet (HistoSet &, const float &value)
 
void updateHistoSet (HistoSet &, const uint32_t &bin)
 
void updateHistoSet (HistoSet &, const uint32_t &bin, const float &value)
 

Detailed Description

Definition at line 10 of file PedestalsTask.h.

Constructor & Destructor Documentation

◆ PedestalsTask()

PedestalsTask::PedestalsTask ( DQMStore dqm,
const FedChannelConnection conn 
)

Definition at line 15 of file PedestalsTask.cc.

16  : CommissioningTask(dqm, conn, "PedestalsTask"), peds_(), cm_() {
17  LogTrace(mlDqmSource_) << "[PedestalsTask::" << __func__ << "]"
18  << " Constructing object...";
19 }

References LogTrace, and sistrip::mlDqmSource_.

◆ ~PedestalsTask()

PedestalsTask::~PedestalsTask ( )
override

Definition at line 23 of file PedestalsTask.cc.

23  {
24  LogTrace(mlDqmSource_) << "[PedestalsTask::" << __func__ << "]"
25  << " Destructing object...";
26 }

References LogTrace, and sistrip::mlDqmSource_.

Member Function Documentation

◆ book()

void PedestalsTask::book ( )
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 30 of file PedestalsTask.cc.

30  {
31  LogTrace(mlDqmSource_) << "[PedestalsTask::" << __func__ << "]";
32 
33  uint16_t nbins;
35  std::string extra_info;
36  peds_.resize(2);
37  nbins = 256;
38 
39  // Pedestals histogram
40  extra_info = sistrip::extrainfo::pedestals_;
41  peds_[0].isProfile_ = true;
42 
46  fedKey(),
48  connection().lldChannel(),
49  extra_info)
50  .title();
51 
52  peds_[0].histo(dqm()->bookProfile(title, title, nbins, -0.5, nbins * 1. - 0.5, 1025, 0., 1025.));
53 
54  peds_[0].vNumOfEntries_.resize(nbins, 0);
55  peds_[0].vSumOfContents_.resize(nbins, 0);
56  peds_[0].vSumOfSquares_.resize(nbins, 0);
57 
58  // Noise histogram
59  extra_info = sistrip::extrainfo::noise_;
60  peds_[1].isProfile_ = true;
61 
65  fedKey(),
67  connection().lldChannel(),
68  extra_info)
69  .title();
70 
71  peds_[1].histo(dqm()->bookProfile(title, title, nbins, -0.5, nbins * 1. - 0.5, 1025, 0., 1025.));
72 
73  peds_[1].vNumOfEntries_.resize(nbins, 0);
74  peds_[1].vSumOfContents_.resize(nbins, 0);
75  peds_[1].vSumOfSquares_.resize(nbins, 0);
76 
77  // Common mode histograms
78  cm_.resize(2);
79  nbins = 1024;
80  for (uint16_t iapv = 0; iapv < 2; iapv++) {
84  fedKey(),
86  connection().i2cAddr(iapv),
88  .title();
89 
90  cm_[iapv].histo(dqm()->book1D(title, title, nbins, -0.5, nbins * 1. - 0.5));
91  cm_[iapv].isProfile_ = false;
92 
93  cm_[iapv].vNumOfEntries_.resize(nbins, 0);
94  cm_[iapv].vNumOfEntries_.resize(nbins, 0);
95  }
96 }

References sistrip::APV, cm_, sistrip::extrainfo::commonMode_, CommissioningTask::connection(), CommissioningTask::dqm(), sistrip::EXPERT_HISTO, sistrip::FED_KEY, CommissioningTask::fedKey(), sistrip::LLD_CHAN, LogTrace, sistrip::mlDqmSource_, LaserClient_cfi::nbins, sistrip::extrainfo::noise_, sistrip::PEDESTALS, sistrip::extrainfo::pedestals_, peds_, AlCaHLTBitMon_QueryRunRegistry::string, SiStripHistoTitle::title(), and runGCPTkAlMap::title.

◆ fill()

void PedestalsTask::fill ( const SiStripEventSummary summary,
const edm::DetSet< SiStripRawDigi > &  digis 
)
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 100 of file PedestalsTask.cc.

100  {
101  if (digis.data.size() != peds_[0].vNumOfEntries_.size()) {
102  edm::LogWarning(mlDqmSource_) << "[PedestalsTask::" << __func__ << "]"
103  << " Unexpected number of digis: " << digis.data.size();
104  return;
105  }
106 
107  // Check number of digis
108  uint16_t nbins = peds_[0].vNumOfEntries_.size();
109  if (digis.data.size() < nbins) {
110  nbins = digis.data.size();
111  }
112 
113  //@@ Inefficient!!!
114  uint16_t napvs = nbins / 128;
115  std::vector<uint32_t> cm;
116  cm.resize(napvs, 0);
117 
118  // Calc common mode for both APVs
119  std::vector<uint16_t> adc;
120  for (uint16_t iapv = 0; iapv < napvs; iapv++) {
121  adc.clear();
122  adc.reserve(128);
123  for (uint16_t ibin = 0; ibin < 128; ibin++) {
124  if ((iapv * 128) + ibin < nbins) {
125  adc.push_back(digis.data[(iapv * 128) + ibin].adc()); //@@ VIRGIN RAW DATA (MUX, APV READOUT)
126  }
127  }
128  sort(adc.begin(), adc.end());
129  uint16_t index = adc.size() % 2 ? adc.size() / 2 : adc.size() / 2 - 1;
130  if (!adc.empty()) {
131  cm[iapv] = static_cast<uint32_t>(adc[index]);
132  }
133  }
134 
135  for (uint16_t ibin = 0; ibin < nbins; ibin++) {
136  updateHistoSet(peds_[0], ibin, digis.data[ibin].adc()); // peds and raw noise
137  float diff = static_cast<float>(digis.data[ibin].adc()) - static_cast<float>(cm[ibin / 128]);
138  updateHistoSet(peds_[1], ibin, diff); // residuals and real noise
139  }
140 
141  if (cm.size() < cm_.size()) {
142  edm::LogWarning(mlDqmSource_) << "[PedestalsTask::" << __func__ << "]"
143  << " Fewer CM values than expected: " << cm.size();
144  }
145 
146  updateHistoSet(cm_[0], cm[0]);
147  updateHistoSet(cm_[1], cm[1]);
148 }

References ecalLiteDTU::adc(), cm_, edm::DetSet< T >::data, change_name::diff, sistrip::mlDqmSource_, LaserClient_cfi::nbins, peds_, and CommissioningTask::updateHistoSet().

◆ update()

void PedestalsTask::update ( )
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 152 of file PedestalsTask.cc.

152  {
153  // Pedestals
154  updateHistoSet(peds_[0]);
155 
156  // Noise (cannot use HistoSet directly, as want to plot noise as "contents", not "error")
157  TProfile* histo = ExtractTObject<TProfile>().extract(peds_[1].histo());
158  for (uint16_t ii = 0; ii < peds_[1].vNumOfEntries_.size(); ++ii) {
159  float mean = 0.;
160  float spread = 0.;
161  float entries = peds_[1].vNumOfEntries_[ii];
162  if (entries > 0.) {
163  mean = peds_[1].vSumOfContents_[ii] / entries;
164  spread = sqrt(peds_[1].vSumOfSquares_[ii] / entries - mean * mean);
165  }
166 
167  float noise = spread;
168  float error = 0; // sqrt(entries) / entries;
169 
171  }
172 
173  // Common mode
174  updateHistoSet(cm_[0]);
175  updateHistoSet(cm_[1]);
176 }

References cm_, relativeConstraints::error, ExtractTObject< T >::extract(), timingPdfMaker::histo, cuy::ii, SiStripPI::mean, hgcalDigitizer_cfi::noise, peds_, UpdateTProfile::setBinContent(), mathSSE::sqrt(), and CommissioningTask::updateHistoSet().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), dqm-mbProfile.Profile::finish(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

Member Data Documentation

◆ cm_

std::vector<HistoSet> PedestalsTask::cm_
private

Definition at line 21 of file PedestalsTask.h.

Referenced by book(), fill(), and update().

◆ peds_

std::vector<HistoSet> PedestalsTask::peds_
private

Definition at line 20 of file PedestalsTask.h.

Referenced by book(), fill(), and update().

change_name.diff
diff
Definition: change_name.py:13
sistrip::mlDqmSource_
static const char mlDqmSource_[]
Definition: ConstantsForLogger.h:20
sistrip::extrainfo::commonMode_
static const char commonMode_[]
Definition: ConstantsForDqm.h:48
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
sistrip::extrainfo::noise_
static const char noise_[]
Definition: ConstantsForDqm.h:47
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
CommissioningTask::connection
const FedChannelConnection & connection() const
Definition: CommissioningTask.h:189
SiStripCommissioningClient_cfg.conn
conn
Definition: SiStripCommissioningClient_cfg.py:5
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:279
ExtractTObject
Definition: ExtractTObject.h:9
relativeConstraints.error
error
Definition: relativeConstraints.py:53
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
CommissioningTask::fedKey
const uint32_t & fedKey() const
Definition: CommissioningTask.h:192
ecalLiteDTU::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalLiteDTUSample.h:12
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
sistrip::EXPERT_HISTO
Definition: ConstantsForHistoType.h:29
LaserClient_cfi.nbins
nbins
Definition: LaserClient_cfi.py:51
sistrip::extrainfo::pedestals_
static const char pedestals_[]
Definition: ConstantsForDqm.h:45
PedestalsTask::cm_
std::vector< HistoSet > cm_
Definition: PedestalsTask.h:21
CommissioningTask::CommissioningTask
CommissioningTask()
Definition: CommissioningTask.h:143
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PedestalsTask::peds_
std::vector< HistoSet > peds_
Definition: PedestalsTask.h:20
hgcalDigitizer_cfi.noise
noise
Definition: hgcalDigitizer_cfi.py:155
sistrip::PEDESTALS
Definition: ConstantsForRunType.h:72
sistrip::APV
Definition: ConstantsForGranularity.h:79
CommissioningTask::updateHistoSet
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
Definition: CommissioningTask.cc:274
ExtractTObject::extract
static T * extract(MonitorElement *me)
Definition: ExtractTObject.cc:21
CommissioningTask::dqm
DQMStore *const dqm() const
Definition: CommissioningTask.h:188
SiStripHistoTitle::title
const std::string & title() const
Definition: SiStripHistoTitle.h:109
edm::DetSet::data
collection_type data
Definition: DetSet.h:80
SiStripHistoTitle
Utility class that holds histogram title.
Definition: SiStripHistoTitle.h:20
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
dqm
Definition: DQMStore.h:18
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
sistrip::FED_KEY
Definition: ConstantsForKeyType.h:30
UpdateTProfile::setBinContent
static void setBinContent(TProfile *const profile, const uint32_t &bin, const double &entries, const double &mean, const double &spread)
Definition: UpdateTProfile.cc:80
cuy.ii
ii
Definition: cuy.py:590
sistrip::LLD_CHAN
Definition: ConstantsForGranularity.h:78