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