Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfigBti.h"
00019 #include "FWCore/Utilities/interface/Exception.h"
00020
00021
00022
00023
00024 #include <cstdlib>
00025 #include <string>
00026 #include <iostream>
00027 #include <fstream>
00028 #include <stdio.h>
00029 #include <stdlib.h>
00030 #include <math.h>
00031 #include <iomanip>
00032
00033
00034
00035
00036
00037
00038
00039
00040 DTConfigBti::DTConfigBti(const edm::ParameterSet& ps) {
00041
00042 setDefaults(ps);
00043
00044 }
00045
00046 DTConfigBti::DTConfigBti(unsigned short int * buffer) {
00047
00048
00049 if (buffer[2]!=0x54){
00050 throw cms::Exception("DTTPG") << "===> ConfigBti constructor : not a BTI string!" << std::endl;
00051 }
00052
00053
00054 unsigned short int memory_bti[31];
00055 for(int i=0;i<31;i++){
00056 memory_bti[i] = buffer[i+5];
00057
00058 }
00059 int wmask[9];
00060 int st43 = memory_bti[0] & 0x3f;
00061 wmask[6] = memory_bti[1] & 0x01;
00062 wmask[7] = (memory_bti[1] >> 1 )& 0x01;
00063 wmask[8] = (memory_bti[1] >> 2 )& 0x01;
00064 int re43 = (memory_bti[1] >> 4 )& 0x03;
00065 wmask[0] = memory_bti[2] & 0x01;
00066 wmask[1] = (memory_bti[2] >> 1) & 0x01;
00067 wmask[2] = (memory_bti[2] >> 2 )& 0x01;
00068 wmask[3] = (memory_bti[2] >> 3 )& 0x01;
00069 wmask[4] = (memory_bti[2] >> 4 )& 0x01;
00070 wmask[5] = (memory_bti[2] >> 5 )& 0x01;
00071 int dead = memory_bti[3] & 0x3F;
00072 int LH = memory_bti[4] & 0x3F;
00073 int LL = memory_bti[5] & 0x3F;
00074 int CH = memory_bti[6] & 0x3F;
00075 int CL = memory_bti[7] & 0x3F;
00076 int RH = memory_bti[8] & 0x3F;
00077 int RL = memory_bti[9] & 0x3F;
00078 int tston = ( memory_bti[10] & 0x20 ) != 0 ;
00079 int test = ( memory_bti[10] & 0x10 ) != 0 ;
00080 int ten = ( memory_bti[10] & 0x8 ) != 0 ;
00081 int xon = ( memory_bti[10] & 0x2 ) != 0 ;
00082 int ron = ( memory_bti[10] & 0x1 ) != 0 ;
00083 int set = ( memory_bti[11] & 0x38 ) >> 3 ;
00084 int lts = ( memory_bti[11] & 0x6 ) >> 1 ;
00085 int ac1 = ( memory_bti[12] & 0x30 ) >> 4 ;
00086 int ac2 = ( memory_bti[12] & 0xc ) >> 2 ;
00087 int acl = ( memory_bti[12] & 0x3 ) ;
00088 int ach = ( memory_bti[13] & 0x30 ) >> 4 ;
00089
00090 int pmask[32];
00091 for(int ir=0; ir<6; ir++)
00092 {
00093 pmask[0+6*ir] = memory_bti[19-ir] & 0x01;
00094 pmask[1+6*ir] = (memory_bti[19-ir] >> 1 )& 0x01;
00095 if(ir!=5)
00096 {
00097 pmask[2+6*ir] = (memory_bti[19-ir] >> 2 )& 0x01;
00098 pmask[3+6*ir] = (memory_bti[19-ir] >> 3 )& 0x01;
00099 pmask[4+6*ir] = (memory_bti[19-ir] >> 4 )& 0x01;
00100 pmask[5+6*ir] = (memory_bti[19-ir] >> 5 )& 0x01;
00101 }
00102 }
00103
00104
00105 if(debug()==1){
00106 std::cout << std::dec << "st43=" << st43
00107 << " re43=" << re43
00108 << " dead=" << dead
00109 << " LH=" << LH
00110 << " LL=" << LL
00111 << " CH=" << CH
00112 << " CL=" << CL
00113 << " RH=" << RH
00114 << " RL=" << RL
00115 << " tston=" << tston
00116 << " test=" << test
00117 << " ten=" << ten
00118 << " xon=" << xon
00119 << " ron=" << ron
00120 << " set=" << set
00121 << " lts=" << lts
00122 << " ac1=" << ac1
00123 << " ac2=" << ac2
00124 << " acl=" << acl
00125 << " ach=" << ach
00126 << std::endl;
00127 std::cout << std::dec << " wire masks= ";
00128 for(int iw=0; iw<9; iw++)
00129 std::cout << wmask[iw] << " ";
00130 std::cout << std::dec << "\n pattern masks= ";
00131 for(int ip=0; ip<32; ip++)
00132 std::cout << pmask[ip] << " ";
00133 std::cout << std::endl;
00134 }
00135
00136
00137
00138 setKCut(64);
00139 setKAccTheta(1);
00140
00141 for(int ip=0; ip<32; ip++)
00142 setPTMSflag(pmask[ip],ip);
00143
00144 for(int iw=0; iw<9; iw++)
00145 setWENflag(wmask[iw],iw+1);
00146
00147 setST43(st43);
00148 setRE43(re43);
00149 setDEADpar(dead);
00150 setLL(LL);
00151 setLH(LH);
00152 setCL(CL);
00153 setCH(CH);
00154 setRL(RL);
00155 setRH(RH);
00156 setXON(xon);
00157 setRONflag(ron);
00158 setSET(set);
00159 setLTS(lts);
00160 setAccPattAC1(ac1);
00161 setAccPattAC2(ac2);
00162 setAccPattACH(ach);
00163 setAccPattACL(acl);
00164 }
00165
00166
00167
00168
00169 DTConfigBti::~DTConfigBti() {}
00170
00171
00172
00173
00174
00175 void
00176 DTConfigBti::setDefaults(const edm::ParameterSet& ps) {
00177
00178
00179 m_debug = ps.getUntrackedParameter<int>("Debug");
00180
00181
00182 m_kcut = ps.getParameter<int>("KMAX");
00183
00184
00185 m_kacctheta = ps.getParameter<int>("KACCTHETA");
00186
00187
00188 m_xon = ps.getParameter<bool>("XON");
00189
00190 m_lts = ps.getParameter<int>("LTS");
00191 m_set = ps.getParameter<int>("SET");
00192
00193 m_ac1 = ps.getParameter<int>("AC1");
00194 m_ac2 = ps.getParameter<int>("AC2");
00195 m_ach = ps.getParameter<int>("ACH");
00196 m_acl = ps.getParameter<int>("ACL");
00197
00198 m_ron = ps.getParameter<bool>("RON");
00199
00200
00201 for(int p=0; p<32; p++)
00202 {
00203 std::string label = "PTMS";
00204 char patt0 = (p/10)+'0';
00205 char patt1 = (p%10)+'0';
00206 if ( patt0 != '0' )
00207 label = label + patt0;
00208 label = label + patt1;
00209
00210 m_pattmask.set(p,ps.getParameter<int>(label));
00211 }
00212
00213
00214 for(int w=0; w<9; w++)
00215 {
00216 std::string label = "WEN";
00217 char wname = w+'0';
00218 label = label + wname;
00219
00220 m_wiremask.set(w,ps.getParameter<int>(label));
00221 }
00222
00223
00224 m_ll = ps.getParameter<int>("LL");
00225 m_lh = ps.getParameter<int>("LH");
00226 m_cl = ps.getParameter<int>("CL");
00227 m_ch = ps.getParameter<int>("CH");
00228 m_rl = ps.getParameter<int>("RL");
00229 m_rh = ps.getParameter<int>("RH");
00230
00231 m_4st3 = ps.getParameter<int>("ST43");
00232
00233 m_4re3 = ps.getParameter<int>("RE43");
00234
00235 m_dead = ps.getParameter<int>("DEAD");
00236 }
00237
00238 void
00239 DTConfigBti::print() const {
00240 std::cout << "******************************************************************************" << std::endl;
00241 std::cout << "* DTTrigger configuration : BTI chips *" << std::endl;
00242 std::cout << "******************************************************************************" << std::endl;
00243 std::cout << "* *" << std::endl;
00244 std::cout << "Debug flag : " << debug() << std::endl;
00245 std::cout << "Max K param accepted : " << KCut() << std::endl;
00246 std::cout << "BTI angular acceptance in theta view : " << KAccTheta() << std::endl;
00247 std::cout << "Time indep. K equation suppression (XON) : " << XON() << std::endl;
00248 std::cout << "LTS for low trigger suppression : " << LTS() << std::endl;
00249 std::cout << "SET for low trigger suppression : " << SET() << std::endl;
00250 std::cout << "pattern acceptance AC1, AC2, ACH, ACL : " <<
00251 AccPattAC1() << ", " << AccPattAC2() << " , " << AccPattACH() << ", " << AccPattACL() << std::endl;
00252 std::cout << "redundant patterns flag RON : " << RONflag() << std::endl;
00253 std::cout << "pattern masks : ";
00254 for(int p=0; p<32; p++)
00255 std::cout << PTMSflag(p) << " ";
00256 std::cout << std::endl;
00257
00258 std::cout << "wire masks : ";
00259 for(int w=1; w<=9; w++)
00260 std::cout << WENflag(w) << " ";
00261 std::cout << std::endl;
00262
00263 std::cout << "angular window limits for traco : " << LL() << ", " << LH() << ", "
00264 << CL() << ", " << CH() << ", " << RL() << ", " << RH() << std::endl;
00265 std::cout << "drift velocity parameter 4ST3 : " << ST43() << std::endl;
00266 std::cout << "drift velocity parameter 4RE3 : " << RE43() << std::endl;
00267 std::cout << "DEAD parameter : " << DEADpar() << std::endl;
00268
00269 std::cout << "******************************************************************************" << std::endl;
00270
00271 }