CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
UECalibration Struct Reference

#include <UECalibration.h>

Public Member Functions

 UECalibration (const std::vector< float > &v)
 
 UECalibration (std::string calibrationFile)
 

Public Attributes

unsigned int index
 
unsigned int ni0 [2]
 
unsigned int ni1 [2]
 
unsigned int ni2 [2]
 
unsigned int np [5]
 
float ue_interpolation_pf0 [15][344]
 
float ue_interpolation_pf1 [15][344]
 
float ue_interpolation_pf2 [15][82]
 
float ue_predictor_pf [3][15][5][2][82]
 

Detailed Description

Definition at line 11 of file UECalibration.h.

Constructor & Destructor Documentation

UECalibration::UECalibration ( const std::vector< float > &  v)
inline

Definition at line 12 of file UECalibration.h.

References index, ni0, ni1, ni2, np, ue_interpolation_pf0, ue_interpolation_pf1, ue_interpolation_pf2, and ue_predictor_pf.

13  {
14  np[0] = 3; // Number of reduced PF ID (track, ECAL, HCAL)
15  np[1] = 15; // Number of pseudorapidity block
16  np[2] = 5; // Fourier series order
17  np[3] = 2; // Re or Im
18  np[4] = 82; // Number of feature parameter
19 
20  ni0[0] = np[1];
21  ni0[1] = 344;
22 
23  ni1[0] = np[1];
24  ni1[1] = 344;
25 
26  ni2[0] = np[1];
27  ni2[1] = 82;
28 
29  unsigned int Nnp_full = np[0] * np[1] * np[2] * np[3] * np[4];
30  unsigned int Nnp = np[0] * np[1] * (1 + (np[2] - 1) * np[3]) * np[4];
31  unsigned int Nni0 = ni0[0]*ni0[1];
32  unsigned int Nni1 = ni1[0]*ni1[1];
33  unsigned int Nni2 = ni2[0]*ni2[1];
34 
35  memset(ue_predictor_pf, 0, Nnp_full * sizeof(float));
36  memset(ue_interpolation_pf0, 0, Nni0 * sizeof(float));
37  memset(ue_interpolation_pf1, 0, Nni1 * sizeof(float));
38  memset(ue_interpolation_pf2, 0, Nni2 * sizeof(float));
39 
40  for (index = 0; index < Nnp + Nni0 + Nni1 + Nni2; index++) {
41  float val = v[index];
42  int bin0, bin1, bin2, bin3, bin4;
43 
44  if (index < Nnp){
45  bin4 = index % np[4];
46 
47  unsigned int u = (index / np[4]) % (1 + (np[2] - 1) * np[3]);
48 
49  if (u == 0) {
50  bin2 = 0;
51  bin3 = 0;
52  }
53  else {
54  bin2 = (u - 1) / np[3] + 1;
55  bin3 = (u - 1) % np[3];
56  }
57 
58  bin1 = ((index / np[4]) / (1 + (np[2] - 1) * np[3])) % np[1];
59  bin0 = ((index / np[4]) / (1 + (np[2] - 1) * np[3])) / np[1];
60 
61  ue_predictor_pf[bin0][bin1][bin2][bin3][bin4] = val;
62  }
63  else if (index < Nnp + Nni0) {
64  bin1 = (index - Nnp) % ni0[1];
65  bin0 = (index - Nnp) / ni0[1];
66  ue_interpolation_pf0[bin0][bin1] = val;
67  }
68  else if (index < Nnp + Nni0 + Nni1) {
69  bin1 = (index - Nnp - Nni0) % ni1[1];
70  bin0 = (index - Nnp - Nni0) / ni1[1];
71  ue_interpolation_pf1[bin0][bin1] = val;
72  }
73  else {
74  bin1 = (index - Nnp - Nni0 - Nni1) % ni2[1];
75  bin0 = (index - Nnp - Nni0 - Nni1) / ni2[1];
76  ue_interpolation_pf2[bin0][bin1] = val;
77  }
78  }
79  }
unsigned int ni0[2]
unsigned int index
unsigned int ni2[2]
unsigned int np[5]
unsigned int ni1[2]
float ue_interpolation_pf0[15][344]
float ue_predictor_pf[3][15][5][2][82]
float ue_interpolation_pf1[15][344]
float ue_interpolation_pf2[15][82]
UECalibration::UECalibration ( std::string  calibrationFile)
inline

Definition at line 81 of file UECalibration.h.

References recoMuon::in, index, geometryCSVtoXML::line, ni0, ni1, ni2, np, AlCaHLTBitMon_QueryRunRegistry::string, ue_interpolation_pf0, ue_interpolation_pf1, ue_interpolation_pf2, and ue_predictor_pf.

