1 #ifndef L2VirtualAlgo2012_h
2 #define L2VirtualAlgo2012_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 "L2eventStream2012.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, muid;
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[L2eventStream2012::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() {
102 return mName1.c_str();
105 int initRun(
int runNo,
int *rc_ints,
float *rc_floats);
106 void compute (
int token);
107 bool decision(
int token,
bool barrel_is_in,
bool endcap_is_in,
int *myL2Result);
109 bool checkDsmMask(
unsigned short *lastDSM);
110 int readDsmMask(
const char *fileN);
113 virtual int initRunUser(
int runNo,
int *rc_ints,
float *rc_floats){
return 0;}
114 virtual void computeUser(
int token){};
115 virtual bool decisionUser(
int token,
int *myL2Result){
return true;}
116 virtual void finishRunUser(){}
119 void printCalibratedData(
int token);
121 void criticalError(
const char* message);