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  DQMStore* bei,
21  const sistrip::RunType& task )
22  : CommissioningHistograms( pset.getParameter<edm::ParameterSet>("SamplingParameters"),
23  bei,
24  task ),
25  sOnCut_(3)
26 {
28  << "[SamplingHistograms::" << __func__ << "]"
29  << " Constructing object...";
30  factory_ = unique_ptr<SamplingSummaryFactory>( new SamplingSummaryFactory );
31  // retreive the latency code from the root file
32  std::string dataPath = std::string(sistrip::collate_) + "/" + sistrip::root_ + "/latencyCode";
33  MonitorElement* codeElement = bei->get(dataPath);
34  if(codeElement) latencyCode_ = codeElement->getIntValue() ;
35  else latencyCode_ = 0;
36 }
37 
38 // -----------------------------------------------------------------------------
42  << "[SamplingHistograms::" << __func__ << "]"
43  << " Deleting object...";
44 }
45 
46 // -----------------------------------------------------------------------------
49 
50  // Clear map holding analysis objects
51  Analyses::iterator ianal;
52  for ( ianal = data().begin(); ianal != data().end(); ianal++ ) {
53  if ( ianal->second ) { delete ianal->second; }
54  }
55  data().clear();
56 
57  // Iterate through map containing vectors of profile histograms
58  HistosMap::const_iterator iter = histos().begin();
59  for ( ; iter != histos().end(); iter++ ) {
60  // Check vector of histos is not empty (should be 1 histo)
61  if ( iter->second.empty() ) {
63  << "[SamplingHistograms::" << __func__ << "]"
64  << " Zero collation histograms found!";
65  continue;
66  }
67 
68  // Retrieve pointers to profile histos for this FED channel
69  vector<TH1*> profs;
70  Histos::const_iterator ihis = iter->second.begin();
71  for ( ; ihis != iter->second.end(); ihis++ ) {
72  TProfile* prof = ExtractTObject<TProfile>().extract( (*ihis)->me_ );
73  if ( prof ) { profs.push_back(prof); }
74  }
75 
76  // Perform histo analysis
77  SamplingAnalysis* anal = new SamplingAnalysis( iter->first );
78  anal->setSoNcut(sOnCut_);
79  SamplingAlgorithm algo( this->pset(), anal, latencyCode_ );
80  algo.analysis( profs );
81  data()[iter->first] = anal;
82 
83  }
84 
85 }
86 
88 {
89  //TODO: should use the parameter set. Why is this crashing ???
90 // sOnCut_ = pset.getParameter<double>("SignalToNoiseCut");
91  sOnCut_ = 3.;
92 }
93 
void analysis(const std::vector< TH1 * > &)
int64_t getIntValue() const
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)
static const char mlDqmClient_[]
sistrip classes
void configure(const edm::ParameterSet &, const edm::EventSetup &) override
~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