CMS 3D CMS Logo

NoiseHistosUsingDb.cc
Go to the documentation of this file.
1 
8 #include <iostream>
9 
10 using namespace sistrip;
11 
12 // -----------------------------------------------------------------------------
15  DQMStore* bei,
16  SiStripConfigDb* const db,
18  : CommissioningHistograms(pset.getParameter<edm::ParameterSet>("NoiseParameters"), bei, sistrip::NOISE),
20  NoiseHistograms(pset.getParameter<edm::ParameterSet>("NoiseParameters"), bei) {
21  LogTrace(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]"
22  << " Constructing object...";
23 }
24 
25 // -----------------------------------------------------------------------------
28  LogTrace(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]"
29  << " Destructing object...";
30 }
31 
32 // -----------------------------------------------------------------------------
35  LogTrace(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]";
36 
37  if (!db()) {
38  edm::LogError(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]"
39  << " NULL pointer to SiStripConfigDb interface!"
40  << " Aborting upload...";
41  return;
42  }
43 
44  // Update FED descriptions with new peds/noise values
46  update(feds);
47  if (doUploadConf()) {
48  edm::LogVerbatim(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]"
49  << " Uploading pedestals/noise to DB...";
51  edm::LogVerbatim(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]"
52  << " Completed database upload of " << feds.size() << " FED descriptions!";
53  } else {
54  edm::LogWarning(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]"
55  << " TEST only! No pedestals/noise values will be uploaded to DB...";
56  }
57 }
58 
59 // -----------------------------------------------------------------------------
62  // Iterate through feds and update fed descriptions
63  uint16_t updated = 0;
64  SiStripConfigDb::FedDescriptionsV::const_iterator ifed;
65  for (ifed = feds.begin(); ifed != feds.end(); ifed++) {
66  for (uint16_t ichan = 0; ichan < sistrip::FEDCH_PER_FED; ichan++) {
67  // Build FED and FEC keys
68  const FedChannelConnection& conn = cabling()->fedConnection((*ifed)->getFedId(), ichan);
69  if (conn.fecCrate() == sistrip::invalid_ || conn.fecSlot() == sistrip::invalid_ ||
70  conn.fecRing() == sistrip::invalid_ || conn.ccuAddr() == sistrip::invalid_ ||
71  conn.ccuChan() == sistrip::invalid_ || conn.lldChannel() == sistrip::invalid_) {
72  continue;
73  }
74  SiStripFedKey fed_key(conn.fedId(), SiStripFedKey::feUnit(conn.fedCh()), SiStripFedKey::feChan(conn.fedCh()));
75  SiStripFecKey fec_key(
76  conn.fecCrate(), conn.fecSlot(), conn.fecRing(), conn.ccuAddr(), conn.ccuChan(), conn.lldChannel());
77 
78  // Locate appropriate analysis object
79  Analyses::const_iterator iter = data().find(fec_key.key());
80  if (iter != data().end()) {
81  // Check if analysis is valid
82  if (!iter->second->isValid()) {
83  continue;
84  }
85 
86  NoiseAnalysis* anal = dynamic_cast<NoiseAnalysis*>(iter->second);
87  if (!anal) {
88  edm::LogError(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]"
89  << " NULL pointer to analysis object!";
90  continue;
91  }
92 
93  // Iterate through APVs and strips
94  for (uint16_t iapv = 0; iapv < sistrip::APVS_PER_FEDCH; iapv++) {
95  for (uint16_t istr = 0; istr < anal->peds()[iapv].size(); istr++) {
96  constexpr float high_threshold = 5.;
97  constexpr float low_threshold = 2.;
98  constexpr bool disable_strip = false;
99  Fed9U::Fed9UStripDescription data(static_cast<uint32_t>(anal->peds()[iapv][istr]),
100  high_threshold,
101  low_threshold,
102  anal->noise()[iapv][istr],
103  disable_strip);
104  Fed9U::Fed9UAddress addr(ichan, iapv, istr);
105  (*ifed)->getFedStrips().setStrip(addr, data);
106  }
107  }
108  updated++;
109 
110  } else {
111  edm::LogWarning(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]"
112  << " Unable to find pedestals/noise for FedKey/Id/Ch: " << hex << setw(8)
113  << setfill('0') << fed_key.key() << dec << "/" << (*ifed)->getFedId() << "/"
114  << ichan << " and device with FEC/slot/ring/CCU/LLD " << fec_key.fecCrate() << "/"
115  << fec_key.fecSlot() << "/" << fec_key.fecRing() << "/" << fec_key.ccuAddr()
116  << "/" << fec_key.ccuChan() << "/" << fec_key.channel();
117  }
118  }
119  }
120 
121  edm::LogVerbatim(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]"
122  << " Updated FED pedestals/noise for " << updated << " channels";
123 }
124 
125 // -----------------------------------------------------------------------------
128  NoiseAnalysis* anal = dynamic_cast<NoiseAnalysis*>(analysis->second);
129  if (!anal) {
130  return;
131  }
132 
133  SiStripFecKey fec_key(anal->fecKey());
134  SiStripFedKey fed_key(anal->fedKey());
135 
136  for (uint16_t iapv = 0; iapv < 2; ++iapv) {
137  // Create description
138  PedestalsAnalysisDescription* tmp;
139  tmp = new PedestalsAnalysisDescription(anal->dead()[iapv],
140  anal->noisy()[iapv],
141  anal->pedsMean()[iapv],
142  anal->pedsSpread()[iapv],
143  anal->noiseMean()[iapv],
144  anal->noiseSpread()[iapv],
145  anal->rawMean()[iapv],
146  anal->rawSpread()[iapv],
147  anal->pedsMax()[iapv],
148  anal->pedsMin()[iapv],
149  anal->noiseMax()[iapv],
150  anal->noiseMin()[iapv],
151  anal->rawMax()[iapv],
152  anal->rawMin()[iapv],
153  fec_key.fecCrate(),
154  fec_key.fecSlot(),
155  fec_key.fecRing(),
156  fec_key.ccuAddr(),
157  fec_key.ccuChan(),
158  SiStripFecKey::i2cAddr(fec_key.lldChan(), !iapv),
159  db()->dbParams().partitions().begin()->second.partitionName(),
160  db()->dbParams().partitions().begin()->second.runNumber(),
161  anal->isValid(),
162  "",
163  fed_key.fedId(),
164  fed_key.feUnit(),
165  fed_key.feChan(),
166  fed_key.fedApv());
167 
168  // Add comments
169  typedef std::vector<std::string> Strings;
170  Strings errors = anal->getErrorCodes();
171  Strings::const_iterator istr = errors.begin();
172  Strings::const_iterator jstr = errors.end();
173  for (; istr != jstr; ++istr) {
174  tmp->addComments(*istr);
175  }
176 
177  // Store description
178  desc.push_back(tmp);
179  }
180 }
NoiseHistosUsingDb::uploadConfigurations
void uploadConfigurations() override
Definition: NoiseHistosUsingDb.cc:34
NoiseHistosUsingDb::NoiseHistosUsingDb
NoiseHistosUsingDb(const edm::ParameterSet &pset, DQMStore *, SiStripConfigDb *const, edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken)
Definition: NoiseHistosUsingDb.cc:14
l1tstage2emulator_dqm_sourceclient-live_cfg.feds
feds
Definition: l1tstage2emulator_dqm_sourceclient-live_cfg.py:152
NoiseHistograms
Definition: NoiseHistograms.h:7
MessageLogger.h
SiStripConfigDb::dbParams
const SiStripDbParams & dbParams() const
Definition: SiStripConfigDb.h:421
SiStripKey::key
const uint32_t & key() const
Definition: SiStripKey.h:120
edm
HLT enums.
Definition: AlignableModifier.h:19
SiStripConfigDb::getFedDescriptions
FedDescriptionsRange getFedDescriptions(std::string partition="")
Definition: FedDescriptions.cc:12
SiStripConfigDb::uploadFedDescriptions
void uploadFedDescriptions(std::string partition="")
Definition: FedDescriptions.cc:197
CommissioningHistosUsingDb::cabling
SiStripFedCabling *const cabling() const
Definition: CommissioningHistosUsingDb.h:100
SiStripCommissioningClient_cfg.conn
conn
Definition: SiStripCommissioningClient_cfg.py:5
SiStripFedCabling::fedConnection
FedChannelConnection fedConnection(uint16_t fed_id, uint16_t fed_ch) const
Definition: SiStripFedCabling.cc:171
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
CommissioningHistosUsingDb
Definition: CommissioningHistosUsingDb.h:18
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
sistrip::mlDqmClient_
static const char mlDqmClient_[]
Definition: ConstantsForLogger.h:19
NoiseHistosUsingDb::update
void update(SiStripConfigDb::FedDescriptionsRange)
Definition: NoiseHistosUsingDb.cc:61
dqmiodatasetharvest.db
db
Definition: dqmiodatasetharvest.py:119
SiStripConfigDb::FedDescriptionsRange
FedDescriptions::range FedDescriptionsRange
Definition: SiStripConfigDb.h:116
generateTowerEtThresholdLUT.addr
addr
Definition: generateTowerEtThresholdLUT.py:57
dqm::legacy::DQMStore
Definition: DQMStore.h:727
errors
Definition: errors.py:1
SiStripConfigDb
An interface class to the DeviceFactory.
Definition: SiStripConfigDb.h:47
SiStripFecKey
Utility class that identifies a position within the strip tracker control structure,...
Definition: SiStripFecKey.h:45
NoiseHistosUsingDb.h
SiStripFecKey.h
FedChannelConnection
Class containning control, module, detector and connection information, at the level of a FED channel...
Definition: FedChannelConnection.h:26
SiStripConstants.h
SiStripFedKey.h
edm::ParameterSet
Definition: ParameterSet.h:47
ParameterSet
Definition: Functions.h:16
SiStripDbParams::partitions
const_iterator_range partitions() const
Definition: SiStripDbParams.h:178
SiStripFedKey::feUnit
const uint16_t & feUnit() const
Definition: SiStripFedKey.h:189
CommissioningHistosUsingDb::doUploadConf
bool doUploadConf() const
Definition: CommissioningHistosUsingDb.h:97
sistrip::invalid_
static const uint16_t invalid_
Definition: Constants.h:16
CommissioningHistograms
Definition: CommissioningHistograms.h:23
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd >
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
SiStripFecKey::i2cAddr
const uint16_t & i2cAddr() const
Definition: SiStripFecKey.h:204
sistrip::APVS_PER_FEDCH
static const uint16_t APVS_PER_FEDCH
Definition: ConstantsForHardwareSystems.h:34
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
sistrip::NOISE
Definition: ConstantsForRunType.h:91
SiStripConfigDb::AnalysisDescriptionsV
std::vector< AnalysisDescription * > AnalysisDescriptionsV
Definition: SiStripConfigDb.h:135
NoiseAnalysis.h
sistrip::FEDCH_PER_FED
static const uint16_t FEDCH_PER_FED
Definition: ConstantsForHardwareSystems.h:30
CommissioningHistosUsingDb::db
SiStripConfigDb *const db() const
Definition: CommissioningHistosUsingDb.h:99
NoiseHistosUsingDb::create
void create(SiStripConfigDb::AnalysisDescriptionsV &, Analysis) override
Definition: NoiseHistosUsingDb.cc:127
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
sistrip
sistrip classes
Definition: SiStripQualityHelpers.h:14
conversion_template_cfg.anal
anal
Definition: conversion_template_cfg.py:16
NoiseHistosUsingDb::~NoiseHistosUsingDb
~NoiseHistosUsingDb() override
Definition: NoiseHistosUsingDb.cc:27
NoiseAnalysis
Histogram-based analysis for pedestal run.
Definition: NoiseAnalysis.h:15
CommissioningHistograms::Analysis
Analyses::iterator Analysis
Definition: CommissioningHistograms.h:58
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
SiStripFedKey::feChan
const uint16_t & feChan() const
Definition: SiStripFedKey.h:190