StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
L2EmcDb2012.h
1 #ifndef L2EMCDB_H
2 #define L2EMCDB_H
3 #include <stdio.h>
4 
5 /*********************************************************
6  * $Id: L2EmcDb2012.h,v 1.2 2011/10/19 15:58:06 jml Exp $
7  * \author Jan Balewski, IUCF, 2006
8  *********************************************************
9  * Descripion:
10  * StRoot-free DB container , common for BTOW + ETOW + ESMD
11  *********************************************************
12  */
13 
14 class L2EmcDb2012 {
15  public:
16  /* use it to decalare any ENDCAP local array 12+1 secors */
17  enum { EindexMax=13000};
18  /* use it to decalare any local BTOW array 12+1+extra */
19  enum { BindexMax=5400};
20 #define EmcDbIndexMax (L2EmcDb2012::EindexMax+L2EmcDb2012::BindexMax) /* use it to decalare any local array */
21 
22  enum {ETOW_DATSIZE=160, ETOW_DATUSED=128, BTOW_DATSIZE=160, ETOW_MAXFEE=6, BTOW_MAXFEE=30,MxEmcNameLen=16};
23 
24  struct EmcCDbItem {
25  int key; /* unique EmcDbC ID in form 1 to EmcIndex-1, not all used */
26  char name[MxEmcNameLen]; /* geographical name of the pixel */
27  char tube[MxEmcNameLen]; /* ETOW: name of PMT; ESMD: MAPMT pixel; BTOW: softId-mod-sub-eta */
28 
29 
30  /* for towers/pre/post use (sec,sub,eta)
31  for SMD use sec,plane,strip) */
32  int sec,eta; /*ETOW: 1-12, 1-12; BTOW: 1-12, 1-40 */
33  char sub;/*ETWO: A-E; BTOW: a-j*/
34  char plane; /* ESMD: U-V */
35  int strip; /* ESMD: 1-288 */
36 
37  int crate, chan; /* hardware channel */
38  int rdo; /* index of channel in the raw data block, counts from 0 */
39  float gain;
40  float ped,thr,sigPed; /* in ADC channals */
41  unsigned stat; /* bits, see eemcConstDB.hh for definitions */
42  unsigned fail; /* bits, see eemcConstDB.hh for definitions */
43  } ;
44 
45  L2EmcDb2012(char *inpP, char *logP, char *uid);
46  ~L2EmcDb2012(); // saves DB for last run
47  const EmcCDbItem *getByIndex(int i);
48  const EmcCDbItem *getByName(char *name); // slow
49  int name2index(char *name);// slow
50 
51  static void printItem(const EmcCDbItem *x);
52  bool isEmpty(const EmcCDbItem *x);
53  bool isBTOW(const EmcCDbItem *x);
54  bool isETOW(const EmcCDbItem *x);
55 
56  int initRun(int runNo);
57  int getRun() { return run_number;}
58  void finishRun();
59 
60  enum {mxTxt=1000};
61  char logPath[mxTxt];
62  char inpPath[mxTxt];
63  char pedFile[mxTxt];
64  char maskFile[mxTxt];
65  char muid[mxTxt];
66 
67  void setPedFile( const char *c );
68  void setMaskFile( const char *c );
70  private:
71  EmcCDbItem dbByIndex[EmcDbIndexMax]; // the data container
72 
73  void clearItem(EmcCDbItem *x);
74  void clearTables();
75  int importItem(EmcCDbItem *x, FILE *fd);
76  void exportItem(EmcCDbItem *x, FILE *fd);
77  int BtowName2Index(int sect, char *xee); //slow
78  int readAsciiDb(char *fname, char *lbl);
79  void writeAsciiDb(FILE *fd);
80 
81  int changeMaskFullCrate(const char *fname, char BEflag, char *lbl);
82  int changePedsByName(const char *fname, char *lbl);
83  int changeMaskByName(const char *fname, char *lbl);
84 
85  int run_number;
86 
87  enum {txMxLbl=6, txMxSize=100};
88  char db_labels[txMxLbl][txMxSize];
89 
90 };
91 
92 
93 /***********************************************************
94 
95  Descripion:
96 
97  1) Lets define a unique 'name' for any active element in EEMC
98  name="ssTann" for towers, ss=sector 01-12, a=subsector='A' -'E'
99  nn=tower in eta =01-12
100  "ssxkkk" for SMD x='U' or 'V' plain orientation,
101  kkk=001-288 strip ID
102  "ssPann" for Pres1
103  "ssQann" for Pres2
104  "ssRann" for Post
105  "ssLann" for LED pixel
106  1.b) Extension for BTOW towers
107  name="sstann" for towers, ss=sector 01-12, t='t'
108  a=subsector='a'-'j' interlaced
109  nn=tower etaBin =1-40
110  Geograohical location of towers:
111  BTOW subs 'a' infront of ETOW subs 'A'
112  BTOW subs 'b' spans ETOW subs 'A'
113  BTOW subs 'c' spans ETOW subs 'B' , etc ...
114  BTOW eta bin 1 is at physical eta of +0.95
115  BTOW eta bin 20 is at physical eta of +0.0?
116  BTOW eta bin 21 is at physical eta of -0.0?
117  BTOW eta bin 40 is at physical eta of -0.95
118 
119  1.c) Extension for spare channels --> use sector 13
120  Add 1000 to the ETOW index range.
121  Add 400 to the BTOW index range.
122 
123  spare ETOW chan 120-127 per crate 1-6 mapp into
124  consecutive 13TA01, ..02, ..12, 13TB01,... 13TD12
125 
126  spare BTOW chan papping ???
127 
128 
129  2) Lets define sector oriented index for any PMT/MAPMT pixel
130  Index within sector:
131 
132  Tower 1- 60 =(sub-1)*5+eta, where sub=1-5, eta=1-12
133  Pre1 101-160 = the same
134  Pre2 201-260 = the same
135  Post 301-360 = the same
136  smd-U 401-688 couting from shortest at eta=2
137  smd-V 701-988 couting from shortest at eta=2
138 
139  Index jumps by 1000 from sector to sector
140  --> add (sectorID-1)*1000
141 
142  Index total range [1 - 12,999], spare ~15% or ~180/sector
143 
144  2.b) Extension for BTOW towers
145  Tower =12,000+ (sec-1)*400 + (sub-1)*40 +eta
146  where sec=1-12, sub=1-10, eta=1-40
147  Index total range [13,001- 17,200], 200 spares
148 
149 ****************************************************/
150 
151 
152 #endif
153 
154 
155 /*
156 *********************************************************************
157  $Log: L2EmcDb2012.h,v $
158  Revision 1.2 2011/10/19 15:58:06 jml
159  more compile offline
160 
161  Revision 1.1 2011/10/19 15:42:14 jml
162  added 2012
163 
164  Revision 1.6 2008/01/30 00:47:15 balewski
165  Added L2-Etow-calib
166 
167  Revision 1.5 2007/12/19 02:30:16 balewski
168  new L2-btow-calib-2008
169 
170  Revision 1.4 2007/11/14 03:58:07 balewski
171  cleanup of common timing measurement
172 
173  Revision 1.3 2007/11/06 22:07:24 balewski
174  added timeStamp controlled L2 setup from Jason
175 
176  Revision 1.2 2007/10/22 23:10:03 balewski
177  split L2 to generic and year specific, not finished
178 
179  Revision 1.1 2007/10/11 00:33:14 balewski
180  L2algo added
181 
182  Revision 1.4 2006/03/28 19:33:23 balewski
183  ver16b , in L2new
184 
185  Revision 1.3 2006/03/11 17:08:32 balewski
186  now CVS comments should work
187 
188 */
189 
void setPedFile(const char *c)
Definition: L2EmcDb2012.cxx:32
void setMaskFile(const char *c)
Definition: L2EmcDb2012.cxx:33