CMS 3D CMS Logo

DaqScopeModeHistograms.cc
Go to the documentation of this file.
9 #include <iostream>
10 #include <sstream>
11 #include <iomanip>
12 
13 using namespace std;
14 using namespace sistrip;
15 
16 // -----------------------------------------------------------------------------
19  DQMStore* bei )
20  : CommissioningHistograms( pset.getParameter<edm::ParameterSet>("DaqScopeModeParameters"),
21  bei,
23 {
24 
25  factory_ = auto_ptr<DaqScopeModeSummaryFactory>( new DaqScopeModeSummaryFactory );
27  << "[DaqScopeModeHistograms::" << __func__ << "]"
28  << " Constructing object...";
29 
30 }
31 
32 // -----------------------------------------------------------------------------
36  << "[DaqScopeModeHistograms::" << __func__ << "]"
37  << " Destructing object...";
38 }
39 
40 // -----------------------------------------------------------------------------
43 
45  << "[DaqScopeModeHistograms::" << __func__ << "]";
46 
47  // Some initialisation
48  uint16_t valid = 0;
49  HistosMap::const_iterator iter;
50  Analyses::iterator ianal;
51  std::map<std::string,uint16_t> errors;
52 
53  // Clear map holding analysis objects
54  for ( ianal = data().begin(); ianal != data().end(); ianal++ ) {
55  if ( ianal->second ) { delete ianal->second; }
56  }
57  data().clear();
58 
59  // Iterate through map containing histograms
60  for ( iter = histos().begin();
61  iter != histos().end(); iter++ ) {
62 
63  // Check vector of histos is not empty
64  if ( iter->second.empty() ) {
66  << "[DaqScopeModeHistograms::" << __func__ << "]"
67  << " Zero histograms found!";
68  continue;
69  }
70 
71  // Retrieve pointers to profile histos
72  std::vector<TH1*> profs;
73  Histos::const_iterator ihis = iter->second.begin();
74  for ( ; ihis != iter->second.end(); ihis++ ) {
75  TProfile* prof = ExtractTObject<TProfile>().extract( (*ihis)->me_ );
76  if ( prof )
77  profs.push_back(prof);
78  }
79 
80  // Perform histo analysis
81  DaqScopeModeAnalysis* anal = new DaqScopeModeAnalysis( iter->first );
82  DaqScopeModeAlgorithm algo( this->pset(), anal );
83  algo.analysis( profs );
84  data()[iter->first] = anal;
85 
86  if ( anal->isValid() ) { valid++; }
87  if ( !anal->getErrorCodes().empty() ) {
88  errors[anal->getErrorCodes()[0]]++;
89  }
90  }
91 
92  if ( !histos().empty() ) {
94  << "[DaqScopeModeHistograms::" << __func__ << "]"
95  << " Analyzed histograms for " << histos().size()
96  << " FED channels, of which " << valid
97  << " (" << 100 * valid / histos().size()
98  << "%) are valid.";
99  if ( !errors.empty() ) {
100  uint16_t count = 0;
101  std::stringstream ss;
102  ss << std::endl;
103  std::map<std::string,uint16_t>::const_iterator ii;
104  for ( ii = errors.begin(); ii != errors.end(); ++ii ) {
105  ss << " " << ii->first << ": " << ii->second << std::endl;
106  count += ii->second;
107  }
109  << "[DaqScopeModeHistograms::" << __func__ << "]"
110  << " Found " << count << " errors ("
111  << 100 * count / histos().size() << "%): "
112  << ss.str();
113  }
114  } else {
116  << "[DaqScopeModeHistograms::" << __func__ << "]"
117  << " No histograms to analyze!";
118  }
119 }
120 
121 // -----------------------------------------------------------------------------
123  Analyses::iterator ianal = data().begin();
124  Analyses::iterator janal = data().end();
125  for ( ; ianal != janal; ++ianal ) {
126  if ( ianal->second ) {
127  std::stringstream ss;
128  ianal->second->print( ss, 1 );
129  ianal->second->print( ss, 2 );
130  if ( ianal->second->isValid() ) { LogTrace(mlDqmClient_) << ss.str();
131  }
132  else { edm::LogWarning(mlDqmClient_) << ss.str(); }
133  }
134  }
135 }
136 
void analysis(const std::vector< TH1 * > &)
Analyses & data(bool getMaskedData=false)
const edm::ParameterSet & pset() const
bool isValid() const override
static const char mlDqmClient_[]
void histoAnalysis(bool debug) override
DaqScopeModeHistograms(const edm::ParameterSet &pset, DQMStore *)
sistrip classes
#define LogTrace(id)
ii
Definition: cuy.py:589
int extract(std::vector< int > *output, const std::string &dati)
#define debug
Definition: HDRShower.cc:19
Algorithm for scope mode data.
std::auto_ptr< Factory > factory_
#define begin
Definition: vmac.h:32
HLT enums.
const VString & getErrorCodes() const
const HistosMap & histos() const
Analysis for scope mode data.