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 edm::EventSetup &setup)
 
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

- 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 CalibrationTask.h.

Constructor & Destructor Documentation

CalibrationTask::CalibrationTask ( DQMStore dqm,
const FedChannelConnection conn,
const sistrip::RunType rtype,
const char *  filename,
uint32_t  run,
const edm::EventSetup setup 
)

Definition at line 20 of file CalibrationTask.cc.

References FedChannelConnection::apvPairNumber(), sistrip::CALIBRATION, sistrip::CALIBRATION_DECO, FedChannelConnection::detId(), edm::EventSetup::get(), SiStripPedestals::getPed(), SiStripPedestals::getRange(), createfilelist::int, LogDebug, nBins_, ped, runType_, and digitizers_cfi::strip.

25  :
26  CommissioningTask( dqm, conn, "CalibrationTask" ),
27  runType_(rtype),
28  nBins_(0),
29  lastCalChan_(1000),
30  lastCalSel_(1000),
31  lastLatency_(1000),
32  extrainfo_(),
33  run_(run)
34 {
35 
36  // each latency point is 25ns, each calSel is 25/8 --> 64 points = 8 calsel + 8 latency --> as set in the DAQ configuration
38  // each latency point is 25ns, each calSel is 25/8 --> 80 points = 8 calsel + 10 latency --> as set in the DAQ configuration
39  else if(runType_ == sistrip::CALIBRATION_DECO) nBins_ = 80;
40 
41  LogDebug("Commissioning") << "[CalibrationTask::CalibrationTask] Constructing object...";
42 
43  // load the pedestals
44  edm::ESHandle<SiStripPedestals> pedestalsHandle;
45  setup.get<SiStripPedestalsRcd>().get(pedestalsHandle);
46  SiStripPedestals::Range detPedRange = pedestalsHandle->getRange(conn.detId());
47  int start = conn.apvPairNumber()*256;
48  int stop = start + 256;
49  int value = 0;
50  ped.reserve(256);
51  for(int strip = start; strip < stop; ++strip) {
52  value = int(pedestalsHandle->getPed(strip,detPedRange));
53  if(value>895) value -= 1024;
54  ped.push_back(value);
55  }
56 }
#define LogDebug(id)
Definition: start.py:1
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_
Definition: value.py:1
std::vector< uint16_t > ped
T get() const
Definition: EventSetup.h:71
const Range getRange(const uint32_t &detID) const
CalibrationTask::~CalibrationTask ( )
override

Definition at line 60 of file CalibrationTask.cc.

References LogDebug.

60  {
61  LogDebug("Commissioning") << "[CalibrationTask::CalibrationTask] Destructing object...";
62 }
#define LogDebug(id)

Member Function Documentation

void CalibrationTask::book ( )
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 66 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_, tablePrinter::postfix, runType_, DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, fftjetcommon_cfi::title, and SiStripHistoTitle::title().

Referenced by fill().

66  {
67 
68  LogDebug("Commissioning") << "[CalibrationTask::book]";
69 
70  // book 16 histograms, one for each strip in a calibration group --> APV1 --> 16 = dimension of one calChan
71  if(calib1_.find(extrainfo_) == calib1_.end()){
73  calib1_[extrainfo_].resize(16);
74  for(int i = 0; i < 16; ++i) {
75  std::string postfix = extrainfo_+"_istrip_"+std::to_string(i);
77  runType_,
79  fedKey(),
80  sistrip::APV,
81  connection().i2cAddr(0),
82  postfix).title();
83 
85  calib1_[extrainfo_][i].histo( dqm()->book1D( title, title, nBins_, 0, 200));
87  calib1_[extrainfo_][i].histo( dqm()->book1D( title, title, nBins_, 0, 250));
88  calib1_[extrainfo_][i].isProfile_ = false;
89  calib1_[extrainfo_][i].vNumOfEntries_.resize(nBins_,0);
90  }
91  }
92 
93  // book 16 histograms, one for each strip in a calibration group --> APV2 --> 16 = dimension of one calChan
94  if(calib2_.find(extrainfo_) == calib2_.end()){
95 
97  calib2_[extrainfo_].resize(16);
98  for(int i = 0; i < 16; ++i) {
99  std::string postfix = extrainfo_+"_istrip_"+std::to_string(i);
101  runType_,
103  fedKey(),
104  sistrip::APV,
105  connection().i2cAddr(1),
106  postfix).title();
107 
109  calib2_[extrainfo_][i].histo( dqm()->book1D( title, title, nBins_, 0, 200));
111  calib2_[extrainfo_][i].histo( dqm()->book1D( title, title, nBins_, 0, 250));
112 
113  calib2_[extrainfo_][i].isProfile_ = false;
114  calib2_[extrainfo_][i].vNumOfEntries_.resize(nBins_,0);
115  }
116  }
117 }
#define LogDebug(id)
Utility class that holds histogram title.
const std::string & title() const
std::map< std::string, std::vector< HistoSet > > calib1_
std::string extrainfo_
std::string directory_
sistrip::RunType runType_
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:571
DQMStore *const dqm() const
const uint32_t & fedKey() const
std::map< std::string, std::vector< HistoSet > > calib2_
const FedChannelConnection & connection() const
void CalibrationTask::fill ( const SiStripEventSummary summary,
const edm::DetSet< SiStripRawDigi > &  digis 
)
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 121 of file CalibrationTask.cc.

References stringResolutionProvider_cfi::bin, book(), SiStripEventSummary::calChan(), calib1_, calib2_, sistrip::CALIBRATION, sistrip::CALIBRATION_DECO, SiStripEventSummary::calSel(), edm::DetSet< T >::data, extrainfo_, gen::k, lastCalChan_, lastCalSel_, lastLatency_, SiStripEventSummary::latency(), LogDebug, ped, runType_, update(), and CommissioningTask::updateHistoSet().

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

Definition at line 173 of file CalibrationTask.cc.

References dir, and directory_.

173  {
174  directory_ = dir;
175 }
std::string directory_
dbl *** dir
Definition: mlp_gen.cc:35
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__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), fill(), dqm-mbProfile.Profile::finish(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

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

Member Data Documentation

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

Definition at line 27 of file CalibrationTask.h.

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

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

Definition at line 28 of file CalibrationTask.h.

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

std::string CalibrationTask::directory_
private

Definition at line 33 of file CalibrationTask.h.

Referenced by book(), and setCurrentFolder().

std::string CalibrationTask::extrainfo_
private

Definition at line 32 of file CalibrationTask.h.

Referenced by book(), and fill().

uint16_t CalibrationTask::lastCalChan_
private

Definition at line 31 of file CalibrationTask.h.

Referenced by fill().

uint16_t CalibrationTask::lastCalSel_
private

Definition at line 31 of file CalibrationTask.h.

Referenced by fill().

uint16_t CalibrationTask::lastLatency_
private

Definition at line 31 of file CalibrationTask.h.

Referenced by fill().

uint16_t CalibrationTask::nBins_
private

Definition at line 30 of file CalibrationTask.h.

Referenced by book(), and CalibrationTask().

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

Definition at line 34 of file CalibrationTask.h.

Referenced by CalibrationTask(), and fill().

uint32_t CalibrationTask::run_
private

Definition at line 35 of file CalibrationTask.h.

sistrip::RunType CalibrationTask::runType_
private

Definition at line 26 of file CalibrationTask.h.

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