CMS 3D CMS Logo

DaqScopeModeHistograms.cc
Go to the documentation of this file.
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>("DaqScopeModeParameters"), bei, sistrip::DAQ_SCOPE_MODE) {
23  factory_ = std::make_unique<DaqScopeModeSummaryFactory>();
24  LogTrace(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]"
25  << " Constructing object...";
26 }
27 
28 // -----------------------------------------------------------------------------
31  LogTrace(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]"
32  << " Destructing object...";
33 }
34 
35 // -----------------------------------------------------------------------------
38  LogTrace(mlDqmClient_) << "[DaqScopeModeHistograms::" << __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_) << "[DaqScopeModeHistograms::" << __func__ << "]"
59  << " Zero histograms found!";
60  continue;
61  }
62 
63  // Retrieve pointers to profile 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  if (!prof) {
72  TH1F* prof = ExtractTObject<TH1F>().extract((*ihis)->me_);
73  profs.push_back(prof);
74  }
75  }
76 
77  // Perform histo analysis
79  DaqScopeModeAlgorithm algo(this->pset(), anal);
80  algo.analysis(profs);
81  data()[iter->first] = anal;
82 
83  if (anal->isValid()) {
84  valid++;
85  }
86  if (!anal->getErrorCodes().empty()) {
87  errors[anal->getErrorCodes()[0]]++;
88  }
89  }
90 
91  if (!histos().empty()) {
92  edm::LogVerbatim(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]"
93  << " Analyzed histograms for " << histos().size() << " FED channels, of which "
94  << valid << " (" << 100 * valid / histos().size() << "%) are valid.";
95  if (!errors.empty()) {
96  uint16_t count = 0;
97  std::stringstream ss;
98  ss << std::endl;
99  std::map<std::string, uint16_t>::const_iterator ii;
100  for (ii = errors.begin(); ii != errors.end(); ++ii) {
101  ss << " " << ii->first << ": " << ii->second << std::endl;
102  count += ii->second;
103  }
104  edm::LogWarning(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]"
105  << " Found " << count << " errors (" << 100 * count / histos().size()
106  << "%): " << ss.str();
107  }
108  } else {
109  edm::LogWarning(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]"
110  << " No histograms to analyze!";
111  }
112 }
113 
114 // -----------------------------------------------------------------------------
116  Analyses::iterator ianal = data().begin();
117  Analyses::iterator janal = data().end();
118  for (; ianal != janal; ++ianal) {
119  if (ianal->second) {
120  std::stringstream ss;
121  ianal->second->print(ss, 1);
122  ianal->second->print(ss, 2);
123  if (ianal->second->isValid()) {
124  LogTrace(mlDqmClient_) << ss.str();
125  } else {
126  edm::LogWarning(mlDqmClient_) << ss.str();
127  }
128  }
129  }
130 }
sistrip::DAQ_SCOPE_MODE
Definition: ConstantsForRunType.h:83
MessageLogger.h
CommissioningHistograms::pset
const edm::ParameterSet & pset() const
Definition: CommissioningHistograms.h:163
edm
HLT enums.
Definition: AlignableModifier.h:19
DaqScopeModeHistograms::histoAnalysis
void histoAnalysis(bool debug) override
Definition: DaqScopeModeHistograms.cc:37
DaqScopeModeAlgorithm.h
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
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
DaqScopeModeHistograms::~DaqScopeModeHistograms
~DaqScopeModeHistograms() override
Definition: DaqScopeModeHistograms.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
DaqScopeModeSummaryFactory.h
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
DaqScopeModeAnalysis
Analysis for scope mode data.
Definition: DaqScopeModeAnalysis.h:16
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
DaqScopeModeHistograms.h
DaqScopeModeHistograms::DaqScopeModeHistograms
DaqScopeModeHistograms(const edm::ParameterSet &pset, DQMStore *)
Definition: DaqScopeModeHistograms.cc:20
CommissioningHistograms
Definition: CommissioningHistograms.h:23
DaqScopeModeAlgorithm
Algorithm for scope mode data.
Definition: DaqScopeModeAlgorithm.h:16
std
Definition: JetResolutionObject.h:76
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
SiStripEnumsAndStrings.h
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
CommissioningHistograms::histos
const HistosMap & histos() const
Definition: CommissioningHistograms.h:161
DaqScopeModeAnalysis.h
DaqScopeModeHistograms::printAnalyses
void printAnalyses() override
Definition: DaqScopeModeHistograms.cc:115
SummaryGenerator.h
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
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
cuy.ii
ii
Definition: cuy.py:590
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
debug_messages_cfi.errors
errors
Definition: debug_messages_cfi.py:54