00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "StBemcTables.h"
00010 #include "Stiostream.h"
00011 #include "StEmcUtil/others/emcDetectorName.h"
00012 #include "StDaqLib/EMC/StEmcDecoder.h"
00013 #include "StMaker.h"
00014 #include "St_db_Maker/St_db_Maker.h"
00015 #include "StEmcRawMaker/defines.h"
00016
00017 ClassImp(StBemcTables)
00018
00019 StBemcTables::StBemcTables(Bool_t btowMapFix, Bool_t bprsMapFix):TObject() {
00020 mBtowP = NULL;
00021 mBprsP = NULL;
00022 mSmdeP = NULL;
00023 mSmdpP = NULL;
00024 mBtowS = NULL;
00025 mBprsS = NULL;
00026 mSmdeS = NULL;
00027 mSmdpS = NULL;
00028 mBtowC = NULL;
00029 mBprsC = NULL;
00030 mSmdeC = NULL;
00031 mSmdpC = NULL;
00032 mBtowG = NULL;
00033 mBprsG = NULL;
00034 mSmdeG = NULL;
00035 mSmdpG = NULL;
00036 mTrigS = NULL;
00037 mTrigP = NULL;
00038 mTrigL = NULL;
00039
00040 mBtowMapFix = btowMapFix;
00041 mBprsMapFix = bprsMapFix;
00042 mDecoder = new StEmcDecoder();
00043 }
00044
00045 StBemcTables::~StBemcTables() {
00046 delete mBtowP;
00047 delete mBprsP;
00048 delete mSmdeP;
00049 delete mSmdpP;
00050 delete mBtowS;
00051 delete mBprsS;
00052 delete mSmdeS;
00053 delete mSmdpS;
00054 delete mBtowC;
00055 delete mBprsC;
00056 delete mSmdeC;
00057 delete mSmdpC;
00058 delete mBtowG;
00059 delete mBprsG;
00060 delete mSmdeG;
00061 delete mSmdpG;
00062 delete mTrigS;
00063 delete mTrigP;
00064 delete mTrigL;
00065
00066 if(mDecoder) delete mDecoder;
00067 }
00068
00069
00070
00071 void StBemcTables::loadTables(StMaker* maker) {
00072 if(mBtowP) mBtowP = NULL;
00073 if(mBtowS) mBtowS = NULL;
00074 if(mBtowC) mBtowC = NULL;
00075 if(mBtowG) mBtowG = NULL;
00076
00077 if(mBprsP) mBprsP = NULL;
00078 if(mBprsS) mBprsS = NULL;
00079 if(mBprsC) mBprsC = NULL;
00080 if(mBprsG) mBprsG = NULL;
00081
00082 if(mSmdeP) mSmdeP = NULL;
00083 if(mSmdeS) mSmdeS = NULL;
00084 if(mSmdeC) mSmdeC = NULL;
00085 if(mSmdeG) mSmdeG = NULL;
00086
00087 if(mSmdpP) mSmdpP = NULL;
00088 if(mSmdpS) mSmdpS = NULL;
00089 if(mSmdpC) mSmdpC = NULL;
00090 if(mSmdpG) mSmdpG = NULL;
00091
00092 int date = (maker->GetDBTime()).GetDate();
00093 int time = (maker->GetDBTime()).GetTime();
00094 mDecoder->SetDateTime(date, time);
00095
00096
00097
00098 if(date >= 20060101) mBtowMapFix = kFALSE;
00099
00100
00101 if(date >= 20080101) mBprsMapFix = kFALSE;
00102
00103 TDataSet * DB = NULL;
00104
00105 DB = maker->GetInputDB("Calibrations/emc/y3bemc");
00106 if(DB) {
00107 St_emcPed* bemcPed = (St_emcPed*)DB->Find("bemcPed");
00108 if(bemcPed) {
00109 mBtowP = bemcPed->GetTable();
00110 updateValidity(maker, bemcPed);
00111 }
00112
00113 St_emcStatus* bemcStatus = (St_emcStatus*)DB->Find("bemcStatus");
00114 if(bemcStatus) {
00115 mBtowS = bemcStatus->GetTable();
00116 updateValidity(maker, bemcStatus);
00117 }
00118
00119 St_emcCalib* bemcCalib = (St_emcCalib*)DB->Find("bemcCalib");
00120 if(bemcCalib) {
00121 mBtowC = bemcCalib->GetTable();
00122 updateValidity(maker, bemcCalib);
00123 }
00124
00125 St_emcGain* bemcGain = (St_emcGain*)DB->Find("bemcGain");
00126 if(bemcGain) {
00127 mBtowG = bemcGain->GetTable();
00128 updateValidity(maker, bemcGain);
00129 }
00130 }
00131
00132 DB = maker->GetInputDB("Calibrations/emc/y3bprs");
00133 if(DB) {
00134 St_emcPed* bprsPed = (St_emcPed*)DB->Find("bprsPed");
00135 if(bprsPed) {
00136 mBprsP = bprsPed->GetTable();
00137 updateValidity(maker, bprsPed);
00138 }
00139
00140 St_emcStatus* bprsStatus = (St_emcStatus*)DB->Find("bprsStatus");
00141 if(bprsStatus) {
00142 mBprsS = bprsStatus->GetTable();
00143 updateValidity(maker, bprsStatus);
00144 }
00145
00146 St_emcCalib* bprsCalib = (St_emcCalib*)DB->Find("bprsCalib");
00147 if(bprsCalib) {
00148 mBprsC = bprsCalib->GetTable();
00149 updateValidity(maker, bprsCalib);
00150 }
00151
00152 St_emcGain* bprsGain = (St_emcGain*)DB->Find("bprsGain");
00153 if(bprsGain) {
00154 mBprsG = bprsGain->GetTable();
00155 updateValidity(maker, bprsGain);
00156 }
00157 }
00158
00159 DB = maker->GetInputDB("Calibrations/emc/y3bsmde");
00160 if(DB) {
00161 St_smdPed* bsmdePed = (St_smdPed*)DB->Find("bsmdePed");
00162 if(bsmdePed) {
00163 mSmdeP = bsmdePed->GetTable();
00164 updateValidity(maker, bsmdePed);
00165 }
00166
00167 St_smdStatus* bsmdeStatus = (St_smdStatus*)DB->Find("bsmdeStatus");
00168 if(bsmdeStatus) {
00169 mSmdeS = bsmdeStatus->GetTable();
00170 updateValidity(maker, bsmdeStatus);
00171 }
00172
00173 St_smdCalib* bsmdeCalib = (St_smdCalib*)DB->Find("bsmdeCalib");
00174 if(bsmdeCalib) {
00175 mSmdeC = bsmdeCalib->GetTable();
00176 updateValidity(maker, bsmdeCalib);
00177 }
00178
00179 St_smdGain* bsmdeGain = (St_smdGain*)DB->Find("bsmdeGain");
00180 if(bsmdeGain) {
00181 mSmdeG = bsmdeGain->GetTable();
00182 updateValidity(maker, bsmdeGain);
00183 }
00184 }
00185
00186 DB = maker->GetInputDB("Calibrations/emc/y3bsmdp");
00187 if(DB) {
00188 St_smdPed* bsmdpPed = (St_smdPed*)DB->Find("bsmdpPed");
00189 if(bsmdpPed) {
00190 mSmdpP = bsmdpPed->GetTable();
00191 updateValidity(maker, bsmdpPed);
00192 }
00193
00194 St_smdStatus* bsmdpStatus = (St_smdStatus*)DB->Find("bsmdpStatus");
00195 if(bsmdpStatus) {
00196 mSmdpS = bsmdpStatus->GetTable();
00197 updateValidity(maker, bsmdpStatus);
00198 }
00199
00200 St_smdCalib* bsmdpCalib = (St_smdCalib*)DB->Find("bsmdpCalib");
00201 if(bsmdpCalib) {
00202 mSmdpC = bsmdpCalib->GetTable();
00203 updateValidity(maker, bsmdpCalib);
00204 }
00205
00206 St_smdGain* bsmdpGain = (St_smdGain*)DB->Find("bsmdpGain");
00207 if(bsmdpGain) {
00208 mSmdpG = bsmdpGain->GetTable();
00209 updateValidity(maker, bsmdpGain);
00210 }
00211 }
00212
00213 DB = maker->GetInputDB("Calibrations/emc/trigger");
00214 if(DB) {
00215 St_emcTriggerStatus* bemcTriggerStatus = (St_emcTriggerStatus*)DB->Find("bemcTriggerStatus");
00216 if(bemcTriggerStatus) {
00217 mTrigS = bemcTriggerStatus->GetTable();
00218 updateValidity(maker, bemcTriggerStatus);
00219 }
00220
00221 St_emcTriggerPed* bemcTriggerPed = (St_emcTriggerPed*)DB->Find("bemcTriggerPed");
00222 if(bemcTriggerPed) {
00223 mTrigP = bemcTriggerPed->GetTable();
00224 updateValidity(maker, bemcTriggerPed);
00225 }
00226
00227 St_emcTriggerLUT* bemcTriggerLUT = (St_emcTriggerLUT*)DB->Find("bemcTriggerLUT");
00228 if(bemcTriggerLUT) {
00229 mTrigL = bemcTriggerLUT->GetTable();
00230 updateValidity(maker, bemcTriggerLUT);
00231 }
00232 }
00233 }
00234
00235 void StBemcTables::updateValidity(StMaker* maker, TTable* table) {
00236 TDatime datime[2];
00237 St_db_Maker::GetValidity(table,datime);
00238 string tableName = table->GetName();
00239 string beginTime = datime[0].AsSQLString();
00240 string endTime = datime[1].AsSQLString();
00241
00242 map<string, pair<string, string> >::iterator iter = mValidRanges.find(tableName);
00243 if(iter == mValidRanges.end()) {
00244 mValidRanges[tableName] = make_pair(beginTime, endTime);
00245 LOG_INFO << Form("loaded a new %20s table with beginTime %s and endTime %s", tableName.c_str(), beginTime.c_str(), endTime.c_str()) << endm;
00246 }
00247 else if( beginTime != (iter->second).first ) {
00248 (iter->second).first = beginTime;
00249 (iter->second).second = endTime;
00250 LOG_INFO << Form("loaded a new %20s table with beginTime %s and endTime %s", tableName.c_str(), beginTime.c_str(), endTime.c_str()) << endm;
00251 }
00252 }
00253
00254 const char* StBemcTables::beginTime(const char * tableName) const {
00255 string t = tableName;
00256 map<string, pair<string, string> >::const_iterator iter = mValidRanges.find(t);
00257 if(iter == mValidRanges.end()) {
00258 LOG_WARN << "Couldn't find a table named " << tableName << endm;
00259 return NULL;
00260 }
00261 else {
00262 return (iter->second).first.c_str();
00263 }
00264 }
00265
00266 const char* StBemcTables::endTime(const char * tableName) const {
00267 string t = tableName;
00268 map<string, pair<string, string> >::const_iterator iter = mValidRanges.find(t);
00269 if(iter == mValidRanges.end()) {
00270 LOG_WARN << "Couldn't find a table named " << tableName << endm;
00271 return NULL;
00272 }
00273 else {
00274 return (iter->second).second.c_str();
00275 }
00276 }
00277
00278
00279
00280 Int_t StBemcTables::getOldId(int det, Int_t newId) const {
00281 Int_t shift = 0;
00282 if(det == BTOW) {
00283 mDecoder->GetTowerBugCorrectionShift(newId, shift);
00284 }
00285 if(det == BPRS) {
00286 mDecoder->GetPreshowerBugCorrectionShift(newId, shift);
00287 }
00288 return newId + shift;
00289 }
00290
00291
00292
00293 void StBemcTables::getPedestal(Int_t det, Int_t id, Int_t CAP,Float_t& P, Float_t& R) const {
00294 P = 0;
00295 R = 0;
00296 if(det==BTOW && mBtowP)
00297 {
00298 Int_t id1 = id;
00299 if(mBtowMapFix) id1 = getOldId(BTOW, id);
00300 P = ((Float_t)mBtowP[0].AdcPedestal[id1-1])/100;
00301 R = ((Float_t)mBtowP[0].AdcPedestalRMS[id1-1])/100;
00302 return;
00303 }
00304 if(det==BPRS && mBprsP)
00305 {
00306 Int_t id1 = id;
00307 if(mBprsMapFix) id1 = getOldId(BPRS, id);
00308 P = ((Float_t)mBprsP[0].AdcPedestal[id1-1])/100;
00309 R = ((Float_t)mBprsP[0].AdcPedestalRMS[id1-1])/100;
00310 return;
00311 }
00312 if(det==BSMDE && mSmdeP)
00313 {
00314 Int_t C = 0;
00315 if(CAP==CAP1) C = 1;
00316 if(CAP==CAP2) C = 2;
00317 P = ((Float_t)mSmdeP[0].AdcPedestal[id-1][C])/100;
00318 R = ((Float_t)mSmdeP[0].AdcPedestalRMS[id-1][C])/100;
00319 return;
00320 }
00321 if(det==BSMDP && mSmdpP)
00322 {
00323 Int_t C = 0;
00324 if(CAP==CAP1) C = 1;
00325 if(CAP==CAP2) C = 2;
00326 P = ((Float_t)mSmdpP[0].AdcPedestal[id-1][C])/100;
00327 R = ((Float_t)mSmdpP[0].AdcPedestalRMS[id-1][C])/100;
00328 return;
00329 }
00330 return;
00331 }
00332
00333 void StBemcTables::getStatus(Int_t det, Int_t id, Int_t& S, const char *option) const {
00334 S = STATUS_OK;
00335 if(det==BTOW && mBtowS)
00336 {
00337 Int_t id1 = id;
00338 if(mBtowMapFix) id1 = getOldId(BTOW, id);
00339 if(!strcmp(option, "calib")) { S = (Int_t)mBtowC[0].Status[id1-1]; return; }
00340 if(!strcmp(option, "pedestal")) { S = (Int_t)mBtowP[0].Status[id1-1]; return; }
00341 if(!strcmp(option, "gain")) { S = (Int_t)mBtowG[0].Status[id1-1]; return; }
00342 S = (Int_t)mBtowS[0].Status[id1-1];
00343 return;
00344 }
00345 if(det==BPRS && mBprsS) {
00346 Int_t id1 = id;
00347 if(mBprsMapFix) id1 = getOldId(BPRS, id);
00348 if(!strcmp(option, "calib")) { S = (Int_t)mBprsC[0].Status[id1-1]; return; }
00349 if(!strcmp(option, "pedestal")) { S = (Int_t)mBprsP[0].Status[id1-1]; return; }
00350 if(!strcmp(option, "gain")) { S = (Int_t)mBprsG[0].Status[id1-1]; return; }
00351 S = (Int_t)mBprsS[0].Status[id1-1];return;
00352 }
00353 if(det==BSMDE && mSmdeS) {
00354 if(!strcmp(option, "calib")) { S = (Int_t)mSmdeC[0].Status[id-1]; return; }
00355 if(!strcmp(option, "pedestal")) { S = (Int_t)mSmdeP[0].Status[id-1]; return; }
00356 if(!strcmp(option, "gain")) { S = (Int_t)mSmdeG[0].Status[id-1]; return; }
00357 S = (Int_t)mSmdeS[0].Status[id-1];return;
00358 }
00359 if(det==BSMDP && mSmdpS) {
00360 if(!strcmp(option, "calib")) { S = (Int_t)mSmdpC[0].Status[id-1]; return; }
00361 if(!strcmp(option, "pedestal")) { S = (Int_t)mSmdpP[0].Status[id-1]; return; }
00362 if(!strcmp(option, "gain")) { S = (Int_t)mSmdpG[0].Status[id-1]; return; }
00363 S = (Int_t)mSmdpS[0].Status[id-1];return;
00364 }
00365 return;
00366 }
00367
00368 void StBemcTables::getGain(Int_t det, Int_t id, Float_t& G) const {
00369 G = 1;
00370 if(det==BTOW && mBtowG)
00371 {
00372 Int_t id1 = id;
00373 if(mBtowMapFix) id1 = getOldId(BTOW, id);
00374 G = (Float_t)mBtowG[0].Gain[id1-1];
00375 return;
00376 }
00377 if(det==BPRS && mBprsG) {
00378 Int_t id1 = id;
00379 if(mBprsMapFix) id1 = getOldId(BPRS, id);
00380 G = (Float_t)mBprsG[0].Gain[id1-1];return;
00381 }
00382 if(det==BSMDE && mSmdeG) { G = (Float_t)mSmdeG[0].Gain[id-1];return;}
00383 if(det==BSMDP && mSmdpG) { G = (Float_t)mSmdpG[0].Gain[id-1];return;}
00384 return;
00385 }
00386
00387 void StBemcTables::getCalib(Int_t det, Int_t id, Int_t power, Float_t& C) const {
00388 C = 0;
00389 if(det==BTOW && mBtowC)
00390 {
00391 Int_t id1 = id;
00392 if(mBtowMapFix) id1 = getOldId(BTOW, id);
00393 C = (Float_t)mBtowC[0].AdcToE[id1-1][power];
00394 return;
00395 }
00396 if(det==BPRS && mBprsC) {
00397 Int_t id1 = id;
00398 if(mBprsMapFix) id1 = getOldId(BPRS, id);
00399 C = (Float_t)mBprsC[0].AdcToE[id1-1][power];return;
00400 }
00401 if(det==BSMDE && mSmdeC) { C = (Float_t)mSmdeC[0].AdcToE[id-1][power];return;}
00402 if(det==BSMDP && mSmdpC) { C = (Float_t)mSmdpC[0].AdcToE[id-1][power];return;}
00403 return;
00404 }
00405
00406
00407
00408 void StBemcTables::getTriggerPatchStatus(Int_t patch, Int_t& STATUS) const {
00409 STATUS = 0;
00410 if(mTrigS && patch>=0 && patch<NBEMCTRIGGERTOWER)
00411 STATUS = (Int_t)mTrigS[0].PatchStatus[patch];
00412 }
00413
00414 void StBemcTables::getTriggerHighTowerStatus(Int_t hightower, Int_t& STATUS) const {
00415 STATUS = 0;
00416 if(mTrigS && hightower>=0 && hightower<NBEMCTRIGGERTOWER)
00417 STATUS = (Int_t)mTrigS[0].HighTowerStatus[hightower];
00418 }
00419
00420 void StBemcTables::getTriggerTowerStatus(Int_t crate,Int_t index, Int_t& STATUS) const {
00421 STATUS = 0;
00422 if(mTrigS && crate>0 && crate<=MAXCRATES && index>=0 && index<NTOWERSPERCRATE)
00423 STATUS = (Int_t)mTrigS[0].TowerStatus[crate-1][index];
00424 }
00425
00426 void StBemcTables::getTriggerPedestal(Int_t crate,Int_t index, Float_t& PEDESTAL) const {
00427 PEDESTAL = 0;
00428 if(mTrigP && crate>0 && crate<=MAXCRATES && index>=0 && index<NTOWERSPERCRATE)
00429 PEDESTAL = ((Float_t)mTrigP[0].Ped[crate-1][index])/100.0;
00430 }
00431
00432 void StBemcTables::getTriggerBitConv(Int_t crate,Int_t patch, Int_t& BIT) const {
00433 BIT = 0;
00434 if(mTrigP && crate>0 && crate<=MAXCRATES && patch>=0 && patch<NPATCHESPERCRATE) {
00435 BIT = (Int_t)mTrigP[0].BitConversionMode[crate-1][patch];
00436 }
00437 }
00438
00439 void StBemcTables::getTriggerPedestalShift(Int_t& pedestalShift) const {
00440 if (mTrigP) pedestalShift = (Int_t)mTrigP->PedShift / 100;
00441 }
00442
00443 void StBemcTables::getTriggerFormulaTag(Int_t crate, Int_t index, Int_t& formula) const {
00444 if (mTrigL) formula = (Int_t)mTrigL->FormulaTag[crate-1][index];
00445 }
00446
00447 void StBemcTables::getTriggerFormulaParameters(Int_t crate, Int_t index, Int_t* parameters) const {
00448 if (mTrigL) {
00449 parameters[0] = (Int_t)mTrigL->FormulaParameter0[crate-1][index];
00450 parameters[1] = (Int_t)mTrigL->FormulaParameter1[crate-1][index];
00451 parameters[2] = (Int_t)mTrigL->FormulaParameter2[crate-1][index];
00452 parameters[3] = (Int_t)mTrigL->FormulaParameter3[crate-1][index];
00453 parameters[4] = (Int_t)mTrigL->FormulaParameter4[crate-1][index];
00454 parameters[5] = (Int_t)mTrigL->FormulaParameter5[crate-1][index];
00455 }
00456 }
00457
00458
00459
00460 float StBemcTables::calib(int det, int softId, int power) const {
00461 float val;
00462 getCalib(det, softId, power, val);
00463 return val;
00464 }
00465
00466 float StBemcTables::pedestal(int det, int softId, int cap) const {
00467 float val, junk;
00468 getPedestal(det, softId, cap, val, junk);
00469 return val;
00470 }
00471
00472 float StBemcTables::pedestalRMS(int det, int softId, int cap) const {
00473 float val, junk;
00474 getPedestal(det, softId, cap, junk, val);
00475 return val;
00476 }
00477
00478 float StBemcTables::gain(int det, int softId) const {
00479 float val;
00480 getGain(det, softId, val);
00481 return val;
00482 }
00483
00484 int StBemcTables::status(int det, int softId, const char *option) const {
00485 int val;
00486 getStatus(det, softId, val, option);
00487 return val;
00488 }
00489
00490
00491
00492 int StBemcTables::triggerPatchStatus(int triggerPatchId) const {
00493 int val;
00494 getTriggerPatchStatus(triggerPatchId,val);
00495 return val;
00496 }
00497
00498 int StBemcTables::triggerHighTowerStatus(int triggerPatchId) const {
00499 int val;
00500 getTriggerHighTowerStatus(triggerPatchId,val);
00501 return val;
00502 }
00503
00504 int StBemcTables::triggerTowerStatus(int crate, int sequence) const {
00505 int val;
00506 getTriggerTowerStatus(crate,sequence,val);
00507 return val;
00508 }
00509
00510 float StBemcTables::triggerPedestal(int crate, int sequence) const {
00511 float val;
00512 getTriggerPedestal(crate,sequence,val);
00513 return val;
00514 }
00515
00516 int StBemcTables::triggerBitConversion(int crate, int patchSequence) const {
00517 int val;
00518 getTriggerBitConv(crate,patchSequence,val);
00519 return val;
00520 }
00521
00522 int StBemcTables::triggerPedestalShift() const {
00523 int val;
00524 getTriggerPedestalShift(val);
00525 return val;
00526 }
00527
00528 int StBemcTables::triggerFormulaTag(int crate, int patchSequence) const {
00529 int val;
00530 getTriggerFormulaTag(crate,patchSequence,val);
00531 return val;
00532 }
00533
00534 int* StBemcTables::triggerFormulaParameters(int crate, int patchSequence) const {
00535 int * params = new int[6];
00536 getTriggerFormulaParameters(crate,patchSequence,params);
00537 return params;
00538 }
00539
00540
00541
00542 int StBemcTables::triggerPatchStatusByID(int softId) const {
00543 int patchId;
00544 if(mDecoder->GetTriggerPatchFromTowerId(softId, patchId)) {
00545 return this->triggerPatchStatus(patchId);
00546 }
00547 LOG_ERROR << "Problem with StEmcDecoder::GetTriggerPatchFromTowerId for softId " << softId << endm;
00548 return -999;
00549 }
00550
00551 int StBemcTables::triggerHighTowerStatusByID(int softId) const {
00552 int patchId;
00553 if(mDecoder->GetTriggerPatchFromTowerId(softId, patchId)) {
00554 return this->triggerHighTowerStatus(patchId);
00555 }
00556 LOG_ERROR << "Problem with StEmcDecoder::GetTriggerPatchFromTowerId for softId " << softId << endm;
00557 return -999;
00558 }
00559
00560 int StBemcTables::triggerTowerStatusByID(int softId) const {
00561 int crate, sequence;
00562 if(mDecoder->GetCrateFromTowerId(softId, crate, sequence)) {
00563 return this->triggerTowerStatus(crate, sequence);
00564 }
00565 LOG_ERROR << "Problem with StEmcDecoder::GetCrateFromTowerId for softId " << softId << endm;
00566 return -999;
00567 }
00568
00569 float StBemcTables::triggerPedestalByID(int softId) const {
00570 int crate, sequence;
00571 if(mDecoder->GetCrateFromTowerId(softId, crate, sequence)) {
00572 return this->triggerPedestal(crate, sequence);
00573 }
00574 LOG_ERROR << "Problem with StEmcDecoder::GetCrateFromTowerId for softId " << softId << endm;
00575 return -999;
00576 }
00577
00578 int StBemcTables::triggerBitConversionByID(int softId) const {
00579 int patchId, crate, patchSequence;
00580 if(mDecoder->GetTriggerPatchFromTowerId(softId, patchId)) {
00581 if(mDecoder->GetCrateAndSequenceFromTriggerPatch(patchId, crate, patchSequence)) {
00582 if( (patchSequence%16 != 0) || (patchId%10 != patchSequence/16) ) {
00583 LOG_ERROR << "Please ask Adam what the heck is going on" << endm;
00584 }
00585 return this->triggerBitConversion(crate, patchSequence/16);
00586 }
00587 LOG_ERROR << "Problem with StEmcDecoder::GetCrateAndSequenceFromTriggerPatch for patchId " << patchId << endm;
00588 }
00589 LOG_ERROR << "Problem with StEmcDecoder::GetTriggerPatchFromTowerId for softId " << softId << endm;
00590 return -999;
00591 }
00592
00593 int StBemcTables::triggerFormulaTagByID(int softId) const {
00594 int patchId, crate, patchSequence;
00595 if(mDecoder->GetTriggerPatchFromTowerId(softId, patchId)) {
00596 if(mDecoder->GetCrateAndSequenceFromTriggerPatch(patchId, crate, patchSequence)) {
00597 if( (patchSequence%16 != 0) || (patchId%10 != patchSequence/16) ) {
00598 LOG_ERROR << "Please ask Adam what the heck is going on" << endm;
00599 }
00600 return this->triggerFormulaTag(crate, patchSequence/16);
00601 }
00602 LOG_ERROR << "Problem with StEmcDecoder::GetCrateAndSequenceFromTriggerPatch for patchId " << patchId << endm;
00603 }
00604 LOG_ERROR << "Problem with StEmcDecoder::GetTriggerPatchFromTowerId for softId " << softId << endm;
00605 return -999;
00606 }
00607
00608 int* StBemcTables::triggerFormulaParametersByID(int softId) const {
00609 int patchId, crate, patchSequence;
00610 if(mDecoder->GetTriggerPatchFromTowerId(softId, patchId)) {
00611 if(mDecoder->GetCrateAndSequenceFromTriggerPatch(patchId, crate, patchSequence)) {
00612 if( (patchSequence%16 != 0) || (patchId%10 != patchSequence/16) ) {
00613 LOG_ERROR << "Please ask Adam what the heck is going on" << endm;
00614 }
00615 return this->triggerFormulaParameters(crate, patchSequence/16);
00616 }
00617 LOG_ERROR << "Problem with StEmcDecoder::GetCrateAndSequenceFromTriggerPatch for patchId " << patchId << endm;
00618 }
00619 LOG_ERROR << "Problem with StEmcDecoder::GetTriggerPatchFromTowerId for softId " << softId << endm;
00620 return NULL;
00621 }
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651