CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
TrackerDetToDTCELinkCablingMap Class Reference

#include <CondFormats/Phase2TrackerDTC/src/TrackerDetToDTCELinkCablingMap.cc>

Public Member Functions

void clear ()
 Clears the map. More...
 
std::pair< std::unordered_multimap< uint32_t, DTCELinkId >::const_iterator, std::unordered_multimap< uint32_t, DTCELinkId >::const_iterator > detIdToDTCELinkId (uint32_t const) const
 Resolves one or more DTCELinkId of eLinks which are connected to the detector identified by the given raw DetId. More...
 
std::unordered_map< DTCELinkId, uint32_t >::const_iterator dtcELinkIdToDetId (DTCELinkId const &) const
 Resolves the raw DetId of the detector connected to the eLink identified by a DTCELinkId. More...
 
std::vector< uint32_t > getKnownDetIds () const
 Returns a vector containing all detector DetId known to the map. More...
 
std::vector< DTCELinkIdgetKnownDTCELinkIds () const
 Returns a vector containing all elink DTCELinkId nown to the map. More...
 
void insert (DTCELinkId const &, uint32_t const)
 Inserts in the cabling map a record corresponding to the connection of an eLink identified by the given DTCELinkId to a detector identified by the given raw DetId. More...
 
bool knowsDetId (uint32_t) const
 Returns true if the cabling map has a record corresponding to an eLink identified by the given DTCELinkId. More...
 
bool knowsDTCELinkId (DTCELinkId const &) const
 Returns true if the cabling map has a record corresponding to a detector identified by the given raw DetId. More...
 
 TrackerDetToDTCELinkCablingMap ()
 
virtual ~TrackerDetToDTCELinkCablingMap ()
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

std::unordered_multimap< uint32_t, DTCELinkIdcablingMapDetIdToDTCELinkId_
 
std::unordered_map< DTCELinkId, uint32_t > cablingMapDTCELinkIdToDetId_
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Description: Map associating DTCELinkId of Phase2 tracker DTCs to DetId of the sensors connected to each of them.

Implementation: [Notes on implementation]

Definition at line 29 of file TrackerDetToDTCELinkCablingMap.h.

Constructor & Destructor Documentation

◆ TrackerDetToDTCELinkCablingMap()

TrackerDetToDTCELinkCablingMap::TrackerDetToDTCELinkCablingMap ( )

Definition at line 8 of file TrackerDetToDTCELinkCablingMap.cc.

8 {}

◆ ~TrackerDetToDTCELinkCablingMap()

TrackerDetToDTCELinkCablingMap::~TrackerDetToDTCELinkCablingMap ( )
virtual

Definition at line 10 of file TrackerDetToDTCELinkCablingMap.cc.

10 {}

Member Function Documentation

◆ clear()

void TrackerDetToDTCELinkCablingMap::clear ( void  )

Clears the map.

Definition at line 90 of file TrackerDetToDTCELinkCablingMap.cc.

References cablingMapDetIdToDTCELinkId_, and cablingMapDTCELinkIdToDetId_.

90  {
93 }
std::unordered_map< DTCELinkId, uint32_t > cablingMapDTCELinkIdToDetId_
std::unordered_multimap< uint32_t, DTCELinkId > cablingMapDetIdToDTCELinkId_

◆ detIdToDTCELinkId()

std::pair< std::unordered_multimap< uint32_t, DTCELinkId >::const_iterator, std::unordered_multimap< uint32_t, DTCELinkId >::const_iterator > TrackerDetToDTCELinkCablingMap::detIdToDTCELinkId ( uint32_t const  key) const

Resolves one or more DTCELinkId of eLinks which are connected to the detector identified by the given raw DetId.

Definition at line 27 of file TrackerDetToDTCELinkCablingMap.cc.

References cablingMapDetIdToDTCELinkId_, Exception, and submitPVResolutionJobs::key.

Referenced by tt::Setup::produceSensorModules().

27  {
28  auto const DTCELinkId_itpair = cablingMapDetIdToDTCELinkId_.equal_range(key);
29 
30  if (DTCELinkId_itpair.first == cablingMapDetIdToDTCELinkId_.end()) {
31  throw cms::Exception(
32  "TrackerDetToDTCELinkCablingMap has been asked to return a DTCELinkId associated to a DetId, but the latter is "
33  "unknown to the map. ")
34  << " DetId = " << key << std::endl;
35  }
36 
37  return DTCELinkId_itpair;
38 }
key
prepare the HTCondor submission files and eventually submit them
std::unordered_multimap< uint32_t, DTCELinkId > cablingMapDetIdToDTCELinkId_

◆ dtcELinkIdToDetId()

std::unordered_map< DTCELinkId, uint32_t >::const_iterator TrackerDetToDTCELinkCablingMap::dtcELinkIdToDetId ( DTCELinkId const &  key) const

Resolves the raw DetId of the detector connected to the eLink identified by a DTCELinkId.

Definition at line 12 of file TrackerDetToDTCELinkCablingMap.cc.

References cablingMapDTCELinkIdToDetId_, Exception, and submitPVResolutionJobs::key.

13  {
15  throw cms::Exception(
16  "TrackerDetToDTCELinkCablingMap has been asked to return a DetId associated to a DTCELinkId, but the latter is "
17  "unknown to the map. ")
18  << " (DTC, GBT, Elink) numbers = (" << key.dtc_id() << "," << key.gbtlink_id() << "," << key.elink_id() << ")"
19  << std::endl;
20  }
21 
22  return cablingMapDTCELinkIdToDetId_.find(key);
23 }
key
prepare the HTCondor submission files and eventually submit them
std::unordered_map< DTCELinkId, uint32_t > cablingMapDTCELinkIdToDetId_

