CMS 3D CMS Logo

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 <cstdio>
27 #include <cstdlib>
28 #include <cmath>
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(int debugTRACO, unsigned short int * buffer) {
47 
48  m_debug = debugTRACO;
49 
50  // check if this is a TRACO configuration string
51  if (buffer[2]!=0x15){
52  throw cms::Exception("DTTPG") << "===> ConfigTraco constructor : not a TRACO string!" << std::endl;
53  }
54 
55  // decode
56  unsigned short int memory_traco[38];
57 
58  for(int i=0;i<38;i++){
59  memory_traco[i] = buffer[i+5];
60  //std::cout << hex << memory_traco[i];
61  }
62  int btic = memory_traco[0] & 0x3f ;
63  int rad = ( ( memory_traco[0] & 0xc0 ) >> 6 ) | ( ( memory_traco[1] & 0x7 ) << 2 ) ;
64  int dd = ( memory_traco[1] & 0xf8 ) >> 3 ;
65  int fprgcomp = memory_traco[2] & 0x3 ;
66  int sprgcomp = memory_traco[3] & 0x3 ;
67  int fhism = ( memory_traco[2] & 0x4 ) != 0 ;
68  int fhtprf = ( memory_traco[2] & 0x8 ) != 0 ;
69  int fslmsk = ( memory_traco[2] & 0x10 ) != 0 ;
70  int fltmsk = ( memory_traco[2] & 0x20 ) != 0 ;
71  int fhtmsk = ( memory_traco[2] & 0x40 ) != 0 ;
72  int shism = ( memory_traco[3] & 0x4 ) != 0 ;
73  int shtprf = ( memory_traco[3] & 0x8 ) != 0 ;
74  int sslmsk = ( memory_traco[3] & 0x10 ) != 0 ;
75  int sltmsk = ( memory_traco[3] & 0x20 ) != 0 ;
76  int shtmsk = ( memory_traco[3] & 0x40 ) != 0 ;
77  int reusei = ( memory_traco[2] & 0x80 ) != 0 ;
78  int reuseo = ( memory_traco[3] & 0x80 ) != 0 ;
79  int ltf = ( memory_traco[4] & 1 ) != 0 ;
80  int lts = ( memory_traco[4] & 2 ) != 0 ;
81  int prgdel = ( memory_traco[4] & 0x1c ) >> 2 ;
82  int snapcor = ( memory_traco[4] & 0xe0 ) >> 5 ;
83  int trgenb[16];
84  for(int it=0; it<2; it++)
85  {
86  trgenb[0+it*8] = memory_traco[5+it] & 0x01;
87  trgenb[1+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
88  trgenb[2+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
89  trgenb[3+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
90  trgenb[4+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
91  trgenb[5+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
92  trgenb[6+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
93  trgenb[7+it*8] = (memory_traco[5+it] >> 1 ) & 0x01;
94  }
95  int trgadel = memory_traco[7] & 0x3 ;
96  int ibtioff = ( memory_traco[7] & 0xfc ) >> 2 ;
97  int kprgcom = ( memory_traco[8] & 0xff ) ;
98  int testmode = ( memory_traco[9] & 1 ) != 0 ;
99  int starttest = ( memory_traco[9] & 2 ) != 0 ;
100  int prvsignmux = ( memory_traco[9] & 4 ) != 0 ;
101  int lth = ( memory_traco[9] & 8 ) != 0 ;
102 
103  if(debug()==1)
104  {
105  std::cout << "btic=" << btic
106  << " rad=" << rad
107  << " dd=" << dd
108  << " fprgcomp=" << fprgcomp
109  << " sprgcomp=" << sprgcomp
110  << " fhism=" << fhism
111  << " fhtprf=" << fhtprf
112  << " fslmsk=" << fslmsk
113  << " fltmsk=" << fltmsk
114  << " fhtmsk=" << fhtmsk
115  << " shism=" << shism
116  << " shtprf=" << shtprf
117  << " sslmsk=" << sslmsk
118  << " sltmsk=" << sltmsk
119  << " shtmsk=" << shtmsk
120  << " reusei=" << reusei
121  << " reuseo=" << reuseo
122  << " ltf=" << ltf
123  << " lts=" << lts
124  << " prgdel=" << prgdel
125  << " snapcor=" << snapcor
126  << " trgenb=";
127  for(int t=0; t<16; t++)
128  std::cout << trgenb[t] << " ";
129  std::cout << " trgadel=" << trgadel
130  << " ibtioff=" << ibtioff
131  << " kprgcom=" << kprgcom
132  << " testmode=" << testmode
133  << " starttest=" << starttest
134  << " prvsignmux=" << prvsignmux
135  << " lth=" << lth << std::endl;
136 
137  }
138 
139  // set parameters
140  setBTIC(btic);
141  setKRAD(rad);
142  setDD(dd);
143  setTcKToll(0,fprgcomp);
144  setTcKToll(1,sprgcomp);
145  setSortKascend(0,fhism);
146  setSortKascend(1,shism);
147  setPrefHtrig(0,fhtprf);
148  setPrefHtrig(1,shtprf);
149  setPrefInner(0,fslmsk);
150  setPrefInner(1,sslmsk);
151  setSingleLflag(0,fltmsk);
152  setSingleLflag(1,sltmsk);
153  setSingleHflag(0,fhtmsk);
154  setSingleHflag(1,shtmsk);
155  setTcReuse(0,reusei);
156  setTcReuse(1,reuseo);
157  setSingleLenab(0,ltf);
158  setSingleLenab(1,ltf);
159  setTcBxLts(lts);
160  setIBTIOFF(ibtioff);
161  setBendingAngleCut(kprgcom);
162  setLVALIDIFH(lth);
163  for(int t=0; t<16; t++)
164  setUsedBti(t+1,trgenb[t]);
165 
166  // the following are not relevant for simulation
167  // prgdel, snapcor, trgadel, testmode, starttest, prvsignmux
168 }
169 
170 //--------------
171 // Destructor --
172 //--------------
174 
175 //--------------
176 // Operations --
177 //--------------
178 
179 void
181 
182  // Debug flag
183  m_debug = ps.getUntrackedParameter<int>("Debug");
184 
185  // KRAD traco parameter
186  m_krad = ps.getParameter<int>("KRAD");
187 
188  // BTIC traco parameter
189  m_btic = ps.getParameter<int>("BTIC");
190 
191  // DD traco parameter: this is fixed
192  m_dd = ps.getParameter<int>("DD");
193 
194  // recycling of TRACO cand. in inner/outer SL : REUSEI/REUSEO
195  m_reusei = ps.getParameter<int>("REUSEI");
196  m_reuseo = ps.getParameter<int>("REUSEO");
197 
198  // single HTRIG enabling on first/second tracks F(S)HTMSK
199  m_fhtmsk = ps.getParameter<int>("FHTMSK");
200  m_shtmsk = ps.getParameter<int>("SHTMSK");
201 
202  // single LTRIG enabling on first/second tracks: F(S)LTMSK
203  m_fltmsk = ps.getParameter<int>("FLTMSK");
204  m_sltmsk = ps.getParameter<int>("SLTMSK");
205 
206  // preference to inner on first/second tracks: F(S)SLMSK
207  m_fslmsk = ps.getParameter<int>("FSLMSK");
208  m_sslmsk = ps.getParameter<int>("SSLMSK");
209 
210  // preference to HTRIG on first/second tracks: F(S)HTPRF
211  m_fhtprf = ps.getParameter<int>("FHTPRF");
212  m_shtprf = ps.getParameter<int>("SHTPRF");
213 
214  // ascend. order for K sorting first/second tracks: F(S)HISM
215  m_fhism = ps.getParameter<int>("FHISM");
216  m_shism = ps.getParameter<int>("SHISM");
217 
218  // K tollerance for correlation in TRACO: F(S)PRGCOMP
219  m_fprgcomp = ps.getParameter<int>("FPRGCOMP");
220  m_sprgcomp = ps.getParameter<int>("SPRGCOMP");
221 
222  // suppr. of LTRIG in 4 BX before HTRIG: LTS
223  m_lts = ps.getParameter<int>("LTS");
224 
225  // single LTRIG accept enabling on first/second tracks LTF
226  m_ltf = ps.getParameter<int>("LTF");
227 
228  // Connected bti in traco: bti mask
229  for(int b=0; b<16; b++)
230  {
231  std::string label = "TRGENB";
232  char p0 = (b/10)+'0';
233  char p1 = (b%10)+'0';
234  if ( p0 != '0' )
235  label = label + p0;
236  label = label + p1;
237 
238  m_trgenb.set(b,ps.getParameter<int>(label));
239  }
240 
241  // IBTIOFF traco parameter
242  m_ibtioff = ps.getParameter<int>("IBTIOFF");
243 
244  // bending angle cut for all stations and triggers : KPRGCOM
245  m_kprgcom = ps.getParameter<int>("KPRGCOM");
246 
247  // flag for Low validation parameter
248  m_lvalidifh = ps.getParameter<int>("LVALIDIFH");
249 }
250 
251 void
253  std::cout << "******************************************************************************" << std::endl;
254  std::cout << "* DTTrigger configuration : TRACO chips *" << std::endl;
255  std::cout << "******************************************************************************" << std::endl;
256  std::cout << "* *" << std::endl;
257  std::cout << "Debug flag : " << debug() << std::endl;
258  std::cout << "KRAD traco parameter : " << KRAD() << std::endl;
259  std::cout << "BTIC traco parameter : " << BTIC() << std::endl;
260  std::cout << "DD traco parameter : " << DD() << std::endl;
261  std::cout << "REUSEI, REUSEO : " << TcReuse(0) << ", " << TcReuse(1) << std::endl;
262  std::cout << "FHTMSK, SHTMSK : " << singleHflag(0) << ", " << singleHflag(1) << std::endl;
263  std::cout << "FLTMSK, SLTMSK: " << singleLflag(0) << ", " << singleLflag(1) << std::endl;
264  std::cout << "FSLMSK, SSLMSK : " << prefInner(0) << ", " << prefInner(1) << std::endl;
265  std::cout << "FHTPRF, SHTPRF : " << prefHtrig(0) << ", " << prefHtrig(1) << std::endl;
266  std::cout << "FHISM, SHISM : " << sortKascend(0) << ", " << sortKascend(1) << std::endl;
267  std::cout << "FPRGCOMP, SPRGCOMP : " << TcKToll(0) << ", " << TcKToll(1) << std::endl;
268  std::cout << "LTS : " << TcBxLts() << std::endl;
269  std::cout << "LTF : " << singleLenab(0) << std::endl;
270  std::cout << "Connected bti in traco - bti mask : ";
271  for(int b=1; b<=16; b++)
272  std::cout << usedBti(b) << " ";
273  std::cout << std::endl;
274  std::cout << "IBTIOFF : " << IBTIOFF() << std::endl;
275  std::cout << "bending angle cut : " << BendingAngleCut() << std::endl;
276  std::cout << "flag for Low validation parameter : " << LVALIDIFH() << std::endl;
277  std::cout << "******************************************************************************" << std::endl;
278 
279 }
T getParameter(std::string const &) const
DTConfigTraco()
Constructor.
Definition: DTConfigTraco.h:55
T getUntrackedParameter(std::string const &, T const &) const
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.
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.
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
Definition: DDUnits.h:8
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.
~DTConfigTraco() override
Destructor.