CMS 3D CMS Logo

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

#include <DaqScopeModeTask.h>

Inheritance diagram for DaqScopeModeTask:
CommissioningTask

Public Member Functions

 DaqScopeModeTask (DQMStore *, const FedChannelConnection &, const edm::ParameterSet &)
 
 ~DaqScopeModeTask () 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 fill (const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &, const edm::DetSet< SiStripRawDigi > &) override
 
void update () override
 

Private Attributes

std::vector< HistoSetcm_
 
uint16_t nBins_
 
uint16_t nBinsSpy_
 
edm::ParameterSet parameters_
 parameters useful for the spy More...
 
std::vector< HistoSetpeds_
 
HistoSet scopeFrame_
 

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

Constructor & Destructor Documentation

DaqScopeModeTask::DaqScopeModeTask ( DQMStore dqm,
const FedChannelConnection conn,
const edm::ParameterSet pset 
)

Definition at line 13 of file DaqScopeModeTask.cc.

15  :
16  CommissioningTask( dqm, conn, "DaqScopeModeTask" ),
17  scopeFrame_(),
18  nBins_(256), //@@ number of strips per FED channel
19  nBinsSpy_(298), //@@ in case of spy events includes header and trailing tick
20  parameters_(pset)
21 {}
edm::ParameterSet parameters_
parameters useful for the spy
DaqScopeModeTask::~DaqScopeModeTask ( )
override

Definition at line 25 of file DaqScopeModeTask.cc.

25  {
26 }

Member Function Documentation

void DaqScopeModeTask::book ( )
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 30 of file DaqScopeModeTask.cc.

References sistrip::APV, cm_, sistrip::extrainfo::commonMode_, CommissioningTask::connection(), sistrip::DAQ_SCOPE_MODE, CommissioningTask::dqm(), edm::ParameterSet::existsAs(), sistrip::EXPERT_HISTO, sistrip::FED_KEY, CommissioningTask::fedKey(), edm::ParameterSet::getParameter(), CommissioningTask::HistoSet::histo(), CommissioningTask::HistoSet::isProfile_, sistrip::LLD_CHAN, LogTrace, sistrip::mlDqmSource_, pileupCalc::nbins, nBins_, nBinsSpy_, sistrip::extrainfo::noise_, parameters_, sistrip::extrainfo::pedestals_, peds_, scopeFrame_, sistrip::extrainfo::scopeModeFrame_, AlCaHLTBitMon_QueryRunRegistry::string, fftjetcommon_cfi::title, SiStripHistoTitle::title(), CommissioningTask::HistoSet::vNumOfEntries_, CommissioningTask::HistoSet::vSumOfContents_, and CommissioningTask::HistoSet::vSumOfSquares_.

