StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
L2hienAlgo09.h
1 #ifndef L2hienAlgo09_H
2 #define L2hienAlgo09_H
3 /*****************************************************
4  * $Id: L2hienAlgo09.h,v 1.1 2011/09/22 20:44:13 pibero Exp $
5  * \author Jan Balewski, MIT, 2008
6  *****************************************************
7 Descripion:
8 this algo selects high-energy towers from BTOW & ETOW data
9  and take advantage of common calibration to be deployed
10  at L2 in February of 2008.
11 The common (for B & E) ADC threshold is defined
12  in units of adc above ped i.e. in ET.
13 The output of this algo _one_ lists of pairs {adc,softID}.
14 You need 2 instances of this ago to cover E & B-EMC.
15 Saving of those lists to disk is beyond the scope of this algo.
16 SoftID is defined as follows:
17 *BTOW : traditional softID [1-4800] used since 20th centry.
18 *ETOW: range [0..719], eta index changes slower
19  int ieta= (x->eta-1);
20  int iphi= (x->sec-1)*EtowGeom::mxSubs + x->sub-'A' ;
21  int softId= iphi+EtowGeom::mxPhiBin*ieta;
22 
23 There is a hardcoded limit on the max list length at 256 towers.
24 In case of an overflow a random (not realy) selection of towers will be added to the list until the software limit is reached.
25 ******************************************************
26 */
27 
28 #ifdef IS_REAL_L2 //in l2-ana environmen
29  #include "L2VirtualAlgo2009.h"
30 #else
31  #include "StTriggerUtilities/L2Emulator/L2algoUtil/L2VirtualAlgo2009.h"
32 #endif
33 
34 #include "L2hienResult2009.h"
35 
36 class L2hienAlgo09 ;
37 class L2Histo;
38 class L2EmcGeom;
39 
40 // remember to clear in initRun() to avoid stale data
41 class L2hienList09 {// WARN : all sits in RAM x 4096 tokens!
42  public:
43  enum {mxListSize=150}; // keep this size small
44  enum {kDataFresh=0}; // if used 1 or more times data are stale
45  private:
46  friend class L2hienAlgo09 ;
47  int isFresh; // for QA
48  int size;// # of elements on the list below
49  unsigned int value[mxListSize]; //list, not cleared
50 };
51 
52 //-------------------------------
54  /* this class fills the folowing bins
55  of counter histo (mhN), see also L2VirtualAlgo2008.h
56  5 - # of eve w/ overflow # of towers, in decision() input
57  6 - # of eve w/ STALE data - very bad, in decision() input
58 
59  */
60  public:
61  // shortcuts
62  enum {mxBtow=(BtowGeom::mxEtaBin) * (BtowGeom::mxPhiBin)};
63  enum {mxEtow=(EtowGeom::mxEtaBin) * (EtowGeom::mxPhiBin)};
64  private:
65  //..................... params set in initRun
66  int par_dbg;
67  int par_maxList;
68  int par_adcThres; // in ADC counts above peds
69 
70  //................... BTOW lookup tables
71  int mRdo2towerID_B[mxBtow];
72  int mTowerID2etaBin_B[mxBtow]; // for QA only
73  int mTowerID2phiBin_B[mxBtow]; // for QA only
74 
75  //................... ETOW lookup tables
76  int mRdo2towerID_E[mxEtow];
77  int mTowerID2etaBin_E[mxEtow]; // for QA only
78  int mTowerID2phiBin_E[mxEtow]; // for QA only
79 
80  //---- event-long variables changed by COMPUTE() -----
81  //............... preserved for Decision(),
82  L2hienList09 mHiEnTw[L2eventStream2009::mxToken]; //it is a lot of RAM!
83  L2hienResult2009 mHienResult[L2eventStream2009::mxToken]; //so is this!
84  // add similar for the endcap
85 
86  // utility methods
87  void createHisto();
88 
89  public:
90  L2hienAlgo09(const char* name, L2EmcDb* db, L2EmcGeom *geo, char* outDir, int resOff, L2VirtualAlgo2009::EmcSwitch beSwitch);
91  int initRunUser( int runNo, int *rc_ints, float *rc_floats);
92  void finishRunUser();// at the end of each run
93  void computeUser(int token);
94  bool decisionUser(int token, int *myL2Result);//only QA
95  // expert only, to export high towers
96  int getListSize(int token) { return mHiEnTw[token].size;}
97  const unsigned int *getListData(int token) { return mHiEnTw[token].value;}
98 
99  void print2(int token);
100 
101 };
102 
103 #endif
104 
105 /****************************************************
106  $Log: L2hienAlgo09.h,v $
107  Revision 1.1 2011/09/22 20:44:13 pibero
108  *** empty log message ***
109 
110  Revision 1.3 2008/02/01 00:16:44 balewski
111  add mxListSize to BTOW/ETOW calibration
112 
113  Revision 1.2 2008/01/30 21:56:43 balewski
114  E+B high-enery-filter L2-algo fuly functional
115 
116  Revision 1.1 2008/01/29 00:17:21 balewski
117  new algo filtering high-energy towers
118 
119 
120 
121 
122 */
123