diff --git a/DataFormats/CSCDigi/interface/CSCComparatorDigi.h b/DataFormats/CSCDigi/interface/CSCComparatorDigi.h index 106404ebd2384..3d57a7022e365 100644 --- a/DataFormats/CSCDigi/interface/CSCComparatorDigi.h +++ b/DataFormats/CSCDigi/interface/CSCComparatorDigi.h @@ -1,10 +1,10 @@ -#ifndef CSCComparatorDigi_CSCComparatorDigi_h -#define CSCComparatorDigi_CSCComparatorDigi_h +#ifndef DataFormats_CSCDigi_CSCComparatorDigi_h +#define DataFormats_CSCDigi_CSCComparatorDigi_h /** \class CSCComparatorDigi * * Digi for CSC Comparators. - * + * * * \author M. Schmitt, Northwestern * @@ -28,9 +28,15 @@ class CSCComparatorDigi { /// sort by time first, then by strip bool operator<(const CSCComparatorDigi& digi) const; + /// Get the distrip number. Counts from 0. + int getDiStrip() const; + /// Get the strip number. Counts from 1. int getStrip() const { return strip_; } + /// Get the CFEB number. Counts from 0. + int getCFEB() const; + /// Get Comparator readings. Can be 0 or 1. int getComparator() const { return comparator_; } diff --git a/DataFormats/CSCDigi/interface/CSCConstants.h b/DataFormats/CSCDigi/interface/CSCConstants.h new file mode 100644 index 0000000000000..58160a61896c8 --- /dev/null +++ b/DataFormats/CSCDigi/interface/CSCConstants.h @@ -0,0 +1,133 @@ +#ifndef DataFormats_CSCDigi_CSCConstants_h +#define DataFormats_CSCDigi_CSCConstants_h + +/** + * \class CSCConstants + * + * Static interface to basic chamber constants. + */ + +class CSCConstants { +public: + enum DDU_Info { NUM_DDUS = 5 }; + + enum CFEB_Info { + // Run-1: Maximum number of cathode front-end boards + MAX_CFEBS_RUN1 = 5, + // ME1/1 cases + NUM_CFEBS_ME1A_GANGED = 1, + NUM_CFEBS_ME1A_UNGANGED = 3, + NUM_CFEBS_ME1B = 4, + NUM_CFEBS_ME11_GANGED = NUM_CFEBS_ME1A_GANGED + NUM_CFEBS_ME1B, // 5 + NUM_CFEBS_ME11_UNGANGED = NUM_CFEBS_ME1A_UNGANGED + NUM_CFEBS_ME1B, // 7 + // Run-2: Maximum number of cathode front-end boards + MAX_CFEBS_RUN2 = NUM_CFEBS_ME11_UNGANGED, // 7 + }; + + enum FPGA_Latency { CLCT_EMUL_TIME_OFFSET = 3, ALCT_EMUL_TIME_OFFSET = 6 }; + + // Numbers obtained from https://twiki.cern.ch/twiki/pub/CMS/CSCDPGGeometry/table_of_csc_properties_150730.pdf + enum WG_Info { + NUM_WIREGROUPS_ME11 = 48, + NUM_WIREGROUPS_ME12 = 64, + NUM_WIREGROUPS_ME13 = 32, + NUM_WIREGROUPS_ME21 = 112, + NUM_WIREGROUPS_ME22 = 64, + NUM_WIREGROUPS_ME31 = 96, + NUM_WIREGROUPS_ME32 = 64, + NUM_WIREGROUPS_ME41 = 96, + NUM_WIREGROUPS_ME42 = 64, + // this number should really be 112, but has always been 119 since the + // CSC trigger was developed in 2006. Probably it would not hurt to change it to 112 + MAX_NUM_WIREGROUPS = 119 + }; + + // distrips, strips, half-strips + enum Strip_Info { + // Each CFEB reads out 8 distrips... + NUM_DISTRIPS_PER_CFEB = 8, + //...16 strips... + NUM_STRIPS_PER_CFEB = 2 * NUM_DISTRIPS_PER_CFEB, + //...32 half-strips. + NUM_HALF_STRIPS_PER_CFEB = 2 * NUM_STRIPS_PER_CFEB, + // There are exactly 80 or 112 strips... + MAX_NUM_STRIPS_RUN1 = MAX_CFEBS_RUN1 * NUM_STRIPS_PER_CFEB, // 80 + MAX_NUM_STRIPS_RUN2 = MAX_CFEBS_RUN2 * NUM_STRIPS_PER_CFEB, // 112 + //...and 160 or 224 half-strips for 5 or 7 CFEBs... + MAX_NUM_HALF_STRIPS_RUN1 = MAX_CFEBS_RUN1 * NUM_HALF_STRIPS_PER_CFEB, // 160 + MAX_NUM_HALF_STRIPS_RUN2 = MAX_CFEBS_RUN2 * NUM_HALF_STRIPS_PER_CFEB, // 224 + // ...but depending on the chamber, there may or may not be strip staggering. + /* CMS-MUO-16-001: "[..] alternate layers in a CSC are staggered by half a strip width, except + in the ME1/1 chambers where the strips are narrower and the effect is small" */ + // _TRIGGER is added at the end, because these constants are only used in the trigger + MAX_NUM_HALF_STRIPS_RUN1_TRIGGER = 1 + MAX_NUM_HALF_STRIPS_RUN1, // 161 + MAX_NUM_HALF_STRIPS_RUN2_TRIGGER = 1 + MAX_NUM_HALF_STRIPS_RUN2, // 225 + // Number of strips in ME11 (special case) + NUM_STRIPS_ME1A_GANGED = NUM_CFEBS_ME1A_GANGED * NUM_STRIPS_PER_CFEB, // 16 + NUM_STRIPS_ME1A_UNGANGED = NUM_CFEBS_ME1A_UNGANGED * NUM_STRIPS_PER_CFEB, // 48 + NUM_STRIPS_ME1B = NUM_CFEBS_ME1B * NUM_STRIPS_PER_CFEB, // 64 + // Number of half-strips in ME11 (special case) + NUM_HALF_STRIPS_ME1A_GANGED = NUM_CFEBS_ME1A_GANGED * NUM_HALF_STRIPS_PER_CFEB, // 32 + NUM_HALF_STRIPS_ME1A_UNGANGED = NUM_CFEBS_ME1A_UNGANGED * NUM_HALF_STRIPS_PER_CFEB, // 96 + NUM_HALF_STRIPS_ME1B = NUM_CFEBS_ME1B * NUM_HALF_STRIPS_PER_CFEB, // 128 + // max halfstrip number in ME1/1 chambers + MAX_HALF_STRIP_ME1A_GANGED = NUM_HALF_STRIPS_ME1A_GANGED - 1, // 31 + MAX_HALF_STRIP_ME1A_UNGANGED = NUM_HALF_STRIPS_ME1A_UNGANGED - 1, // 95 + MAX_HALF_STRIP_ME1B = NUM_HALF_STRIPS_ME1B - 1, // 127 + }; + + // CSCs have 6 layers. The key (reference) layer is the third layer + enum Layer_Info { NUM_LAYERS = 6, KEY_CLCT_LAYER = 3, KEY_ALCT_LAYER = 3 }; + + // Both ALCT and CLCTs have patterns. CLCTs have a better granularity than ALCTs, thus more patterns + enum Pattern_Info { + NUM_ALCT_PATTERNS = 3, + ALCT_PATTERN_WIDTH = 5, + NUM_CLCT_PATTERNS = 11, + CLCT_PATTERN_WIDTH = 11, + // Max number of wires participating in a pattern + MAX_WIRES_IN_PATTERN = 14, + NUM_COMPARATOR_CODES = 4096 + }; + + enum Digis_Info { MAX_DIGIS_PER_ALCT = 10, MAX_DIGIS_PER_CLCT = 8 }; + + enum LCT_stubs { + // CSC local trigger considers 4-bit BX window (16 numbers) in the readout + MAX_CLCT_TBINS = 16, + MAX_ALCT_TBINS = 16, + MAX_LCT_TBINS = 16, + // Maximum allowed matching window size + MAX_MATCH_WINDOW_SIZE = 15, + // Each CLCT processor can send up to 2 CLCTs to TMB per BX + MAX_CLCTS_PER_PROCESSOR = 2, + MAX_CLCTS_READOUT = 2, + // Each ALCT processor can send up to 2 ALCTs to TMB per BX + MAX_ALCTS_PER_PROCESSOR = 2, + MAX_ALCTS_READOUT = 2, + // Each CSC can send up to 2 LCTs to the MPC per BX + MAX_LCTS_PER_CSC = 2, + // An MPC receives up to 18 LCTs from 9 CSCs in the trigger sector + MAX_LCTS_PER_MPC = 18, + // Reference BX for LCTs in simulation and firmware + LCT_CENTRAL_BX = 8, + /* + Reference BX for ALCTs in firmware. In the ALCT simulation, + and in the motherboard simulation the ALCT central BX is 8. + However, ALCT BX is shifted before they are inserted into the EDM + ROOT file to have a central BX of 3 and be consistent with the firmware. + */ + ALCT_CENTRAL_BX = 3, + /* + Reference BX for CLCTs in firmware. In the CLCT simulation, the central + CLCT BX is 7. In the motherboard simulation they are shifted to 8 (in order + to matched with ALCTs). But in the EDM ROOT file the CLCT central BX is 7 + to be consistent with the firmware. + */ + CLCT_CENTRAL_BX = 7, + // Offset between the ALCT and CLCT central BX in simulation + ALCT_CLCT_OFFSET = 1 + }; +}; + +#endif diff --git a/DataFormats/CSCDigi/interface/CSCStripDigi.h b/DataFormats/CSCDigi/interface/CSCStripDigi.h index ac1b617441cce..525e556b9a698 100644 --- a/DataFormats/CSCDigi/interface/CSCStripDigi.h +++ b/DataFormats/CSCDigi/interface/CSCStripDigi.h @@ -1,5 +1,5 @@ -#ifndef CSCStripDigi_CSCStripDigi_h -#define CSCStripDigi_CSCStripDigi_h +#ifndef DataFormats_CSCDigi_CSCStripDigi_h +#define DataFormats_CSCDigi_CSCStripDigi_h /** \class CSCStripDigi * @@ -40,6 +40,9 @@ class CSCStripDigi { // Get the strip number. counts from 1. int getStrip() const { return strip; } + /// Get the CFEB number. Counts from 0. + int getCFEB() const; + /// Get ADC readings std::vector const& getADCCounts() const { return ADCCounts; } diff --git a/DataFormats/CSCDigi/src/CSCComparatorDigi.cc b/DataFormats/CSCDigi/src/CSCComparatorDigi.cc index 6fba526c4915e..6c9267d630381 100644 --- a/DataFormats/CSCDigi/src/CSCComparatorDigi.cc +++ b/DataFormats/CSCDigi/src/CSCComparatorDigi.cc @@ -4,6 +4,7 @@ * \author M.Schmitt, Northwestern */ #include "DataFormats/CSCDigi/interface/CSCComparatorDigi.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include #include @@ -61,6 +62,14 @@ int CSCComparatorDigi::getTimeBin() const { return tbin; } +/// Get the distrip number. Counts from 0. +// originally defined in EventFilter/CSCRawToDigi/src/CSCComparatorData.cc +int CSCComparatorDigi::getDiStrip() const { return ((strip_ - 1) % CSCConstants::NUM_STRIPS_PER_CFEB) / 2; } + +/// Get the CFEB number. Counts from 0. +// originally defined in EventFilter/CSCRawToDigi/src/CSCComparatorData.cc +int CSCComparatorDigi::getCFEB() const { return (strip_ - 1) / CSCConstants::NUM_STRIPS_PER_CFEB; } + // This definition is consistent with the one used in // the function CSCComparatorData::add() in EventFilter/CSCRawToDigi // The halfstrip counts from 0! diff --git a/DataFormats/CSCDigi/src/CSCStripDigi.cc b/DataFormats/CSCDigi/src/CSCStripDigi.cc index eaa01654d1feb..66e0bd117c2bc 100644 --- a/DataFormats/CSCDigi/src/CSCStripDigi.cc +++ b/DataFormats/CSCDigi/src/CSCStripDigi.cc @@ -4,6 +4,7 @@ * \author M.Schmitt, Northwestern */ #include "DataFormats/CSCDigi/interface/CSCStripDigi.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include #include @@ -19,6 +20,10 @@ bool CSCStripDigi::operator==(const CSCStripDigi& digi) const { return true; } +/// Get the CFEB number. Counts from 0. +// originally defined in EventFilter/CSCRawToDigi/src/CSCComparatorData.cc +int CSCStripDigi::getCFEB() const { return (strip - 1) / CSCConstants::NUM_STRIPS_PER_CFEB; } + void CSCStripDigi::setADCCounts(const std::vector& vADCCounts) { bool badVal = false; for (int i = 0; i < (int)vADCCounts.size(); i++) { diff --git a/DataFormats/L1TMuon/interface/CSCConstants.h b/DataFormats/L1TMuon/interface/CSCConstants.h deleted file mode 100644 index 14d526cf3b5a6..0000000000000 --- a/DataFormats/L1TMuon/interface/CSCConstants.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef DataFormats_L1TMuon_CSCConstants_h -#define DataFormats_L1TMuon_CSCConstants_h - -/** - * \class CSCConstants - * - * Static interface to basic chamber constants. - */ -#include - -class CSCConstants { -public: - enum CFEB_Info { - //Maximum number of cathode front-end boards - MAX_CFEBS = 5, - }; - - enum FPGA_Latency { CLCT_EMUL_TIME_OFFSET = 3, ALCT_EMUL_TIME_OFFSET = 6 }; - - // Note: WIRE means actually "wiregroup" here - enum WG_and_Strip { - MAX_NUM_WIRES = 119, - MAX_WIRES_ME11 = 48, - MAX_NUM_STRIPS = 80, - MAX_NUM_STRIPS_7CFEBS = 112, - NUM_DI_STRIPS = 40 + 1, // Add 1 to allow for staggering of strips - NUM_HALF_STRIPS = 160 + 1, - NUM_HALF_STRIPS_7CFEBS = 224 + 1, - // each CFEB reads out 8 distrips, 16 strips or 32 halfstrips - NUM_DISTRIPS_PER_CFEB = 8, - NUM_STRIPS_PER_CFEB = 16, - NUM_HALF_STRIPS_PER_CFEB = 32, - // max halfstrip number in ME1/1 chambers - // All ME1A readout by 1 CFEB -> 32 -1 - MAX_HALF_STRIP_ME1A_GANGED = 31, - // All ME1A readout by 3 CFEBs -> 3*32 -1 - MAX_HALF_STRIP_ME1A_UNGANGED = 95, - // All ME1B readout by 4 CFEBs -> 4*32 -1 - MAX_HALF_STRIP_ME1B = 127, - MAX_NUM_STRIPS_ME1B = 64, - MAX_NUM_STRIPS_ME1A_GANGED = 16, - MAX_NUM_STRIPS_ME1A_UNGANGED = 48, - }; - - // CSCs have 6 layers. The key (refernce) layer is the third layer - enum Layer_Info { NUM_LAYERS = 6, KEY_CLCT_LAYER = 3, KEY_ALCT_LAYER = 3 }; - - // Both ALCT and CLCTs have patterns. CLCTs have a better granularity than ALCTs, thus more patterns - enum Pattern_Info { - NUM_ALCT_PATTERNS = 3, - ALCT_PATTERN_WIDTH = 5, - NUM_CLCT_PATTERNS = 11, - CLCT_PATTERN_WIDTH = 11, - // Max number of wires participating in a pattern - MAX_WIRES_IN_PATTERN = 14, - NUM_COMPARATOR_CODES = 4096 - }; - - enum Digis_Info { MAX_DIGIS_PER_ALCT = 10, MAX_DIGIS_PER_CLCT = 8 }; - - enum LCT_stubs { - // CSC local trigger considers 4-bit BX window (16 numbers) in the readout - MAX_CLCT_TBINS = 16, - MAX_ALCT_TBINS = 16, - MAX_LCT_TBINS = 16, - // Maximum allowed matching window size - MAX_MATCH_WINDOW_SIZE = 15, - // Each CLCT processor can send up to 2 CLCTs to TMB per BX - MAX_CLCTS_PER_PROCESSOR = 2, - MAX_CLCTS_READOUT = 2, - // Each ALCT processor can send up to 2 ALCTs to TMB per BX - MAX_ALCTS_PER_PROCESSOR = 2, - MAX_ALCTS_READOUT = 2, - // Each CSC can send up to 2 LCTs to the MPC per BX - MAX_LCTS_PER_CSC = 2, - // An MPC receives up to 18 LCTs from 9 CSCs in the trigger sector - MAX_LCTS_PER_MPC = 18, - // Reference BX for LCTs in simulation and firmware - LCT_CENTRAL_BX = 8, - // Offset between the ALCT and CLCT central BX in simulation - ALCT_CLCT_OFFSET = 1 - }; -}; - -#endif diff --git a/DataFormats/L1TMuon/src/EMTFHit.cc b/DataFormats/L1TMuon/src/EMTFHit.cc index 3f446353e70e8..85d86a54b235c 100644 --- a/DataFormats/L1TMuon/src/EMTFHit.cc +++ b/DataFormats/L1TMuon/src/EMTFHit.cc @@ -1,5 +1,5 @@ #include "DataFormats/L1TMuon/interface/EMTFHit.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" namespace l1t { diff --git a/EventFilter/CSCRawToDigi/interface/CSCAnodeData.h b/EventFilter/CSCRawToDigi/interface/CSCAnodeData.h index 61a5e9914f06d..0a03d270e5166 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCAnodeData.h +++ b/EventFilter/CSCRawToDigi/interface/CSCAnodeData.h @@ -1,9 +1,8 @@ #ifndef EventFilter_CSCRawToDigi_CSCAnodeData_h #define EventFilter_CSCRawToDigi_CSCAnodeData_h -#include -#include -#include "DataFormats/CSCDigi/interface/CSCWireDigi.h" + #include "EventFilter/CSCRawToDigi/interface/CSCAnodeDataFormat.h" +#include class CSCALCTHeader; diff --git a/EventFilter/CSCRawToDigi/interface/CSCAnodeDataFormat.h b/EventFilter/CSCRawToDigi/interface/CSCAnodeDataFormat.h index 03ac125a6c41f..7b707402111e7 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCAnodeDataFormat.h +++ b/EventFilter/CSCRawToDigi/interface/CSCAnodeDataFormat.h @@ -1,7 +1,9 @@ #ifndef EventFilter_CSCRawToDigi_CSCAnodeDataFormat_h #define EventFilter_CSCRawToDigi_CSCAnodeDataFormat_h + #include "DataFormats/CSCDigi/interface/CSCWireDigi.h" #include + class CSCAnodeDataFormat { public: virtual ~CSCAnodeDataFormat() {} diff --git a/EventFilter/CSCRawToDigi/interface/CSCEventData.h b/EventFilter/CSCRawToDigi/interface/CSCEventData.h index 8cafdee0c805b..b36482e9ebf95 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCEventData.h +++ b/EventFilter/CSCRawToDigi/interface/CSCEventData.h @@ -23,9 +23,6 @@ class CSCStripDigi; #include "DataFormats/MuonDetId/interface/GEMDetId.h" #include -/// Maximum available CFEBs per chamber (for old system 5, for new ME11 should be 7) -#define MAX_CFEB 7 - class CSCEventData { public: explicit CSCEventData(int chamberType, uint16_t format_version = 2005); @@ -159,7 +156,7 @@ class CSCEventData { CSCTMBData *theTMBData; /// for up to MAX_CFEB CFEB boards - CSCCFEBData *theCFEBData[MAX_CFEB]; + CSCCFEBData *theCFEBData[CSCConstants::MAX_CFEBS_RUN2]; CSCDMBTrailer theDMBTrailer; diff --git a/EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h b/EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h index 7d5809bac8a26..5a079e0261a58 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h +++ b/EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h @@ -5,6 +5,7 @@ #include "DataFormats/CSCDigi/interface/CSCALCTDigi.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h" #include "DataFormats/MuonDetId/interface/CSCDetId.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include #include #include diff --git a/EventFilter/CSCRawToDigi/plugins/CSCDCCUnpacker.cc b/EventFilter/CSCRawToDigi/plugins/CSCDCCUnpacker.cc index f9715b1a794ec..a5d73400a630a 100644 --- a/EventFilter/CSCRawToDigi/plugins/CSCDCCUnpacker.cc +++ b/EventFilter/CSCRawToDigi/plugins/CSCDCCUnpacker.cc @@ -29,6 +29,8 @@ #include "DataFormats/FEDRawData/interface/FEDNumbering.h" //Digi stuff + +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCFEBStatusDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h" @@ -536,7 +538,7 @@ void CSCDCCUnpacker::produce(edm::Event& e, const edm::EventSetup& c) { /// fill cfeb status digi if (unpackStatusDigis) { - for (icfeb = 0; icfeb < 7; ++icfeb) ///loop over status digis + for (icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) ///loop over status digis { if (cscData[iCSC].cfebData(icfeb) != nullptr) cfebStatusProduct->insertDigi(layer, cscData[iCSC].cfebData(icfeb)->statusDigi()); @@ -554,7 +556,7 @@ void CSCDCCUnpacker::produce(edm::Event& e, const edm::EventSetup& c) { } /// fill wire, strip and comparator digis... - for (int ilayer = 1; ilayer <= 6; ++ilayer) { + for (int ilayer = CSCDetId::minLayerId(); ilayer <= CSCDetId::maxLayerId(); ++ilayer) { /// set layer, dmb and vme are valid because already checked in line 240 // (You have to be kidding. Line 240 in whose universe?) @@ -565,7 +567,7 @@ void CSCDCCUnpacker::produce(edm::Event& e, const edm::EventSetup& c) { wireProduct->move(std::make_pair(wireDigis.begin(), wireDigis.end()), layer); } - for (icfeb = 0; icfeb < 7; ++icfeb) { + for (icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) { layer = pcrate->detId(vmecrate, dmb, icfeb, ilayer); if (cscData[iCSC].cfebData(icfeb) && cscData[iCSC].cfebData(icfeb)->check()) { std::vector stripDigis; diff --git a/EventFilter/CSCRawToDigi/src/CSCAnodeData.cc b/EventFilter/CSCRawToDigi/src/CSCAnodeData.cc index 7b8ad159f766f..a06a7315f30b4 100644 --- a/EventFilter/CSCRawToDigi/src/CSCAnodeData.cc +++ b/EventFilter/CSCRawToDigi/src/CSCAnodeData.cc @@ -2,6 +2,7 @@ #include "EventFilter/CSCRawToDigi/interface/CSCALCTHeader.h" #include "EventFilter/CSCRawToDigi/interface/CSCAnodeData2006.h" #include "EventFilter/CSCRawToDigi/interface/CSCAnodeData2007.h" +#include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include // for bzero @@ -26,7 +27,7 @@ CSCAnodeData::CSCAnodeData(const CSCALCTHeader &header, const unsigned short *bu std::vector > CSCAnodeData::wireDigis() const { std::vector > result; - for (int layer = 1; layer <= 6; ++layer) { + for (int layer = CSCDetId::minLayerId(); layer <= CSCDetId::maxLayerId(); ++layer) { result.push_back(wireDigis(layer)); } return result; diff --git a/EventFilter/CSCRawToDigi/src/CSCAnodeData2006.cc b/EventFilter/CSCRawToDigi/src/CSCAnodeData2006.cc index 769c61a120a5b..279f76d806535 100644 --- a/EventFilter/CSCRawToDigi/src/CSCAnodeData2006.cc +++ b/EventFilter/CSCRawToDigi/src/CSCAnodeData2006.cc @@ -1,5 +1,6 @@ #include "EventFilter/CSCRawToDigi/interface/CSCAnodeData2006.h" #include "EventFilter/CSCRawToDigi/interface/CSCALCTHeader.h" +#include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include // for bzero #include @@ -17,7 +18,7 @@ CSCAnodeData2006::CSCAnodeData2006(const CSCALCTHeader &header) ///for digi->ra bzero(theDataFrames, sizeInWords() * 2); for (int afeb = 0; afeb < nAFEBs_; ++afeb) { for (int tbin = 0; tbin < nTimeBins_; ++tbin) { - for (int layer = 1; layer <= 6; ++layer) { + for (int layer = CSCDetId::minLayerId(); layer <= CSCDetId::maxLayerId(); ++layer) { for (int halfLayer = 0; halfLayer < 2; ++halfLayer) { theDataFrames[index(afeb, tbin, layer) + halfLayer] = CSCAnodeDataFrame2006(afeb, tbin, 0).frame(); } diff --git a/EventFilter/CSCRawToDigi/src/CSCAnodeData2007.cc b/EventFilter/CSCRawToDigi/src/CSCAnodeData2007.cc index 903562ca4df2d..04202068770a7 100644 --- a/EventFilter/CSCRawToDigi/src/CSCAnodeData2007.cc +++ b/EventFilter/CSCRawToDigi/src/CSCAnodeData2007.cc @@ -1,5 +1,6 @@ #include "EventFilter/CSCRawToDigi/interface/CSCAnodeData2007.h" #include "EventFilter/CSCRawToDigi/interface/CSCALCTHeader.h" +#include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include // for bzero #include @@ -73,7 +74,7 @@ CSCAnodeDataFrame2007 CSCAnodeData2007::findFrame(int tbin, int layer, int layer int CSCAnodeData2007::index(int tbin, int layer, int layerPart) const { assert(tbin < nTimeBins_); - assert(layer <= 6); + assert(layer <= CSCDetId::maxLayerId()); assert(layerPart < layerParts_); int result = tbin * 6 * layerParts_ + (layer - 1) * layerParts_ + layerPart; assert(result < MAXFRAMES); diff --git a/EventFilter/CSCRawToDigi/src/CSCCFEBData.cc b/EventFilter/CSCRawToDigi/src/CSCCFEBData.cc index 751232a193af2..09d3025f2088f 100644 --- a/EventFilter/CSCRawToDigi/src/CSCCFEBData.cc +++ b/EventFilter/CSCRawToDigi/src/CSCCFEBData.cc @@ -1,10 +1,10 @@ - -#include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "EventFilter/CSCRawToDigi/interface/CSCCFEBData.h" #include "EventFilter/CSCRawToDigi/interface/CSCCFEBTimeSlice.h" #include "EventFilter/CSCRawToDigi/interface/CSCBadCFEBTimeSlice.h" #include "DataFormats/CSCDigi/interface/CSCStripDigi.h" #include "DataFormats/CSCDigi/interface/CSCCFEBStatusDigi.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" +#include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include @@ -200,8 +200,6 @@ CSCCFEBStatusDigi CSCCFEBData::statusDigi() const { } void CSCCFEBData::digis(uint32_t idlayer, std::vector &result) const { - // assert(layer>0 && layer <= 6); - LogTrace("CSCCFEBData|CSCRawToDigi") << "nTimeSamples in CSCCFEBData::digis = " << nTimeSamples(); if (nTimeSamples() == 0) { LogTrace("CSCCFEBData|CSCRawToDigi") << "nTimeSamples is zero - CFEB data corrupt?"; @@ -267,23 +265,23 @@ void CSCCFEBData::digis(uint32_t idlayer, std::vector &result) con if (theFormatVersion == 2013) { /// Handle 2013 Format if (me1a) - strip = strip % 64; // reset 65-112/ to 1-48 digi + strip = strip % CSCConstants::NUM_STRIPS_ME1B; // reset 65-112/ to 1-48 digi if (me1a && zplus) { - strip = 49 - strip; + strip = CSCConstants::NUM_STRIPS_ME1A_UNGANGED + 1 - strip; } // 1-48 -> 48-1 if (me1b && !zplus) { - strip = 65 - strip; + strip = CSCConstants::NUM_STRIPS_ME1B + 1 - strip; } // 1-64 -> 64-1 ... } else { // Handle original 2005 format if (me1a) - strip = strip % 64; // reset 65-80 to 1-16 digi + strip = strip % CSCConstants::NUM_STRIPS_ME1B; // reset 65-80 to 1-16 digi if (me1a && zplus) { - strip = 17 - strip; + strip = CSCConstants::NUM_STRIPS_ME1A_GANGED + 1 - strip; } // 1-16 -> 16-1 if (me1b && !zplus) { - strip = 65 - strip; + strip = CSCConstants::NUM_STRIPS_ME1B + 1 - strip; } // 1-64 -> 64-1 ... } result.push_back(CSCStripDigi(strip, sca, overflow, overlap, errorfl)); @@ -291,7 +289,6 @@ void CSCCFEBData::digis(uint32_t idlayer, std::vector &result) con } std::vector CSCCFEBData::digis(unsigned idlayer) const { - //assert(layer>0 && layer <= 6); std::vector result; uint32_t layer = idlayer; digis(layer, result); @@ -310,7 +307,7 @@ bool CSCCFEBData::check() const { std::ostream &operator<<(std::ostream &os, const CSCCFEBData &data) { os << "printing CFEB data sample by sample " << std::endl; - for (unsigned ilayer = 1; ilayer <= 6; ++ilayer) { + for (int ilayer = CSCDetId::minLayerId(); ilayer <= CSCDetId::maxLayerId(); ++ilayer) { for (unsigned channel = 1; channel <= 16; ++channel) { unsigned strip = channel + data.boardNumber_ * 16; os << "Strip " << strip << " "; @@ -325,7 +322,7 @@ std::ostream &operator<<(std::ostream &os, const CSCCFEBData &data) { std::vector > CSCCFEBData::stripDigis() { std::vector > result; - for (int layer = 1; layer <= 6; ++layer) { + for (int layer = CSCDetId::minLayerId(); layer <= CSCDetId::maxLayerId(); ++layer) { result.push_back(digis(layer)); } return result; diff --git a/EventFilter/CSCRawToDigi/src/CSCCFEBTimeSlice.cc b/EventFilter/CSCRawToDigi/src/CSCCFEBTimeSlice.cc index bf9c2542736b0..547fbf85fc5ed 100644 --- a/EventFilter/CSCRawToDigi/src/CSCCFEBTimeSlice.cc +++ b/EventFilter/CSCRawToDigi/src/CSCCFEBTimeSlice.cc @@ -1,3 +1,4 @@ +#include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "EventFilter/CSCRawToDigi/interface/CSCCFEBTimeSlice.h" #include #include @@ -29,7 +30,8 @@ CSCCFEBSCAControllerWord::CSCCFEBSCAControllerWord(unsigned short frame) } CSCCFEBDataWord *CSCCFEBTimeSlice::timeSample(int layer, int channel, bool isDCFEB) const { - assert(layer >= 1 && layer <= 6); + assert(layer >= CSCDetId::minLayerId()); + assert(layer <= CSCDetId::maxLayerId()); assert(channel >= 1 && channel <= 16); int layerIndex = layerInverseGrayCode[layer - 1]; @@ -50,7 +52,7 @@ CSCCFEBSCAControllerWord CSCCFEBTimeSlice::scaControllerWord(int layer) const { } void CSCCFEBTimeSlice::setControllerWord(const CSCCFEBSCAControllerWord &controllerWord) { - for (int layer = 1; layer <= 6; ++layer) { + for (int layer = CSCDetId::minLayerId(); layer <= CSCDetId::maxLayerId(); ++layer) { for (int channel = 1; channel <= 16; ++channel) { const unsigned short *shortWord = reinterpret_cast(&controllerWord); timeSample(layer, channel)->controllerData = (*shortWord >> (channel - 1)) & 1; @@ -68,7 +70,7 @@ unsigned CSCCFEBTimeSlice::calcCRC() const { std::ostream &operator<<(std::ostream &os, const CSCCFEBTimeSlice &slice) { for (int ichannel = 1; ichannel <= 16; ++ichannel) { - for (int ilayer = 1; ilayer <= 6; ++ilayer) { + for (int ilayer = CSCDetId::minLayerId(); ilayer <= CSCDetId::maxLayerId(); ++ilayer) { //unsigned index = (ilayer-1) + (ichannel-1)*6; //int value = (slice.timeSample(index))->adcCounts - 560; int value = (slice.timeSample(ilayer, ichannel))->adcCounts - 560; diff --git a/EventFilter/CSCRawToDigi/src/CSCComparatorData.cc b/EventFilter/CSCRawToDigi/src/CSCComparatorData.cc index 6e30fc550d4bf..dfe87b1b1cc13 100644 --- a/EventFilter/CSCRawToDigi/src/CSCComparatorData.cc +++ b/EventFilter/CSCRawToDigi/src/CSCComparatorData.cc @@ -1,6 +1,7 @@ #include "EventFilter/CSCRawToDigi/interface/CSCComparatorData.h" #include "EventFilter/CSCRawToDigi/interface/CSCTMBHeader.h" #include "DataFormats/MuonDetId/interface/CSCDetId.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include #include @@ -41,7 +42,7 @@ CSCComparatorData::CSCComparatorData(int ncfebs, int ntbins, const unsigned shor void CSCComparatorData::zero() { for (int ifeb = 0; ifeb < ncfebs_; ++ifeb) { for (int tbin = 0; tbin < ntbins_; ++tbin) { - for (int layer = 1; layer <= 6; ++layer) { + for (int layer = CSCDetId::minLayerId(); layer <= CSCDetId::maxLayerId(); ++layer) { dataWord(ifeb, tbin, layer) = CSCComparatorDataWord(ifeb, tbin, 0); } } @@ -53,16 +54,18 @@ std::vector CSCComparatorData::comparatorDigis(uint32_t idlay bool me1a = (CSCDetId::station(idlayer) == 1) && (CSCDetId::ring(idlayer) == 4); bool zplus = (CSCDetId::endcap(idlayer) == 1); bool me1b = (CSCDetId::station(idlayer) == 1) && (CSCDetId::ring(idlayer) == 1); - // bool me11 = (CSCDetId::station(idlayer)==1) && ((CSCDetId::ring(idlayer)==1) || (CSCDetId::ring(idlayer)==4)); - unsigned layer = CSCDetId::layer(idlayer); + int layer = CSCDetId::layer(idlayer); + + assert(layer >= CSCDetId::minLayerId()); + assert(layer <= CSCDetId::maxLayerId()); //looking for comp output on layer std::vector result; - assert(layer > 0 && layer <= 6); + // this is pretty sparse data, so I wish we could check the // data word by word, not bit by bit, but I don't see how to // do the time sequencing that way. - for (int distrip = 0; distrip < 8; ++distrip) { + for (int distrip = 0; distrip < CSCConstants::NUM_DISTRIPS_PER_CFEB; ++distrip) { uint16_t tbinbitsS0HS0 = 0; uint16_t tbinbitsS0HS1 = 0; uint16_t tbinbitsS1HS0 = 0; @@ -78,18 +81,18 @@ std::vector CSCComparatorData::comparatorDigis(uint32_t idlay int bit2 = bitValue(cfeb, tbin + 1, layer, distrip); int bit3 = bitValue(cfeb, tbin + 2, layer, distrip); // should count from zero - int chamberDistrip = distrip + cfeb * 8; + int chamberDistrip = distrip + cfeb * CSCConstants::NUM_DISTRIPS_PER_CFEB; int HalfStrip = 4 * chamberDistrip + bit2 * 2 + bit3; int output = 4 + bit2 * 2 + bit3; /* - * Handles distrip logic; comparator output is for pairs of strips: - * hit bin dec - * x--- 100 4 - * -x-- 101 5 - * --x- 110 6 - * ---x 111 7 - * - */ + * Handles distrip logic; comparator output is for pairs of strips: + * hit bin dec + * x--- 100 4 + * -x-- 101 5 + * --x- 110 6 + * ---x 111 7 + * + */ if (debug) LogTrace("CSCComparatorData|CSCRawToDigi") @@ -177,10 +180,10 @@ std::vector CSCComparatorData::comparatorDigis(uint32_t idlay } std::vector CSCComparatorData::comparatorDigis(int layer) { - //returns comparators for one layer for all cfebs - std::vector result; - assert(layer > 0 && layer <= 6); + assert(layer >= CSCDetId::minLayerId()); + assert(layer <= CSCDetId::maxLayerId()); + std::vector result; for (int cfeb = 0; cfeb < ncfebs_; ++cfeb) { std::vector oneCfebDigi = comparatorDigis(layer, cfeb); result.insert(result.end(), oneCfebDigi.begin(), oneCfebDigi.end()); @@ -190,15 +193,16 @@ std::vector CSCComparatorData::comparatorDigis(int layer) { } void CSCComparatorData::add(const CSCComparatorDigi& digi, int layer) { - //FIXME do flipping int strip = digi.getStrip(); - int halfStrip = (strip - 1) * 2 + digi.getComparator(); - int cfeb = (strip - 1) / 16; - int distrip = ((strip - 1) % 16) / 2; + int halfstrip = digi.getHalfStrip(); + int cfeb = digi.getCFEB(); + int distrip = digi.getDiStrip(); - // assert(distrip < 8 && cfeb < 6 && halfStrip < 161); - ///!!! Do we need to introduce format version here to accomodate 7 CFEBs - assert(distrip < 8 && cfeb < 8 && halfStrip < 225); + // Check the distrip and half-strip number + assert(cfeb < CSCConstants::MAX_CFEBS_RUN2); + assert(distrip < CSCConstants::NUM_DISTRIPS_PER_CFEB); + // note that half-strips are not staggered in the packer + assert(halfstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2); std::vector timeBinsOn = digi.getTimeBinsOn(); for (std::vector::const_iterator tbinItr = timeBinsOn.begin(); tbinItr != timeBinsOn.end(); ++tbinItr) { @@ -225,52 +229,55 @@ void CSCComparatorData::add(const CSCComparatorDigi& digi, const CSCDetId& cid) bool me1a = (cid.station() == 1) && (cid.ring() == 4); bool zplus = (cid.endcap() == 1); bool me1b = (cid.station() == 1) && (cid.ring() == 1); - // bool me11 = (cid.station()==1) && ((cid.ring()==1) || (cid.ring()==4)); unsigned layer = cid.layer(); int strip = digi.getStrip(); - int halfstrip = (strip - 1) * 2 + digi.getComparator(); - int cfeb = (strip - 1) / 16; - int distrip = ((strip - 1) % 16) / 2; + int halfstrip = digi.getHalfStrip(); + int cfeb = digi.getCFEB(); + int distrip = digi.getDiStrip(); int bit2 = (strip - 1) % 2; int bit3 = digi.getComparator(); - // assert(distrip < 8 && cfeb < 6 && halfStrip < 161); - ///!!! Do we need to introduce format version here to accomodate 7 CFEBs + // Check the distrip and half-strip number if (theFirmwareVersion >= 2013) { - assert(distrip < 8 && cfeb < 8 && halfstrip < 225); + assert(cfeb < CSCConstants::MAX_CFEBS_RUN2); + assert(distrip < CSCConstants::NUM_DISTRIPS_PER_CFEB); + // note that half-strips are not staggered in the packer + assert(halfstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2); } else { - assert(distrip < 8 && cfeb < 6 && halfstrip < 161); + assert(cfeb < CSCConstants::MAX_CFEBS_RUN1); + assert(distrip < CSCConstants::NUM_DISTRIPS_PER_CFEB); + // note that half-strips are not staggered in the packer + assert(halfstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN1); } // Lets try to do ME11 strip flipping if (doStripSwapping) { if (theFirmwareVersion >= 2013) { - if ((me1a || (me1b && (cfeb > 3))) && zplus) { + if ((me1a || (me1b && (cfeb > CSCConstants::NUM_CFEBS_ME1A_UNGANGED))) && zplus) { distrip = 7 - distrip; // 0-7 -> 7-0 cfeb = 10 - cfeb; - bit2 = ((31 - (halfstrip % 32)) % 4) / 2; - bit3 = ((31 - (halfstrip % 32)) % 4) % 2; + bit2 = ((31 - (halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB)) % 4) / 2; + bit3 = ((31 - (halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB)) % 4) % 2; } - if (me1b && !zplus && (cfeb < 4)) { + if (me1b && !zplus && (cfeb < CSCConstants::NUM_CFEBS_ME1B)) { distrip = 7 - distrip; cfeb = 3 - cfeb; - bit2 = ((31 - (halfstrip % 32)) % 4) / 2; - bit3 = ((31 - (halfstrip % 32)) % 4) % 2; + bit2 = ((31 - (halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB)) % 4) / 2; + bit3 = ((31 - (halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB)) % 4) % 2; } } else { - // if ( me1a ) { cfeb_corr = 0; } // reset 4 to 0 - if ((me1a || (me1b && (cfeb > 3))) && zplus) { + if ((me1a || (me1b && (cfeb > CSCConstants::NUM_CFEBS_ME1A_UNGANGED))) && zplus) { distrip = 7 - distrip; // 0-7 -> 7-0 - bit2 = ((31 - (halfstrip % 32)) % 4) / 2; - bit3 = ((31 - (halfstrip % 32)) % 4) % 2; + bit2 = ((31 - (halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB)) % 4) / 2; + bit3 = ((31 - (halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB)) % 4) % 2; } - if (me1b && !zplus && (cfeb < 4)) { + if (me1b && !zplus && (cfeb < CSCConstants::NUM_CFEBS_ME1B)) { distrip = 7 - distrip; cfeb = 3 - cfeb; - bit2 = ((31 - (halfstrip % 32)) % 4) / 2; - bit3 = ((31 - (halfstrip % 32)) % 4) % 2; + bit2 = ((31 - (halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB)) % 4) / 2; + bit3 = ((31 - (halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB)) % 4) % 2; } } } @@ -298,7 +305,7 @@ bool CSCComparatorData::check() const { bool result = true; for (int cfeb = 0; cfeb < ncfebs_; ++cfeb) { for (int tbin = 0; tbin < ntbins_; ++tbin) { - for (int layer = 1; layer <= 6; ++layer) { + for (int layer = CSCDetId::minLayerId(); layer <= CSCDetId::maxLayerId(); ++layer) { /// first do some checks const CSCComparatorDataWord& word = dataWord(cfeb, tbin, layer); bool wordIsGood = (word.tbin_ == tbin) && (word.cfeb_ == cfeb); diff --git a/EventFilter/CSCRawToDigi/src/CSCDMBHeader2013.cc b/EventFilter/CSCRawToDigi/src/CSCDMBHeader2013.cc index 5745f296fbe4e..c09c24f196f65 100644 --- a/EventFilter/CSCRawToDigi/src/CSCDMBHeader2013.cc +++ b/EventFilter/CSCRawToDigi/src/CSCDMBHeader2013.cc @@ -1,4 +1,5 @@ #include "EventFilter/CSCRawToDigi/interface/CSCDMBHeader2013.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include CSCDMBHeader2013::CSCDMBHeader2013() { @@ -56,12 +57,12 @@ unsigned CSCDMBHeader2013::sizeInWords() const { return 8; } /// counts from zero bool CSCDMBHeader2013::cfebAvailable(unsigned icfeb) { - assert(icfeb < 7); + assert(icfeb < CSCConstants::MAX_CFEBS_RUN2); return (cfebAvailable() >> icfeb) & 1; } void CSCDMBHeader2013::addCFEB(int icfeb) { - assert(icfeb < 7); + assert(icfeb < CSCConstants::MAX_CFEBS_RUN2); bits.cfeb_dav |= (1 << icfeb); bits.cfeb_clct_sent |= (1 << icfeb); } diff --git a/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc b/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc index 1f1c74618a6ea..66f933d7c83f2 100644 --- a/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc +++ b/EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc @@ -5,6 +5,7 @@ */ #include "DataFormats/MuonDetId/interface/CSCDetId.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "EventFilter/CSCRawToDigi/interface/CSCDigiToRaw.h" #include "EventFilter/CSCRawToDigi/interface/CSCDCCEventData.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" @@ -161,28 +162,30 @@ void CSCDigiToRaw::add(const CSCStripDigiCollection& stripDigis, for (; digiItr != last; ++digiItr) { CSCStripDigi digi = *digiItr; int strip = digi.getStrip(); + // From LS1 on ME1a strips are unganged if (fedInfo.formatVersion_ == 2013) { if (me1a && zplus) { - digi.setStrip(49 - strip); // 1-48 -> 48-1 + digi.setStrip(CSCConstants::NUM_STRIPS_ME1A_UNGANGED + 1 - strip); // 1-48 -> 48-1 } if (me1b && !zplus) { - digi.setStrip(65 - strip); // 1-64 -> 64-1 + digi.setStrip(CSCConstants::NUM_STRIPS_ME1B + 1 - strip); // 1-64 -> 64-1 } if (me1a) { strip = digi.getStrip(); // reset back 1-16 to 65-80 digi - digi.setStrip(strip + 64); + digi.setStrip(strip + CSCConstants::NUM_STRIPS_ME1B); } - - } else { + } + // During Run-1 ME1a strips are triple-ganged + else { if (me1a && zplus) { - digi.setStrip(17 - strip); // 1-16 -> 16-1 + digi.setStrip(CSCConstants::NUM_STRIPS_ME1A_GANGED + 1 - strip); // 1-16 -> 16-1 } if (me1b && !zplus) { - digi.setStrip(65 - strip); // 1-64 -> 64-1 + digi.setStrip(CSCConstants::NUM_STRIPS_ME1B + 1 - strip); // 1-64 -> 64-1 } if (me1a) { strip = digi.getStrip(); // reset back 1-16 to 65-80 digi - digi.setStrip(strip + 64); + digi.setStrip(strip + CSCConstants::NUM_STRIPS_ME1B); } } cscData.add(digi, cscDetId.layer()); @@ -222,23 +225,28 @@ void CSCDigiToRaw::add(const CSCComparatorDigiCollection& comparatorDigis, if (packEverything || cscd2r::accept(cscDetId, clctDigis, clctWindowMin_, clctWindowMax_, me1abCheck)) { bool me1a = (cscDetId.station() == 1) && (cscDetId.ring() == 4); + /* + Add the comparator digi to the fedInfo. + Move ME1/A comparators from CFEB=0 to CFEB=4 if this has not + been done already. + Consider the case for triple-ganged and unganged ME1A strips + */ for (auto digi = j.second.first; digi != j.second.second; ++digi) { if (fedInfo.formatVersion_ == 2013) { - // Move ME1/A comparators from CFEB=0 to CFEB=4 if this has not - // been done already. - if (me1a && digi->getStrip() <= 48) { - CSCComparatorDigi digi_corr(64 + digi->getStrip(), digi->getComparator(), digi->getTimeBinWord()); - cscData.add(digi_corr, cscDetId); // This version does ME11 strips swapping - // cscData.add(digi_corr, cscDetId.layer()); // This one doesn't + // unganged case + if (me1a && digi->getStrip() <= CSCConstants::NUM_STRIPS_ME1A_UNGANGED) { + CSCComparatorDigi digi_corr( + CSCConstants::NUM_STRIPS_ME1B + digi->getStrip(), digi->getComparator(), digi->getTimeBinWord()); + cscData.add(digi_corr, cscDetId); } else { - cscData.add(*digi, cscDetId); // This version does ME11 strips swapping - // cscData.add(digi, cscDetId.layer()); // This one doesn't + cscData.add(*digi, cscDetId); } - } else { - // Move ME1/A comparators from CFEB=0 to CFEB=4 if this has not - // been done already. - if (me1a && digi->getStrip() <= 16) { - CSCComparatorDigi digi_corr(64 + digi->getStrip(), digi->getComparator(), digi->getTimeBinWord()); + } + // triple-ganged case + else { + if (me1a && digi->getStrip() <= CSCConstants::NUM_STRIPS_ME1A_GANGED) { + CSCComparatorDigi digi_corr( + CSCConstants::NUM_STRIPS_ME1B + digi->getStrip(), digi->getComparator(), digi->getTimeBinWord()); cscData.add(digi_corr, cscDetId.layer()); } else { cscData.add(*digi, cscDetId.layer()); @@ -270,14 +278,14 @@ void CSCDigiToRaw::add(const CSCCLCTDigiCollection& clctDigis, FindEventDataInfo if (me11a && fedInfo.formatVersion_ == 2013) { std::vector shiftedDigis((*j).second.first, (*j).second.second); for (std::vector::iterator iC = shiftedDigis.begin(); iC != shiftedDigis.end(); ++iC) { - if (iC->getCFEB() < 3) { //sanity check, mostly + if (iC->getCFEB() < CSCConstants::NUM_CFEBS_ME1A_UNGANGED) { //sanity check, mostly (*iC) = CSCCLCTDigi(iC->isValid(), iC->getQuality(), iC->getPattern(), iC->getStripType(), iC->getBend(), iC->getStrip(), - iC->getCFEB() + 4, + iC->getCFEB() + CSCConstants::NUM_CFEBS_ME1B, iC->getBX(), iC->getTrknmb(), iC->getFullBX()); @@ -302,12 +310,12 @@ void CSCDigiToRaw::add(const CSCCorrelatedLCTDigiCollection& corrLCTDigis, FindE if (me11a && fedInfo.formatVersion_ == 2013) { std::vector shiftedDigis((*j).second.first, (*j).second.second); for (std::vector::iterator iC = shiftedDigis.begin(); iC != shiftedDigis.end(); ++iC) { - if (iC->getStrip() < 96) { //sanity check, mostly + if (iC->getStrip() < CSCConstants::NUM_HALF_STRIPS_ME1A_UNGANGED) { //sanity check, mostly (*iC) = CSCCorrelatedLCTDigi(iC->getTrknmb(), iC->isValid(), iC->getQuality(), iC->getKeyWG(), - iC->getStrip() + 128, + iC->getStrip() + CSCConstants::NUM_HALF_STRIPS_ME1B, iC->getPattern(), iC->getBend(), iC->getBX(), @@ -364,20 +372,13 @@ void CSCDigiToRaw::createFedBuffers(const CSCStripDigiCollection& stripDigis, } int l1a = eid.event(); //need to add increments or get it from lct digis int bx = l1a; //same as above - //int startingFED = FEDNumbering::MINCSCFEDID; if (fedInfo.formatVersion_ == 2005) /// Handle pre-LS1 format data { std::map dccMap; + //idcc goes from startingFed to startingFED+7 for (int idcc = FEDNumbering::MINCSCFEDID; idcc <= FEDNumbering::MAXCSCFEDID; ++idcc) { - //idcc goes from startingFed to startingFED+7 - // @@ if ReadoutMapping changes, this'll have to change - // DCCs 1,2,4,5 have 5 DDUs. Otherwise, 4 - //int nDDUs = (idcc < 2) || (idcc ==4) || (idcc ==5) - // ? 5 : 4; - //@@ WARNING some DCCs only have 4 DDUs, but I'm giving them all 5, for now - int nDDUs = 5; - dccMap.insert(std::pair(idcc, CSCDCCEventData(idcc, nDDUs, bx, l1a))); + dccMap.insert(std::pair(idcc, CSCDCCEventData(idcc, CSCConstants::NUM_DDUS, bx, l1a))); } for (int idcc = FEDNumbering::MINCSCFEDID; idcc <= FEDNumbering::MAXCSCFEDID; ++idcc) { @@ -417,9 +418,9 @@ void CSCDigiToRaw::createFedBuffers(const CSCStripDigiCollection& stripDigis, 0, 0); } - - } else if (format_version == 2013) /// Handle post-LS1 format data - { + } + /// Handle post-LS1 format data + else if (format_version == 2013) { std::map dduMap; unsigned int ddu_fmt_version = 0x7; /// 2013 Format const unsigned postLS1_map[] = {841, 842, 843, 844, 845, 846, 847, 848, 849, 831, 832, 833, diff --git a/EventFilter/CSCRawToDigi/src/CSCEventData.cc b/EventFilter/CSCRawToDigi/src/CSCEventData.cc index 6e6ba75e0143e..ccfd2957d214c 100644 --- a/EventFilter/CSCRawToDigi/src/CSCEventData.cc +++ b/EventFilter/CSCRawToDigi/src/CSCEventData.cc @@ -1,12 +1,13 @@ #include "EventFilter/CSCRawToDigi/interface/CSCEventData.h" #include "EventFilter/CSCRawToDigi/interface/CSCCFEBData.h" +#include "EventFilter/CSCRawToDigi/interface/cscPackerCompare.h" +#include "EventFilter/CSCRawToDigi/interface/bitset_append.h" #include "DataFormats/CSCDigi/interface/CSCStripDigi.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "EventFilter/CSCRawToDigi/interface/cscPackerCompare.h" +#include "FWCore/Utilities/interface/Exception.h" #include #include -#include "EventFilter/CSCRawToDigi/interface/bitset_append.h" -#include "FWCore/Utilities/interface/Exception.h" #ifdef LOCAL_UNPACK bool CSCEventData::debug = false; @@ -25,7 +26,7 @@ CSCEventData::CSCEventData(int chamberType, uint16_t format_version) alctZSErecovered(nullptr), zseEnable(0), theFormatVersion(format_version) { - for (unsigned i = 0; i < MAX_CFEB; ++i) { + for (unsigned i = 0; i < CSCConstants::MAX_CFEBS_RUN2; ++i) { theCFEBData[i] = nullptr; } } @@ -216,7 +217,7 @@ void CSCEventData::unpack_data(const uint16_t* buf) { } } if (dmbTrailerReached) { - for (int icfeb = 0; icfeb < MAX_CFEB; ++icfeb) { + for (int icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) { theCFEBData[icfeb] = nullptr; int cfeb_available = theDMBHeader.cfebAvailable(icfeb); unsigned int cfebTimeout = theDMBTrailer.cfeb_starttimeout() | theDMBTrailer.cfeb_endtimeout(); @@ -272,7 +273,7 @@ void CSCEventData::init() { theAnodeData = nullptr; theALCTTrailer = nullptr; theTMBData = nullptr; - for (int icfeb = 0; icfeb < MAX_CFEB; ++icfeb) { + for (int icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) { theCFEBData[icfeb] = nullptr; } alctZSErecovered = nullptr; @@ -292,7 +293,7 @@ void CSCEventData::copy(const CSCEventData& data) { theALCTTrailer = new CSCALCTTrailer(*(data.theALCTTrailer)); if (data.theTMBData != nullptr) theTMBData = new CSCTMBData(*(data.theTMBData)); - for (int icfeb = 0; icfeb < MAX_CFEB; ++icfeb) { + for (int icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) { theCFEBData[icfeb] = nullptr; if (data.theCFEBData[icfeb] != nullptr) theCFEBData[icfeb] = new CSCCFEBData(*(data.theCFEBData[icfeb])); @@ -309,7 +310,7 @@ void CSCEventData::destroy() { delete theAnodeData; delete theALCTTrailer; delete theTMBData; - for (int icfeb = 0; icfeb < MAX_CFEB; ++icfeb) { + for (int icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) { delete theCFEBData[icfeb]; } /* @@ -321,7 +322,7 @@ void CSCEventData::destroy() { std::vector CSCEventData::stripDigis(const CSCDetId& idlayer) const { std::vector result; - for (unsigned icfeb = 0; icfeb < MAX_CFEB; ++icfeb) { + for (unsigned icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) { std::vector newDigis = stripDigis(idlayer, icfeb); result.insert(result.end(), newDigis.begin(), newDigis.end()); } @@ -329,7 +330,6 @@ std::vector CSCEventData::stripDigis(const CSCDetId& idlayer) cons } std::vector CSCEventData::stripDigis(unsigned idlayer, unsigned icfeb) const { - // assert(ilayer > 0 && ilayer <= 6); // off because now idlayer is raw cscdetid std::vector result; if (theCFEBData[icfeb] != nullptr) { std::vector newDigis = theCFEBData[icfeb]->digis(idlayer); @@ -349,7 +349,7 @@ std::vector CSCEventData::wireDigis(unsigned ilayer) const { std::vector > CSCEventData::stripDigis() const { std::vector > result; - for (int layer = 1; layer <= 6; ++layer) { + for (int layer = CSCDetId::minLayerId(); layer <= CSCDetId::maxLayerId(); ++layer) { std::vector digis = stripDigis(layer); result.push_back(digis); } @@ -358,7 +358,7 @@ std::vector > CSCEventData::stripDigis() const { std::vector > CSCEventData::wireDigis() const { std::vector > result; - for (int layer = 1; layer <= 6; ++layer) { + for (int layer = CSCDetId::minLayerId(); layer <= CSCDetId::maxLayerId(); ++layer) { result.push_back(wireDigis(layer)); } return result; @@ -414,20 +414,14 @@ void CSCEventData::setEventInformation(int bxnum, int lvl1num) { assert(theChamberType > 0); - theTMBData->tmbHeader()->setNCFEBs(5); + theTMBData->tmbHeader()->setNCFEBs(CSCConstants::MAX_CFEBS_RUN1); // Set number of CFEBs to 7 for Post-LS1 ME11 if ((theFormatVersion == 2013) && ((theChamberType == 1) || (theChamberType == 2))) { - theTMBData->tmbHeader()->setNCFEBs(7); + theTMBData->tmbHeader()->setNCFEBs(CSCConstants::MAX_CFEBS_RUN2); } - /* - // Set number of CFEBs to 4 for ME13 chambers - if (theChamberType == 4) { - theTMBData->tmbHeader()->setNCFEBs(4); - } -*/ } - for (unsigned cfeb = 0; cfeb < 7; cfeb++) { + for (unsigned cfeb = 0; cfeb < CSCConstants::MAX_CFEBS_RUN2; cfeb++) { if (theCFEBData[cfeb]) theCFEBData[cfeb]->setL1A(lvl1num); } @@ -447,9 +441,9 @@ void CSCEventData::checkALCTClasses() { } void CSCEventData::checkTMBClasses() { - int nCFEBs = 5; + int nCFEBs = CSCConstants::MAX_CFEBS_RUN1; if ((theFormatVersion == 2013) && ((theChamberType == 1) || (theChamberType == 2))) { - nCFEBs = 7; + nCFEBs = CSCConstants::MAX_CFEBS_RUN2; } if (theTMBData == nullptr) { if (theFormatVersion == 2013) { // Set to TMB format for Post-LS1 data @@ -466,7 +460,7 @@ void CSCEventData::checkTMBClasses() { void CSCEventData::add(const CSCStripDigi& digi, int layer) { //@@ need special logic here for ME11 - unsigned cfeb = (digi.getStrip() - 1) / 16; + unsigned cfeb = digi.getCFEB(); bool sixteenSamples = false; if (digi.getADCCounts().size() == 16) sixteenSamples = true; @@ -515,7 +509,7 @@ void CSCEventData::add(const std::vector& digis) { void CSCEventData::add(const std::vector& clusters, const GEMDetId&) { checkTMBClasses(); } std::ostream& operator<<(std::ostream& os, const CSCEventData& evt) { - for (int ilayer = 1; ilayer <= 6; ++ilayer) { + for (int ilayer = CSCDetId::minLayerId(); ilayer <= CSCDetId::maxLayerId(); ++ilayer) { std::vector stripDigis = evt.stripDigis(ilayer); //copy(stripDigis.begin(), stripDigis.end(), std::ostream_iterator(os, "\n")); //print your scas here @@ -554,7 +548,7 @@ boost::dynamic_bitset<> CSCEventData::pack() { result = bitset_utilities::append(result, theTMBData->pack()); } - for (int icfeb = 0; icfeb < MAX_CFEB; ++icfeb) { + for (int icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) { if (theCFEBData[icfeb] != nullptr) { boost::dynamic_bitset<> cfebData = bitset_utilities::ushortToBitset(theCFEBData[icfeb]->sizeInWords() * 16, theCFEBData[icfeb]->data()); diff --git a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2007_rev0x50c3.cc b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2007_rev0x50c3.cc index c0668a9f2ccf2..ef5c07eaba7b8 100644 --- a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2007_rev0x50c3.cc +++ b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2007_rev0x50c3.cc @@ -26,8 +26,8 @@ void CSCTMBHeader2007_rev0x50c3::setEventInformation(const CSCDMBHeader& dmbHead std::vector CSCTMBHeader2007_rev0x50c3::CLCTDigis(uint32_t idlayer) { std::vector result; int halfstrip = bits.clct0_key_low + (bits.clct0_key_high << 7); - int strip = halfstrip % 32; - int cfeb = halfstrip / 32; + int strip = halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB; + int cfeb = halfstrip / CSCConstants::NUM_HALF_STRIPS_PER_CFEB; int pattern = bits.clct0_shape; int bend = pattern & 0x1; @@ -37,8 +37,8 @@ std::vector CSCTMBHeader2007_rev0x50c3::CLCTDigis(uint32_t idlayer) //digi0.setFullBX(bits.bxnPreTrigger); halfstrip = bits.clct1_key_low + (bits.clct1_key_high << 7); - strip = halfstrip % 32; - cfeb = halfstrip / 32; + strip = halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB; + cfeb = halfstrip / CSCConstants::NUM_HALF_STRIPS_PER_CFEB; pattern = bits.clct1_shape; bend = pattern & 0x1; diff --git a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2013.cc b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2013.cc index 1ab0a318628ec..1c79a290a8ec1 100644 --- a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2013.cc +++ b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2013.cc @@ -24,8 +24,8 @@ void CSCTMBHeader2013::setEventInformation(const CSCDMBHeader& dmbHeader) { std::vector CSCTMBHeader2013::CLCTDigis(uint32_t idlayer) { std::vector result; int halfstrip = bits.clct0_key_low + (bits.clct0_key_high << 7); - int strip = halfstrip % 32; - int cfeb = halfstrip / 32; + int strip = halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB; + int cfeb = halfstrip / CSCConstants::NUM_HALF_STRIPS_PER_CFEB; int pattern = bits.clct0_shape; int bend = pattern & 0x1; @@ -35,8 +35,8 @@ std::vector CSCTMBHeader2013::CLCTDigis(uint32_t idlayer) { //digi0.setFullBX(bits.bxnPreTrigger); halfstrip = bits.clct1_key_low + (bits.clct1_key_high << 7); - strip = halfstrip % 32; - cfeb = halfstrip / 32; + strip = halfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB; + cfeb = halfstrip / CSCConstants::NUM_HALF_STRIPS_PER_CFEB; pattern = bits.clct1_shape; bend = pattern & 0x1; diff --git a/EventFilter/L1TRawToDigi/src/OmtfCscPacker.cc b/EventFilter/L1TRawToDigi/src/OmtfCscPacker.cc index 97e482e93a78d..a318ba694fae3 100644 --- a/EventFilter/L1TRawToDigi/src/OmtfCscPacker.cc +++ b/EventFilter/L1TRawToDigi/src/OmtfCscPacker.cc @@ -2,7 +2,7 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DataFormats/L1TMuon/interface/OMTF/OmtfCscDataWord64.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" namespace omtf { diff --git a/EventFilter/L1TRawToDigi/src/OmtfCscUnpacker.cc b/EventFilter/L1TRawToDigi/src/OmtfCscUnpacker.cc index 99924ba24acea..0a7e406707125 100644 --- a/EventFilter/L1TRawToDigi/src/OmtfCscUnpacker.cc +++ b/EventFilter/L1TRawToDigi/src/OmtfCscUnpacker.cc @@ -1,11 +1,8 @@ #include "EventFilter/L1TRawToDigi/interface/OmtfCscUnpacker.h" - #include "FWCore/MessageLogger/interface/MessageLogger.h" - #include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" - +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "DataFormats/L1TMuon/interface/OMTF/OmtfCscDataWord64.h" namespace omtf { diff --git a/L1Trigger/CSCTrackFinder/src/CSCSectorReceiverLUT.cc b/L1Trigger/CSCTrackFinder/src/CSCSectorReceiverLUT.cc index 48010e6643421..8f557085df83f 100644 --- a/L1Trigger/CSCTrackFinder/src/CSCSectorReceiverLUT.cc +++ b/L1Trigger/CSCTrackFinder/src/CSCSectorReceiverLUT.cc @@ -1,18 +1,18 @@ -#include -#include -#include -#include -#include -#include +#include "L1Trigger/CSCTrackFinder/interface/CSCSectorReceiverLUT.h" +#include "L1Trigger/CSCTrackFinder/interface/CSCSectorReceiverMiniLUT.h" +#include "L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h" +#include "DataFormats/L1CSCTrackFinder/interface/CSCBitWidths.h" +#include "DataFormats/L1CSCTrackFinder/interface/CSCTFConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "Geometry/CSCGeometry/interface/CSCGeometry.h" -#include +#include "Geometry/CSCGeometry/interface/CSCLayerGeometry.h" #include "DataFormats/GeometryVector/interface/LocalPoint.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" -#include +#include "DataFormats/MuonDetId/interface/CSCTriggerNumbering.h" -#include +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include #include @@ -138,21 +138,21 @@ lclphidat CSCSectorReceiverLUT::calcLocalPhi(const lclphiadd& theadd) const { lclphidat data; constexpr int maxPhiL = 1 << CSCBitWidths::kLocalPhiDataBitWidth; - double binPhiL = static_cast(maxPhiL) / (2. * CSCConstants::MAX_NUM_STRIPS); + double binPhiL = static_cast(maxPhiL) / (2. * CSCConstants::MAX_NUM_STRIPS_RUN1); double patternOffset; patternOffset = CSCPatternBank::getLegacyPosition((theadd.pattern_type << 3) + theadd.clct_pattern); // The phiL value stored is for the center of the half-/di-strip. - if (theadd.strip < 2 * CSCConstants::MAX_NUM_STRIPS) + if (theadd.strip < 2 * CSCConstants::MAX_NUM_STRIPS_RUN1) if (theadd.pattern_type == 1 || isTMB07) // if halfstrip (Note: no distrips in TMB 2007 patterns) data.phi_local = static_cast((0.5 + theadd.strip + patternOffset) * binPhiL); else // if distrip data.phi_local = static_cast((2 + theadd.strip + 4. * patternOffset) * binPhiL); else { throw cms::Exception("CSCSectorReceiverLUT") << "+++ Value of strip, " << theadd.strip << ", exceeds max allowed, " - << 2 * CSCConstants::MAX_NUM_STRIPS - 1 << " +++\n"; + << 2 * CSCConstants::MAX_NUM_STRIPS_RUN1 - 1 << " +++\n"; } if (data.phi_local >= maxPhiL) { @@ -257,7 +257,7 @@ gblphidat CSCSectorReceiverLUT::calcGlobalPhiME(const gblphiadd& address) const // We will use these to convert the local phi into radians. constexpr unsigned int maxPhiL = 1 << CSCBitWidths::kLocalPhiDataBitWidth; - const double binPhiL = static_cast(maxPhiL) / (2. * CSCConstants::MAX_NUM_STRIPS); + const double binPhiL = static_cast(maxPhiL) / (2. * CSCConstants::MAX_NUM_STRIPS_RUN1); if (cscid < CSCTriggerNumbering::minTriggerCscId()) { edm::LogWarning("CSCSectorReceiverLUT|getGlobalPhiValue") @@ -304,9 +304,9 @@ gblphidat CSCSectorReceiverLUT::calcGlobalPhiME(const gblphiadd& address) const // 1023. When we did the conversion in fillLocalPhiTable(), we did // not know for which chamber we do it (and, therefore, how many strips // it has), and always used the maximum possible number of strips - // per chamber, MAX_NUM_STRIPS=80. Now, since we know the chamber id + // per chamber, MAX_NUM_STRIPS_RUN1=80. Now, since we know the chamber id // and how many strips the chamber has, we can re-adjust the scale. - //const double scale = static_cast(CSCConstants::MAX_NUM_STRIPS)/nStrips; + //const double scale = static_cast(CSCConstants::MAX_NUM_STRIPS_RUN1)/nStrips; int strip = 0, halfstrip = 0; @@ -608,15 +608,15 @@ double CSCSectorReceiverLUT::getGlobalEtaValue(const unsigned& thecscid, result = thechamber->layer(CSCConstants::KEY_ALCT_LAYER)->centerOfWireGroup(wire_group).eta(); } else { const unsigned nStrips = layerGeom->numberOfStrips(); - const unsigned nStripsPerBin = CSCConstants::MAX_NUM_STRIPS / numBins; + const unsigned nStripsPerBin = CSCConstants::MAX_NUM_STRIPS_RUN1 / numBins; /** * Calculate Eta correction */ // Check that no strips will be left out. - if (nStrips % numBins != 0 || CSCConstants::MAX_NUM_STRIPS % numBins != 0) + if (nStrips % numBins != 0 || CSCConstants::MAX_NUM_STRIPS_RUN1 % numBins != 0) edm::LogWarning("CSCSectorReceiverLUT") - << "getGlobalEtaValue warning: number of strips " << nStrips << " (" << CSCConstants::MAX_NUM_STRIPS + << "getGlobalEtaValue warning: number of strips " << nStrips << " (" << CSCConstants::MAX_NUM_STRIPS_RUN1 << ") is not divisible by numBins " << numBins << " Station " << _station << " sector " << _sector << " subsector " << _subsector << " cscid " << cscid << "\n"; diff --git a/L1Trigger/CSCTrackFinder/src/CSCSectorReceiverMiniLUT.cc b/L1Trigger/CSCTrackFinder/src/CSCSectorReceiverMiniLUT.cc index d62ad2a736810..90a57e402b15d 100644 --- a/L1Trigger/CSCTrackFinder/src/CSCSectorReceiverMiniLUT.cc +++ b/L1Trigger/CSCTrackFinder/src/CSCSectorReceiverMiniLUT.cc @@ -1,19 +1,19 @@ -#include -#include -#include -#include +#include "L1Trigger/CSCTrackFinder/interface/CSCSectorReceiverMiniLUT.h" +#include "L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h" +#include "DataFormats/L1CSCTrackFinder/interface/CSCBitWidths.h" +#include "DataFormats/L1CSCTrackFinder/interface/CSCTFConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" -#include +#include "Geometry/CSCGeometry/interface/CSCLayerGeometry.h" #include "DataFormats/GeometryVector/interface/LocalPoint.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" -#include +#include "DataFormats/MuonDetId/interface/CSCTriggerNumbering.h" -#include +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include #include -#include lclphidat CSCSectorReceiverMiniLUT::calcLocalPhiMini(unsigned theadd, const bool gangedME1a) { // This method is ripped from CSCSectorReceverLUT.cc with minor changes @@ -24,7 +24,7 @@ lclphidat CSCSectorReceiverMiniLUT::calcLocalPhiMini(unsigned theadd, const bool unsigned short int pattern = ((theadd >> 8) & 0xf); unsigned short int strip = (theadd & 0xff); - if (strip < 2 * (CSCConstants::MAX_NUM_STRIPS * 7 / 5) && + if (strip < 2 * (CSCConstants::MAX_NUM_STRIPS_RUN1 * 7 / 5) && pattern < CSCConstants:: NUM_CLCT_PATTERNS) { // MDG, DA and RW, for ME1 we have 7CFEBs and not just 5, so the num_strips can go up to 16 * 7 but only for ME1 @@ -33,7 +33,7 @@ lclphidat CSCSectorReceiverMiniLUT::calcLocalPhiMini(unsigned theadd, const bool //DA and MDG, rescale range of local phi so ME1/1b fits in 0-511 } else edm::LogWarning("CSCSectorReceiverMiniLUT") << "+++ Value of strip, " << strip << ", exceeds max allowed, " - << 2 * CSCConstants::MAX_NUM_STRIPS - 1 << " +++\n"; + << 2 * CSCConstants::MAX_NUM_STRIPS_RUN1 - 1 << " +++\n"; if (data.phi_local >= maxPhiL) edm::LogWarning("CSCSectorReceiverMiniLUT") @@ -72,7 +72,7 @@ global_eta_data CSCSectorReceiverMiniLUT::calcGlobalEtaMEMini(unsigned short end int eta_temp = 999, eta_min = 999, eta_max = 999; - if ((tcscid > 0) && (tcscid <= 12) && (WG < CSCConstants::MAX_NUM_WIRES)) { + if ((tcscid > 0) && (tcscid <= 12) && (WG < CSCConstants::MAX_NUM_WIREGROUPS)) { unsigned short int cscid = (tcscid > 9) ? tcscid - 9 : tcscid; if (station == 1) { unsigned short int lclPhip = 0; @@ -113,7 +113,7 @@ global_eta_data CSCSectorReceiverMiniLUT::calcGlobalEtaMEMini(unsigned short end } else { edm::LogWarning("CSCSectorReceiverMiniLUT") << "+++ Value of cscid, " << tcscid << ", is out of bounds, [1, 9] -- or --" - << " Value of wire group, " << WG << ", exceeds max allowed, " << CSCConstants::MAX_NUM_WIRES << " +++\n"; + << " Value of wire group, " << WG << ", exceeds max allowed, " << CSCConstants::MAX_NUM_WIREGROUPS << " +++\n"; } // protect from negative numbers. If the value of eta_temp is <0, set global eta to the minimum value @@ -158,7 +158,7 @@ global_phi_data CSCSectorReceiverMiniLUT::calcGlobalPhiMEMini(unsigned short end // 12/11/09 // GP et DA: how to identify the strip number and isolate and shift the localPhi value - const double binPhiL = static_cast(maxPhiL) / (2 * CSCConstants::MAX_NUM_STRIPS); + const double binPhiL = static_cast(maxPhiL) / (2 * CSCConstants::MAX_NUM_STRIPS_RUN1); int strip = static_cast(lclPhi / binPhiL); if (station == 1 && (cscid <= 3) && diff --git a/L1Trigger/CSCTrackFinder/src/CSCTFDTReceiver.cc b/L1Trigger/CSCTrackFinder/src/CSCTFDTReceiver.cc index 705fef2f8e431..4304a68943cac 100644 --- a/L1Trigger/CSCTrackFinder/src/CSCTFDTReceiver.cc +++ b/L1Trigger/CSCTrackFinder/src/CSCTFDTReceiver.cc @@ -1,13 +1,13 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#include +#include "L1Trigger/CSCTrackFinder/src/CSCTFDTReceiver.h" +#include "L1Trigger/DTTrackFinder/src/L1MuDTTFConfig.h" +#include "L1TriggerConfig/DTTPGConfig/interface/DTConfigTraco.h" +#include "DataFormats/MuonDetId/interface/CSCDetId.h" +#include "DataFormats/MuonDetId/interface/CSCTriggerNumbering.h" +#include "DataFormats/L1CSCTrackFinder/interface/CSCBitWidths.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" +#include "DataFormats/MuonDetId/interface/DTChamberId.h" + +#include "L1Trigger/CSCTrackFinder/src/CSCTFDTReceiverLUT.h" CSCTriggerContainer CSCTFDTReceiver::process(const L1MuDTChambPhContainer* dttrig) { dtstubs.clear(); diff --git a/L1Trigger/CSCTrackFinder/src/CSCTFMuonSorter.cc b/L1Trigger/CSCTrackFinder/src/CSCTFMuonSorter.cc index 95067796693f8..e61135d5856f5 100644 --- a/L1Trigger/CSCTrackFinder/src/CSCTFMuonSorter.cc +++ b/L1Trigger/CSCTrackFinder/src/CSCTFMuonSorter.cc @@ -1,6 +1,6 @@ -#include -#include "DataFormats/L1TMuon/interface/CSCConstants.h" -#include +#include "L1Trigger/CSCTrackFinder/interface/CSCTFMuonSorter.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" CSCTFMuonSorter::CSCTFMuonSorter(const edm::ParameterSet& pset) { m_minBX = pset.getParameter("MinBX"); diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h index cc99185d1b817..56bc0e6dfda43 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h @@ -74,7 +74,7 @@ class CSCAnodeLCTProcessor : public CSCBaseboard { // test, being passed the time array, or called by the run() function above. // It gets wire times from an input array and then loops over the keywires. // All found LCT candidates are sorted and the best two are retained. - void run(const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]); + void run(const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]); /** Returns vector of ALCTs in the read-out time window, if any. */ std::vector readoutALCTs(int nMaxALCTs = CSCConstants::MAX_ALCTS_READOUT) const; @@ -119,18 +119,19 @@ class CSCAnodeLCTProcessor : public CSCBaseboard { int numWireGroups; int MESelection; - int first_bx[CSCConstants::MAX_NUM_WIRES]; - int first_bx_corrected[CSCConstants::MAX_NUM_WIRES]; - int quality[CSCConstants::MAX_NUM_WIRES][3]; + int first_bx[CSCConstants::MAX_NUM_WIREGROUPS]; + int first_bx_corrected[CSCConstants::MAX_NUM_WIREGROUPS]; + int quality[CSCConstants::MAX_NUM_WIREGROUPS][3]; std::vector digiV[CSCConstants::NUM_LAYERS]; - unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]; + unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]; std::vector lct_list; std::vector thePreTriggerDigis; /* data members for high multiplicity triggers */ - void encodeHighMultiplicityBits(const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]); + void encodeHighMultiplicityBits( + const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]); unsigned inTimeHMT_; unsigned outTimeHMT_; std::vector thresholds_; @@ -195,14 +196,14 @@ class CSCAnodeLCTProcessor : public CSCBaseboard { void clear(const int wire, const int pattern); /* Gets wire times from the wire digis and fills wire[][] vector */ - void readWireDigis(std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]); + void readWireDigis(std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]); /* A pulse array will be used as a bit representation of hit times. For example: if a keywire has a bx_time of 3, then 1 shifted left 3 will be bit pattern 0000000000001000. Bits are then added to signify the duration of a signal (hit_persist, formerly bx_width). So for the pulse with a hit_persist of 6 will look like 0000000111111000. */ - bool pulseExtension(const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]); + bool pulseExtension(const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]); /* Check that there are nplanes_hit_pretrig or more layers hit in collision or accelerator patterns for a particular key_wire. If so, return @@ -259,7 +260,7 @@ class CSCAnodeLCTProcessor : public CSCBaseboard { void dumpConfigParams() const; /** Dump digis on wire groups. */ - void dumpDigis(const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) const; + void dumpDigis(const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) const; void showPatterns(const int key_wire); }; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h index ba03f1cdc9e3e..a0c1e0be34f39 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h @@ -6,7 +6,7 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "Geometry/CSCGeometry/interface/CSCGeometry.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h" #include "CondFormats/CSCObjects/interface/CSCDBL1TPParameters.h" diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h index 12e0acce33f98..086939466fd20 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h @@ -69,7 +69,7 @@ class CSCCathodeLCTProcessor : public CSCBaseboard { /** Called in test mode and by the run(compdc) function; does the actual LCT finding. */ - void run(const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]); + void run(const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]); /** Returns vector of CLCTs in the read-out time window, if any. */ std::vector readoutCLCTs(int nMaxCLCTs = CSCConstants::MAX_CLCTS_READOUT) const; @@ -117,19 +117,21 @@ class CSCCathodeLCTProcessor : public CSCBaseboard { /** Make sure that the parameter values are within the allowed range. */ void checkConfigParameters(); - typedef unsigned int PulseArray[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + typedef unsigned int PulseArray[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; //---------------- Methods common to all firmware versions ------------------ // Single-argument version for TMB07 (halfstrip-only) firmware. // Takes the comparator & time info and stuffs it into halfstrip vector. // Multiple hits on the same strip are allowed. - void readComparatorDigis(std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]); - void pulseExtension(const std::vector time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], - PulseArray pulse); + void readComparatorDigis( + std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]); + void pulseExtension( + const std::vector time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER], + PulseArray pulse); //--------------- Functions for post-2007 version of the firmware ----------- virtual std::vector findLCTs( - const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]); + const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]); /* Check all half-strip pattern envelopes simultaneously, on every clock cycle, for a matching pattern */ virtual bool preTrigger(const PulseArray pulse, const int start_bx, int& first_bx); @@ -145,14 +147,17 @@ class CSCCathodeLCTProcessor : public CSCBaseboard { void cleanComparatorContainer(CSCCLCTDigi& lct) const; /* Mark the half-strips around the best half-strip as busy */ - void markBusyKeys(const int best_hstrip, const int best_patid, int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS]); + void markBusyKeys(const int best_hstrip, + const int best_patid, + int quality[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]); //--------------------------- Auxiliary methods ----------------------------- /** Dump CLCT configuration parameters. */ void dumpConfigParams() const; /** Dump half-strip digis */ - void dumpDigis(const std::vector strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]) const; + void dumpDigis( + const std::vector strip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) const; // --------Functions for the comparator code algorith for Run-3 ---------// //calculates the id based on location of hits @@ -168,15 +173,15 @@ class CSCCathodeLCTProcessor : public CSCBaseboard { //--------------------------- Member variables ----------------------------- /* best pattern Id for a given half-strip */ - unsigned int best_pid[CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + unsigned int best_pid[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; /* number of layers hit on a given half-strip */ - unsigned int nhits[CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + unsigned int nhits[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; - int first_bx_corrected[CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + int first_bx_corrected[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; /* does a given half-strip have a pre-trigger? */ - bool ispretrig[CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + bool ispretrig[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; // actual LUT used CSCPatternBank::LCTPatterns clct_pattern_ = {}; @@ -208,7 +213,7 @@ class CSCCathodeLCTProcessor : public CSCBaseboard { /* data members for high multiplicity triggers */ void encodeHighMultiplicityBits( - const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]); + const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]); unsigned inTimeHMT_; unsigned outTimeHMT_; std::vector thresholds_; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h index de2a2e71cb47e..2b16dfcdcaf09 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h @@ -1,7 +1,7 @@ #ifndef L1Trigger_CSCTriggerPrimitives_CSCPatternBank_h #define L1Trigger_CSCTriggerPrimitives_CSCPatternBank_h -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include // diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeCathodeLCTProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeCathodeLCTProcessor.h index 11dd9cd8cc623..96637013ee21f 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeCathodeLCTProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeCathodeLCTProcessor.h @@ -36,7 +36,7 @@ class CSCUpgradeCathodeLCTProcessor : public CSCCathodeLCTProcessor { protected: /* is a given half-strip in a pretrigger dead zone */ - bool busyMap[CSCConstants::NUM_HALF_STRIPS_7CFEBS][CSCConstants::MAX_CLCT_TBINS]; + bool busyMap[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER][CSCConstants::MAX_CLCT_TBINS]; private: /** VK: use of localized dead-time zones */ @@ -51,7 +51,8 @@ class CSCUpgradeCathodeLCTProcessor : public CSCCathodeLCTProcessor { //--------------- Functions for Phase2 studies ---------------- std::vector findLCTs( - const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]) override; + const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) + override; /* Phase2 version, Check all half-strip pattern envelopes simultaneously, on every clock cycle, for a matching pattern */ bool preTrigger(const PulseArray pulse, const int start_bx, int& first_bx) override; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h index 156afb11ec6bc..ca12f1cc83d52 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h @@ -1,7 +1,6 @@ #ifndef L1Trigger_CSCTriggerPrimitives_CSCUpgradeMotherboardLUT_h #define L1Trigger_CSCTriggerPrimitives_CSCUpgradeMotherboardLUT_h -#include "DataFormats/L1TMuon/interface/CSCConstants.h" #include "DataFormats/CSCDigi/interface/CSCALCTDigi.h" #include "DataFormats/CSCDigi/interface/CSCCLCTDigi.h" diff --git a/L1Trigger/CSCTriggerPrimitives/interface/LCTContainer.h b/L1Trigger/CSCTriggerPrimitives/interface/LCTContainer.h index b9d58e611813e..684adadbb3b2d 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/LCTContainer.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/LCTContainer.h @@ -10,7 +10,7 @@ */ #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include #include diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCAnodeLCTAnalyzer.cc b/L1Trigger/CSCTriggerPrimitives/plugins/CSCAnodeLCTAnalyzer.cc index bfb1d389b9466..9902d3ea48d6c 100644 --- a/L1Trigger/CSCTriggerPrimitives/plugins/CSCAnodeLCTAnalyzer.cc +++ b/L1Trigger/CSCTriggerPrimitives/plugins/CSCAnodeLCTAnalyzer.cc @@ -3,6 +3,7 @@ #include "Geometry/CSCGeometry/interface/CSCGeometry.h" #include "Geometry/CSCGeometry/interface/CSCLayer.h" #include "L1Trigger/CSCTriggerPrimitives/plugins/CSCAnodeLCTAnalyzer.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" using namespace std; @@ -100,7 +101,7 @@ vector CSCAnodeLCTAnalyzer::lctDigis(const CSCALCTDigi& alct, // check the mask if (CSCPatternBank::alct_pattern_legacy_[alct_pattern][i_layer][i_wire]) { int wire = alct_keywire + CSCPatternBank::alct_keywire_offset_[MESelection][i_wire]; - if (wire >= 0 && wire < CSCConstants::MAX_NUM_WIRES) { + if (wire >= 0 && wire < CSCConstants::MAX_NUM_WIREGROUPS) { // Check if there is a "good" Digi on this wire. if (digiMap.count(wire) > 0) { tempInfo.setId(layerId); // store the layer of this object @@ -299,9 +300,9 @@ int CSCAnodeLCTAnalyzer::nearestWG(const vector& allLayerInfo // Wire groups in ALCTs are counted starting from 0, whereas they // are counted from 1 in MC-related info. nearestWG -= 1; - if (nearestWG < 0 || nearestWG >= CSCConstants::MAX_NUM_WIRES) { + if (nearestWG < 0 || nearestWG >= CSCConstants::MAX_NUM_WIREGROUPS) { edm::LogWarning("L1CSCTPEmulatorWrongInput") - << "+++ Warning: nearest wire group, " << nearestWG << ", is not in [0-" << CSCConstants::MAX_NUM_WIRES + << "+++ Warning: nearest wire group, " << nearestWG << ", is not in [0-" << CSCConstants::MAX_NUM_WIREGROUPS << ") interval +++\n"; } @@ -330,9 +331,9 @@ void CSCAnodeLCTAnalyzer::setGeometry(const CSCGeometry* geom) { geom_ = geom; } double CSCAnodeLCTAnalyzer::getWGEta(const CSCDetId& layerId, const int wiregroup) { // Returns eta position of a given wiregroup. - if (wiregroup < 0 || wiregroup >= CSCConstants::MAX_NUM_WIRES) { + if (wiregroup < 0 || wiregroup >= CSCConstants::MAX_NUM_WIREGROUPS) { edm::LogWarning("L1CSCTPEmulatorWrongInput") << "+++ Warning: wire group, " << wiregroup << ", is not in [0-" - << CSCConstants::MAX_NUM_WIRES << ") interval +++\n"; + << CSCConstants::MAX_NUM_WIREGROUPS << ") interval +++\n"; } const CSCLayer* csclayer = geom_->layer(layerId); diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.cc b/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.cc index 3f5f74e493cd9..7ce39fd9e4feb 100644 --- a/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.cc +++ b/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.cc @@ -53,9 +53,9 @@ vector CSCCathodeLCTAnalyzer::lctDigis(const CSCCLCTDigi& c // The list of ComparatorDigis is stored in a class called CSCLayerInfo which // contains the layerId's of the stored ComparatorDigis as well as the actual // digis themselves. - int hfstripDigis[CSCConstants::NUM_HALF_STRIPS]; - int time[CSCConstants::MAX_NUM_STRIPS], comp[CSCConstants::MAX_NUM_STRIPS]; - int digiNum[CSCConstants::MAX_NUM_STRIPS]; + int hfstripDigis[CSCConstants::MAX_NUM_HALF_STRIPS_RUN1_TRIGGER]; + int time[CSCConstants::MAX_NUM_STRIPS_RUN1], comp[CSCConstants::MAX_NUM_STRIPS_RUN1]; + int digiNum[CSCConstants::MAX_NUM_STRIPS_RUN1]; int digiId = -999; CSCCathodeLayerInfo tempInfo; vector vectInfo; @@ -91,10 +91,10 @@ vector CSCCathodeLCTAnalyzer::lctDigis(const CSCCLCTDigi& c // @ Switch to maps eventually vector digiMap; int digi_num = 0; - for (int i_hstrip = 0; i_hstrip < CSCConstants::NUM_HALF_STRIPS; i_hstrip++) { + for (int i_hstrip = 0; i_hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN1_TRIGGER; i_hstrip++) { hfstripDigis[i_hstrip] = -999; } - for (int i_strip = 0; i_strip < CSCConstants::MAX_NUM_STRIPS; i_strip++) { + for (int i_strip = 0; i_strip < CSCConstants::MAX_NUM_STRIPS_RUN1; i_strip++) { time[i_strip] = -999; comp[i_strip] = 0; digiNum[i_strip] = -999; @@ -125,7 +125,7 @@ vector CSCCathodeLCTAnalyzer::lctDigis(const CSCCLCTDigi& c for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { for (int i_strip = 0; i_strip < CSCConstants::CLCT_PATTERN_WIDTH; i_strip++) { strip = clct_keystrip + key_stagger + CSCPatternBank::clct_pattern_offset_[i_strip]; - if (strip >= 0 && strip < CSCConstants::NUM_HALF_STRIPS) { + if (strip >= 0 && strip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN1_TRIGGER) { digiId = hfstripDigis[strip]; // halfstripDigis contains the digi numbers // that were carried through the different transformations @@ -153,10 +153,10 @@ int CSCCathodeLCTAnalyzer::preselectDigis(const int clct_bx, const CSCDetId& layerId, const CSCComparatorDigiCollection* compdc, vector& digiMap, - int hfstripDigis[CSCConstants::NUM_HALF_STRIPS], - int time[CSCConstants::MAX_NUM_STRIPS], - int comp[CSCConstants::MAX_NUM_STRIPS], - int digiNum[CSCConstants::MAX_NUM_STRIPS]) { + int hfstripDigis[CSCConstants::MAX_NUM_HALF_STRIPS_RUN1_TRIGGER], + int time[CSCConstants::MAX_NUM_STRIPS_RUN1], + int comp[CSCConstants::MAX_NUM_STRIPS_RUN1], + int digiNum[CSCConstants::MAX_NUM_STRIPS_RUN1]) { // Preselection of Digis: right layer and bx. int digi_num = 0; @@ -366,9 +366,9 @@ int CSCCathodeLCTAnalyzer::nearestHS(const vector& allLayer // Should be in the interval [0-MAX_STRIPS). I see (rarely) cases when // strip = nearestStrip = MAX_STRIPS; do not know how to handle them. int nearestStrip = static_cast(strip); - if (nearestStrip < 0 || nearestStrip >= CSCConstants::MAX_NUM_STRIPS) { + if (nearestStrip < 0 || nearestStrip >= CSCConstants::MAX_NUM_STRIPS_RUN1) { edm::LogWarning("L1CSCTPEmulatorWrongInput") - << "+++ Warning: nearest strip, " << nearestStrip << ", is not in [0-" << CSCConstants::MAX_NUM_STRIPS + << "+++ Warning: nearest strip, " << nearestStrip << ", is not in [0-" << CSCConstants::MAX_NUM_STRIPS_RUN1 << ") interval; strip = " << strip << " +++\n"; } // Left/right half of the strip. @@ -400,9 +400,9 @@ void CSCCathodeLCTAnalyzer::setGeometry(const CSCGeometry* geom) { geom_ = geom; double CSCCathodeLCTAnalyzer::getStripPhi(const CSCDetId& layerId, const float strip) { // Returns phi position of a given strip. - if (strip < 0. || strip >= CSCConstants::MAX_NUM_STRIPS) { - edm::LogWarning("L1CSCTPEmulatorWrongInput") - << "+++ Warning: strip, " << strip << ", is not in [0-" << CSCConstants::MAX_NUM_STRIPS << ") interval +++\n"; + if (strip < 0. || strip >= CSCConstants::MAX_NUM_STRIPS_RUN1) { + edm::LogWarning("L1CSCTPEmulatorWrongInput") << "+++ Warning: strip, " << strip << ", is not in [0-" + << CSCConstants::MAX_NUM_STRIPS_RUN1 << ") interval +++\n"; } const CSCLayer* csclayer = geom_->layer(layerId); diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.h b/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.h index 1ef7b0c42ae48..f92f5d1f95642 100644 --- a/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.h +++ b/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.h @@ -16,6 +16,7 @@ #include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCLayerInfo.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h" @@ -66,10 +67,10 @@ class CSCCathodeLCTAnalyzer { const CSCDetId& layerId, const CSCComparatorDigiCollection* compdc, std::vector& digiMap, - int hfstripDigis[CSCConstants::NUM_HALF_STRIPS], - int time[CSCConstants::MAX_NUM_STRIPS], - int comp[CSCConstants::MAX_NUM_STRIPS], - int digiNum[CSCConstants::MAX_NUM_STRIPS]); + int hfstripDigis[CSCConstants::MAX_NUM_HALF_STRIPS_RUN1_TRIGGER], + int time[CSCConstants::MAX_NUM_STRIPS_RUN1], + int comp[CSCConstants::MAX_NUM_STRIPS_RUN1], + int digiNum[CSCConstants::MAX_NUM_STRIPS_RUN1]); /* Find SimHits closest to each ComparatorDigi on CLCT. */ void digiSimHitAssociator(CSCCathodeLayerInfo& info, const edm::PSimHitContainer* allSimHits); diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesReader.h b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesReader.h index 92ce0e485a8e7..6f64274632b87 100644 --- a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesReader.h +++ b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesReader.h @@ -20,7 +20,7 @@ #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Utilities/interface/ESGetToken.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.h" diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc index 73e46756421b9..0382ae2ca5d20 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc @@ -107,7 +107,7 @@ CSCAnodeLCTProcessor::CSCAnodeLCTProcessor() : CSCBaseboard() { config_dumped = true; } - numWireGroups = CSCConstants::MAX_NUM_WIRES; + numWireGroups = CSCConstants::MAX_NUM_WIREGROUPS; MESelection = (theStation < 3) ? 0 : 1; // Load pattern mask. @@ -225,14 +225,14 @@ std::vector CSCAnodeLCTProcessor::run(const CSCWireDigiCollection* // Get the number of wire groups for the given chamber. Do it only once // per chamber. - if (numWireGroups <= 0 or numWireGroups > CSCConstants::MAX_NUM_WIRES) { + if (numWireGroups <= 0 or numWireGroups > CSCConstants::MAX_NUM_WIREGROUPS) { if (cscChamber_) { numWireGroups = cscChamber_->layer(1)->geometry()->numberOfWireGroups(); - if (numWireGroups > CSCConstants::MAX_NUM_WIRES) { + if (numWireGroups > CSCConstants::MAX_NUM_WIREGROUPS) { edm::LogError("CSCAnodeLCTProcessor|SetupError") << "+++ Number of wire groups, " << numWireGroups << " found in " << theCSCName_ << " (sector " << theSector << " subsector " << theSubsector << " trig id. " << theTrigChamber << ")" - << " exceeds max expected, " << CSCConstants::MAX_NUM_WIRES << " +++\n" + << " exceeds max expected, " << CSCConstants::MAX_NUM_WIREGROUPS << " +++\n" << "+++ CSC geometry looks garbled; no emulation possible +++\n"; numWireGroups = -1; } @@ -260,7 +260,7 @@ std::vector CSCAnodeLCTProcessor::run(const CSCWireDigiCollection* if (hasDigis) { // First get wiregroup times from the wire digis. - std::vector wireGroupTimes[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]; + std::vector wireGroupTimes[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]; readWireDigis(wireGroupTimes); // Pass an array of wire times on to another run() doing the LCT search. @@ -290,7 +290,7 @@ std::vector CSCAnodeLCTProcessor::run(const CSCWireDigiCollection* return getALCTs(); } -void CSCAnodeLCTProcessor::run(const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) { +void CSCAnodeLCTProcessor::run(const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) { bool trigger = false; // Check if there are any in-time hits and do the pulse extension. @@ -418,7 +418,8 @@ void CSCAnodeLCTProcessor::getDigis(const CSCWireDigiCollection* wiredc, const C } } -void CSCAnodeLCTProcessor::readWireDigis(std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) { +void CSCAnodeLCTProcessor::readWireDigis( + std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) { // Loop over all 6 layers. for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { // Loop over all digis in the layer and find the wireGroup and bx @@ -475,7 +476,7 @@ void CSCAnodeLCTProcessor::readWireDigis(std::vector wire[CSCConstants::NUM } bool CSCAnodeLCTProcessor::pulseExtension( - const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) { + const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) { bool chamber_empty = true; int i_wire, i_layer, digi_num; const unsigned int bits_in_pulse = 8 * sizeof(pulse[0][0]); @@ -751,7 +752,7 @@ bool CSCAnodeLCTProcessor::patternDetection( } void CSCAnodeLCTProcessor::ghostCancellationLogic() { - int ghost_cleared[CSCConstants::MAX_NUM_WIRES][2]; + int ghost_cleared[CSCConstants::MAX_NUM_WIREGROUPS][2]; for (int key_wire = 0; key_wire < numWireGroups; key_wire++) { for (int i_pattern = 0; i_pattern < 2; i_pattern++) { @@ -1214,7 +1215,7 @@ void CSCAnodeLCTProcessor::dumpConfigParams() const { // Dump of digis on wire groups. void CSCAnodeLCTProcessor::dumpDigis( - const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) const { + const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) const { LogDebug("CSCAnodeLCTProcessor") << theCSCName_ << " nWiregroups " << numWireGroups; std::ostringstream strstrm; @@ -1399,7 +1400,7 @@ void CSCAnodeLCTProcessor::setWireContainer(CSCALCTDigi& alct, CSCALCTDigi::Wire } void CSCAnodeLCTProcessor::encodeHighMultiplicityBits( - const std::vector wires[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) { + const std::vector wires[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) { inTimeHMT_ = 0; outTimeHMT_ = 0; @@ -1411,7 +1412,7 @@ void CSCAnodeLCTProcessor::encodeHighMultiplicityBits( unsigned hitsInTime = 0; unsigned hitsOutTime = 0; for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { - for (int i_wire = 0; i_wire < CSCConstants::MAX_NUM_WIRES; i_wire++) { + for (int i_wire = 0; i_wire < CSCConstants::MAX_NUM_WIREGROUPS; i_wire++) { auto times = wires[i_layer][i_wire]; hitsInTime += std::count_if(times.begin(), times.end(), inTime); hitsOutTime += std::count_if(times.begin(), times.end(), outTime); diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc index 55f48941735ee..aff7b30c657d7 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc @@ -130,7 +130,7 @@ CSCCathodeLCTProcessor::CSCCathodeLCTProcessor() : CSCBaseboard() { config_dumped = true; } - numStrips_ = CSCConstants::MAX_NUM_STRIPS; + numStrips_ = CSCConstants::MAX_NUM_STRIPS_RUN1; // Should be OK for all stations except ME1. for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { if ((i_layer + 1) % 2 == 0) @@ -187,7 +187,7 @@ void CSCCathodeLCTProcessor::checkConfigParameters() { static const unsigned int max_nplanes_hit_pretrig = 1 << 3; static const unsigned int max_nplanes_hit_pattern = 1 << 3; static const unsigned int max_pid_thresh_pretrig = 1 << 4; - static const unsigned int max_min_separation = CSCConstants::NUM_HALF_STRIPS_7CFEBS; + static const unsigned int max_min_separation = CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER; static const unsigned int max_tmb_l1a_window_size = 1 << 4; // Checks. @@ -230,7 +230,7 @@ std::vector CSCCathodeLCTProcessor::run(const CSCComparatorDigiColl // Get the number of strips and stagger of layers for the given chamber. // Do it only once per chamber. - if (numStrips_ <= 0 or numStrips_ > CSCConstants::MAX_NUM_STRIPS_7CFEBS) { + if (numStrips_ <= 0 or numStrips_ > CSCConstants::MAX_NUM_STRIPS_RUN2) { if (cscChamber_) { numStrips_ = cscChamber_->layer(1)->geometry()->numberOfStrips(); @@ -248,21 +248,21 @@ std::vector CSCCathodeLCTProcessor::run(const CSCComparatorDigiColl << "+++ CSC geometry looks garbled; no emulation possible +++\n"; } if (!disableME1a_ && theRing == 1 && !gangedME1a_) - numStrips_ = CSCConstants::MAX_NUM_STRIPS_7CFEBS; + numStrips_ = CSCConstants::MAX_NUM_STRIPS_RUN2; if (!disableME1a_ && theRing == 1 && gangedME1a_) - numStrips_ = CSCConstants::MAX_NUM_STRIPS; + numStrips_ = CSCConstants::MAX_NUM_STRIPS_RUN1; if (disableME1a_ && theRing == 1) - numStrips_ = CSCConstants::MAX_NUM_STRIPS_ME1B; + numStrips_ = CSCConstants::NUM_STRIPS_ME1B; } numHalfStrips_ = 2 * numStrips_ + 1; numCFEBs_ = numStrips_ / CSCConstants::NUM_STRIPS_PER_CFEB; - if (numStrips_ > CSCConstants::MAX_NUM_STRIPS_7CFEBS) { + if (numStrips_ > CSCConstants::MAX_NUM_STRIPS_RUN2) { edm::LogError("CSCCathodeLCTProcessor|SetupError") << "+++ Number of strips, " << numStrips_ << " found in " << theCSCName_ << " (sector " << theSector << " subsector " << theSubsector << " trig id. " << theTrigChamber << ")" - << " exceeds max expected, " << CSCConstants::MAX_NUM_STRIPS_7CFEBS << " +++\n" + << " exceeds max expected, " << CSCConstants::MAX_NUM_STRIPS_RUN2 << " +++\n" << "+++ CSC geometry looks garbled; no emulation possible +++\n"; numStrips_ = -1; numHalfStrips_ = -1; @@ -310,7 +310,7 @@ std::vector CSCCathodeLCTProcessor::run(const CSCComparatorDigiColl if (hasDigis) { // Get halfstrip times from comparator digis. - std::vector halfStripTimes[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + std::vector halfStripTimes[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; readComparatorDigis(halfStripTimes); // Pass arrays of halfstrips on to another run() doing the @@ -321,7 +321,7 @@ std::vector CSCCathodeLCTProcessor::run(const CSCComparatorDigiColl // to the number of planes required to pre-trigger.) unsigned int layersHit = 0; for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { - for (int i_hstrip = 0; i_hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS; i_hstrip++) { + for (int i_hstrip = 0; i_hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER; i_hstrip++) { if (!halfStripTimes[i_layer][i_hstrip].empty()) { layersHit++; break; @@ -356,7 +356,7 @@ std::vector CSCCathodeLCTProcessor::run(const CSCComparatorDigiColl } void CSCCathodeLCTProcessor::run( - const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]) { + const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) { // This version of the run() function can either be called in a standalone // test, being passed the halfstrip times, or called by the // run() function above. It uses the findLCTs() method to find vectors @@ -449,14 +449,14 @@ void CSCCathodeLCTProcessor::getDigis(const CSCComparatorDigiCollection* compdc, for (CSCComparatorDigiCollection::const_iterator digiIt = rcompd.first; digiIt != rcompd.second; ++digiIt) { const unsigned int origStrip = digiIt->getStrip(); const unsigned int maxStripsME1a = - gangedME1a_ ? CSCConstants::MAX_NUM_STRIPS_ME1A_GANGED : CSCConstants::MAX_NUM_STRIPS_ME1A_UNGANGED; + gangedME1a_ ? CSCConstants::NUM_STRIPS_ME1A_GANGED : CSCConstants::NUM_STRIPS_ME1A_UNGANGED; // this special case can only be reached in MC // in real data, the comparator digis have always ring==1 if (me1a && origStrip <= maxStripsME1a && !disableME1a_) { // Move ME1/A comparators from CFEB=0 to CFEB=4 if this has not // been done already. CSCComparatorDigi digi_corr( - origStrip + CSCConstants::MAX_NUM_STRIPS_ME1B, digiIt->getComparator(), digiIt->getTimeBinWord()); + origStrip + CSCConstants::NUM_STRIPS_ME1B, digiIt->getComparator(), digiIt->getTimeBinWord()); digiV[id.layer() - 1].push_back(digi_corr); } else { digiV[id.layer() - 1].push_back(*digiIt); @@ -465,7 +465,7 @@ void CSCCathodeLCTProcessor::getDigis(const CSCComparatorDigiCollection* compdc, } void CSCCathodeLCTProcessor::readComparatorDigis( - std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]) { + std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) { for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { int i_digi = 0; // digi counter, for dumps. for (std::vector::iterator pld = digiV[i_layer].begin(); pld != digiV[i_layer].end(); @@ -557,7 +557,7 @@ void CSCCathodeLCTProcessor::readComparatorDigis( // TMB-07 version. std::vector CSCCathodeLCTProcessor::findLCTs( - const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]) { + const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) { std::vector lctList; if (infoV > 1) @@ -623,7 +623,7 @@ std::vector CSCCathodeLCTProcessor::findLCTs( // could occur already at the next bx. // Quality for sorting. - int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + int quality[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; int best_halfstrip[CSCConstants::MAX_CLCTS_PER_PROCESSOR]; int best_quality[CSCConstants::MAX_CLCTS_PER_PROCESSOR]; @@ -777,7 +777,8 @@ std::vector CSCCathodeLCTProcessor::findLCTs( // Common to all versions. void CSCCathodeLCTProcessor::pulseExtension( - const std::vector time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], PulseArray pulse) { + const std::vector time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER], + PulseArray pulse) { static const unsigned int bits_in_pulse = 8 * sizeof(pulse[0][0]); // Clear pulse array. This array will be used as a bit representation of @@ -1027,12 +1028,12 @@ bool CSCCathodeLCTProcessor::patternFinding( // TMB-07 version. void CSCCathodeLCTProcessor::markBusyKeys(const int best_hstrip, const int best_patid, - int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS]) { + int quality[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) { int nspan = min_separation; int pspan = min_separation; for (int hstrip = best_hstrip - nspan; hstrip <= best_hstrip + pspan; hstrip++) { - if (hstrip >= 0 && hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS) { + if (hstrip >= 0 && hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER) { quality[hstrip] = 0; } } @@ -1072,7 +1073,7 @@ void CSCCathodeLCTProcessor::dumpConfigParams() const { // Reasonably nice dump of digis on half-strips. void CSCCathodeLCTProcessor::dumpDigis( - const std::vector strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]) const { + const std::vector strip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) const { LogDebug("CSCCathodeLCTProcessor") << theCSCName_ << " strip type: half-strip, numHalfStrips " << numHalfStrips_; std::ostringstream strstrm; @@ -1472,7 +1473,7 @@ unsigned CSCCathodeLCTProcessor::convertSlopeToRun2Pattern(const unsigned slope) } void CSCCathodeLCTProcessor::encodeHighMultiplicityBits( - const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]) { + const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) { inTimeHMT_ = 0; outTimeHMT_ = 0; @@ -1484,7 +1485,7 @@ void CSCCathodeLCTProcessor::encodeHighMultiplicityBits( unsigned hitsInTime = 0; unsigned hitsOutTime = 0; for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { - for (int i_hstrip = 0; i_hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS; i_hstrip++) { + for (int i_hstrip = 0; i_hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER; i_hstrip++) { auto times = halfstrip[i_layer][i_hstrip]; hitsInTime += std::count_if(times.begin(), times.end(), inTime); hitsOutTime += std::count_if(times.begin(), times.end(), outTime); diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMuonPortCard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCMuonPortCard.cc index bc329f0a5fa15..94ddf47314a3a 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMuonPortCard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMuonPortCard.cc @@ -1,5 +1,5 @@ #include "L1Trigger/CSCTriggerPrimitives/interface/CSCMuonPortCard.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include CSCMuonPortCard::CSCMuonPortCard() {} diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeAnodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeAnodeLCTProcessor.cc index 29c5c5dc07106..b7f93d4ade2cb 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeAnodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeAnodeLCTProcessor.cc @@ -27,7 +27,7 @@ CSCUpgradeAnodeLCTProcessor::CSCUpgradeAnodeLCTProcessor() : CSCAnodeLCTProcesso } void CSCUpgradeAnodeLCTProcessor::ghostCancellationLogic() { - int ghost_cleared[CSCConstants::MAX_NUM_WIRES][2]; + int ghost_cleared[CSCConstants::MAX_NUM_WIREGROUPS][2]; for (int key_wire = 0; key_wire < numWireGroups; key_wire++) { for (int i_pattern = 0; i_pattern < 2; i_pattern++) { diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeCathodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeCathodeLCTProcessor.cc index c8eb90711f0ab..88c8f9e81775b 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeCathodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeCathodeLCTProcessor.cc @@ -135,7 +135,7 @@ bool CSCUpgradeCathodeLCTProcessor::preTrigger(const PulseArray pulse, const int // Phase2 version. std::vector CSCUpgradeCathodeLCTProcessor::findLCTs( - const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]) { + const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) { // run the original algorithm in case we do not use dead time zoning if (runPhase2_ and !use_dead_time_zoning) { return CSCCathodeLCTProcessor::findLCTs(halfstrip); @@ -152,7 +152,7 @@ std::vector CSCUpgradeCathodeLCTProcessor::findLCTs( dumpDigis(halfstrip); // keeps dead-time zones around key halfstrips of triggered CLCTs - for (int i = 0; i < CSCConstants::NUM_HALF_STRIPS_7CFEBS; i++) { + for (int i = 0; i < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER; i++) { for (int j = 0; j < CSCConstants::MAX_CLCT_TBINS; j++) { busyMap[i][j] = false; } @@ -160,7 +160,7 @@ std::vector CSCUpgradeCathodeLCTProcessor::findLCTs( std::vector lctListBX; - unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; // Fire half-strip one-shots for hit_persist bx's (4 bx's by default). pulseExtension(halfstrip, pulse); @@ -210,30 +210,30 @@ std::vector CSCUpgradeCathodeLCTProcessor::findLCTs( int keystrip_data[CSCConstants::MAX_CLCTS_PER_PROCESSOR][CLCT_NUM_QUANTITIES] = {{0}}; // Quality for sorting. - int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + int quality[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; int best_halfstrip[CSCConstants::MAX_CLCTS_PER_PROCESSOR], best_quality[CSCConstants::MAX_CLCTS_PER_PROCESSOR]; for (int ilct = 0; ilct < CSCConstants::MAX_CLCTS_PER_PROCESSOR; ilct++) { best_halfstrip[ilct] = -1; best_quality[ilct] = 0; } - bool pretrig_zone[CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + bool pretrig_zone[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]; // Calculate quality from pattern id and number of hits, and // simultaneously select best-quality LCT. if (hits_in_time) { // first, mark half-strip zones around pretriggers // that happened at the current first_bx - for (int hstrip = 0; hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS; hstrip++) + for (int hstrip = 0; hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER; hstrip++) pretrig_zone[hstrip] = false; - for (int hstrip = 0; hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS; hstrip++) { + for (int hstrip = 0; hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER; hstrip++) { if (ispretrig[hstrip]) { int min_hs = hstrip - pretrig_trig_zone; int max_hs = hstrip + pretrig_trig_zone; if (min_hs < 0) min_hs = 0; - if (max_hs > CSCConstants::NUM_HALF_STRIPS_7CFEBS - 1) - max_hs = CSCConstants::NUM_HALF_STRIPS_7CFEBS - 1; + if (max_hs > CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER - 1) + max_hs = CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER - 1; for (int hs = min_hs; hs <= max_hs; hs++) pretrig_zone[hs] = true; if (infoV > 1) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboardLUT.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboardLUT.cc index 4dfecf7c0b57c..70c137c7defbb 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboardLUT.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboardLUT.cc @@ -1,4 +1,5 @@ #include "L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" CSCMotherboardLUTME11::CSCMotherboardLUTME11() { // Keep in mind that ME1A is considered an extension of ME1B diff --git a/L1Trigger/CSCTriggerPrimitives/src/LCTQualityControl.cc b/L1Trigger/CSCTriggerPrimitives/src/LCTQualityControl.cc index ddaca87d1a9c8..a11025d0dfe13 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/LCTQualityControl.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/LCTQualityControl.cc @@ -313,7 +313,7 @@ unsigned LCTQualityControl::get_csc_max_eighthstrip(int station, int ring) const std::pair LCTQualityControl::get_csc_min_max_cfeb(int station, int ring) const { // 5 CFEBs [0,4] for non-ME1/1 chambers int min_cfeb = 0; - int max_cfeb = CSCConstants::MAX_CFEBS - 1; // 4 + int max_cfeb = CSCConstants::MAX_CFEBS_RUN1 - 1; // 4 // 7 CFEBs [0,6] for ME1/1 chambers if (station == 1 and ring == 1) { max_cfeb = 6; diff --git a/L1Trigger/L1TMuon/src/GeometryTranslator.cc b/L1Trigger/L1TMuon/src/GeometryTranslator.cc index a2d21348b9cb7..b29597cb23270 100644 --- a/L1Trigger/L1TMuon/src/GeometryTranslator.cc +++ b/L1Trigger/L1TMuon/src/GeometryTranslator.cc @@ -12,7 +12,7 @@ #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" #include "L1Trigger/DTUtilities/interface/DTTrigGeom.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h" #include "L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h" diff --git a/L1Trigger/L1TMuonEndCap/test/tools/MakeAngleLUT.cc b/L1Trigger/L1TMuonEndCap/test/tools/MakeAngleLUT.cc index 0a30c75123de5..fd44216bf2b05 100644 --- a/L1Trigger/L1TMuonEndCap/test/tools/MakeAngleLUT.cc +++ b/L1Trigger/L1TMuonEndCap/test/tools/MakeAngleLUT.cc @@ -29,7 +29,7 @@ #include "DataFormats/GeometryVector/interface/GlobalPoint.h" //#include "DataFormats/MuonDetId/interface/CSCTriggerNumbering.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "L1Trigger/L1TMuon/interface/GeometryTranslator.h" #include "L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h" diff --git a/L1Trigger/L1TMuonEndCap/test/tools/MakeCoordLUT.cc b/L1Trigger/L1TMuonEndCap/test/tools/MakeCoordLUT.cc index 0a5de70d30ecb..e11a7f5ae4e8d 100644 --- a/L1Trigger/L1TMuonEndCap/test/tools/MakeCoordLUT.cc +++ b/L1Trigger/L1TMuonEndCap/test/tools/MakeCoordLUT.cc @@ -19,7 +19,7 @@ #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "DataFormats/MuonDetId/interface/CSCTriggerNumbering.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "Geometry/CSCGeometry/interface/CSCGeometry.h" #include "Geometry/CSCGeometry/interface/CSCChamber.h" diff --git a/L1Trigger/L1TMuonOverlap/src/AngleConverter.cc b/L1Trigger/L1TMuonOverlap/src/AngleConverter.cc index 3bded865e4b43..50fda8c43715f 100644 --- a/L1Trigger/L1TMuonOverlap/src/AngleConverter.cc +++ b/L1Trigger/L1TMuonOverlap/src/AngleConverter.cc @@ -5,11 +5,11 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Utilities/interface/Transition.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h" #include "L1Trigger/DTUtilities/interface/DTTrigGeom.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h" #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhDigi.h" #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h" diff --git a/L1Trigger/L1TMuonOverlap/src/OMTFinputMaker.cc b/L1Trigger/L1TMuonOverlap/src/OMTFinputMaker.cc index 6a89510248d50..5f9e25ca6b041 100644 --- a/L1Trigger/L1TMuonOverlap/src/OMTFinputMaker.cc +++ b/L1Trigger/L1TMuonOverlap/src/OMTFinputMaker.cc @@ -12,7 +12,7 @@ #include "L1Trigger/L1TMuonOverlap/interface/OMTFinput.h" #include "L1Trigger/L1TMuonOverlap/interface/OMTFConfiguration.h" #include "L1Trigger/L1TMuonOverlap/interface/AngleConverter.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" /////////////////////////////////////// diff --git a/Validation/MuonCSCDigis/src/CSCStubMatcher.cc b/Validation/MuonCSCDigis/src/CSCStubMatcher.cc index c50d1b773b6d5..046fe1757b1b4 100644 --- a/Validation/MuonCSCDigis/src/CSCStubMatcher.cc +++ b/Validation/MuonCSCDigis/src/CSCStubMatcher.cc @@ -1,5 +1,5 @@ #include "Validation/MuonCSCDigis/interface/CSCStubMatcher.h" -#include "DataFormats/L1TMuon/interface/CSCConstants.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" #include using namespace std; @@ -95,7 +95,7 @@ void CSCStubMatcher::matchCLCTsToSimTrack(const CSCCLCTDigiCollection& clcts) { // get the comparator digis in this chamber std::vector comps; - for (int ilayer = 1; ilayer <= 6; ilayer++) { + for (int ilayer = CSCDetId::minLayerId(); ilayer <= CSCDetId::maxLayerId(); ilayer++) { CSCDetId layerid(ch_id.endcap(), ch_id.station(), ring, ch_id.chamber(), ilayer); comps.push_back(cscDigiMatcher_->comparatorDigisInDetId(layerid)); } @@ -640,7 +640,7 @@ GlobalPoint CSCStubMatcher::getGlobalPosition(unsigned int rawId, const CSCCorre float fractional_strip = lct.getFractionalStrip(); // case ME1/a if (cscId.station() == 1 and cscId.ring() == 4 and lct.getStrip() > CSCConstants::MAX_HALF_STRIP_ME1B) { - fractional_strip -= CSCConstants::MAX_NUM_STRIPS_ME1B; + fractional_strip -= CSCConstants::NUM_STRIPS_ME1B; } // regular cases const auto& chamber = cscGeometry_->chamber(cscId);