◆ getKnownDetIds()

std::vector< uint32_t > TrackerDetToDTCELinkCablingMap::getKnownDetIds ( ) const

Returns a vector containing all detector DetId known to the map.

Definition at line 60 of file TrackerDetToDTCELinkCablingMap.cc.

References cablingMapDetIdToDTCELinkId_.

60  {
61  std::vector<uint32_t> knownDetId;
62 
63  // To get the list of unique DetIds we need to iterate over the various equal_ranges
64  // in the map associated to each unique key, and count them only once.
65 
66  for (auto allpairs_it = cablingMapDetIdToDTCELinkId_.begin(), allpairs_end = cablingMapDetIdToDTCELinkId_.end();
67  allpairs_it != allpairs_end;) {
68  // ***Store the first instance of the key***
69  knownDetId.push_back(uint32_t(allpairs_it->first));
70 
71  // *** Skip to the end of the equal range ***
72  // The following is just explicative, the bottom expression is equivalent
73  //auto const current_key = allpairs_it->first;
74  //auto const current_key_equal_range = cablingMapDetIdToDTCELinkId_.equal_range(current_key);
75  //auto const current_key_range_end = current_key_equal_range.second;
76  auto const current_key_range_end = cablingMapDetIdToDTCELinkId_.equal_range(allpairs_it->first).second;
77 
78  while (allpairs_it != current_key_range_end)
79  ++allpairs_it;
80  }
81 
82  return knownDetId;
83 }
std::unordered_multimap< uint32_t, DTCELinkId > cablingMapDetIdToDTCELinkId_

◆ getKnownDTCELinkIds()

std::vector< DTCELinkId > TrackerDetToDTCELinkCablingMap::getKnownDTCELinkIds ( ) const

Returns a vector containing all elink DTCELinkId nown to the map.

Definition at line 48 of file TrackerDetToDTCELinkCablingMap.cc.

References cablingMapDTCELinkIdToDetId_, and HcalDetIdTransform::transform().

48  {
49  std::vector<DTCELinkId> knownDTCELinkIds(cablingMapDTCELinkIdToDetId_.size());
50 
51  // Unzip the map into a vector of DTCELinkId, discarding the DetIds
54  knownDTCELinkIds.begin(),
55  [=](auto pair) { return pair.first; });
56 
57  return knownDTCELinkIds;
58 }
std::unordered_map< DTCELinkId, uint32_t > cablingMapDTCELinkIdToDetId_
unsigned transform(const HcalDetId &id, unsigned transformCode)

◆ insert()

void TrackerDetToDTCELinkCablingMap::insert ( DTCELinkId const &  dtcELinkId,
uint32_t const  detId 
)

Inserts in the cabling map a record corresponding to the connection of an eLink identified by the given DTCELinkId to a detector identified by the given raw DetId.

Definition at line 85 of file TrackerDetToDTCELinkCablingMap.cc.

References cablingMapDetIdToDTCELinkId_, cablingMapDTCELinkIdToDetId_, and hcalRecHitTable_cff::detId.

Referenced by SequenceTypes.Schedule::_replaceIfHeldDirectly().

85  {
86  cablingMapDTCELinkIdToDetId_.insert(std::make_pair(DTCELinkId(dtcELinkId), uint32_t(detId)));
87  cablingMapDetIdToDTCELinkId_.insert(std::make_pair(uint32_t(detId), DTCELinkId(dtcELinkId)));
88 }
std::unordered_map< DTCELinkId, uint32_t > cablingMapDTCELinkIdToDetId_
std::unordered_multimap< uint32_t, DTCELinkId > cablingMapDetIdToDTCELinkId_

◆ knowsDetId()

bool TrackerDetToDTCELinkCablingMap::knowsDetId ( uint32_t  key) const

Returns true if the cabling map has a record corresponding to an eLink identified by the given DTCELinkId.

Definition at line 44 of file TrackerDetToDTCELinkCablingMap.cc.

References cablingMapDetIdToDTCELinkId_, and submitPVResolutionJobs::key.

44  {
46 }
key
prepare the HTCondor submission files and eventually submit them
std::unordered_multimap< uint32_t, DTCELinkId > cablingMapDetIdToDTCELinkId_

◆ knowsDTCELinkId()

bool TrackerDetToDTCELinkCablingMap::knowsDTCELinkId ( DTCELinkId const &  key) const

Returns true if the cabling map has a record corresponding to a detector identified by the given raw DetId.

Definition at line 40 of file TrackerDetToDTCELinkCablingMap.cc.

References cablingMapDTCELinkIdToDetId_, and submitPVResolutionJobs::key.

40  {
42 }
key
prepare the HTCondor submission files and eventually submit them
std::unordered_map< DTCELinkId, uint32_t > cablingMapDTCELinkIdToDetId_

◆ serialize()

template<class Archive >
void TrackerDetToDTCELinkCablingMap::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 69 of file TrackerDetToDTCELinkCablingMap.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 69 of file TrackerDetToDTCELinkCablingMap.h.

Member Data Documentation

◆ cablingMapDetIdToDTCELinkId_

std::unordered_multimap<uint32_t, DTCELinkId> TrackerDetToDTCELinkCablingMap::cablingMapDetIdToDTCELinkId_
private

◆ cablingMapDTCELinkIdToDetId_

std::unordered_map<DTCELinkId, uint32_t> TrackerDetToDTCELinkCablingMap::cablingMapDTCELinkIdToDetId_
private