CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ( 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 FedChannelConnection::apvPairNumber(), sistrip::CALIBRATION, sistrip::CALIBRATION_DECO, FedChannelConnection::detId(), SiStripPedestals::getPed(), SiStripPedestals::getRange(), LogDebug, nBins_, ped, runType_, command_line::start, digitizers_cfi::strip, and relativeConstraints::value.

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 }
uint16_t lastCalSel_
uint16_t apvPairNumber() const
std::string extrainfo_
std::pair< ContainerIterator, ContainerIterator > Range
uint16_t lastLatency_
float getPed(const uint16_t &strip, const Range &range) const
const uint32_t & detId() const
uint16_t lastCalChan_
sistrip::RunType runType_
std::vector< uint16_t > ped
const Range getRange(const uint32_t &detID) const
#define LogDebug(id)
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

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_, runType_, dqm::implementation::DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, SiStripHistoTitle::title(), and runGCPTkAlMap::title.

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.
const std::string & title() const
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:569
std::map< std::string, std::vector< HistoSet > > calib2_
std::string extrainfo_
std::string directory_
DQMStore *const dqm() const
std::map< std::string, std::vector< HistoSet > > calib1_
sistrip::RunType runType_
const uint32_t & fedKey() const
const FedChannelConnection & connection() const
#define LogDebug(id)
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(), SiStripEventSummary::calChan(), calib1_, calib2_, sistrip::CALIBRATION, sistrip::CALIBRATION_DECO, SiStripEventSummary::calSel(), edm::DetSet< T >::data, extrainfo_, isotrackApplyRegressor::k, lastCalChan_, lastCalSel_, lastLatency_, SiStripEventSummary::latency(), LogDebug, ped, runType_, 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_
const uint32_t & latency() const
std::map< std::string, std::vector< HistoSet > > calib2_
std::string extrainfo_
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_
const uint32_t & calSel() const
std::vector< uint16_t > ped
void book() override
collection_type data
Definition: DetSet.h:80
const uint32_t & calChan() const
#define LogDebug(id)
void CalibrationTask::setCurrentFolder ( const std::string &  dir)

Definition at line 171 of file CalibrationTask.cc.

References DeadROC_duringRun::dir, and directory_.

171 { directory_ = dir; }
std::string directory_
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

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

Definition at line 29 of file CalibrationTask.h.

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

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

Definition at line 30 of file CalibrationTask.h.

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

std::string CalibrationTask::directory_
private

Definition at line 35 of file CalibrationTask.h.

Referenced by book(), and setCurrentFolder().

std::string CalibrationTask::extrainfo_
private

Definition at line 34 of file CalibrationTask.h.

Referenced by book(), and fill().

uint16_t CalibrationTask::lastCalChan_
private

Definition at line 33 of file CalibrationTask.h.

Referenced by fill().

uint16_t CalibrationTask::lastCalSel_
private

Definition at line 33 of file CalibrationTask.h.

Referenced by fill().

uint16_t CalibrationTask::lastLatency_
private

Definition at line 33 of file CalibrationTask.h.

Referenced by fill().

uint16_t CalibrationTask::nBins_
private

Definition at line 32 of file CalibrationTask.h.

Referenced by book(), and CalibrationTask().

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

Definition at line 36 of file CalibrationTask.h.

Referenced by CalibrationTask(), and fill().

uint32_t CalibrationTask::run_
private

Definition at line 37 of file CalibrationTask.h.

sistrip::RunType CalibrationTask::runType_
private

Definition at line 28 of file CalibrationTask.h.

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