CMS 3D CMS Logo

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

#include <OptoScanHistosUsingDb.h>

Inheritance diagram for OptoScanHistosUsingDb:
CommissioningHistosUsingDb OptoScanHistograms CommissioningHistograms CommissioningHistograms

Public Member Functions

 OptoScanHistosUsingDb (const edm::ParameterSet &pset, DQMStore *, SiStripConfigDb *const)
 
void uploadConfigurations () override
 
 ~OptoScanHistosUsingDb () override
 
- Public Member Functions inherited from CommissioningHistosUsingDb
 CommissioningHistosUsingDb (SiStripConfigDb *const, sistrip::RunType=sistrip::UNDEFINED_RUN_TYPE)
 
void configure (const edm::ParameterSet &, const edm::EventSetup &) override
 
bool doUploadAnal () const
 
void doUploadAnal (bool)
 
bool doUploadConf () const
 
void doUploadConf (bool)
 
void uploadToConfigDb ()
 
 ~CommissioningHistosUsingDb () override
 
- Public Member Functions inherited from CommissioningHistograms
 CommissioningHistograms ()
 
 CommissioningHistograms (const edm::ParameterSet &pset, DQMStore *const, const sistrip::RunType &)
 
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, std::string partitionName="")
 
virtual ~CommissioningHistograms ()
 
- Public Member Functions inherited from OptoScanHistograms
void histoAnalysis (bool debug) override
 
 OptoScanHistograms (const edm::ParameterSet &pset, DQMStore *)
 
void printAnalyses () override
 
 ~OptoScanHistograms () override
 

Private Member Functions

void create (SiStripConfigDb::AnalysisDescriptionsV &, Analysis) override
 
void update (SiStripConfigDb::DeviceDescriptionsRange)
 

Private Attributes

bool allowSelectiveUpload_
 
bool skipGainUpdate_
 

Additional Inherited Members

- Public Types inherited from CommissioningHistograms
typedef std::map< uint32_t, CommissioningAnalysis * > Analyses
 
typedef Analyses::iterator Analysis
 
typedef dqm::harvesting::DQMStore DQMStore
 
typedef SummaryPlotFactory< CommissioningAnalysis * > Factory
 
typedef std::map< uint32_t, uint32_t > FedToFecMap
 
typedef std::vector< Histo * > Histos
 
typedef std::map< uint32_t, HistosHistosMap
 
typedef dqm::harvesting::MonitorElement MonitorElement
 
