StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
L2jetAlgo2006.h
1 #ifndef L2JETALGO2006_H
2 #define L2JETALGO2006_H
3 /*********************************************************************
4  * $Id: L2jetAlgo2006.h,v 1.1 2007/11/19 22:18:28 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 
20 class L2jetAlgo2006 : public L2VirtualAlgo {
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  class L2Jet {
80  public:
81  /* Note, some variables below are NOT in physical units,
82  this is tricky, be carefull
83  */
84  int iphiBin; // phi-bin location of _left_edge_
85  float fphiBin; // phi-bin location of _centroid_
86  int ietaBin; // eta-bin location of _left_edge_
87  float fetaBin; // eta-bin location of _centroid_
88  int iene; // int4 transverse energy
89  float phiRad; // phi in radians, energy weighted
90  float eneGeV; // energy in GeV
91 
92  L2Jet(){}; // compact jet holder
93  void clear(){
94  iphiBin=ietaBin=iene=0;
95  fphiBin=fetaBin=phiRad=eneGeV=0.;
96  }
97  };
98 
99  //............... event-long variables
100  TrgDataType* eve_TrigData;
101  int eve_ID;
102  int eve_patchEne[cl2jetMaxEtaBins*cl2jetMaxPhiBins];
103  int eve_phiEne[cl2jetMaxPhiBins+cl2jet_par_mxPhiBin-1];
104  L2Jet * eve_Jet[mxJ];
105 
106  // utility methods
107  void createHisto();
108  void clearEvent();
109  int projectAdc( unsigned short *rawAdc, int nRdo,
110  unsigned short *thr, unsigned short *ped, unsigned short *gainCorr,
111  unsigned short *phiBin, unsigned short *patchBin,
112  L2Histo *hHot );
113  int scanPhi();
114  void scanEta(int iJ);//int iphi0, int *etaEneA, float *fetaBinMax, int *eneMax ,int *ietaBinLeft);
115  void weightedPhi(int iJ);
116  void dumpPatchEneA();
117  void finishRunHisto();
118  bool paramsChanged( int *rc_ints, float *rc_floats);
119 
120  public:
121  L2jetAlgo2006(const char* name, L2EmcDb* db, char* outDir, int resOff);
122  // ~L2jetAlgo2006(){}; // memory leak NOT taken care of
123  int initRun( int runNo, int *rc_ints, float *rc_floats);
124  bool doEvent(int L0trg, int inpEveId, TrgDataType* trgData, // for every event
125  int bemcIn, unsigned short *bemcData,
126  int eemcIn, unsigned short *eemcData);
127  void finishRun();// at the end of each run
128 };
129 
130 #endif
131 
132 /**********************************************************************
133  $Log: L2jetAlgo2006.h,v $
134  Revision 1.1 2007/11/19 22:18:28 balewski
135  most L2algos provide triggerID's
136 
137  Revision 1.6 2007/11/14 03:58:14 balewski
138  cleanup of common timing measurement
139 
140  Revision 1.5 2007/11/13 23:06:07 balewski
141  toward more unified L2-algos
142 
143  Revision 1.4 2007/11/08 04:02:31 balewski
144  run on l2ana as well
145 
146  Revision 1.3 2007/11/02 03:03:47 balewski
147  modified L2VirtualAlgo
148 
149  Revision 1.2 2007/10/25 02:07:03 balewski
150  added L2upsilon & binary event dump
151 
152  Revision 1.1 2007/10/11 00:33:20 balewski
153  L2algo added
154 
155  Revision 1.7 2006/03/28 19:46:49 balewski
156  ver16b, in l2new
157 
158  Revision 1.6 2006/03/11 17:08:33 balewski
159  now CVS comments should work
160 
161 */
162