StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
L2adc2energyAlgo.h
1 #ifndef L2adc2energy_H
2 #define L2adc2energy_H
3 /*********************************************************************
4  * $Id: L2adc2energyAlgo.h,v 1.1 2007/11/19 22:18:25 balewski Exp $
5  * \author Jan Balewski, IUCF, 2006
6  *********************************************************************
7  * Descripion:
8  * Reco of mono- & di-jets in L2 using BTOW+ETOW
9  *********************************************************************
10  */
11 
12 
13 class L2Histo;
14 #ifdef IS_REAL_L2 //in l2-ana environmen
15  #include "L2VirtualAlgo.h"
16 #else
17  #include "StTriggerUtilities/L2Emulator/L2algoUtil/L2VirtualAlgo.h"
18 #endif
19 
21  public:
22  /* usefull dimensions */
23 #define MaxBtowRdo (L2EmcDb::BTOW_MAXFEE*L2EmcDb::BTOW_DATSIZE)
24 #define MaxEtowRdo (L2EmcDb::ETOW_MAXFEE*L2EmcDb::ETOW_DATSIZE)
25 
26  enum {cl2jetMaxEtaBins=15, cl2jetMaxPhiBins=30};
27 
28  /* enum below defines L2 jet 0.6x0.6 size
29  WARN: do NOT change it w/o understaning of
30  ScanEta/phi-algos algo,JB */
31  enum {cl2jet_par_mxPhiBin=3, cl2jet_par_mxEtaBin=3};
32  private:
33 
34  //................. params set in constructor
35  float par_maxADC;
36  float par_maxEt;
37  unsigned short par_adcMask,par_pedOff;
38  int par_hotTwEtThr; // only monitoring
39 
40  //..................... params set in initRun
41  int par_useBtowEast;
42  int par_useBtowWest;
43  int par_useEndcap;
44  int par_minPhiBinDiff;
45  int par_cutTag;
46  float par_energyScale;
47  float par_diJetThrHigh;
48  float par_diJetThrLow;
49  float par_oneJetThr;
50  float par_rndAccProb;
51  int par_rndAccThr;
52  int par_dbg;
53  int *raw_ints;
54  float *raw_floats;
55 
56  //.............run-long variables
57  enum { mxHA=128, mxJ=2};
58  L2Histo *hA[mxHA]; // my private HBOOK@L2
59  long run_startUnix;
60  int run_number;
61 
62  // event counters
63  int run_nEventOneJet, run_nEventDiJet, run_nEventRnd;
64 
65  /* fast DB lookup tables */
66  unsigned short db_btowThr[MaxBtowRdo];
67  unsigned short db_btowPedS[MaxBtowRdo]; // ped offset, similar to DSM
68  unsigned short db_btowGainCorr[MaxBtowRdo];
69  unsigned short db_btowL2PhiBin[MaxBtowRdo];
70  unsigned short db_btowL2PatchBin[MaxBtowRdo];
71 
72  // similar tables for ETOW ....
73  unsigned short db_etowThr[MaxEtowRdo];
74  unsigned short db_etowPedS[MaxEtowRdo];// ped offset, similar to DSM
75  unsigned short db_etowGainCorr[MaxEtowRdo];
76  unsigned short db_etowL2PhiBin[MaxEtowRdo];
77  unsigned short db_etowL2PatchBin[MaxEtowRdo];
78 
79 
80  //............... event-long variables
81  int eve_ID;
82  int eve_patchEne[cl2jetMaxEtaBins*cl2jetMaxPhiBins];
83  int eve_phiEne[cl2jetMaxPhiBins+cl2jet_par_mxPhiBin-1];
84 
85  // utility methods
86  void createHisto();
87  void clearEvent();
88  int projectAdc( unsigned short *rawAdc, int nRdo,
89  unsigned short *thr, unsigned short *ped, unsigned short *gainCorr,
90  unsigned short *phiBin, unsigned short *patchBin,
91  L2Histo *hHot );
92 
93 
94  void dumpPatchEneA();
95  void finishRunHisto();
96  bool paramsChanged( int *rc_ints, float *rc_floats);
97 
98  public:
99  L2adc2energyAlgo(const char* name, L2EmcDb* db, char* outDir, int resOff);
100  // ~L2adc2energyAlgo(){}; // memory leak NOT taken care of
101  int initRun( int runNo, int *rc_ints, float *rc_floats);
102  bool doEvent(int L0trg, int inpEveId, TrgDataType* trgData, // for every event
103  int bemcIn, unsigned short *bemcData,
104  int eemcIn, unsigned short *eemcData);
105  void finishRun();// at the end of each run
106 };
107 
108 #endif
109 
110 /**********************************************************************
111  $Log: L2adc2energyAlgo.h,v $
112  Revision 1.1 2007/11/19 22:18:25 balewski
113  most L2algos provide triggerID's
114 
115 
116 */
117