Skip to content

Commit

Permalink
Update LayerEncoding.h (cms-sw#131)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
tomalin committed May 31, 2022
1 parent 351133e commit 994ab56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion L1Trigger/TrackerDTC/interface/LayerEncoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>& 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<std::vector<int>> encodingsLayerId_;
};
Expand All @@ -35,4 +39,4 @@ namespace trackerDTC {

EVENTSETUP_DATA_DEFAULT_RECORD(trackerDTC::LayerEncoding, trackerDTC::LayerEncodingRcd);

#endif
#endif
6 changes: 3 additions & 3 deletions L1Trigger/TrackerDTC/src/LayerEncoding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> encodingLayerId;
for (int region = 0; region < setup->numRegions(); region++) {
Expand All @@ -41,4 +41,4 @@ namespace trackerDTC {
return distance(encoding.begin(), pos);
}

} // namespace trackerDTC
} // namespace trackerDTC

0 comments on commit 994ab56

Please sign in to comment.