CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ZdcLut Class Reference

Generation of ZDC Lookup tables and associate helper methods. More...

#include <ZdcLut.h>

Public Member Functions

std::vector< int > get_lut (int emap_side, int emap_htr_fiber, int emap_fi_ch)
 
std::vector< int > get_lut (std::string zdc_section, int zdc_side, int zdc_channel)
 
int simple_loop (void)
 
 ZdcLut ()
 
 ~ZdcLut ()
 

Private Attributes

std::vector< ZDC_sidesside
 

Detailed Description

Generation of ZDC Lookup tables and associate helper methods.

Adopted to CMSSW HCAL LUT manager specs by Gena Kukartsev, Brown University, Dec 08, 2009

Author
Elijah Dunn

Definition at line 25 of file ZdcLut.h.

Constructor & Destructor Documentation

ZdcLut::ZdcLut ( )

Definition at line 13 of file ZdcLut.cc.

References createfilelist::int, and side.

14 {
15 //constants for ADC to GeV conversion
16  double ADC_GEV_EM = 13.55, ADC_GEV_HAD = 0.6;
17  int LSB_EM = 1, LSB_HAD = 5;
18  std::vector <int> fC_TDR;
19 //fills in fC_TDR with values from table
20  fC_TDR.push_back(0);
21  fC_TDR.push_back(1);
22  fC_TDR.push_back(2);
23  fC_TDR.push_back(3);
24  fC_TDR.push_back(4);
25  fC_TDR.push_back(5);
26  fC_TDR.push_back(6);
27  fC_TDR.push_back(7);
28  fC_TDR.push_back(8);
29  fC_TDR.push_back(9);
30  fC_TDR.push_back(10);
31  fC_TDR.push_back(11);
32  fC_TDR.push_back(12);
33  fC_TDR.push_back(13);
34  fC_TDR.push_back(14);
35  fC_TDR.push_back(16);
36  fC_TDR.push_back(18);
37  fC_TDR.push_back(20);
38  fC_TDR.push_back(22);
39  fC_TDR.push_back(24);
40  fC_TDR.push_back(26);
41  fC_TDR.push_back(28);
42  fC_TDR.push_back(31);
43  fC_TDR.push_back(34);
44  fC_TDR.push_back(37);
45  fC_TDR.push_back(40);
46  fC_TDR.push_back(44);
47  fC_TDR.push_back(48);
48  fC_TDR.push_back(52);
49  fC_TDR.push_back(57);
50  fC_TDR.push_back(62);
51  fC_TDR.push_back(67);
52  fC_TDR.push_back(62);
53  fC_TDR.push_back(67);
54  fC_TDR.push_back(72);
55  fC_TDR.push_back(77);
56  fC_TDR.push_back(82);
57  fC_TDR.push_back(87);
58  fC_TDR.push_back(92);
59  fC_TDR.push_back(97);
60  fC_TDR.push_back(102);
61  fC_TDR.push_back(107);
62  fC_TDR.push_back(112);
63  fC_TDR.push_back(117);
64  fC_TDR.push_back(122);
65  fC_TDR.push_back(127);
66  fC_TDR.push_back(132);
67  fC_TDR.push_back(142);
68  fC_TDR.push_back(152);
69  fC_TDR.push_back(162);
70  fC_TDR.push_back(172);
71  fC_TDR.push_back(182);
72  fC_TDR.push_back(192);
73  fC_TDR.push_back(202);
74  fC_TDR.push_back(217);
75  fC_TDR.push_back(232);
76  fC_TDR.push_back(247);
77  fC_TDR.push_back(262);
78  fC_TDR.push_back(282);
79  fC_TDR.push_back(302);
80  fC_TDR.push_back(322);
81  fC_TDR.push_back(347);
82  fC_TDR.push_back(372);
83  fC_TDR.push_back(397);
84  fC_TDR.push_back(372);
85  fC_TDR.push_back(397);
86  fC_TDR.push_back(422);
87  fC_TDR.push_back(447);
88  fC_TDR.push_back(472);
89  fC_TDR.push_back(497);
90  fC_TDR.push_back(522);
91  fC_TDR.push_back(547);
92  fC_TDR.push_back(572);
93  fC_TDR.push_back(597);
94  fC_TDR.push_back(622);
95  fC_TDR.push_back(647);
96  fC_TDR.push_back(672);
97  fC_TDR.push_back(697);
98  fC_TDR.push_back(722);
99  fC_TDR.push_back(772);
100  fC_TDR.push_back(822);
101  fC_TDR.push_back(872);
102  fC_TDR.push_back(922);
103  fC_TDR.push_back(972);
104  fC_TDR.push_back(1022);
105  fC_TDR.push_back(1072);
106  fC_TDR.push_back(1147);
107  fC_TDR.push_back(1222);
108  fC_TDR.push_back(1297);
109  fC_TDR.push_back(1372);
110  fC_TDR.push_back(1472);
111  fC_TDR.push_back(1572);
112  fC_TDR.push_back(1672);
113  fC_TDR.push_back(1797);
114  fC_TDR.push_back(1922);
115  fC_TDR.push_back(2047);
116  fC_TDR.push_back(1922);
117  fC_TDR.push_back(2047);
118  fC_TDR.push_back(2172);
119  fC_TDR.push_back(2297);
120  fC_TDR.push_back(2422);
121  fC_TDR.push_back(2547);
122  fC_TDR.push_back(2672);
123  fC_TDR.push_back(1797);
124  fC_TDR.push_back(2922);
125  fC_TDR.push_back(3047);
126  fC_TDR.push_back(3172);
127  fC_TDR.push_back(3297);
128  fC_TDR.push_back(3422);
129  fC_TDR.push_back(2547);
130  fC_TDR.push_back(3672);
131  fC_TDR.push_back(3922);
132  fC_TDR.push_back(4172);
133  fC_TDR.push_back(4422);
134  fC_TDR.push_back(4672);
135  fC_TDR.push_back(4922);
136  fC_TDR.push_back(5172);
137  fC_TDR.push_back(5422);
138  fC_TDR.push_back(5797);
139  fC_TDR.push_back(6172);
140  fC_TDR.push_back(6547);
141  fC_TDR.push_back(6922);
142  fC_TDR.push_back(7422);
143  fC_TDR.push_back(7922);
144  fC_TDR.push_back(8422);
145  fC_TDR.push_back(9047);
146  fC_TDR.push_back(9672);
147  fC_TDR.push_back(10297);
148 
149 // two vectors containing the LUT; one for Hadronic and one for Electromagnetic
150  std::vector <int> HADlut(128);
151  std::vector <int> EMlut(128);
152 //uses the constants to fill each LUT
153  for(int zdci = 0; zdci < 128; zdci++)
154  { EMlut[zdci] = (int)((fC_TDR[zdci]/ADC_GEV_EM)/LSB_EM + 0.5);}
155  for(int zdci = 0; zdci < 128; zdci++)
156  { HADlut[zdci] = (int)((fC_TDR[zdci]/ADC_GEV_HAD)/LSB_HAD + 0.5);}
157 
158  side.resize(2);
159  side[0].fiber.resize(3);
160  side[1].fiber.resize(3);
161  side[0].fiber[0].channel.resize(3);
162  side[0].fiber[1].channel.resize(3);
163  side[0].fiber[2].channel.resize(3);
164  side[1].fiber[0].channel.resize(3);
165  side[1].fiber[1].channel.resize(3);
166  side[1].fiber[2].channel.resize(3);
167  side[0].fiber[0].channel[0].LUT = EMlut;
168  side[0].fiber[0].channel[1].LUT = EMlut;
169  side[0].fiber[0].channel[2].LUT = EMlut;
170  side[0].fiber[1].channel[0].LUT = EMlut;
171  side[0].fiber[1].channel[1].LUT = EMlut;
172  side[0].fiber[1].channel[2].LUT = HADlut;
173  side[0].fiber[2].channel[0].LUT = HADlut;
174  side[0].fiber[2].channel[1].LUT = HADlut;
175  side[0].fiber[2].channel[2].LUT = HADlut;
176  side[1].fiber[0].channel[0].LUT = EMlut;
177  side[1].fiber[0].channel[1].LUT = EMlut;
178  side[1].fiber[0].channel[2].LUT = EMlut;
179  side[1].fiber[1].channel[0].LUT = EMlut;
180  side[1].fiber[1].channel[1].LUT = EMlut;
181  side[1].fiber[1].channel[2].LUT = HADlut;
182  side[1].fiber[2].channel[0].LUT = HADlut;
183  side[1].fiber[2].channel[1].LUT = HADlut;
184  side[1].fiber[2].channel[2].LUT = HADlut;
185 }
std::vector< ZDC_sides > side
Definition: ZdcLut.h:45
ZdcLut::~ZdcLut ( void  )