30  {
31  LogTrace(mlDqmSource_) << "[CommissioningTask::" << __func__ << "]";
32 
34  if(not (parameters_.existsAs<bool>("isSpy") and parameters_.getParameter<bool>("isSpy"))){
35 
40  fedKey(),
42  connection().lldChannel(),
44 
45  scopeFrame_.histo( dqm()->book1D( title, title,
46  nBins_, -0.5, nBins_-0.5 ) );
47 
51  scopeFrame_.isProfile_ = false;
52  }
53  else{ // use spy run to measure pedestal and tick height
54 
55  std::string extra_info;
56  peds_.resize(2);
57  extra_info = sistrip::extrainfo::pedestals_;
58 
59  peds_[0].isProfile_ = true;
63  fedKey(),
65  connection().lldChannel(),
66  extra_info ).title();
67 
68  peds_[0].histo( dqm()->bookProfile( title, title,
69  nBins_, -0.5,nBins_*1.-0.5,
70  1025, 0., 1025. ) );
71 
72  peds_[0].vNumOfEntries_.resize(nBins_,0);
73  peds_[0].vSumOfContents_.resize(nBins_,0);
74  peds_[0].vSumOfSquares_.resize(nBins_,0);
75 
76  // Noise histogram
77  extra_info = sistrip::extrainfo::noise_;
78  peds_[1].isProfile_ = true;
79 
83  fedKey(),
85  connection().lldChannel(),
86  extra_info ).title();
87 
88  peds_[1].histo( dqm()->bookProfile( title, title,
89  nBins_, -0.5, nBins_*1.-0.5,
90  1025, 0., 1025. ) );
91 
92  peds_[1].vNumOfEntries_.resize(nBins_,0);
93  peds_[1].vSumOfContents_.resize(nBins_,0);
94  peds_[1].vSumOfSquares_.resize(nBins_,0);
95 
96  // Common mode histograms
97  cm_.resize(2);
98  int nbins = 1024;
99 
100  for ( uint16_t iapv = 0; iapv < 2; iapv++ ) {
104  fedKey(),
105  sistrip::APV,
106  connection().i2cAddr(iapv),
108 
109  cm_[iapv].histo( dqm()->book1D( title, title, nbins, -0.5, nbins*1.-0.5 ) );
110  cm_[iapv].isProfile_ = false;
111 
112  cm_[iapv].vNumOfEntries_.resize(nbins,0);
113  cm_[iapv].vNumOfEntries_.resize(nbins,0);
114  }
115 
116 
121  fedKey(),
123  connection().lldChannel(),
125 
126  scopeFrame_.histo( dqm()->bookProfile( title, title,
127  nBinsSpy_, -0.5, nBinsSpy_*1.-0.5,
128  1025, 0., 1025. ) );
129 
133  scopeFrame_.isProfile_ = true;
134 
135 
136  }
137 }
static const char noise_[]
T getParameter(std::string const &) const
std::vector< float > vNumOfEntries_
edm::ParameterSet parameters_
parameters useful for the spy
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
Utility class that holds histogram title.
const std::string & title() const
static const char mlDqmSource_[]
std::vector< float > vSumOfContents_
std::vector< HistoSet > peds_
static const char commonMode_[]
#define LogTrace(id)
std::vector< HistoSet > cm_
static const char pedestals_[]
DQMStore *const dqm() const
void histo(MonitorElement *)
static const char scopeModeFrame_[]
const uint32_t & fedKey() const
std::vector< double > vSumOfSquares_
const FedChannelConnection & connection() const
void DaqScopeModeTask::fill ( const SiStripEventSummary summary,
const edm::DetSet< SiStripRawDigi > &  digis 
)
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 141 of file DaqScopeModeTask.cc.

References ecalMGPA::adc(), create_public_pileup_plots::bins, cm_, edm::DetSet< T >::data, diffTreeTool::diff, edm::ParameterSet::existsAs(), CommissioningTask::fillCntr(), edm::ParameterSet::getParameter(), sistrip::mlDqmSource_, pileupCalc::nbins, nBins_, parameters_, peds_, scopeFrame_, CommissioningTask::updateFreq(), and CommissioningTask::updateHistoSet().

142  {
143 
144  // Only fill every 'N' events
145  if(not (parameters_.existsAs<bool>("isSpy") and parameters_.getParameter<bool>("isSpy"))){
146  if ( !updateFreq() || fillCntr()%updateFreq() ) { return; }
147  }
148 
149  if ( digis.data.size() != nBins_ ) { //@@ check scope mode length?
151  << "[DaqScopeModeTask::" << __func__ << "]"
152  << " Unexpected number of digis ("
153  << digis.data.size()
154  << ") wrt number of histogram bins ("
155  << nBins_ << ")!";
156  }
157 
158 
159  if(not (parameters_.existsAs<bool>("isSpy") and parameters_.getParameter<bool>("isSpy"))){
160  uint16_t bins = digis.data.size() < nBins_ ? digis.data.size() : nBins_;
161  for ( uint16_t ibin = 0; ibin < bins; ibin++ ) {
162  updateHistoSet( scopeFrame_, ibin, digis.data[ibin].adc() );
163  }
164  }
165  else{
166  // fill the pedestal histograms as done in the pedestal task
167  // Check number of digis
168  uint16_t nbins = peds_[0].vNumOfEntries_.size();
169  if ( digis.data.size() < nbins ) { nbins = digis.data.size(); }
170 
171  uint16_t napvs = nbins / 128;
172  std::vector<uint32_t> cm; cm.resize(napvs,0);
173 
174  // Calc common mode for both APVs
175  std::vector<uint16_t> adc;
176  for ( uint16_t iapv = 0; iapv < napvs; iapv++ ) {
177  adc.clear(); adc.reserve(128);
178 
179  for ( uint16_t ibin = 0; ibin < 128; ibin++ ) {
180  if ( (iapv*128)+ibin < nbins ) {
181  adc.push_back( digis.data[(iapv*128)+ibin].adc() );
182  }
183  }
184 
185  sort( adc.begin(), adc.end() );
186  uint16_t index = adc.size()%2 ? adc.size()/2 : adc.size()/2-1;
187  if ( !adc.empty() ) { cm[iapv] = static_cast<uint32_t>( adc[index] ); }
188  }
189  for ( uint16_t ibin = 0; ibin < nbins; ibin++ ) {
190  float digiVal = digis.data[ibin].adc();
191  updateHistoSet( peds_[0], ibin, digiVal ); // peds and raw noise
192  float diff = digiVal - static_cast<float>( cm[ibin/128] );
193  updateHistoSet( peds_[1], ibin, diff ); // residuals and real noise
194  }
195 
196  if ( cm.size() < cm_.size() ) {
198  << "[PedestalsTask::" << __func__ << "]"
199  << " Fewer CM values than expected: " << cm.size();
200  }
201 
202  updateHistoSet( cm_[0], cm[0] );
203  updateHistoSet( cm_[1], cm[1] );
204  }
205 
206 }
int adc(sample_type sample)
get the ADC sample (12 bits)
T getParameter(std::string const &) const
edm::ParameterSet parameters_
parameters useful for the spy
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
static const char mlDqmSource_[]
const uint32_t & updateFreq() const
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
std::vector< HistoSet > peds_
std::vector< HistoSet > cm_
const uint32_t & fillCntr() const
collection_type data
Definition: DetSet.h:78
void DaqScopeModeTask::fill ( const SiStripEventSummary summary,
const edm::DetSet< SiStripRawDigi > &  digis,
const edm::DetSet< SiStripRawDigi > &  digisAlt 
)
overrideprivatevirtual

