CMS 3D CMS Logo

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

#include <PedestalsHistosUsingDb.h>

Inheritance diagram for PedestalsHistosUsingDb:
CommissioningHistosUsingDb PedestalsHistograms CommissioningHistograms CommissioningHistograms

Public Member Functions

 PedestalsHistosUsingDb (const edm::ParameterSet &pset, DQMStore *, SiStripConfigDb *const, edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken)
 
void uploadConfigurations () override
 
 ~PedestalsHistosUsingDb () 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 PedestalsHistograms
void histoAnalysis (bool debug) override
 
 PedestalsHistograms (const edm::ParameterSet &pset, DQMStore *)
 
void printAnalyses () override
 
 ~PedestalsHistograms () override
 

Private Member Functions

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

Private Attributes

bool allowSelectiveUpload_
 
bool disableBadStrips_
 
float highThreshold_
 
bool keepStripsDisabled_
 
float lowThreshold_
 

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 PedestalsHistosUsingDb.h.

Constructor & Destructor Documentation

◆ PedestalsHistosUsingDb()

PedestalsHistosUsingDb::PedestalsHistosUsingDb ( const edm::ParameterSet pset,
DQMStore bei,
SiStripConfigDb * const  db,
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd tTopoToken 
)

Definition at line 14 of file PedestalsHistosUsingDb.cc.

References allowSelectiveUpload_, disableBadStrips_, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), highThreshold_, keepStripsDisabled_, LogTrace, lowThreshold_, sistrip::mlDqmClient_, and CommissioningHistograms::pset().

20  PedestalsHistograms(pset.getParameter<edm::ParameterSet>("PedestalsParameters"), bei) {
21  LogTrace(mlDqmClient_) << "[PedestalsHistosUsingDb::" << __func__ << "]"
22  << " Constructing object...";
23  highThreshold_ = this->pset().getParameter<double>("HighThreshold");
24  lowThreshold_ = this->pset().getParameter<double>("LowThreshold");
25  LogTrace(mlDqmClient_) << "[PedestalsHistosUsingDb::" << __func__ << "]"
26  << " Set FED zero suppression high/low threshold to " << highThreshold_ << "/"
27  << lowThreshold_;
28  disableBadStrips_ = this->pset().getParameter<bool>("DisableBadStrips");
29  keepStripsDisabled_ = this->pset().getParameter<bool>("KeepStripsDisabled");
30  LogTrace(mlDqmClient_) << "[PedestalsHistosUsingDb::" << __func__ << "]"
31  << " Disabling strips: " << disableBadStrips_
32  << " ; keeping previously disabled strips: " << keepStripsDisabled_;
33 
35  this->pset().existsAs<bool>("doSelectiveUpload") ? this->pset().getParameter<bool>("doSelectiveUpload") : false;
36  LogTrace(mlDqmClient_) << "[PedestalsHistosUsingDb::" << __func__ << "]"
37  << " Selective upload of modules set to : " << allowSelectiveUpload_;
38 }
PedestalsHistograms(const edm::ParameterSet &pset, DQMStore *)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
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

◆ ~PedestalsHistosUsingDb()

PedestalsHistosUsingDb::~PedestalsHistosUsingDb ( )
override

Definition at line 42 of file PedestalsHistosUsingDb.cc.

References LogTrace, and sistrip::mlDqmClient_.

42  {
43  LogTrace(mlDqmClient_) << "[PedestalsHistosUsingDb::" << __func__ << "]"
44  << " Destructing object...";
45 }
static const char mlDqmClient_[]
#define LogTrace(id)

Member Function Documentation

◆ create()

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

Reimplemented from CommissioningHistosUsingDb.

Definition at line 201 of file PedestalsHistosUsingDb.cc.

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

