CMS 3D CMS Logo

PedsFullNoiseHistograms.cc
Go to the documentation of this file.
8 #include <iostream>
9 #include <memory>
10 
11 #include <sstream>
12 #include <iomanip>
13 #include "TProfile.h"
14 
15 using namespace std;
16 using namespace sistrip;
17 
18 // -----------------------------------------------------------------------------
22  pset.getParameter<edm::ParameterSet>("PedsFullNoiseParameters"), bei, sistrip::PEDS_FULL_NOISE) {
23  factory_ = std::make_unique<PedsFullNoiseSummaryFactory>();
24  LogTrace(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]"
25  << " Constructing object...";
26 }
27 
28 // -----------------------------------------------------------------------------
31  LogTrace(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]"
32  << " Destructing object...";
33 }
34 
35 // -----------------------------------------------------------------------------
38  LogTrace(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __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  long int ichannel = 0;
56  long int nchannel = histos().size();
57  for (iter = histos().begin(); iter != histos().end(); iter++) {
58  // Check vector of histos is not empty
59  if (iter->second.empty()) {
60  edm::LogWarning(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]"
61  << " Zero histograms found!";
62  continue;
63  }
64 
65  // Retrieve pointers to peds and noise histos
66  std::vector<TH1*> hists;
67  Histos::const_iterator ihis = iter->second.begin();
68 
69  for (; ihis != iter->second.end(); ihis++) {
70  // pedestal and noise 1D profiles
71  TProfile* prof = ExtractTObject<TProfile>().extract((*ihis)->me_);
72  if (prof) {
73  hists.push_back(prof);
74  }
75  // 2D noise histograms
76  TH2S* his2D = ExtractTObject<TH2S>().extract((*ihis)->me_);
77  if (his2D) {
78  hists.push_back(his2D);
79  }
80  }
81 
82  if (ichannel % 100 == 0)
83  edm::LogVerbatim(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]"
84  << " Analyzing channel " << ichannel << " out of " << nchannel;
85  ichannel++;
86 
87  // Perform histo analysis
89  PedsFullNoiseAlgorithm algo(this->pset(), anal);
90  algo.analysis(hists);
91 
92  data()[iter->first] = anal;
93  if (anal->isValid()) {
94  valid++;
95  }
96  if (!anal->getErrorCodes().empty()) {
97  errors[anal->getErrorCodes()[0]]++;
98  }
99  }
100 
101  if (!histos().empty()) {
102  edm::LogVerbatim(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]"
103  << " Analyzed histograms for " << histos().size() << " FED channels, of which "
104  << valid << " (" << 100 * valid / histos().size() << "%) are valid.";
105  if (!errors.empty()) {
106  uint16_t count = 0;
107  std::stringstream ss;
108  ss << std::endl;
109  std::map<std::string, uint16_t>::const_iterator ii;
110  for (ii = errors.begin(); ii != errors.end(); ++ii) {
111  ss << " " << ii->first << ": " << ii->second << std::endl;
112  count += ii->second;
113  }
114  edm::LogWarning(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]"
115  << " Found " << count << " errors (" << 100 * count / histos().size()
116  << "%): " << ss.str();
117  }
118  } else {
119  edm::LogWarning(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]"
120  << " No histograms to analyze!";
121  }
122 }
123 
124 // -----------------------------------------------------------------------------
127  Analyses::iterator ianal = data().begin();
128  Analyses::iterator janal = data().end();
129  for (; ianal != janal; ++ianal) {
130  if (ianal->second) {
131  std::stringstream ss;
132  ianal->second->print(ss, 1);
133  ianal->second->print(ss, 2);
134  if (ianal->second->isValid()) {
135  LogTrace(mlDqmClient_) << ss.str();
136  } else {
137  edm::LogWarning(mlDqmClient_) << ss.str();
138  }
139  }
140  }
141 }
MessageLogger.h
sistrip::PEDS_FULL_NOISE
Definition: ConstantsForRunType.h:92
CommissioningHistograms::pset
const edm::ParameterSet & pset() const
Definition: CommissioningHistograms.h:163
edm
HLT enums.
Definition: AlignableModifier.h:19
PedsFullNoiseHistograms.h
PedsFullNoiseHistograms::printAnalyses
void printAnalyses() override
Definition: PedsFullNoiseHistograms.cc:126
ExtractTObject.h
compare.hists
hists
Definition: compare.py:319
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
PedsFullNoiseAnalysis
Histogram-based analysis for pedestal run.
Definition: PedsFullNoiseAnalysis.h:16
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
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
PedsFullNoiseHistograms::PedsFullNoiseHistograms
PedsFullNoiseHistograms(const edm::ParameterSet &pset, DQMStore *)
Definition: PedsFullNoiseHistograms.cc:20
PedsFullNoiseAlgorithm.h
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
CommissioningHistograms::factory_
std::unique_ptr< Factory > factory_
Definition: CommissioningHistograms.h:129
SiStripConstants.h
PedsFullNoiseHistograms::~PedsFullNoiseHistograms
~PedsFullNoiseHistograms() override
Definition: PedsFullNoiseHistograms.cc:30
edm::ParameterSet
Definition: ParameterSet.h:47
ParameterSet
Definition: Functions.h:16
PedsFullNoiseAlgorithm
Histogram-based analysis for pedestal run.
Definition: PedsFullNoiseAlgorithm.h:17
ExtractTObject::extract
static T * extract(MonitorElement *me)
Definition: ExtractTObject.cc:21
CommissioningHistograms
Definition: CommissioningHistograms.h:23
std
Definition: JetResolutionObject.h:76
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
PedsFullNoiseSummaryFactory.h
CommissioningHistograms::histos
const HistosMap & histos() const
Definition: CommissioningHistograms.h:161
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
PedsFullNoiseHistograms::histoAnalysis
void histoAnalysis(bool debug) override
Definition: PedsFullNoiseHistograms.cc:37
cuy.ii
ii
Definition: cuy.py:590
PedsFullNoiseAnalysis.h
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
debug_messages_cfi.errors
errors
Definition: debug_messages_cfi.py:54