CMS 3D CMS Logo

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

#include <OptoScanTask.h>

Inheritance diagram for OptoScanTask:
CommissioningTask

Public Member Functions

 OptoScanTask (DQMStore *dqm, const FedChannelConnection &conn)
 
 ~OptoScanTask () 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 &summary, const edm::DetSet< SiStripRawDigi > &digis) override
 
void locateTicks (const edm::DetSet< SiStripRawDigi > &scope_mode_data, std::pair< float, float > &digital_range, std::vector< float > &baseline, float &baseline_rms)
 
void update () override
 

Private Attributes

uint16_t nBins_
 
std::vector< std::vector< HistoSet > > opto_
 

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

Constructor & Destructor Documentation

OptoScanTask::OptoScanTask ( DQMStore dqm,
const FedChannelConnection conn 
)

Definition at line 16 of file OptoScanTask.cc.

17  : CommissioningTask(dqm, conn, "OptoScanTask"), opto_() {}
std::vector< std::vector< HistoSet > > opto_
Definition: OptoScanTask.h:24
OptoScanTask::~OptoScanTask ( )
override

Definition at line 21 of file OptoScanTask.cc.

21 {}

Member Function Documentation

void OptoScanTask::book ( )
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 25 of file OptoScanTask.cc.

References sistrip::extrainfo::baselineRms_, CommissioningTask::connection(), sistrip::extrainfo::digital_, CommissioningTask::dqm(), sistrip::EXPERT_HISTO, sistrip::FED_KEY, CommissioningTask::fedKey(), sistrip::extrainfo::gain_, sistrip::LLD_CHAN, LaserClient_cfi::nbins, opto_, sistrip::OPTO_SCAN, AlCaHLTBitMon_QueryRunRegistry::string, and overlapproblemtsosanalyzer_cfi::title.

25  {
26  uint16_t nbins = 50;
27  uint16_t gains = 4;
28 
29  // Resize "histo sets"
30  opto_.resize(gains);
31  for (uint16_t igain = 0; igain < opto_.size(); igain++) {
32  opto_[igain].resize(3);
33  }
34 
35  for (uint16_t igain = 0; igain < opto_.size(); igain++) {
36  for (uint16_t ihisto = 0; ihisto < 3; ihisto++) {
37  // Extra info
38  std::stringstream extra_info;
39  extra_info << sistrip::extrainfo::gain_ << igain;
40  if (ihisto == 0 || ihisto == 1) {
41  extra_info << sistrip::extrainfo::digital_ << ihisto;
42  } else {
44  }
45 
46  // Title
50  fedKey(),
52  connection().lldChannel(),
53  extra_info.str())
54  .title();
55 
56  // Book histo
57  opto_[igain][ihisto].histo(dqm()->bookProfile(title,
58  title,
59  nbins,
60  0.5,
61  nbins * 1. + 0.5, // range is bias setting (1-50)
62  1024,
63  -0.5,
64  1023.5));
65 
66  opto_[igain][ihisto].vNumOfEntries_.resize(nbins, 0);
67  opto_[igain][ihisto].vSumOfContents_.resize(nbins, 0);
68  opto_[igain][ihisto].vSumOfSquares_.resize(nbins, 0);
69 
70  } // end loop on histos
71  } // end loop on gains
72 }
Utility class that holds histogram title.
static const char baselineRms_[]
std::vector< std::vector< HistoSet > > opto_
Definition: OptoScanTask.h:24
DQMStore *const dqm() const
static const char digital_[]
static const char gain_[]
const uint32_t & fedKey() const
const FedChannelConnection & connection() const
void OptoScanTask::fill ( const SiStripEventSummary summary,
const edm::DetSet< SiStripRawDigi > &  digis 
)
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 76 of file OptoScanTask.cc.

References newFWLiteAna::bin, edm::DetSet< T >::data, PedestalClient_cfi::gain, sistrip::invalid_, SiStripEventSummary::lldBias(), SiStripEventSummary::lldGain(), locateTicks(), sistrip::mlDqmSource_, opto_, findQualityFiles::size, CommissioningTask::updateHistoSet(), and sistrip::valid_.