201  {
202  PedestalsAnalysis* anal = dynamic_cast<PedestalsAnalysis*>(analysis->second);
203  if (!anal) {
204  return;
205  }
206 
207  SiStripFecKey fec_key(anal->fecKey());
208  SiStripFedKey fed_key(anal->fedKey());
209 
210  for (uint16_t iapv = 0; iapv < 2; ++iapv) {
211  // Create description
212  PedestalsAnalysisDescription* tmp;
213  tmp = new PedestalsAnalysisDescription(anal->dead()[iapv],
214  anal->noisy()[iapv],
215  anal->pedsMean()[iapv],
216  anal->pedsSpread()[iapv],
217  anal->noiseMean()[iapv],
218  anal->noiseSpread()[iapv],
219  anal->rawMean()[iapv],
220  anal->rawSpread()[iapv],
221  anal->pedsMax()[iapv],
222  anal->pedsMin()[iapv],
223  anal->noiseMax()[iapv],
224  anal->noiseMin()[iapv],
225  anal->rawMax()[iapv],
226  anal->rawMin()[iapv],
227  fec_key.fecCrate(),
228  fec_key.fecSlot(),
229  fec_key.fecRing(),
230  fec_key.ccuAddr(),
231  fec_key.ccuChan(),
232  SiStripFecKey::i2cAddr(fec_key.lldChan(), !iapv),
233  db()->dbParams().partitions().begin()->second.partitionName(),
234  db()->dbParams().partitions().begin()->second.runNumber(),
235  anal->isValid(),
236  "",
237  fed_key.fedId(),
238  fed_key.feUnit(),
239  fed_key.feChan(),
240  fed_key.fedApv());
241 
242  // Add comments
243  typedef std::vector<std::string> Strings;
244  Strings errors = anal->getErrorCodes();
245  Strings::const_iterator istr = errors.begin();
246  Strings::const_iterator jstr = errors.end();
247  for (; istr != jstr; ++istr) {
248  tmp->addComments(*istr);
249  }
250 
251  // Store description
252  desc.push_back(tmp);
253  }
254 }
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
Histogram-based analysis for pedestal run.
Definition: errors.py:1
const SiStripDbParams & dbParams() const
tmp
align.sh
Definition: createJobs.py:716

◆ update()

void PedestalsHistosUsingDb::update ( SiStripConfigDb::FedDescriptionsRange  feds)
private

Definition at line 76 of file PedestalsHistosUsingDb.cc.

References generateTowerEtThresholdLUT::addr, allowSelectiveUpload_, conversion_template_cfg::anal, sistrip::APVS_PER_FEDCH, CommissioningHistosUsingDb::cabling(), getInfo::conn, CommissioningHistograms::data(), TauDecayModes::dec, CommissioningHistosUsingDb::deviceIsPresent(), disableBadStrips_, SiStripFedKey::feChan(), sistrip::FEDCH_PER_FED, SiStripFedKey::fedChannel(), SiStripFedCabling::fedConnection(), SiStripFedKey::fedId(), l1tstage2emulator_dqm_sourceclient-live_cfg::feds, SiStripFedKey::feUnit(), spr::find(), highThreshold_, sistrip::invalid_, edm::isDebugEnabled(), keepStripsDisabled_, SiStripKey::key(), LogTrace, lowThreshold_, sistrip::mlDqmClient_, contentValuesCheck::ss, and groupFilesInBlocks::temp.

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

