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
PedestalsHistosUsingDb Class Reference

#include <PedestalsHistosUsingDb.h>

Inheritance diagram for PedestalsHistosUsingDb:
CommissioningHistosUsingDb PedestalsHistograms CommissioningHistograms CommissioningHistograms

Public Member Functions

 PedestalsHistosUsingDb (const edm::ParameterSet &pset, DQMStore *, SiStripConfigDb *const )
 
virtual void uploadConfigurations ()
 
virtual ~PedestalsHistosUsingDb ()
 
- Public Member Functions inherited from CommissioningHistosUsingDb
 CommissioningHistosUsingDb (SiStripConfigDb *const, sistrip::RunType=sistrip::UNDEFINED_RUN_TYPE)
 
bool doUploadAnal () const
 
void doUploadAnal (bool)
 
bool doUploadConf () const
 
void doUploadConf (bool)
 
void uploadToConfigDb ()
 
virtual ~CommissioningHistosUsingDb ()
 
- Public Member Functions inherited from CommissioningHistograms
 CommissioningHistograms (const edm::ParameterSet &pset, DQMStore *const, const sistrip::RunType &)
 
 CommissioningHistograms ()
 
virtual void configure (const edm::ParameterSet &, const edm::EventSetup &)
 
void createCollations (const std::vector< std::string > &)
 
virtual void createSummaryHisto (const sistrip::Monitorable &, const sistrip::Presentation &, const std::string &top_level_dir, const sistrip::Granularity &)
 
void extractHistograms (const std::vector< std::string > &)
 
virtual void printSummary ()
 
void remove (std::string pattern="")
 
void save (std::string &filename, uint32_t run_number=0)
 
virtual ~CommissioningHistograms ()
 
- Public Member Functions inherited from PedestalsHistograms
void histoAnalysis (bool debug)
 
 PedestalsHistograms (const edm::ParameterSet &pset, DQMStore *)
 
void printAnalyses ()
 
virtual ~PedestalsHistograms ()
 

Private Member Functions

void create (SiStripConfigDb::AnalysisDescriptionsV &, Analysis)
 
void update (SiStripConfigDb::FedDescriptionsRange)
 

Private Attributes

bool disableBadStrips_
 
float highThreshold_
 
bool keepStripsDisabled_
 
float lowThreshold_
 

Additional Inherited Members

- Public Types inherited from CommissioningHistograms
typedef std::map< uint32_t,
CommissioningAnalysis * > 
Analyses
 
typedef Analyses::iterator Analysis
 
typedef SummaryPlotFactory
< CommissioningAnalysis * > 
Factory
 
typedef std::map< uint32_t,
uint32_t > 
FedToFecMap
 
typedef std::vector< Histo * > Histos
 
typedef std::map< uint32_t,
Histos
HistosMap
 
- Static Public Member Functions inherited from CommissioningHistograms
static void copyCustomInformation (DQMStore *const, const std::vector< std::string > &)
 
static void getContents (DQMStore *const, std::vector< std::string > &)
 
static uint32_t runNumber (DQMStore *const, const std::vector< std::string > &)
 
static sistrip::RunType runType (DQMStore *const, const std::vector< std::string > &)
 
- Protected Member Functions inherited from CommissioningHistosUsingDb
virtual void addDcuDetIds ()
 
void buildDetInfo ()
 
SiStripFedCabling *const cabling () const
 
virtual void createAnalyses (SiStripConfigDb::AnalysisDescriptionsV &)
 
SiStripConfigDb *const db () const
 
std::pair< std::string, DetInfodetInfo (const SiStripFecKey &)
 
bool deviceIsPresent (const SiStripFecKey &)
 
void uploadAnalyses ()
 
- Protected Member Functions inherited from CommissioningHistograms
DQMStore *const bei () const
 
void clearHistosMap ()
 
Analysesdata ()
 
Factory *const factory ()
 
TH1 * histogram (const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &directory, const uint32_t &xbins, const float &xlow=1.*sistrip::invalid_, const float &xhigh=1.*sistrip::invalid_)
 
const HistosMaphistos () const
 
const FedToFecMapmapping () const
 
void printHistosMap ()
 
const edm::ParameterSetpset () const
 
const sistrip::RunTypetask () const
 
- Protected Attributes inherited from CommissioningHistograms
std::auto_ptr< Factoryfactory_
 

Detailed Description

Definition at line 8 of file PedestalsHistosUsingDb.h.

Constructor & Destructor Documentation

