00001 #ifndef L2EMCDB_H 00002 #define L2EMCDB_H 00003 #include <stdio.h> 00004 00005 /********************************************************* 00006 * $Id: L2EmcDb2012.h,v 1.2 2011/10/19 15:58:06 jml Exp $ 00007 * \author Jan Balewski, IUCF, 2006 00008 ********************************************************* 00009 * Descripion: 00010 * StRoot-free DB container , common for BTOW + ETOW + ESMD 00011 ********************************************************* 00012 */ 00013 00014 class L2EmcDb2012 { 00015 public: 00016 /* use it to decalare any ENDCAP local array 12+1 secors */ 00017 enum { EindexMax=13000}; 00018 /* use it to decalare any local BTOW array 12+1+extra */ 00019 enum { BindexMax=5400}; 00020 #define EmcDbIndexMax (L2EmcDb2012::EindexMax+L2EmcDb2012::BindexMax) /* use it to decalare any local array */ 00021 00022 enum {ETOW_DATSIZE=160, ETOW_DATUSED=128, BTOW_DATSIZE=160, ETOW_MAXFEE=6, BTOW_MAXFEE=30,MxEmcNameLen=16}; 00023 00024 struct EmcCDbItem { 00025 int key; /* unique EmcDbC ID in form 1 to EmcIndex-1, not all used */ 00026 char name[MxEmcNameLen]; /* geographical name of the pixel */ 00027 char tube[MxEmcNameLen]; /* ETOW: name of PMT; ESMD: MAPMT pixel; BTOW: softId-mod-sub-eta */ 00028 00029 00030 /* for towers/pre/post use (sec,sub,eta) 00031 for SMD use sec,plane,strip) */ 00032 int sec,eta; /*ETOW: 1-12, 1-12; BTOW: 1-12, 1-40 */ 00033 char sub;/*ETWO: A-E; BTOW: a-j*/ 00034 char plane; /* ESMD: U-V */ 00035 int strip; /* ESMD: 1-288 */ 00036 00037 int crate, chan; /* hardware channel */ 00038 int rdo; /* index of channel in the raw data block, counts from 0 */ 00039 float gain; 00040 float ped,thr,sigPed; /* in ADC channals */ 00041 unsigned stat; /* bits, see eemcConstDB.hh for definitions */ 00042 unsigned fail; /* bits, see eemcConstDB.hh for definitions */ 00043 } ; 00044 00045 L2EmcDb2012(char *inpP, char *logP, char *uid); 00046 ~L2EmcDb2012(); // saves DB for last run 00047 const EmcCDbItem *getByIndex(int i); 00048 const EmcCDbItem *getByName(char *name); // slow 00049 int name2index(char *name);// slow 00050 00051 static void printItem(const EmcCDbItem *x); 00052 bool isEmpty(const EmcCDbItem *x); 00053 bool isBTOW(const EmcCDbItem *x); 00054 bool isETOW(const EmcCDbItem *x); 00055 00056 int initRun(int runNo); 00057 int getRun() { return run_number;} 00058 void finishRun(); 00059 00060 enum {mxTxt=1000}; 00061 char logPath[mxTxt]; 00062 char inpPath[mxTxt]; 00063 char pedFile[mxTxt]; 00064 char maskFile[mxTxt]; 00065 char muid[mxTxt]; 00066 00067 void setPedFile( const char *c ); 00068 void setMaskFile( const char *c ); 00070 private: 00071 EmcCDbItem dbByIndex[EmcDbIndexMax]; // the data container 00072 00073 void clearItem(EmcCDbItem *x); 00074 void clearTables(); 00075 int importItem(EmcCDbItem *x, FILE *fd); 00076 void exportItem(EmcCDbItem *x, FILE *fd); 00077 int BtowName2Index(int sect, char *xee); //slow 00078 int readAsciiDb(char *fname, char *lbl); 00079 void writeAsciiDb(FILE *fd); 00080 00081 int changeMaskFullCrate(const char *fname, char BEflag, char *lbl); 00082 int changePedsByName(const char *fname, char *lbl); 00083 int changeMaskByName(const char *fname, char *lbl); 00084 00085 int run_number; 00086 00087 enum {txMxLbl=6, txMxSize=100}; 00088 char db_labels[txMxLbl][txMxSize]; 00089 00090 }; 00091 00092 00093 /*********************************************************** 00094 00095 Descripion: 00096 00097 1) Lets define a unique 'name' for any active element in EEMC 00098 name="ssTann" for towers, ss=sector 01-12, a=subsector='A' -'E' 00099 nn=tower in eta =01-12 00100 "ssxkkk" for SMD x='U' or 'V' plain orientation, 00101 kkk=001-288 strip ID 00102 "ssPann" for Pres1 00103 "ssQann" for Pres2 00104 "ssRann" for Post 00105 "ssLann" for LED pixel 00106 1.b) Extension for BTOW towers 00107 name="sstann" for towers, ss=sector 01-12, t='t' 00108 a=subsector='a'-'j' interlaced 00109 nn=tower etaBin =1-40 00110 Geograohical location of towers: 00111 BTOW subs 'a' infront of ETOW subs 'A' 00112 BTOW subs 'b' spans ETOW subs 'A' 00113 BTOW subs 'c' spans ETOW subs 'B' , etc ... 00114 BTOW eta bin 1 is at physical eta of +0.95 00115 BTOW eta bin 20 is at physical eta of +0.0? 00116 BTOW eta bin 21 is at physical eta of -0.0? 00117 BTOW eta bin 40 is at physical eta of -0.95 00118 00119 1.c) Extension for spare channels --> use sector 13 00120 Add 1000 to the ETOW index range. 00121 Add 400 to the BTOW index range. 00122 00123 spare ETOW chan 120-127 per crate 1-6 mapp into 00124 consecutive 13TA01, ..02, ..12, 13TB01,... 13TD12 00125 00126 spare BTOW chan papping ??? 00127 00128 00129 2) Lets define sector oriented index for any PMT/MAPMT pixel 00130 Index within sector: 00131 00132 Tower 1- 60 =(sub-1)*5+eta, where sub=1-5, eta=1-12 00133 Pre1 101-160 = the same 00134 Pre2 201-260 = the same 00135 Post 301-360 = the same 00136 smd-U 401-688 couting from shortest at eta=2 00137 smd-V 701-988 couting from shortest at eta=2 00138 00139 Index jumps by 1000 from sector to sector 00140 --> add (sectorID-1)*1000 00141 00142 Index total range [1 - 12,999], spare ~15% or ~180/sector 00143 00144 2.b) Extension for BTOW towers 00145 Tower =12,000+ (sec-1)*400 + (sub-1)*40 +eta 00146 where sec=1-12, sub=1-10, eta=1-40 00147 Index total range [13,001- 17,200], 200 spares 00148 00149 ****************************************************/ 00150 00151 00152 #endif 00153 00154 00155 /* 00156 ********************************************************************* 00157 $Log: L2EmcDb2012.h,v $ 00158 Revision 1.2 2011/10/19 15:58:06 jml 00159 more compile offline 00160 00161 Revision 1.1 2011/10/19 15:42:14 jml 00162 added 2012 00163 00164 Revision 1.6 2008/01/30 00:47:15 balewski 00165 Added L2-Etow-calib 00166 00167 Revision 1.5 2007/12/19 02:30:16 balewski 00168 new L2-btow-calib-2008 00169 00170 Revision 1.4 2007/11/14 03:58:07 balewski 00171 cleanup of common timing measurement 00172 00173 Revision 1.3 2007/11/06 22:07:24 balewski 00174 added timeStamp controlled L2 setup from Jason 00175 00176 Revision 1.2 2007/10/22 23:10:03 balewski 00177 split L2 to generic and year specific, not finished 00178 00179 Revision 1.1 2007/10/11 00:33:14 balewski 00180 L2algo added 00181 00182 Revision 1.4 2006/03/28 19:33:23 balewski 00183 ver16b , in L2new 00184 00185 Revision 1.3 2006/03/11 17:08:32 balewski 00186 now CVS comments should work 00187 00188 */ 00189
1.5.9