CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
PedestalsTask Class Reference

#include <PedestalsTask.h>

Inheritance diagram for PedestalsTask:
CommissioningTask

Public Member Functions

 PedestalsTask (DQMStore *, const FedChannelConnection &)
 
virtual ~PedestalsTask ()
 
- 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

virtual void book ()
 
virtual void fill (const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &)
 
virtual void update ()
 

Private Attributes

std::vector< HistoSetcm_
 
std::vector< HistoSetpeds_
 

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

Constructor & Destructor Documentation

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

Definition at line 15 of file PedestalsTask.cc.

References LogTrace, and sistrip::mlDqmSource_.

16  :
17  CommissioningTask( dqm, conn, "PedestalsTask" ),
18  peds_(),
19  cm_()
20 {
22  << "[PedestalsTask::" << __func__ << "]"
23  << " Constructing object...";
24 }
static const char mlDqmSource_[]
std::vector< HistoSet > peds_
Definition: PedestalsTask.h:24
#define LogTrace(id)
std::vector< HistoSet > cm_
Definition: PedestalsTask.h:25
DQMStore *const dqm() const
PedestalsTask::~PedestalsTask ( )
virtual

Definition at line 28 of file PedestalsTask.cc.

References LogTrace, and sistrip::mlDqmSource_.

28  {
30  << "[PedestalsTask::" << __func__ << "]"
31  << " Destructing object...";
32 }
static const char mlDqmSource_[]
#define LogTrace(id)

Member Function Documentation

void PedestalsTask::book ( )
privatevirtual

Reimplemented from CommissioningTask.

Definition at line 36 of file PedestalsTask.cc.

References sistrip::APV, cm_, sistrip::extrainfo::commonMode_, CommissioningTask::connection(), CommissioningTask::dqm(), sistrip::EXPERT_HISTO, sistrip::FED_KEY, CommissioningTask::fedKey(), sistrip::LLD_CHAN, LogTrace, sistrip::mlDqmSource_, pileupCalc::nbins, sistrip::extrainfo::noise_, sistrip::PEDESTALS, sistrip::extrainfo::pedestals_, peds_, AlCaHLTBitMon_QueryRunRegistry::string, SiStripHistoTitle::title(), and indexGen::title.

36  {
37  LogTrace(mlDqmSource_) << "[PedestalsTask::" << __func__ << "]";
38 
39  uint16_t nbins;
41  std::string extra_info;
42  peds_.resize(2);
43  nbins = 256;
44 
45  // Pedestals histogram
46  extra_info = sistrip::extrainfo::pedestals_;
47  peds_[0].isProfile_ = true;
48 
52  fedKey(),
54  connection().lldChannel(),
55  extra_info ).title();
56 
57  peds_[0].histo( dqm()->bookProfile( title, title,
58  nbins, -0.5, nbins*1.-0.5,
59  1025, 0., 1025. ) );
60 
61  peds_[0].vNumOfEntries_.resize(nbins,0);
62  peds_[0].vSumOfContents_.resize(nbins,0);
63  peds_[0].vSumOfSquares_.resize(nbins,0);
64 
65  // Noise histogram
66  extra_info = sistrip::extrainfo::noise_;
67  peds_[1].isProfile_ = true;
68 
72  fedKey(),
74  connection().lldChannel(),
75  extra_info ).title();
76 
77  peds_[1].histo( dqm()->bookProfile( title, title,
78  nbins, -0.5, nbins*1.-0.5,
79  1025, 0., 1025. ) );
80 
81  peds_[1].vNumOfEntries_.resize(nbins,0);
82  peds_[1].vSumOfContents_.resize(nbins,0);
83  peds_[1].vSumOfSquares_.resize(nbins,0);
84 
85  // Common mode histograms
86  cm_.resize(2);
87  nbins = 1024;
88  for ( uint16_t iapv = 0; iapv < 2; iapv++ ) {
89 
93  fedKey(),
94  sistrip::APV,
95  connection().i2cAddr(iapv),
97 
98  cm_[iapv].histo( dqm()->book1D( title, title, nbins, -0.5, nbins*1.-0.5 ) );
99  cm_[iapv].isProfile_ = false;
100 
101  cm_[iapv].vNumOfEntries_.resize(nbins,0);
102  cm_[iapv].vNumOfEntries_.resize(nbins,0);
103 
104  }
105 
106 }
static const char noise_[]
Utility class that holds histogram title.
const std::string & title() const
static const char mlDqmSource_[]
std::vector< HistoSet > peds_
Definition: PedestalsTask.h:24
static const char commonMode_[]
#define LogTrace(id)
std::vector< HistoSet > cm_
Definition: PedestalsTask.h:25
static const char pedestals_[]
DQMStore *const dqm() const
const uint32_t & fedKey() const
const FedChannelConnection & connection() const
void PedestalsTask::fill ( const SiStripEventSummary summary,
const edm::DetSet< SiStripRawDigi > &  digis 
)
privatevirtual

