CMS 3D CMS Logo

DTConfigBti.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: DTConfigBti
4 //
5 // Description: Configurable parameters and constants for Level1 Mu DT Trigger - BTI chip
6 //
7 //
8 // Author List:
9 // S.Vanini
10 //
11 // Modifications:
12 // April,10th : set BTI parameters from string
13 //-----------------------------------------------------------------------
14 
15 //-----------------------
16 // This Class's Header --
17 //-----------------------
20 
21 //---------------
22 // C++ Headers --
23 //---------------
24 #include <cstdlib>
25 #include <string>
26 #include <iostream>
27 #include <fstream>
28 #include <cstdio>
29 #include <cstdlib>
30 #include <cmath>
31 #include <iomanip>
32 
33 //-------------------------------
34 // Collaborating Class Headers --
35 //-------------------------------
36 
37 //----------------
38 // Constructors --
39 //----------------
41 
42 DTConfigBti::DTConfigBti(int debugBTI, unsigned short int* buffer) {
43  m_debug = debugBTI;
44 
45  // check if this is a BTI configuration string
46  if (buffer[2] != 0x54) {
47  throw cms::Exception("DTTPG") << "===> ConfigBti constructor : not a BTI string!" << std::endl;
48  }
49 
50  // decode
51  unsigned short int memory_bti[31];
52  for (int i = 0; i < 31; i++) {
53  memory_bti[i] = buffer[i + 5];
54  //std::cout << hex << memory_bti[i] << " ";
55  }
56  int wmask[9];
57  int st43 = memory_bti[0] & 0x3f;
58  wmask[6] = memory_bti[1] & 0x01;
59  wmask[7] = (memory_bti[1] >> 1) & 0x01;
60  wmask[8] = (memory_bti[1] >> 2) & 0x01;
61  int re43 = (memory_bti[1] >> 4) & 0x03;
62  wmask[0] = memory_bti[2] & 0x01;
63  wmask[1] = (memory_bti[2] >> 1) & 0x01;
64  wmask[2] = (memory_bti[2] >> 2) & 0x01;
65  wmask[3] = (memory_bti[2] >> 3) & 0x01;
66  wmask[4] = (memory_bti[2] >> 4) & 0x01;
67  wmask[5] = (memory_bti[2] >> 5) & 0x01;
68  int dead = memory_bti[3] & 0x3F;
69  int LH = memory_bti[4] & 0x3F;
70  int LL = memory_bti[5] & 0x3F;
71  int CH = memory_bti[6] & 0x3F;
72  int CL = memory_bti[7] & 0x3F;
73  int RH = memory_bti[8] & 0x3F;
74  int RL = memory_bti[9] & 0x3F;
75  int tston = (memory_bti[10] & 0x20) != 0;
76  int test = (memory_bti[10] & 0x10) != 0;
77  int ten = (memory_bti[10] & 0x8) != 0;
78  int xon = (memory_bti[10] & 0x2) != 0;
79  int ron = (memory_bti[10] & 0x1) != 0;
80  int set = (memory_bti[11] & 0x38) >> 3;
81  int lts = (memory_bti[11] & 0x6) >> 1;
82  int ac1 = (memory_bti[12] & 0x30) >> 4;
83  int ac2 = (memory_bti[12] & 0xc) >> 2;
84  int acl = (memory_bti[12] & 0x3);
85  int ach = (memory_bti[13] & 0x30) >> 4;
86 
87  int pmask[32];
88  for (int ir = 0; ir < 6; ir++) {
89  pmask[0 + 6 * ir] = memory_bti[19 - ir] & 0x01;
90  pmask[1 + 6 * ir] = (memory_bti[19 - ir] >> 1) & 0x01;
91  if (ir != 5) {
92  pmask[2 + 6 * ir] = (memory_bti[19 - ir] >> 2) & 0x01;
93  pmask[3 + 6 * ir] = (memory_bti[19 - ir] >> 3) & 0x01;
94  pmask[4 + 6 * ir] = (memory_bti[19 - ir] >> 4) & 0x01;
95  pmask[5 + 6 * ir] = (memory_bti[19 - ir] >> 5) & 0x01;
96  }
97  }
98 
99  // dump
100  if (debug() == 1) {
101  std::cout << std::dec << "st43=" << st43 << " re43=" << re43 << " dead=" << dead << " LH=" << LH << " LL=" << LL
102  << " CH=" << CH << " CL=" << CL << " RH=" << RH << " RL=" << RL << " tston=" << tston << " test=" << test
103  << " ten=" << ten << " xon=" << xon << " ron=" << ron << " set=" << set << " lts=" << lts
104  << " ac1=" << ac1 << " ac2=" << ac2 << " acl=" << acl << " ach=" << ach << std::endl;
105  std::cout << std::dec << " wire masks= ";
106  for (int iw = 0; iw < 9; iw++)
107  std::cout << wmask[iw] << " ";
108  std::cout << std::dec << "\n pattern masks= ";
109  for (int ip = 0; ip < 32; ip++)
110  std::cout << pmask[ip] << " ";
111  std::cout << std::endl;
112  }
113 
114  // set parameters
115  // default for KCut and KAccTheta
116  setKCut(64);
117  setKAccTheta(1);
118 
119  for (int ip = 0; ip < 32; ip++)
120  setPTMSflag(pmask[ip], ip);
121 
122  for (int iw = 0; iw < 9; iw++)
123  setWENflag(wmask[iw], iw + 1);
124 
125  setST43(st43);
126  setRE43(re43);
127  setDEADpar(dead);
128  setLL(LL);
129  setLH(LH);
130  setCL(CL);
131  setCH(CH);
132  setRL(RL);
133  setRH(RH);
134  setXON(xon);
135  setRONflag(ron);
136  setSET(set);
137  setLTS(lts);
138  setAccPattAC1(ac1);
139  setAccPattAC2(ac2);
140  setAccPattACH(ach);
141  setAccPattACL(acl);
142 }
143 
144 //--------------
145 // Destructor --
146 //--------------
148 
149 //--------------
150 // Operations --
151 //--------------
152 
154  // Debug flag
155  m_debug = ps.getUntrackedParameter<int>("Debug");
156 
157  // Max K param accepted
158  m_kcut = ps.getParameter<int>("KMAX");
159 
160  // BTI angular acceptance in theta view
161  m_kacctheta = ps.getParameter<int>("KACCTHETA");
162 
163  // Time indep. K equation suppression (XON)
164  m_xon = ps.getParameter<bool>("XON");
165  // LTS and SET for low trigger suppression
166  m_lts = ps.getParameter<int>("LTS");
167  m_set = ps.getParameter<int>("SET");
168  // pattern acceptance AC1, AC2, ACH, ACL
169  m_ac1 = ps.getParameter<int>("AC1");
170  m_ac2 = ps.getParameter<int>("AC2");
171  m_ach = ps.getParameter<int>("ACH");
172  m_acl = ps.getParameter<int>("ACL");
173  // redundant patterns flag RON
174  m_ron = ps.getParameter<bool>("RON");
175 
176  // pattern masks
177  for (int p = 0; p < 32; p++) {
178  std::string label = "PTMS";
179  char patt0 = (p / 10) + '0';
180  char patt1 = (p % 10) + '0';
181  if (patt0 != '0')
182  label = label + patt0;
183  label = label + patt1;
184 
185  m_pattmask.set(p, ps.getParameter<int>(label));
186  }
187 
188  // wire masks
189  for (int w = 0; w < 9; w++) {
190  std::string label = "WEN";
191  char wname = w + '0';
192  label = label + wname;
193 
194  m_wiremask.set(w, ps.getParameter<int>(label));
195  }
196 
197  // angular window limits for traco
198  m_ll = ps.getParameter<int>("LL");
199  m_lh = ps.getParameter<int>("LH");
200  m_cl = ps.getParameter<int>("CL");
201  m_ch = ps.getParameter<int>("CH");
202  m_rl = ps.getParameter<int>("RL");
203  m_rh = ps.getParameter<int>("RH");
204  // drift velocity parameter 4ST3
205  m_4st3 = ps.getParameter<int>("ST43");
206  // drift velocity parameter 4RE3
207  m_4re3 = ps.getParameter<int>("RE43");
208  // DEAD parameter
209  m_dead = ps.getParameter<int>("DEAD");
210 }
211 
212 void DTConfigBti::print() const {
213  std::cout << "******************************************************************************" << std::endl;
214  std::cout << "* DTTrigger configuration : BTI chips *" << std::endl;
215  std::cout << "******************************************************************************" << std::endl;
216  std::cout << "* *" << std::endl;
217  std::cout << "Debug flag : " << debug() << std::endl;
218  std::cout << "Max K param accepted : " << KCut() << std::endl;
219  std::cout << "BTI angular acceptance in theta view : " << KAccTheta() << std::endl;
220  std::cout << "Time indep. K equation suppression (XON) : " << XON() << std::endl;
221  std::cout << "LTS for low trigger suppression : " << LTS() << std::endl;
222  std::cout << "SET for low trigger suppression : " << SET() << std::endl;
223  std::cout << "pattern acceptance AC1, AC2, ACH, ACL : " << AccPattAC1() << ", " << AccPattAC2() << " , "
224  << AccPattACH() << ", " << AccPattACL() << std::endl;
225  std::cout << "redundant patterns flag RON : " << RONflag() << std::endl;
226  std::cout << "pattern masks : ";
227  for (int p = 0; p < 32; p++)
228  std::cout << PTMSflag(p) << " ";
229  std::cout << std::endl;
230 
231  std::cout << "wire masks : ";
232  for (int w = 1; w <= 9; w++)
233  std::cout << WENflag(w) << " ";
234  std::cout << std::endl;
235 
236  std::cout << "angular window limits for traco : " << LL() << ", " << LH() << ", " << CL() << ", " << CH() << ", "
237  << RL() << ", " << RH() << std::endl;
238  std::cout << "drift velocity parameter 4ST3 : " << ST43() << std::endl;
239  std::cout << "drift velocity parameter 4RE3 : " << RE43() << std::endl;
240  std::cout << "DEAD parameter : " << DEADpar() << std::endl;
241 
242  std::cout << "******************************************************************************" << std::endl;
243 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void setWENflag(int mask, int wire)
Set Wire mask flag.
Definition: DTConfigBti.h:162
int debug() const
Debug flag.
Definition: DTConfigBti.h:58
int RL() const
K left limit for right traco.
Definition: DTConfigBti.h:112
void setLL(int LL)
Set K left limit for left traco.
Definition: DTConfigBti.h:165
int AccPattACL() const
Acceptance pattern ACL.
Definition: DTConfigBti.h:88
void setRONflag(bool RON)
Set Redundant patterns flag RONDTBti/src/DTBtiChipEquations.cc:
Definition: DTConfigBti.h:156
int8_t m_acl
Definition: DTConfigBti.h:207
int8_t m_ac1
Definition: DTConfigBti.h:204
const double w
Definition: UKUtility.cc:23
int8_t m_rl
Definition: DTConfigBti.h:215
int DEADpar() const
Wire DEAD time parameter.
Definition: DTConfigBti.h:122
int ST43() const
ST and RE parameters for drift velocity.
Definition: DTConfigBti.h:118
void setCL(int CL)
Set K left limit for center traco.
Definition: DTConfigBti.h:171
void setRL(int RL)
Set K left limit for right traco.
Definition: DTConfigBti.h:177
int8_t m_lh
Definition: DTConfigBti.h:212
int CH() const
K right limit for center traco.
Definition: DTConfigBti.h:109
~DTConfigBti() override
Destructor.
Definition: DTConfigBti.cc:147
int AccPattAC1() const
Acceptance pattern AC1.
Definition: DTConfigBti.h:79
int8_t m_lts
Definition: DTConfigBti.h:202
void setKAccTheta(int KAccTh)
Set BTI angular acceptance in theta view.
Definition: DTConfigBti.h:132
void setLH(int LH)
Set K right limit for left traco.
Definition: DTConfigBti.h:168
void setDefaults(const edm::ParameterSet &ps)
Set default parameters.
Definition: DTConfigBti.cc:153
int8_t m_dead
Definition: DTConfigBti.h:219
int8_t m_kacctheta
Definition: DTConfigBti.h:200
int8_t m_ll
Definition: DTConfigBti.h:211
char const * label
int8_t m_4re3
Definition: DTConfigBti.h:218
void setST43(int ST43)
Set ST and RE parameters for drift velocity.
Definition: DTConfigBti.h:183
int LL() const
K left limit for left traco.
Definition: DTConfigBti.h:100
void setSET(int SET)
Set SET.
Definition: DTConfigBti.h:141
void setAccPattACL(int ACL)
Set Acceptance pattern ACL.
Definition: DTConfigBti.h:153
int8_t m_4st3
Definition: DTConfigBti.h:217
BitArray< 32 > m_pattmask
Definition: DTConfigBti.h:209
void setRE43(int RE43)
Definition: DTConfigBti.h:184
void setLTS(int LTS)
Set LTS.
Definition: DTConfigBti.h:138
void setXON(bool XON)
Set X-patterns flag XON: activates tracks passing on the same side of 3 wires.
Definition: DTConfigBti.h:135
void setDEADpar(int DEAD)
Wire DEAD time parameter.
Definition: DTConfigBti.h:187
int RE43() const
Definition: DTConfigBti.h:119
int8_t m_debug
Definition: DTConfigBti.h:198
int KCut() const
Max K param accepted: max bit number.
Definition: DTConfigBti.h:64
int PTMSflag(int patt) const
Pattern mask flag.
Definition: DTConfigBti.h:94
int8_t m_rh
Definition: DTConfigBti.h:216
int8_t m_cl
Definition: DTConfigBti.h:213
void setPTMSflag(int mask, int patt)
Set Pattern mask flag.
Definition: DTConfigBti.h:159
int KAccTheta() const
BTI angular acceptance in theta view.
Definition: DTConfigBti.h:67
int AccPattAC2() const
Acceptance pattern AC2.
Definition: DTConfigBti.h:82
int SET() const
SET.
Definition: DTConfigBti.h:76
void setKCut(int KCut)
Set Max K param accepted: max bit number.
Definition: DTConfigBti.h:129
void print() const
Print the setup.
Definition: DTConfigBti.cc:212
int AccPattACH() const
Acceptance pattern ACH.
Definition: DTConfigBti.h:85
int8_t m_ac2
Definition: DTConfigBti.h:205
int8_t m_ach
Definition: DTConfigBti.h:206
void setCH(int CH)
Set K right limit for center traco.
Definition: DTConfigBti.h:174
int LH() const
K right limit for left traco.
Definition: DTConfigBti.h:103
int RH() const
K right limit for right traco.
Definition: DTConfigBti.h:115
void setRH(int RH)
Set K right limit for right traco.
Definition: DTConfigBti.h:180
int8_t m_ch
Definition: DTConfigBti.h:214
void setAccPattAC2(int AC2)
Set Acceptance pattern AC2.
Definition: DTConfigBti.h:147
bool RONflag() const
Redundant patterns flag RONDTBti/src/DTBtiChipEquations.cc:
Definition: DTConfigBti.h:91
void setAccPattACH(int ACH)
Set Acceptance pattern ACH.
Definition: DTConfigBti.h:150
void setAccPattAC1(int AC1)
Set Acceptance pattern AC1.
Definition: DTConfigBti.h:144
int CL() const
K left limit for center traco.
Definition: DTConfigBti.h:106
DTConfigBti()
Empty Constructor.
Definition: DTConfigBti.h:46
int8_t m_kcut
Definition: DTConfigBti.h:199
int WENflag(int wire) const
Wire mask flag.
Definition: DTConfigBti.h:97
void set(const int i)
Definition: BitArray.h:224
BitArray< 9 > m_wiremask
Definition: DTConfigBti.h:210
bool XON() const
X-patterns flag XON: activates tracks passing on the same side of 3 wires.
Definition: DTConfigBti.h:70
int LTS() const
LTS.
Definition: DTConfigBti.h:73
int8_t m_set
Definition: DTConfigBti.h:203