00001 #include "StBemcTriggerDbThresholds.h"
00002
00003
00004 #include <StMessMgr.h>
00005 #include "TDatime.h"
00006
00007 #include "St_db_Maker/St_db_Maker.h"
00008
00009
00010 ClassImp(StBemcTriggerDbThresholds);
00011
00012
00013
00014 StBemcTriggerDbThresholds::StBemcTriggerDbThresholds() {
00015
00016 LOG_INFO<<"StBemcTriggerDbThresholds::constructor"<<endm;
00017
00018 }
00019
00020
00021 StBemcTriggerDbThresholds::~StBemcTriggerDbThresholds(){
00022
00023 LOG_INFO<<"StBemcTriggerDbThresholds::deconstructor"<<endl;
00024
00025 }
00026
00027
00028
00029 void StBemcTriggerDbThresholds::LoadTimeStamps(){
00030
00031
00032
00033
00034
00035
00036 start_2006[0].Set(2006,04,07,04,43,21);
00037 end_2006[0].Set(2006,04,11,17,21,19);
00038
00039 start_2006[1].Set(2006,4,12,1,31,30);
00040 end_2006[1].Set(2006,5,9,21,16,17);
00041
00042 start_2006[2].Set(2006,5,12,3,59,6);
00043 end_2006[2].Set(2006,5,12,9,16,32);
00044
00045 start_2006[3].Set(2006,5,12,20,44,24);
00046 end_2006[3].Set(2006,5,13,21,50,13);
00047
00048 start_2006[4].Set(2006,5,13,21,52,39);
00049 end_2006[4].Set(2006,5,15,16,47,13);
00050
00051 start_2006[5].Set(2006,5,16,2,38,45);
00052 end_2006[5].Set(2006,6,5,15,49,27);
00053
00054
00055
00056
00057
00058
00059 start_2007[0].Set(2007,4,4,5,38,44);
00060 end_2007[0].Set(2007,4,12,9,13,27);
00061
00062
00063
00064 start_2007[1].Set(2007,4,8,3,25,59);
00065 end_2007[1].Set(2007,4,15,8,23,10);
00066
00067
00068
00069
00070
00071
00072 start_2007[2].Set(2007,4,13,20,9,29);
00073 end_2007[2].Set(2007,4,23,17,24,23);
00074
00075
00076
00077
00078
00079 start_2007[3].Set(2007,4,19,5,1,48);
00080 end_2007[3].Set(2007,6,26,12,57,41);
00081
00082
00083
00084
00085
00086 start_2008[0].Set(2007,12,6,12,39,10);
00087 end_2008[0].Set(2007,12,10,2,42,55);
00088
00089
00090
00091 start_2008[1].Set(2007,12,10,19,42,27);
00092 end_2008[1].Set(2008,1,28,0,56,7);
00093
00094
00095
00096
00097
00098 start_2008[2].Set(2008,2,14,7,3,42);
00099 end_2008[2].Set(2008,3,10,11,1,55);
00100
00101
00102 start_2009[0].Set(2009,2,17,0,0,0);
00103 end_2009[0].Set(2009,4,15,0,0,0);
00104
00105
00106 start_2009[1].Set(2009,4,15,0,0,1);
00107 end_2009[1].Set(2009,5,15,0,0,0);
00108
00109
00110 }
00111
00112
00113
00114 Int_t StBemcTriggerDbThresholds::GetHtFEEbitOffset(int year){
00115
00116 LOG_INFO <<"StBemcTriggerDbThresholds::GetHtFEEbitOffset()"<<endm;
00117
00118 int bitOffset=2;
00119
00120 (year>2005) ? bitOffset=2 : bitOffset=3;
00121
00122 return bitOffset;
00123
00124 }
00125
00126
00127
00128
00129
00130 Int_t StBemcTriggerDbThresholds::GetTP_DSM0_threshold(Int_t DSMmodule, UInt_t timestamp, Int_t layer){
00131
00132 Int_t threshold=-1;
00133
00134
00135 const Int_t TP0_TH_2006[6] = { 1, 1, 1, 1, 1, 1};
00136 const Int_t TP1_TH_2006[6] = { 17, 17, 20, 20, 19, 19};
00137 const Int_t TP2_TH_2006[6] = { 31, 31, 31, 31, 31, 31};
00138 for (int i=0; i<6;i++)
00139 {
00140 if (DSMmodule<15)
00141 {
00142 if ((timestamp>=start_2006[i].Get())&&(timestamp<=end_2006[i].Get()))
00143 {
00144 if (layer==0) threshold=TP0_TH_2006[i];
00145 if (layer==1) threshold=TP1_TH_2006[i];
00146 if (layer==2) threshold=TP2_TH_2006[i];
00147 }
00148 }
00149
00150 if (DSMmodule>=15)
00151 {
00152 if ((timestamp>=start_2006[i].Get())&&(timestamp<=end_2006[i].Get()))
00153 {
00154
00155 if (layer==0) threshold=TP0_TH_2006[i];
00156 if (layer==1) threshold=TP1_TH_2006[i];
00157 if (layer==2) threshold=TP2_TH_2006[i];
00158 }
00159 }
00160 }
00161
00162
00163
00164
00165
00166 const Int_t TP0_TH_2008[6] = { 24, 24, 24, 24, 24, 24};
00167 for (int i=0; i<6;i++)
00168 {
00169 if (DSMmodule<15)
00170 {
00171 if ((timestamp>=start_2008[i].Get())&&(timestamp<=end_2008[i].Get()))
00172 {
00173 if (layer==0) threshold=TP0_TH_2008[i];
00174 }
00175 }
00176
00177 if (DSMmodule>=15)
00178 {
00179 if ((timestamp>=start_2008[i].Get())&&(timestamp<=end_2008[i].Get()))
00180 {
00181 if (layer==0) threshold=TP0_TH_2008[i];
00182 }
00183 }
00184 }
00185
00186 return threshold;
00187 }
00188
00189
00190
00191 Int_t StBemcTriggerDbThresholds::GetJP_DSM1_threshold(Int_t DSMmodule,UInt_t timestamp, Int_t layer){
00192
00193 Int_t threshold=-1;
00194
00195
00196 const Int_t JP0_TH_2006[6] = { 42, 42, 48, 49, 49, 49};
00197 const Int_t JP1_TH_2006[6] = { 58, 58, 58, 60, 60, 60};
00198 const Int_t JP2_TH_2006[6] = {110,110,110,110,110,110};
00199 for (int i=0;i<6;i++)
00200 {
00201 if (DSMmodule<15)
00202 {
00203 if ((timestamp>=start_2006[i].Get())&&(timestamp<=end_2006[i].Get()))
00204 {
00205 if (layer==0) threshold=JP0_TH_2006[i];
00206 if (layer==1) threshold=JP1_TH_2006[i];
00207 if (layer==2) threshold=JP2_TH_2006[i];
00208 }
00209 }
00210
00211
00212 if (DSMmodule>=15)
00213 {
00214 if ((timestamp>=start_2006[i].Get())&&(timestamp<=end_2006[i].Get()))
00215 {
00216 if (layer==0) threshold=JP0_TH_2006[i];
00217 if (layer==1) threshold=JP1_TH_2006[i];
00218 if (layer==2) threshold=JP2_TH_2006[i];
00219 }
00220 }
00221 }
00222
00223
00224
00225
00226 const Int_t JP0_TH_2008[6] = { 50, 50, 50, 50, 50, 50};
00227 const Int_t JP1_TH_2008[6] = { 87, 87, 87, 87, 87, 87};
00228 const Int_t JP2_TH_2008[6] = {100,100,100,100,100,100};
00229 for (int i=0;i<6;i++)
00230 {
00231 if (DSMmodule<15)
00232 {
00233 if ((timestamp>=start_2008[i].Get())&&(timestamp<=end_2008[i].Get()))
00234 {
00235 if (layer==0) threshold=JP0_TH_2008[i];
00236 if (layer==1) threshold=JP1_TH_2008[i];
00237 if (layer==2) threshold=JP2_TH_2008[i];
00238 }
00239 }
00240
00241
00242 if (DSMmodule>=15)
00243 {
00244 if ((timestamp>=start_2008[i].Get())&&(timestamp<=end_2008[i].Get()))
00245 {
00246 if (layer==0) threshold=JP0_TH_2008[i];
00247 if (layer==1) threshold=JP1_TH_2008[i];
00248 if (layer==2) threshold=JP2_TH_2008[i];
00249 }
00250 }
00251 }
00252
00253
00254
00255
00256
00257
00258 const Int_t JP0_TH_2009[2] = { 28, 20};
00259 const Int_t JP1_TH_2009[2] = { 35, 28};
00260 const Int_t JP2_TH_2009[2] = { 52, 35};
00261 for (int i=0;i<2;i++)
00262 {
00263 if (DSMmodule<15)
00264 {
00265 if ((timestamp>=start_2009[i].Get())&&(timestamp<=end_2009[i].Get()))
00266 {
00267 if (layer==0) threshold=JP0_TH_2009[i];
00268 if (layer==1) threshold=JP1_TH_2009[i];
00269 if (layer==2) threshold=JP2_TH_2009[i];
00270 }
00271 }
00272
00273
00274 if (DSMmodule>=15)
00275 {
00276 if ((timestamp>=start_2009[i].Get())&&(timestamp<=end_2009[i].Get()))
00277 {
00278 if (layer==0) threshold=JP0_TH_2009[i];
00279 if (layer==1) threshold=JP1_TH_2009[i];
00280 if (layer==2) threshold=JP2_TH_2009[i];
00281 }
00282 }
00283 }
00284
00285
00286 return threshold;
00287 }
00288
00289
00290
00291 Int_t StBemcTriggerDbThresholds::GetHT_DSM0_threshold(Int_t DSMmodule, UInt_t timestamp, Int_t layer){
00292
00293 int threshold=-1;
00294
00295
00296 const Int_t HTW0_TH_2006[6] = { 5, 5, 5, 5, 5, 5};
00297 const Int_t HTW1_TH_2006[6] = { 12, 12, 16, 18, 16, 16};
00298 const Int_t HTW2_TH_2006[6] = { 22, 24, 24, 24, 24, 24};
00299 const Int_t HTE0_TH_2006[6] = { 11, 11, 5, 5, 5, 5};
00300 const Int_t HTE1_TH_2006[6] = { 12, 12, 16, 18, 16, 16};
00301 const Int_t HTE2_TH_2006[6] = { 24, 24, 24, 24, 24, 24};
00302 for (int i=0;i<6;i++){
00303
00304 if (DSMmodule<15)
00305 {
00306 if ((timestamp>=start_2006[i].Get())&&(timestamp<=end_2006[i].Get()))
00307 {
00308 if (layer==0) threshold=HTW0_TH_2006[i];
00309 if (layer==1) threshold=HTW1_TH_2006[i];
00310 if (layer==2) threshold=HTW2_TH_2006[i];
00311 }
00312 }
00313
00314
00315 if (DSMmodule>=15)
00316 {
00317 if ((timestamp>=start_2006[i].Get())&&(timestamp<=end_2006[i].Get()))
00318 {
00319 if (layer==0) threshold=HTE0_TH_2006[i];
00320 if (layer==1) threshold=HTE1_TH_2006[i];
00321 if (layer==2) threshold=HTE2_TH_2006[i];
00322 }
00323 }
00324 }
00325
00326
00327
00328 const Int_t HTW0_TH_2007[4] = { 6, 4, 3, 3};
00329 const Int_t HTW1_TH_2007[4] = { 18, 18, 18, 18};
00330 const Int_t HTW2_TH_2007[4] = { 24, 24, 24, 23};
00331 const Int_t HTE0_TH_2007[4] = { 6, 4, 3, 3};
00332 const Int_t HTE1_TH_2007[4] = { 18, 18, 18, 18};
00333 const Int_t HTE2_TH_2007[4] = { 24, 24, 24, 23};
00334 for (int i=0;i<4;i++){
00335
00336 if (DSMmodule<15)
00337 {
00338 if ((timestamp>=start_2007[i].Get())&&(timestamp<=end_2007[i].Get()))
00339 {
00340 if (layer==0) threshold=HTW0_TH_2007[i];
00341 if (layer==1) threshold=HTW1_TH_2007[i];
00342 if (layer==2) threshold=HTW2_TH_2007[i];
00343 }
00344 }
00345
00346
00347 if (DSMmodule>=15)
00348 {
00349 if ((timestamp>=start_2007[i].Get())&&(timestamp<=end_2007[i].Get()))
00350 {
00351 if (layer==0) threshold=HTE0_TH_2007[i];
00352 if (layer==1) threshold=HTE1_TH_2007[i];
00353 if (layer==2) threshold=HTE2_TH_2007[i];
00354 }
00355 }
00356 }
00357
00358
00359
00360 const Int_t HTW0_TH_2008[6] = { 11, 11, 11};
00361 const Int_t HTW1_TH_2008[6] = { 15, 15, 15};
00362 const Int_t HTW2_TH_2008[6] = { 18, 18, 18};
00363 const Int_t HTW3_TH_2008[6] = { 35, 35, 16};
00364 const Int_t HTW4_TH_2008[6] = { 35, 35, 63};
00365
00366 const Int_t HTE0_TH_2008[6] = { 11, 11, 11};
00367 const Int_t HTE1_TH_2008[6] = { 15, 15, 15};
00368 const Int_t HTE2_TH_2008[6] = { 18, 18, 18};
00369 const Int_t HTE3_TH_2008[6] = { 35, 35, 16};
00370 const Int_t HTE4_TH_2008[6] = { 35, 35, 63};
00371
00372 for (int i=0;i<3;i++){
00373
00374 if (DSMmodule<15)
00375 {
00376 if ((timestamp>=start_2008[i].Get())&&(timestamp<=end_2008[i].Get()))
00377 {
00378 if (layer==0) threshold=HTW0_TH_2008[i];
00379 if (layer==1) threshold=HTW1_TH_2008[i];
00380 if (layer==2) threshold=HTW2_TH_2008[i];
00381 if (layer==3) threshold=HTW3_TH_2008[i];
00382 if (layer==4) threshold=HTW4_TH_2008[i];
00383 }
00384
00385 }
00386
00387
00388 if (DSMmodule>=15)
00389 {
00390 if ((timestamp>=start_2008[i].Get())&&(timestamp<=end_2008[i].Get()))
00391 {
00392 if (layer==0) threshold=HTE0_TH_2008[i];
00393 if (layer==1) threshold=HTE1_TH_2008[i];
00394 if (layer==2) threshold=HTE2_TH_2008[i];
00395 if (layer==3) threshold=HTE3_TH_2008[i];
00396 if (layer==4) threshold=HTE4_TH_2008[i];
00397 }
00398 }
00399 }
00400
00401
00402
00403
00404
00405 const Int_t HT0_TH_2009[2] = { 11, 11};
00406 const Int_t HT1_TH_2009[2] = { 15, 15};
00407 const Int_t HT2_TH_2009[2] = { 19, 17};
00408 const Int_t HT3_TH_2009[2] = { 25, 23};
00409
00410 for (int i=0;i<2;i++){
00411
00412 if (DSMmodule<15)
00413 {
00414 if ((timestamp>=start_2009[i].Get())&&(timestamp<=end_2009[i].Get()))
00415 {
00416 if (layer==0) threshold=HT0_TH_2009[i];
00417 if (layer==1) threshold=HT1_TH_2009[i];
00418 if (layer==2) threshold=HT2_TH_2009[i];
00419 if (layer==3) threshold=HT3_TH_2009[i];
00420 }
00421
00422 }
00423
00424
00425 if (DSMmodule>=15)
00426 {
00427 if ((timestamp>=start_2009[i].Get())&&(timestamp<=end_2009[i].Get()))
00428 {
00429 if (layer==0) threshold=HT0_TH_2009[i];
00430 if (layer==1) threshold=HT1_TH_2009[i];
00431 if (layer==2) threshold=HT2_TH_2009[i];
00432 if (layer==3) threshold=HT3_TH_2009[i];
00433 }
00434 }
00435 }
00436
00437 return threshold;
00438
00439 }