CMS 3D CMS Logo

VersionControl.cc
Go to the documentation of this file.
2 
3 VersionControl::VersionControl(const edm::ParameterSet& iConfig) : config_(iConfig) {
4  // All the configurables from python/simEmtfDigis_cfi.py must be visible to this class, except InputTags.
5  verbose_ = iConfig.getUntrackedParameter<int>("verbosity");
6  useO2O_ = iConfig.getParameter<bool>("FWConfig");
7  era_ = iConfig.getParameter<std::string>("Era");
8  // Run 3 CCLUT
9  useRun3CCLUT_OTMB_ = iConfig.getParameter<bool>("UseRun3CCLUT_OTMB");
10  useRun3CCLUT_TMB_ = iConfig.getParameter<bool>("UseRun3CCLUT_TMB");
11 
12  useDT_ = iConfig.getParameter<bool>("DTEnable");
13  useCSC_ = iConfig.getParameter<bool>("CSCEnable");
14  useRPC_ = iConfig.getParameter<bool>("RPCEnable");
15  useIRPC_ = iConfig.getParameter<bool>("IRPCEnable");
16  useCPPF_ = iConfig.getParameter<bool>("CPPFEnable");
17  useGEM_ = iConfig.getParameter<bool>("GEMEnable");
18  useME0_ = iConfig.getParameter<bool>("ME0Enable");
19 
20  minBX_ = iConfig.getParameter<int>("MinBX");
21  maxBX_ = iConfig.getParameter<int>("MaxBX");
22  bxWindow_ = iConfig.getParameter<int>("BXWindow");
23  bxShiftCSC_ = iConfig.getParameter<int>("CSCInputBXShift");
24  bxShiftRPC_ = iConfig.getParameter<int>("RPCInputBXShift");
25  bxShiftGEM_ = iConfig.getParameter<int>("GEMInputBXShift");
26  bxShiftME0_ = iConfig.getParameter<int>("ME0InputBXShift");
27 
28  auto spPCParams16 = iConfig.getParameter<edm::ParameterSet>("spPCParams16");
29  zoneBoundaries_ = spPCParams16.getParameter<std::vector<int> >("ZoneBoundaries");
30  zoneOverlap_ = spPCParams16.getParameter<int>("ZoneOverlap");
31  includeNeighbor_ = spPCParams16.getParameter<bool>("IncludeNeighbor");
32  duplicateTheta_ = spPCParams16.getParameter<bool>("DuplicateTheta");
33  fixZonePhi_ = spPCParams16.getParameter<bool>("FixZonePhi");
34  useNewZones_ = spPCParams16.getParameter<bool>("UseNewZones");
35  fixME11Edges_ = spPCParams16.getParameter<bool>("FixME11Edges");
36 
37  auto spPRParams16 = iConfig.getParameter<edm::ParameterSet>("spPRParams16");
38  pattDefinitions_ = spPRParams16.getParameter<std::vector<std::string> >("PatternDefinitions");
39  symPattDefinitions_ = spPRParams16.getParameter<std::vector<std::string> >("SymPatternDefinitions");
40  useSymPatterns_ = spPRParams16.getParameter<bool>("UseSymmetricalPatterns");
41 
42  auto spTBParams16 = iConfig.getParameter<edm::ParameterSet>("spTBParams16");
43  thetaWindow_ = spTBParams16.getParameter<int>("ThetaWindow");
44  thetaWindowZone0_ = spTBParams16.getParameter<int>("ThetaWindowZone0");
45  useSingleHits_ = spTBParams16.getParameter<bool>("UseSingleHits");
46  bugSt2PhDiff_ = spTBParams16.getParameter<bool>("BugSt2PhDiff");
47  bugME11Dupes_ = spTBParams16.getParameter<bool>("BugME11Dupes");
48  bugAmbigThetaWin_ = spTBParams16.getParameter<bool>("BugAmbigThetaWin");
49  twoStationSameBX_ = spTBParams16.getParameter<bool>("TwoStationSameBX");
50 
51  auto spGCParams16 = iConfig.getParameter<edm::ParameterSet>("spGCParams16");
52  maxRoadsPerZone_ = spGCParams16.getParameter<int>("MaxRoadsPerZone");
53  maxTracks_ = spGCParams16.getParameter<int>("MaxTracks");
54  useSecondEarliest_ = spGCParams16.getParameter<bool>("UseSecondEarliest");
55  bugSameSectorPt0_ = spGCParams16.getParameter<bool>("BugSameSectorPt0");
56 
57  auto spPAParams16 = iConfig.getParameter<edm::ParameterSet>("spPAParams16");
58  readPtLUTFile_ = spPAParams16.getParameter<bool>("ReadPtLUTFile");
59  fixMode15HighPt_ = spPAParams16.getParameter<bool>("FixMode15HighPt");
60  bug9BitDPhi_ = spPAParams16.getParameter<bool>("Bug9BitDPhi");
61  bugMode7CLCT_ = spPAParams16.getParameter<bool>("BugMode7CLCT");
62  bugNegPt_ = spPAParams16.getParameter<bool>("BugNegPt");
63  bugGMTPhi_ = spPAParams16.getParameter<bool>("BugGMTPhi");
64  promoteMode7_ = spPAParams16.getParameter<bool>("PromoteMode7");
65  modeQualVer_ = spPAParams16.getParameter<int>("ModeQualVer");
66  pbFileName_ = spPAParams16.getParameter<std::string>("ProtobufFileName");
67 }
68 
70 
71 // Refer to docs/EMTF_FW_LUT_versions_2016_draft2.xlsx
72 void VersionControl::configure_by_fw_version(unsigned fw_version) {
73  if (fw_version == 0 || fw_version == 123456) // fw_version '123456' is from the fake conditions
74  return;
75 
76  // For now, no switches later than FW version 47864 (end-of-year 2016)
77  // Beggining in late 2016, "fw_version" in O2O populated with timestamp, rather than FW version
78  // tm fw_time = gmtime(fw_version); (See https://linux.die.net/man/3/gmtime, https://www.epochconverter.com)
79 
83  if (fw_version >= 1514764800) { // January 1, 2018
84 
85  // Settings for all of 2018 (following order in simEmtfDigis_cfi.py)
86  // BXWindow(2) and BugAmbigThetaWin(F) deployed sometime before stable beams on March 20, not quite sure when - AWB 26.04.18
87  // TwoStationSameBX(T), ThetaWindowZone0(4), and ModeQualVer(2) to be deployed sometime between May 17 and May 31 - AWB 14.05.18
88 
89  // Global parameters
90  // Defaults : CSCEnable(T), RPCEnable(T), GEMEnable(F), Era("Run2_2018"), MinBX(-3), MaxBX(+3), BXWindow(2)
91  // --------------------------------------------------------------------------------------------------------
92  era_ = "Run2_2018"; // Era for CMSSW customization
93  bxWindow_ = 2; // Number of BX whose primitives can be included in the same track
94 
95  // spTBParams16 : Sector processor track-building parameters
96  // Defaults : PrimConvLUT(1), ZoneBoundaries(0,41,49,87,127), ZoneOverlap(2), IncludeNeighbor(T),
97  // DuplicateThteta(T), FixZonePhi(T), UseNewZones(F), FixME11Edges(T)
98  // ------------------------------------------------------------------------------
99 
100  // spPRParams16 : Sector processor pattern-recognition parameters
101  // Defaults : PatternDefinitions(...), SymPatternDefinitions(...), UseSymmetricalPatterns(T)
102  // -----------------------------------------------------------------------------------------
103 
104  // spTBParams16 : Sector processor track-building parameters
105  // Defaults : ThetaWindow(8), ThetaWindowZone0(4), UseSingleHits(F), BugSt2PhDiff(F),
106  // BugME11Dupes(F), BugAmbigThetaWin(F), TwoStationSameBX(T)
107  // ----------------------------------------------------------------------------------
108  thetaWindow_ = 8; // Maximum dTheta between primitives in the same track
109  thetaWindowZone0_ = 4; // Maximum dTheta between primitives in the same track in Zone 0 (ring 1)
110  bugAmbigThetaWin_ = false; // Can allow dThetas outside window when there are 2 LCTs in the same chamber
111  twoStationSameBX_ = true; // Requires the hits in two-station tracks to have the same BX
112 
113  // spGCParams16 : Sector processor ghost-cancellation parameters
114  // Defaults : MaxRoadsPerZone(3), MaxTracks(3), UseSecondEarliest(T), BugSameSectorPt0(F)
115  // --------------------------------------------------------------------------------------
116 
117  // spPAParams16 : Sector processor pt-assignment parameters
118  // Defaults : ReadPtLUTFile(F), FixMode15HighPt(T), Bug9BitDPhi(F), BugMode7CLCT(F),
119  // BugNegPt(F), BugGMTPhi(F), PromoteMode7(F), ModeQualVer(2)
120  // ---------------------------------------------------------------------------------
121  modeQualVer_ = 2; // Version 2 contains modified mode-quality mapping for 2018
122  promoteMode7_ = false; // Assign station 2-3-4 tracks with |eta| > 1.6 SingleMu quality
123 
124  // ___________________________________________________________________________
125  // Versions in 2018 - no external documentation
126  // As of the beginning of 2018 EMTF O2O was broken, not updating the database with online conditions
127  // Firmware version reported for runs before 318841 (June 28) is 1504018578 (Aug. 29, 2017) even though
128  // updates occured in February and March of 2018. May need to re-write history in the database. - AWB 30.06.18
129 
130  if (fw_version < 1529520380) { // June 20, 2018
131  thetaWindowZone0_ = 8; // Maximum dTheta between primitives in the same track in Zone 0 (ring 1)
132  twoStationSameBX_ = false; // Requires the hits in two-station tracks to have the same BX
133  modeQualVer_ = 1; // Version 2 contains modified mode-quality mapping for 2018
134  promoteMode7_ = true; // Assign station 2-3-4 tracks with |eta| > 1.6 SingleMu quality
135  }
136 
137  return;
138  }
139 
143  else if (fw_version >= 50000) {
144  // Settings for all of 2017 (following order in simEmtfDigis_cfi.py)
145 
146  // Global parameters
147  // Defaults : CSCEnable(T), RPCEnable(T), GEMEnable(F), Era("Run2_2018"), MinBX(-3), MaxBX(+3), BXWindow(2)
148  // --------------------------------------------------------------------------------------------------------
149  era_ = "Run2_2017"; // Era for CMSSW customization
150  bxWindow_ = 3; // Number of BX whose primitives can be included in the same track
151 
152  // spTBParams16 : Sector processor track-building parameters
153  // Defaults : PrimConvLUT(1), ZoneBoundaries(0,41,49,87,127), ZoneOverlap(2), IncludeNeighbor(T),
154  // DuplicateThteta(T), FixZonePhi(T), UseNewZones(F), FixME11Edges(T)
155  // ------------------------------------------------------------------------------
156 
157  // spPRParams16 : Sector processor pattern-recognition parameters
158  // Defaults : PatternDefinitions(...), SymPatternDefinitions(...), UseSymmetricalPatterns(T)
159  // -----------------------------------------------------------------------------------------
160 
161  // spTBParams16 : Sector processor track-building parameters
162  // Defaults : ThetaWindow(8), ThetaWindowZone0(4), UseSingleHits(F), BugSt2PhDiff(F),
163  // BugME11Dupes(F), BugAmbigThetaWin(F), TwoStationSameBX(T)
164  // ----------------------------------------------------------------------------------
165  thetaWindow_ = 8; // Maximum dTheta between primitives in the same track
166  thetaWindowZone0_ = 8; // Maximum dTheta between primitives in the same track in Zone 0 (ring 1)
167  bugAmbigThetaWin_ = true; // Can allow dThetas outside window when there are 2 LCTs in the same chamber
168  twoStationSameBX_ = false; // Requires the hits in two-station tracks to have the same BX
169 
170  // spGCParams16 : Sector processor ghost-cancellation parameters
171  // Defaults : MaxRoadsPerZone(3), MaxTracks(3), UseSecondEarliest(T), BugSameSectorPt0(F)
172  // --------------------------------------------------------------------------------------
173 
174  // spPAParams16 : Sector processor pt-assignment parameters
175  // Defaults : ReadPtLUTFile(F), FixMode15HighPt(T), Bug9BitDPhi(F), BugMode7CLCT(F),
176  // BugNegPt(F), BugGMTPhi(F), PromoteMode7(F)
177  // ---------------------------------------------------------------------------------
178  modeQualVer_ = 1; // Version 2 contains modified mode-quality mapping for 2018
179 
180  // ___________________________________________________________________________
181  // Versions in 2017 - no full documentation, can refer to https://twiki.cern.ch/twiki/bin/viewauth/CMS/L1KnownIssues
182 
183  // Before July 9th (runs < 298653), all mode 7 tracks (station 2-3-4) assigned quality 11
184  // July 9th - 29th (runs 298653 - 300087), mode 7 tracks with |eta| > 1.6 in sector -6 assigned quality 12
185  // After July 29th (runs >= 300088), mode 7 track promotion applied in all sectors
186  // For some reason, the FW version in the database is 1496792995, at least for runs >= 298034 (July 4),
187  // which is towards the end of run 2017B (could not check earlier runs). This corresponds to the date "June 6th",
188  // which is a month earlier than the first firmware update to apply this promotion. So something's screwey.
189  // Since July 18 is in the middle of the single-sector-fix period, would like to use a firmware version with
190  // roughly that date. But this may require an intervention in the database. - AWB 04.08.17
191  // Last firmware version in 2017 was 1504018578 (Aug. 29, 2017).
192  if (fw_version >= 1496792995)
193  promoteMode7_ = true; // Assign station 2-3-4 tracks with |eta| > 1.6 SingleMu quality
194 
195  return;
196  }
197 
201  else {
202  // Global parameters
203  // Defaults : CSCEnable(T), RPCEnable(T), GEMEnable(F), Era("Run2_2018"), MinBX(-3), MaxBX(+3), BXWindow(2)
204  // --------------------------------------------------------------------------------------------------------
205  useRPC_ = false; // Use clustered RPC hits from CPPF in track-building
206  era_ = "Run2_2016"; // Era for CMSSW customization
207  // maxBX_ // Depends on FW version, see below
208  bxWindow_ = 3; // Number of BX whose primitives can be included in the same track
209 
210  // spTBParams16 : Sector processor track-building parameters
211  // Defaults : PrimConvLUT(1), ZoneBoundaries(0,41,49,87,127), ZoneOverlap(2), IncludeNeighbor(T),
212  // DuplicateThteta(T), FixZonePhi(T), UseNewZones(F), FixME11Edges(T)
213  // ------------------------------------------------------------------------------
214  // primConvLUT_ // Should be 0 for 2016, set using get_pc_lut_version() from ConditionsHelper.cc
215  // fixZonePhi_ // Depends on FW version, see below
216  fixME11Edges_ = false; // Improved small fraction of buggy LCT coordinate transformations
217 
218  // spPRParams16 : Sector processor pattern-recognition parameters
219  // Defaults : PatternDefinitions(...), SymPatternDefinitions(...), UseSymmetricalPatterns(T)
220  // -----------------------------------------------------------------------------------------
221  // useSymPatterns_ // Depends on FW version, see below
222 
223  // spTBParams16 : Sector processor track-building parameters
224  // Defaults : ThetaWindow(8), ThetaWindowZone0(4), UseSingleHits(F), BugSt2PhDiff(F),
225  // BugME11Dupes(F), BugAmbigThetaWin(F), TwoStationSameBX(T)
226  // ----------------------------------------------------------------------------------
227  thetaWindow_ = 4; // Maximum dTheta between primitives in the same track
228  thetaWindowZone0_ = 4; // Maximum dTheta between primitives in the same track in Zone 0 (ring 1)
229  // bugSt2PhDiff_ // Depends on FW version, see below
230  // bugME11Dupes_ // Depends on FW version, see below
231  bugAmbigThetaWin_ = true; // Can allow dThetas outside window when there are 2 LCTs in the same chamber
232  twoStationSameBX_ = false; // Requires the hits in two-station tracks to have the same BX
233 
234  // spGCParams16 : Sector processor ghost-cancellation parameters
235  // Defaults : MaxRoadsPerZone(3), MaxTracks(3), UseSecondEarliest(T), BugSameSectorPt0(F)
236  // --------------------------------------------------------------------------------------
237  // useSecondEarliest_ // Depends on FW version, see below
238  // bugSameSectorPt0_ // Depends on FW version, see below
239 
240  // spPAParams16 : Sector processor pt-assignment parameters
241  // Defaults : ReadPtLUTFile(F), FixMode15HighPt(T), Bug9BitDPhi(F), BugMode7CLCT(F),
242  // BugNegPt(F), BugGMTPhi(F), PromoteMode7(F)
243  // ---------------------------------------------------------------------------------
244  // fixMode15HighPt_ // Depends on FW version, see below
245  // bug9BitDPhi_ // Depends on FW version, see below
246  // bugMode7CLCT_ // Depends on FW version, see below
247  // bugNegPt_ // Depends on FW version, see below
248  bugGMTPhi_ = true; // Some drift in uGMT phi conversion, off by up to a few degrees
249  modeQualVer_ = 1; // Version 2 contains modified mode-quality mapping for 2018
250 
251  } // End default settings for 2016
252 
253  // ___________________________________________________________________________
254  // Versions in 2016 - refer to docs/EMTF_FW_LUT_versions_2016_draft2.xlsx
255 
256  // 1st_LCT_BX / 2nd_LCT_BX (should also make unpacker configurable - AWB 21.07.17)
257  // FW: Before: Earliest LCT used to assign BX, tracks only cancel within same BX
258  // After: Second-earliest LCT used to assign BX, tracks cancel over 3 BX, improved LCT recovery
259  useSecondEarliest_ = (fw_version < 46773) ? false : true; // Changed Sept. 5
260 
261  // 8_BX_readout / 7_BX_readout
262  // SW: DAQ readout changed from to [-3, +4] BX to [-3, +3] BX
263  maxBX_ = (fw_version < 47109) ? +4 : +3; // Changed Sept. 28
264 
265  // Asymm_patterns / Symm_patterns
266  // FW: Changed from 9 asymmetric patterns to 5 symmetric patterns for track building
267  useSymPatterns_ = (fw_version < 47214) ? false : true; // Changed Oct. 6
268 
269  // HiPt_outlier
270  // LUT: High-pT fix puts outlier LCTs in mode 15 tracks back in a straight line
271  fixMode15HighPt_ = (fw_version < 46650) ? false : true; // Changed July 25
272 
273  // Link_monitor (unpacker only)
274  // FW: Added MPC link monitoring
275 
276  // ___________________________________________________________________________
277  // Bugs
278 
279  // DAQ_ID (unpacker only; should make configurable - AWB 21.07.17)
280  // FW: DAQ ME with output CSC ID range 0 - 8 instead of 1 - 9
281  // SP output ME2_ID, 3_ID, and 4_ID filled with 4, 5, or 6 when they should have been 7, 8, or 9.
282 
283  // ME_ID_FR
284  // FW: Incorrect ME_ID fields in DAQ, wrong FR bits and some dPhi wrap-around in pT LUT address
285  // - Unpacker only, or not worth emulating
286 
287  // DAQ_miss_LCT (unpacker only)
288  // FW: LCTs only output if there was a track in the sector
289 
290  // Sector_pT_0
291  // FW: Only highest-quality track in a sector assigned pT; others assigned pT = 0
292  bugSameSectorPt0_ = (fw_version < 46650) ? true : false; // Fixed July 22
293 
294  // Sector_bad_pT
295  // FW: Tracks sometimes assigned pT of track in previous BX
296  // - This is an ongoing (very rare) bug which occurs when 2 tracks try to access the same "bank" in the pT LUT
297  // It would be very difficult to emulate exactly, but the logic from Alex Madorsky is below
298  // ## macro for detecting same bank address
299  // ## bank and chip must match, and valid flags must be set
300  // ## a and b are indexes 0,1,2
301  // ## [X:Y] are bit portions from ptlut address words
302  // `define sb(a,b) (ptlut_addr[a][29:26] == ptlut_addr[b][29:26] && ptlut_addr[a][5:2] == ptlut_addr[b][5:2] && ptlut_addr_val[a] && ptlut_addr_val[b])
303  // ## This macro is used like this:
304  // if (`sb(0,2) || `sb(1,2)) {disable PT readout for track 2}
305 
306  // DAQ_BX_3_LCT (unpacker only)
307  // SW: LCTs in BX -3 only reported if there was a track in the sector
308  // - not applicable
309 
310  // DAQ_BX_23_LCT (unpacker only)
311  // SW: LCTs in BX -2 and -3 only reported if there was a track in the sector
312  // - not applicable
313 
314  // pT_dPhi_bits
315  // FW: dPhi wrap-around in modes 3, 5, 6, 9, 10, 12
316  bug9BitDPhi_ = (fw_version < 47214) ? true : false; // Fixed Oct. 6
317 
318  // Pattern_phi / ME1_neigh_phi
319  // FW: Pattern phi slightly offset from true LCT phi; also ME3/4 pattern width off
320  // Pattern phi of neighbor hits in ME1 miscalculated
321  fixZonePhi_ = (fw_version < 47214) ? false : true; // Fixed Oct. 6
322 
323  // LCT_station_2
324  // FW: Reduced LCT matching window in station 2, resulting in demoted tracks and inefficiency
325  bugSt2PhDiff_ = (47109 <= fw_version && fw_version < 47249) ? true : false; // Bug introduced Oct. 6, fixed Oct. 19
326 
327  // LCT_theta_dup
328  // FW: LCTs matched to track may take theta value from other LCT in the same chamber
329  bugME11Dupes_ = (fw_version < 47423) ? true : false; // Fixed Nov. 1
330 
331  // LCT_7_10_neg_pT (E)
332  // LUT: Written with incorrect values for mode 7 CLCT, mode 10 random offset, all modes negative (1/pT) set to 3 instead of 511
333  bugMode7CLCT_ = (fw_version < 47864) ? true : false; // Fixed sometime after Nov. 1
334  bugNegPt_ = (fw_version < 47864) ? true : false; // Fixed sometime after Nov. 1
335 }
VersionControl(const edm::ParameterSet &iConfig)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< std::string > pattDefinitions_
void configure_by_fw_version(unsigned fw_version)
std::string pbFileName_
T getUntrackedParameter(std::string const &, T const &) const
std::vector< int > zoneBoundaries_
std::string era_
std::vector< std::string > symPattDefinitions_