1 #ifndef L2VirtualAlgo2009_h
2 #define L2VirtualAlgo2009_h
15 #define rdtscl_macro(low) \
16 __asm__ __volatile__("rdtsc" : "=a" (low) : : "edx")
18 #define rdtsc_macro(low,high) \
19 __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
23 #include "L2eventStream2009.h"
29 enum EmcSwitch { kIsBad=0, kIsBtow, kIsEtow, kIsB_Etow };
34 enum {kMaximumNumberOfDsmMasks=4};
37 unsigned short DsmMask[kMaximumNumberOfDsmMasks][8];
42 std::string mOutDir1, mName1;
44 FILE *mLogFile, *mHistFile;
59 bool mAccept, mRandomAccept;
65 int mRndAcceptCounter;
66 int par_RndAcceptPrescale;
73 enum {par_cpuTicksPerSecond=1600000000};
74 unsigned long mComputeTimeStart, mComputeTimeStop, mComputeTimeDiff[L2eventStream2009::mxToken];
75 unsigned long mDecisionTimeStart, mDecisionTimeStop, mDecisionTimeDiff;
76 unsigned long long mRunStartTicks;
80 void setMaxHist(
int k) {
82 criticalError(
"setMaxHist called with negative argument.");
86 memset(hA,0,mxHA*
sizeof(
L2Histo*));
88 int finishCommonHistos();
91 void computeStop(
int token);
92 unsigned short swap_bytes(
unsigned short in);
97 void setOflTrigID(
int x) {oflTrigId=x;}
98 int getOflTrigID() {
return oflTrigId;}
99 bool isAccepted(){
return mAccept; }
100 static int readParams(
const char *fileN,
int mxPar,
int *iPar,
float *fPar);
101 const char *getName() {
return mName1.c_str();}
103 int initRun(
int runNo,
int *rc_ints,
float *rc_floats);
104 void compute (
int token);
105 bool decision(
int token,
bool barrel_is_in,
bool endcap_is_in,
int *myL2Result);
107 bool checkDsmMask(
unsigned short *lastDSM);
108 int readDsmMask(
const char *fileN);
111 virtual int initRunUser(
int runNo,
int *rc_ints,
float *rc_floats){
return 0;}
112 virtual void computeUser(
int token){};
113 virtual bool decisionUser(
int token,
int *myL2Result){
return true;}
114 virtual void finishRunUser(){}
117 void printCalibratedData(
int token);
119 void criticalError(
const char* message);