CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
Phase2TrackerCabling Class Reference

#include <Phase2TrackerCabling.h>

Public Member Functions

const std::vector< Phase2TrackerModule > & connections () const
 
std::string description (bool compact=false) const
 
Phase2TrackerCabling filterByCoolingLine (uint32_t coolingLine) const
 
Phase2TrackerCabling filterByPowerGroup (uint32_t powerGroup) const
 
const Phase2TrackerModulefindDetid (uint32_t detid) const
 
const Phase2TrackerModulefindFedCh (std::pair< unsigned int, unsigned int > fedch) const
 
const Phase2TrackerModulefindGbtid (uint32_t gbtid) const
 
void initializeCabling ()
 
 Phase2TrackerCabling (const std::vector< Phase2TrackerModule > &cons)
 
 Phase2TrackerCabling (const Phase2TrackerCabling &src)
 
 Phase2TrackerCabling ()
 
std::string summaryDescription () const
 
virtual ~Phase2TrackerCabling ()
 

Private Types

typedef std::vector< keycabling
 
typedef std::vector< Phase2TrackerModule >::const_iterator key
 
typedef std::vector< Phase2TrackerModulestore
 

Private Member Functions

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

Static Private Member Functions

static bool chComp (key a, std::pair< unsigned int, unsigned int > b)
 
static bool chOrdering (key a, key b)
 
static bool cooleq (const Phase2TrackerModule &a, const Phase2TrackerModule &b)
 
static bool coolingComp (const Phase2TrackerModule &a, uint32_t b)
 
static bool coolingOrdering (const Phase2TrackerModule &a, const Phase2TrackerModule &b)
 
static bool detidComp (key a, uint32_t b)
 
static bool detidOrdering (key a, key b)
 
static bool fedeq (key a, key b)
 
static bool gbtidComp (key a, uint32_t b)
 
static bool gbtidOrdering (key a, key b)
 
static bool poweq (const Phase2TrackerModule &a, const Phase2TrackerModule &b)
 
static bool powerComp (const Phase2TrackerModule &a, uint32_t b)
 
static bool powerOrdering (const Phase2TrackerModule &a, const Phase2TrackerModule &b)
 

Private Attributes

store connections_
 
cabling detCabling_
 
cabling fedCabling_
 
cabling gbtCabling_
 

Friends

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

Detailed Description

Definition at line 9 of file Phase2TrackerCabling.h.

Member Typedef Documentation

typedef std::vector<key> Phase2TrackerCabling::cabling
private

Definition at line 12 of file Phase2TrackerCabling.h.

typedef std::vector<Phase2TrackerModule>::const_iterator Phase2TrackerCabling::key
private

Definition at line 11 of file Phase2TrackerCabling.h.

typedef std::vector<Phase2TrackerModule> Phase2TrackerCabling::store
private

Definition at line 10 of file Phase2TrackerCabling.h.

Constructor & Destructor Documentation

Phase2TrackerCabling::Phase2TrackerCabling ( const std::vector< Phase2TrackerModule > &  cons)

Definition at line 56 of file Phase2TrackerCabling.cc.

References initializeCabling().

56  : connections_(cons) {
57  // initialize the cabling (fill the transient objects and sort.
59 }
Phase2TrackerCabling::Phase2TrackerCabling ( const Phase2TrackerCabling src)
Phase2TrackerCabling::Phase2TrackerCabling ( )
inline

Definition at line 22 of file Phase2TrackerCabling.h.

22 {}
virtual Phase2TrackerCabling::~Phase2TrackerCabling ( )
inlinevirtual

Definition at line 25 of file Phase2TrackerCabling.h.

References initializeCabling().

25 {}

Member Function Documentation

bool Phase2TrackerCabling::chComp ( Phase2TrackerCabling::key  a,
std::pair< unsigned int, unsigned int >  b 
)
staticprivate

Definition at line 16 of file Phase2TrackerCabling.cc.

Referenced by findFedCh().

16  {
17  if (a->getCh().first == b.first)
18  return a->getCh().second < b.second;
19  else
20  return a->getCh().first < b.first;
21 }
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
bool Phase2TrackerCabling::chOrdering ( Phase2TrackerCabling::key  a,
Phase2TrackerCabling::key  b 
)
staticprivate

Definition at line 10 of file Phase2TrackerCabling.cc.

Referenced by initializeCabling().