Reimplemented from CommissioningTask.

Definition at line 110 of file PedestalsTask.cc.

References ecalMGPA::adc(), cm_, edm::DetSet< T >::data, diffTreeTool::diff, cmsHarvester::index, sistrip::mlDqmSource_, pileupCalc::nbins, peds_, python.multivaluedict::sort(), and CommissioningTask::updateHistoSet().

111  {
112 
113  if ( digis.data.size() != peds_[0].vNumOfEntries_.size() ) {
115  << "[PedestalsTask::" << __func__ << "]"
116  << " Unexpected number of digis: "
117  << digis.data.size();
118  return;
119  }
120 
121  // Check number of digis
122  uint16_t nbins = peds_[0].vNumOfEntries_.size();
123  if ( digis.data.size() < nbins ) { nbins = digis.data.size(); }
124 
125  //@@ Inefficient!!!
126  uint16_t napvs = nbins / 128;
127  std::vector<uint32_t> cm; cm.resize(napvs,0);
128 
129  // Calc common mode for both APVs
130  std::vector<uint16_t> adc;
131  for ( uint16_t iapv = 0; iapv < napvs; iapv++ ) {
132  adc.clear(); adc.reserve(128);
133  for ( uint16_t ibin = 0; ibin < 128; ibin++ ) {
134  if ( (iapv*128)+ibin < nbins ) {
135  adc.push_back( digis.data[(iapv*128)+ibin].adc() ); //@@ VIRGIN RAW DATA (MUX, APV READOUT)
136  }
137  }
138  sort( adc.begin(), adc.end() );
139  uint16_t index = adc.size()%2 ? adc.size()/2 : adc.size()/2-1;
140  if ( !adc.empty() ) { cm[iapv] = static_cast<uint32_t>( adc[index] ); }
141  }
142 
143  for ( uint16_t ibin = 0; ibin < nbins; ibin++ ) {
144  updateHistoSet( peds_[0], ibin, digis.data[ibin].adc() ); // peds and raw noise
145  float diff = static_cast<float>( digis.data[ibin].adc() ) - static_cast<float>( cm[ibin/128] );
146  updateHistoSet( peds_[1], ibin, diff ); // residuals and real noise
147  }
148 
149  if ( cm.size() < cm_.size() ) {
151  << "[PedestalsTask::" << __func__ << "]"
152  << " Fewer CM values than expected: " << cm.size();
153  }
154 
155  updateHistoSet( cm_[0], cm[0] );
156  updateHistoSet( cm_[1], cm[1] );
157 
158 }
int adc(sample_type sample)
get the ADC sample (12 bits)
static const char mlDqmSource_[]
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
std::vector< HistoSet > peds_
Definition: PedestalsTask.h:24
std::vector< HistoSet > cm_
Definition: PedestalsTask.h:25
collection_type data
Definition: DetSet.h:78
void PedestalsTask::update ( )
privatevirtual

Reimplemented from CommissioningTask.

Definition at line 162 of file PedestalsTask.cc.

References cm_, python.tagInventory::entries, relativeConstraints::error, extract(), timingPdfMaker::histo, cuy::ii, timingPdfMaker::mean, HLT_25ns14e33_v1_cff::noise, peds_, 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(), 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().

162  {
163 
164  // Pedestals
165  updateHistoSet( peds_[0] );
166 
167  // Noise (cannot use HistoSet directly, as want to plot noise as "contents", not "error")
168  TProfile* histo = ExtractTObject<TProfile>().extract( peds_[1].histo() );
169  for ( uint16_t ii = 0; ii < peds_[1].vNumOfEntries_.size(); ++ii ) {
170 
171  float mean = 0.;
172  float spread = 0.;
173  float entries = peds_[1].vNumOfEntries_[ii];
174  if ( entries > 0. ) {
175  mean = peds_[1].vSumOfContents_[ii] / entries;
176  spread = sqrt( peds_[1].vSumOfSquares_[ii] / entries - mean * mean );
177  }
178 
179  float noise = spread;
180  float error = 0; // sqrt(entries) / entries;
181 
182  UpdateTProfile::setBinContent( histo, ii+1, entries, noise, error );
183 
184  }
185 
186  // Common mode
187  updateHistoSet( cm_[0] );
188  updateHistoSet( cm_[1] );
189 
190 }
int ii
Definition: cuy.py:588
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
T sqrt(T t)
Definition: SSEVec.h:48
std::vector< HistoSet > peds_
Definition: PedestalsTask.h:24
static void setBinContent(TProfile *const profile, const uint32_t &bin, const double &entries, const double &mean, const double &spread)
std::vector< HistoSet > cm_
Definition: PedestalsTask.h:25
int extract(std::vector< int > *output, const std::string &dati)

Member Data Documentation

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

Definition at line 25 of file PedestalsTask.h.

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

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

Definition at line 24 of file PedestalsTask.h.

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