76  {
77  //@@ if scope mode length is in trigger fed, then
78  //@@ can add check here on number of digis
79  if (digis.data.empty()) {
80  edm::LogWarning(mlDqmSource_) << "[OptoScanTask::" << __func__ << "]"
81  << " Unexpected number of digis! " << digis.data.size();
82  } else {
83  // Retrieve opt bias and gain setting from SiStripEventSummary
84  uint16_t gain = summary.lldGain();
85  uint16_t bias = summary.lldBias();
86 
87  if (gain >= opto_.size()) {
88  opto_.resize(gain);
89  for (uint16_t igain = 0; igain < opto_.size(); igain++) {
90  if (opto_[gain].size() != 3) {
91  opto_[gain].resize(3);
92  }
93  }
94  edm::LogWarning(mlDqmSource_) << "[OptoScanTask::" << __func__ << "]"
95  << " Unexpected gain value! " << gain;
96  }
97 
98  if (bias > 50) {
99  return;
100  } // only use bias settings 1-50
101 
102  // Find digital "0" and digital "1" levels from tick marks within scope mode data
103  std::vector<float> baseline;
104  std::pair<float, float> digital_range;
105  digital_range.first = sistrip::invalid_;
106  digital_range.second = sistrip::invalid_;
107  float baseline_rms = sistrip::invalid_;
108 
109  locateTicks(digis, digital_range, baseline, baseline_rms);
110 
111  uint16_t bin = bias - 1; // fill "bins" (0-49), not bias (1-50)
112 
113  // Digital "0"
114  if (digital_range.first < 1. * sistrip::valid_) {
115  updateHistoSet(opto_[gain][0], bin, digital_range.first);
116  }
117 
118  // Digital "1"
119  if (digital_range.second < 1. * sistrip::valid_) {
120  updateHistoSet(opto_[gain][1], bin, digital_range.second);
121  }
122 
123  // Baseline rms
124  if (baseline_rms < 1. * sistrip::valid_) {
125  updateHistoSet(opto_[gain][2], bin, baseline_rms);
126  }
127  }
128 }
size
Write out results.
static const char mlDqmSource_[]
static const uint16_t valid_
Definition: Constants.h:17
const uint32_t & lldGain() const
const uint32_t & lldBias() const
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
std::vector< std::vector< HistoSet > > opto_
Definition: OptoScanTask.h:24
static const uint16_t invalid_
Definition: Constants.h:16
collection_type data
Definition: DetSet.h:81
void locateTicks(const edm::DetSet< SiStripRawDigi > &scope_mode_data, std::pair< float, float > &digital_range, std::vector< float > &baseline, float &baseline_rms)
void OptoScanTask::locateTicks ( const edm::DetSet< SiStripRawDigi > &  scope_mode_data,
std::pair< float, float > &  digital_range,
std::vector< float > &  baseline,
float &  baseline_rms 
)
private

Definition at line 142 of file OptoScanTask.cc.

References ecalMGPA::adc(), filterCSVwithJSON::copy, edm::DetSet< T >::data, cuy::ii, findQualityFiles::jj, sistrip::mlDqmSource_, and mathSSE::sqrt().

Referenced by fill().

145  {
146  // Copy ADC values and sort
147  std::vector<uint16_t> adc;
148  adc.reserve(digis.data.size());
149  for (uint16_t iadc = 0; iadc < digis.data.size(); iadc++) {
150  // only take the adc from the first APV (multiplexing alternates the digis)
151  // this was asked by Karl et al
152  if (iadc % 2 == 0) {
153  adc.push_back(digis.data[iadc].adc());
154  }
155  }
156  sort(adc.begin(), adc.end());
157 
158  // To make sure we have a tickmark, which comes every 70 bxs,
159  // fully contained in the scope 'frame' we are analyzing
160  // standard length is 280, sufficient to contain a full apv frame
161  // in this run there is no frame though, just baseline and tickmarks
162  if (adc.size() > 70) {
163  // Define tick mark top" level as "max" ADC values
164  range.second = adc.back();
165 
166  // Construct vector to hold "baseline samples" (exclude tick mark samples)
167  std::vector<uint16_t> truncated;
168  std::vector<uint16_t>::const_iterator ii = adc.begin();
169  // remove twice the expected number of tick samples, otherwise you bias the baseline mean and rms
170  std::vector<uint16_t>::const_iterator jj = adc.end() - 4 * ((adc.size() / 70) + 1);
171  truncated.resize(jj - ii);
172  std::copy(ii, jj, truncated.begin());
173  if (truncated.empty()) {
174  return;
175  }
176 
177  // Calc mean baseline level
178  float b_mean = 0.;
179  std::vector<uint16_t>::const_iterator iii = truncated.begin();
180  std::vector<uint16_t>::const_iterator jjj = truncated.end();
181  for (; iii != jjj; ++iii) {
182  b_mean += *iii;
183  }
184  b_mean /= (1. * truncated.size());
185  range.first = b_mean;
186 
187  // Calc baseline noise
188  float b_rms = 0.;
189  std::vector<uint16_t>::const_iterator iiii = truncated.begin();
190  std::vector<uint16_t>::const_iterator jjjj = truncated.end();
191  for (; iiii != jjjj; ++iiii) {
192  b_rms += fabs(*iiii - b_mean);
193  }
194  // Set baseline "noise" (requires any possible APV frames are filtered from the data!)
195  baseline_rms = sqrt(b_rms / (1. * truncated.size()));
196 
197  } else {
198  edm::LogWarning(mlDqmSource_) << "[OptoScanTask::" << __func__ << "]"
199  << " Insufficient ADC values: " << adc.size();
200  }
201 }
static const char mlDqmSource_[]
T sqrt(T t)
Definition: SSEVec.h:19
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
ii
Definition: cuy.py:590
void OptoScanTask::update ( )
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 132 of file OptoScanTask.cc.

References opto_, 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(), 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().

132  {
133  for (uint16_t igain = 0; igain < opto_.size(); igain++) {
134  for (uint16_t ihisto = 0; ihisto < opto_[igain].size(); ihisto++) {
135  updateHistoSet(opto_[igain][ihisto]);
136  }
137  }
138 }
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
std::vector< std::vector< HistoSet > > opto_
Definition: OptoScanTask.h:24

Member Data Documentation

uint16_t OptoScanTask::nBins_
private

Definition at line 25 of file OptoScanTask.h.

std::vector<std::vector<HistoSet> > OptoScanTask::opto_
private

Definition at line 24 of file OptoScanTask.h.

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