10  {
11  if (a->getCh().first == b->getCh().first)
12  return a->getCh().second < b->getCh().second;
13  else
14  return a->getCh().first < b->getCh().first;
15 }
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
const std::vector<Phase2TrackerModule>& Phase2TrackerCabling::connections ( ) const
inline
bool Phase2TrackerCabling::cooleq ( const Phase2TrackerModule a,
const Phase2TrackerModule b 
)
staticprivate

Definition at line 41 of file Phase2TrackerCabling.cc.

References Phase2TrackerModule::getCoolingLoop().

Referenced by summaryDescription().

41  {
42  return (a.getCoolingLoop() == b.getCoolingLoop());
43 }
uint32_t getCoolingLoop() const
bool Phase2TrackerCabling::coolingComp ( const Phase2TrackerModule a,
uint32_t  b 
)
staticprivate

Definition at line 40 of file Phase2TrackerCabling.cc.

References b, and Phase2TrackerModule::getCoolingLoop().

40 { return a.getCoolingLoop() < b; }
uint32_t getCoolingLoop() const
double b
Definition: hdecay.h:118
bool Phase2TrackerCabling::coolingOrdering ( const Phase2TrackerModule a,
const Phase2TrackerModule b 
)
staticprivate

Definition at line 37 of file Phase2TrackerCabling.cc.

References Phase2TrackerModule::getCoolingLoop().

Referenced by filterByCoolingLine(), and summaryDescription().

37  {
38  return a.getCoolingLoop() < b.getCoolingLoop();
39 }
uint32_t getCoolingLoop() const
std::string Phase2TrackerCabling::description ( bool  compact = false) const

Definition at line 173 of file Phase2TrackerCabling.cc.

References connections_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by connections().

173  {
174  std::string mystring("Cabling:\n========\n");
175  for (std::vector<Phase2TrackerModule>::const_iterator it = connections_.begin(); it < connections_.end(); ++it) {
176  mystring += it->description(compact);
177  }
178  return mystring;
179 }
bool Phase2TrackerCabling::detidComp ( Phase2TrackerCabling::key  a,
uint32_t  b 
)
staticprivate

Definition at line 28 of file Phase2TrackerCabling.cc.

References b.

Referenced by findDetid().

28 { return a->getDetid() < b; }
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
bool Phase2TrackerCabling::detidOrdering ( Phase2TrackerCabling::key  a,
Phase2TrackerCabling::key  b 
)
staticprivate

Definition at line 25 of file Phase2TrackerCabling.cc.

Referenced by initializeCabling().

25  {
26  return a->getDetid() < b->getDetid();
27 }
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
bool Phase2TrackerCabling::fedeq ( key  a,
key  b 
)
staticprivate

Definition at line 22 of file Phase2TrackerCabling.cc.

Referenced by summaryDescription().

22 { return (a->getCh().first == b->getCh().first); }
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
Phase2TrackerCabling Phase2TrackerCabling::filterByCoolingLine ( uint32_t  coolingLine) const

Definition at line 114 of file Phase2TrackerCabling.cc.

References connections_, coolingOrdering(), FastTimerService_cff::range, mps_fire::result, and Phase2TrackerModule::SS.

Referenced by connections().

