CMS 3D CMS Logo

SamplingHistograms.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>("SamplingParameters"), bei, task), sOnCut_(3) {
21  LogTrace(mlDqmClient_) << "[SamplingHistograms::" << __func__ << "]"
22  << " Constructing object...";
23  factory_ = unique_ptr<SamplingSummaryFactory>(new SamplingSummaryFactory);
24  // retreive the latency code from the root file
25  std::string dataPath = std::string(sistrip::collate_) + "/" + sistrip::root_ + "/latencyCode";
26  MonitorElement* codeElement = bei->get(dataPath);
27  if (codeElement)
28  latencyCode_ = codeElement->getIntValue();
29  else
30  latencyCode_ = 0;
31 }
32 
33 // -----------------------------------------------------------------------------
36  LogTrace(mlDqmClient_) << "[SamplingHistograms::" << __func__ << "]"
37  << " Deleting object...";
38 }
39 
40 // -----------------------------------------------------------------------------
43  // Clear map holding analysis objects
44  Analyses::iterator ianal;
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 vectors of profile histograms
53  HistosMap::const_iterator iter = histos().begin();
54  for (; iter != histos().end(); iter++) {
55  // Check vector of histos is not empty (should be 1 histo)
56  if (iter->second.empty()) {
57  edm::LogWarning(mlDqmClient_) << "[SamplingHistograms::" << __func__ << "]"
58  << " Zero collation histograms found!";
59  continue;
60  }
61 
62  // Retrieve pointers to profile histos for this FED channel
63  vector<TH1*> profs;
64  Histos::const_iterator ihis = iter->second.begin();
65  for (; ihis != iter->second.end(); ihis++) {
66  TProfile* prof = ExtractTObject<TProfile>().extract((*ihis)->me_);
67  if (prof) {
68  profs.push_back(prof);
69  }
70  }
71 
72  // Perform histo analysis
73  SamplingAnalysis* anal = new SamplingAnalysis(iter->first);
74  anal->setSoNcut(sOnCut_);
75  SamplingAlgorithm algo(this->pset(), anal, latencyCode_);
76  algo.analysis(profs);
77  data()[iter->first] = anal;
78  }
79 }
80 
82  //TODO: should use the parameter set. Why is this crashing ???
83  // sOnCut_ = pset.getParameter<double>("SignalToNoiseCut");
84  sOnCut_ = 3.;
85 }
void analysis(const std::vector< TH1 * > &)
Analysis for latency run.
SamplingHistograms(const edm::ParameterSet &pset, DQMStore *, const sistrip::RunType &task=sistrip::APV_LATENCY)
Algorithm for latency run.
Analyses & data(bool getMaskedData=false)
const edm::ParameterSet & pset() const
void setSoNcut(const float sOnCut)
virtual int64_t getIntValue() const
static const char mlDqmClient_[]
sistrip classes
void configure(const edm::ParameterSet &, const edm::EventSetup &) override
MonitorElement * get(std::string const &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
Definition: DQMStore.cc:1509
~SamplingHistograms() override
#define LogTrace(id)
int extract(std::vector< int > *output, const std::string &dati)
void histoAnalysis(bool debug) override
#define debug
Definition: HDRShower.cc:19
std::unique_ptr< Factory > factory_
#define begin
Definition: vmac.h:32
HLT enums.
static const char root_[]
static const char collate_[]
const HistosMap & histos() const