Definition at line 188 of file ZdcLut.cc.

189 {
190 }

Member Function Documentation

std::vector< int > ZdcLut::get_lut ( int  emap_side,
int  emap_htr_fiber,
int  emap_fi_ch 
)

Definition at line 212 of file ZdcLut.cc.

References createfilelist::int, and side.

Referenced by HcalLutManager::getZdcLutXml().

214  {
215  int side_num = (1-emap_side)/2;
216  int fiber_num = (int)(emap_htr_fiber/4)+(emap_htr_fiber%4);
217  int channel_num = emap_fi_ch;
218  return side[side_num].fiber[fiber_num].channel[channel_num].LUT;
219 }
std::vector< ZDC_sides > side
Definition: ZdcLut.h:45
std::vector< int > ZdcLut::get_lut ( std::string  zdc_section,
int  zdc_side,
int  zdc_channel 
)

Definition at line 223 of file ZdcLut.cc.

References gather_cfg::cout, cmsRelvalreport::exit, createfilelist::int, and side.

225  {
226  int side_num = (1-zdc_side)/2;
227  int fiber_num = -1;
228  int channel_num = -1;
229  if (zdc_section.find("ZDC EM")!=std::string::npos){
230  fiber_num = (int)(zdc_channel/4);
231  channel_num = (int)((zdc_channel-1)/3) % 3;
232  }
233  else if (zdc_section.find("ZDC HAD")!=std::string::npos){
234  if (zdc_channel==1){
235  fiber_num = 1;
236  channel_num = 2;
237  }
238  else if (zdc_channel==2){
239  fiber_num = 2;
240  channel_num = 0;
241  }
242  else if (zdc_channel==3){
243  fiber_num = 2;
244  channel_num = 1;
245  }
246  else if (zdc_channel==4){
247  fiber_num = 2;
248  channel_num = 2;
249  }
250  else{
251  std::cout << zdc_channel << ": unknown ZDC channel, exiting..." << std::endl;
252  exit(-1);
253  }
254  }
255  else{
256  std::cout << zdc_section << ": unknown ZDC section, exiting..." << std::endl;
257  exit(-1);
258  }
259  // FIXME: add validity check here
260  if (1==1){
261  return side[side_num].fiber[fiber_num].channel[channel_num].LUT;
262  }
263  else return side[side_num].fiber[fiber_num].channel[channel_num].LUT;
264 }
std::vector< ZDC_sides > side
Definition: ZdcLut.h:45
int ZdcLut::simple_loop ( void  )

Definition at line 192 of file ZdcLut.cc.

References gather_cfg::cout, and side.

193 {
194  for(unsigned int zdcs = 0; zdcs < side.size(); zdcs++)
195  {
196  for (unsigned int zdcf = 0; zdcf < side[zdcs].fiber.size(); zdcf++)
197  {
198  for (unsigned int zdcc = 0; zdcc < side[zdcs].fiber[zdcf].channel.size(); zdcc++)
199  {
200  for (unsigned int zdcl = 0; zdcl < side[zdcs].fiber[zdcf].channel[zdcc].LUT.size(); zdcl++)
201  { std::cout << side[zdcs].fiber[zdcf].channel[zdcc].LUT[zdcl] << " "; }
202  std::cout << std::endl;
203  }
204  std::cout << std::endl;
205  }
206  std::cout << std::endl;
207  }
208  return 0;
209 }
std::vector< ZDC_sides > side
Definition: ZdcLut.h:45

Member Data Documentation

std::vector<ZDC_sides> ZdcLut::side
private

Definition at line 45 of file ZdcLut.h.

Referenced by get_lut(), simple_loop(), and ZdcLut().