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 (HistoSet &, const uint32_t &bin, const float &value)
 
void updateHistoSet (CompactHistoSet &, const uint32_t &bin, const short &value)
 
void updateHistoSet (HistoSet &, const uint32_t &bin)
 
void updateHistoSet (CompactHistoSet &, const uint32_t &bin)
 
void updateHistoSet (HistoSet &, const float &value)
 
void updateHistoSet (CompactHistoSet &)
 
void updateHistoSet (HistoSet &)
 

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.

References LogTrace, and sistrip::mlDqmSource_.

16  : CommissioningTask(dqm, conn, "PedestalsTask"), peds_(), cm_() {
17  LogTrace(mlDqmSource_) << "[PedestalsTask::" << __func__ << "]"
18  << " Constructing object...";
19 }
static const char mlDqmSource_[]
#define LogTrace(id)
std::vector< HistoSet > peds_
Definition: PedestalsTask.h:20
std::vector< HistoSet > cm_
Definition: PedestalsTask.h:21
conn
Definition: getInfo.py:9
Definition: DQMStore.h:18

◆ ~PedestalsTask()

PedestalsTask::~PedestalsTask ( )
override

Definition at line 23 of file PedestalsTask.cc.

References LogTrace, and sistrip::mlDqmSource_.

23  {
24  LogTrace(mlDqmSource_) << "[PedestalsTask::" << __func__ << "]"
25  << " Destructing object...";
26 }
static const char mlDqmSource_[]
#define LogTrace(id)

Member Function Documentation

◆ book()

void PedestalsTask::book ( )
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 30 of file PedestalsTask.cc.

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.

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 }
static const char noise_[]
Utility class that holds histogram title.
static const char mlDqmSource_[]
#define LogTrace(id)
std::vector< HistoSet > peds_
Definition: PedestalsTask.h:20
static const char commonMode_[]
const uint32_t & fedKey() const
std::vector< HistoSet > cm_
Definition: PedestalsTask.h:21
DQMStore *const dqm() const
static const char pedestals_[]
const std::string & title() const
const FedChannelConnection & connection() const

◆ fill()

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

Reimplemented from CommissioningTask.

Definition at line 100 of file PedestalsTask.cc.

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

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 }
static const char mlDqmSource_[]
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
std::vector< HistoSet > peds_
Definition: PedestalsTask.h:20
std::vector< HistoSet > cm_
Definition: PedestalsTask.h:21
collection_type data
Definition: DetSet.h:80
Log< level::Warning, false > LogWarning
uint16_t *__restrict__ uint16_t const *__restrict__ adc

◆ update()

void PedestalsTask::update ( )
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 152 of file PedestalsTask.cc.

References cm_, relativeConstraints::error, extract(), timingPdfMaker::histo, cuy::ii, SiStripPI::mean, hgchebackDigitizer_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().

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 }
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
T sqrt(T t)
Definition: SSEVec.h:23
std::vector< HistoSet > peds_
Definition: PedestalsTask.h:20
static void setBinContent(TProfile *const profile, const uint32_t &bin, const double &entries, const double &mean, const double &spread)
std::vector< HistoSet > cm_
Definition: PedestalsTask.h:21
ii
Definition: cuy.py:589
int extract(std::vector< int > *output, const std::string &dati)

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().