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 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

- 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 18 of file OptoScanTask.cc.

19  :
20  CommissioningTask( dqm, conn, "OptoScanTask" ),
21  opto_() {
22 }
std::vector< std::vector< HistoSet > > opto_
Definition: OptoScanTask.h:28
OptoScanTask::~OptoScanTask ( )
override

Definition at line 27 of file OptoScanTask.cc.

27  {
28 }

Member Function Documentation

void OptoScanTask::book ( )
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 33 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, pileupCalc::nbins, opto_, sistrip::OPTO_SCAN, AlCaHLTBitMon_QueryRunRegistry::string, and fftjetcommon_cfi::title.

33  {
34 
35  uint16_t nbins = 50;
36  uint16_t gains = 4;
37 
38  // Resize "histo sets"
39  opto_.resize( gains );
40  for ( uint16_t igain = 0; igain < opto_.size(); igain++ ) {
41  opto_[igain].resize(3);
42  }
43 
44  for ( uint16_t igain = 0; igain < opto_.size(); igain++ ) {
45  for ( uint16_t ihisto = 0; ihisto < 3; ihisto++ ) {
46 
47  // Extra info
48  std::stringstream extra_info;
49  extra_info << sistrip::extrainfo::gain_ << igain;
50  if ( ihisto == 0 || ihisto == 1 ) {
51  extra_info << sistrip::extrainfo::digital_ << ihisto;
52  } else {
54  }
55 
56  // Title
60  fedKey(),
62  connection().lldChannel(),
63  extra_info.str() ).title();
64 
65  // Book histo
66  opto_[igain][ihisto].histo( dqm()->bookProfile( title, title,
67  nbins, 0.5, nbins*1.+0.5, // range is bias setting (1-50)
68  1024, -0.5, 1023.5 ) );
69 
70  opto_[igain][ihisto].vNumOfEntries_.resize(nbins,0);
71  opto_[igain][ihisto].vSumOfContents_.resize(nbins,0);
72  opto_[igain][ihisto].vSumOfSquares_.resize(nbins,0);
73 
74  } // end loop on histos
75  } // end loop on gains
76 
77 }
Utility class that holds histogram title.
std::vector< std::vector< HistoSet > > opto_
Definition: OptoScanTask.h:28
static const char baselineRms_[]
static const char digital_[]
DQMStore *const dqm() const
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 82 of file OptoScanTask.cc.

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

83  {
84 
85  //@@ if scope mode length is in trigger fed, then
86  //@@ can add check here on number of digis
87  if ( digis.data.empty() ) {
89  << "[OptoScanTask::" << __func__ << "]"
90  << " Unexpected number of digis! "
91  << digis.data.size();
92  } else {
93 
94  // Retrieve opt bias and gain setting from SiStripEventSummary
95  uint16_t gain = summary.lldGain();
96  uint16_t bias = summary.lldBias();
97 
98  if ( gain >= opto_.size() ) {
99  opto_.resize( gain );
100  for ( uint16_t igain = 0; igain < opto_.size(); igain++ ) {
101  if ( opto_[gain].size() != 3 ) { opto_[gain].resize( 3 ); }
102  }
104  << "[OptoScanTask::" << __func__ << "]"
105  << " Unexpected gain value! " << gain;
106  }
107 
108  if ( bias > 50 ) { return; } // only use bias settings 1-50
109 
110  // Find digital "0" and digital "1" levels from tick marks within scope mode data
111  std::vector<float> baseline;
112  std::pair<float,float> digital_range;
113  digital_range.first = sistrip::invalid_;
114  digital_range.second = sistrip::invalid_;
115  float baseline_rms = sistrip::invalid_;
116 
117  locateTicks( digis, digital_range, baseline, baseline_rms );
118 
119  uint16_t bin = bias - 1; // fill "bins" (0-49), not bias (1-50)
120 
121  // Digital "0"
122  if ( digital_range.first < 1. * sistrip::valid_ ) {
123  updateHistoSet( opto_[gain][0], bin, digital_range.first );
124  }
125 
126  // Digital "1"
127  if ( digital_range.second < 1. * sistrip::valid_ ) {
128  updateHistoSet( opto_[gain][1], bin, digital_range.second );
129  }
130 
131  // Baseline rms
132  if ( baseline_rms < 1. * sistrip::valid_ ) {
133  updateHistoSet( opto_[gain][2], bin, baseline_rms );
134  }
135 
136  }
137 
138 }
size
Write out results.
std::vector< std::vector< HistoSet > > opto_
Definition: OptoScanTask.h:28
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)
bin
set the eta bin as selection string.
static const uint16_t invalid_
Definition: Constants.h:16
collection_type data
Definition: DetSet.h:78
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 156 of file OptoScanTask.cc.

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

Referenced by fill().

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

Reimplemented from CommissioningTask.

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

143  {
144 
145  for ( uint16_t igain = 0; igain < opto_.size(); igain++ ) {
146  for ( uint16_t ihisto = 0; ihisto < opto_[igain].size(); ihisto++ ) {
147  updateHistoSet( opto_[igain][ihisto] );
148  }
149  }
150 
151 }
std::vector< std::vector< HistoSet > > opto_
Definition: OptoScanTask.h:28
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)

Member Data Documentation

uint16_t OptoScanTask::nBins_
private

Definition at line 29 of file OptoScanTask.h.

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

Definition at line 28 of file OptoScanTask.h.

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