CMS 3D CMS Logo

FedCablingHistograms.cc
Go to the documentation of this file.
9 #include <iostream>
10 #include <sstream>
11 #include <iomanip>
12 #include "TProfile.h"
13 
14 using namespace std;
15 using namespace sistrip;
16 
17 // -----------------------------------------------------------------------------
20  : CommissioningHistograms(pset.getParameter<edm::ParameterSet>("FedCablingParameters"), bei, sistrip::FED_CABLING),
21  factory_(new Factory) {
22  LogTrace(mlDqmClient_) << "[FedCablingHistograms::" << __func__ << "]"
23  << " Constructing object...";
24 }
25 
26 // -----------------------------------------------------------------------------
29  LogTrace(mlDqmClient_) << "[FedCablingHistograms::" << __func__ << "]"
30  << " Destructing object...";
31 }
32 
33 // -----------------------------------------------------------------------------
36  LogTrace(mlDqmClient_) << "[FedCablingHistograms::" << __func__ << "]";
37 
38  uint16_t valid = 0;
39  HistosMap::const_iterator iter;
40  Analyses::iterator ianal;
41 
42  // Clear map holding analysis objects
43  for (ianal = data_.begin(); ianal != data_.end(); ianal++) {
44  if (ianal->second) {
45  delete ianal->second;
46  }
47  }
48  data_.clear();
49 
50  // Iterate through map containing histograms
51  for (iter = histos().begin(); iter != histos().end(); iter++) {
52  // Check vector of histos is not empty
53  if (iter->second.empty()) {
54  edm::LogWarning(mlDqmClient_) << "[FedCablingHistograms::" << __func__ << "]"
55  << " Zero histograms found!";
56  continue;
57  }
58 
59  // Retrieve pointers to histos
60  std::vector<TH1*> profs;
61  Histos::const_iterator ihis = iter->second.begin();
62  for (; ihis != iter->second.end(); ihis++) {
63  TProfile* prof = ExtractTObject<TProfile>().extract((*ihis)->me_);
64  if (prof) {
65  profs.push_back(prof);
66  }
67  }
68 
69  // Perform histo analysis
70  FedCablingAnalysis* anal = new FedCablingAnalysis(iter->first);
71  FedCablingAlgorithm algo(this->pset(), anal);
72  algo.analysis(profs);
73  data_[iter->first] = anal;
74  if (anal->isValid()) {
75  valid++;
76  }
77  }
78 
79  if (!histos().empty()) {
80  edm::LogVerbatim(mlDqmClient_) << "[FedCablingHistograms::" << __func__ << "]"
81  << " Analyzed histograms for " << histos().size() << " FED channels, of which "
82  << valid << " (" << 100 * valid / histos().size() << "%) are valid.";
83  } else {
84  edm::LogWarning(mlDqmClient_) << "[FedCablingHistograms::" << __func__ << "]"
85  << " No histograms to analyze!";
86  }
87 }
88 
89 // -----------------------------------------------------------------------------
92  Analyses::iterator ianal = data_.begin();
93  Analyses::iterator janal = data_.end();
94  for (; ianal != janal; ++ianal) {
95  if (ianal->second) {
96  std::stringstream ss;
97  ianal->second->print(ss);
98  if (ianal->second->isValid()) {
99  LogTrace(mlDqmClient_) << ss.str();
100  } else {
101  edm::LogWarning(mlDqmClient_) << ss.str();
102  }
103  }
104  }
105 }
106 
107 // -----------------------------------------------------------------------------
111  const std::string& dir,
112  const sistrip::Granularity& gran) {
113  LogTrace(mlDqmClient_) << "[FedCablingHistograms::" << __func__ << "]";
114 
115  // Check view
117  if (view == sistrip::UNKNOWN_VIEW) {
118  return;
119  }
120 
121  // Analyze histograms if not done already
122  if (data_.empty()) {
123  histoAnalysis(false);
124  }
125 
126  // Extract data to be histogrammed
127  uint32_t xbins = factory_->init(histo, type, view, dir, gran, data_);
128 
129  // Create summary histogram (if it doesn't already exist)
130  TH1* summary = histogram(histo, type, view, dir, xbins);
131 
132  // Fill histogram with data
133  factory_->fill(*summary);
134 }
void analysis(const std::vector< TH1 * > &)
type
Definition: HCALResponse.h:21
TH1 * histogram(const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &directory, const uint32_t &xbins, const float &xlow=1.*sistrip::invalid_, const float &xhigh=1.*sistrip::invalid_)
const double xbins[]
const edm::ParameterSet & pset() const
Histogram-based analysis for connection loop.
static const char mlDqmClient_[]
std::unique_ptr< Factory > factory_
void createSummaryHisto(const sistrip::Monitorable &, const sistrip::Presentation &, const std::string &top_level_dir, const sistrip::Granularity &) override
void printAnalyses() override
sistrip classes
static std::string view(const sistrip::View &)
#define LogTrace(id)
int extract(std::vector< int > *output, const std::string &dati)
#define debug
Definition: HDRShower.cc:19
#define begin
Definition: vmac.h:32
HLT enums.
FedCablingHistograms(const edm::ParameterSet &pset, DQMStore *)
bool isValid() const override
Histogram-based analysis for connection loop.
const HistosMap & histos() const
void histoAnalysis(bool debug) override