76  {
77  // Iterate through feds and update fed descriptions
78  uint16_t updated = 0;
79  SiStripConfigDb::FedDescriptionsV::const_iterator ifed;
80  for (ifed = feds.begin(); ifed != feds.end(); ifed++) {
81  for (uint16_t ichan = 0; ichan < sistrip::FEDCH_PER_FED; ichan++) {
82  // Build FED and FEC keys
83  const FedChannelConnection& conn = cabling()->fedConnection((*ifed)->getFedId(), ichan);
84  if (conn.fecCrate() == sistrip::invalid_ || conn.fecSlot() == sistrip::invalid_ ||
85  conn.fecRing() == sistrip::invalid_ || conn.ccuAddr() == sistrip::invalid_ ||
86  conn.ccuChan() == sistrip::invalid_ || conn.lldChannel() == sistrip::invalid_) {
87  continue;
88  }
89  SiStripFedKey fed_key(conn.fedId(), SiStripFedKey::feUnit(conn.fedCh()), SiStripFedKey::feChan(conn.fedCh()));
90  SiStripFecKey fec_key(
91  conn.fecCrate(), conn.fecSlot(), conn.fecRing(), conn.ccuAddr(), conn.ccuChan(), conn.lldChannel());
92 
93  // Locate appropriate analysis object
94  Analyses::const_iterator iter = data(allowSelectiveUpload_).find(fec_key.key());
95  if (iter != data(allowSelectiveUpload_).end()) {
96  // Check if analysis is valid
97  if (!iter->second->isValid()) {
98  continue;
99  }
100 
101  PedestalsAnalysis* anal = dynamic_cast<PedestalsAnalysis*>(iter->second);
102  if (!anal) {
103  edm::LogError(mlDqmClient_) << "[PedestalsHistosUsingDb::" << __func__ << "]"
104  << " NULL pointer to analysis object!";
105  continue;
106  }
107 
108  // Determine the pedestal shift to apply
109  uint32_t pedshift = 127;
110  for (uint16_t iapv = 0; iapv < sistrip::APVS_PER_FEDCH; iapv++) {
111  uint32_t pedmin = (uint32_t)anal->pedsMin()[iapv];
112  pedshift = pedmin < pedshift ? pedmin : pedshift;
113  std::stringstream ss;
114  ss << "iapv: " << iapv << " pedsMin()[iapv]: " << anal->pedsMin()[iapv] << " pedmin: " << pedmin
115  << " pedshift: " << pedshift;
116  edm::LogWarning(mlDqmClient_) << ss.str();
117  }
118 
119  // Iterate through APVs and strips
120  for (uint16_t iapv = 0; iapv < sistrip::APVS_PER_FEDCH; iapv++) {
121  for (uint16_t istr = 0; istr < anal->peds()[iapv].size(); istr++) {
122  // get the information on the strip as it was on the db
123  Fed9U::Fed9UAddress addr(ichan, iapv, istr);
124  Fed9U::Fed9UStripDescription temp = (*ifed)->getFedStrips().getStrip(addr);
125 
126  if (anal->peds()[iapv][istr] < 1.) { //@@ ie, zero
128  << "[PedestalsHistosUsingDb::" << __func__ << "]"
129  << " Skipping ZERO pedestal value (ie, NO UPLOAD TO DB!) for FedKey/Id/Ch: " << hex << setw(8)
130  << setfill('0') << fed_key.key() << dec << "/" << (*ifed)->getFedId() << "/" << ichan
131  << " and device with FEC/slot/ring/CCU/LLD " << fec_key.fecCrate() << "/" << fec_key.fecSlot() << "/"
132  << fec_key.fecRing() << "/" << fec_key.ccuAddr() << "/" << fec_key.ccuChan() << "/"
133  << fec_key.channel();
134  continue; //@@ do not upload
135  }
136 
137  // determine whether we need to disable the strip
138  bool disableStrip = false;
139  if (keepStripsDisabled_) {
140  disableStrip = temp.getDisable();
141  } else if (disableBadStrips_) {
142  PedestalsAnalysis::VInt dead = anal->dead()[iapv];
143  if (find(dead.begin(), dead.end(), istr) != dead.end())
144  disableStrip = true;
145  PedestalsAnalysis::VInt noisy = anal->noisy()[iapv];
146  if (find(noisy.begin(), noisy.end(), istr) != noisy.end())
147  disableStrip = true;
148  }
149 
150  Fed9U::Fed9UStripDescription data(static_cast<uint32_t>(anal->peds()[iapv][istr] - pedshift),
153  anal->noise()[iapv][istr],
154  disableStrip);
155 
156  std::stringstream ss;
157  if (data.getDisable() && edm::isDebugEnabled()) {
158  ss << "[PedestalsHistosUsingDb::" << __func__ << "]"
159  << " Disabling strip in Fed9UStripDescription object..." << std::endl
160  << " for FED id/channel and APV/strip : " << fed_key.fedId() << "/" << fed_key.fedChannel() << " "
161  << iapv << "/" << istr << std::endl
162  << " and crate/FEC/ring/CCU/module : " << fec_key.fecCrate() << "/" << fec_key.fecSlot() << "/"
163  << fec_key.fecRing() << "/" << fec_key.ccuAddr() << "/" << fec_key.ccuChan() << std::endl
164  << " from ped/noise/high/low/disable : " << static_cast<uint16_t>(temp.getPedestal()) << "/"
165  << static_cast<uint16_t>(temp.getHighThreshold()) << "/"
166  << static_cast<uint16_t>(temp.getLowThreshold()) << "/" << static_cast<uint16_t>(temp.getNoise())
167  << "/" << static_cast<uint16_t>(temp.getDisable()) << std::endl;
168  }
169  (*ifed)->getFedStrips().setStrip(addr, data);
170  if (data.getDisable() && edm::isDebugEnabled()) {
171  ss << " to ped/noise/high/low/disable : " << static_cast<uint16_t>(data.getPedestal()) << "/"
172  << static_cast<uint16_t>(data.getHighThreshold()) << "/"
173  << static_cast<uint16_t>(data.getLowThreshold()) << "/" << static_cast<uint16_t>(data.getNoise())
174  << "/" << static_cast<uint16_t>(data.getDisable()) << std::endl;
175  LogTrace(mlDqmClient_) << ss.str();
176  }
177 
178  } // end loop on strips
179  } // end loop on apvs
180  updated++;
181 
182  } else {
183  if (deviceIsPresent(fec_key)) {
184  edm::LogWarning(mlDqmClient_) << "[PedestalsHistosUsingDb::" << __func__ << "]"
185  << " Unable to find pedestals/noise for FedKey/Id/Ch: " << hex << setw(8)
186  << setfill('0') << fed_key.key() << dec << "/" << (*ifed)->getFedId() << "/"
187  << ichan << " and device with FEC/slot/ring/CCU/LLD " << fec_key.fecCrate()
188  << "/" << fec_key.fecSlot() << "/" << fec_key.fecRing() << "/"
189  << fec_key.ccuAddr() << "/" << fec_key.ccuChan() << "/" << fec_key.channel();
190  }
191  }
192  }
193  }
194 
195  edm::LogVerbatim(mlDqmClient_) << "[PedestalsHistosUsingDb::" << __func__ << "]"
196  << " Updated FED pedestals/noise for " << updated << " channels";
197 }
Log< level::Info, true > LogVerbatim
bool isDebugEnabled()
const uint16_t & feChan() const
Analyses & data(bool getMaskedData=false)
const uint16_t & feUnit() const
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
bool deviceIsPresent(const SiStripFecKey &)
FedChannelConnection fedConnection(uint16_t fed_id, uint16_t fed_ch) const
static const char mlDqmClient_[]
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
#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
Class containning control, module, detector and connection information, at the level of a FED channel...
Histogram-based analysis for pedestal run.
SiStripFedCabling *const cabling() const
std::vector< uint16_t > VInt
static const uint16_t invalid_
Definition: Constants.h:16
static const uint16_t FEDCH_PER_FED
conn
Definition: getInfo.py:9
Log< level::Warning, false > LogWarning
static const uint16_t APVS_PER_FEDCH

