8 #include "StBemcTablesWriter.h"
14 #include "TUnixTime.h"
15 #include "StDaqLib/EMC/StEmcDecoder.h"
16 #include "StMessMgr.h"
18 #include "StEmcRawMaker/defines.h"
23 mDbTables[
"bemcPed"] = NULL;
24 mDbTables[
"bprsPed"] = NULL;
25 mDbTables[
"bsmdePed"] = NULL;
26 mDbTables[
"bsmdpPed"] = NULL;
28 mDbTables[
"bemcStatus"] = NULL;
29 mDbTables[
"bprsStatus"] = NULL;
30 mDbTables[
"bsmdeStatus"] = NULL;
31 mDbTables[
"bsmdpStatus"] = NULL;
33 mDbTables[
"bemcCalib"] = NULL;
34 mDbTables[
"bprsCalib"] = NULL;
35 mDbTables[
"bsmdeCalib"] = NULL;
36 mDbTables[
"bsmdpCalib"] = NULL;
38 mDbTables[
"bemcGain"] = NULL;
39 mDbTables[
"bprsGain"] = NULL;
40 mDbTables[
"bsmdeGain"] = NULL;
41 mDbTables[
"bsmdpGain"] = NULL;
43 mDbTables[
"bemcTriggerPed"] = NULL;
44 mDbTables[
"bemcTriggerPed4"] = NULL;
45 mDbTables[
"bemcTriggerStatus"]= NULL;
46 mDbTables[
"bemcTriggerLUT"] = NULL;
51 StBemcTablesWriter::~StBemcTablesWriter(){
52 for(map<string, StDbTable*>::iterator it=mDbTables.begin(); it!=mDbTables.end(); ++it){
58 if(mDbHandler)
delete mDbHandler;
65 if (mDecoder) mDecoder->SetDateTime(dt.GetDate(), dt.GetTime());
69 if(dt.GetDate() >= 20060101) mBtowMapFix = kFALSE;
71 for(map<string, StDbTable*>::iterator it = mDbTables.begin(); it!=mDbTables.end(); it++) {
72 string tableName = it->first;
74 if( (!t) || (ut() < t->getBeginTime()) || (ut() >= t->getEndTime()) ) {
76 mDbHandler->setTimeStamp(sqlTime);
77 mDbHandler->setFlavor(flavor);
78 mDbHandler->setTableName((
char*)tableName.c_str());
84 string beginTime = StEmcDbHandler::timeToSqlTime(t->getBeginDateTime());
85 string endTime = StEmcDbHandler::timeToSqlTime(t->getEndDateTime());
86 map<string, pair<string, string> >::iterator iter = mValidRanges.find(tableName);
87 if(iter == mValidRanges.end()) {
88 mValidRanges[tableName] = make_pair(beginTime, endTime);
89 LOG_INFO << Form(
"loaded a new %20s table with beginTime %s and endTime %s", tableName.c_str(), beginTime.c_str(), endTime.c_str()) << endm;
90 }
else if( beginTime != (iter->second).first ) {
91 (iter->second).first = beginTime;
92 (iter->second).second = endTime;
93 LOG_INFO << Form(
"loaded a new %20s table with beginTime %s and endTime %s", tableName.c_str(), beginTime.c_str(), endTime.c_str()) << endm;
99 if(mBtowP)
delete mBtowP;
100 mBtowP = mDbTables[
"bemcPed"] ? (emcPed_st*) mDbTables[
"bemcPed"]->GetTableCpy() : 0;
102 if(mBprsP)
delete mBprsP;
103 mBprsP = mDbTables[
"bprsPed"] ? (emcPed_st*) mDbTables[
"bprsPed"]->GetTableCpy() : 0;
105 if(mSmdeP)
delete mSmdeP;
106 mSmdeP = mDbTables[
"bsmdePed"] ? (smdPed_st*) mDbTables[
"bsmdePed"]->GetTableCpy() : 0;
108 if(mSmdpP)
delete mSmdpP;
109 mSmdpP = mDbTables[
"bsmdpPed"] ? (smdPed_st*) mDbTables[
"bsmdpPed"]->GetTableCpy() : 0;
112 if(mBtowS)
delete mBtowS;
113 mBtowS = mDbTables[
"bemcStatus"] ? (emcStatus_st*) mDbTables[
"bemcStatus"]->GetTableCpy() : 0;
115 if(mBprsS)
delete mBprsS;
116 mBprsS = mDbTables[
"bprsStatus"] ? (emcStatus_st*) mDbTables[
"bprsStatus"]->GetTableCpy() : 0;
118 if(mSmdeS)
delete mSmdeS;
119 mSmdeS = mDbTables[
"bsmdeStatus"] ? (smdStatus_st*) mDbTables[
"bsmdeStatus"]->GetTableCpy() : 0;
121 if(mSmdpS)
delete mSmdpS;
122 mSmdpS = mDbTables[
"bsmdpStatus"] ? (smdStatus_st*) mDbTables[
"bsmdpStatus"]->GetTableCpy() : 0;
125 if(mBtowC)
delete mBtowC;
126 mBtowC = mDbTables[
"bemcCalib"] ? (emcCalib_st*) mDbTables[
"bemcCalib"]->GetTableCpy() : 0;
128 if(mBprsC)
delete mBprsC;
129 mBprsC = mDbTables[
"bprsCalib"] ? (emcCalib_st*) mDbTables[
"bprsCalib"]->GetTableCpy() : 0;
131 if(mSmdeC)
delete mSmdeC;
132 mSmdeC = mDbTables[
"bsmdeCalib"] ? (smdCalib_st*) mDbTables[
"bsmdeCalib"]->GetTableCpy() : 0;
134 if(mSmdpC)
delete mSmdpC;
135 mSmdpC = mDbTables[
"bsmdpCalib"] ? (smdCalib_st*) mDbTables[
"bsmdpCalib"]->GetTableCpy() : 0;
138 if(mBtowG)
delete mBtowG;
139 mBtowG = mDbTables[
"bemcGain"] ? (emcGain_st*) mDbTables[
"bemcGain"]->GetTableCpy() : 0;
141 if(mBprsG)
delete mBprsG;
142 mBprsG = mDbTables[
"bprsGain"] ? (emcGain_st*) mDbTables[
"bprsGain"]->GetTableCpy() : 0;
144 if(mSmdeG)
delete mSmdeG;
145 mSmdeG = mDbTables[
"bsmdeGain"] ? (smdGain_st*) mDbTables[
"bsmdeGain"]->GetTableCpy() : 0;
147 if(mSmdpG)
delete mSmdpG;
148 mSmdpG = mDbTables[
"bsmdpGain"] ? (smdGain_st*) mDbTables[
"bsmdpGain"]->GetTableCpy() : 0;
151 if(mTrigS)
delete mTrigS;
152 mTrigS = mDbTables[
"bemcTriggerStatus"] ? (emcTriggerStatus_st*) mDbTables[
"bemcTriggerStatus"]->GetTableCpy() : 0;
154 if(mTrigP)
delete mTrigP;
155 mTrigP = mDbTables[
"bemcTriggerPed"] ? (emcTriggerPed_st*) mDbTables[
"bemcTriggerPed"]->GetTableCpy() : 0;
157 if(mTrigP4)
delete mTrigP4;
158 mTrigP4 = mDbTables[
"bemcTriggerPed4"] ? (bemcTriggerPed4_st*) mDbTables[
"bemcTriggerPed4"]->GetTableCpy() : 0;
160 if(mTrigL)
delete mTrigL;
161 mTrigL = mDbTables[
"bemcTriggerLUT"] ? (emcTriggerLUT_st*) mDbTables[
"bemcTriggerLUT"]->GetTableCpy() : 0;
164 void StBemcTablesWriter::setCalib(
int det,
int softId,
int power,
float val) {
167 if (mBtowC) mBtowC->AdcToE[softId-1][power] = val;
171 if (mBprsC) mBprsC->AdcToE[softId-1][power] = val;
175 if (mSmdeC) mSmdeC->AdcToE[softId-1][power] = val;
179 if (mSmdpC) mSmdpC->AdcToE[softId-1][power] = val;
184 void StBemcTablesWriter::setPedestal(
int det,
int softId,
int cap,
float val) {
185 short packedValue =
static_cast<short>(val*100.0);
188 if (mBtowP) mBtowP->AdcPedestal[softId-1] = packedValue;
192 if (mBprsP) mBprsP->AdcPedestal[softId-1] = packedValue;
196 if (mSmdeP) mSmdeP->AdcPedestal[softId-1][cap] = packedValue;
200 if (mSmdpP) mSmdpP->AdcPedestal[softId-1][cap] = packedValue;
205 void StBemcTablesWriter::setPedestalRMS(
int det,
int softId,
int cap,
float val) {
206 short packedValue =
static_cast<short>(val*100.0);
209 if (mBtowP) mBtowP->AdcPedestalRMS[softId-1] = packedValue;
213 if (mBprsP) mBprsP->AdcPedestalRMS[softId-1] = packedValue;
217 if (mSmdeP) mSmdeP->AdcPedestalRMS[softId-1][cap] = packedValue;
221 if (mSmdpP) mSmdpP->AdcPedestalRMS[softId-1][cap] = packedValue;
226 void StBemcTablesWriter::setGain(
int det,
int softId,
float val) {
229 if (mBtowG) mBtowG->Gain[softId-1] = val;
233 if (mBprsG) mBprsG->Gain[softId-1] = val;
237 if (mSmdeG) mSmdeG->Gain[softId-1] = val;
241 if (mSmdpG) mSmdpG->Gain[softId-1] = val;
246 void StBemcTablesWriter::setStatus(
int det,
int softId,
unsigned short val) {
248 cout <<
"status must be between 0 and 255 -- you supplied " << val << endl;
254 if (mBtowS) mBtowS->Status[softId-1] = val;
258 if (mBprsS) mBprsS->Status[softId-1] = val;
262 if (mSmdeS) mSmdeS->Status[softId-1] = val;
266 if (mSmdpS) mSmdpS->Status[softId-1] = val;
271 void StBemcTablesWriter::setCalibStatus(
int det,
int softId,
unsigned short val) {
273 cout <<
"status must be between 0 and 255 -- you supplied " << val << endl;
279 if (mBtowC) mBtowC->Status[softId-1] = val;
283 if (mBprsC) mBprsC->Status[softId-1] = val;
287 if (mSmdeC) mSmdeC->Status[softId-1] = val;
291 if (mSmdpC) mSmdpC->Status[softId-1] = val;
296 void StBemcTablesWriter::setPedestalStatus(
int det,
int softId,
unsigned short val) {
298 cout <<
"status must be between 0 and 255 -- you supplied " << val << endl;
304 if (mBtowP) mBtowP->Status[softId-1] = val;
308 if (mBprsP) mBprsP->Status[softId-1] = val;
312 if (mSmdeP) mSmdeP->Status[softId-1] = val;
316 if (mSmdpP) mSmdpP->Status[softId-1] = val;
321 void StBemcTablesWriter::setGainStatus(
int det,
int softId,
unsigned short val) {
323 cout <<
"status must be between 0 and 255 -- you supplied " << val << endl;
329 if (mBtowG) mBtowG->Status[softId-1] = val;
333 if (mBprsG) mBprsG->Status[softId-1] = val;
337 if (mSmdeG) mSmdeG->Status[softId-1] = val;
341 if (mSmdpG) mSmdpG->Status[softId-1] = val;
346 void StBemcTablesWriter::writeToDb(
const char * tableName,
const char * timeStamp,
const char * flavor) {
347 if (!mDbHandler)
return;
349 mDbHandler->setTableName(tableName);
350 mDbHandler->setTimeStamp(timeStamp);
351 mDbHandler->setFlavor(flavor);
353 if(!strcmp(tableName,
"bemcCalib")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mBtowC));
return; }
354 if(!strcmp(tableName,
"bprsCalib")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mBprsC));
return; }
355 if(!strcmp(tableName,
"bsmdeCalib")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mSmdeC));
return; }
356 if(!strcmp(tableName,
"bsmdpCalib")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mSmdpC));
return; }
358 if(!strcmp(tableName,
"bemcPed")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mBtowP));
return; }
359 if(!strcmp(tableName,
"bprsPed")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mBprsP));
return; }
360 if(!strcmp(tableName,
"bsmdePed")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mSmdeP));
return; }
361 if(!strcmp(tableName,
"bsmdpPed")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mSmdpP));
return; }
363 if(!strcmp(tableName,
"bemcGain")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mBtowG));
return; }
364 if(!strcmp(tableName,
"bprsGain")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mBprsG));
return; }
365 if(!strcmp(tableName,
"bsmdeGain")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mSmdeG));
return; }
366 if(!strcmp(tableName,
"bsmdpGain")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mSmdpG));
return; }
368 if(!strcmp(tableName,
"bemcStatus")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mBtowS));
return; }
369 if(!strcmp(tableName,
"bprsStatus")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mBprsS));
return; }
370 if(!strcmp(tableName,
"bsmdeStatus")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mSmdeS));
return; }
371 if(!strcmp(tableName,
"bsmdpStatus")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mSmdpS));
return; }
373 if(!strcmp(tableName,
"bemcTriggerPed")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mTrigP));
return; }
374 if(!strcmp(tableName,
"bemcTriggerPed4")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mTrigP4));
return; }
375 if(!strcmp(tableName,
"bemcTriggerStatus")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mTrigS));
return; }
376 if(!strcmp(tableName,
"bemcTriggerLUT")) { mDbHandler->writeToDb(reinterpret_cast<char*>(mTrigL));
return; }
380 LOG_ERROR <<
"Can't upload a table with name = " << tableName << endm;
383 void StBemcTablesWriter::writeToFile(
const char * fileName) {
384 TFile *f =
new TFile(fileName,
"recreate");
386 string baseName = gSystem->BaseName(fileName);
388 if(baseName.find(
"bemcCalib") == 0) {
389 St_emcCalib* table =
new St_emcCalib(
"bemcCalib",1);
390 if (table && mBtowC) {
391 table->AddAt(static_cast<void*>(mBtowC),0);
395 else if(baseName.find(
"bprsCalib") == 0) {
396 St_emcCalib* table =
new St_emcCalib(
"bprsCalib",1);
397 if (table && mBprsC) {
398 table->AddAt(static_cast<void*>(mBprsC),0);
402 else if(baseName.find(
"bsmdeCalib") == 0) {
403 St_smdCalib* table =
new St_smdCalib(
"bsmdeCalib",1);
404 if (table && mSmdeC) {
405 table->AddAt(static_cast<void*>(mSmdeC),0);
409 else if(baseName.find(
"bsmdpCalib") == 0) {
410 St_smdCalib* table =
new St_smdCalib(
"bsmdpCalib",1);
411 if (table && mSmdpC) {
412 table->AddAt(static_cast<void*>(mSmdpC),0);
417 else if(baseName.find(
"bemcPed") == 0) {
418 St_emcPed* table =
new St_emcPed(
"bemcPed",1);
419 if (table && mBtowP) {
420 table->AddAt(static_cast<void*>(mBtowP),0);
424 else if(baseName.find(
"bprsPed") == 0) {
425 St_emcPed* table =
new St_emcPed(
"bprsPed",1);
426 if (table && mBprsP) {
427 table->AddAt(static_cast<void*>(mBprsP),0);
431 else if(baseName.find(
"bsmdePed") == 0) {
432 St_smdPed* table =
new St_smdPed(
"bsmdePed",1);
433 if (table && mSmdeP) {
434 table->AddAt(static_cast<void*>(mSmdeP),0);
438 else if(baseName.find(
"bsmdpPed") == 0) {
439 St_smdPed* table =
new St_smdPed(
"bsmdpPed",1);
440 if (table && mSmdpP) {
441 table->AddAt(static_cast<void*>(mSmdpP),0);
445 else if(baseName.find(
"bemcGain") == 0) {
446 St_emcGain* table =
new St_emcGain(
"bemcGain",1);
447 if (table && mBtowG) {
448 table->AddAt(static_cast<void*>(mBtowG),0);
452 else if(baseName.find(
"bprsGain") == 0) {
453 St_emcGain* table =
new St_emcGain(
"bprsGain",1);
454 if (table && mBprsG) {
455 table->AddAt(static_cast<void*>(mBprsG),0);
459 else if(baseName.find(
"bsmdeGain") == 0) {
460 St_smdGain* table =
new St_smdGain(
"bsmdeGain",1);
461 if (table && mSmdeG) {
462 table->AddAt(static_cast<void*>(mSmdeG),0);
466 else if(baseName.find(
"bsmdpGain") == 0) {
467 St_smdGain* table =
new St_smdGain(
"bsmdpGain",1);
468 if (table && mSmdpG) {
469 table->AddAt(static_cast<void*>(mSmdpG),0);
474 else if(baseName.find(
"bemcStatus") == 0) {
475 St_emcStatus* table =
new St_emcStatus(
"bemcStatus",1);
476 if (table && mBtowS) {
477 table->AddAt(static_cast<void*>(mBtowS),0);
481 else if(baseName.find(
"bprsStatus") == 0) {
482 St_emcStatus* table =
new St_emcStatus(
"bprsStatus",1);
483 if (table && mBprsS) {
484 table->AddAt(static_cast<void*>(mBprsS),0);
488 else if(baseName.find(
"bsmdeStatus") == 0) {
489 St_smdStatus* table =
new St_smdStatus(
"bsmdeStatus",1);
490 if (table && mSmdeS) {
491 table->AddAt(static_cast<void*>(mSmdeS),0);
495 else if(baseName.find(
"bsmdpStatus") == 0) {
496 St_smdStatus* table =
new St_smdStatus(
"bsmdpStatus",1);
497 if (table && mSmdpS) {
498 table->AddAt(static_cast<void*>(mSmdpS),0);
502 else if(baseName.find(
"bemcTriggerPed4") == 0) {
503 St_bemcTriggerPed4* table =
new St_bemcTriggerPed4(
"bemcTriggerPed4",1);
504 if (table && mTrigP4) {
505 table->AddAt(static_cast<void*>(mTrigP4),0);
509 else if(baseName.find(
"bemcTriggerPed") == 0) {
510 St_emcTriggerPed* table =
new St_emcTriggerPed(
"bemcTriggerPed",1);
511 if (table && mTrigP) {
512 table->AddAt(static_cast<void*>(mTrigP),0);
516 else if(baseName.find(
"bemcTriggerStatus") == 0) {
517 St_emcTriggerStatus* table =
new St_emcTriggerStatus(
"bemcTriggerStatus",1);
518 if (table && mTrigS) {
519 table->AddAt(static_cast<void*>(mTrigS),0);
523 else if(baseName.find(
"bemcTriggerLUT") == 0) {
524 St_emcTriggerLUT* table =
new St_emcTriggerLUT(
"bemcTriggerLUT",1);
525 if (table && mTrigL) {
526 table->AddAt(static_cast<void*>(mTrigL),0);
535 void StBemcTablesWriter::loadTableFromFile(TFile *f) {
536 string fileName = gSystem->BaseName(f->GetName());
538 if(fileName.find(
"bemcPed") == 0) {
539 if(mBtowP)
delete mBtowP;
540 mBtowP = f->Get(
"bemcPed") ? ((St_emcPed*)f->Get(
"bemcPed"))->GetTable() : 0;
542 else if(fileName.find(
"bprsPed") == 0) {
543 if(mBprsP)
delete mBprsP;
544 mBprsP = f->Get(
"bprsPed") ? ((St_emcPed*)f->Get(
"bprsPed"))->GetTable() : 0;
546 else if(fileName.find(
"bsmdePed") == 0) {
547 if(mSmdeP)
delete mSmdeP;
548 mSmdeP = f->Get(
"bsmdePed") ? ((St_smdPed*)f->Get(
"bsmdePed"))->GetTable() : 0;
550 else if(fileName.find(
"bsmdpPed") == 0) {
551 if(mSmdpP)
delete mSmdpP;
552 mSmdpP = f->Get(
"bsmdpPed") ? ((St_smdPed*)f->Get(
"bsmdpPed"))->GetTable() : 0;
554 else if(fileName.find(
"bemcStatus") == 0) {
555 if(mBtowS)
delete mBtowS;
556 mBtowS = f->Get(
"bemcStatus") ? ((St_emcStatus*)f->Get(
"bemcStatus"))->GetTable() : 0;
558 else if(fileName.find(
"bprsStatus") == 0) {
559 if(mBprsS)
delete mBprsS;
560 mBprsS = f->Get(
"bprsStatus") ? ((St_emcStatus*)f->Get(
"bprsStatus"))->GetTable() : 0;
562 else if(fileName.find(
"bsmdeStatus") == 0) {
563 if(mSmdeS)
delete mSmdeS;
564 mSmdeS = f->Get(
"bsmdeStatus") ? ((St_smdStatus*)f->Get(
"bsmdeStatus"))->GetTable() : 0;
566 else if(fileName.find(
"bsmdpStatus") == 0) {
567 if(mSmdpS)
delete mSmdpS;
568 mSmdpS = f->Get(
"bsmdpStatus") ? ((St_smdStatus*)f->Get(
"bsmdpStatus"))->GetTable() : 0;
570 else if(fileName.find(
"bemcCalib") == 0) {
571 if(mBtowC)
delete mBtowC;
572 mBtowC = f->Get(
"bemcCalib") ? ((St_emcCalib*)f->Get(
"bemcCalib"))->GetTable() : 0;
574 else if(fileName.find(
"bprsCalib") == 0) {
575 if(mBprsC)
delete mBprsC;
576 mBprsC = f->Get(
"bprsCalib") ? ((St_emcCalib*)f->Get(
"bprsCalib"))->GetTable() : 0;
578 else if(fileName.find(
"bsmdeCalib") == 0) {
579 if(mSmdeC)
delete mSmdeC;
580 mSmdeC = f->Get(
"bsmdeCalib") ? ((St_smdCalib*)f->Get(
"bsmdeCalib"))->GetTable() : 0;
582 else if(fileName.find(
"bsmdpCalib") == 0) {
583 if(mSmdpC)
delete mSmdpC;
584 mSmdpC = f->Get(
"bsmdpCalib") ? ((St_smdCalib*)f->Get(
"bsmdpCalib"))->GetTable() : 0;
586 else if(fileName.find(
"bemcGain") == 0) {
587 if(mBtowG)
delete mBtowG;
588 mBtowG = f->Get(
"bemcGain") ? ((St_emcGain*)f->Get(
"bemcGain"))->GetTable() : 0;
590 else if(fileName.find(
"bprsGain") == 0) {
591 if(mBprsG)
delete mBprsG;
592 mBprsG = f->Get(
"bprsGain") ? ((St_emcGain*)f->Get(
"bprsGain"))->GetTable() : 0;
594 else if(fileName.find(
"bsmdeGain") == 0) {
595 if(mSmdeG)
delete mSmdeG;
596 mSmdeG = f->Get(
"bsmdeGain") ? ((St_smdGain*)f->Get(
"bsmdeGain"))->GetTable() : 0;
598 else if(fileName.find(
"bsmdpGain") == 0) {
599 if(mSmdpG)
delete mSmdpG;
600 mSmdpG = f->Get(
"bsmdpGain") ? ((St_smdGain*)f->Get(
"bsmdpGain"))->GetTable() : 0;
602 else if(fileName.find(
"bemcTriggerStatus") == 0) {
603 if(mTrigS)
delete mTrigS;
604 mTrigS = f->Get(
"bemcTriggerStatus") ? ((St_emcTriggerStatus*)f->Get(
"bemcTriggerStatus"))->GetTable() : 0;
606 else if(fileName.find(
"bemcTriggerPed4") == 0) {
607 if(mTrigP4)
delete mTrigP4;
608 mTrigP4 = f->Get(
"bemcTriggerPed4") ? ((St_bemcTriggerPed4*)f->Get(
"bemcTriggerPed4"))->GetTable() : 0;
610 else if(fileName.find(
"bemcTriggerPed") == 0) {
611 if(mTrigP)
delete mTrigP;
612 mTrigP = f->Get(
"bemcTriggerPed") ? ((St_emcTriggerPed*)f->Get(
"bemcTriggerPed"))->GetTable() : 0;
614 else if(fileName.find(
"bemcTriggerLUT") == 0) {
615 if(mTrigL)
delete mTrigL;
616 mTrigL = f->Get(
"bemcTriggerLUT") ? ((St_emcTriggerLUT*)f->Get(
"bemcTriggerLUT"))->GetTable() : 0;
620 void StBemcTablesWriter::setTable(
const char * tableName,
void *
data) {
621 if (!tableName || !data)
return;
622 string myName(tableName);
624 if(myName.find(
"bemcPed") == 0) {
625 if (mBtowP) memcpy(mBtowP, data,
sizeof(emcPed_st));
627 else if(myName.find(
"bprsPed") == 0) {
628 if (mBprsP) memcpy(mBprsP, data,
sizeof(emcPed_st));
630 else if(myName.find(
"bsmdePed") == 0) {
631 if (mSmdeP) memcpy(mSmdeP, data,
sizeof(smdPed_st));
633 else if(myName.find(
"bsmdpPed") == 0) {
634 if (mSmdpP) memcpy(mSmdpP, data,
sizeof(smdPed_st));
636 else if(myName.find(
"bemcStatus") == 0) {
637 if (mBtowS) memcpy(mBtowS, data,
sizeof(emcStatus_st));
639 else if(myName.find(
"bprsStatus") == 0) {
640 if (mBprsS) memcpy(mBprsS, data,
sizeof(emcStatus_st));
642 else if(myName.find(
"bsmdeStatus") == 0) {
643 if (mSmdeS) memcpy(mSmdeS, data,
sizeof(smdStatus_st));
645 else if(myName.find(
"bsmdpStatus") == 0) {
646 if (mSmdpS) memcpy(mSmdpS, data,
sizeof(smdStatus_st));
648 else if(myName.find(
"bemcCalib") == 0) {
649 if (mBtowC) memcpy(mBtowC, data,
sizeof(emcCalib_st));
651 else if(myName.find(
"bprsCalib") == 0) {
652 if (mBprsC) memcpy(mBprsC, data,
sizeof(emcCalib_st));
654 else if(myName.find(
"bsmdeCalib") == 0) {
655 if (mSmdeC) memcpy(mSmdeC, data,
sizeof(smdCalib_st));
657 else if(myName.find(
"bsmdpCalib") == 0) {
658 if (mSmdpC) memcpy(mSmdpC, data,
sizeof(smdCalib_st));
660 else if(myName.find(
"bemcGain") == 0) {
661 if (mBtowG) memcpy(mBtowG, data,
sizeof(emcGain_st));
663 else if(myName.find(
"bprsGain") == 0) {
664 if (mBprsG) memcpy(mBprsG, data,
sizeof(emcGain_st));
666 else if(myName.find(
"bsmdeGain") == 0) {
667 if (mSmdeG) memcpy(mSmdeG, data,
sizeof(smdGain_st));
669 else if(myName.find(
"bsmdpGain") == 0) {
670 if (mSmdpG) memcpy(mSmdpG, data,
sizeof(smdGain_st));
672 else if(myName.find(
"bemcTriggerStatus") == 0) {
673 if (mTrigS) memcpy(mTrigS, data,
sizeof(emcTriggerStatus_st));
675 else if(myName.find(
"bemcTriggerPed4") == 0) {
676 if (mTrigP4) memcpy(mTrigP4, data,
sizeof(bemcTriggerPed4_st));
678 else if(myName.find(
"bemcTriggerPed") == 0) {
679 if (mTrigP) memcpy(mTrigP, data,
sizeof(emcTriggerPed_st));
681 else if(myName.find(
"bemcTriggerLUT") == 0) {
682 if (mTrigL) memcpy(mTrigL, data,
sizeof(emcTriggerLUT_st));
void loadTables(const char *sqlTime, const char *flavor="ofl")
load directly from DB, no Maker needed