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