◆ uploadConfigurations()

void PedestalsHistosUsingDb::uploadConfigurations ( )
overridevirtual

Reimplemented from CommissioningHistosUsingDb.

Definition at line 49 of file PedestalsHistosUsingDb.cc.

References CommissioningHistosUsingDb::db(), CommissioningHistosUsingDb::doUploadConf(), l1tstage2emulator_dqm_sourceclient-live_cfg::feds, SiStripConfigDb::getFedDescriptions(), LogTrace, sistrip::mlDqmClient_, update(), and SiStripConfigDb::uploadFedDescriptions().

49  {
50  LogTrace(mlDqmClient_) << "[PedestalsHistosUsingDb::" << __func__ << "]";
51 
52  if (!db()) {
53  edm::LogError(mlDqmClient_) << "[PedestalsHistosUsingDb::" << __func__ << "]"
54  << " NULL pointer to SiStripConfigDb interface!"
55  << " Aborting upload...";
56  return;
57  }
58 
59  // Update FED descriptions with new peds/noise values
61  update(feds);
62  if (doUploadConf()) {
63  edm::LogVerbatim(mlDqmClient_) << "[PedestalsHistosUsingDb::" << __func__ << "]"
64  << " Uploading pedestals/noise to DB...";
66  edm::LogVerbatim(mlDqmClient_) << "[PedestalsHistosUsingDb::" << __func__ << "]"
67  << " Completed database upload of " << feds.size() << " FED descriptions!";
68  } else {
69  edm::LogWarning(mlDqmClient_) << "[PedestalsHistosUsingDb::" << __func__ << "]"
70  << " TEST! No pedestals/noise values will be uploaded to DB...";
71  }
72 }
Log< level::Info, true > LogVerbatim
void update(SiStripConfigDb::FedDescriptionsRange)
FedDescriptionsRange getFedDescriptions(std::string partition="")
FedDescriptions::range FedDescriptionsRange
static const char mlDqmClient_[]
Log< level::Error, false > LogError
#define LogTrace(id)
SiStripConfigDb *const db() const
void uploadFedDescriptions(std::string partition="")
Log< level::Warning, false > LogWarning

Member Data Documentation

◆ allowSelectiveUpload_

bool PedestalsHistosUsingDb::allowSelectiveUpload_
private

Definition at line 30 of file PedestalsHistosUsingDb.h.

Referenced by PedestalsHistosUsingDb(), and update().

◆ disableBadStrips_

bool PedestalsHistosUsingDb::disableBadStrips_
private

Definition at line 27 of file PedestalsHistosUsingDb.h.

Referenced by PedestalsHistosUsingDb(), and update().

◆ highThreshold_

float PedestalsHistosUsingDb::highThreshold_
private

Definition at line 25 of file PedestalsHistosUsingDb.h.

Referenced by PedestalsHistosUsingDb(), and update().

◆ keepStripsDisabled_

bool PedestalsHistosUsingDb::keepStripsDisabled_
private

Definition at line 28 of file PedestalsHistosUsingDb.h.

Referenced by PedestalsHistosUsingDb(), and update().

◆ lowThreshold_

float PedestalsHistosUsingDb::lowThreshold_
private

Definition at line 26 of file PedestalsHistosUsingDb.h.

Referenced by PedestalsHistosUsingDb(), and update().