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 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_(64),
29  lastCalChan_(1000),
30  lastCalSel_(1000),
31  lastLatency_(1000),
32  extrainfo_(),
33  run_(run)
34 {
35 
37  else if(runType_ == sistrip::CALIBRATION_DECO) nBins_ = 80;
38 
39  LogDebug("Commissioning") << "[CalibrationTask::CalibrationTask] Constructing object...";
40  // load the pedestals
41  edm::ESHandle<SiStripPedestals> pedestalsHandle;
42  setup.get<SiStripPedestalsRcd>().get(pedestalsHandle);
43  SiStripPedestals::Range detPedRange = pedestalsHandle->getRange(conn.detId());
44  int start = conn.apvPairNumber()*256;
45  int stop = start + 256;
46  int value = 0;
47  ped.reserve(256);
48  for(int strip = start; strip < stop; ++strip) {
49  value = int(pedestalsHandle->getPed(strip,detPedRange));
50  if(value>895) value -= 1024;
51  ped.push_back(value);
52  }
53 }
#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:68
const Range getRange(const uint32_t &detID) const
CalibrationTask::~CalibrationTask ( )
override

Definition at line 57 of file CalibrationTask.cc.

References LogDebug.

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

Member Function Documentation

void CalibrationTask::book ( )
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 63 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().

63  {
64  LogDebug("Commissioning") << "[CalibrationTask::book]";
65 
66  // book 16 histograms, one for each strip in a calibration group --> APV1
67  if(calib1_.find(extrainfo_) == calib1_.end()){
69  calib1_[extrainfo_].resize(16);
70  for(int i = 0; i < 16; ++i) {
71  std::string postfix = extrainfo_+"_istrip_"+std::to_string(i);
73  runType_,
75  fedKey(),
76  sistrip::APV,
77  connection().i2cAddr(0),
78  postfix).title();
79 
80  if(runType_ == sistrip::CALIBRATION) // each latency point is 25ns, each calSel is 25/8 --> 64 points = 8 calsel + 8 latency
81  calib1_[extrainfo_][i].histo( dqm()->book1D( title, title, nBins_, 0, 200));
82  else if(runType_ == sistrip::CALIBRATION_DECO) // each latency point is 25ns, each calSel is 25/8 --> 80 points = 8 calsel + 10 latency
83  calib1_[extrainfo_][i].histo( dqm()->book1D( title, title, nBins_, 0, 250));
84  calib1_[extrainfo_][i].isProfile_ = false;
85  calib1_[extrainfo_][i].vNumOfEntries_.resize(nBins_,0);
86  }
87  }
88 
89  // book 16 histograms, one for each strip in a calibration group --> APV2
90  if(calib2_.find(extrainfo_) == calib2_.end()){
91 
93  calib2_[extrainfo_].resize(16);
94  for(int i = 0; i < 16; ++i) {
95  std::string postfix = extrainfo_+"_istrip_"+std::to_string(i);
97  runType_,
99  fedKey(),
100  sistrip::APV,
101  connection().i2cAddr(1),
102  postfix).title();
103 
104  if(runType_ == sistrip::CALIBRATION) // each latency point is 25ns, each calSel is 25/8 --> 64 points = 8 calsel + 8 latency
105  calib2_[extrainfo_][i].histo( dqm()->book1D( title, title, nBins_, 0, 200));
106  else if(runType_ == sistrip::CALIBRATION_DECO) // each latency point is 25ns, each calSel is 25/8 --> 80 points = 8 calsel + 10 latency
107  calib2_[extrainfo_][i].histo( dqm()->book1D( title, title, nBins_, 0, 250));
108 
109  calib2_[extrainfo_][i].isProfile_ = false;
110  calib2_[extrainfo_][i].vNumOfEntries_.resize(nBins_,0);
111  }
112  }
113 }
#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:565
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 117 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().

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

Definition at line 170 of file CalibrationTask.cc.

References dir, and directory_.

170  {
171  directory_ = dir;
172 }
std::string directory_
dbl *** dir
Definition: mlp_gen.cc:35
void CalibrationTask::update ( )
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 154 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().

154  {
155 
156  LogDebug("Commissioning") << "[CalibrationTask::update]"; // huge output
157 
158  for(auto element : calib1_){ // all pulse for different calChan
159  for(auto vecelement : element.second) // all strips in a calCan
160  updateHistoSet(vecelement);
161  }
162 
163  for(auto element : calib2_){ // all pulse for different calChan
164  for(auto vecelement : element.second) // all strips in a calCan
165  updateHistoSet(vecelement);
166  }
167 
168 }
#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 28 of file CalibrationTask.h.

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

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

Definition at line 29 of file CalibrationTask.h.

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

std::string CalibrationTask::directory_
private

Definition at line 34 of file CalibrationTask.h.

Referenced by book(), and setCurrentFolder().

std::string CalibrationTask::extrainfo_
private

Definition at line 33 of file CalibrationTask.h.

Referenced by book(), and fill().

uint16_t CalibrationTask::lastCalChan_
private

Definition at line 32 of file CalibrationTask.h.

Referenced by fill().

uint16_t CalibrationTask::lastCalSel_
private

Definition at line 32 of file CalibrationTask.h.

Referenced by fill().

uint16_t CalibrationTask::lastLatency_
private

Definition at line 32 of file CalibrationTask.h.

Referenced by fill().

uint16_t CalibrationTask::nBins_
private

Definition at line 31 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 35 of file CalibrationTask.h.

sistrip::RunType CalibrationTask::runType_
private

Definition at line 26 of file CalibrationTask.h.

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