Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfigTraco.h"
00018
00019
00020
00021
00022 #include <cstdlib>
00023 #include <string>
00024 #include <iostream>
00025 #include <fstream>
00026 #include <stdio.h>
00027 #include <stdlib.h>
00028 #include <math.h>
00029 #include <iomanip>
00030
00031
00032
00033
00034
00035 #include "FWCore/Utilities/interface/Exception.h"
00036
00037
00038
00039
00040 DTConfigTraco::DTConfigTraco(const edm::ParameterSet& ps) {
00041
00042 setDefaults(ps);
00043
00044 }
00045
00046 DTConfigTraco::DTConfigTraco(unsigned short int * buffer) {
00047
00048
00049 if (buffer[2]!=0x15){
00050 throw cms::Exception("DTTPG") << "===> ConfigTraco constructor : not a TRACO string!" << std::endl;
00051 }
00052
00053
00054 unsigned short int memory_traco[38];
00055
00056 for(int i=0;i<38;i++){
00057 memory_traco[i] = buffer[i+5];
00058
00059 }
00060 int btic = memory_traco[0] & 0x3f ;
00061 int rad = ( ( memory_traco[0] & 0xc0 ) >> 6 ) | ( ( memory_traco[1] & 0x7 ) << 2 ) ;
00062 int dd = ( memory_traco[1] & 0xf8 ) >> 3 ;
00063 int fprgcomp = memory_traco[2] & 0x3 ;
00064 int sprgcomp = memory_traco[3] & 0x3 ;
00065 int fhism = ( memory_traco[2] & 0x4 ) != 0 ;
00066 int fhtprf = ( memory_traco[2] & 0x8 ) != 0 ;
00067 int fslmsk = ( memory_traco[2] & 0x10 ) != 0 ;
00068 int fltmsk = ( memory_traco[2] & 0x20 ) != 0 ;
00069 int fhtmsk = ( memory_traco[2] & 0x40 ) != 0 ;
00070 int shism = ( memory_traco[3] & 0x4 ) != 0 ;
00071 int shtprf = ( memory_traco[3] & 0x8 ) != 0 ;
00072 int sslmsk = ( memory_traco[3] & 0x10 ) != 0 ;
00073 int sltmsk = ( memory_traco[3] & 0x20 ) != 0 ;
00074 int shtmsk = ( memory_traco[3] & 0x40 ) != 0 ;
00075 int reusei = ( memory_traco[2] & 0x80 ) != 0 ;
00076 int reuseo = ( memory_traco[3] & 0x80 ) != 0 ;
00077 int ltf = ( memory_traco[4] & 1 ) != 0 ;
00078 int lts = ( memory_traco[4] & 2 ) != 0 ;
00079 int prgdel = ( memory_traco[4] & 0x1c ) >> 2 ;
00080 int snapcor = ( memory_traco[4] & 0xe0 ) >> 5 ;
00081 int trgenb[16];
00082 for(int it=0; it<2; it++)
00083 {
00084 trgenb[0+it*8] = memory_traco[5+it] & 0x01;
00085 trgenb[1+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
00086 trgenb[2+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
00087 trgenb[3+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
00088 trgenb[4+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
00089 trgenb[5+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
00090 trgenb[6+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
00091 trgenb[7+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
00092 }
00093 int trgadel = memory_traco[7] & 0x3 ;
00094 int ibtioff = ( memory_traco[7] & 0xfc ) >> 2 ;
00095 int kprgcom = ( memory_traco[8] & 0xff ) ;
00096 int testmode = ( memory_traco[9] & 1 ) != 0 ;
00097 int starttest = ( memory_traco[9] & 2 ) != 0 ;
00098 int prvsignmux = ( memory_traco[9] & 4 ) != 0 ;
00099 int lth = ( memory_traco[9] & 8 ) != 0 ;
00100
00101 if(debug()==1)
00102 {
00103 std::cout << "btic=" << btic
00104 << " rad=" << rad
00105 << " dd=" << dd
00106 << " fprgcomp=" << fprgcomp
00107 << " sprgcomp=" << sprgcomp
00108 << " fhism=" << fhism
00109 << " fhtprf=" << fhtprf
00110 << " fslmsk=" << fslmsk
00111 << " fltmsk=" << fltmsk
00112 << " fhtmsk=" << fhtmsk
00113 << " shism=" << shism
00114 << " shtprf=" << shtprf
00115 << " sslmsk=" << sslmsk
00116 << " sltmsk=" << sltmsk
00117 << " shtmsk=" << shtmsk
00118 << " reusei=" << reusei
00119 << " reuseo=" << reuseo
00120 << " ltf=" << ltf
00121 << " lts=" << lts
00122 << " prgdel=" << prgdel
00123 << " snapcor=" << snapcor
00124 << " trgenb=";
00125 for(int t=0; t<16; t++)
00126 std::cout << trgenb[t] << " ";
00127 std::cout << " trgadel=" << trgadel
00128 << " ibtioff=" << ibtioff
00129 << " kprgcom=" << kprgcom
00130 << " testmode=" << testmode
00131 << " starttest=" << starttest
00132 << " prvsignmux=" << prvsignmux
00133 << " lth=" << lth << std::endl;
00134
00135 }
00136
00137
00138 setBTIC(btic);
00139 setKRAD(rad);
00140 setDD(dd);
00141 setTcKToll(0,fprgcomp);
00142 setTcKToll(1,sprgcomp);
00143 setSortKascend(0,fhism);
00144 setSortKascend(1,shism);
00145 setPrefHtrig(0,fhtprf);
00146 setPrefHtrig(1,shtprf);
00147 setPrefInner(0,fslmsk);
00148 setPrefInner(1,sslmsk);
00149 setSingleLflag(0,fltmsk);
00150 setSingleLflag(1,sltmsk);
00151 setSingleHflag(0,fhtmsk);
00152 setSingleHflag(1,shtmsk);
00153 setTcReuse(0,reusei);
00154 setTcReuse(1,reuseo);
00155 setSingleLenab(0,ltf);
00156 setSingleLenab(1,ltf);
00157 setTcBxLts(lts);
00158 setIBTIOFF(ibtioff);
00159 setBendingAngleCut(kprgcom);
00160 setLVALIDIFH(lth);
00161 for(int t=0; t<16; t++)
00162 setUsedBti(t+1,trgenb[t]);
00163
00164
00165
00166 }
00167
00168
00169
00170
00171 DTConfigTraco::~DTConfigTraco() {}
00172
00173
00174
00175
00176
00177 void
00178 DTConfigTraco::setDefaults(const edm::ParameterSet& ps) {
00179
00180
00181 m_debug = ps.getUntrackedParameter<int>("Debug");
00182
00183
00184 m_krad = ps.getParameter<int>("KRAD");
00185
00186
00187 m_btic = ps.getParameter<int>("BTIC");
00188
00189
00190 m_dd = ps.getParameter<int>("DD");
00191
00192
00193 m_reusei = ps.getParameter<int>("REUSEI");
00194 m_reuseo = ps.getParameter<int>("REUSEO");
00195
00196
00197 m_fhtmsk = ps.getParameter<int>("FHTMSK");
00198 m_shtmsk = ps.getParameter<int>("SHTMSK");
00199
00200
00201 m_fltmsk = ps.getParameter<int>("FLTMSK");
00202 m_sltmsk = ps.getParameter<int>("SLTMSK");
00203
00204
00205 m_fslmsk = ps.getParameter<int>("FSLMSK");
00206 m_sslmsk = ps.getParameter<int>("SSLMSK");
00207
00208
00209 m_fhtprf = ps.getParameter<int>("FHTPRF");
00210 m_shtprf = ps.getParameter<int>("SHTPRF");
00211
00212
00213 m_fhism = ps.getParameter<int>("FHISM");
00214 m_shism = ps.getParameter<int>("SHISM");
00215
00216
00217 m_fprgcomp = ps.getParameter<int>("FPRGCOMP");
00218 m_sprgcomp = ps.getParameter<int>("SPRGCOMP");
00219
00220
00221 m_lts = ps.getParameter<int>("LTS");
00222
00223
00224 m_ltf = ps.getParameter<int>("LTF");
00225
00226
00227 for(int b=0; b<16; b++)
00228 {
00229 std::string label = "TRGENB";
00230 char p0 = (b/10)+'0';
00231 char p1 = (b%10)+'0';
00232 if ( p0 != '0' )
00233 label = label + p0;
00234 label = label + p1;
00235
00236 m_trgenb.set(b,ps.getParameter<int>(label));
00237 }
00238
00239
00240 m_ibtioff = ps.getParameter<int>("IBTIOFF");
00241
00242
00243 m_kprgcom = ps.getParameter<int>("KPRGCOM");
00244
00245
00246 m_lvalidifh = ps.getParameter<int>("LVALIDIFH");
00247 }
00248
00249 void
00250 DTConfigTraco::print() const {
00251 std::cout << "******************************************************************************" << std::endl;
00252 std::cout << "* DTTrigger configuration : TRACO chips *" << std::endl;
00253 std::cout << "******************************************************************************" << std::endl;
00254 std::cout << "* *" << std::endl;
00255 std::cout << "Debug flag : " << debug() << std::endl;
00256 std::cout << "KRAD traco parameter : " << KRAD() << std::endl;
00257 std::cout << "BTIC traco parameter : " << BTIC() << std::endl;
00258 std::cout << "DD traco parameter : " << DD() << std::endl;
00259 std::cout << "REUSEI, REUSEO : " << TcReuse(0) << ", " << TcReuse(1) << std::endl;
00260 std::cout << "FHTMSK, SHTMSK : " << singleHflag(0) << ", " << singleHflag(1) << std::endl;
00261 std::cout << "FLTMSK, SLTMSK: " << singleLflag(0) << ", " << singleLflag(1) << std::endl;
00262 std::cout << "FSLMSK, SSLMSK : " << prefInner(0) << ", " << prefInner(1) << std::endl;
00263 std::cout << "FHTPRF, SHTPRF : " << prefHtrig(0) << ", " << prefHtrig(1) << std::endl;
00264 std::cout << "FHISM, SHISM : " << sortKascend(0) << ", " << sortKascend(1) << std::endl;
00265 std::cout << "FPRGCOMP, SPRGCOMP : " << TcKToll(0) << ", " << TcKToll(1) << std::endl;
00266 std::cout << "LTS : " << TcBxLts() << std::endl;
00267 std::cout << "LTF : " << singleLenab(0) << std::endl;
00268 std::cout << "Connected bti in traco - bti mask : ";
00269 for(int b=1; b<=16; b++)
00270 std::cout << usedBti(b) << " ";
00271 std::cout << std::endl;
00272 std::cout << "IBTIOFF : " << IBTIOFF() << std::endl;
00273 std::cout << "bending angle cut : " << BendingAngleCut() << std::endl;
00274 std::cout << "flag for Low validation parameter : " << LVALIDIFH() << std::endl;
00275 std::cout << "******************************************************************************" << std::endl;
00276
00277 }