CMS 3D CMS Logo

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

#include <CalibrationHistosUsingDb.h>

Inheritance diagram for CalibrationHistosUsingDb:
CommissioningHistosUsingDb CalibrationHistograms CommissioningHistograms CommissioningHistograms

Public Member Functions

 CalibrationHistosUsingDb (const edm::ParameterSet &pset, DQMStore *, SiStripConfigDb *const, edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken, const sistrip::RunType &task=sistrip::CALIBRATION)
 
void uploadConfigurations () override
 
 ~CalibrationHistosUsingDb () 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 CalibrationHistograms
 CalibrationHistograms (const edm::ParameterSet &pset, DQMStore *, const sistrip::RunType &task=sistrip::CALIBRATION)
 
void histoAnalysis (bool debug) override
 
void printAnalyses () override
 
void save (std::string &filename, uint32_t run_number=0, std::string partitionName="")
 
 ~CalibrationHistograms () override
 

Private Member Functions

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

Private Attributes

bool allowSelectiveUpload_
 

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 13 of file CalibrationHistosUsingDb.h.

Constructor & Destructor Documentation

◆ CalibrationHistosUsingDb()

CalibrationHistosUsingDb::CalibrationHistosUsingDb ( const edm::ParameterSet pset,
DQMStore bei,
SiStripConfigDb * const  db,
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd tTopoToken,
const sistrip::RunType task = sistrip::CALIBRATION 
)

Definition at line 20 of file CalibrationHistosUsingDb.cc.

References generateTowerEtThresholdLUT::addr, allowSelectiveUpload_, newFWLiteAna::bin, CommissioningHistosUsingDb::db(), submitPVResolutionJobs::desc, SiStripConfigDb::deviceAddress(), edm::ParameterSet::existsAs(), SiStripConfigDb::getDeviceDescriptions(), edm::ParameterSet::getParameter(), LogTrace, sistrip::mlDqmClient_, and CommissioningHistograms::pset().

