CMS 3D CMS Logo

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

#include <CalibrationTask.h>

Inheritance diagram for CalibrationTask:
CommissioningTask

Public Member Functions

 CalibrationTask (DQMStore *, const FedChannelConnection &, const sistrip::RunType &, const char *filename, uint32_t run, const SiStripPedestals &pedestals)
 
void setCurrentFolder (const std::string &)
 
 ~CalibrationTask () 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::map< std::string, std::vector< HistoSet > > calib1_
 
std::map< std::string, std::vector< HistoSet > > calib2_
 
std::string directory_
 
std::string extrainfo_
 
uint16_t lastCalChan_
 
uint16_t lastCalSel_
 
uint16_t lastLatency_
 
uint16_t nBins_
 
std::vector< uint16_t > ped
 
uint32_t run_
 
sistrip::RunType runType_
 

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 12 of file CalibrationTask.h.

Constructor & Destructor Documentation

◆ CalibrationTask()

CalibrationTask::CalibrationTask ( DQMStore dqm,
const FedChannelConnection conn,
const sistrip::RunType rtype,
const char *  filename,
uint32_t  run,
const SiStripPedestals pedestals 
)

Definition at line 16 of file CalibrationTask.cc.

References sistrip::CALIBRATION, sistrip::CALIBRATION_DECO, getInfo::conn, SiStripPedestals::getPed(), SiStripPedestals::getRange(), createfilelist::int, LogDebug, nBins_, ped, runType_, and nano_mu_digi_cff::strip.

22  : CommissioningTask(dqm, conn, "CalibrationTask"),
23  runType_(rtype),
24  nBins_(0),
25  lastCalChan_(1000),
26  lastCalSel_(1000),
27  lastLatency_(1000),
28  extrainfo_(),
29  run_(run) {
30  // each latency point is 25ns, each calSel is 25/8 --> 64 points = 8 calsel + 8 latency --> as set in the DAQ configuration
32  nBins_ = 64;
33  // each latency point is 25ns, each calSel is 25/8 --> 80 points = 8 calsel + 10 latency --> as set in the DAQ configuration
35  nBins_ = 80;
36 
37  LogDebug("Commissioning") << "[CalibrationTask::CalibrationTask] Constructing object...";
38 
39  // load the pedestals
40  SiStripPedestals::Range detPedRange = pedestals.getRange(conn.detId());
41  int start = conn.apvPairNumber() * 256;
42  int stop = start + 256;
43  int value = 0;
44  ped.reserve(256);
45  for (int strip = start; strip < stop; ++strip) {
46  value = int(pedestals.getPed(strip, detPedRange));
47  if (value > 895)
48  value -= 1024;
49  ped.push_back(value);
50  }
51 }
Definition: start.py:1
const Range getRange(const uint32_t &detID) const
uint16_t lastCalSel_
std::string extrainfo_
std::pair< ContainerIterator, ContainerIterator > Range
float getPed(const uint16_t &strip, const Range &range) const
uint16_t lastLatency_
uint16_t lastCalChan_
sistrip::RunType runType_
Definition: value.py:1
std::vector< uint16_t > ped
conn
Definition: getInfo.py:9
Definition: DQMStore.h:18
#define LogDebug(id)

◆ ~CalibrationTask()

CalibrationTask::~CalibrationTask ( )
override

Definition at line 55 of file CalibrationTask.cc.

References LogDebug.

55  {
56  LogDebug("Commissioning") << "[CalibrationTask::CalibrationTask] Destructing object...";
57 }
#define LogDebug(id)

Member Function Documentation

◆ book()

void CalibrationTask::book ( )
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 61 of file CalibrationTask.cc.

References sistrip::APV, calib1_, calib2_, sistrip::CALIBRATION, sistrip::CALIBRATION_DECO, CommissioningTask::connection(), directory_, CommissioningTask::dqm(), sistrip::EXPERT_HISTO, extrainfo_, sistrip::FED_KEY, CommissioningTask::fedKey(), mps_fire::i, LogDebug, nBins_, nano_postproc::postfix, runType_, dqm::implementation::DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, SiStripHistoTitle::title(), runGCPTkAlMap::title, and to_string().

