CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTConfigTraco.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: DTConfigTraco
4 //
5 // Description: Configurable parameters and constants for Level1 Mu DT Trigger - TRACO chip
6 //
7 //
8 // Author List:
9 // S.Vanini
10 // Modifications:
11 // April,10th 2008: set TRACO parameters from string
12 //-----------------------------------------------------------------------
13 
14 //-----------------------
15 // This Class's Header --
16 //-----------------------
18 
19 //---------------
20 // C++ Headers --
21 //---------------
22 #include <cstdlib>
23 #include <string>
24 #include <iostream>
25 #include <fstream>
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <math.h>
29 #include <iomanip>
30 
31 //-------------------------------
32 // Collaborating Class Headers --
33 //-------------------------------
34 
36 
37 //----------------
38 // Constructors --
39 //----------------
41 
42  setDefaults(ps);
43 
44 }
45 
46 DTConfigTraco::DTConfigTraco(unsigned short int * buffer) {
47 
48  // check if this is a TRACO configuration string
49  if (buffer[2]!=0x15){
50  throw cms::Exception("DTTPG") << "===> ConfigTraco constructor : not a TRACO string!" << std::endl;
51  }
52 
53  // decode
54  unsigned short int memory_traco[38];
55 
56  for(int i=0;i<38;i++){
57  memory_traco[i] = buffer[i+5];
58  //std::cout << hex << memory_traco[i];
59  }
60  int btic = memory_traco[0] & 0x3f ;
61  int rad = ( ( memory_traco[0] & 0xc0 ) >> 6 ) | ( ( memory_traco[1] & 0x7 ) << 2 ) ;
62  int dd = ( memory_traco[1] & 0xf8 ) >> 3 ;
63  int fprgcomp = memory_traco[2] & 0x3 ;
64  int sprgcomp = memory_traco[3] & 0x3 ;
65  int fhism = ( memory_traco[2] & 0x4 ) != 0 ;
66  int fhtprf = ( memory_traco[2] & 0x8 ) != 0 ;
67  int fslmsk = ( memory_traco[2] & 0x10 ) != 0 ;
68  int fltmsk = ( memory_traco[2] & 0x20 ) != 0 ;
69  int fhtmsk = ( memory_traco[2] & 0x40 ) != 0 ;
70  int shism = ( memory_traco[3] & 0x4 ) != 0 ;
71  int shtprf = ( memory_traco[3] & 0x8 ) != 0 ;
72  int sslmsk = ( memory_traco[3] & 0x10 ) != 0 ;
73  int sltmsk = ( memory_traco[3] & 0x20 ) != 0 ;
74  int shtmsk = ( memory_traco[3] & 0x40 ) != 0 ;
75  int reusei = ( memory_traco[2] & 0x80 ) != 0 ;
76  int reuseo = ( memory_traco[3] & 0x80 ) != 0 ;
77  int ltf = ( memory_traco[4] & 1 ) != 0 ;
78  int lts = ( memory_traco[4] & 2 ) != 0 ;
79  int prgdel = ( memory_traco[4] & 0x1c ) >> 2 ;
80  int snapcor = ( memory_traco[4] & 0xe0 ) >> 5 ;
81  int trgenb[16];
82  for(int it=0; it<2; it++)
83  {
84  trgenb[0+it*8] = memory_traco[5+it] & 0x01;
85  trgenb[1+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
86  trgenb[2+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
87  trgenb[3+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
88  trgenb[4+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
89  trgenb[5+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
90  trgenb[6+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
91  trgenb[7+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
92  }
93  int trgadel = memory_traco[7] & 0x3 ;
94  int ibtioff = ( memory_traco[7] & 0xfc ) >> 2 ;
95  int kprgcom = ( memory_traco[8] & 0xff ) ;
96  int testmode = ( memory_traco[9] & 1 ) != 0 ;
97  int starttest = ( memory_traco[9] & 2 ) != 0 ;
98  int prvsignmux = ( memory_traco[9] & 4 ) != 0 ;
99  int lth = ( memory_traco[9] & 8 ) != 0 ;
100 
101  if(debug()==1)
102  {
103  std::cout << "btic=" << btic
104  << " rad=" << rad
105  << " dd=" << dd
106  << " fprgcomp=" << fprgcomp
107  << " sprgcomp=" << sprgcomp
108  << " fhism=" << fhism
109  << " fhtprf=" << fhtprf
110  << " fslmsk=" << fslmsk
111  << " fltmsk=" << fltmsk
112  << " fhtmsk=" << fhtmsk
113  << " shism=" << shism
114  << " shtprf=" << shtprf
115  << " sslmsk=" << sslmsk
116  << " sltmsk=" << sltmsk
117  << " shtmsk=" << shtmsk
118  << " reusei=" << reusei
119  << " reuseo=" << reuseo
120  << " ltf=" << ltf
121  << " lts=" << lts
122  << " prgdel=" << prgdel
123  << " snapcor=" << snapcor
124  << " trgenb=";
125  for(int t=0; t<16; t++)
126  std::cout << trgenb[t] << " ";
127  std::cout << " trgadel=" << trgadel
128  << " ibtioff=" << ibtioff
129  << " kprgcom=" << kprgcom
130  << " testmode=" << testmode
131  << " starttest=" << starttest
132  << " prvsignmux=" << prvsignmux
133  << " lth=" << lth << std::endl;
134 
135  }
136 
137  // set parameters
138  setBTIC(btic);
139  setKRAD(rad);
140  setDD(dd);
141  setTcKToll(0,fprgcomp);
142  setTcKToll(1,sprgcomp);
143  setSortKascend(0,fhism);
144  setSortKascend(1,shism);
145  setPrefHtrig(0,fhtprf);
146  setPrefHtrig(1,shtprf);
147  setPrefInner(0,fslmsk);
148  setPrefInner(1,sslmsk);
149  setSingleLflag(0,fltmsk);
150  setSingleLflag(1,sltmsk);
151  setSingleHflag(0,fhtmsk);
152  setSingleHflag(1,shtmsk);
153  setTcReuse(0,reusei);
154  setTcReuse(1,reuseo);
155  setSingleLenab(0,ltf);
156  setSingleLenab(1,ltf);
157  setTcBxLts(lts);
158  setIBTIOFF(ibtioff);
159  setBendingAngleCut(kprgcom);
160  setLVALIDIFH(lth);
161  for(int t=0; t<16; t++)
162  setUsedBti(t+1,trgenb[t]);
163 
164  // the following are not relevant for simulation
165  // prgdel, snapcor, trgadel, testmode, starttest, prvsignmux
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  // KRAD traco parameter
184  m_krad = ps.getParameter<int>("KRAD");
185 
186  // BTIC traco parameter
187  m_btic = ps.getParameter<int>("BTIC");
188 
189  // DD traco parameter: this is fixed
190  m_dd = ps.getParameter<int>("DD");
191 
192  // recycling of TRACO cand. in inner/outer SL : REUSEI/REUSEO
193  m_reusei = ps.getParameter<int>("REUSEI");
194  m_reuseo = ps.getParameter<int>("REUSEO");
195 
196  // single HTRIG enabling on first/second tracks F(S)HTMSK
197  m_fhtmsk = ps.getParameter<int>("FHTMSK");
198  m_shtmsk = ps.getParameter<int>("SHTMSK");
199 
200  // single LTRIG enabling on first/second tracks: F(S)LTMSK
201  m_fltmsk = ps.getParameter<int>("FLTMSK");
202  m_sltmsk = ps.getParameter<int>("SLTMSK");
203 
204  // preference to inner on first/second tracks: F(S)SLMSK
205  m_fslmsk = ps.getParameter<int>("FSLMSK");
206  m_sslmsk = ps.getParameter<int>("SSLMSK");
207 
208  // preference to HTRIG on first/second tracks: F(S)HTPRF
209  m_fhtprf = ps.getParameter<int>("FHTPRF");
210  m_shtprf = ps.getParameter<int>("SHTPRF");
211 
212  // ascend. order for K sorting first/second tracks: F(S)HISM
213  m_fhism = ps.getParameter<int>("FHISM");
214  m_shism = ps.getParameter<int>("SHISM");
215 
216  // K tollerance for correlation in TRACO: F(S)PRGCOMP
217  m_fprgcomp = ps.getParameter<int>("FPRGCOMP");
218  m_sprgcomp = ps.getParameter<int>("SPRGCOMP");
219 
220  // suppr. of LTRIG in 4 BX before HTRIG: LTS
221  m_lts = ps.getParameter<int>("LTS");
222 
223  // single LTRIG accept enabling on first/second tracks LTF
224  m_ltf = ps.getParameter<int>("LTF");
225 
226  // Connected bti in traco: bti mask
227  for(int b=0; b<16; b++)
228  {
229  std::string label = "TRGENB";
230  char p0 = (b/10)+'0';
231  char p1 = (b%10)+'0';
232  if ( p0 != '0' )
233  label = label + p0;
234  label = label + p1;
235 
236  m_trgenb.set(b,ps.getParameter<int>(label));
237  }
238 
239  // IBTIOFF traco parameter
240  m_ibtioff = ps.getParameter<int>("IBTIOFF");
241 
242  // bending angle cut for all stations and triggers : KPRGCOM
243  m_kprgcom = ps.getParameter<int>("KPRGCOM");
244 
245  // flag for Low validation parameter
246  m_lvalidifh = ps.getParameter<int>("LVALIDIFH");
247 }
248 
249 void
251  std::cout << "******************************************************************************" << std::endl;
252  std::cout << "* DTTrigger configuration : TRACO chips *" << std::endl;
253  std::cout << "******************************************************************************" << std::endl;
254  std::cout << "* *" << std::endl;
255  std::cout << "Debug flag : " << debug() << std::endl;
256  std::cout << "KRAD traco parameter : " << KRAD() << std::endl;
257  std::cout << "BTIC traco parameter : " << BTIC() << std::endl;
258  std::cout << "DD traco parameter : " << DD() << std::endl;
259  std::cout << "REUSEI, REUSEO : " << TcReuse(0) << ", " << TcReuse(1) << std::endl;
260  std::cout << "FHTMSK, SHTMSK : " << singleHflag(0) << ", " << singleHflag(1) << std::endl;
261  std::cout << "FLTMSK, SLTMSK: " << singleLflag(0) << ", " << singleLflag(1) << std::endl;
262  std::cout << "FSLMSK, SSLMSK : " << prefInner(0) << ", " << prefInner(1) << std::endl;
263  std::cout << "FHTPRF, SHTPRF : " << prefHtrig(0) << ", " << prefHtrig(1) << std::endl;
264  std::cout << "FHISM, SHISM : " << sortKascend(0) << ", " << sortKascend(1) << std::endl;
265  std::cout << "FPRGCOMP, SPRGCOMP : " << TcKToll(0) << ", " << TcKToll(1) << std::endl;
266  std::cout << "LTS : " << TcBxLts() << std::endl;
267  std::cout << "LTF : " << singleLenab(0) << std::endl;
268  std::cout << "Connected bti in traco - bti mask : ";
269  for(int b=1; b<=16; b++)
270  std::cout << usedBti(b) << " ";
271  std::cout << std::endl;
272  std::cout << "IBTIOFF : " << IBTIOFF() << std::endl;
273  std::cout << "bending angle cut : " << BendingAngleCut() << std::endl;
274  std::cout << "flag for Low validation parameter : " << LVALIDIFH() << std::endl;
275  std::cout << "******************************************************************************" << std::endl;
276 
277 }
T getParameter(std::string const &) const
DTConfigTraco()
Constructor.
Definition: DTConfigTraco.h:55
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
void print() const
Print the setup.
void setPrefInner(int i, int prefInner)
Set Preference to inner on first/second tracks: F(S)SLMSK.
void setBTIC(int BTIC)
Set BTIC traco parameter: must be equal to Btis ST parameter.
const std::string & label
Definition: MVAComputer.cc:186
void setDefaults(const edm::ParameterSet &ps)
Set default parameters.
void setSingleLenab(int i, int singleLenab)
Set Single LTRIG accept enabling on first/second tracks LTF.
int KRAD() const
KRAD traco parameter.
Definition: DTConfigTraco.h:70
int prefHtrig(int i) const
Preference to HTRIG on first/second tracks: F(S)HTPRF.
int LVALIDIFH() const
Flag for Low validation parameter.
int8_t m_lvalidifh
void setSortKascend(int i, int sortKascend)
Set Ascend. order for K sorting first/second tracks: F(S)HISM.
int singleLenab(int i) const
Single LTRIG accept enabling on first/second tracks LTF.
void setIBTIOFF(int IBTIOFF)
Set IBTIOFF traco parameter.
int BTIC() const
BTIC traco parameter: must be equal to Btis ST parameter.
Definition: DTConfigTraco.h:73
void setUsedBti(int bti, int mask)
Set Connected bti in traco: bti mask.
void setDD(int DD)
Set DD traco parameter: this is fixed.
void setPrefHtrig(int i, int prefHtrig)
Set Preference to HTRIG on first/second tracks: F(S)HTPRF.
int BendingAngleCut() const
Bending angle cut for all stations and triggers : KPRGCOM.
void setBendingAngleCut(int BendingAngleCut)
Set Bending angle cut for all stations and triggers : KPRGCOM.
BitArray< 16 > m_trgenb
void setTcKToll(int i, int TcKToll)
Set K tollerance for correlation in TRACO: F(S)PRGCOMP.
void setSingleHflag(int i, int singleHflag)
Set Single HTRIG enabling on first/second tracks F(S)HTMSK.
int TcBxLts() const
Suppr. of LTRIG in 4 BX before HTRIG: LTS.
~DTConfigTraco()
Destructor.
void setTcReuse(int i, int TcReuse)
Set Recycling of TRACO cand. in inner/outer SL : REUSEI/REUSEO.
int singleHflag(int i) const
Single HTRIG enabling on first/second tracks F(S)HTMSK.
Definition: DTConfigTraco.h:87
int TcKToll(int i) const
K tollerance for correlation in TRACO: F(S)PRGCOMP.
int prefInner(int i) const
Preference to inner on first/second tracks: F(S)SLMSK.
void setKRAD(int KRAD)
Set KRAD traco parameter.
int16_t m_kprgcom
double b
Definition: hdecay.h:120
void setSingleLflag(int i, int singleLflag)
Set Single LTRIG enabling on first/second tracks: F(S)LTMSK.
int usedBti(int bti) const
Connected bti in traco: bti mask.
double p1[4]
Definition: TauolaWrapper.h:89
void setTcBxLts(int TcBxLts)
Set Suppr. of LTRIG in 4 BX before HTRIG: LTS.
int DD() const
DD traco parameter: this is fixed.
Definition: DTConfigTraco.h:76
int singleLflag(int i) const
Single LTRIG enabling on first/second tracks: F(S)LTMSK.
Definition: DTConfigTraco.h:95
tuple cout
Definition: gather_cfg.py:41
void setLVALIDIFH(int LVALIDIFH)
Set Flag for Low validation parameter.
int TcReuse(int i) const
Recycling of TRACO cand. in inner/outer SL : REUSEI/REUSEO.
Definition: DTConfigTraco.h:79
int debug() const
Debug flag.
Definition: DTConfigTraco.h:67
int sortKascend(int i) const
Ascend. order for K sorting first/second tracks: F(S)HISM.
void set(const int i)
Definition: BitArray.h:230
int IBTIOFF() const
IBTIOFF traco parameter.