25  : CommissioningHistograms(pset.getParameter<edm::ParameterSet>("CalibrationParameters"), bei, task),
26  CommissioningHistosUsingDb(db, tTopoToken, task),
27  CalibrationHistograms(pset.getParameter<edm::ParameterSet>("CalibrationParameters"), bei, task) {
28  LogTrace(mlDqmClient_) << "[CalibrationHistosUsingDb::" << __func__ << "]"
29  << " Constructing object...";
30 
31  // Load and dump the current ISHA/VFS values. This is used by the standalone analysis script
32  const SiStripConfigDb::DeviceDescriptionsRange& apvDescriptions = db->getDeviceDescriptions(APV25);
33  for (SiStripConfigDb::DeviceDescriptionsV::const_iterator apv = apvDescriptions.begin(); apv != apvDescriptions.end();
34  ++apv) {
35  apvDescription* desc = dynamic_cast<apvDescription*>(*apv);
36  if (!desc) {
37  continue;
38  }
39  // Retrieve device addresses from device description
41  std::stringstream bin;
42  bin << std::setw(1) << std::setfill('0') << addr.fecCrate_;
43  bin << "." << std::setw(2) << std::setfill('0') << addr.fecSlot_;
44  bin << "." << std::setw(1) << std::setfill('0') << addr.fecRing_;
45  bin << "." << std::setw(3) << std::setfill('0') << addr.ccuAddr_;
46  bin << "." << std::setw(2) << std::setfill('0') << addr.ccuChan_;
47  bin << "." << desc->getAddress();
48  LogTrace(mlDqmClient_) << "Present values for ISHA/VFS of APV " << bin.str() << " : "
49  << static_cast<uint16_t>(desc->getIsha()) << " " << static_cast<uint16_t>(desc->getVfs());
50  }
51 
53  this->pset().existsAs<bool>("doSelectiveUpload") ? this->pset().getParameter<bool>("doSelectiveUpload") : false;
55  LogTrace(mlDqmClient_) << "[CalibrationHistosUsingDb::" << __func__ << "]"
56  << " Enabling selective update of FED parameters.";
57 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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:171
#define LogTrace(id)
CalibrationHistograms(const edm::ParameterSet &pset, DQMStore *, const sistrip::RunType &task=sistrip::CALIBRATION)
SiStripConfigDb *const db() const
DeviceDescriptions::range DeviceDescriptionsRange
DeviceAddress deviceAddress(const deviceDescription &)
const edm::ParameterSet & pset() const
DQMStore *const bei() const
const sistrip::RunType & task() const
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")

◆ ~CalibrationHistosUsingDb()

CalibrationHistosUsingDb::~CalibrationHistosUsingDb ( )
override

Definition at line 61 of file CalibrationHistosUsingDb.cc.

References LogTrace, and sistrip::mlDqmClient_.

61  {
62  LogTrace(mlDqmClient_) << "[CalibrationHistosUsingDb::" << __func__ << "]"
63  << " Destructing object...";
64 }
static const char mlDqmClient_[]
#define LogTrace(id)

Member Function Documentation

◆ create()

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

Reimplemented from CommissioningHistosUsingDb.

Definition at line 179 of file CalibrationHistosUsingDb.cc.

References conversion_template_cfg::anal, sistrip::CALIBRATION, sistrip::CALIBRATION_DECO, sistrip::CALIBRATION_SCAN, sistrip::CALIBRATION_SCAN_DECO, CommissioningHistosUsingDb::db(), SiStripConfigDb::dbParams(), submitPVResolutionJobs::desc, SiStripFecKey::i2cAddr(), or, SiStripDbParams::partitions(), CommissioningHistograms::task(), and createJobs::tmp.

179  {
180  if (task() == sistrip::CALIBRATION or
181  task() == sistrip::CALIBRATION_DECO) { // calibration run --> pulse shape measurement
182 
183  CalibrationAnalysis* anal = dynamic_cast<CalibrationAnalysis*>(analysis->second);
184  if (!anal) {
185  return;
186  }
187 
188  SiStripFecKey fec_key(anal->fecKey());
189  SiStripFedKey fed_key(anal->fedKey());
190 
191  for (uint16_t iapv = 0; iapv < 2; ++iapv) {
192  // Create description table with placeholder values for isha and vfs
193  CalibrationAnalysisDescription* tmp;
194  tmp = new CalibrationAnalysisDescription(anal->amplitudeMean()[iapv],
195  anal->tailMean()[iapv],
196  anal->riseTimeMean()[iapv],
197  anal->decayTimeMean()[iapv],
198  anal->smearingMean()[iapv],
199  anal->chi2Mean()[iapv],
200  anal->deconvMode(),
201  fec_key.fecCrate(),
202  fec_key.fecSlot(),
203  fec_key.fecRing(),
204  fec_key.ccuAddr(),
205  fec_key.ccuChan(),
206  SiStripFecKey::i2cAddr(fec_key.lldChan(), !iapv),
207  db()->dbParams().partitions().begin()->second.partitionName(),
208  db()->dbParams().partitions().begin()->second.runNumber(),
209  anal->isValid(),
210  "",
211  fed_key.fedId(),
212  fed_key.feUnit(),
213  fed_key.feChan(),
214  fed_key.fedApv(),
215  anal->calChan(),
216  -1,
217  -1);
218 
219  // Add comments
220  typedef std::vector<std::string> Strings;
221  Strings errors = anal->getErrorCodes();
222  Strings::const_iterator istr = errors.begin();
223  Strings::const_iterator jstr = errors.end();
224  for (; istr != jstr; ++istr) {
225  tmp->addComments(*istr);
226  }
227  // Store description
228  desc.push_back(tmp);
229  }
231  CalibrationScanAnalysis* anal = dynamic_cast<CalibrationScanAnalysis*>(analysis->second);
232  if (!anal) {
233  return;
234  }
235 
236  SiStripFecKey fec_key(anal->fecKey());
237  SiStripFedKey fed_key(anal->fedKey());
238 
239  for (uint16_t iapv = 0; iapv < 2; ++iapv) {
240  // Create description table with placeholder values for isha and vfs
241  CalibrationAnalysisDescription* tmp;
242  tmp = new CalibrationAnalysisDescription(anal->tunedAmplitude()[iapv],
243  anal->tunedTail()[iapv],
244  anal->tunedRiseTime()[iapv],
245  anal->tunedDecayTime()[iapv],
246  anal->tunedSmearing()[iapv],
247  anal->tunedChi2()[iapv],
248  anal->deconvMode(),
249  fec_key.fecCrate(),
250  fec_key.fecSlot(),
251  fec_key.fecRing(),
252  fec_key.ccuAddr(),
253  fec_key.ccuChan(),
254  SiStripFecKey::i2cAddr(fec_key.lldChan(), !iapv),
255  db()->dbParams().partitions().begin()->second.partitionName(),
256  db()->dbParams().partitions().begin()->second.runNumber(),
257  anal->isValid(),
258  "",
259  fed_key.fedId(),
260  fed_key.feUnit(),
261  fed_key.feChan(),
262  fed_key.fedApv(),
263  -1,
264  anal->tunedISHA()[iapv],
265  anal->tunedVFS()[iapv]);
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) {
273  tmp->addComments(*istr);
274  }
275  // Store description
276  desc.push_back(tmp);
277  }
278  }
279 }
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
Analysis for calibration runs.
const uint16_t & i2cAddr() const
SiStripConfigDb *const db() const
Analysis for calibration scans.
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
Definition: errors.py:1
const SiStripDbParams & dbParams() const
const sistrip::RunType & task() const
tmp
align.sh
Definition: createJobs.py:716

