StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StBemcTriggerDbThresholds.cxx
1 #include "StBemcTriggerDbThresholds.h"
2 
3 //General
4 #include <StMessMgr.h>
5 #include "TDatime.h"
6 //Db
7 #include "St_db_Maker/St_db_Maker.h"
8 
9 
11 
12 //==================================================
13 
14 StBemcTriggerDbThresholds::StBemcTriggerDbThresholds() {
15 
16  LOG_INFO<<"StBemcTriggerDbThresholds::constructor"<<endm;
17 
18 }
19 
20 //==================================================
21 StBemcTriggerDbThresholds::~StBemcTriggerDbThresholds(){
22 
23  LOG_INFO<<"StBemcTriggerDbThresholds::deconstructor"<<endl;
24 
25 }
26 
27 //==================================================
28 //==================================================
29 void StBemcTriggerDbThresholds::LoadTimeStamps(){
30 
31  //settings for year 2006
32  // subtract 10 seconds from each beginTime and add 10 to each endTime
33  // just in case DB record is off be a second (it happens) -- APK
34 
35  //#0 Runs#7097009 - 7101054 2006-04-07 04:43:31 to 2006-04-11 17:21:09
36  start_2006[0].Set(2006,04,07,04,43,21);
37  end_2006[0].Set(2006,04,11,17,21,19);
38  //#1 Runs#7101075 - 7129065 2006-04-12 01:31:40 to 2006-05-09 21:16:07
39  start_2006[1].Set(2006,4,12,1,31,30);
40  end_2006[1].Set(2006,5,9,21,16,17);
41  //#2 Runs#7131043 - 7132027 2006-05-12 03:59:16 to 2006-05-12 09:16:22
42  start_2006[2].Set(2006,5,12,3,59,6);
43  end_2006[2].Set(2006,5,12,9,16,32);
44  //#3 Runs#7132062 - 7133051 2006-05-12 20:44:34 to 2006-05-13 21:50:03
45  start_2006[3].Set(2006,5,12,20,44,24);
46  end_2006[3].Set(2006,5,13,21,50,13);
47  //#4 Runs#7133052 - 7135028 2006-05-13 21:52:49 to 2006-05-15 16:47:03
48  start_2006[4].Set(2006,5,13,21,52,39);
49  end_2006[4].Set(2006,5,15,16,47,13);
50  //#5 Runs#7135067 - 7156028 2006-05-16 02:38:55 to 2006-06-05 15:49:17
51  start_2006[5].Set(2006,5,16,2,38,45);
52  end_2006[5].Set(2006,6,5,15,49,27);
53 
54 
55  //settings for year 2007
56 
57  //#0 Runs#8094008 - 8102029 2007-04-04 05:38:54 to 2007-04-12 09:13:17
58  //200211 - bht2-mb (somewhere in here bit0 changed from 6 to 3!)
59  start_2007[0].Set(2007,4,4,5,38,44);
60  end_2007[0].Set(2007,4,12,9,13,27);
61 
62  //#1 Runs#8097121 - 8108014 2007-04-08 03:26:09 to 2007-04-18 08:23:00
63  //200585 - bht2
64  start_2007[1].Set(2007,4,8,3,25,59);
65  end_2007[1].Set(2007,4,15,8,23,10);
66 
67  //#2 Runs#8103029 - 8113068 2007-04-13 20:09:39 to 2007-04-23 17:24:13
68  //200212 - bht2-mb
69  //200213 - btag, 200601 - L2-upsilon
70  //200220 - bht2-mb
71  //200601 - L2-upsilon bht1
72  start_2007[2].Set(2007,4,13,20,9,29);
73  end_2007[2].Set(2007,4,23,17,24,23);
74 
75  //#3 Runs#8109015 - 8177048 2007-04-19 05:01:58 to 2007-06-26 12:57:31
76  //200221 - bht2-mb, 200620 - L2-gamma
77  //200586 - bht2, 200222 - bht2-mb, 200214 - btag,
78  //200602 - L2-upsilon, 200621 - L2-gamma (HTbits = 3,18,23)
79  start_2007[3].Set(2007,4,19,5,1,48);
80  end_2007[3].Set(2007,6,26,12,57,41);
81 
82  //settings for 2008 production_dAu2008
83 
84  //#1 Runs#8340015 - 8344057 2007-12-06 12:39:20 - 2007-12-10 14:42:45
85  //210500 HT0, 210510 HT1, 210520 HT2
86  start_2008[0].Set(2007,12,6,12,39,10);
87  end_2008[0].Set(2007,12,10,2,42,55);
88 
89  //#2 Runs#8344088 - 9027087 2007-12-10 19:42:37 - 2008-01-28 00:55:57
90  //210501 HT0, 210511 HT1, 210521 HT2, 210541 HT4
91  start_2008[1].Set(2007,12,10,19,42,27);
92  end_2008[1].Set(2008,1,28,0,56,7);
93 
94  //settings for 2008 production_pp
95 
96  //#1 Runs#9045006-9070007 2008-02-14 07:03:52 - 2008-03-10 11:02:05
97  //220500 HT0, 220510 HT1, 220520 HT2
98  start_2008[2].Set(2008,2,14,7,3,42);
99  end_2008[2].Set(2008,3,10,11,1,55);
100 
101  //settings for 2009 production 500 GeV
102  start_2009[0].Set(2009,2,17,0,0,0);
103  end_2009[0].Set(2009,4,15,0,0,0);
104 
105  //settings for 2009 production 200 GeV
106  start_2009[1].Set(2009,4,15,0,0,1);
107  end_2009[1].Set(2009,5,15,0,0,0);
108 
109 
110 }
111 
112 //==================================================
113 //==================================================
114 Int_t StBemcTriggerDbThresholds::GetHtFEEbitOffset(int year){
115 
116  LOG_INFO <<"StBemcTriggerDbThresholds::GetHtFEEbitOffset()"<<endm;
117 
118  int bitOffset=2;
119 
120  (year>2005) ? bitOffset=2 : bitOffset=3;
121 
122  return bitOffset;
123 
124 }
125 
126 
127 
128 //==================================================
129 //==================================================
130 Int_t StBemcTriggerDbThresholds::GetTP_DSM0_threshold(Int_t DSMmodule, UInt_t timestamp, Int_t layer){
131 
132  Int_t threshold=-1;
133 
134  //2006 TP thresholds
135  const Int_t TP0_TH_2006[6] = { 1, 1, 1, 1, 1, 1};
136  const Int_t TP1_TH_2006[6] = { 17, 17, 20, 20, 19, 19};
137  const Int_t TP2_TH_2006[6] = { 31, 31, 31, 31, 31, 31};
138  for (int i=0; i<6;i++)
139  {
140  if (DSMmodule<15)
141  {//WEST
142  if ((timestamp>=start_2006[i].Get())&&(timestamp<=end_2006[i].Get()))
143  {
144  if (layer==0) threshold=TP0_TH_2006[i];
145  if (layer==1) threshold=TP1_TH_2006[i];
146  if (layer==2) threshold=TP2_TH_2006[i];
147  }
148  }
149 
150  if (DSMmodule>=15)
151  {//EAST
152  if ((timestamp>=start_2006[i].Get())&&(timestamp<=end_2006[i].Get()))
153  {
154 
155  if (layer==0) threshold=TP0_TH_2006[i];
156  if (layer==1) threshold=TP1_TH_2006[i];
157  if (layer==2) threshold=TP2_TH_2006[i];
158  }
159  }
160  }
161 
162 
163  //There were no TP thresholds in 2007
164 
165  //2008 TP thresholds
166  const Int_t TP0_TH_2008[6] = { 24, 24, 24, 24, 24, 24};
167  for (int i=0; i<6;i++)
168  {
169  if (DSMmodule<15)
170  {//WEST
171  if ((timestamp>=start_2008[i].Get())&&(timestamp<=end_2008[i].Get()))
172  {
173  if (layer==0) threshold=TP0_TH_2008[i];
174  }
175  }
176 
177  if (DSMmodule>=15)
178  {//EAST
179  if ((timestamp>=start_2008[i].Get())&&(timestamp<=end_2008[i].Get()))
180  {
181  if (layer==0) threshold=TP0_TH_2008[i];
182  }
183  }
184  }
185 
186  return threshold;
187 }
188 
189 //==================================================
190 //==================================================
191 Int_t StBemcTriggerDbThresholds::GetJP_DSM1_threshold(Int_t DSMmodule,UInt_t timestamp, Int_t layer){
192 
193  Int_t threshold=-1;
194 
195  //2006 JP thresholds
196  const Int_t JP0_TH_2006[6] = { 42, 42, 48, 49, 49, 49};
197  const Int_t JP1_TH_2006[6] = { 58, 58, 58, 60, 60, 60};
198  const Int_t JP2_TH_2006[6] = {110,110,110,110,110,110};
199  for (int i=0;i<6;i++)
200  {
201  if (DSMmodule<15)
202  {//WEST
203  if ((timestamp>=start_2006[i].Get())&&(timestamp<=end_2006[i].Get()))
204  {
205  if (layer==0) threshold=JP0_TH_2006[i];
206  if (layer==1) threshold=JP1_TH_2006[i];
207  if (layer==2) threshold=JP2_TH_2006[i];
208  }
209  }
210 
211 
212  if (DSMmodule>=15)
213  {//EAST
214  if ((timestamp>=start_2006[i].Get())&&(timestamp<=end_2006[i].Get()))
215  {
216  if (layer==0) threshold=JP0_TH_2006[i];
217  if (layer==1) threshold=JP1_TH_2006[i];
218  if (layer==2) threshold=JP2_TH_2006[i];
219  }
220  }
221  }
222 
223  //There were no JP thresholds in 2007
224 
225  //2008 JP thresholds
226  const Int_t JP0_TH_2008[6] = { 50, 50, 50, 50, 50, 50};
227  const Int_t JP1_TH_2008[6] = { 87, 87, 87, 87, 87, 87};
228  const Int_t JP2_TH_2008[6] = {100,100,100,100,100,100};
229  for (int i=0;i<6;i++)
230  {
231  if (DSMmodule<15)
232  {//WEST
233  if ((timestamp>=start_2008[i].Get())&&(timestamp<=end_2008[i].Get()))
234  {
235  if (layer==0) threshold=JP0_TH_2008[i];
236  if (layer==1) threshold=JP1_TH_2008[i];
237  if (layer==2) threshold=JP2_TH_2008[i];
238  }
239  }
240 
241 
242  if (DSMmodule>=15)
243  {//EAST
244  if ((timestamp>=start_2008[i].Get())&&(timestamp<=end_2008[i].Get()))
245  {
246  if (layer==0) threshold=JP0_TH_2008[i];
247  if (layer==1) threshold=JP1_TH_2008[i];
248  if (layer==2) threshold=JP2_TH_2008[i];
249  }
250  }
251  }
252 
253 
254 
255 
256 
257  //2009 JP thresholds
258  const Int_t JP0_TH_2009[2] = { 28, 20};
259  const Int_t JP1_TH_2009[2] = { 35, 28};
260  const Int_t JP2_TH_2009[2] = { 52, 35};
261  for (int i=0;i<2;i++)
262  {
263  if (DSMmodule<15)
264  {//WEST
265  if ((timestamp>=start_2009[i].Get())&&(timestamp<=end_2009[i].Get()))
266  {
267  if (layer==0) threshold=JP0_TH_2009[i];
268  if (layer==1) threshold=JP1_TH_2009[i];
269  if (layer==2) threshold=JP2_TH_2009[i];
270  }
271  }
272 
273 
274  if (DSMmodule>=15)
275  {//EAST
276  if ((timestamp>=start_2009[i].Get())&&(timestamp<=end_2009[i].Get()))
277  {
278  if (layer==0) threshold=JP0_TH_2009[i];
279  if (layer==1) threshold=JP1_TH_2009[i];
280  if (layer==2) threshold=JP2_TH_2009[i];
281  }
282  }
283  }
284 
285 
286  return threshold;
287 }
288 
289 //==================================================
290 //==================================================
291 Int_t StBemcTriggerDbThresholds::GetHT_DSM0_threshold(Int_t DSMmodule, UInt_t timestamp, Int_t layer){
292 
293  int threshold=-1;
294 
295  //2006 HT East and West Thresholds
296  const Int_t HTW0_TH_2006[6] = { 5, 5, 5, 5, 5, 5};
297  const Int_t HTW1_TH_2006[6] = { 12, 12, 16, 18, 16, 16};
298  const Int_t HTW2_TH_2006[6] = { 22, 24, 24, 24, 24, 24};
299  const Int_t HTE0_TH_2006[6] = { 11, 11, 5, 5, 5, 5};
300  const Int_t HTE1_TH_2006[6] = { 12, 12, 16, 18, 16, 16};
301  const Int_t HTE2_TH_2006[6] = { 24, 24, 24, 24, 24, 24};
302  for (int i=0;i<6;i++){
303 
304  if (DSMmodule<15)
305  {//WEST
306  if ((timestamp>=start_2006[i].Get())&&(timestamp<=end_2006[i].Get()))
307  {
308  if (layer==0) threshold=HTW0_TH_2006[i];
309  if (layer==1) threshold=HTW1_TH_2006[i];
310  if (layer==2) threshold=HTW2_TH_2006[i];
311  }
312  }
313 
314 
315  if (DSMmodule>=15)
316  {//EAST
317  if ((timestamp>=start_2006[i].Get())&&(timestamp<=end_2006[i].Get()))
318  {
319  if (layer==0) threshold=HTE0_TH_2006[i];
320  if (layer==1) threshold=HTE1_TH_2006[i];
321  if (layer==2) threshold=HTE2_TH_2006[i];
322  }
323  }
324  }
325 
326 
327  //2007 HT East and West Thresholds (no separation of east or west in 2007)
328  const Int_t HTW0_TH_2007[4] = { 6, 4, 3, 3};
329  const Int_t HTW1_TH_2007[4] = { 18, 18, 18, 18};
330  const Int_t HTW2_TH_2007[4] = { 24, 24, 24, 23};
331  const Int_t HTE0_TH_2007[4] = { 6, 4, 3, 3};
332  const Int_t HTE1_TH_2007[4] = { 18, 18, 18, 18};
333  const Int_t HTE2_TH_2007[4] = { 24, 24, 24, 23};
334  for (int i=0;i<4;i++){
335 
336  if (DSMmodule<15)
337  {//WEST
338  if ((timestamp>=start_2007[i].Get())&&(timestamp<=end_2007[i].Get()))
339  {
340  if (layer==0) threshold=HTW0_TH_2007[i];
341  if (layer==1) threshold=HTW1_TH_2007[i];
342  if (layer==2) threshold=HTW2_TH_2007[i];
343  }
344  }
345 
346 
347  if (DSMmodule>=15)
348  {//EAST
349  if ((timestamp>=start_2007[i].Get())&&(timestamp<=end_2007[i].Get()))
350  {
351  if (layer==0) threshold=HTE0_TH_2007[i];
352  if (layer==1) threshold=HTE1_TH_2007[i];
353  if (layer==2) threshold=HTE2_TH_2007[i];
354  }
355  }
356  }
357 
358 
359  //2008 HT East and West Thresholds
360  const Int_t HTW0_TH_2008[6] = { 11, 11, 11};
361  const Int_t HTW1_TH_2008[6] = { 15, 15, 15};
362  const Int_t HTW2_TH_2008[6] = { 18, 18, 18};
363  const Int_t HTW3_TH_2008[6] = { 35, 35, 16};
364  const Int_t HTW4_TH_2008[6] = { 35, 35, 63};
365 
366  const Int_t HTE0_TH_2008[6] = { 11, 11, 11};
367  const Int_t HTE1_TH_2008[6] = { 15, 15, 15};
368  const Int_t HTE2_TH_2008[6] = { 18, 18, 18};
369  const Int_t HTE3_TH_2008[6] = { 35, 35, 16};
370  const Int_t HTE4_TH_2008[6] = { 35, 35, 63};
371 
372  for (int i=0;i<3;i++){
373 
374  if (DSMmodule<15)
375  {//WEST
376  if ((timestamp>=start_2008[i].Get())&&(timestamp<=end_2008[i].Get()))
377  {
378  if (layer==0) threshold=HTW0_TH_2008[i];
379  if (layer==1) threshold=HTW1_TH_2008[i];
380  if (layer==2) threshold=HTW2_TH_2008[i];
381  if (layer==3) threshold=HTW3_TH_2008[i];
382  if (layer==4) threshold=HTW4_TH_2008[i];
383  }
384 
385  }
386 
387 
388  if (DSMmodule>=15)
389  {//EAST
390  if ((timestamp>=start_2008[i].Get())&&(timestamp<=end_2008[i].Get()))
391  {
392  if (layer==0) threshold=HTE0_TH_2008[i];
393  if (layer==1) threshold=HTE1_TH_2008[i];
394  if (layer==2) threshold=HTE2_TH_2008[i];
395  if (layer==3) threshold=HTE3_TH_2008[i];
396  if (layer==4) threshold=HTE4_TH_2008[i];
397  }
398  }
399  }
400 
401 
402 
403 
404  //2009 HT East and West Thresholds
405  const Int_t HT0_TH_2009[2] = { 11, 11};
406  const Int_t HT1_TH_2009[2] = { 15, 15};
407  const Int_t HT2_TH_2009[2] = { 19, 17};
408  const Int_t HT3_TH_2009[2] = { 25, 23};
409 
410  for (int i=0;i<2;i++){
411 
412  if (DSMmodule<15)
413  {//WEST
414  if ((timestamp>=start_2009[i].Get())&&(timestamp<=end_2009[i].Get()))
415  {
416  if (layer==0) threshold=HT0_TH_2009[i];
417  if (layer==1) threshold=HT1_TH_2009[i];
418  if (layer==2) threshold=HT2_TH_2009[i];
419  if (layer==3) threshold=HT3_TH_2009[i];
420  }
421 
422  }
423 
424 
425  if (DSMmodule>=15)
426  {//EAST
427  if ((timestamp>=start_2009[i].Get())&&(timestamp<=end_2009[i].Get()))
428  {
429  if (layer==0) threshold=HT0_TH_2009[i];
430  if (layer==1) threshold=HT1_TH_2009[i];
431  if (layer==2) threshold=HT2_TH_2009[i];
432  if (layer==3) threshold=HT3_TH_2009[i];
433  }
434  }
435  }
436 
437  return threshold;
438 
439 }