114  {
115  // NB: this approach involves two copies of the connections. Can we do better?
116  // since this is a relatively rare operation, I don't want to pre-sort the connections.
117 
118  // make a copy of the store
119  store resultStore = connections_;
120  // sort according to cooling
121  std::sort(resultStore.begin(), resultStore.end(), coolingOrdering);
122  // search for the proper range
123  std::pair<key, key> range = std::equal_range(resultStore.begin(),
124  resultStore.end(),
125  Phase2TrackerModule(Phase2TrackerModule::SS, 0, 0, 0, 0, 0, coolingLine),
127  // create a new cabling object
128  Phase2TrackerCabling result(store(range.first, range.second));
129  // return the new cabling object
130  return result;
131 }
static bool coolingOrdering(const Phase2TrackerModule &a, const Phase2TrackerModule &b)
std::vector< Phase2TrackerModule > store
Phase2TrackerCabling Phase2TrackerCabling::filterByPowerGroup ( uint32_t  powerGroup) const

Definition at line 133 of file Phase2TrackerCabling.cc.

References connections_, powerOrdering(), FastTimerService_cff::range, mps_fire::result, and Phase2TrackerModule::SS.

Referenced by connections().

133  {
134  // NB: this approach involves two copies of the connections. Can we do better?
135  // since this is a relatively rare operation, I don't want to pre-sort the connections.
136 
137  // make a copy of the store
138  store resultStore = connections_;
139  // sort according to power groups
140  std::sort(resultStore.begin(), resultStore.end(), powerOrdering);
141  // search for the proper range
142  std::pair<key, key> range = std::equal_range(resultStore.begin(),
143  resultStore.end(),
144  Phase2TrackerModule(Phase2TrackerModule::SS, 0, 0, 0, 0, powerGroup, 0),
145  powerOrdering);
146  // create a new cabling object
147  Phase2TrackerCabling result(store(range.first, range.second));
148  // return the new cabling object
149  return result;
150 }
static bool powerOrdering(const Phase2TrackerModule &a, const Phase2TrackerModule &b)
std::vector< Phase2TrackerModule > store
const Phase2TrackerModule & Phase2TrackerCabling::findDetid ( uint32_t  detid) const

Definition at line 94 of file Phase2TrackerCabling.cc.

References TauDecayModes::dec, detCabling_, detidComp(), and Exception.

Referenced by connections().

94  {
95  // look for id
96  cabling::const_iterator itch = std::lower_bound(detCabling_.begin(), detCabling_.end(), detid, detidComp);
97  if (itch != detCabling_.end() && (*itch)->getDetid() == detid)
98  return **itch;
99  else
100  throw cms::Exception("IndexNotFound")
101  << "No connection corresponding to detid = 0x" << std::hex << detid << std::dec;
102 }
static bool detidComp(key a, uint32_t b)
const Phase2TrackerModule & Phase2TrackerCabling::findFedCh ( std::pair< unsigned int, unsigned int >  fedch) const

Definition at line 84 of file Phase2TrackerCabling.cc.

References chComp(), Exception, and fedCabling_.

Referenced by connections(), and Phase2Tracker::Phase2TrackerDigiProducer::produce().

84  {
85  // look for ch
86  cabling::const_iterator itid = std::lower_bound(fedCabling_.begin(), fedCabling_.end(), fedch, chComp);
87  if (itid != fedCabling_.end() && (*itid)->getCh() == fedch)
88  return **itid;
89  else
90  throw cms::Exception("IndexNotFound")
91  << "No connection corresponding to FED id/ch = " << fedch.first << "/" << fedch.second;
92 }
static bool chComp(key a, std::pair< unsigned int, unsigned int > b)
const Phase2TrackerModule & Phase2TrackerCabling::findGbtid ( uint32_t  gbtid) const

Definition at line 104 of file Phase2TrackerCabling.cc.

References TauDecayModes::dec, Exception, gbtCabling_, and gbtidComp().

Referenced by connections().

104  {
105  // look for id
106  cabling::const_iterator itch = std::lower_bound(gbtCabling_.begin(), gbtCabling_.end(), gbtid, gbtidComp);
107  if (itch != gbtCabling_.end() && (*itch)->getGbtid() == gbtid)
108  return **itch;
109  else
110  throw cms::Exception("IndexNotFound")
111  << "No connection corresponding to gbtid = 0x" << std::hex << gbtid << std::dec;
112 }
static bool gbtidComp(key a, uint32_t b)
bool Phase2TrackerCabling::gbtidComp ( Phase2TrackerCabling::key  a,
uint32_t  b 
)
staticprivate

Definition at line 34 of file Phase2TrackerCabling.cc.

References b.

Referenced by findGbtid().

34 { return a->getGbtid() < b; }
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
bool Phase2TrackerCabling::gbtidOrdering ( Phase2TrackerCabling::key  a,
Phase2TrackerCabling::key  b 
)
staticprivate

Definition at line 31 of file Phase2TrackerCabling.cc.

Referenced by initializeCabling().

31  {
32  return a->getGbtid() < b->getGbtid();
33 }
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
void Phase2TrackerCabling::initializeCabling ( )

Definition at line 68 of file Phase2TrackerCabling.cc.

References chOrdering(), connections_, detCabling_, detidOrdering(), fedCabling_, gbtCabling_, and gbtidOrdering().

Referenced by Phase2TrackerCabling(), and ~Phase2TrackerCabling().

68  {
69  // fill the cabling objects
70  fedCabling_.reserve(connections_.size());
71  detCabling_.reserve(connections_.size());
72  gbtCabling_.reserve(connections_.size());
73  for (key module = connections_.begin(); module < connections_.end(); ++module) {
74  fedCabling_.push_back(module);
75  detCabling_.push_back(module);
76  gbtCabling_.push_back(module);
77  }
78  // sort the cabling objects
79  std::sort(fedCabling_.begin(), fedCabling_.end(), chOrdering);
80  std::sort(detCabling_.begin(), detCabling_.end(), detidOrdering);
81  std::sort(gbtCabling_.begin(), gbtCabling_.end(), gbtidOrdering);
82 }
static bool gbtidOrdering(key a, key b)
static bool chOrdering(key a, key b)
std::vector< Phase2TrackerModule >::const_iterator key
static bool detidOrdering(key a, key b)
Definition: vlib.h:198
bool Phase2TrackerCabling::poweq ( const Phase2TrackerModule a,
const Phase2TrackerModule b 
)
staticprivate

Definition at line 50 of file Phase2TrackerCabling.cc.

References Phase2TrackerModule::getPowerGroup().

Referenced by summaryDescription().

50  {
51  return (a.getPowerGroup() == b.getPowerGroup());
52 }
uint32_t getPowerGroup() const
bool Phase2TrackerCabling::powerComp ( const Phase2TrackerModule a,
uint32_t  b 
)
staticprivate

Definition at line 49 of file Phase2TrackerCabling.cc.

References b, and Phase2TrackerModule::getPowerGroup().

49 { return a.getPowerGroup() < b; }
uint32_t getPowerGroup() const
double b
Definition: hdecay.h:118
bool Phase2TrackerCabling::powerOrdering ( const Phase2TrackerModule a,
const Phase2TrackerModule b 
)
staticprivate

Definition at line 46 of file Phase2TrackerCabling.cc.

References Phase2TrackerModule::getPowerGroup().

Referenced by filterByPowerGroup(), and summaryDescription().

46  {
47  return a.getPowerGroup() < b.getPowerGroup();
48 }
uint32_t getPowerGroup() const
template<class Archive >
void Phase2TrackerCabling::serialize ( Archive &  ar,
const unsigned int  version 
)
private
std::string Phase2TrackerCabling::summaryDescription ( ) const

Definition at line 152 of file Phase2TrackerCabling.cc.

References connections_, cooleq(), coolingOrdering(), HLT_2018_cff::distance, fedCabling_, fedeq(), poweq(), powerOrdering(), contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, createJobs::tmp, and tier0::unique().

Referenced by connections().

152  {
153  std::string mystring("Summary of the cabling\n======================\n");
154  std::stringstream ss;
155  // number of modules, feds, cooling loop and power groups
156  ss << "Number of modules: " << connections_.size() << std::endl;
157  store orig(connections_);
158  ss << "Number of FEDs: ";
159  cabling tmpc(fedCabling_);
160  ss << std::distance(tmpc.begin(), std::unique(tmpc.begin(), tmpc.end(), fedeq)) << std::endl;
161  ss << "Number of cooling loops: ";
162  std::sort(orig.begin(), orig.end(), coolingOrdering);
163  store tmp(orig);
164  ss << std::distance(tmp.begin(), std::unique(tmp.begin(), tmp.end(), cooleq)) << std::endl;
165  ss << "Number of power groups: ";
166  std::sort(orig.begin(), orig.end(), powerOrdering);
167  tmp = orig;
168  ss << std::distance(tmp.begin(), std::unique(tmp.begin(), tmp.end(), poweq)) << std::endl;
169  mystring += ss.str();
170  return mystring;
171 }
static bool powerOrdering(const Phase2TrackerModule &a, const Phase2TrackerModule &b)
static bool coolingOrdering(const Phase2TrackerModule &a, const Phase2TrackerModule &b)
static bool cooleq(const Phase2TrackerModule &a, const Phase2TrackerModule &b)
static bool poweq(const Phase2TrackerModule &a, const Phase2TrackerModule &b)
def unique(seq, keepstr=True)
Definition: tier0.py:24
static bool fedeq(key a, key b)
tmp
align.sh
Definition: createJobs.py:716
std::vector< Phase2TrackerModule > store
std::vector< key > cabling

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 79 of file Phase2TrackerCabling.h.

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

Definition at line 79 of file Phase2TrackerCabling.h.

Member Data Documentation

store Phase2TrackerCabling::connections_
private
cabling Phase2TrackerCabling::detCabling_
private

Definition at line 61 of file Phase2TrackerCabling.h.

Referenced by findDetid(), initializeCabling(), and Phase2TrackerCabling().

cabling Phase2TrackerCabling::fedCabling_
private
cabling Phase2TrackerCabling::gbtCabling_
private

Definition at line 60 of file Phase2TrackerCabling.h.

Referenced by findGbtid(), initializeCabling(), and Phase2TrackerCabling().