Referenced by fill().

61  {
62  LogDebug("Commissioning") << "[CalibrationTask::book]";
63 
64  // book 16 histograms, one for each strip in a calibration group --> APV1 --> 16 = dimension of one calChan
65  if (calib1_.find(extrainfo_) == calib1_.end()) {
67  calib1_[extrainfo_].resize(16);
68  for (int i = 0; i < 16; ++i) {
69  std::string postfix = extrainfo_ + "_istrip_" + std::to_string(i);
71  runType_,
73  fedKey(),
75  connection().i2cAddr(0),
76  postfix)
77  .title();
78 
80  calib1_[extrainfo_][i].histo(dqm()->book1D(title, title, nBins_, 0, 200));
82  calib1_[extrainfo_][i].histo(dqm()->book1D(title, title, nBins_, 0, 250));
83  calib1_[extrainfo_][i].isProfile_ = false;
84  calib1_[extrainfo_][i].vNumOfEntries_.resize(nBins_, 0);
85  }
86  }
87 
88  // book 16 histograms, one for each strip in a calibration group --> APV2 --> 16 = dimension of one calChan
89  if (calib2_.find(extrainfo_) == calib2_.end()) {
91  calib2_[extrainfo_].resize(16);
92  for (int i = 0; i < 16; ++i) {
93  std::string postfix = extrainfo_ + "_istrip_" + std::to_string(i);
95  runType_,
97  fedKey(),
99  connection().i2cAddr(1),
100  postfix)
101  .title();
102 
104  calib2_[extrainfo_][i].histo(dqm()->book1D(title, title, nBins_, 0, 200));
106  calib2_[extrainfo_][i].histo(dqm()->book1D(title, title, nBins_, 0, 250));
107 
108  calib2_[extrainfo_][i].isProfile_ = false;
109  calib2_[extrainfo_][i].vNumOfEntries_.resize(nBins_, 0);
110  }
111  }
112 }
Utility class that holds histogram title.
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:647
std::map< std::string, std::vector< HistoSet > > calib2_
std::string extrainfo_
std::string directory_
static std::string to_string(const XMLCh *ch)
std::map< std::string, std::vector< HistoSet > > calib1_
sistrip::RunType runType_
const uint32_t & fedKey() const
DQMStore *const dqm() const
const std::string & title() const
const FedChannelConnection & connection() const
#define LogDebug(id)

◆ fill()

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

Reimplemented from CommissioningTask.

Definition at line 116 of file CalibrationTask.cc.

References newFWLiteAna::bin, book(), calib1_, calib2_, sistrip::CALIBRATION, sistrip::CALIBRATION_DECO, edm::DetSet< T >::data, extrainfo_, dqmdumpme::k, lastCalChan_, lastCalSel_, lastLatency_, LogDebug, ped, runType_, edmLumisInFiles::summary, to_string(), update(), and CommissioningTask::updateHistoSet().

