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 (CompactHistoSet &)
 
void updateHistoSet (CompactHistoSet &, const uint32_t &bin)
 
void updateHistoSet (CompactHistoSet &, const uint32_t &bin, const short &value)
 
void updateHistoSet (HistoSet &)
 
void updateHistoSet (HistoSet &, const float &value)
 
void updateHistoSet (HistoSet &, const uint32_t &bin)
 
void updateHistoSet (HistoSet &, const uint32_t &bin, const float &value)
 

Detailed Description

Definition at line 10 of file OptoScanTask.h.

Constructor & Destructor Documentation

◆ OptoScanTask()

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

Definition at line 16 of file OptoScanTask.cc.

17  : CommissioningTask(dqm, conn, "OptoScanTask"), opto_() {}

◆ ~OptoScanTask()

OptoScanTask::~OptoScanTask ( )
override

Definition at line 21 of file OptoScanTask.cc.

21 {}

Member Function Documentation

◆ book()

void OptoScanTask::book ( )
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 25 of file OptoScanTask.cc.

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 }

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 runGCPTkAlMap::title.

◆ fill()

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

Reimplemented from CommissioningTask.

Definition at line 76 of file OptoScanTask.cc.

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 }

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

◆ locateTicks()

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.

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 }

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

Referenced by fill().

◆ update()

void OptoScanTask::update ( )
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 132 of file OptoScanTask.cc.

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 }

References opto_, and CommissioningTask::updateHistoSet().

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

Member Data Documentation

◆ nBins_

uint16_t OptoScanTask::nBins_
private

Definition at line 25 of file OptoScanTask.h.

◆ opto_

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

Definition at line 24 of file OptoScanTask.h.

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

sistrip::mlDqmSource_
static const char mlDqmSource_[]
Definition: ConstantsForLogger.h:20
OptoScanTask::locateTicks
void locateTicks(const edm::DetSet< SiStripRawDigi > &scope_mode_data, std::pair< float, float > &digital_range, std::vector< float > &baseline, float &baseline_rms)
Definition: OptoScanTask.cc:142
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
CommissioningTask::connection
const FedChannelConnection & connection() const
Definition: CommissioningTask.h:189
gpuClustering::adc
uint16_t *__restrict__ uint16_t const *__restrict__ adc
Definition: gpuClusterChargeCut.h:20
sistrip::OPTO_SCAN
Definition: ConstantsForRunType.h:74
SiStripCommissioningClient_cfg.conn
conn
Definition: SiStripCommissioningClient_cfg.py:5
sistrip::extrainfo::digital_
static const char digital_[]
Definition: ConstantsForDqm.h:40
sistrip::extrainfo::baselineRms_
static const char baselineRms_[]
Definition: ConstantsForDqm.h:41
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
CommissioningTask::fedKey
const uint32_t & fedKey() const
Definition: CommissioningTask.h:192
sistrip::valid_
static const uint16_t valid_
Definition: Constants.h:17
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
sistrip::EXPERT_HISTO
Definition: ConstantsForHistoType.h:29
LaserClient_cfi.nbins
nbins
Definition: LaserClient_cfi.py:51
CommissioningTask::CommissioningTask
CommissioningTask()
Definition: CommissioningTask.h:143
OptoScanTask::opto_
std::vector< std::vector< HistoSet > > opto_
Definition: OptoScanTask.h:24
sistrip::extrainfo::gain_
static const char gain_[]
Definition: ConstantsForDqm.h:39
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
edmLumisInFiles.summary
summary
Definition: edmLumisInFiles.py:39
CommissioningTask::updateHistoSet
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
Definition: CommissioningTask.cc:274
sistrip::invalid_
static const uint16_t invalid_
Definition: Constants.h:16
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
CommissioningTask::dqm
DQMStore *const dqm() const
Definition: CommissioningTask.h:188
findQualityFiles.jj
string jj
Definition: findQualityFiles.py:188
edm::DetSet::data
collection_type data
Definition: DetSet.h:80
SiStripHistoTitle
Utility class that holds histogram title.
Definition: SiStripHistoTitle.h:20
dqm
Definition: DQMStore.h:18
sistrip::FED_KEY
Definition: ConstantsForKeyType.h:30
cuy.ii
ii
Definition: cuy.py:589
sistrip::LLD_CHAN
Definition: ConstantsForGranularity.h:78
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443