StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
L2VirtualAlgo.h
1 #ifndef L2VirtualAlgo_h
2 #define L2VirtualAlgo_h
3 
4 
5 /***************************************************************
6  * $Id: L2VirtualAlgo.h,v 1.11 2008/01/30 15:09:35 balewski Exp $
7  * \author Jan Balewski, IUCF, 2006
8  ***************************************************************
9  * Descripion:
10  * all actual L2 algos should inherit from it the 4 methods
11  ***************************************************************
12  */
13 
14 //#include "/asm-i386/msr.h" /* for rdtscl */
15 // Great suggestion from Pibero, to use ASM macro directly
16 #define rdtscl_macro(low) \
17  __asm__ __volatile__("rdtsc" : "=a" (low) : : "edx")
18 
19 #ifdef IS_REAL_L2 //in l2-ana environmen
20  #include "trgStructures.h"
21 #else
22  #include "StDaqLib/TRG/trgStructures.h"
23 #endif
24 
25 class L2EmcDb;
26 class L2Histo;
28  enum {mxTxt=1000};
29  protected:
30  char mName[mxTxt];
31  char mOutDir[mxTxt];
32  L2EmcDb* mDb;
33  FILE *mLogFile, *mHistFile;
34  int mResultOffset;
35  int oflTrigId;
36  bool mAccept;
37  unsigned long mEveTimeStart, mEveTimeStop,mEveTimeDiff;
38  void finishCommonHistos();
39  L2Histo *mhT, *mhN;
40  int mEventsInRun;// run_nEventIn,
41  public:
42  void setOflTrigID(int x) {oflTrigId=x;}
43  int getOflTrigID() {return oflTrigId;}
44  bool isAccepted(){ return mAccept; }
45  bool accepted() { return mAccept; } // obsolete
46  const char *getName(){ return mName; }
47  L2VirtualAlgo(const char* name, L2EmcDb* db, char* outDir, int resOff);
48  virtual ~L2VirtualAlgo()=0; // memory leak NOT taken care off
49  virtual int initRun(int runNo, int *rc_ints, float *rc_floats)=0;
50  // 2006 version
51  virtual bool doEvent(int L0trg, int inpEveId, TrgDataType* trgData,
52  int bemcIn, unsigned short *bemcData,
53  int eemcIn, unsigned short *eemcData)=0;
54 
55  virtual void finishRun()=0;// at the end of each run
56  static int readParams(const char *fileN, int mxPar, int *iPar, float *fPar);
57  const char* name() const { return mName; }
58 };
59 
60 
61 #endif