CMS 3D CMS Logo

Functions
EcalFunctionParametersUtils.h File Reference
#include "TH2F.h"
#include <string>
#include <cmath>

Go to the source code of this file.

Functions

int countEmptyRows (std::vector< float > &vec)
 
void fillFunctionParamsValues (TH2F *&align, std::vector< float > &m_params, std::string title, int &gridRows, int &NbColumns)
 

Function Documentation

int countEmptyRows ( std::vector< float > &  vec)

Definition at line 6 of file EcalFunctionParametersUtils.h.

Referenced by fillFunctionParamsValues().

6  {
7 
8  int cnt=0;
9  for(std::vector<float>::const_iterator it=vec.begin();it!=vec.end();it++)
10  if((*it)==0.0f)
11  cnt++;
12 
13  return cnt;
14 
15 }
void fillFunctionParamsValues ( TH2F *&  align,
std::vector< float > &  m_params,
std::string  title,
int &  gridRows,
int &  NbColumns 
)

Definition at line 17 of file EcalFunctionParametersUtils.h.

References countEmptyRows(), and mps_fire::i.

17  {
18  const int maxInCol=25;
19  int NbRows=0;
20 
21  NbRows = m_params.size() - countEmptyRows(m_params);
22 
23  gridRows=(NbRows<=maxInCol)?NbRows:maxInCol;
24  NbColumns=ceil(1.0*NbRows/maxInCol)+1;
25 
26  //char *y = new char[text[s].length() + 1];
27  //std::strcpy(y, text[s].c_str());
28 
29  align =new TH2F(title.c_str(),"Ecal Function Parameters", NbColumns, 0, NbColumns, gridRows, 0, gridRows);
30 
31  double row = gridRows - 0.5;
32  double column=1.5;
33  int cnt=0;
34 
35  for(int i=0;i<gridRows;i++){
36  align->Fill(0.5, gridRows-i-0.5, i+1);
37  }
38 
39 
40  for (std::vector<float>::const_iterator it =m_params.begin(); it != m_params.end();it++) {
41  if((*it)==0.0f) continue;
42  align->Fill(column, row, *it);
43 
44  cnt++;
45  column=floor(1.0*cnt/maxInCol)+1.5;
46  row=(row==0.5?(gridRows-0.5):row-1);
47  }
48 }
int countEmptyRows(std::vector< float > &vec)