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