CMS 3D CMS Logo

VpspScanHistograms.cc
Go to the documentation of this file.
8 #include "TProfile.h"
9 #include <iostream>
10 #include <sstream>
11 #include <iomanip>
12 
13 using namespace std;
14 using namespace sistrip;
15 
16 // -----------------------------------------------------------------------------
19  : CommissioningHistograms(pset.getParameter<edm::ParameterSet>("VpspScanParameters"), bei, sistrip::VPSP_SCAN) {
20  factory_ = unique_ptr<VpspScanSummaryFactory>(new VpspScanSummaryFactory);
21  LogTrace(mlDqmClient_) << "[VpspScanHistograms::" << __func__ << "]"
22  << " Constructing object...";
23 }
24 
25 // -----------------------------------------------------------------------------
28  LogTrace(mlDqmClient_) << "[VpspScanHistograms::" << __func__ << "]"
29  << " Denstructing object...";
30 }
31 
32 // -----------------------------------------------------------------------------
35  LogTrace(mlDqmClient_) << "[VpspScanHistograms::" << __func__ << "]";
36 
37  // Some initialisation
38  uint16_t valid = 0;
39  HistosMap::const_iterator iter;
40  Analyses::iterator ianal;
41  std::map<std::string, uint16_t> errors;
42 
43  // Clear map holding analysis objects
44  for (ianal = data().begin(); ianal != data().end(); ianal++) {
45  if (ianal->second) {
46  delete ianal->second;
47  }
48  }
49  data().clear();
50 
51  // Iterate through map containing histograms
52  for (iter = histos().begin(); iter != histos().end(); iter++) {
53  // Check vector of histos is not empty
54  if (iter->second.empty()) {
55  edm::LogWarning(mlDqmClient_) << "[VpspScanHistograms::" << __func__ << "]"
56  << " Zero histograms found!" << endl;
57  continue;
58  }
59 
60  // Retrieve pointers to profile histos for this FED channel
61  std::vector<TH1*> profs;
62  Histos::const_iterator ihis = iter->second.begin();
63  for (; ihis != iter->second.end(); ihis++) {
64  TProfile* prof = ExtractTObject<TProfile>().extract((*ihis)->me_);
65  if (prof) {
66  profs.push_back(prof);
67  }
68  }
69 
70  // Perform histo analysis
71  VpspScanAnalysis* anal = new VpspScanAnalysis(iter->first);
72  VpspScanAlgorithm algo(this->pset(), anal);
73  algo.analysis(profs);
74  data()[iter->first] = anal;
75  if (anal->isValid()) {
76  valid++;
77  }
78  if (!anal->getErrorCodes().empty()) {
79  errors[anal->getErrorCodes()[0]]++;
80  }
81  }
82 
83  if (!histos().empty()) {
84  edm::LogVerbatim(mlDqmClient_) << "[VpspScanHistograms::" << __func__ << "]"
85  << " Analyzed histograms for " << histos().size() << " FED channels, of which "
86  << valid << " (" << 100 * valid / histos().size() << "%) are valid.";
87  if (!errors.empty()) {
88  uint16_t count = 0;
89  std::stringstream ss;
90  ss << std::endl;
91  std::map<std::string, uint16_t>::const_iterator ii;
92  for (ii = errors.begin(); ii != errors.end(); ++ii) {
93  ss << " " << ii->first << ": " << ii->second << std::endl;
94  count += ii->second;
95  }
96  edm::LogWarning(mlDqmClient_) << "[VpspScanHistograms::" << __func__ << "]"
97  << " Found " << count << " errors (" << 100 * count / histos().size()
98  << "%): " << ss.str();
99  }
100  } else {
101  edm::LogWarning(mlDqmClient_) << "[VpspScanHistograms::" << __func__ << "]"
102  << " No histograms to analyze!";
103  }
104 }
105 
106 // -----------------------------------------------------------------------------
109  Analyses::iterator ianal = data().begin();
110  Analyses::iterator janal = data().end();
111  for (; ianal != janal; ++ianal) {
112  if (ianal->second) {
113  std::stringstream ss;
114  ianal->second->print(ss, 1);
115  ianal->second->print(ss, 2);
116  if (ianal->second->isValid()) {
117  LogTrace(mlDqmClient_) << ss.str();
118  } else {
119  edm::LogWarning(mlDqmClient_) << ss.str();
120  }
121  }
122  }
123 }
MessageLogger.h
VpspScanHistograms::VpspScanHistograms
VpspScanHistograms(const edm::ParameterSet &pset, DQMStore *)
Definition: VpspScanHistograms.cc:18
sistrip::VPSP_SCAN
Definition: ConstantsForRunType.h:82
CommissioningHistograms::pset
const edm::ParameterSet & pset() const
Definition: CommissioningHistograms.h:163
edm
HLT enums.
Definition: AlignableModifier.h:19
MessageLogger_cfi.errors
errors
Definition: MessageLogger_cfi.py:18
ExtractTObject.h
VpspScanSummaryFactory
Definition: VpspScanSummaryFactory.h:6
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
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
VpspScanAlgorithm.h
VpspScanAlgorithm
Histogram-based analysis for VPSP scan.
Definition: VpspScanAlgorithm.h:16
VpspScanHistograms::~VpspScanHistograms
~VpspScanHistograms() override
Definition: VpspScanHistograms.cc:27
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
VpspScanHistograms::printAnalyses
void printAnalyses() override
Definition: VpspScanHistograms.cc:108
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
CommissioningHistograms
Definition: CommissioningHistograms.h:23
VpspScanHistograms.h
std
Definition: JetResolutionObject.h:76
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
CommissioningHistograms::histos
const HistosMap & histos() const
Definition: CommissioningHistograms.h:161
VpspScanAnalysis
Histogram-based analysis for VPSP scan.
Definition: VpspScanAnalysis.h:15
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
VpspScanHistograms::histoAnalysis
void histoAnalysis(bool debug) override
Definition: VpspScanHistograms.cc:34
cuy.ii
ii
Definition: cuy.py:590
begin
#define begin
Definition: vmac.h:32
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
VpspScanAnalysis.h
VpspScanSummaryFactory.h