00001 #include "StOnlineTriggerMonitoring.h"
00002 #include <iostream>
00003 #include <fstream>
00004 #include <cstdlib>
00005 using namespace std;
00006
00007 #include <TROOT.h>
00008 #include <TSystem.h>
00009 #include <TFile.h>
00010 #include <TString.h>
00011
00012 #include "StMessMgr.h"
00013
00014 #include "StDbLib/StDbManager.hh"
00015 #include "StDbLib/StDbConfigNode.hh"
00016 #include "StDbLib/StDbTable.h"
00017 #include "StDbLib/StDataBaseI.hh"
00018
00019 #include "tables/St_emcTriggerStatus_Table.h"
00020 #include "tables/St_emcTriggerPed_Table.h"
00021 #include "tables/St_emcTriggerLUT_Table.h"
00022 #include "tables/St_emcStatus_Table.h"
00023 #include "tables/St_emcPed_Table.h"
00024
00025 #include "StEmcUtil/database/StEmcDecoder.h"
00026 #include "StEmcUtil/database/StBemcTablesWriter.h"
00027
00028 char BITMASK[15][130];
00029 int PATCH[300], DSM[300], BIT[300], PA[300], HT[300], TOWER[30][160], PED[30][160], PEDRMS[30][160], BITCONV[30][10];
00030 int FORMULATAG[30][10],FORMULAPARAMETER[30][10][6];
00031 int PEDSHIFT;
00032
00033 ClassImp(StOnlineTriggerMonitoring)
00034
00035 int unpackbits(char *data, int nbits, int index)
00036 {
00037 TString a = data;
00038 TString v= a(index,nbits);
00039 int b = strtol(v.Data(),NULL,2);
00040 return b;
00041 }
00042 void swapline(char*pointer)
00043 {
00044 char T[16];
00045 for(int i=0;i<16;i++) T[i] = pointer[i];
00046 pointer[8] = T[4];
00047 pointer[9] = T[5];
00048 pointer[10] = T[6];
00049 pointer[11] = T[7];
00050 pointer[12] = T[0];
00051 pointer[13] = T[1];
00052 pointer[14] = T[2];
00053 pointer[15] = T[3];
00054
00055 pointer[0] = T[12];
00056 pointer[1] = T[13];
00057 pointer[2] = T[14];
00058 pointer[3] = T[15];
00059 pointer[4] = T[8];
00060 pointer[5] = T[9];
00061 pointer[6] = T[10];
00062 pointer[7] = T[11];
00063 }
00064 void makeString(unsigned char* data,int nb, TString &result)
00065 {
00066 result = "";
00067 for(int i=0;i<nb;i++) for (Int_t j = 7;j >= 0;j--) result += (((short)data[i] & (1 << j)) ? "1" : "0");
00068 }
00069 void loadTriggerMasks(char* file,int start)
00070 {
00071 FILE *W = fopen(file,"rb");
00072 unsigned char mask[16];
00073 for(int dsm=1;dsm<=15;dsm++)
00074 {
00075 char * pointer = (char*)mask;
00076 fread(pointer,(int)sizeof(unsigned char)*16,1,W);
00077 swapline(pointer);
00078 TString result;
00079 makeString((unsigned char*) pointer,16, result);
00080 sprintf(BITMASK[dsm-1],"%s",result.Data());
00081
00082
00083 }
00084 cout <<"Decoding the data "<<endl;
00085 for(int patch = 1; patch<=150;patch++)
00086 {
00087 int dsm = DSM[patch-1+start];
00088 int bit = BIT[patch-1+start];
00089 int ht = unpackbits((char*)BITMASK[dsm-1],6,128-bit-6);
00090 int pa = unpackbits((char*)BITMASK[dsm-1],6,128-bit-12);
00091 if(ht==63) HT[patch-1+start] = 1; else HT[patch-1+start] = 0;
00092 if(pa==63) PA[patch-1+start] = 1; else PA[patch-1+start] = 0;
00093
00094
00095
00096
00097
00098
00099
00100 }
00101 fclose(W);
00102 }
00103
00104 void StOnlineTriggerMonitoring::saveTrigger(
00105 const Char_t *TS
00106 , Bool_t status
00107 , Bool_t pedestal
00108 , Bool_t lut
00109 , Bool_t statusOffline
00110 , Bool_t pedestalOffline
00111 , Bool_t saveDB
00112 , Bool_t saveTables
00113 , const Char_t *tables_dir
00114 , const Char_t *saved_dir
00115 , const Char_t *bemcStatusCopy
00116 , const Char_t *bceTable
00117 , const Char_t *bcwTable
00118 ) {
00119 cout << "tables dir = " << tables_dir << endl;
00120 cout << "saved dir = " << saved_dir << endl;
00121 cout << "bemcStatusCopy = " << bemcStatusCopy << endl;
00122 cout << "bceTable = " << bceTable << endl;
00123 cout << "bcwTable = " << bcwTable << endl;
00124
00125 TString FILENAME;
00126
00127 cout << "Saving trigger tables in offline DB for TS = "<< TS <<endl;
00128
00129
00130
00131
00132
00133 ifstream inw(bcwTable);
00134 for(int i=0;i<150;i++) {
00135 inw >> PATCH[i]>>DSM[i]>>BIT[i];
00136
00137 }
00138 inw.close();
00139 ifstream ine(bceTable);
00140 for(int i=0;i<150;i++) {
00141 ine >> PATCH[i+150]>>DSM[i+150]>>BIT[i+150];
00142
00143 }
00144 ine.close();
00145
00146 FILENAME = saved_dir; FILENAME += "/bcw.lut.bin";
00147 cout <<"Loading trigger masks from "<<FILENAME.Data()<<endl;
00148 loadTriggerMasks((char*)FILENAME.Data(),0);
00149 FILENAME = saved_dir; FILENAME += "/bce.lut.bin";
00150 cout <<"Loading trigger masks from "<<FILENAME.Data()<<endl;
00151 loadTriggerMasks((char*)FILENAME.Data(),150);
00152
00153 int NHT=0, NPA=0;
00154
00155 for(int i=0;i<300;i++)
00156 {
00157 if(HT[i]==0) cout <<"High Tower "<<i<<" masked out\n";
00158 if(PA[i]==0) cout <<"Patch sum "<<i<<" masked out\n";
00159 if(HT[i]==0) NHT++;
00160 if(PA[i]==0) NPA++;
00161 }
00162 cout <<"Number of high towers masked out = "<<NHT<<endl;
00163 cout <<"Number of trigger patches masked out = "<<NPA<<endl;
00164
00165
00166
00167 for(int crate = 1;crate<=30;crate++)
00168 {
00169 FILENAME = saved_dir;
00170 FILENAME+="/pedestal_crate0x";
00171 char str[10];
00172 sprintf(str,"%02x",crate);
00173 FILENAME+=str;
00174 FILENAME+=".dat";
00175
00176 long id,flag,mod;
00177 Long64_t size;
00178 if(gSystem->GetPathInfo(FILENAME.Data(),&id,&size,&flag,&mod)==0)
00179 {
00180 cout <<FILENAME.Data()<<" is Ok\n";
00181 ifstream in(FILENAME.Data());
00182 int towerid;
00183 float ped, rms;
00184 for(int i=0;i<160;i++)
00185 {
00186 in>>towerid>>ped>>rms;
00187 PED[crate-1][towerid] = (int)(ped*100);
00188 PEDRMS[crate-1][towerid] = (int)(rms*100);
00189
00190 }
00191 in.close();
00192 } else {
00193 for(int i=0;i<160;i++) {
00194 PED[crate-1][i]=0;
00195 PEDRMS[crate-1][i]=0;
00196 }
00197 }
00198 }
00199
00200
00201 FILENAME = saved_dir; FILENAME+="/BemcConfig.dat";
00202 ifstream bemcConf(FILENAME.Data());
00203 PEDSHIFT = 0;
00204 char line[4096];
00205 while(!bemcConf.eof())
00206 {
00207 bemcConf.getline(line,4096);
00208
00209 TString L = line;
00210 if(L.Index("TriggerPedestalShift")>=0)
00211 {
00212 TString b = L(L.Index("TriggerPedestalShift")+21,L.Length());
00213 if(b.BeginsWith("0x")) PEDSHIFT = strtol(b.Data(),NULL,16);
00214 else PEDSHIFT = atoi(b.Data());
00215 PEDSHIFT*=100;
00216 }
00217 }
00218
00219
00220 for(int crate = 1;crate<=30;crate++)
00221 {
00222 FILENAME = saved_dir; FILENAME+= "/config_crate0x";
00223 char str[10];
00224 sprintf(str,"%02x",crate);
00225 FILENAME+=str;
00226 FILENAME+=".dat";
00227
00228 long id,flag,mod;
00229 Long64_t size;
00230 if(gSystem->GetPathInfo(FILENAME.Data(),&id,&size,&flag,&mod)==0)
00231 {
00232 cout <<FILENAME.Data()<<" is Ok\n";
00233 ifstream in(FILENAME.Data());
00234 char tmp[50];
00235 short bit6[2][5],mask[2][5],formula[2][5],par[2][5][6];
00236 in >> tmp;
00237 in >> tmp;
00238 in >> tmp;
00239 in >> tmp;
00240 in >> tmp;
00241 in >> tmp;
00242 in >> tmp;
00243 in >> tmp;
00244
00245 for(int board = 1; board<=5;board++)
00246 {
00247 in >> tmp;
00248 in >> tmp;
00249 in >> tmp;
00250
00251 for(int patch = 0;patch<2;patch++)
00252 {
00253 in >> tmp;
00254 TString A1 = tmp;
00255 if(A1.BeginsWith("0x")) mask[patch][board-1] = strtol(A1.Data(),NULL,16);
00256 else mask[patch][board-1] = atoi(A1.Data());
00257
00258 in >> tmp;
00259 TString A11 = tmp;
00260 if(A11.BeginsWith("0x")) formula[patch][board-1] = strtol(A11.Data(),NULL,16);
00261 else formula[patch][board-1] = atoi(A11.Data());
00262
00263 for(int f = 0;f<6;f++)
00264 {
00265 in >> tmp;
00266 TString A12 = tmp;
00267 if(A12.BeginsWith("0x")) par[patch][board-1][f] = strtol(A12.Data(),NULL,16);
00268 else par[patch][board-1][f] = atoi(A12.Data());
00269 }
00270
00271 in >> tmp;
00272 TString A = tmp;
00273 if(A.BeginsWith("0x")) bit6[patch][board-1] = strtol(A.Data(),NULL,16);
00274 else bit6[patch][board-1] = atoi(A.Data());
00275
00276 }
00277 }
00278 if (!in.eof()) {
00279 for(int board = 0; board<=5;board++) {
00280 in >> tmp;
00281 in >> tmp;
00282 if (board >= 1) {
00283 Bool_t boardHT = atoi(tmp);
00284 if (!boardHT) {
00285 cout << "Board " << board << " HT peds not configured" << endl;
00286
00287 }
00288 }
00289 in >> tmp;
00290 if (board >= 1) {
00291 Bool_t boardJP = atoi(tmp);
00292 if (!boardJP) {
00293 cout << "Board " << board << " LUT not configured" << endl;
00294 formula[0][board-1] = 0;
00295 formula[1][board-1] = 0;
00296 par[0][board-1][0] = 1;
00297 par[1][board-1][0] = 1;
00298 par[0][board-1][1] = 0;
00299 par[1][board-1][1] = 0;
00300 par[0][board-1][2] = 0;
00301 par[1][board-1][2] = 0;
00302 par[0][board-1][3] = 1;
00303 par[1][board-1][3] = 1;
00304 par[0][board-1][4] = 0;
00305 par[1][board-1][4] = 0;
00306 par[0][board-1][5] = 0;
00307 par[1][board-1][5] = 0;
00308 }
00309 }
00310 in >> tmp;
00311 in >> tmp;
00312 in >> tmp;
00313 }
00314 }
00315 for(int i=0;i<160;i++)
00316 {
00317 int board = i/32+1;
00318 int channel = i%32;
00319 int patch = channel/16;
00320 int m = mask[patch][board-1];
00321 int bit = channel-16*patch;
00322 FORMULATAG[crate-1][i/16] = formula[patch][board-1];
00323 for(int p = 0;p<6;p++)
00324 FORMULAPARAMETER[crate-1][i/16][p] = par[patch][board-1][p];
00325 BITCONV[crate-1][i/16] = bit6[patch][board-1];
00326 if( ((m>>bit) & 0x1)==1 ) TOWER[crate-1][i] = 1; else TOWER[crate-1][i] = 0;
00327 if(TOWER[crate-1][i] == 0) cout <<" Masked out channel "<<i<<" from crate "<<crate<<endl;
00328 }
00329 in.close();
00330 }
00331 else for(int i=0;i<160;i++) { BITCONV[crate-1][i/16]=0; TOWER[crate-1][i]=0;}
00332 }
00333
00334
00335 int first=-1;
00336 TString TSp = TS;
00337 TString timestamp=TSp(first+1,4);
00338 timestamp+="-";
00339 timestamp+=TSp(first+5,2);
00340 timestamp+="-";
00341 timestamp+=TSp(first+7,2);
00342 timestamp+=" ";
00343 timestamp+=TSp(first+10,2);
00344 timestamp+=":";
00345 timestamp+=TSp(first+12,2);
00346 timestamp+=":";
00347 timestamp+=TSp(first+14,2);
00348 cout <<"TS = "<<TS<<" TimeStamp = "<<timestamp<<endl;
00349
00350 int towerData[4800][8];
00351 for (int i = 0;i < 4800;i++) {
00352 for (int j = 0;j < 8;j++) {
00353 towerData[i][j] = 0;
00354 }
00355 }
00356 {
00357 cout << "Start writing " << bemcStatusCopy << endl;
00358 ofstream bemcStatusStream(bemcStatusCopy);
00359 bemcStatusStream << "##################################################################################" << endl;
00360 bemcStatusStream << "# This plain text file contains the complete BEMC trigger configuration" << endl;
00361 bemcStatusStream << "# Generated by the online BEMC trigger monitoring program on " << gSystem->HostName() << ":" << gSystem->WorkingDirectory() << endl;
00362 bemcStatusStream << "# Timestamp: " << timestamp << endl;
00363
00364 cout << "Creating StEmcDecoder..." << endl;
00365 StEmcDecoder *decoder = new StEmcDecoder();
00366 cout << "Decoder created " << decoder << endl;
00367
00368 for(int crate = 1;crate <= 30;crate++) {
00369 for(int tower = 0;tower < 160;tower++) {
00370 int softId;
00371 if (decoder && decoder->GetTowerIdFromCrate(crate, tower, softId)) {
00372 towerData[softId - 1][0] = TOWER[crate - 1][tower];
00373 towerData[softId - 1][3] = PED[crate - 1][tower];
00374 towerData[softId - 1][7] = PEDRMS[crate - 1][tower];
00375 towerData[softId - 1][4] = crate;
00376 towerData[softId - 1][5] = tower;
00377 }
00378 int triggerPatch;
00379 if (decoder && decoder->GetTriggerPatchFromCrate(crate, tower, triggerPatch)) {
00380 towerData[softId - 1][6] = triggerPatch;
00381 towerData[softId - 1][1] = HT[triggerPatch];
00382 towerData[softId - 1][2] = PA[triggerPatch];
00383 }
00384 }
00385 }
00386 bemcStatusStream << "#" << endl;
00387 bemcStatusStream << "# SoftId\tCrate\tCrate seq\tTower unmasked?\tPatch unmasked in HT?\tPatch unmasked in sum?\tPedestal\ttriggerPatch" << endl;
00388 for (int i = 0;i < 4800;i++) {
00389 bemcStatusStream << "SoftId " << (i + 1) << "\t" << towerData[i][4] << "\t" << towerData[i][5] << "\t" << towerData[i][0] << "\t" << towerData[i][1] << "\t" << towerData[i][2] << "\t" << (Float_t(towerData[i][3]) / 100.0) << "\t" << towerData[i][6] << endl;
00390 }
00391 bemcStatusStream << "#" << endl;
00392
00393 bemcStatusStream << "TriggerPedestalShift " << (float(PEDSHIFT)/100.0) << endl;
00394 bemcStatusStream << "#" << endl;
00395
00396 bemcStatusStream << "# triggerPatch\tCrate\tCrate patch\tUnmasked in HT?\tUnmasked in sum?\tBit conversion mode\tLUT formula and parameters" << endl;
00397 for(int crate = 1;crate <= 30;crate++) {
00398 for(int patch = 0;patch < 10;patch++) {
00399 int triggerPatch;
00400 if (decoder->GetTriggerPatchFromCrate(crate, patch*16, triggerPatch)) {
00401 bemcStatusStream << "triggerPatch " << triggerPatch << "\t" << crate << "\t" << patch << "\t";
00402 bemcStatusStream << HT[triggerPatch] << "\t";
00403 bemcStatusStream << PA[triggerPatch] << "\t";
00404 bemcStatusStream << BITCONV[crate-1][patch] << "\t";
00405 bemcStatusStream << FORMULATAG[crate-1][patch] << "\t";
00406 bemcStatusStream << FORMULAPARAMETER[crate-1][patch][0] << "\t";
00407 bemcStatusStream << FORMULAPARAMETER[crate-1][patch][1] << "\t";
00408 bemcStatusStream << FORMULAPARAMETER[crate-1][patch][2] << "\t";
00409 bemcStatusStream << FORMULAPARAMETER[crate-1][patch][3] << "\t";
00410 bemcStatusStream << FORMULAPARAMETER[crate-1][patch][4] << "\t";
00411 bemcStatusStream << FORMULAPARAMETER[crate-1][patch][5];
00412 bemcStatusStream << endl;
00413 }
00414 }
00415 }
00416
00417 cout << "Deleting decoder " << decoder << endl;
00418 if (decoder) delete decoder; decoder = 0;
00419 cout << "Decoder deleted " << decoder << endl;
00420
00421 bemcStatusStream << "# End of file" << endl;
00422 bemcStatusStream << "##################################################################################" << endl;
00423 bemcStatusStream.close();
00424 cout << "Finished writing " << bemcStatusCopy << endl;
00425 }
00426
00427 cout << "Started creating tables" << endl;
00428 St_emcTriggerPed *pedestals_t = new St_emcTriggerPed("bemcTriggerPed",1);
00429 St_emcTriggerStatus *status_t = new St_emcTriggerStatus("bemcTriggerStatus",1);
00430 St_emcTriggerLUT *lut_t = new St_emcTriggerLUT("bemcTriggerLUT",1);
00431 St_emcPed *ped_t = new St_emcPed("bemcPed",1);
00432 St_emcStatus *stat_t = new St_emcStatus("bemcStatus",1);
00433 emcTriggerPed_st* pedestals_st = pedestals_t ? pedestals_t->GetTable() : 0;
00434 emcTriggerStatus_st* status_st = status_t ? status_t->GetTable() : 0;
00435 emcTriggerLUT_st* lut_st = lut_t ? lut_t->GetTable() : 0;
00436 emcPed_st* ped_st = ped_t ? ped_t->GetTable() : 0;
00437 emcStatus_st* stat_st = stat_t ? stat_t->GetTable() : 0;
00438 cout << "Finished creating tables" << endl;
00439
00440 cout << "Started filling tables" << endl;
00441 if (pedestals_st) pedestals_st->PedShift = PEDSHIFT;
00442 for(int crate = 1;crate<=30;crate++) {
00443 for(int patch =0;patch<10;patch++) {
00444 if (pedestals_st) pedestals_st->BitConversionMode[crate-1][patch] = BITCONV[crate-1][patch];
00445 if (lut_st) {
00446 lut_st->FormulaTag[crate-1][patch] = FORMULATAG[crate-1][patch];
00447 lut_st->FormulaParameter0[crate-1][patch] = FORMULAPARAMETER[crate-1][patch][0];
00448 lut_st->FormulaParameter1[crate-1][patch] = FORMULAPARAMETER[crate-1][patch][1];
00449 lut_st->FormulaParameter2[crate-1][patch] = FORMULAPARAMETER[crate-1][patch][2];
00450 lut_st->FormulaParameter3[crate-1][patch] = FORMULAPARAMETER[crate-1][patch][3];
00451 lut_st->FormulaParameter4[crate-1][patch] = FORMULAPARAMETER[crate-1][patch][4];
00452 lut_st->FormulaParameter5[crate-1][patch] = FORMULAPARAMETER[crate-1][patch][5];
00453 }
00454 }
00455 for(int tower =0;tower<160;tower++) {
00456 if (pedestals_st) pedestals_st->Ped[crate-1][tower]=PED[crate-1][tower];
00457 if (status_st) status_st->TowerStatus[crate-1][tower]=TOWER[crate-1][tower];
00458 }
00459 }
00460 cout << "... filling tables" << endl;
00461 for(int patch=0;patch<300;patch++) {
00462 if (status_st) {
00463 status_st->PatchStatus[patch]=PA[patch];
00464 status_st->HighTowerStatus[patch]=HT[patch];
00465 }
00466 }
00467 cout << "... filling aux tables" << endl;
00468 for (int i = 0;i < 4800;i++) {
00469 ped_st->AdcPedestal[i] = towerData[i][3];
00470 ped_st->AdcPedestalRMS[i] = towerData[i][7];
00471 ped_st->Status[i] = towerData[i][0];
00472 stat_st->Status[i] = towerData[i][0];
00473 }
00474 cout << "Finished filling tables" << endl;
00475
00476 cout << "Creating StBemcTablesWriter ..." << endl;
00477 StBemcTablesWriter writer;
00478 cout << "Created StBemcTablesWriter" << endl;
00479 cout << "Loading tables ..." << endl;
00480 writer.loadTables(timestamp.Data());
00481 cout << "Loaded tables" << endl;
00482
00483 if(status && status_st) {
00484 cout << "Setting bemcTriggerStatus table " << status_st << endl;
00485 writer.setTable("bemcTriggerStatus", status_st);
00486 if(saveDB) {
00487 LOG_INFO << "Start uploading table bemcTriggerStatus" << endm;
00488 writer.writeToDb("bemcTriggerStatus", timestamp.Data());
00489 LOG_INFO << "Finished uploading table bemcTriggerStatus" << endm;
00490 }
00491 if(saveTables) {
00492 FILENAME = tables_dir; FILENAME += "/bemcTriggerStatus."; FILENAME+=TS; FILENAME+=".root";
00493 LOG_INFO << "Start saving table " << FILENAME << endm;
00494 writer.writeToFile(FILENAME.Data());
00495 LOG_INFO << "Finished saving table " << FILENAME << endm;
00496 }
00497 }
00498
00499 if(pedestal && pedestals_st) {
00500 cout << "Setting bemcTriggerPed table " << pedestals_st << endl;
00501 writer.setTable("bemcTriggerPed", pedestals_st);
00502 if(saveDB) {
00503 LOG_INFO << "Start uploading table bemcTriggerPed" << endm;
00504 writer.writeToDb("bemcTriggerPed", timestamp.Data());
00505 LOG_INFO << "Finished uploading table bemcTriggerPed" << endm;
00506 }
00507 if(saveTables) {
00508 FILENAME = tables_dir; FILENAME += "/bemcTriggerPed."; FILENAME+=TS; FILENAME+=".root";
00509 LOG_INFO << "Start saving table " << FILENAME << endm;
00510 writer.writeToFile(FILENAME.Data());
00511 LOG_INFO << "Finished saving table " << FILENAME << endm;
00512 }
00513 }
00514
00515 if(lut && lut_st) {
00516 cout << "Setting bemcTriggerLUT table " << lut_st << endl;
00517 writer.setTable("bemcTriggerLUT", lut_st);
00518 if(saveDB) {
00519 LOG_INFO << "Start uploading table bemcTriggerLUT" << endm;
00520 writer.writeToDb("bemcTriggerLUT", timestamp.Data());
00521 LOG_INFO << "Finished uploading table bemcTriggerLUT" << endm;
00522 }
00523 if(saveTables) {
00524 FILENAME = tables_dir; FILENAME += "/bemcTriggerLUT."; FILENAME+=TS; FILENAME+=".root";
00525 LOG_INFO << "Start saving table " << FILENAME << endm;
00526 writer.writeToFile(FILENAME.Data());
00527 LOG_INFO << "Finished saving table " << FILENAME << endm;
00528 }
00529 }
00530
00531 if(statusOffline && stat_st) {
00532 cout << "Setting bemcStatus table " << stat_st << endl;
00533 writer.setTable("bemcStatus", stat_st);
00534 if(saveDB) {
00535 LOG_INFO << "Start uploading table bemcStatus" << endm;
00536 writer.writeToDb("bemcStatus", timestamp.Data());
00537 LOG_INFO << "Finished uploading table bemcStatus" << endm;
00538 }
00539 if(saveTables) {
00540 FILENAME = tables_dir; FILENAME += "/bemcStatus."; FILENAME+=TS; FILENAME+=".root";
00541 LOG_INFO << "Start saving table " << FILENAME << endm;
00542 writer.writeToFile(FILENAME.Data());
00543 LOG_INFO << "Finished saving table " << FILENAME << endm;
00544 }
00545 }
00546
00547 if(pedestalOffline && ped_st) {
00548 cout << "Setting bemcPed table " << ped_st << endl;
00549 writer.setTable("bemcPed", ped_st);
00550 if(saveDB) {
00551 LOG_INFO << "Start uploading table bemcPed" << endm;
00552 writer.writeToDb("bemcPed", timestamp.Data());
00553 LOG_INFO << "Finished uploading table bemcPed" << endm;
00554 }
00555 if(saveTables) {
00556 FILENAME = tables_dir; FILENAME += "/bemcPed."; FILENAME+=TS; FILENAME+=".root";
00557 LOG_INFO << "Start saving table " << FILENAME << endm;
00558 writer.writeToFile(FILENAME.Data());
00559 LOG_INFO << "Finished saving table " << FILENAME << endm;
00560 }
00561 }
00562 }
00563