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  : CommissioningHistograms(pset.getParameter<edm::ParameterSet>("NoiseParameters"), bei, sistrip::NOISE),
17  NoiseHistograms(pset.getParameter<edm::ParameterSet>("NoiseParameters"), bei) {
18  LogTrace(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]"
19  << " Constructing object...";
20 }
21 
22 // -----------------------------------------------------------------------------
25  LogTrace(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]"
26  << " Destructing object...";
27 }
28 
29 // -----------------------------------------------------------------------------
32  LogTrace(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]";
33 
34  if (!db()) {
35  edm::LogError(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]"
36  << " NULL pointer to SiStripConfigDb interface!"
37  << " Aborting upload...";
38  return;
39  }
40 
41  // Update FED descriptions with new peds/noise values
43  update(feds);
44  if (doUploadConf()) {
45  edm::LogVerbatim(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]"
46  << " Uploading pedestals/noise to DB...";
48  edm::LogVerbatim(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]"
49  << " Completed database upload of " << feds.size() << " FED descriptions!";
50  } else {
51  edm::LogWarning(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]"
52  << " TEST only! No pedestals/noise values will be uploaded to DB...";
53  }
54 }
55 
56 // -----------------------------------------------------------------------------
59  // Iterate through feds and update fed descriptions
60  uint16_t updated = 0;
61  SiStripConfigDb::FedDescriptionsV::const_iterator ifed;
62  for (ifed = feds.begin(); ifed != feds.end(); ifed++) {
63  for (uint16_t ichan = 0; ichan < sistrip::FEDCH_PER_FED; ichan++) {
64  // Build FED and FEC keys
65  const FedChannelConnection& conn = cabling()->fedConnection((*ifed)->getFedId(), ichan);
66  if (conn.fecCrate() == sistrip::invalid_ || conn.fecSlot() == sistrip::invalid_ ||
67  conn.fecRing() == sistrip::invalid_ || conn.ccuAddr() == sistrip::invalid_ ||
68  conn.ccuChan() == sistrip::invalid_ || conn.lldChannel() == sistrip::invalid_) {
69  continue;
70  }
71  SiStripFedKey fed_key(conn.fedId(), SiStripFedKey::feUnit(conn.fedCh()), SiStripFedKey::feChan(conn.fedCh()));
72  SiStripFecKey fec_key(
73  conn.fecCrate(), conn.fecSlot(), conn.fecRing(), conn.ccuAddr(), conn.ccuChan(), conn.lldChannel());
74 
75  // Locate appropriate analysis object
76  Analyses::const_iterator iter = data().find(fec_key.key());
77  if (iter != data().end()) {
78  // Check if analysis is valid
79  if (!iter->second->isValid()) {
80  continue;
81  }
82 
83  NoiseAnalysis* anal = dynamic_cast<NoiseAnalysis*>(iter->second);
84  if (!anal) {
85  edm::LogError(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]"
86  << " NULL pointer to analysis object!";
87  continue;
88  }
89 
90  // Iterate through APVs and strips
91  for (uint16_t iapv = 0; iapv < sistrip::APVS_PER_FEDCH; iapv++) {
92  for (uint16_t istr = 0; istr < anal->peds()[iapv].size(); istr++) {
93  constexpr float high_threshold = 5.;
94  constexpr float low_threshold = 2.;
95  constexpr bool disable_strip = false;
96  Fed9U::Fed9UStripDescription data(static_cast<uint32_t>(anal->peds()[iapv][istr]),
97  high_threshold,
98  low_threshold,
99  anal->noise()[iapv][istr],
100  disable_strip);
101  Fed9U::Fed9UAddress addr(ichan, iapv, istr);
102  (*ifed)->getFedStrips().setStrip(addr, data);
103  }
104  }
105  updated++;
106 
107  } else {
108  edm::LogWarning(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]"
109  << " Unable to find pedestals/noise for FedKey/Id/Ch: " << hex << setw(8)
110  << setfill('0') << fed_key.key() << dec << "/" << (*ifed)->getFedId() << "/"
111  << ichan << " and device with FEC/slot/ring/CCU/LLD " << fec_key.fecCrate() << "/"
112  << fec_key.fecSlot() << "/" << fec_key.fecRing() << "/" << fec_key.ccuAddr()
113  << "/" << fec_key.ccuChan() << "/" << fec_key.channel();
114  }
115  }
116  }
117 
118  edm::LogVerbatim(mlDqmClient_) << "[NoiseHistosUsingDb::" << __func__ << "]"
119  << " Updated FED pedestals/noise for " << updated << " channels";
120 }
121 
122 // -----------------------------------------------------------------------------
125  NoiseAnalysis* anal = dynamic_cast<NoiseAnalysis*>(analysis->second);
126  if (!anal) {
127  return;
128  }
129 
130  SiStripFecKey fec_key(anal->fecKey());
131  SiStripFedKey fed_key(anal->fedKey());
132 
133  for (uint16_t iapv = 0; iapv < 2; ++iapv) {
134  // Create description
135  PedestalsAnalysisDescription* tmp;
136  tmp = new PedestalsAnalysisDescription(anal->dead()[iapv],
137  anal->noisy()[iapv],
138  anal->pedsMean()[iapv],
139  anal->pedsSpread()[iapv],
140  anal->noiseMean()[iapv],
141  anal->noiseSpread()[iapv],
142  anal->rawMean()[iapv],
143  anal->rawSpread()[iapv],
144  anal->pedsMax()[iapv],
145  anal->pedsMin()[iapv],
146  anal->noiseMax()[iapv],
147  anal->noiseMin()[iapv],
148  anal->rawMax()[iapv],
149  anal->rawMin()[iapv],
150  fec_key.fecCrate(),
151  fec_key.fecSlot(),
152  fec_key.fecRing(),
153  fec_key.ccuAddr(),
154  fec_key.ccuChan(),
155  SiStripFecKey::i2cAddr(fec_key.lldChan(), !iapv),
156  db()->dbParams().partitions().begin()->second.partitionName(),
157  db()->dbParams().partitions().begin()->second.runNumber(),
158  anal->isValid(),
159  "",
160  fed_key.fedId(),
161  fed_key.feUnit(),
162  fed_key.feChan(),
163  fed_key.fedApv());
164 
165  // Add comments
166  typedef std::vector<std::string> Strings;
167  Strings errors = anal->getErrorCodes();
168  Strings::const_iterator istr = errors.begin();
169  Strings::const_iterator jstr = errors.end();
170  for (; istr != jstr; ++istr) {
171  tmp->addComments(*istr);
172  }
173 
174  // Store description
175  desc.push_back(tmp);
176  }
177 }
NoiseHistosUsingDb::uploadConfigurations
void uploadConfigurations() override
Definition: NoiseHistosUsingDb.cc:31
l1tstage2emulator_dqm_sourceclient-live_cfg.feds
feds
Definition: l1tstage2emulator_dqm_sourceclient-live_cfg.py:153
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:94
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:16
sistrip::mlDqmClient_
static const char mlDqmClient_[]
Definition: ConstantsForLogger.h:19
NoiseHistosUsingDb::update
void update(SiStripConfigDb::FedDescriptionsRange)
Definition: NoiseHistosUsingDb.cc:58
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
edm::LogWarning
Definition: MessageLogger.h:141
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:36
edm::LogError
Definition: MessageLogger.h:183
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
NoiseHistosUsingDb::NoiseHistosUsingDb
NoiseHistosUsingDb(const edm::ParameterSet &pset, DQMStore *, SiStripConfigDb *const)
Definition: NoiseHistosUsingDb.cc:14
edm::LogVerbatim
Definition: MessageLogger.h:297
CommissioningHistosUsingDb::doUploadConf
bool doUploadConf() const
Definition: CommissioningHistosUsingDb.h:91
sistrip::invalid_
static const uint16_t invalid_
Definition: Constants.h:16
CommissioningHistograms
Definition: CommissioningHistograms.h:23
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
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:93
NoiseHistosUsingDb::create
void create(SiStripConfigDb::AnalysisDescriptionsV &, Analysis) override
Definition: NoiseHistosUsingDb.cc:124
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
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:24
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