File indexing completed on 2024-04-06 12:22:14
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfigBti.h"
0019 #include "FWCore/Utilities/interface/Exception.h"
0020
0021
0022
0023
0024 #include <cstdlib>
0025 #include <string>
0026 #include <iostream>
0027 #include <fstream>
0028 #include <cstdio>
0029 #include <cstdlib>
0030 #include <cmath>
0031 #include <iomanip>
0032
0033
0034
0035
0036
0037
0038
0039
0040 DTConfigBti::DTConfigBti(const edm::ParameterSet& ps) { setDefaults(ps); }
0041
0042 DTConfigBti::DTConfigBti(int debugBTI, unsigned short int* buffer) {
0043 m_debug = debugBTI;
0044
0045
0046 if (buffer[2] != 0x54) {
0047 throw cms::Exception("DTTPG") << "===> ConfigBti constructor : not a BTI string!" << std::endl;
0048 }
0049
0050
0051 unsigned short int memory_bti[31];
0052 for (int i = 0; i < 31; i++) {
0053 memory_bti[i] = buffer[i + 5];
0054
0055 }
0056 int wmask[9];
0057 int st43 = memory_bti[0] & 0x3f;
0058 wmask[6] = memory_bti[1] & 0x01;
0059 wmask[7] = (memory_bti[1] >> 1) & 0x01;
0060 wmask[8] = (memory_bti[1] >> 2) & 0x01;
0061 int re43 = (memory_bti[1] >> 4) & 0x03;
0062 wmask[0] = memory_bti[2] & 0x01;
0063 wmask[1] = (memory_bti[2] >> 1) & 0x01;
0064 wmask[2] = (memory_bti[2] >> 2) & 0x01;
0065 wmask[3] = (memory_bti[2] >> 3) & 0x01;
0066 wmask[4] = (memory_bti[2] >> 4) & 0x01;
0067 wmask[5] = (memory_bti[2] >> 5) & 0x01;
0068 int dead = memory_bti[3] & 0x3F;
0069 int LH = memory_bti[4] & 0x3F;
0070 int LL = memory_bti[5] & 0x3F;
0071 int CH = memory_bti[6] & 0x3F;
0072 int CL = memory_bti[7] & 0x3F;
0073 int RH = memory_bti[8] & 0x3F;
0074 int RL = memory_bti[9] & 0x3F;
0075 int tston = (memory_bti[10] & 0x20) != 0;
0076 int test = (memory_bti[10] & 0x10) != 0;
0077 int ten = (memory_bti[10] & 0x8) != 0;
0078 int xon = (memory_bti[10] & 0x2) != 0;
0079 int ron = (memory_bti[10] & 0x1) != 0;
0080 int set = (memory_bti[11] & 0x38) >> 3;
0081 int lts = (memory_bti[11] & 0x6) >> 1;
0082 int ac1 = (memory_bti[12] & 0x30) >> 4;
0083 int ac2 = (memory_bti[12] & 0xc) >> 2;
0084 int acl = (memory_bti[12] & 0x3);
0085 int ach = (memory_bti[13] & 0x30) >> 4;
0086
0087 int pmask[32];
0088 for (int ir = 0; ir < 6; ir++) {
0089 pmask[0 + 6 * ir] = memory_bti[19 - ir] & 0x01;
0090 pmask[1 + 6 * ir] = (memory_bti[19 - ir] >> 1) & 0x01;
0091 if (ir != 5) {
0092 pmask[2 + 6 * ir] = (memory_bti[19 - ir] >> 2) & 0x01;
0093 pmask[3 + 6 * ir] = (memory_bti[19 - ir] >> 3) & 0x01;
0094 pmask[4 + 6 * ir] = (memory_bti[19 - ir] >> 4) & 0x01;
0095 pmask[5 + 6 * ir] = (memory_bti[19 - ir] >> 5) & 0x01;
0096 }
0097 }
0098
0099
0100 if (debug() == 1) {
0101 std::cout << std::dec << "st43=" << st43 << " re43=" << re43 << " dead=" << dead << " LH=" << LH << " LL=" << LL
0102 << " CH=" << CH << " CL=" << CL << " RH=" << RH << " RL=" << RL << " tston=" << tston << " test=" << test
0103 << " ten=" << ten << " xon=" << xon << " ron=" << ron << " set=" << set << " lts=" << lts
0104 << " ac1=" << ac1 << " ac2=" << ac2 << " acl=" << acl << " ach=" << ach << std::endl;
0105 std::cout << std::dec << " wire masks= ";
0106 for (int iw = 0; iw < 9; iw++)
0107 std::cout << wmask[iw] << " ";
0108 std::cout << std::dec << "\n pattern masks= ";
0109 for (int ip = 0; ip < 32; ip++)
0110 std::cout << pmask[ip] << " ";
0111 std::cout << std::endl;
0112 }
0113
0114
0115
0116 setKCut(64);
0117 setKAccTheta(1);
0118
0119 for (int ip = 0; ip < 32; ip++)
0120 setPTMSflag(pmask[ip], ip);
0121
0122 for (int iw = 0; iw < 9; iw++)
0123 setWENflag(wmask[iw], iw + 1);
0124
0125 setST43(st43);
0126 setRE43(re43);
0127 setDEADpar(dead);
0128 setLL(LL);
0129 setLH(LH);
0130 setCL(CL);
0131 setCH(CH);
0132 setRL(RL);
0133 setRH(RH);
0134 setXON(xon);
0135 setRONflag(ron);
0136 setSET(set);
0137 setLTS(lts);
0138 setAccPattAC1(ac1);
0139 setAccPattAC2(ac2);
0140 setAccPattACH(ach);
0141 setAccPattACL(acl);
0142 }
0143
0144
0145
0146
0147 DTConfigBti::~DTConfigBti() {}
0148
0149
0150
0151
0152
0153 void DTConfigBti::setDefaults(const edm::ParameterSet& ps) {
0154
0155 m_debug = ps.getUntrackedParameter<int>("Debug");
0156
0157
0158 m_kcut = ps.getParameter<int>("KMAX");
0159
0160
0161 m_kacctheta = ps.getParameter<int>("KACCTHETA");
0162
0163
0164 m_xon = ps.getParameter<bool>("XON");
0165
0166 m_lts = ps.getParameter<int>("LTS");
0167 m_set = ps.getParameter<int>("SET");
0168
0169 m_ac1 = ps.getParameter<int>("AC1");
0170 m_ac2 = ps.getParameter<int>("AC2");
0171 m_ach = ps.getParameter<int>("ACH");
0172 m_acl = ps.getParameter<int>("ACL");
0173
0174 m_ron = ps.getParameter<bool>("RON");
0175
0176
0177 for (int p = 0; p < 32; p++) {
0178 std::string label = "PTMS";
0179 char patt0 = (p / 10) + '0';
0180 char patt1 = (p % 10) + '0';
0181 if (patt0 != '0')
0182 label = label + patt0;
0183 label = label + patt1;
0184
0185 m_pattmask.set(p, ps.getParameter<int>(label));
0186 }
0187
0188
0189 for (int w = 0; w < 9; w++) {
0190 std::string label = "WEN";
0191 char wname = w + '0';
0192 label = label + wname;
0193
0194 m_wiremask.set(w, ps.getParameter<int>(label));
0195 }
0196
0197
0198 m_ll = ps.getParameter<int>("LL");
0199 m_lh = ps.getParameter<int>("LH");
0200 m_cl = ps.getParameter<int>("CL");
0201 m_ch = ps.getParameter<int>("CH");
0202 m_rl = ps.getParameter<int>("RL");
0203 m_rh = ps.getParameter<int>("RH");
0204
0205 m_4st3 = ps.getParameter<int>("ST43");
0206
0207 m_4re3 = ps.getParameter<int>("RE43");
0208
0209 m_dead = ps.getParameter<int>("DEAD");
0210 }
0211
0212 void DTConfigBti::print() const {
0213 std::cout << "******************************************************************************" << std::endl;
0214 std::cout << "* DTTrigger configuration : BTI chips *" << std::endl;
0215 std::cout << "******************************************************************************" << std::endl;
0216 std::cout << "* *" << std::endl;
0217 std::cout << "Debug flag : " << debug() << std::endl;
0218 std::cout << "Max K param accepted : " << KCut() << std::endl;
0219 std::cout << "BTI angular acceptance in theta view : " << KAccTheta() << std::endl;
0220 std::cout << "Time indep. K equation suppression (XON) : " << XON() << std::endl;
0221 std::cout << "LTS for low trigger suppression : " << LTS() << std::endl;
0222 std::cout << "SET for low trigger suppression : " << SET() << std::endl;
0223 std::cout << "pattern acceptance AC1, AC2, ACH, ACL : " << AccPattAC1() << ", " << AccPattAC2() << " , "
0224 << AccPattACH() << ", " << AccPattACL() << std::endl;
0225 std::cout << "redundant patterns flag RON : " << RONflag() << std::endl;
0226 std::cout << "pattern masks : ";
0227 for (int p = 0; p < 32; p++)
0228 std::cout << PTMSflag(p) << " ";
0229 std::cout << std::endl;
0230
0231 std::cout << "wire masks : ";
0232 for (int w = 1; w <= 9; w++)
0233 std::cout << WENflag(w) << " ";
0234 std::cout << std::endl;
0235
0236 std::cout << "angular window limits for traco : " << LL() << ", " << LH() << ", " << CL() << ", " << CH() << ", "
0237 << RL() << ", " << RH() << std::endl;
0238 std::cout << "drift velocity parameter 4ST3 : " << ST43() << std::endl;
0239 std::cout << "drift velocity parameter 4RE3 : " << RE43() << std::endl;
0240 std::cout << "DEAD parameter : " << DEADpar() << std::endl;
0241
0242 std::cout << "******************************************************************************" << std::endl;
0243 }