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, edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken)
 
void uploadConfigurations () override
 
 ~OptoScanHistosUsingDb () override
 
- Public Member Functions inherited from CommissioningHistosUsingDb
 CommissioningHistosUsingDb (SiStripConfigDb *const, edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken, 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 (const edm::ParameterSet &pset, DQMStore *const, const sistrip::RunType &)
 
 CommissioningHistograms ()
 
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,
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd tTopoToken 
)

Definition at line 13 of file OptoScanHistosUsingDb.cc.

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

19  OptoScanHistograms(pset.getParameter<edm::ParameterSet>("OptoScanParameters"), bei) {
20  LogTrace(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
21  << " Constructing object...";
22  skipGainUpdate_ = this->pset().getParameter<bool>("SkipGainUpdate");
23  if (skipGainUpdate_)
24  LogTrace(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
25  << " Skipping db update of gain parameters.";
26 
28  this->pset().existsAs<bool>("doSelectiveUpload") ? this->pset().getParameter<bool>("doSelectiveUpload") : false;
30  LogTrace(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
31  << " Enabling selective upload of gain parameters";
32 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
OptoScanHistograms(const edm::ParameterSet &pset, DQMStore *)
static const char mlDqmClient_[]
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:172
#define LogTrace(id)
SiStripConfigDb *const db() const
const edm::ParameterSet & pset() const
DQMStore *const bei() const

◆ ~OptoScanHistosUsingDb()

OptoScanHistosUsingDb::~OptoScanHistosUsingDb ( )
override

Definition at line 36 of file OptoScanHistosUsingDb.cc.

References LogTrace, and sistrip::mlDqmClient_.

36  {
37  LogTrace(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
38  << " Destructing object...";
39 }
static const char mlDqmClient_[]
#define LogTrace(id)

Member Function Documentation

◆ create()

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

Reimplemented from CommissioningHistosUsingDb.

Definition at line 136 of file OptoScanHistosUsingDb.cc.

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

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

◆ update()

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

Definition at line 70 of file OptoScanHistosUsingDb.cc.

References generateTowerEtThresholdLUT::addr, allowSelectiveUpload_, conversion_template_cfg::anal, SiStripFecKey::ccuAddr(), SiStripFecKey::ccuChan(), SiStripKey::channel(), sistrip::CHANS_PER_LLD, CommissioningHistograms::data(), CommissioningHistosUsingDb::db(), submitPVResolutionJobs::desc, SiStripConfigDb::deviceAddress(), CommissioningHistosUsingDb::deviceIsPresent(), cms::alpakatools::devices(), 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().

70  {
71  // Iterate through devices and update device descriptions
72  uint16_t updated = 0;
73  SiStripConfigDb::DeviceDescriptionsV::const_iterator idevice;
74  for (idevice = devices.begin(); idevice != devices.end(); idevice++) {
75  if ((*idevice)->getDeviceType() != LASERDRIVER) {
76  continue;
77  }
78 
79  // Cast to retrieve appropriate description object
80  laserdriverDescription* desc = dynamic_cast<laserdriverDescription*>(*idevice);
81  if (!desc) {
82  continue;
83  }
84 
85  // Retrieve device addresses from device description
87 
88  // Iterate through LLD channels
89  for (uint16_t ichan = 0; ichan < sistrip::CHANS_PER_LLD; ichan++) {
90  // Construct key from device description
91  SiStripFecKey fec_key(addr.fecCrate_, addr.fecSlot_, addr.fecRing_, addr.ccuAddr_, addr.ccuChan_, ichan + 1);
92 
93  // Iterate through all channels and extract LLD settings
94  Analyses::const_iterator iter = data(allowSelectiveUpload_).find(fec_key.key());
95  if (iter != data(allowSelectiveUpload_).end()) {
96  OptoScanAnalysis* anal = dynamic_cast<OptoScanAnalysis*>(iter->second);
97  if (!anal) {
98  edm::LogError(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
99  << " NULL pointer to analysis object!";
100  continue;
101  }
102 
103  uint16_t gain = anal->gain();
104  std::stringstream ss;
105  ss << "[OptoScanHistosUsingDb::" << __func__ << "]"
106  << " Updating LLD gain/bias settings for crate/crate/FEC/ring/CCU/module/LLD " << fec_key.fecCrate() << "/"
107  << fec_key.fecSlot() << "/" << fec_key.fecRing() << "/" << fec_key.ccuAddr() << "/" << fec_key.ccuChan()
108  << "/" << fec_key.channel() << " from " << static_cast<uint16_t>(desc->getGain(ichan)) << "/"
109  << static_cast<uint16_t>(desc->getBias(ichan));
110  if (!skipGainUpdate_)
111  desc->setGain(ichan, gain);
112  desc->setBias(ichan, anal->bias()[gain]);
113  updated++;
114  ss << " to " << static_cast<uint16_t>(desc->getGain(ichan)) << "/"
115  << static_cast<uint16_t>(desc->getBias(ichan));
116  LogTrace(mlDqmClient_) << ss.str();
117 
118  } else {
119  if (deviceIsPresent(fec_key)) {
120  edm::LogWarning(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
121  << " Unable to find FEC key with params crate/FEC/ring/CCU/module/LLD "
122  << fec_key.fecCrate() << "/" << fec_key.fecSlot() << "/" << fec_key.fecRing()
123  << "/" << fec_key.ccuAddr() << "/" << fec_key.ccuChan() << "/"
124  << fec_key.channel();
125  }
126  }
127  }
128  }
129 
130  edm::LogVerbatim(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
131  << " Updated LLD bias/gain settings for " << updated << " modules";
132 }
Histogram-based analysis for opto bias/gain scan.
Log< level::Info, true > LogVerbatim
Analyses & data(bool getMaskedData=false)
bool deviceIsPresent(const SiStripFecKey &)
static const char mlDqmClient_[]
Log< level::Error, false > LogError
#define LogTrace(id)
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
SiStripConfigDb *const db() const
static const uint16_t CHANS_PER_LLD
DeviceAddress deviceAddress(const deviceDescription &)
std::vector< alpaka::Dev< TPlatform > > const & devices()
Definition: devices.h:35
Log< level::Warning, false > LogWarning

◆ uploadConfigurations()

void OptoScanHistosUsingDb::uploadConfigurations ( )
overridevirtual

Reimplemented from CommissioningHistosUsingDb.

Definition at line 43 of file OptoScanHistosUsingDb.cc.

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

43  {
44  LogTrace(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]";
45 
46  if (!db()) {
47  edm::LogError(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
48  << " NULL pointer to SiStripConfigDb interface!"
49  << " Aborting upload...";
50  return;
51  }
52 
53  // Update LLD descriptions with new bias/gain settings
55  update(devices);
56  if (doUploadConf()) {
57  edm::LogVerbatim(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
58  << " Uploading LLD settings to DB...";
60  edm::LogVerbatim(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
61  << " Upload of LLD settings to DB finished!";
62  } else {
63  edm::LogWarning(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]"
64  << " TEST only! No LLD settings will be uploaded to DB...";
65  }
66 }
Log< level::Info, true > LogVerbatim
static const char mlDqmClient_[]
Log< level::Error, false > LogError
#define LogTrace(id)
void update(SiStripConfigDb::DeviceDescriptionsRange)
SiStripConfigDb *const db() const
DeviceDescriptions::range DeviceDescriptionsRange
std::vector< alpaka::Dev< TPlatform > > const & devices()
Definition: devices.h:35
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
Log< level::Warning, false > LogWarning
void uploadDeviceDescriptions(std::string partition="")

Member Data Documentation

◆ allowSelectiveUpload_

bool OptoScanHistosUsingDb::allowSelectiveUpload_
private

Definition at line 27 of file OptoScanHistosUsingDb.h.

Referenced by OptoScanHistosUsingDb(), and update().

◆ skipGainUpdate_

bool OptoScanHistosUsingDb::skipGainUpdate_
private

Definition at line 25 of file OptoScanHistosUsingDb.h.

Referenced by OptoScanHistosUsingDb(), and update().