PedestalsHistosUsingDb::PedestalsHistosUsingDb ( const edm::ParameterSet pset,
DQMStore bei,
SiStripConfigDb * const  db 
)

Definition at line 14 of file PedestalsHistosUsingDb.cc.

References disableBadStrips_, edm::ParameterSet::getParameter(), highThreshold_, keepStripsDisabled_, LogTrace, lowThreshold_, sistrip::mlDqmClient_, and CommissioningHistograms::pset().

17  : CommissioningHistograms( pset.getParameter<edm::ParameterSet>("PedestalsParameters"),
18  bei,
22  PedestalsHistograms( pset.getParameter<edm::ParameterSet>("PedestalsParameters"),
23  bei )
24 {
26  << "[PedestalsHistosUsingDb::" << __func__ << "]"
27  << " Constructing object...";
28  highThreshold_ = this->pset().getParameter<double>("HighThreshold");
29  lowThreshold_ = this->pset().getParameter<double>("LowThreshold");
31  << "[PedestalsHistosUsingDb::" << __func__ << "]"
32  << " Set FED zero suppression high/low threshold to "
33  << highThreshold_ << "/" << lowThreshold_;
34  disableBadStrips_ = this->pset().getParameter<bool>("DisableBadStrips");
35  keepStripsDisabled_ = this->pset().getParameter<bool>("KeepStripsDisabled");
37  << "[PedestalsHistosUsingDb::" << __func__ << "]"
38  << " Disabling strips: " << disableBadStrips_
39  << " ; keeping previously disabled strips: " << keepStripsDisabled_;
40 }
T getParameter(std::string const &) const
PedestalsHistograms(const edm::ParameterSet &pset, DQMStore *)
const edm::ParameterSet & pset() const
static const char mlDqmClient_[]
#define LogTrace(id)
PedestalsHistosUsingDb::~PedestalsHistosUsingDb ( )
virtual

Definition at line 44 of file PedestalsHistosUsingDb.cc.

References LogTrace, and sistrip::mlDqmClient_.

44  {
46  << "[PedestalsHistosUsingDb::" << __func__ << "]"
47  << " Destructing object...";
48 }
static const char mlDqmClient_[]
#define LogTrace(id)

Member Function Documentation

void PedestalsHistosUsingDb::create ( SiStripConfigDb::AnalysisDescriptionsV desc,
Analysis  analysis 
)
privatevirtual

Reimplemented from CommissioningHistosUsingDb.

Definition at line 223 of file PedestalsHistosUsingDb.cc.

References CommissioningHistosUsingDb::db(), SiStripConfigDb::dbParams(), PedestalsAnalysis::dead(), benchmark_cfg::errors, CommissioningAnalysis::fecKey(), CommissioningAnalysis::fedKey(), CommissioningAnalysis::getErrorCodes(), SiStripFecKey::i2cAddr(), PedestalsAnalysis::isValid(), PedestalsAnalysis::noiseMax(), PedestalsAnalysis::noiseMean(), PedestalsAnalysis::noiseMin(), PedestalsAnalysis::noiseSpread(), PedestalsAnalysis::noisy(), SiStripDbParams::partitions(), PedestalsAnalysis::pedsMax(), PedestalsAnalysis::pedsMean(), PedestalsAnalysis::pedsMin(), PedestalsAnalysis::pedsSpread(), PedestalsAnalysis::rawMax(), PedestalsAnalysis::rawMean(), PedestalsAnalysis::rawMin(), PedestalsAnalysis::rawSpread(), and tmp.

224  {
225 
226  PedestalsAnalysis* anal = dynamic_cast<PedestalsAnalysis*>( analysis->second );
227  if ( !anal ) { return; }
228 
229  SiStripFecKey fec_key( anal->fecKey() );
230  SiStripFedKey fed_key( anal->fedKey() );
231 
232  for ( uint16_t iapv = 0; iapv < 2; ++iapv ) {
233 
234  // Create description
235  PedestalsAnalysisDescription* tmp;
236  tmp = new PedestalsAnalysisDescription(
237  anal->dead()[iapv],
238  anal->noisy()[iapv],
239  anal->pedsMean()[iapv],
240  anal->pedsSpread()[iapv],
241  anal->noiseMean()[iapv],
242  anal->noiseSpread()[iapv],
243  anal->rawMean()[iapv],
244  anal->rawSpread()[iapv],
245  anal->pedsMax()[iapv],
246  anal->pedsMin()[iapv],
247  anal->noiseMax()[iapv],
248  anal->noiseMin()[iapv],
249  anal->rawMax()[iapv],
250  anal->rawMin()[iapv],
251  fec_key.fecCrate(),
252  fec_key.fecSlot(),
253  fec_key.fecRing(),
254  fec_key.ccuAddr(),
255  fec_key.ccuChan(),
256  SiStripFecKey::i2cAddr( fec_key.lldChan(), !iapv ),
257  db()->dbParams().partitions().begin()->second.partitionName(),
258  db()->dbParams().partitions().begin()->second.runNumber(),
259  anal->isValid(),
260  "",
261  fed_key.fedId(),
262  fed_key.feUnit(),
263  fed_key.feChan(),
264  fed_key.fedApv()
265  );
266 
267  // Add comments
268  typedef std::vector<std::string> Strings;
269  Strings errors = anal->getErrorCodes();
270  Strings::const_iterator istr = errors.begin();
271  Strings::const_iterator jstr = errors.end();
272  for ( ; istr != jstr; ++istr ) { tmp->addComments( *istr ); }
273 
274  // Store description
275  desc.push_back( tmp );
276 
277  }
278 
279 }
const VFloat & rawMax() const
const VFloat & pedsMean() const
const uint32_t & fedKey() const
const VVInt & noisy() const
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
std::vector< std::string > Strings
Definition: MsgTools.h:18
bool isValid() const
const uint16_t & i2cAddr() const
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
const VFloat & noiseMean() const
const_iterator_range partitions() const
const VFloat & pedsMin() const
Histogram-based analysis for pedestal run.
const uint32_t & fecKey() const
const VVInt & dead() const
const VFloat & rawMin() const
const VFloat & rawSpread() const
const VFloat & rawMean() const
const SiStripDbParams & dbParams() const
const VFloat & pedsSpread() const
const VFloat & pedsMax() const
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
const VFloat & noiseSpread() const
SiStripConfigDb *const db() const
const VFloat & noiseMax() const
const VString & getErrorCodes() const
const VFloat & noiseMin() const
void PedestalsHistosUsingDb::update ( SiStripConfigDb::FedDescriptionsRange  feds)
private

Definition at line 86 of file PedestalsHistosUsingDb.cc.

References sistrip::APVS_PER_FEDCH, CommissioningHistosUsingDb::cabling(), FedChannelConnection::ccuAddr(), FedChannelConnection::ccuChan(), results_mgr::conn, CommissioningHistograms::data(), PedestalsAnalysis::dead(), CommissioningHistosUsingDb::deviceIsPresent(), disableBadStrips_, FedChannelConnection::fecCrate(), SiStripFedKey::feChan(), FedChannelConnection::fecRing(), FedChannelConnection::fecSlot(), FedChannelConnection::fedCh(), sistrip::FEDCH_PER_FED, SiStripFedKey::fedChannel(), SiStripFedCabling::fedConnection(), SiStripFedKey::fedId(), FedChannelConnection::fedId(), SiStripFedKey::feUnit(), spr::find(), highThreshold_, sistrip::invalid_, edm::isDebugEnabled(), keepStripsDisabled_, SiStripKey::key(), FedChannelConnection::lldChannel(), LogTrace, lowThreshold_, sistrip::mlDqmClient_, PedestalsAnalysis::noise(), PedestalsAnalysis::noisy(), PedestalsAnalysis::peds(), PedestalsAnalysis::pedsMin(), and groupFilesInBlocks::temp.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.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(), relval_steps.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(), Vispa.Gui.PortConnection.PointToPointConnection::updateConnection(), and uploadConfigurations().

86  {
87 
88  // Iterate through feds and update fed descriptions
89  uint16_t updated = 0;
90  SiStripConfigDb::FedDescriptionsV::const_iterator ifed;
91  for ( ifed = feds.begin(); ifed != feds.end(); ifed++ ) {
92 
93  for ( uint16_t ichan = 0; ichan < sistrip::FEDCH_PER_FED; ichan++ ) {
94 
95  // Build FED and FEC keys
96  const FedChannelConnection& conn = cabling()->fedConnection( (*ifed)->getFedId(), ichan );
97  if ( conn.fecCrate() == sistrip::invalid_ ||
98  conn.fecSlot() == sistrip::invalid_ ||
99  conn.fecRing() == sistrip::invalid_ ||
100  conn.ccuAddr() == sistrip::invalid_ ||
101  conn.ccuChan() == sistrip::invalid_ ||
102  conn.lldChannel() == sistrip::invalid_ ) { continue; }
103  SiStripFedKey fed_key( conn.fedId(),
104  SiStripFedKey::feUnit( conn.fedCh() ),
105  SiStripFedKey::feChan( conn.fedCh() ) );
106  SiStripFecKey fec_key( conn.fecCrate(),
107  conn.fecSlot(),
108  conn.fecRing(),
109  conn.ccuAddr(),
110  conn.ccuChan(),
111  conn.lldChannel() );
112 
113  // Locate appropriate analysis object
114  Analyses::const_iterator iter = data().find( fec_key.key() );
115  if ( iter != data().end() ) {
116 
117  PedestalsAnalysis* anal = dynamic_cast<PedestalsAnalysis*>( iter->second );
118  if ( !anal ) {
120  << "[PedestalsHistosUsingDb::" << __func__ << "]"
121  << " NULL pointer to analysis object!";
122  continue;
123  }
124 
125  // Determine the pedestal shift to apply
126  uint32_t pedshift = 127;
127  for ( uint16_t iapv = 0; iapv < sistrip::APVS_PER_FEDCH; iapv++ ) {
128  uint32_t pedmin = (uint32_t) anal->pedsMin()[iapv];
129  pedshift = pedmin < pedshift ? pedmin : pedshift;
130  }
131 
132  // Iterate through APVs and strips
133  for ( uint16_t iapv = 0; iapv < sistrip::APVS_PER_FEDCH; iapv++ ) {
134  for ( uint16_t istr = 0; istr < anal->peds()[iapv].size(); istr++ ) {
135 
136  // get the information on the strip as it was on the db
137  Fed9U::Fed9UAddress addr( ichan, iapv, istr );
138  Fed9U::Fed9UStripDescription temp = (*ifed)->getFedStrips().getStrip( addr );
139 
140  // determine whether we need to disable the strip
141  bool disableStrip = false;
142  if ( keepStripsDisabled_ ) {
143  disableStrip = temp.getDisable();
144  } else if (disableBadStrips_) {
145  PedestalsAnalysis::VInt dead = anal->dead()[iapv];
146  if ( find( dead.begin(), dead.end(), istr ) != dead.end() ) disableStrip = true;
147  PedestalsAnalysis::VInt noisy = anal->noisy()[iapv];
148  if ( find( noisy.begin(), noisy.end(), istr ) != noisy.end() ) disableStrip = true;
149  }
150 
151  Fed9U::Fed9UStripDescription data( static_cast<uint32_t>( anal->peds()[iapv][istr]-pedshift ),
154  anal->noise()[iapv][istr],
155  disableStrip );
156 
157  std::stringstream ss;
158  if ( data.getDisable() && edm::isDebugEnabled() ) {
159  ss << "[PedestalsHistosUsingDb::" << __func__ << "]"
160  << " Disabling strip in Fed9UStripDescription object..." << std::endl
161  << " for FED id/channel and APV/strip : "
162  << fed_key.fedId() << "/"
163  << fed_key.fedChannel() << " "
164  << iapv << "/"
165  << istr << std::endl
166  << " and crate/FEC/ring/CCU/module : "
167  << fec_key.fecCrate() << "/"
168  << fec_key.fecSlot() << "/"
169  << fec_key.fecRing() << "/"
170  << fec_key.ccuAddr() << "/"
171  << fec_key.ccuChan() << std::endl
172  << " from ped/noise/high/low/disable : "
173  << static_cast<uint16_t>( temp.getPedestal() ) << "/"
174  << static_cast<uint16_t>( temp.getHighThreshold() ) << "/"
175  << static_cast<uint16_t>( temp.getLowThreshold() ) << "/"
176  << static_cast<uint16_t>( temp.getNoise() ) << "/"
177  << static_cast<uint16_t>( temp.getDisable() ) << std::endl;
178  }
179  (*ifed)->getFedStrips().setStrip( addr, data );
180  if ( data.getDisable() && edm::isDebugEnabled() ) {
181  ss << " to ped/noise/high/low/disable : "
182  << static_cast<uint16_t>( data.getPedestal() ) << "/"
183  << static_cast<uint16_t>( data.getHighThreshold() ) << "/"
184  << static_cast<uint16_t>( data.getLowThreshold() ) << "/"
185  << static_cast<uint16_t>( data.getNoise() ) << "/"
186  << static_cast<uint16_t>( data.getDisable() ) << std::endl;
187  LogTrace(mlDqmClient_) << ss.str();
188  }
189 
190  } // end loop on strips
191  } // end loop on apvs
192  updated++;
193 
194  } else {
195  if ( deviceIsPresent(fec_key) ) {
197  << "[PedestalsHistosUsingDb::" << __func__ << "]"
198  << " Unable to find pedestals/noise for FedKey/Id/Ch: "
199  << hex << setw(8) << setfill('0') << fed_key.key() << dec << "/"
200  << (*ifed)->getFedId() << "/"
201  << ichan
202  << " and device with FEC/slot/ring/CCU/LLD "
203  << fec_key.fecCrate() << "/"
204  << fec_key.fecSlot() << "/"
205  << fec_key.fecRing() << "/"
206  << fec_key.ccuAddr() << "/"
207  << fec_key.ccuChan() << "/"
208  << fec_key.channel();
209  }
210  }
211  }
212  }
213 
215  << "[PedestalsHistosUsingDb::" << __func__ << "]"
216  << " Updated FED pedestals/noise for "
217  << updated << " channels";
218 
219 }
const uint16_t & fecSlot() const
bool isDebugEnabled()
const uint16_t & fecCrate() const
const VVInt & noisy() const
const VVFloat & peds() const
FedChannelConnection fedConnection(uint16_t fed_id, uint16_t fed_ch) const
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
const uint16_t & fedCh() const
bool deviceIsPresent(const SiStripFecKey &)
static const char mlDqmClient_[]
uint16_t lldChannel() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const uint16_t & fedId() const
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
const uint16_t & fecRing() const
const VFloat & pedsMin() const
Class containning control, module, detector and connection information, at the level of a FED channel...
const VVFloat & noise() const
const uint16_t & ccuChan() const
Histogram-based analysis for pedestal run.
const VVInt & dead() const
const uint16_t & ccuAddr() const
#define LogTrace(id)
std::vector< uint16_t > VInt
const uint16_t & feUnit() const
static const uint16_t invalid_
Definition: Constants.h:16
static const uint16_t FEDCH_PER_FED
const uint16_t & feChan() const
SiStripFedCabling *const cabling() const
static const uint16_t APVS_PER_FEDCH
tuple conn
Definition: results_mgr.py:53
void PedestalsHistosUsingDb::uploadConfigurations ( )
virtual

Reimplemented from CommissioningHistosUsingDb.

Definition at line 52 of file PedestalsHistosUsingDb.cc.

References CommissioningHistosUsingDb::db(), CommissioningHistosUsingDb::doUploadConf(), SiStripConfigDb::getFedDescriptions(), LogTrace, sistrip::mlDqmClient_, update(), and SiStripConfigDb::uploadFedDescriptions().

52  {
54  << "[PedestalsHistosUsingDb::" << __func__ << "]";
55 
56  if ( !db() ) {
58  << "[PedestalsHistosUsingDb::" << __func__ << "]"
59  << " NULL pointer to SiStripConfigDb interface!"
60  << " Aborting upload...";
61  return;
62  }
63 
64  // Update FED descriptions with new peds/noise values
66  update( feds );
67  if ( doUploadConf() ) {
69  << "[PedestalsHistosUsingDb::" << __func__ << "]"
70  << " Uploading pedestals/noise to DB...";
73  << "[PedestalsHistosUsingDb::" << __func__ << "]"
74  << " Completed database upload of " << feds.size()
75  << " FED descriptions!";
76  } else {
78  << "[PedestalsHistosUsingDb::" << __func__ << "]"
79  << " TEST! No pedestals/noise values will be uploaded to DB...";
80  }
81 
82 }
void update(SiStripConfigDb::FedDescriptionsRange)
FedDescriptionsRange getFedDescriptions(std::string partition="")
FedDescriptions::range FedDescriptionsRange
static const char mlDqmClient_[]
#define LogTrace(id)
void uploadFedDescriptions(std::string partition="")
SiStripConfigDb *const db() const

Member Data Documentation

bool PedestalsHistosUsingDb::disableBadStrips_
private

Definition at line 29 of file PedestalsHistosUsingDb.h.

Referenced by PedestalsHistosUsingDb(), and update().

float PedestalsHistosUsingDb::highThreshold_
private

Definition at line 27 of file PedestalsHistosUsingDb.h.

Referenced by PedestalsHistosUsingDb(), and update().

bool PedestalsHistosUsingDb::keepStripsDisabled_
private

Definition at line 30 of file PedestalsHistosUsingDb.h.

Referenced by PedestalsHistosUsingDb(), and update().

float PedestalsHistosUsingDb::lowThreshold_
private

Definition at line 28 of file PedestalsHistosUsingDb.h.

Referenced by PedestalsHistosUsingDb(), and update().