27 bool processFile(
char* line,
char* dir)
30 cout <<
"Processing file "<<line<<endl;
31 emcIo->createEvPool(line,dir);
40 istat = emcIo->Make();
43 for(
int i=0;i<4;i++)
if(ped[i]) NE[i] = ped[i]->getNEvents();
44 if(nEventsProc%100==0)
48 cout <<
"Event " << nEventsProc << endl;
50 if(dbMk) dbMk->
Make();
51 if(calib) calib->
Make();
53 bool HASPROCESSED =
false;
59 if(ped[i]->getNEvents()>NE[i]) HASPROCESSED =
true;
60 if(ped[i]->getNEvents()>=(NEVENTS+10)) ok[i] =
true;
62 if(!ok[i]) DONE=
false;
66 if(!HASPROCESSED) NP++;
else NP = 0;
69 cout <<
"Skiping this file. No bemc data have been processed for more than 50 events\n";
72 if ((nEventsProc % 100) == 0) memory.PrintMem(0);
75 }
while(istat==0 || istat==1);
83 void makeOnlinePed(
char* list =
"./runlist.txt",
bool isList =
true) {
86 cout <<
"Started: " << startTime.AsSQLString() << endl;
90 const Char_t *EVP_READER_LIB = gSystem->Getenv(
"EVP_READER_LIB");
91 TString dirStr = gSystem->Getenv(
"EVP_DIR");
92 TString savePathStr = gSystem->Getenv(
"EMCONLINE_PED_BACKUP_DIR");
93 TString tablesPathStr = gSystem->Getenv(
"EMCONLINE_PED_TABLES_DIR");
94 TString lastTablePathStr = gSystem->Getenv(
"EMCONLINE_PED_LASTTABLES_DIR");
95 TString tempPathStr = gSystem->Getenv(
"EMCONLINE_PED_TEMP_DIR");
96 TString pedCrateFilenameFormatStr = gSystem->Getenv(
"CRATE_PEDESTAL_FILES_FORMAT");
97 TString bemcStatusStr = gSystem->Getenv(
"EMCONLINE_PED_BEMCSTATUS_FILE");
99 TString neventsStr = gSystem->Getenv(
"EMCONLINE_PED_NEVENTS");
100 Int_t nevents = neventsStr.Atoi();
101 TString saveDbStr = gSystem->Getenv(
"EMCONLINE_PED_SAVEDB");
102 Bool_t saveDb = (saveDbStr ==
"true");
103 TString saveTablesStr = gSystem->Getenv(
"EMCONLINE_PED_SAVETABLES");
104 Bool_t saveTables = (saveTablesStr ==
"true");
105 TString compareLastTableDBStr = gSystem->Getenv(
"EMCONLINE_PED_COMPARELASTTABLEDB");
106 Bool_t compareLastTableDB = (compareLastTableDBStr ==
"true");
107 TString useBemcStatusStr = gSystem->Getenv(
"EMCONLINE_PED_USEBEMCSTATUS");
108 Bool_t useBemcStatus = (useBemcStatusStr ==
"true");
111 TString minPedDiffDBStr_BTOW = gSystem->Getenv(
"EMCONLINE_PED_MINPEDDIFFDB_BTOW");
112 Float_t minPedDiffDB_BTOW = minPedDiffDBStr_BTOW.Atof();
113 TString minPedDiffNumStr_BTOW = gSystem->Getenv(
"EMCONLINE_PED_MINPEDDIFFNUM_BTOW");
114 Int_t minPedDiffNum_BTOW = minPedDiffNumStr_BTOW.Atoi();
115 TString minPedDiffMinTimeStr_BTOW = gSystem->Getenv(
"EMCONLINE_PED_MINPEDDIFFMINTIME_BTOW");
116 Float_t minPedDiffMinTime_BTOW = minPedDiffMinTimeStr_BTOW.Atof();
119 TString minPedDiffDBStr_BPRS = gSystem->Getenv(
"EMCONLINE_PED_MINPEDDIFFDB_BPRS");
120 Float_t minPedDiffDB_BPRS = minPedDiffDBStr_BPRS.Atof();
121 TString minPedDiffNumStr_BPRS = gSystem->Getenv(
"EMCONLINE_PED_MINPEDDIFFNUM_BPRS");
122 Int_t minPedDiffNum_BPRS = minPedDiffNumStr_BPRS.Atoi();
123 TString minPedDiffMinTimeStr_BPRS = gSystem->Getenv(
"EMCONLINE_PED_MINPEDDIFFMINTIME_BPRS");
124 Float_t minPedDiffMinTime_BPRS = minPedDiffMinTimeStr_BPRS.Atof();
127 TString minPedDiffDBStr_BSMD = gSystem->Getenv(
"EMCONLINE_PED_MINPEDDIFFDB_BSMD");
128 Float_t minPedDiffDB_BSMD = minPedDiffDBStr_BSMD.Atof();
129 TString minPedDiffNumStr_BSMD = gSystem->Getenv(
"EMCONLINE_PED_MINPEDDIFFNUM_BSMD");
130 Int_t minPedDiffNum_BSMD = minPedDiffNumStr_BSMD.Atoi();
131 TString minPedDiffMinTimeStr_BSMD = gSystem->Getenv(
"EMCONLINE_PED_MINPEDDIFFMINTIME_BSMD");
132 Float_t minPedDiffMinTime_BSMD = minPedDiffMinTimeStr_BSMD.Atof();
135 gSystem->Load(EVP_READER_LIB);
136 gSystem->Load(
"St_base");
137 gSystem->Load(
"St_Tables");
138 gSystem->Load(
"StUtilities");
139 gSystem->Load(
"StChain");
140 gSystem->Load(
"StEvent");
141 gSystem->Load(
"StDbLib");
142 gSystem->Load(
"StDbBroker");
143 gSystem->Load(
"St_db_Maker");
144 gSystem->Load(
"StDaqLib");
145 gSystem->Load(
"StEmcUtil");
146 gSystem->Load(
"StEmcOnlineUtil");
147 gSystem->Load(
"StEmcCalibrationMaker");
152 cout <<
"Backup directory: " << savePathStr << endl;
153 cout <<
"Backup tables directory: " << tablesPathStr << endl;
154 cout <<
"Last tables directory: " << lastTablePathStr << endl;
155 cout <<
"Temp directory: " << tempPathStr << endl;
156 cout <<
"Event pool: " << dirStr << endl;
157 cout <<
"bemcStatus.txt: " << bemcStatusStr << endl;
158 cout <<
"Number of events to process: " << NEVENTS << endl;
159 cout <<
"Save tables to DB: " << saveDb << endl;
160 cout <<
"Save tables locally: " << saveTables << endl;
161 cout <<
"Compare to the last saved table: " << compareLastTableDB << endl;
162 cout <<
"Use bemcStatus.txt: " << useBemcStatus << endl;
163 cout <<
"Ped crate filename format: " << pedCrateFilenameFormatStr << endl;
164 cout <<
"BTOW:" << endl;
165 cout <<
"Min ped diff from the last table: " << minPedDiffDB_BTOW << endl;
166 cout <<
"Min ped diff num from the last table: " << minPedDiffNum_BTOW << endl;
167 cout <<
"Min time from the last table: " << minPedDiffMinTime_BTOW << endl;
168 cout <<
"BPRS:" << endl;
169 cout <<
"Min ped diff from the last table: " << minPedDiffDB_BPRS << endl;
170 cout <<
"Min ped diff num from the last table: " << minPedDiffNum_BPRS << endl;
171 cout <<
"Min time from the last table: " << minPedDiffMinTime_BPRS << endl;
172 cout <<
"BSMD:" << endl;
173 cout <<
"Min ped diff from the last table: " << minPedDiffDB_BSMD << endl;
174 cout <<
"Min ped diff num from the last table: " << minPedDiffNum_BSMD << endl;
175 cout <<
"Min time from the last table: " << minPedDiffMinTime_BSMD << endl;
178 chain =
new StChain(
"StChain");
181 emcIo =
new StEmcOnl();
185 dbMk =
new St_db_Maker(
"StarDb",
"$STAR/StarDb",
"MySQL:StarDb");
190 TString name[] = {
"bemcPed",
"bprsPed",
"bsmdePed",
"bsmdpPed"};
195 ped[i]->setDetector(i+1);
196 TString filename = tempPathStr +
"/" + name[i] +
".root";
197 ped[i]->setFile(filename);
198 ped[i]->setNPedEvents(NEVENTS);
199 ped[i]->setPedInterval(24*100);
200 ped[i]->setRange(300);
201 ped[i]->setAutoSaveDB(saveDb);
203 ped[i]->setSavePath(savePathStr.Data());
204 ped[i]->setTablesPath(tablesPathStr.Data());
205 ped[i]->setLastTablePath(lastTablePathStr.Data());
206 ped[i]->setSaveTables(saveTables);
207 ped[i]->setCompareLastTableDB(compareLastTableDB);
208 ped[i]->setPedCrateFilenameFormat(pedCrateFilenameFormatStr.Data());
209 ped[i]->setBemcStatusFilename(bemcStatusStr.Data());
210 ped[i]->setUseBemcStatus(useBemcStatus);
212 ped[i]->setPedDiffSaveDB(minPedDiffDB_BTOW);
213 ped[i]->setPedDiffSaveNum(minPedDiffNum_BTOW);
214 ped[i]->setPedDiffSaveMinTime(minPedDiffMinTime_BTOW);
216 ped[i]->setPedDiffSaveDB(minPedDiffDB_BPRS);
217 ped[i]->setPedDiffSaveNum(minPedDiffNum_BPRS);
218 ped[i]->setPedDiffSaveMinTime(minPedDiffMinTime_BPRS);
219 }
else if ((i == 2) || (i == 3)) {
220 ped[i]->setPedDiffSaveDB(minPedDiffDB_BSMD);
221 ped[i]->setPedDiffSaveNum(minPedDiffNum_BSMD);
222 ped[i]->setPedDiffSaveMinTime(minPedDiffMinTime_BSMD);
233 ifstream INPUT(list);
238 bool isDone = processFile(line,dirStr.Data());
239 if(isDone)
goto EXIT;
242 else processFile(list,dirStr.Data());
250 cout <<
"Finished: " << stopTime.AsSQLString() << endl;
virtual void Clear(Option_t *option="")
User defined functions.