From 994ab56474f563e9a21e30affa79468c21e2662b Mon Sep 17 00:00:00 2001 From: Ian Tomalin Date: Thu, 10 Feb 2022 22:42:53 +0000 Subject: [PATCH] Update LayerEncoding.h (#131) * Update LayerEncoding.h Add function to access layer corresponding to given DTC channel. (Needed by L1Trk Future CMSSW code). * Update LayerEncoding.h response to comment + fix to previous commit * Update LayerEncoding.cc Initialize data member numDTCsPerRegion_ * Update LayerEncoding.h added comment * Update LayerEncoding.h clarified comment --- L1Trigger/TrackerDTC/interface/LayerEncoding.h | 6 +++++- L1Trigger/TrackerDTC/src/LayerEncoding.cc | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/L1Trigger/TrackerDTC/interface/LayerEncoding.h b/L1Trigger/TrackerDTC/interface/LayerEncoding.h index f5cd9d195c070..e2413d5ea06a0 100644 --- a/L1Trigger/TrackerDTC/interface/LayerEncoding.h +++ b/L1Trigger/TrackerDTC/interface/LayerEncoding.h @@ -23,10 +23,14 @@ namespace trackerDTC { ~LayerEncoding() {} // decode layer id for given sensor module int decode(tt::SensorModule* sm) const; + // get encoded layers read by given DTC + const std::vector& layers(int dtcId) const {return encodingsLayerId_.at(dtcId%numDTCsPerRegion_);} private: // helper class to store configurations const tt::Setup* setup_; + // No. of DTCs per detector phi nonant + int numDTCsPerRegion_; // outer index = dtc id in region, inner index = encoded layerId, inner value = decoded layerId std::vector> encodingsLayerId_; }; @@ -35,4 +39,4 @@ namespace trackerDTC { EVENTSETUP_DATA_DEFAULT_RECORD(trackerDTC::LayerEncoding, trackerDTC::LayerEncodingRcd); -#endif \ No newline at end of file +#endif diff --git a/L1Trigger/TrackerDTC/src/LayerEncoding.cc b/L1Trigger/TrackerDTC/src/LayerEncoding.cc index 718732ce48e1b..6692e4a303633 100644 --- a/L1Trigger/TrackerDTC/src/LayerEncoding.cc +++ b/L1Trigger/TrackerDTC/src/LayerEncoding.cc @@ -13,8 +13,8 @@ using namespace tt; namespace trackerDTC { - LayerEncoding::LayerEncoding(const ParameterSet& iConfig, const Setup* setup) : setup_(setup) { - encodingsLayerId_.reserve(setup->numDTCsPerRegion()); + LayerEncoding::LayerEncoding(const ParameterSet& iConfig, const Setup* setup) : setup_(setup), numDTCsPerRegion_(setup->numDTCsPerRegion()) { + encodingsLayerId_.reserve(numDTCsPerRegion_); for (int dtcInRegion = 0; dtcInRegion < setup->numDTCsPerRegion(); dtcInRegion++) { set encodingLayerId; for (int region = 0; region < setup->numRegions(); region++) { @@ -41,4 +41,4 @@ namespace trackerDTC { return distance(encoding.begin(), pos); } -} // namespace trackerDTC \ No newline at end of file +} // namespace trackerDTC