◆ update()

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

Definition at line 103 of file CalibrationHistosUsingDb.cc.

References generateTowerEtThresholdLUT::addr, allowSelectiveUpload_, conversion_template_cfg::anal, sistrip::CALIBRATION, sistrip::CALIBRATION_DECO, sistrip::CALIBRATION_SCAN, sistrip::CALIBRATION_SCAN_DECO, SiStripFecKey::ccuAddr(), SiStripFecKey::ccuChan(), SiStripKey::channel(), CommissioningHistograms::data(), CommissioningHistosUsingDb::db(), submitPVResolutionJobs::desc, SiStripConfigDb::deviceAddress(), CommissioningHistosUsingDb::deviceIsPresent(), cms::alpakatools::devices(), SiStripFecKey::fecCrate(), SiStripFecKey::fecRing(), SiStripFecKey::fecSlot(), SiStripKey::key(), sistrip::mlDqmClient_, or, contentValuesCheck::ss, and CommissioningHistograms::task().

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

103  {
106  << "[CalibrationHistosUsingDb::" << __func__ << "]"
107  << " Nothing has to be uploaded to the SiStripConfigDb for CALIBRATION_SCAN or CALIBRATION_SCAN_DECO run-type"
108  << " Aborting upload...";
109  return;
111  // Iterate through devices and update device descriptions
112  SiStripConfigDb::DeviceDescriptionsV::const_iterator idevice;
113  for (idevice = devices.begin(); idevice != devices.end(); idevice++) {
114  // Check device type
115  if ((*idevice)->getDeviceType() != APV25) {
116  continue;
117  }
118  // Cast to retrieve appropriate description object
119  apvDescription* desc = dynamic_cast<apvDescription*>(*idevice);
120  if (!desc) {
121  continue;
122  }
123  // Retrieve the device address from device description
125 
126  // Retrieve LLD channel and APV numbers
127  uint16_t ichan = (desc->getAddress() - 0x20) / 2;
128  uint16_t iapv = (desc->getAddress() - 0x20) % 2;
129 
130  // Construct key from device description
131  SiStripFecKey fec_key(addr.fecCrate_, addr.fecSlot_, addr.fecRing_, addr.ccuAddr_, addr.ccuChan_, ichan + 1);
132 
133  // Iterate through all channels and extract LLD settings
134  Analyses::const_iterator iter = data(allowSelectiveUpload_).find(fec_key.key());
135  if (iter != data(allowSelectiveUpload_).end()) {
136  CalibrationScanAnalysis* anal = dynamic_cast<CalibrationScanAnalysis*>(iter->second);
137 
138  if (!anal) {
139  edm::LogError(mlDqmClient_) << "[CalibrationHistosUsingDb::" << __func__ << "]"
140  << " NULL pointer to analysis object!";
141  continue;
142  }
143 
144  std::stringstream ss;
145  ss << "[CalibrationHistosUsingDb::" << __func__ << "]"
146  << " Updating ISHA and VFS setting for FECCrate/FECSlot/FECRing/CCUAddr/LLD/APV " << fec_key.fecCrate()
147  << "/" << fec_key.fecSlot() << "/" << fec_key.fecRing() << "/" << fec_key.ccuAddr() << "/"
148  << fec_key.ccuChan() << "/" << fec_key.channel() << iapv << " from ISHA "
149  << static_cast<uint16_t>(desc->getIsha()) << " and VFS " << static_cast<uint16_t>(desc->getVfs());
150  if (iapv == 0) {
151  desc->setIsha(anal->bestISHA()[0]);
152  }
153  if (iapv == 1) {
154  desc->setIsha(anal->bestISHA()[1]);
155  }
156  if (iapv == 0) {
157  desc->setVfs(anal->bestVFS()[0]);
158  }
159  if (iapv == 1) {
160  desc->setVfs(anal->bestVFS()[1]);
161  }
162  ss << " to ISHA " << static_cast<uint16_t>(desc->getIsha()) << " and VFS "
163  << static_cast<uint16_t>(desc->getVfs());
164  edm::LogWarning(mlDqmClient_) << ss.str();
165  } else {
166  if (deviceIsPresent(fec_key)) {
167  edm::LogWarning(mlDqmClient_) << "[CalibrationHistosUsingDb::" << __func__ << "]"
168  << " Unable to find FEC key with params FEC/slot/ring/CCU/LLDchan/APV: "
169  << fec_key.fecCrate() << "/" << fec_key.fecSlot() << "/" << fec_key.fecRing()
170  << "/" << fec_key.ccuAddr() << "/" << fec_key.ccuChan() << "/"
171  << fec_key.channel() << "/" << iapv + 1;
172  }
173  }
174  }
175  }
176 }
Analyses & data(bool getMaskedData=false)
bool deviceIsPresent(const SiStripFecKey &)
static const char mlDqmClient_[]
Log< level::Error, false > LogError
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
Analysis for calibration scans.
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
DeviceAddress deviceAddress(const deviceDescription &)
std::vector< alpaka::Dev< TPlatform > > const & devices()
Definition: devices.h:36
const sistrip::RunType & task() const
Log< level::Warning, false > LogWarning