- Static Public Member Functions inherited from CommissioningHistograms
static void copyCustomInformation (DQMStore *const, 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 (bool getMaskedData=false)
 
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::unique_ptr< Factoryfactory_
 

Detailed Description

Definition at line 8 of file OptoScanHistosUsingDb.h.

Constructor & Destructor Documentation

◆ OptoScanHistosUsingDb()

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

Definition at line 13 of file OptoScanHistosUsingDb.cc.

16  OptoScanHistograms(pset.getParameter<edm::ParameterSet>("OptoScanParameters"), bei) {
17  LogTrace(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
18  << " Constructing object...";
19  skipGainUpdate_ = this->pset().getParameter<bool>("SkipGainUpdate");
20  if (skipGainUpdate_)
21  LogTrace(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
22  << " Skipping db update of gain parameters.";
23 
25  this->pset().existsAs<bool>("doSelectiveUpload") ? this->pset().getParameter<bool>("doSelectiveUpload") : false;
27  LogTrace(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
28  << " Enabling selective upload of gain parameters";
29 }

References allowSelectiveUpload_, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), LogTrace, sistrip::mlDqmClient_, CommissioningHistograms::pset(), and skipGainUpdate_.

◆ ~OptoScanHistosUsingDb()

OptoScanHistosUsingDb::~OptoScanHistosUsingDb ( )
override

Definition at line 33 of file OptoScanHistosUsingDb.cc.

33  {
34  LogTrace(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
35  << " Destructing object...";
36 }

References LogTrace, and sistrip::mlDqmClient_.

Member Function Documentation

◆ create()

void OptoScanHistosUsingDb::create ( SiStripConfigDb::AnalysisDescriptionsV desc,
Analysis  analysis 
)
overrideprivatevirtual

Reimplemented from CommissioningHistosUsingDb.

Definition at line 133 of file OptoScanHistosUsingDb.cc.

133  {
134  OptoScanAnalysis* anal = dynamic_cast<OptoScanAnalysis*>(analysis->second);
135  if (!anal) {
136  return;
137  }
138 
139  SiStripFecKey fec_key(anal->fecKey());
140  SiStripFedKey fed_key(anal->fedKey());
141 
142  for (uint16_t iapv = 0; iapv < 2; ++iapv) {
143  // Create description
144  OptoScanAnalysisDescription* tmp;
145  tmp = new OptoScanAnalysisDescription(anal->baseSlope()[0],
146  anal->baseSlope()[1],
147  anal->baseSlope()[2],
148  anal->baseSlope()[3],
149  anal->gain(),
150  anal->bias()[0],
151  anal->bias()[1],
152  anal->bias()[2],
153  anal->bias()[3],
154  anal->measGain()[0],
155  anal->measGain()[1],
156  anal->measGain()[2],
157  anal->measGain()[3],
158  anal->zeroLight()[0],
159  anal->zeroLight()[1],
160  anal->zeroLight()[2],
161  anal->zeroLight()[3],
162  anal->linkNoise()[0],
163  anal->linkNoise()[1],
164  anal->linkNoise()[2],
165  anal->linkNoise()[3],
166  anal->liftOff()[0],
167  anal->liftOff()[1],
168  anal->liftOff()[2],
169  anal->liftOff()[3],
170  anal->threshold()[0],
171  anal->threshold()[1],
172  anal->threshold()[2],
173  anal->threshold()[3],
174  anal->tickHeight()[0],
175  anal->tickHeight()[1],
176  anal->tickHeight()[2],
177  anal->tickHeight()[3],
178  fec_key.fecCrate(),
179  fec_key.fecSlot(),
180  fec_key.fecRing(),
181  fec_key.ccuAddr(),
182  fec_key.ccuChan(),
183  SiStripFecKey::i2cAddr(fec_key.lldChan(), !iapv),
184  db()->dbParams().partitions().begin()->second.partitionName(),
185  db()->dbParams().partitions().begin()->second.runNumber(),
186  anal->isValid(),
187  "",
188  fed_key.fedId(),
189  fed_key.feUnit(),
190  fed_key.feChan(),
191  fed_key.fedApv());
192 
193  // Add comments
194  typedef std::vector<std::string> Strings;
195  Strings errors = anal->getErrorCodes();
196  Strings::const_iterator istr = errors.begin();
197  Strings::const_iterator jstr = errors.end();
198  for (; istr != jstr; ++istr) {
199  tmp->addComments(*istr);
200  }
201 
202  // Store description
203  desc.push_back(tmp);
204  }
205 }

References conversion_template_cfg::anal, CommissioningHistosUsingDb::db(), SiStripConfigDb::dbParams(), SiStripFecKey::i2cAddr(), SiStripDbParams::partitions(), and createJobs::tmp.

◆ update()

void OptoScanHistosUsingDb::update ( SiStripConfigDb::DeviceDescriptionsRange  devices)
private

Definition at line 67 of file OptoScanHistosUsingDb.cc.

67  {
68  // Iterate through devices and update device descriptions
69  uint16_t updated = 0;
70  SiStripConfigDb::DeviceDescriptionsV::const_iterator idevice;
71  for (idevice = devices.begin(); idevice != devices.end(); idevice++) {
72  if ((*idevice)->getDeviceType() != LASERDRIVER) {
73  continue;
74  }
75 
76  // Cast to retrieve appropriate description object
77  laserdriverDescription* desc = dynamic_cast<laserdriverDescription*>(*idevice);
78  if (!desc) {
79  continue;
80  }
81 
82  // Retrieve device addresses from device description
84 
85  // Iterate through LLD channels
86  for (uint16_t ichan = 0; ichan < sistrip::CHANS_PER_LLD; ichan++) {
87  // Construct key from device description
88  SiStripFecKey fec_key(addr.fecCrate_, addr.fecSlot_, addr.fecRing_, addr.ccuAddr_, addr.ccuChan_, ichan + 1);
89 
90  // Iterate through all channels and extract LLD settings
91  Analyses::const_iterator iter = data(allowSelectiveUpload_).find(fec_key.key());
92  if (iter != data(allowSelectiveUpload_).end()) {
93  OptoScanAnalysis* anal = dynamic_cast<OptoScanAnalysis*>(iter->second);
94  if (!anal) {
95  edm::LogError(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
96  << " NULL pointer to analysis object!";
97  continue;
98  }
99 
100  uint16_t gain = anal->gain();
101  std::stringstream ss;
102  ss << "[OptoScanHistosUsingDb::" << __func__ << "]"
103  << " Updating LLD gain/bias settings for crate/crate/FEC/ring/CCU/module/LLD " << fec_key.fecCrate() << "/"
104  << fec_key.fecSlot() << "/" << fec_key.fecRing() << "/" << fec_key.ccuAddr() << "/" << fec_key.ccuChan()
105  << "/" << fec_key.channel() << " from " << static_cast<uint16_t>(desc->getGain(ichan)) << "/"
106  << static_cast<uint16_t>(desc->getBias(ichan));
107  if (!skipGainUpdate_)
108  desc->setGain(ichan, gain);
109  desc->setBias(ichan, anal->bias()[gain]);
110  updated++;
111  ss << " to " << static_cast<uint16_t>(desc->getGain(ichan)) << "/"
112  << static_cast<uint16_t>(desc->getBias(ichan));
113  LogTrace(mlDqmClient_) << ss.str();
114 
115  } else {
116  if (deviceIsPresent(fec_key)) {
117  edm::LogWarning(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
118  << " Unable to find FEC key with params crate/FEC/ring/CCU/module/LLD "
119  << fec_key.fecCrate() << "/" << fec_key.fecSlot() << "/" << fec_key.fecRing()
120  << "/" << fec_key.ccuAddr() << "/" << fec_key.ccuChan() << "/"
121  << fec_key.channel();
122  }
123  }
124  }
125  }
126 
127  edm::LogVerbatim(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
128  << " Updated LLD bias/gain settings for " << updated << " modules";
129 }

References generateTowerEtThresholdLUT::addr, allowSelectiveUpload_, conversion_template_cfg::anal, SiStripFecKey::ccuAddr(), SiStripFecKey::ccuChan(), SiStripKey::channel(), sistrip::CHANS_PER_LLD, CommissioningHistograms::data(), CommissioningHistosUsingDb::db(), SiStripConfigDb::deviceAddress(), CommissioningHistosUsingDb::deviceIsPresent(), SiStripFecKey::fecCrate(), SiStripFecKey::fecRing(), SiStripFecKey::fecSlot(), PedestalClient_cfi::gain, SiStripKey::key(), LogTrace, sistrip::mlDqmClient_, skipGainUpdate_, and contentValuesCheck::ss.

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

◆ uploadConfigurations()

void OptoScanHistosUsingDb::uploadConfigurations ( )
overridevirtual

Reimplemented from CommissioningHistosUsingDb.

Definition at line 40 of file OptoScanHistosUsingDb.cc.

40  {
41  LogTrace(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]";
42 
43  if (!db()) {
44  edm::LogError(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
45  << " NULL pointer to SiStripConfigDb interface!"
46  << " Aborting upload...";
47  return;
48  }
49 
50  // Update LLD descriptions with new bias/gain settings
52  update(devices);
53  if (doUploadConf()) {
54  edm::LogVerbatim(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
55  << " Uploading LLD settings to DB...";
57  edm::LogVerbatim(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
58  << " Upload of LLD settings to DB finished!";
59  } else {
60  edm::LogWarning(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
61  << " TEST only! No LLD settings will be uploaded to DB...";
62  }
63 }

References CommissioningHistosUsingDb::db(), CommissioningHistosUsingDb::doUploadConf(), SiStripConfigDb::getDeviceDescriptions(), LogTrace, sistrip::mlDqmClient_, update(), and SiStripConfigDb::uploadDeviceDescriptions().

Member Data Documentation

◆ allowSelectiveUpload_

bool OptoScanHistosUsingDb::allowSelectiveUpload_
private

Definition at line 24 of file OptoScanHistosUsingDb.h.

Referenced by OptoScanHistosUsingDb(), and update().

◆ skipGainUpdate_

bool OptoScanHistosUsingDb::skipGainUpdate_
private

Definition at line 22 of file OptoScanHistosUsingDb.h.

Referenced by OptoScanHistosUsingDb(), and update().

SiStripConfigDb::getDeviceDescriptions
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
Definition: DeviceDescriptions.cc:11
SiStripConfigDb::DeviceDescriptionsRange
DeviceDescriptions::range DeviceDescriptionsRange
Definition: SiStripConfigDb.h:110
CommissioningHistograms::pset
const edm::ParameterSet & pset() const
Definition: CommissioningHistograms.h:163
CommissioningHistograms::bei
DQMStore *const bei() const
Definition: CommissioningHistograms.h:159
SiStripConfigDb::dbParams
const SiStripDbParams & dbParams() const
Definition: SiStripConfigDb.h:421
SiStripConfigDb::deviceAddress
DeviceAddress deviceAddress(const deviceDescription &)
Definition: DeviceDescriptions.cc:503
OptoScanHistograms::OptoScanHistograms
OptoScanHistograms(const edm::ParameterSet &pset, DQMStore *)
Definition: OptoScanHistograms.cc:18
sistrip::OPTO_SCAN
Definition: ConstantsForRunType.h:74
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
SiStripFedKey
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
CommissioningHistograms::data
Analyses & data(bool getMaskedData=false)
Definition: CommissioningHistograms.cc:718
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
Strings
std::vector< std::string > Strings
Definition: MsgTools.h:18
sistrip::mlDqmClient_
static const char mlDqmClient_[]
Definition: ConstantsForLogger.h:19
CommissioningHistograms::CommissioningHistograms
CommissioningHistograms()
Definition: CommissioningHistograms.cc:60
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
CommissioningHistosUsingDb::CommissioningHistosUsingDb
CommissioningHistosUsingDb()
Definition: CommissioningHistosUsingDb.cc:34
generateTowerEtThresholdLUT.addr
addr
Definition: generateTowerEtThresholdLUT.py:57
errors
Definition: errors.py:1
SiStripFecKey
Utility class that identifies a position within the strip tracker control structure,...
Definition: SiStripFecKey.h:45
SiStripConfigDb::uploadDeviceDescriptions
void uploadDeviceDescriptions(std::string partition="")
Definition: DeviceDescriptions.cc:264
edm::LogWarning
Definition: MessageLogger.h:141
sistrip::CHANS_PER_LLD
static const uint16_t CHANS_PER_LLD
Definition: ConstantsForHardwareSystems.h:39
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
OptoScanHistosUsingDb::update
void update(SiStripConfigDb::DeviceDescriptionsRange)
Definition: OptoScanHistosUsingDb.cc:67
SiStripDbParams::partitions
const_iterator_range partitions() const
Definition: SiStripDbParams.h:178
edm::LogVerbatim
Definition: MessageLogger.h:297
CommissioningHistosUsingDb::doUploadConf
bool doUploadConf() const
Definition: CommissioningHistosUsingDb.h:91
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
SiStripFecKey::i2cAddr
const uint16_t & i2cAddr() const
Definition: SiStripFecKey.h:204
OptoScanHistosUsingDb::allowSelectiveUpload_
bool allowSelectiveUpload_
Definition: OptoScanHistosUsingDb.h:24
OptoScanAnalysis
Histogram-based analysis for opto bias/gain scan.
Definition: OptoScanAnalysis.h:15
CommissioningHistosUsingDb::db
SiStripConfigDb *const db() const
Definition: CommissioningHistosUsingDb.h:93
SiStripConfigDb::DeviceAddress
Definition: SiStripConfigDb.h:141
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
CommissioningHistosUsingDb::deviceIsPresent
bool deviceIsPresent(const SiStripFecKey &)
Definition: CommissioningHistosUsingDb.cc:369
conversion_template_cfg.anal
anal
Definition: conversion_template_cfg.py:16
OptoScanHistosUsingDb::skipGainUpdate_
bool skipGainUpdate_
Definition: OptoScanHistosUsingDb.h:22