CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
trackerDTC::LayerEncoding Class Reference

Class to encode layer ids used between DTC and TFP in Hybrid. More...

#include <LayerEncoding.h>

Public Member Functions

int decode (tt::SensorModule *sm) const
 
 LayerEncoding ()
 
 LayerEncoding (const edm::ParameterSet &iConfig, const tt::Setup *setup)
 
const std::vector< int > & layers (int dtcId) const
 
 ~LayerEncoding ()
 

Private Attributes

std::vector< std::vector< int > > encodingsLayerId_
 
int numDTCsPerRegion_
 
const tt::Setupsetup_
 

Detailed Description

Class to encode layer ids used between DTC and TFP in Hybrid.

Author
Thomas Schuh
Date
2021, April

Definition at line 19 of file LayerEncoding.h.

Constructor & Destructor Documentation

◆ LayerEncoding() [1/2]

trackerDTC::LayerEncoding::LayerEncoding ( )
inline

Definition at line 21 of file LayerEncoding.h.

21 {}

◆ LayerEncoding() [2/2]

trackerDTC::LayerEncoding::LayerEncoding ( const edm::ParameterSet iConfig,
const tt::Setup setup 
)

Definition at line 16 of file LayerEncoding.cc.

References encodingsLayerId_, cppFunctionSkipper::exception, numDTCsPerRegion_, HLT_2022v15_cff::region, and singleTopDQM_cfi::setup.

17  : setup_(setup), numDTCsPerRegion_(setup->numDTCsPerRegion()) {
19  for (int dtcInRegion = 0; dtcInRegion < setup->numDTCsPerRegion(); dtcInRegion++) {
20  set<int> encodingLayerId;
21  for (int region = 0; region < setup->numRegions(); region++) {
22  const int dtcId = dtcInRegion + region * setup->numDTCsPerRegion();
23  const vector<SensorModule*>& modules = setup->dtcModules(dtcId);
24  for (SensorModule* sm : modules)
25  encodingLayerId.insert(sm->layerId());
26  }
27  // check configuration
28  if ((int)encodingLayerId.size() > setup->hybridNumLayers()) {
29  cms::Exception exception("overflow");
30  exception << "Cabling map connects more than " << setup->hybridNumLayers() << " layers to a DTC.";
31  exception.addContext("trackerDTC::LayerEncoding::LayerEncoding");
32  throw exception;
33  }
34  encodingsLayerId_.emplace_back(encodingLayerId.begin(), encodingLayerId.end());
35  }
36  }
std::vector< std::vector< int > > encodingsLayerId_
Definition: LayerEncoding.h:35
const tt::Setup * setup_
Definition: LayerEncoding.h:31

◆ ~LayerEncoding()

trackerDTC::LayerEncoding::~LayerEncoding ( )
inline

Definition at line 23 of file LayerEncoding.h.

23 {}

Member Function Documentation

◆ decode()

int trackerDTC::LayerEncoding::decode ( tt::SensorModule sm) const

Definition at line 39 of file LayerEncoding.cc.

References HLT_2022v15_cff::distance, tt::SensorModule::dtcId(), encodingsLayerId_, spr::find(), tt::SensorModule::layerId(), tt::Setup::numDTCsPerRegion(), and setup_.

Referenced by trackerDTC::Stub::formatHybrid().

39  {
40  const vector<int>& encoding = encodingsLayerId_.at(sm->dtcId() % setup_->numDTCsPerRegion());
41  const auto pos = find(encoding.begin(), encoding.end(), sm->layerId());
42  return distance(encoding.begin(), pos);
43  }
std::vector< std::vector< int > > encodingsLayerId_
Definition: LayerEncoding.h:35
int numDTCsPerRegion() const
Definition: Setup.h:351
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const tt::Setup * setup_
Definition: LayerEncoding.h:31
int dtcId() const
Definition: SensorModule.h:21
int layerId() const
Definition: SensorModule.h:43

◆ layers()

const std::vector<int>& trackerDTC::LayerEncoding::layers ( int  dtcId) const
inline

Definition at line 27 of file LayerEncoding.h.

References encodingsLayerId_, and numDTCsPerRegion_.

27 { return encodingsLayerId_.at(dtcId % numDTCsPerRegion_); }
std::vector< std::vector< int > > encodingsLayerId_
Definition: LayerEncoding.h:35

Member Data Documentation

◆ encodingsLayerId_

std::vector<std::vector<int> > trackerDTC::LayerEncoding::encodingsLayerId_
private

Definition at line 35 of file LayerEncoding.h.

Referenced by decode(), LayerEncoding(), and layers().

◆ numDTCsPerRegion_

int trackerDTC::LayerEncoding::numDTCsPerRegion_
private

Definition at line 33 of file LayerEncoding.h.

Referenced by LayerEncoding(), and layers().

◆ setup_

const tt::Setup* trackerDTC::LayerEncoding::setup_
private

Definition at line 31 of file LayerEncoding.h.

Referenced by decode(), and upgradeWorkflowComponents.UpgradeWorkflow::setup().