81  {
82  np[0] = 3; // Number of reduced PF ID (track, ECAL, HCAL)
83  np[1] = 15; // Number of pseudorapidity block
84  np[2] = 5; // Fourier series order
85  np[3] = 2; // Re or Im
86  np[4] = 82; // Number of feature parameter
87 
88  ni0[0] = np[1];
89  ni0[1] = 344;
90 
91  ni1[0] = np[1];
92  ni1[1] = 344;
93 
94  ni2[0] = np[1];
95  ni2[1] = 82;
96 
97  index = 0;
98 
99  unsigned int Nnp_full = np[0] * np[1] * np[2] * np[3] * np[4];
100  unsigned int Nnp = np[0] * np[1] * (1 + (np[2] - 1) * np[3]) * np[4];
101  unsigned int Nni0 = ni0[0]*ni0[1];
102  unsigned int Nni1 = ni1[0]*ni1[1];
103  unsigned int Nni2 = ni2[0]*ni2[1];
104 
105  memset(ue_predictor_pf, 0, Nnp_full * sizeof(float));
106  memset(ue_interpolation_pf0, 0, Nni0 * sizeof(float));
107  memset(ue_interpolation_pf1, 0, Nni1 * sizeof(float));
108  memset(ue_interpolation_pf2, 0, Nni2 * sizeof(float));
109 
110  edm::FileInPath ueData(calibrationFile.data());
111  std::string qpDataName = ueData.fullPath();
112  std::ifstream in( qpDataName.c_str() );
114 
115  while( std::getline( in, line)){
116  if(!line.size() || line[0]=='#') {
117  continue;
118  }
119  std::istringstream linestream(line);
120  float val;
121  int bin0, bin1, bin2, bin3, bin4;
122  if(index < Nnp){
123  // cout<<"predictor "<<bin0<<" "<<bin1<<" "<<bin2<<" "<<bin3<<" "<<bin4<<" "<<val<<endl;
124  linestream>>bin0>>bin1>>bin2>>bin3>>bin4>>val;
125  ue_predictor_pf[bin0][bin1][bin2][bin3][bin4] = val;
126  }else if(index < Nnp + Nni0){
127  // cout<<"inter_0 "<<bin0<<" "<<bin1<<" "<<bin2<<" "<<bin3<<" "<<bin4<<" "<<val<<endl;
128  linestream>>bin0>>bin1>>val;
129  ue_interpolation_pf0[bin0][bin1] = val;
130  }else if(index < Nnp + Nni0 + Nni1){
131  // cout<<"inter_1 "<<bin0<<" "<<bin1<<" "<<bin2<<" "<<bin3<<" "<<bin4<<" "<<val<<endl;
132  linestream>>bin0>>bin1>>val;
133  ue_interpolation_pf1[bin0][bin1] = val;
134  }else if(index < Nnp + Nni0 + Nni1 + Nni2){
135  // cout<<"inter_2 "<<bin0<<" "<<bin1<<" "<<bin2<<" "<<bin3<<" "<<bin4<<" "<<val<<endl;
136  linestream>>bin0>>bin1>>val;
137  ue_interpolation_pf2[bin0][bin1] = val;
138  }
139  ++index;
140  }
141  }
unsigned int ni0[2]
unsigned int index
unsigned int ni2[2]
unsigned int np[5]
unsigned int ni1[2]
float ue_interpolation_pf0[15][344]
float ue_predictor_pf[3][15][5][2][82]
float ue_interpolation_pf1[15][344]
float ue_interpolation_pf2[15][82]

Member Data Documentation

unsigned int UECalibration::index

Definition at line 143 of file UECalibration.h.

Referenced by BeautifulSoup.PageElement::_invert(), and UECalibration().

unsigned int UECalibration::ni0[2]

Definition at line 143 of file UECalibration.h.

Referenced by UECalibration().

unsigned int UECalibration::ni1[2]

Definition at line 143 of file UECalibration.h.

Referenced by UECalibration().

unsigned int UECalibration::ni2[2]

Definition at line 143 of file UECalibration.h.

Referenced by UECalibration().

unsigned int UECalibration::np[5]

Definition at line 143 of file UECalibration.h.

Referenced by UECalibration().

float UECalibration::ue_interpolation_pf0[15][344]

Definition at line 149 of file UECalibration.h.

Referenced by VoronoiAlgorithm::subtract_momentum(), and UECalibration().

float UECalibration::ue_interpolation_pf1[15][344]

Definition at line 149 of file UECalibration.h.

Referenced by VoronoiAlgorithm::subtract_momentum(), and UECalibration().

float UECalibration::ue_interpolation_pf2[15][82]

Definition at line 149 of file UECalibration.h.

Referenced by VoronoiAlgorithm::subtract_momentum(), and UECalibration().

float UECalibration::ue_predictor_pf[3][15][5][2][82]

Definition at line 149 of file UECalibration.h.

Referenced by VoronoiAlgorithm::subtract_momentum(), and UECalibration().