CMS 3D CMS Logo

FastFedCablingHistograms.cc
Go to the documentation of this file.
8 #include "TProfile.h"
9 #include <iostream>
10 #include <memory>
11 
12 #include <sstream>
13 #include <iomanip>
14 
15 using namespace std;
16 using namespace sistrip;
17 
18 // -----------------------------------------------------------------------------
22  pset.getParameter<edm::ParameterSet>("FastFedCablingParameters"), bei, sistrip::FAST_CABLING) {
23  factory_ = std::make_unique<FastFedCablingSummaryFactory>();
24  LogTrace(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]"
25  << " Constructing object...";
26 }
27 
28 // -----------------------------------------------------------------------------
31  LogTrace(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]"
32  << " Destructing object...";
33 }
34 
35 // -----------------------------------------------------------------------------
38  LogTrace(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]";
39 
40  // Some initialisation
41  uint16_t valid = 0;
42  HistosMap::const_iterator iter;
43  Analyses::iterator ianal;
44  std::map<std::string, uint16_t> errors;
45 
46  // Clear map holding analysis objects
47  for (ianal = data().begin(); ianal != data().end(); ianal++) {
48  if (ianal->second) {
49  delete ianal->second;
50  }
51  }
52  data().clear();
53 
54  // Iterate through map containing histograms
55  for (iter = histos().begin(); iter != histos().end(); iter++) {
56  // Check vector of histos is not empty
57  if (iter->second.empty()) {
58  edm::LogWarning(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]"
59  << " Zero histograms found!";
60  continue;
61  }
62 
63  // Retrieve pointers to histos
64  std::vector<TH1*> profs;
65  Histos::const_iterator ihis = iter->second.begin();
66  for (; ihis != iter->second.end(); ihis++) {
67  TProfile* prof = ExtractTObject<TProfile>().extract((*ihis)->me_);
68  if (prof) {
69  profs.push_back(prof);
70  }
71  }
72 
73  // Perform histo analysis
75  FastFedCablingAlgorithm algo(this->pset(), anal);
76  FedToFecMap::const_iterator ifed = mapping().find(iter->first);
77  if (ifed != mapping().end()) {
78  anal->fecKey(ifed->second);
79  }
80  algo.analysis(profs);
81  data()[iter->first] = anal;
82  if (anal->isValid()) {
83  valid++;
84  }
85  if (!anal->getErrorCodes().empty()) {
86  errors[anal->getErrorCodes()[0]]++;
87  }
88  }
89 
90  if (!histos().empty()) {
91  edm::LogVerbatim(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]"
92  << " Analyzed histograms for " << histos().size() << " FED channels, of which "
93  << valid << " (" << 100 * valid / histos().size() << "%) are valid.";
94  if (!errors.empty()) {
95  uint16_t count = 0;
96  std::stringstream ss;
97  ss << std::endl;
98  std::map<std::string, uint16_t>::const_iterator ii;
99  for (ii = errors.begin(); ii != errors.end(); ++ii) {
100  ss << " " << ii->first << ": " << ii->second << std::endl;
101  count += ii->second;
102  }
103  edm::LogWarning(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]"
104  << " Found " << count << " error strings: " << ss.str();
105  }
106  } else {
107  edm::LogWarning(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]"
108  << " No histograms to analyze!";
109  }
110 }
111 
112 // -----------------------------------------------------------------------------
115  Analyses::iterator ianal = data().begin();
116  Analyses::iterator janal = data().end();
117  for (; ianal != janal; ++ianal) {
118  FastFedCablingAnalysis* anal = dynamic_cast<FastFedCablingAnalysis*>(ianal->second);
119  if (!anal) {
120  edm::LogError(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]"
121  << " NULL pointer to analysis object!";
122  continue;
123  }
124 
125  std::stringstream ss;
126  anal->print(ss);
127  if (anal->isValid() && !(anal->isDirty()) && !(anal->badTrimDac())) {
128  LogTrace(mlDqmClient_) << ss.str();
129  } else {
130  edm::LogWarning(mlDqmClient_) << ss.str();
131  }
132  }
133 }
134 
135 // -----------------------------------------------------------------------------
138  std::stringstream good;
139  std::stringstream bad;
140 
141  Analyses::iterator ianal = data().begin();
142  Analyses::iterator janal = data().end();
143  for (; ianal != janal; ++ianal) {
144  FastFedCablingAnalysis* anal = dynamic_cast<FastFedCablingAnalysis*>(ianal->second);
145  if (!anal) {
146  edm::LogError(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]"
147  << " NULL pointer to analysis object!";
148  continue;
149  }
150 
151  if (anal->isValid() && !(anal->isDirty()) && !(anal->badTrimDac())) {
152  anal->summary(good);
153  } else {
154  anal->summary(bad);
155  }
156  }
157 
158  if (good.str().empty()) {
159  good << "None found!";
160  }
161  LogTrace(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]"
162  << " Printing summary of good analyses:"
163  << "\n"
164  << good.str();
165 
166  if (bad.str().empty()) {
167  return;
168  } //@@ bad << "None found!"; }
169  LogTrace(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]"
170  << " Printing summary of bad analyses:"
171  << "\n"
172  << bad.str();
173 }
MessageLogger.h
FastFedCablingHistograms.h
sistrip::FAST_CABLING
Definition: ConstantsForRunType.h:89
CommissioningHistograms::pset
const edm::ParameterSet & pset() const
Definition: CommissioningHistograms.h:163
FastFedCablingHistograms::printAnalyses
void printAnalyses() override
Definition: FastFedCablingHistograms.cc:114
FastFedCablingAlgorithm.h
edm
HLT enums.
Definition: AlignableModifier.h:19
FastFedCablingHistograms::printSummary
void printSummary() override
Definition: FastFedCablingHistograms.cc:137
ExtractTObject.h
FastFedCablingAnalysis
Histogram-based analysis for connection loop.
Definition: FastFedCablingAnalysis.h:16
CommissioningHistograms::data
Analyses & data(bool getMaskedData=false)
Definition: CommissioningHistograms.cc:718
ExtractTObject
Definition: ExtractTObject.h:9
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
sistrip::mlDqmClient_
static const char mlDqmClient_[]
Definition: ConstantsForLogger.h:19
FastFedCablingSummaryFactory.h
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
FastFedCablingHistograms::~FastFedCablingHistograms
~FastFedCablingHistograms() override
Definition: FastFedCablingHistograms.cc:30
cmsdt::algo
algo
Definition: constants.h:165
debug
#define debug
Definition: HDRShower.cc:19
dqm::legacy::DQMStore
Definition: DQMStore.h:727
errors
Definition: errors.py:1
mps_fire.end
end
Definition: mps_fire.py:242
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
CommissioningHistograms::factory_
std::unique_ptr< Factory > factory_
Definition: CommissioningHistograms.h:129
SiStripConstants.h
edm::ParameterSet
Definition: ParameterSet.h:47
ParameterSet
Definition: Functions.h:16
ExtractTObject::extract
static T * extract(MonitorElement *me)
Definition: ExtractTObject.cc:21
CommissioningHistograms
Definition: CommissioningHistograms.h:23
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
std
Definition: JetResolutionObject.h:76
FastFedCablingHistograms::FastFedCablingHistograms
FastFedCablingHistograms(const edm::ParameterSet &pset, DQMStore *)
Definition: FastFedCablingHistograms.cc:20
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
CommissioningHistograms::histos
const HistosMap & histos() const
Definition: CommissioningHistograms.h:161
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
FastFedCablingHistograms::histoAnalysis
void histoAnalysis(bool debug) override
Definition: FastFedCablingHistograms.cc:37
sistrip
sistrip classes
Definition: SiStripQualityHelpers.h:14
FastFedCablingAnalysis.h
conversion_template_cfg.anal
anal
Definition: conversion_template_cfg.py:16
CommissioningHistograms::mapping
const FedToFecMap & mapping() const
Definition: CommissioningHistograms.h:162
cuy.ii
ii
Definition: cuy.py:590
FastFedCablingAlgorithm
Histogram-based analysis for connection loop.
Definition: FastFedCablingAlgorithm.h:16
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
debug_messages_cfi.errors
errors
Definition: debug_messages_cfi.py:54