CMS 3D CMS Logo

EcalFunctionParametersUtils.h
Go to the documentation of this file.
1 #include "TH2F.h"
2 #include <string>
3 #include <cmath>
4 
5 int countEmptyRows(std::vector<float>& vec) {
6  int cnt = 0;
7  for (std::vector<float>::const_iterator it = vec.begin(); it != vec.end(); it++)
8  if ((*it) == 0.0f)
9  cnt++;
10 
11  return cnt;
12 }
13 
15  TH2F*& align, std::vector<float>& m_params, std::string title, int& gridRows, int& NbColumns) {
16  const int maxInCol = 25;
17  int NbRows = 0;
18 
19  NbRows = m_params.size() - countEmptyRows(m_params);
20 
21  gridRows = (NbRows <= maxInCol) ? NbRows : maxInCol;
22  NbColumns = ceil(1.0 * NbRows / maxInCol) + 1;
23 
24  //char *y = new char[text[s].length() + 1];
25  //std::strcpy(y, text[s].c_str());
26 
27  align = new TH2F(title.c_str(), "Ecal Function Parameters", NbColumns, 0, NbColumns, gridRows, 0, gridRows);
28 
29  double row = gridRows - 0.5;
30  double column = 1.5;
31  int cnt = 0;
32 
33  for (int i = 0; i < gridRows; i++) {
34  align->Fill(0.5, gridRows - i - 0.5, i + 1);
35  }
36 
37  for (std::vector<float>::const_iterator it = m_params.begin(); it != m_params.end(); it++) {
38  if ((*it) == 0.0f)
39  continue;
40  align->Fill(column, row, *it);
41 
42  cnt++;
43  column = floor(1.0 * cnt / maxInCol) + 1.5;
44  row = (row == 0.5 ? (gridRows - 0.5) : row - 1);
45  }
46 }
mps_fire.i
i
Definition: mps_fire.py:355
align
Definition: AlignableIndexer.h:30
reco::ceil
constexpr int32_t ceil(float num)
Definition: constexpr_cmath.h:7
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
countEmptyRows
int countEmptyRows(std::vector< float > &vec)
Definition: EcalFunctionParametersUtils.h:5
overlapproblemtsosanalyzer_cfi.title
title
Definition: overlapproblemtsosanalyzer_cfi.py:7
fillFunctionParamsValues
void fillFunctionParamsValues(TH2F *&align, std::vector< float > &m_params, std::string title, int &gridRows, int &NbColumns)
Definition: EcalFunctionParametersUtils.h:14