◆ uploadConfigurations()

void CalibrationHistosUsingDb::uploadConfigurations ( )
overridevirtual

Reimplemented from CommissioningHistosUsingDb.

Definition at line 68 of file CalibrationHistosUsingDb.cc.

References sistrip::CALIBRATION, sistrip::CALIBRATION_DECO, sistrip::CALIBRATION_SCAN, sistrip::CALIBRATION_SCAN_DECO, CommissioningHistosUsingDb::db(), cms::alpakatools::devices(), CommissioningHistosUsingDb::doUploadConf(), SiStripConfigDb::getDeviceDescriptions(), LogTrace, sistrip::mlDqmClient_, or, CommissioningHistograms::task(), update(), and SiStripConfigDb::uploadDeviceDescriptions().

68  {
69  if (!db()) {
70  edm::LogWarning(mlDqmClient_) << "[CalibrationHistosUsingDb::" << __func__ << "]"
71  << " NULL pointer to SiStripConfigDb interface!"
72  << " Aborting upload...";
73  return;
74  }
75 
78  << "[CalibrationHistosUsingDb::" << __func__ << "]"
79  << " Nothing has to be uploaded to the SiStripConfigDb for CALIBRATION_SCAN or CALIBRATION_SCAN_DECO run-types"
80  << " Aborting upload...";
81  return;
83  // Update all APV device descriptions with new ISHA and VFS settings
85  update(devices);
86  if (doUploadConf()) {
87  edm::LogVerbatim(mlDqmClient_) << "[CalibrationHistosUsingDb::" << __func__ << "]"
88  << " Uploading ISHA/VFS settings to DB...";
90  edm::LogVerbatim(mlDqmClient_) << "[CalibrationHistosUsingDb::" << __func__ << "]"
91  << " Uploaded ISHA/VFS settings to DB!";
92  } else {
93  edm::LogWarning(mlDqmClient_) << "[CalibrationHistosUsingDb::" << __func__ << "]"
94  << " TEST only! No ISHA/VFS settings will be uploaded to DB...";
95  }
96 
97  LogTrace(mlDqmClient_) << "[CalibrationHistosUsingDb::" << __func__ << "]"
98  << " Upload of ISHA/VFS settings to DB finished!";
99  }
100 }
Log< level::Info, true > LogVerbatim
static const char mlDqmClient_[]
#define LogTrace(id)
SiStripConfigDb *const db() const
DeviceDescriptions::range DeviceDescriptionsRange
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
std::vector< alpaka::Dev< TPlatform > > const & devices()
Definition: devices.h:36
void update(SiStripConfigDb::DeviceDescriptionsRange &)
const sistrip::RunType & task() const
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
Log< level::Warning, false > LogWarning
void uploadDeviceDescriptions(std::string partition="")

Member Data Documentation

◆ allowSelectiveUpload_

bool CalibrationHistosUsingDb::allowSelectiveUpload_
private

Definition at line 26 of file CalibrationHistosUsingDb.h.

Referenced by CalibrationHistosUsingDb(), and update().