116  {
117  LogDebug("Commissioning") << "[CalibrationTask::fill]";
118 
119  if (lastCalChan_ != summary.calChan()) { // change in the calChan value
120  lastCalChan_ = summary.calChan();
121  lastLatency_ = summary.latency();
122  lastCalSel_ = summary.calSel();
123  extrainfo_ = "calChan_" + std::to_string(lastCalChan_);
124  book(); // book histograms and load the right one
125  } else {
126  lastCalChan_ = summary.calChan();
127  lastLatency_ = summary.latency();
128  lastCalSel_ = summary.calSel();
129  extrainfo_ = "calChan_" + std::to_string(lastCalChan_);
130  }
131 
132  // Check if CalChan changed. In that case, save, reset histo, change title, and continue
133  int isub = lastCalChan_ < 4 ? lastCalChan_ + 4 : lastCalChan_ - 4;
134  int bin = 0;
135 
137  bin = (100 - summary.latency()) * 8 + (7 - summary.calSel());
139  bin = (102 - summary.latency()) * 8 + (7 - summary.calSel());
140 
141  // Fill the histograms data-ped -(data-ped)_isub, the second term corresponds to the common mode substraction, looking at a strip far away.
142  for (int k = 0; k < 16; ++k) {
144  bin,
145  digis.data[lastCalChan_ + k * 8].adc() - ped[lastCalChan_ + k * 8] -
146  (digis.data[isub + k * 8].adc() - ped[isub + k * 8]));
148  bin,
149  digis.data[128 + lastCalChan_ + k * 8].adc() - ped[128 + lastCalChan_ + k * 8] -
150  (digis.data[128 + isub + k * 8].adc() - ped[128 + isub + k * 8]));
151  }
152  update(); //TODO: temporary: find a better solution later
153 }
void update() override
uint16_t lastCalSel_
std::map< std::string, std::vector< HistoSet > > calib2_
std::string extrainfo_
static std::string to_string(const XMLCh *ch)
uint16_t lastLatency_
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
uint16_t lastCalChan_
std::map< std::string, std::vector< HistoSet > > calib1_
sistrip::RunType runType_
std::vector< uint16_t > ped
void book() override
collection_type data
Definition: DetSet.h:80
#define LogDebug(id)

◆ setCurrentFolder()

void CalibrationTask::setCurrentFolder ( const std::string &  dir)

Definition at line 171 of file CalibrationTask.cc.

References DeadROC_duringRun::dir, and directory_.

◆ update()

void CalibrationTask::update ( )
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 157 of file CalibrationTask.cc.

References calib1_, calib2_, LogDebug, and CommissioningTask::updateHistoSet().

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

157  {
158  LogDebug("Commissioning") << "[CalibrationTask::update]"; // huge output
159 
160  for (const auto& element : calib1_) { // all pulse for different calChan
161  for (auto vecelement : element.second) // all strips in a calCan
162  updateHistoSet(vecelement);
163  }
164 
165  for (const auto& element : calib2_) { // all pulse for different calChan
166  for (auto vecelement : element.second) // all strips in a calCan
167  updateHistoSet(vecelement);
168  }
169 }
std::map< std::string, std::vector< HistoSet > > calib2_
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
std::map< std::string, std::vector< HistoSet > > calib1_
#define LogDebug(id)

Member Data Documentation

◆ calib1_

std::map<std::string, std::vector<HistoSet> > CalibrationTask::calib1_
private

Definition at line 29 of file CalibrationTask.h.

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

◆ calib2_

std::map<std::string, std::vector<HistoSet> > CalibrationTask::calib2_
private

Definition at line 30 of file CalibrationTask.h.

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

◆ directory_

std::string CalibrationTask::directory_
private

Definition at line 35 of file CalibrationTask.h.

Referenced by book(), and setCurrentFolder().

◆ extrainfo_

std::string CalibrationTask::extrainfo_
private

Definition at line 34 of file CalibrationTask.h.

Referenced by book(), and fill().

◆ lastCalChan_

uint16_t CalibrationTask::lastCalChan_
private

Definition at line 33 of file CalibrationTask.h.

Referenced by fill().

◆ lastCalSel_

uint16_t CalibrationTask::lastCalSel_
private

Definition at line 33 of file CalibrationTask.h.

Referenced by fill().

◆ lastLatency_

uint16_t CalibrationTask::lastLatency_
private

Definition at line 33 of file CalibrationTask.h.

Referenced by fill().

◆ nBins_

uint16_t CalibrationTask::nBins_
private

Definition at line 32 of file CalibrationTask.h.

Referenced by book(), and CalibrationTask().

◆ ped

std::vector<uint16_t> CalibrationTask::ped
private

Definition at line 36 of file CalibrationTask.h.

Referenced by CalibrationTask(), and fill().

◆ run_

uint32_t CalibrationTask::run_
private

Definition at line 37 of file CalibrationTask.h.

◆ runType_

sistrip::RunType CalibrationTask::runType_
private

Definition at line 28 of file CalibrationTask.h.

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