CMS 3D CMS Logo

DaqScopeModeHistograms.cc
Go to the documentation of this file.
9 #include <iostream>
10 #include <sstream>
11 #include <iomanip>
12 
13 using namespace std;
14 using namespace sistrip;
15 
16 // -----------------------------------------------------------------------------
20  pset.getParameter<edm::ParameterSet>("DaqScopeModeParameters"), bei, sistrip::DAQ_SCOPE_MODE) {
21  factory_ = unique_ptr<DaqScopeModeSummaryFactory>(new DaqScopeModeSummaryFactory);
22  LogTrace(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]"
23  << " Constructing object...";
24 }
25 
26 // -----------------------------------------------------------------------------
29  LogTrace(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]"
30  << " Destructing object...";
31 }
32 
33 // -----------------------------------------------------------------------------
36  LogTrace(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]";
37 
38  // Some initialisation
39  uint16_t valid = 0;
40  HistosMap::const_iterator iter;
41  Analyses::iterator ianal;
42  std::map<std::string, uint16_t> errors;
43 
44  // Clear map holding analysis objects
45  for (ianal = data().begin(); ianal != data().end(); ianal++) {
46  if (ianal->second) {
47  delete ianal->second;
48  }
49  }
50  data().clear();
51 
52  // Iterate through map containing histograms
53  for (iter = histos().begin(); iter != histos().end(); iter++) {
54  // Check vector of histos is not empty
55  if (iter->second.empty()) {
56  edm::LogWarning(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]"
57  << " Zero histograms found!";
58  continue;
59  }
60 
61  // Retrieve pointers to profile histos
62  std::vector<TH1*> profs;
63  Histos::const_iterator ihis = iter->second.begin();
64  for (; ihis != iter->second.end(); ihis++) {
65  TProfile* prof = ExtractTObject<TProfile>().extract((*ihis)->me_);
66  if (prof) {
67  profs.push_back(prof);
68  }
69  if (!prof) {
70  TH1F* prof = ExtractTObject<TH1F>().extract((*ihis)->me_);
71  profs.push_back(prof);
72  }
73  }
74 
75  // Perform histo analysis
77  DaqScopeModeAlgorithm algo(this->pset(), anal);
78  algo.analysis(profs);
79  data()[iter->first] = anal;
80 
81  if (anal->isValid()) {
82  valid++;
83  }
84  if (!anal->getErrorCodes().empty()) {
85  errors[anal->getErrorCodes()[0]]++;
86  }
87  }
88 
89  if (!histos().empty()) {
90  edm::LogVerbatim(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]"
91  << " Analyzed histograms for " << histos().size() << " FED channels, of which "
92  << valid << " (" << 100 * valid / histos().size() << "%) are valid.";
93  if (!errors.empty()) {
94  uint16_t count = 0;
95  std::stringstream ss;
96  ss << std::endl;
97  std::map<std::string, uint16_t>::const_iterator ii;
98  for (ii = errors.begin(); ii != errors.end(); ++ii) {
99  ss << " " << ii->first << ": " << ii->second << std::endl;
100  count += ii->second;
101  }
102  edm::LogWarning(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]"
103  << " Found " << count << " errors (" << 100 * count / histos().size()
104  << "%): " << ss.str();
105  }
106  } else {
107  edm::LogWarning(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]"
108  << " No histograms to analyze!";
109  }
110 }
111 
112 // -----------------------------------------------------------------------------
114  Analyses::iterator ianal = data().begin();
115  Analyses::iterator janal = data().end();
116  for (; ianal != janal; ++ianal) {
117  if (ianal->second) {
118  std::stringstream ss;
119  ianal->second->print(ss, 1);
120  ianal->second->print(ss, 2);
121  if (ianal->second->isValid()) {
122  LogTrace(mlDqmClient_) << ss.str();
123  } else {
124  edm::LogWarning(mlDqmClient_) << ss.str();
125  }
126  }
127  }
128 }
sistrip::DAQ_SCOPE_MODE
Definition: ConstantsForRunType.h:83
MessageLogger.h
DaqScopeModeSummaryFactory
Definition: DaqScopeModeSummaryFactory.h:6
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:35
MessageLogger_cfi.errors
errors
Definition: MessageLogger_cfi.py:18
DaqScopeModeAlgorithm.h
CommissioningHistograms::data
Analyses & data(bool getMaskedData=false)
Definition: CommissioningHistograms.cc:718
ExtractTObject
Definition: ExtractTObject.h:9
sistrip::mlDqmClient_
static const char mlDqmClient_[]
Definition: ConstantsForLogger.h:19
validateGeometry_cfg.valid
valid
Definition: validateGeometry_cfg.py:21
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
DaqScopeModeHistograms::~DaqScopeModeHistograms
~DaqScopeModeHistograms() override
Definition: DaqScopeModeHistograms.cc:28
cmsdt::algo
algo
Definition: constants.h:164
debug
#define debug
Definition: HDRShower.cc:19
dqm::legacy::DQMStore
Definition: DQMStore.h:727
errors
Definition: errors.py:1
DaqScopeModeSummaryFactory.h
DaqScopeModeAnalysis
Analysis for scope mode data.
Definition: DaqScopeModeAnalysis.h:16
CommissioningHistograms::factory_
std::unique_ptr< Factory > factory_
Definition: CommissioningHistograms.h:129
edm::LogWarning
Definition: MessageLogger.h:141
SiStripConstants.h
edm::ParameterSet
Definition: ParameterSet.h:36
ParameterSet
Definition: Functions.h:16
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
edm::LogVerbatim
Definition: MessageLogger.h:297
ExtractTObject::extract
static T * extract(MonitorElement *me)
Definition: ExtractTObject.cc:21
DaqScopeModeHistograms.h
DaqScopeModeHistograms::DaqScopeModeHistograms
DaqScopeModeHistograms(const edm::ParameterSet &pset, DQMStore *)
Definition: DaqScopeModeHistograms.cc:18
CommissioningHistograms
Definition: CommissioningHistograms.h:23
DaqScopeModeAlgorithm
Algorithm for scope mode data.
Definition: DaqScopeModeAlgorithm.h:16
std
Definition: JetResolutionObject.h:76
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:113
SummaryGenerator.h
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
cuy.ii
ii
Definition: cuy.py:590
begin
#define begin
Definition: vmac.h:32
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27