CMS 3D CMS Logo

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 13 of file UECalibration.h.

Constructor & Destructor Documentation

◆ UECalibration() [1/2]

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

Definition at line 14 of file UECalibration.h.

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

References index, ni0, ni1, ni2, np, ue_interpolation_pf0, ue_interpolation_pf1, ue_interpolation_pf2, ue_predictor_pf, findQualityFiles::v, and heppy_batch::val.

◆ UECalibration() [2/2]

UECalibration::UECalibration ( std::string  calibrationFile)
inline

Definition at line 83 of file UECalibration.h.

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

References l1EGammaEEProducer_cfi::calibrationFile, recoMuon::in, index, mps_splice::line, ni0, ni1, ni2, np, AlCaHLTBitMon_QueryRunRegistry::string, ue_interpolation_pf0, ue_interpolation_pf1, ue_interpolation_pf2, ue_predictor_pf, and heppy_batch::val.

Member Data Documentation

◆ index

unsigned int UECalibration::index

Definition at line 145 of file UECalibration.h.

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

◆ ni0

unsigned int UECalibration::ni0[2]

Definition at line 145 of file UECalibration.h.

Referenced by UECalibration().

◆ ni1

unsigned int UECalibration::ni1[2]

Definition at line 145 of file UECalibration.h.

Referenced by UECalibration().

◆ ni2

unsigned int UECalibration::ni2[2]

Definition at line 145 of file UECalibration.h.

Referenced by UECalibration().

◆ np

unsigned int UECalibration::np[5]

Definition at line 145 of file UECalibration.h.

Referenced by UECalibration().

◆ ue_interpolation_pf0

float UECalibration::ue_interpolation_pf0[15][344]

Definition at line 151 of file UECalibration.h.

Referenced by UECalibration().

◆ ue_interpolation_pf1

float UECalibration::ue_interpolation_pf1[15][344]

Definition at line 151 of file UECalibration.h.

Referenced by UECalibration().

◆ ue_interpolation_pf2

float UECalibration::ue_interpolation_pf2[15][82]

Definition at line 151 of file UECalibration.h.

Referenced by UECalibration().

◆ ue_predictor_pf

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

Definition at line 151 of file UECalibration.h.

Referenced by UECalibration().

UECalibration::ue_interpolation_pf2
float ue_interpolation_pf2[15][82]
Definition: UECalibration.h:151
findQualityFiles.v
v
Definition: findQualityFiles.py:179
UECalibration::ue_interpolation_pf1
float ue_interpolation_pf1[15][344]
Definition: UECalibration.h:151
edm::FileInPath
Definition: FileInPath.h:64
UECalibration::ni2
unsigned int ni2[2]
Definition: UECalibration.h:145
UECalibration::ue_predictor_pf
float ue_predictor_pf[3][15][5][2][82]
Definition: UECalibration.h:151
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
UECalibration::np
unsigned int np[5]
Definition: UECalibration.h:145
recoMuon::in
Definition: RecoMuonEnumerators.h:6
UECalibration::ue_interpolation_pf0
float ue_interpolation_pf0[15][344]
Definition: UECalibration.h:151
heppy_batch.val
val
Definition: heppy_batch.py:351
UECalibration::index
unsigned int index
Definition: UECalibration.h:145
l1EGammaEEProducer_cfi.calibrationFile
calibrationFile
Definition: l1EGammaEEProducer_cfi.py:6
mps_splice.line
line
Definition: mps_splice.py:76
UECalibration::ni0
unsigned int ni0[2]
Definition: UECalibration.h:145
UECalibration::ni1
unsigned int ni1[2]
Definition: UECalibration.h:145