CMS 3D CMS Logo

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