4 #ifdef IS_REAL_L2 //in l2-ana environment
5 #include "../L2algoUtil/L2Histo.h"
6 #include "trgStructures.h"
8 #include "StDaqLib/TRG/trgStructures.h"
9 #include "StTriggerUtilities/L2Emulator/L2algoUtil/L2Histo.h"
12 #include "L2VirtualAlgo2006.h"
14 L2VirtualAlgo2006::L2VirtualAlgo2006(
const char* name,
L2EmcDb* db,
char* outDir,
int resOff) : mDb(db), mResultOffset(resOff) {
15 strncpy(mName, name,
sizeof(mName));
16 strncpy(mOutDir,outDir,
sizeof(mOutDir));
18 mhT=
new L2Histo(901,
"L2 time used per input event; x: time (CPU kTics); y: events ",400);
23 L2VirtualAlgo2006::finishCommonHistos() {
25 int iMax=-3, iFWHM=-4;
26 mhT->findMax( &iMax, &iFWHM);
27 printf(
"L2:%s CPU/eve MPV %d kTicks, FWHM=%d, seen eve=%d\n",mName,iMax, iFWHM,mEventsInRun);
29 if (mLogFile==0)
return;
30 fprintf(mLogFile,
"L2:%s CPU/eve MPV %d kTicks, FWHM=%d, seen eve=%d\n",mName,iMax, iFWHM,mEventsInRun);
31 mhT->print(0,mLogFile);
34 if (mHistFile) mhT->write(mHistFile);
39 L2VirtualAlgo2006::~L2VirtualAlgo2006(){};
43 L2VirtualAlgo2006::readParams(
const char *fileN,
int mxPar,
int *iPar,
float *fPar) {
49 memset(iPar,0,mxPar*
sizeof(
int));
50 memset(fPar,0,mxPar*
sizeof(
int));
51 FILE *fd=fopen(fileN,
"r");
52 if(fd==0) { printf(
" L2VirtualAlgo2006::readParams failed to open =%s=\n",fileN);
return -2222;}
62 char * ret=fgets(buf,mx,fd);
65 if(buf[0]==0)
continue;
66 if(buf[0]==
'#')
continue;
67 if(buf[0]==
'\n')
continue;
69 if (mode==0 && strstr(buf,
"INTS")) { mode=1;
continue; }
70 if (mode==1 && strstr(buf,
"FLOATS")) { mode=2;
continue; }
73 if(nInt>=mxPar) {nVal=-501;
break;}
74 int ret1=sscanf(buf,
"%i",iPar+nInt);
75 if(ret1!=1) {nVal=-100*mode -nInt;
break;}
79 if(nFloat>=mxPar) {nVal=-502;
break;}
80 int ret1=sscanf(buf,
"%f",fPar+nFloat);
81 if(ret1!=1) {nVal= -100*mode -nFloat;
break;}
88 printf(
" L2VirtualAlgo2006::readParams %d from '%s'\n",nVal,fileN);