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::usedBti
int usedBti(int bti) const
Connected bti in traco: bti mask.
Definition: DTConfigTraco.h:136
DTConfigTraco::sortKascend
int sortKascend(int i) const
Ascend. order for K sorting first/second tracks: F(S)HISM.
Definition: DTConfigTraco.h:114
DTConfigTraco::m_btic
int8_t m_btic
Definition: DTConfigTraco.h:245
DTConfigTraco::BTIC
int BTIC() const
BTIC traco parameter: must be equal to Btis ST parameter.
Definition: DTConfigTraco.h:68
mps_fire.i
i
Definition: mps_fire.py:355
DTConfigTraco::setTcKToll
void setTcKToll(int i, int TcKToll)
Set K tollerance for correlation in TRACO: F(S)PRGCOMP.
Definition: DTConfigTraco.h:209
DTConfigTraco::m_debug
int8_t m_debug
Definition: DTConfigTraco.h:243
DTConfigTraco::~DTConfigTraco
~DTConfigTraco() override
Destructor.
Definition: DTConfigTraco.cc:144
DTConfigTraco::prefHtrig
int prefHtrig(int i) const
Preference to HTRIG on first/second tracks: F(S)HTPRF.
Definition: DTConfigTraco.h:106
DTConfigTraco::m_fprgcomp
int8_t m_fprgcomp
Definition: DTConfigTraco.h:259
DTConfigTraco::DTConfigTraco
DTConfigTraco()
Constructor.
Definition: DTConfigTraco.h:50
DTConfigTraco::setIBTIOFF
void setIBTIOFF(int IBTIOFF)
Set IBTIOFF traco parameter.
Definition: DTConfigTraco.h:226
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DTConfigTraco::setPrefHtrig
void setPrefHtrig(int i, int prefHtrig)
Set Preference to HTRIG on first/second tracks: F(S)HTPRF.
Definition: DTConfigTraco.h:193
DTConfigTraco::TcReuse
int TcReuse(int i) const
Recycling of TRACO cand. in inner/outer SL : REUSEI/REUSEO.
Definition: DTConfigTraco.h:74
DTConfigTraco::m_reuseo
int8_t m_reuseo
Definition: DTConfigTraco.h:248
DTConfigTraco::m_fhism
int8_t m_fhism
Definition: DTConfigTraco.h:257
DTConfigTraco::setBendingAngleCut
void setBendingAngleCut(int BendingAngleCut)
Set Bending angle cut for all stations and triggers : KPRGCOM.
Definition: DTConfigTraco.h:229
DTConfigTraco::setSortKascend
void setSortKascend(int i, int sortKascend)
Set Ascend. order for K sorting first/second tracks: F(S)HISM.
Definition: DTConfigTraco.h:201
DTConfigTraco::setDD
void setDD(int DD)
Set DD traco parameter: this is fixed.
Definition: DTConfigTraco.h:158
DTConfigTraco::TcBxLts
int TcBxLts() const
Suppr. of LTRIG in 4 BX before HTRIG: LTS.
Definition: DTConfigTraco.h:130
DTConfigTraco::m_fhtmsk
int8_t m_fhtmsk
Definition: DTConfigTraco.h:249
DTConfigTraco::m_kprgcom
int16_t m_kprgcom
Definition: DTConfigTraco.h:265
DTConfigTraco::m_ltf
int8_t m_ltf
Definition: DTConfigTraco.h:262
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DTConfigTraco::setSingleLflag
void setSingleLflag(int i, int singleLflag)
Set Single LTRIG enabling on first/second tracks: F(S)LTMSK.
Definition: DTConfigTraco.h:177
DTConfigTraco::setTcBxLts
void setTcBxLts(int TcBxLts)
Set Suppr. of LTRIG in 4 BX before HTRIG: LTS.
Definition: DTConfigTraco.h:217
DTConfigTraco::setUsedBti
void setUsedBti(int bti, int mask)
Set Connected bti in traco: bti mask.
Definition: DTConfigTraco.h:223
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
DTConfigTraco::TcKToll
int TcKToll(int i) const
K tollerance for correlation in TRACO: F(S)PRGCOMP.
Definition: DTConfigTraco.h:122
DTConfigTraco::m_ibtioff
int8_t m_ibtioff
Definition: DTConfigTraco.h:264
DTConfigTraco::KRAD
int KRAD() const
KRAD traco parameter.
Definition: DTConfigTraco.h:65
DTConfigTraco.h
DTConfigTraco::LVALIDIFH
int LVALIDIFH() const
Flag for Low validation parameter.
Definition: DTConfigTraco.h:145
DTConfigTraco::m_fhtprf
int8_t m_fhtprf
Definition: DTConfigTraco.h:255
OrderedSet.t
t
Definition: OrderedSet.py:90
b
double b
Definition: hdecay.h:118
createTree.dd
string dd
Definition: createTree.py:154
DTConfigTraco::m_lts
int8_t m_lts
Definition: DTConfigTraco.h:261
DTConfigTraco::m_shism
int8_t m_shism
Definition: DTConfigTraco.h:258
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DTConfigTraco::m_shtmsk
int8_t m_shtmsk
Definition: DTConfigTraco.h:250
DTConfigTraco::m_dd
int8_t m_dd
Definition: DTConfigTraco.h:246
edm::ParameterSet
Definition: ParameterSet.h:36
DTConfigTraco::m_fltmsk
int8_t m_fltmsk
Definition: DTConfigTraco.h:251
DTConfigTraco::print
void print() const
Print the setup.
Definition: DTConfigTraco.cc:219
DTConfigTraco::m_fslmsk
int8_t m_fslmsk
Definition: DTConfigTraco.h:253
DTConfigTraco::setKRAD
void setKRAD(int KRAD)
Set KRAD traco parameter.
Definition: DTConfigTraco.h:152
DTConfigTraco::m_sprgcomp
int8_t m_sprgcomp
Definition: DTConfigTraco.h:260
DTConfigTraco::setPrefInner
void setPrefInner(int i, int prefInner)
Set Preference to inner on first/second tracks: F(S)SLMSK.
Definition: DTConfigTraco.h:185
DTConfigTraco::setDefaults
void setDefaults(const edm::ParameterSet &ps)
Set default parameters.
Definition: DTConfigTraco.cc:150
DTConfigTraco::setSingleLenab
void setSingleLenab(int i, int singleLenab)
Set Single LTRIG accept enabling on first/second tracks LTF.
Definition: DTConfigTraco.h:220
DTConfigTraco::setBTIC
void setBTIC(int BTIC)
Set BTIC traco parameter: must be equal to Btis ST parameter.
Definition: DTConfigTraco.h:155
DTConfigTraco::m_sslmsk
int8_t m_sslmsk
Definition: DTConfigTraco.h:254
DTConfigTraco::DD
int DD() const
DD traco parameter: this is fixed.
Definition: DTConfigTraco.h:71
p1
double p1[4]
Definition: TauolaWrapper.h:89
DTConfigTraco::m_trgenb
BitArray< 16 > m_trgenb
Definition: DTConfigTraco.h:263
DTConfigTraco::m_reusei
int8_t m_reusei
Definition: DTConfigTraco.h:247
DTConfigTraco::singleLenab
int singleLenab(int i) const
Single LTRIG accept enabling on first/second tracks LTF.
Definition: DTConfigTraco.h:133
DTConfigTraco::prefInner
int prefInner(int i) const
Preference to inner on first/second tracks: F(S)SLMSK.
Definition: DTConfigTraco.h:98
DTConfigTraco::setTcReuse
void setTcReuse(int i, int TcReuse)
Set Recycling of TRACO cand. in inner/outer SL : REUSEI/REUSEO.
Definition: DTConfigTraco.h:161
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
DTConfigTraco::setSingleHflag
void setSingleHflag(int i, int singleHflag)
Set Single HTRIG enabling on first/second tracks F(S)HTMSK.
Definition: DTConfigTraco.h:169
DTConfigTraco::singleLflag
int singleLflag(int i) const
Single LTRIG enabling on first/second tracks: F(S)LTMSK.
Definition: DTConfigTraco.h:90
Exception
Definition: hltDiff.cc:246
DTConfigTraco::BendingAngleCut
int BendingAngleCut() const
Bending angle cut for all stations and triggers : KPRGCOM.
Definition: DTConfigTraco.h:142
Exception.h
BitArray::set
void set(const int i)
Definition: BitArray.h:224
DTConfigTraco::m_lvalidifh
int8_t m_lvalidifh
Definition: DTConfigTraco.h:266
DTConfigTraco::IBTIOFF
int IBTIOFF() const
IBTIOFF traco parameter.
Definition: DTConfigTraco.h:139
DTConfigTraco::m_shtprf
int8_t m_shtprf
Definition: DTConfigTraco.h:256
DTConfigTraco::m_krad
int8_t m_krad
Definition: DTConfigTraco.h:244
label
const char * label
Definition: PFTauDecayModeTools.cc:11
DTConfigTraco::m_sltmsk
int8_t m_sltmsk
Definition: DTConfigTraco.h:252
DTConfigTraco::singleHflag
int singleHflag(int i) const
Single HTRIG enabling on first/second tracks F(S)HTMSK.
Definition: DTConfigTraco.h:82
DTConfigTraco::setLVALIDIFH
void setLVALIDIFH(int LVALIDIFH)
Set Flag for Low validation parameter.
Definition: DTConfigTraco.h:232
DTConfigTraco::debug
int debug() const
Debug flag.
Definition: DTConfigTraco.h:62