StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
L2VirtualAlgo2006.h
1 #ifndef L2VirtualAlgo2006_h
2 #define L2VirtualAlgo2006_h
3 
4 
5 /***************************************************************
6  * $Id: L2VirtualAlgo2006.h,v 1.1 2008/02/10 03:28:24 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  /* usefull dimensions */
20 #define MaxBtowRdo (L2EmcDb::BTOW_MAXFEE*L2EmcDb::BTOW_DATSIZE)
21 #define MaxEtowRdo (L2EmcDb::ETOW_MAXFEE*L2EmcDb::ETOW_DATUSED)
22 
23 #ifdef IS_REAL_L2 //in l2-ana environmen, to allow write, dropped in 2008
24  #include "trgStructures.h"
25 #else
26  #include "StDaqLib/TRG/trgStructures.h"
27 #endif
28 
29 class L2EmcDb;
30 class L2Histo;
32  enum {mxTxt=1000};
33  protected:
34  char mName[mxTxt];
35  char mOutDir[mxTxt];
36  L2EmcDb* mDb;
37  FILE *mLogFile, *mHistFile;
38  int mResultOffset;
39  int oflTrigId;
40  bool mAccept;
41  unsigned long mEveTimeStart, mEveTimeStop,mEveTimeDiff;
42  void finishCommonHistos();
43  L2Histo *mhT, *mhN;
44  int mEventsInRun;
45  public:
46  void setOflTrigID(int x) {oflTrigId=x;}
47  int getOflTrigID() {return oflTrigId;}
48  bool isAccepted(){ return mAccept; }
49  bool accepted() { return mAccept; } // obsolete
50  const char *getName(){ return mName; }
51  L2VirtualAlgo2006(const char* name, L2EmcDb* db, char* outDir, int resOff);
52  virtual ~L2VirtualAlgo2006()=0; // memory leak NOT taken care off
53  virtual int initRun(int runNo, int *rc_ints, float *rc_floats)=0;
54  // 2006 version
55  virtual bool doEvent(int L0trg, int inpEveId, TrgDataType* trgData,
56  int bemcIn, unsigned short *bemcData,
57  int eemcIn, unsigned short *eemcData)=0;
58 
59  virtual void finishRun()=0;// at the end of each run
60  static int readParams(const char *fileN, int mxPar, int *iPar, float *fPar);
61  const char* name() const { return mName; }
62 };
63 
64 
65 #endif