Calculate pedestal

Reimplemented from CommissioningTask.

Definition at line 210 of file DaqScopeModeTask.cc.

References ecalMGPA::adc(), create_public_pileup_plots::bins, cm_, edm::DetSet< T >::data, diffTreeTool::diff, edm::ParameterSet::existsAs(), CommissioningTask::fillCntr(), edm::ParameterSet::getParameter(), sistrip::mlDqmSource_, pileupCalc::nbins, nBins_, nBinsSpy_, parameters_, peds_, scopeFrame_, CommissioningTask::updateFreq(), and CommissioningTask::updateHistoSet().

212  {
213 
214  // Only fill every 'N' events
215  if(not (parameters_.existsAs<bool>("isSpy") and parameters_.getParameter<bool>("isSpy"))){
216  if ( !updateFreq() || fillCntr()%updateFreq() ) { return; }
217  }
218 
219  if ( digis.data.size() != nBins_ ) { //@@ check scope mode length?
221  << "[DaqScopeModeTask::" << __func__ << "]"
222  << " Unexpected number of digis ("
223  << digis.data.size()
224  << ") wrt number of histogram bins ("
225  << nBins_ << ")!";
226  }
227 
228  if(not (parameters_.existsAs<bool>("isSpy") and parameters_.getParameter<bool>("isSpy"))){
229  uint16_t bins = digis.data.size() < nBins_ ? digis.data.size() : nBins_;
230  for ( uint16_t ibin = 0; ibin < bins; ibin++ ) {
231  updateHistoSet( scopeFrame_, ibin, digis.data[ibin].adc() );
232  }
233  }
234  else{
235  // fill the pedestal histograms as done in the pedestal task
236  // Check number of digis
237  uint16_t nbins = peds_[0].vNumOfEntries_.size();
238  if ( digis.data.size() < nbins ) { nbins = digis.data.size(); }
239 
240  uint16_t napvs = nbins / 128;
241  std::vector<uint32_t> cm; cm.resize(napvs,0);
242 
243  // Calc common mode for both APVs
244  std::vector<uint16_t> adc;
245  for ( uint16_t iapv = 0; iapv < napvs; iapv++ ) {
246  adc.clear(); adc.reserve(128);
247  for ( uint16_t ibin = 0; ibin < 128; ibin++ ) {
248  if ( (iapv*128)+ibin < nbins ) {
249  adc.push_back( digis.data[(iapv*128)+ibin].adc() );
250  }
251  }
252  sort( adc.begin(), adc.end() );
253  uint16_t index = adc.size()%2 ? adc.size()/2 : adc.size()/2-1;
254  if ( !adc.empty() ) { cm[iapv] = static_cast<uint32_t>( adc[index] ); }
255  }
256 
258  for ( uint16_t ibin = 0; ibin < nbins; ibin++ ) {
259  float digiVal = digis.data[ibin].adc();
260  updateHistoSet( peds_[0], ibin, digiVal ); // peds and raw noise
261  float diff = digiVal - static_cast<float>( cm[ibin/128] );
262  updateHistoSet( peds_[1], ibin, diff ); // residuals and real noise
263  }
264 
265  if ( cm.size() < cm_.size() ) {
267  << "[PedestalsTask::" << __func__ << "]"
268  << " Fewer CM values than expected: " << cm.size();
269  }
270 
271  updateHistoSet( cm_[0], cm[0] );
272  updateHistoSet( cm_[1], cm[1] );
273 
274  uint16_t bins = digisAlt.data.size() < nBinsSpy_ ? digisAlt.data.size() : nBinsSpy_;
275  for ( uint16_t ibin = 0; ibin < bins; ibin++ ) {
276  updateHistoSet( scopeFrame_, ibin, digisAlt.data[ibin].adc() );
277  }
278  }
279 }
int adc(sample_type sample)
get the ADC sample (12 bits)
T getParameter(std::string const &) const
edm::ParameterSet parameters_
parameters useful for the spy
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
static const char mlDqmSource_[]
const uint32_t & updateFreq() const
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
std::vector< HistoSet > peds_
std::vector< HistoSet > cm_
const uint32_t & fillCntr() const
collection_type data
Definition: DetSet.h:78
void DaqScopeModeTask::update ( )
overrideprivatevirtual

