CMS 3D CMS Logo

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