![]() |
|
|||
File indexing completed on 2025-06-26 23:26:58
0001 #include "L1Trigger/L1TMuonEndCap/interface/VersionControl.h" 0002 0003 VersionControl::VersionControl(const edm::ParameterSet& iConfig) : config_(iConfig) { 0004 // All the configurables from python/simEmtfDigis_cfi.py must be visible to this class, except InputTags. 0005 verbose_ = iConfig.getUntrackedParameter<int>("verbosity"); 0006 useO2O_ = iConfig.getParameter<bool>("FWConfig"); 0007 era_ = iConfig.getParameter<std::string>("Era"); 0008 // Run 3 CCLUT 0009 useRun3CCLUT_OTMB_ = iConfig.getParameter<bool>("UseRun3CCLUT_OTMB"); 0010 useRun3CCLUT_TMB_ = iConfig.getParameter<bool>("UseRun3CCLUT_TMB"); 0011 0012 useDT_ = iConfig.getParameter<bool>("DTEnable"); 0013 useCSC_ = iConfig.getParameter<bool>("CSCEnable"); 0014 useRPC_ = iConfig.getParameter<bool>("RPCEnable"); 0015 useIRPC_ = iConfig.getParameter<bool>("IRPCEnable"); 0016 useCPPF_ = iConfig.getParameter<bool>("CPPFEnable"); 0017 useGEM_ = iConfig.getParameter<bool>("GEMEnable"); 0018 useME0_ = iConfig.getParameter<bool>("ME0Enable"); 0019 0020 minBX_ = iConfig.getParameter<int>("MinBX"); 0021 maxBX_ = iConfig.getParameter<int>("MaxBX"); 0022 bxWindow_ = iConfig.getParameter<int>("BXWindow"); 0023 bxShiftCSC_ = iConfig.getParameter<int>("CSCInputBXShift"); 0024 bxShiftRPC_ = iConfig.getParameter<int>("RPCInputBXShift"); 0025 bxShiftGEM_ = iConfig.getParameter<int>("GEMInputBXShift"); 0026 bxShiftME0_ = iConfig.getParameter<int>("ME0InputBXShift"); 0027 0028 auto spPCParams16 = iConfig.getParameter<edm::ParameterSet>("spPCParams16"); 0029 zoneBoundaries_ = spPCParams16.getParameter<std::vector<int> >("ZoneBoundaries"); 0030 zoneOverlap_ = spPCParams16.getParameter<int>("ZoneOverlap"); 0031 includeNeighbor_ = spPCParams16.getParameter<bool>("IncludeNeighbor"); 0032 duplicateTheta_ = spPCParams16.getParameter<bool>("DuplicateTheta"); 0033 fixZonePhi_ = spPCParams16.getParameter<bool>("FixZonePhi"); 0034 useNewZones_ = spPCParams16.getParameter<bool>("UseNewZones"); 0035 fixME11Edges_ = spPCParams16.getParameter<bool>("FixME11Edges"); 0036 0037 auto spPRParams16 = iConfig.getParameter<edm::ParameterSet>("spPRParams16"); 0038 pattDefinitions_ = spPRParams16.getParameter<std::vector<std::string> >("PatternDefinitions"); 0039 symPattDefinitions_ = spPRParams16.getParameter<std::vector<std::string> >("SymPatternDefinitions"); 0040 useSymPatterns_ = spPRParams16.getParameter<bool>("UseSymmetricalPatterns"); 0041 0042 auto spTBParams16 = iConfig.getParameter<edm::ParameterSet>("spTBParams16"); 0043 thetaWindow_ = spTBParams16.getParameter<int>("ThetaWindow"); 0044 thetaWindowZone0_ = spTBParams16.getParameter<int>("ThetaWindowZone0"); 0045 useSingleHits_ = spTBParams16.getParameter<bool>("UseSingleHits"); 0046 bugSt2PhDiff_ = spTBParams16.getParameter<bool>("BugSt2PhDiff"); 0047 bugME11Dupes_ = spTBParams16.getParameter<bool>("BugME11Dupes"); 0048 bugAmbigThetaWin_ = spTBParams16.getParameter<bool>("BugAmbigThetaWin"); 0049 twoStationSameBX_ = spTBParams16.getParameter<bool>("TwoStationSameBX"); 0050 0051 auto spGCParams16 = iConfig.getParameter<edm::ParameterSet>("spGCParams16"); 0052 maxRoadsPerZone_ = spGCParams16.getParameter<int>("MaxRoadsPerZone"); 0053 maxTracks_ = spGCParams16.getParameter<int>("MaxTracks"); 0054 useSecondEarliest_ = spGCParams16.getParameter<bool>("UseSecondEarliest"); 0055 bugSameSectorPt0_ = spGCParams16.getParameter<bool>("BugSameSectorPt0"); 0056 0057 auto spPAParams16 = iConfig.getParameter<edm::ParameterSet>("spPAParams16"); 0058 readPtLUTFile_ = spPAParams16.getParameter<bool>("ReadPtLUTFile"); 0059 fixMode15HighPt_ = spPAParams16.getParameter<bool>("FixMode15HighPt"); 0060 bug9BitDPhi_ = spPAParams16.getParameter<bool>("Bug9BitDPhi"); 0061 bugMode7CLCT_ = spPAParams16.getParameter<bool>("BugMode7CLCT"); 0062 bugNegPt_ = spPAParams16.getParameter<bool>("BugNegPt"); 0063 bugGMTPhi_ = spPAParams16.getParameter<bool>("BugGMTPhi"); 0064 promoteMode7_ = spPAParams16.getParameter<bool>("PromoteMode7"); 0065 modeQualVer_ = spPAParams16.getParameter<int>("ModeQualVer"); 0066 promoteMode7Sectors_ = spPAParams16.getParameter<std::vector<int> >("PromoteMode7Sectors"); 0067 pbFileName_ = spPAParams16.getParameter<std::string>("ProtobufFileName"); 0068 } 0069 0070 VersionControl::~VersionControl() {} 0071 0072 // Refer to docs/EMTF_FW_LUT_versions_2016_draft2.xlsx 0073 void VersionControl::configure_by_fw_version(unsigned fw_version) { 0074 if (fw_version == 0 || fw_version == 123456) // fw_version '123456' is from the fake conditions 0075 return; 0076 0077 // For now, no switches later than FW version 47864 (end-of-year 2016) 0078 // Beggining in late 2016, "fw_version" in O2O populated with timestamp, rather than FW version 0079 // tm fw_time = gmtime(fw_version); (See https://linux.die.net/man/3/gmtime, https://www.epochconverter.com) 0080 ///////////////////////////////////////////////////////////////////////////////// 0081 /// Settings for 2018 (by default just use settings in simEmtfDigis_cfi.py) /// 0082 ///////////////////////////////////////////////////////////////////////////////// 0083 if (fw_version >= 1514764800) { // January 1, 2018 0084 0085 // Settings for all of 2018 (following order in simEmtfDigis_cfi.py) 0086 // BXWindow(2) and BugAmbigThetaWin(F) deployed sometime before stable beams on March 20, not quite sure when - AWB 26.04.18 0087 // TwoStationSameBX(T), ThetaWindowZone0(4), and ModeQualVer(2) to be deployed sometime between May 17 and May 31 - AWB 14.05.18 0088 0089 // Global parameters 0090 // Defaults : CSCEnable(T), RPCEnable(T), GEMEnable(F), Era("Run2_2018"), MinBX(-3), MaxBX(+3), BXWindow(2) 0091 // -------------------------------------------------------------------------------------------------------- 0092 era_ = "Run2_2018"; // Era for CMSSW customization 0093 bxWindow_ = 2; // Number of BX whose primitives can be included in the same track 0094 0095 // spTBParams16 : Sector processor track-building parameters 0096 // Defaults : PrimConvLUT(1), ZoneBoundaries(0,41,49,87,127), ZoneOverlap(2), IncludeNeighbor(T), 0097 // DuplicateThteta(T), FixZonePhi(T), UseNewZones(F), FixME11Edges(T) 0098 // ------------------------------------------------------------------------------ 0099 0100 // spPRParams16 : Sector processor pattern-recognition parameters 0101 // Defaults : PatternDefinitions(...), SymPatternDefinitions(...), UseSymmetricalPatterns(T) 0102 // ----------------------------------------------------------------------------------------- 0103 0104 // spTBParams16 : Sector processor track-building parameters 0105 // Defaults : ThetaWindow(8), ThetaWindowZone0(4), UseSingleHits(F), BugSt2PhDiff(F), 0106 // BugME11Dupes(F), BugAmbigThetaWin(F), TwoStationSameBX(T) 0107 // ---------------------------------------------------------------------------------- 0108 thetaWindow_ = 8; // Maximum dTheta between primitives in the same track 0109 thetaWindowZone0_ = 4; // Maximum dTheta between primitives in the same track in Zone 0 (ring 1) 0110 bugAmbigThetaWin_ = false; // Can allow dThetas outside window when there are 2 LCTs in the same chamber 0111 twoStationSameBX_ = true; // Requires the hits in two-station tracks to have the same BX 0112 0113 // spGCParams16 : Sector processor ghost-cancellation parameters 0114 // Defaults : MaxRoadsPerZone(3), MaxTracks(3), UseSecondEarliest(T), BugSameSectorPt0(F) 0115 // -------------------------------------------------------------------------------------- 0116 0117 // spPAParams16 : Sector processor pt-assignment parameters 0118 // Defaults : ReadPtLUTFile(F), FixMode15HighPt(T), Bug9BitDPhi(F), BugMode7CLCT(F), 0119 // BugNegPt(F), BugGMTPhi(F), PromoteMode7(F), ModeQualVer(2) 0120 // --------------------------------------------------------------------------------- 0121 modeQualVer_ = 2; // Version 2 contains modified mode-quality mapping for 2018 0122 promoteMode7_ = false; // Assign station 2-3-4 tracks with |eta| > 1.6 SingleMu quality 0123 // ___________________________________________________________________________ 0124 // Versions in 2018 - no external documentation 0125 // As of the beginning of 2018 EMTF O2O was broken, not updating the database with online conditions 0126 // Firmware version reported for runs before 318841 (June 28) is 1504018578 (Aug. 29, 2017) even though 0127 // updates occured in February and March of 2018. May need to re-write history in the database. - AWB 30.06.18 0128 0129 if (fw_version < 1529520380) { // June 20, 2018 0130 thetaWindowZone0_ = 8; // Maximum dTheta between primitives in the same track in Zone 0 (ring 1) 0131 twoStationSameBX_ = false; // Requires the hits in two-station tracks to have the same BX 0132 modeQualVer_ = 1; // Version 2 contains modified mode-quality mapping for 2018 0133 promoteMode7_ = true; // Assign station 2-3-4 tracks with |eta| > 1.6 SingleMu quality 0134 } 0135 0136 // Promote Mode 7 settings for 2025. Implemented here since all the rest of the settings are the same as in 2018. 0137 if (fw_version >= 1747996116) { // May 23, 2025 0138 promoteMode7_ = true; // Assign station 2-3-4 tracks with |eta| > 1.6 SingleMu quality 0139 } 0140 0141 return; 0142 } 0143 0144 ///////////////////////////////////////////////////////////////////////////////// 0145 /// Settings for 2017 (by default just use settings in simEmtfDigis_cfi.py) /// 0146 ///////////////////////////////////////////////////////////////////////////////// 0147 else if (fw_version >= 50000) { 0148 // Settings for all of 2017 (following order in simEmtfDigis_cfi.py) 0149 0150 // Global parameters 0151 // Defaults : CSCEnable(T), RPCEnable(T), GEMEnable(F), Era("Run2_2018"), MinBX(-3), MaxBX(+3), BXWindow(2) 0152 // -------------------------------------------------------------------------------------------------------- 0153 era_ = "Run2_2017"; // Era for CMSSW customization 0154 bxWindow_ = 3; // Number of BX whose primitives can be included in the same track 0155 0156 // spTBParams16 : Sector processor track-building parameters 0157 // Defaults : PrimConvLUT(1), ZoneBoundaries(0,41,49,87,127), ZoneOverlap(2), IncludeNeighbor(T), 0158 // DuplicateThteta(T), FixZonePhi(T), UseNewZones(F), FixME11Edges(T) 0159 // ------------------------------------------------------------------------------ 0160 0161 // spPRParams16 : Sector processor pattern-recognition parameters 0162 // Defaults : PatternDefinitions(...), SymPatternDefinitions(...), UseSymmetricalPatterns(T) 0163 // ----------------------------------------------------------------------------------------- 0164 0165 // spTBParams16 : Sector processor track-building parameters 0166 // Defaults : ThetaWindow(8), ThetaWindowZone0(4), UseSingleHits(F), BugSt2PhDiff(F), 0167 // BugME11Dupes(F), BugAmbigThetaWin(F), TwoStationSameBX(T) 0168 // ---------------------------------------------------------------------------------- 0169 thetaWindow_ = 8; // Maximum dTheta between primitives in the same track 0170 thetaWindowZone0_ = 8; // Maximum dTheta between primitives in the same track in Zone 0 (ring 1) 0171 bugAmbigThetaWin_ = true; // Can allow dThetas outside window when there are 2 LCTs in the same chamber 0172 twoStationSameBX_ = false; // Requires the hits in two-station tracks to have the same BX 0173 0174 // spGCParams16 : Sector processor ghost-cancellation parameters 0175 // Defaults : MaxRoadsPerZone(3), MaxTracks(3), UseSecondEarliest(T), BugSameSectorPt0(F) 0176 // -------------------------------------------------------------------------------------- 0177 0178 // spPAParams16 : Sector processor pt-assignment parameters 0179 // Defaults : ReadPtLUTFile(F), FixMode15HighPt(T), Bug9BitDPhi(F), BugMode7CLCT(F), 0180 // BugNegPt(F), BugGMTPhi(F), PromoteMode7(F) 0181 // --------------------------------------------------------------------------------- 0182 modeQualVer_ = 1; // Version 2 contains modified mode-quality mapping for 2018 0183 0184 // ___________________________________________________________________________ 0185 // Versions in 2017 - no full documentation, can refer to https://twiki.cern.ch/twiki/bin/viewauth/CMS/L1KnownIssues 0186 0187 // Before July 9th (runs < 298653), all mode 7 tracks (station 2-3-4) assigned quality 11 0188 // July 9th - 29th (runs 298653 - 300087), mode 7 tracks with |eta| > 1.6 in sector -6 assigned quality 12 0189 // After July 29th (runs >= 300088), mode 7 track promotion applied in all sectors 0190 // For some reason, the FW version in the database is 1496792995, at least for runs >= 298034 (July 4), 0191 // which is towards the end of run 2017B (could not check earlier runs). This corresponds to the date "June 6th", 0192 // which is a month earlier than the first firmware update to apply this promotion. So something's screwey. 0193 // Since July 18 is in the middle of the single-sector-fix period, would like to use a firmware version with 0194 // roughly that date. But this may require an intervention in the database. - AWB 04.08.17 0195 // Last firmware version in 2017 was 1504018578 (Aug. 29, 2017). 0196 if (fw_version >= 1496792995) 0197 promoteMode7_ = true; // Assign station 2-3-4 tracks with |eta| > 1.6 SingleMu quality 0198 0199 return; 0200 } 0201 0202 /////////////////////////////////////////////////////////////////////////// 0203 /// Settings for all of 2016 (following order in simEmtfDigis_cfi.py) /// 0204 /////////////////////////////////////////////////////////////////////////// 0205 else { 0206 // Global parameters 0207 // Defaults : CSCEnable(T), RPCEnable(T), GEMEnable(F), Era("Run2_2018"), MinBX(-3), MaxBX(+3), BXWindow(2) 0208 // -------------------------------------------------------------------------------------------------------- 0209 useRPC_ = false; // Use clustered RPC hits from CPPF in track-building 0210 era_ = "Run2_2016"; // Era for CMSSW customization 0211 // maxBX_ // Depends on FW version, see below 0212 bxWindow_ = 3; // Number of BX whose primitives can be included in the same track 0213 0214 // spTBParams16 : Sector processor track-building parameters 0215 // Defaults : PrimConvLUT(1), ZoneBoundaries(0,41,49,87,127), ZoneOverlap(2), IncludeNeighbor(T), 0216 // DuplicateThteta(T), FixZonePhi(T), UseNewZones(F), FixME11Edges(T) 0217 // ------------------------------------------------------------------------------ 0218 // primConvLUT_ // Should be 0 for 2016, set using get_pc_lut_version() from ConditionsHelper.cc 0219 // fixZonePhi_ // Depends on FW version, see below 0220 fixME11Edges_ = false; // Improved small fraction of buggy LCT coordinate transformations 0221 0222 // spPRParams16 : Sector processor pattern-recognition parameters 0223 // Defaults : PatternDefinitions(...), SymPatternDefinitions(...), UseSymmetricalPatterns(T) 0224 // ----------------------------------------------------------------------------------------- 0225 // useSymPatterns_ // Depends on FW version, see below 0226 0227 // spTBParams16 : Sector processor track-building parameters 0228 // Defaults : ThetaWindow(8), ThetaWindowZone0(4), UseSingleHits(F), BugSt2PhDiff(F), 0229 // BugME11Dupes(F), BugAmbigThetaWin(F), TwoStationSameBX(T) 0230 // ---------------------------------------------------------------------------------- 0231 thetaWindow_ = 4; // Maximum dTheta between primitives in the same track 0232 thetaWindowZone0_ = 4; // Maximum dTheta between primitives in the same track in Zone 0 (ring 1) 0233 // bugSt2PhDiff_ // Depends on FW version, see below 0234 // bugME11Dupes_ // Depends on FW version, see below 0235 bugAmbigThetaWin_ = true; // Can allow dThetas outside window when there are 2 LCTs in the same chamber 0236 twoStationSameBX_ = false; // Requires the hits in two-station tracks to have the same BX 0237 0238 // spGCParams16 : Sector processor ghost-cancellation parameters 0239 // Defaults : MaxRoadsPerZone(3), MaxTracks(3), UseSecondEarliest(T), BugSameSectorPt0(F) 0240 // -------------------------------------------------------------------------------------- 0241 // useSecondEarliest_ // Depends on FW version, see below 0242 // bugSameSectorPt0_ // Depends on FW version, see below 0243 0244 // spPAParams16 : Sector processor pt-assignment parameters 0245 // Defaults : ReadPtLUTFile(F), FixMode15HighPt(T), Bug9BitDPhi(F), BugMode7CLCT(F), 0246 // BugNegPt(F), BugGMTPhi(F), PromoteMode7(F) 0247 // --------------------------------------------------------------------------------- 0248 // fixMode15HighPt_ // Depends on FW version, see below 0249 // bug9BitDPhi_ // Depends on FW version, see below 0250 // bugMode7CLCT_ // Depends on FW version, see below 0251 // bugNegPt_ // Depends on FW version, see below 0252 bugGMTPhi_ = true; // Some drift in uGMT phi conversion, off by up to a few degrees 0253 modeQualVer_ = 1; // Version 2 contains modified mode-quality mapping for 2018 0254 0255 } // End default settings for 2016 0256 0257 // ___________________________________________________________________________ 0258 // Versions in 2016 - refer to docs/EMTF_FW_LUT_versions_2016_draft2.xlsx 0259 0260 // 1st_LCT_BX / 2nd_LCT_BX (should also make unpacker configurable - AWB 21.07.17) 0261 // FW: Before: Earliest LCT used to assign BX, tracks only cancel within same BX 0262 // After: Second-earliest LCT used to assign BX, tracks cancel over 3 BX, improved LCT recovery 0263 useSecondEarliest_ = (fw_version < 46773) ? false : true; // Changed Sept. 5 0264 0265 // 8_BX_readout / 7_BX_readout 0266 // SW: DAQ readout changed from to [-3, +4] BX to [-3, +3] BX 0267 maxBX_ = (fw_version < 47109) ? +4 : +3; // Changed Sept. 28 0268 0269 // Asymm_patterns / Symm_patterns 0270 // FW: Changed from 9 asymmetric patterns to 5 symmetric patterns for track building 0271 useSymPatterns_ = (fw_version < 47214) ? false : true; // Changed Oct. 6 0272 0273 // HiPt_outlier 0274 // LUT: High-pT fix puts outlier LCTs in mode 15 tracks back in a straight line 0275 fixMode15HighPt_ = (fw_version < 46650) ? false : true; // Changed July 25 0276 0277 // Link_monitor (unpacker only) 0278 // FW: Added MPC link monitoring 0279 0280 // ___________________________________________________________________________ 0281 // Bugs 0282 0283 // DAQ_ID (unpacker only; should make configurable - AWB 21.07.17) 0284 // FW: DAQ ME with output CSC ID range 0 - 8 instead of 1 - 9 0285 // SP output ME2_ID, 3_ID, and 4_ID filled with 4, 5, or 6 when they should have been 7, 8, or 9. 0286 0287 // ME_ID_FR 0288 // FW: Incorrect ME_ID fields in DAQ, wrong FR bits and some dPhi wrap-around in pT LUT address 0289 // - Unpacker only, or not worth emulating 0290 0291 // DAQ_miss_LCT (unpacker only) 0292 // FW: LCTs only output if there was a track in the sector 0293 0294 // Sector_pT_0 0295 // FW: Only highest-quality track in a sector assigned pT; others assigned pT = 0 0296 bugSameSectorPt0_ = (fw_version < 46650) ? true : false; // Fixed July 22 0297 0298 // Sector_bad_pT 0299 // FW: Tracks sometimes assigned pT of track in previous BX 0300 // - This is an ongoing (very rare) bug which occurs when 2 tracks try to access the same "bank" in the pT LUT 0301 // It would be very difficult to emulate exactly, but the logic from Alex Madorsky is below 0302 // ## macro for detecting same bank address 0303 // ## bank and chip must match, and valid flags must be set 0304 // ## a and b are indexes 0,1,2 0305 // ## [X:Y] are bit portions from ptlut address words 0306 // `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]) 0307 // ## This macro is used like this: 0308 // if (`sb(0,2) || `sb(1,2)) {disable PT readout for track 2} 0309 0310 // DAQ_BX_3_LCT (unpacker only) 0311 // SW: LCTs in BX -3 only reported if there was a track in the sector 0312 // - not applicable 0313 0314 // DAQ_BX_23_LCT (unpacker only) 0315 // SW: LCTs in BX -2 and -3 only reported if there was a track in the sector 0316 // - not applicable 0317 0318 // pT_dPhi_bits 0319 // FW: dPhi wrap-around in modes 3, 5, 6, 9, 10, 12 0320 bug9BitDPhi_ = (fw_version < 47214) ? true : false; // Fixed Oct. 6 0321 0322 // Pattern_phi / ME1_neigh_phi 0323 // FW: Pattern phi slightly offset from true LCT phi; also ME3/4 pattern width off 0324 // Pattern phi of neighbor hits in ME1 miscalculated 0325 fixZonePhi_ = (fw_version < 47214) ? false : true; // Fixed Oct. 6 0326 0327 // LCT_station_2 0328 // FW: Reduced LCT matching window in station 2, resulting in demoted tracks and inefficiency 0329 bugSt2PhDiff_ = (47109 <= fw_version && fw_version < 47249) ? true : false; // Bug introduced Oct. 6, fixed Oct. 19 0330 0331 // LCT_theta_dup 0332 // FW: LCTs matched to track may take theta value from other LCT in the same chamber 0333 bugME11Dupes_ = (fw_version < 47423) ? true : false; // Fixed Nov. 1 0334 0335 // LCT_7_10_neg_pT (E) 0336 // LUT: Written with incorrect values for mode 7 CLCT, mode 10 random offset, all modes negative (1/pT) set to 3 instead of 511 0337 bugMode7CLCT_ = (fw_version < 47864) ? true : false; // Fixed sometime after Nov. 1 0338 bugNegPt_ = (fw_version < 47864) ? true : false; // Fixed sometime after Nov. 1 0339 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |
![]() ![]() |