Reimplemented from CommissioningTask.

Definition at line 283 of file DaqScopeModeTask.cc.

References cm_, relativeConstraints::error, edm::ParameterSet::existsAs(), extract(), edm::ParameterSet::getParameter(), trackerHits::histo, cuy::ii, SiStripPI::mean, parameters_, peds_, scopeFrame_, UpdateTProfile::setBinContent(), mathSSE::sqrt(), 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().

283  {
284 
285  if(not (parameters_.existsAs<bool>("isSpy") and parameters_.getParameter<bool>("isSpy")))
287  else{
288 
289  updateHistoSet( peds_[0] );
290  TProfile* histo = ExtractTObject<TProfile>().extract( peds_[1].histo() );
291  for ( uint16_t ii = 0; ii < peds_[1].vNumOfEntries_.size(); ++ii ) {
292 
293  float mean = 0.;
294  float spread = 0.;
295  float entries = peds_[1].vNumOfEntries_[ii];
296  if ( entries > 0. ) {
297  mean = peds_[1].vSumOfContents_[ii] / entries;
298  spread = sqrt( peds_[1].vSumOfSquares_[ii] / entries - mean * mean );
299  }
300 
301  float noise = spread;
302  float error = 0; // sqrt(entries) / entries;
303  UpdateTProfile::setBinContent( histo, ii+1, entries, noise, error );
304  }
305  updateHistoSet( cm_[0] );
306  updateHistoSet( cm_[1] );
308 
309  }
310 }
T getParameter(std::string const &) const
edm::ParameterSet parameters_
parameters useful for the spy
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
std::vector< HistoSet > peds_
T sqrt(T t)
Definition: SSEVec.h:18
static void setBinContent(TProfile *const profile, const uint32_t &bin, const double &entries, const double &mean, const double &spread)
std::vector< HistoSet > cm_
ii
Definition: cuy.py:589
int extract(std::vector< int > *output, const std::string &dati)

Member Data Documentation

std::vector<HistoSet> DaqScopeModeTask::cm_
private

Definition at line 34 of file DaqScopeModeTask.h.

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

uint16_t DaqScopeModeTask::nBins_
private

Definition at line 36 of file DaqScopeModeTask.h.

Referenced by book(), and fill().

uint16_t DaqScopeModeTask::nBinsSpy_
private

Definition at line 37 of file DaqScopeModeTask.h.

Referenced by book(), and fill().

edm::ParameterSet DaqScopeModeTask::parameters_
private

parameters useful for the spy

Definition at line 40 of file DaqScopeModeTask.h.

Referenced by book(), Mixins._TypedParameterizable::clone(), Types.PSet::clone(), Mixins._TypedParameterizable::copy(), fill(), and update().

std::vector<HistoSet> DaqScopeModeTask::peds_
private

Definition at line 33 of file DaqScopeModeTask.h.

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

HistoSet DaqScopeModeTask::scopeFrame_
private

Definition at line 30 of file DaqScopeModeTask.h.

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