CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Static Private Member Functions | Private Attributes
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
< Phase2TrackerModule
store
 

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

 COND_SERIALIZABLE
 
cabling fedCabling_ COND_TRANSIENT
 
cabling gbtCabling_ COND_TRANSIENT
 
cabling detCabling_ COND_TRANSIENT
 
store connections_
 

Detailed Description

Definition at line 9 of file Phase2TrackerCabling.h.

Member Typedef Documentation

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

Definition at line 13 of file Phase2TrackerCabling.h.

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

Definition at line 12 of file Phase2TrackerCabling.h.

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

Definition at line 11 of file Phase2TrackerCabling.h.

Constructor & Destructor Documentation

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

Definition at line 62 of file Phase2TrackerCabling.cc.

References initializeCabling().

62  :connections_(cons) {
63  // initialize the cabling (fill the transient objects and sort.
65 }
Phase2TrackerCabling::Phase2TrackerCabling ( const Phase2TrackerCabling src)

Definition at line 67 of file Phase2TrackerCabling.cc.

References connections_.

67  {
69  fedCabling_ = src.fedCabling_;
70  detCabling_ = src.detCabling_;
71  gbtCabling_ = src.gbtCabling_;
72 }
Phase2TrackerCabling::Phase2TrackerCabling ( )
inline

Definition at line 23 of file Phase2TrackerCabling.h.

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

Definition at line 26 of file Phase2TrackerCabling.h.

26 {}

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:120
double a
Definition: hdecay.h:121
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:120
double a
Definition: hdecay.h:121
const std::vector<Phase2TrackerModule>& Phase2TrackerCabling::connections ( ) const
inline

Definition at line 32 of file Phase2TrackerCabling.h.

References connections_.

32 { return connections_; }
bool Phase2TrackerCabling::cooleq ( const Phase2TrackerModule a,
const Phase2TrackerModule b 
)
staticprivate

Definition at line 47 of file Phase2TrackerCabling.cc.

References Phase2TrackerModule::getCoolingLoop().

Referenced by summaryDescription().

47  {
48  return (a.getCoolingLoop()==b.getCoolingLoop());
49 }
uint32_t getCoolingLoop() const
bool Phase2TrackerCabling::coolingComp ( const Phase2TrackerModule a,
uint32_t  b 
)
staticprivate

Definition at line 45 of file Phase2TrackerCabling.cc.

References b, and Phase2TrackerModule::getCoolingLoop().

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

Definition at line 43 of file Phase2TrackerCabling.cc.

References Phase2TrackerModule::getCoolingLoop().

Referenced by filterByCoolingLine(), and summaryDescription().

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

Definition at line 172 of file Phase2TrackerCabling.cc.

References connections_, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 30 of file Phase2TrackerCabling.cc.

References b.

Referenced by findDetid().

30  {
31  return a->getDetid() < b;
32 }
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
bool Phase2TrackerCabling::detidOrdering ( Phase2TrackerCabling::key  a,
Phase2TrackerCabling::key  b 
)
staticprivate

Definition at line 27 of file Phase2TrackerCabling.cc.

Referenced by initializeCabling().

27  {
28  return a->getDetid() < b->getDetid();
29 }
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
bool Phase2TrackerCabling::fedeq ( key  a,
key  b 
)
staticprivate

Definition at line 22 of file Phase2TrackerCabling.cc.

Referenced by summaryDescription().

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

Definition at line 117 of file Phase2TrackerCabling.cc.

References connections_, coolingOrdering(), query::result, python.multivaluedict::sort(), and Phase2TrackerModule::SS.

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

Definition at line 134 of file Phase2TrackerCabling.cc.

References connections_, powerOrdering(), query::result, python.multivaluedict::sort(), and Phase2TrackerModule::SS.

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

Definition at line 99 of file Phase2TrackerCabling.cc.

References cond::rpcobgas::detid, detidComp(), and edm::hlt::Exception.

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

Definition at line 90 of file Phase2TrackerCabling.cc.

References chComp(), and edm::hlt::Exception.

Referenced by Phase2Tracker::Phase2TrackerDigiProducer::produce().

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

Definition at line 108 of file Phase2TrackerCabling.cc.

References edm::hlt::Exception, and gbtidComp().

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

Definition at line 38 of file Phase2TrackerCabling.cc.

References b.

Referenced by findGbtid().

38  {
39  return a->getGbtid() < b;
40 }
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
bool Phase2TrackerCabling::gbtidOrdering ( Phase2TrackerCabling::key  a,
Phase2TrackerCabling::key  b 
)
staticprivate

Definition at line 35 of file Phase2TrackerCabling.cc.

Referenced by initializeCabling().

35  {
36  return a->getGbtid() < b->getGbtid();
37 }
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
void Phase2TrackerCabling::initializeCabling ( )

Definition at line 74 of file Phase2TrackerCabling.cc.

References chOrdering(), connections_, detidOrdering(), gbtidOrdering(), python.rootplot.argparse::module, and python.multivaluedict::sort().

Referenced by Phase2TrackerCabling().

74  {
75  // fill the cabling objects
76  fedCabling_.reserve(connections_.size());
77  detCabling_.reserve(connections_.size());
78  gbtCabling_.reserve(connections_.size());
79  for(key module = connections_.begin();module<connections_.end();++module) {
80  fedCabling_.push_back(module);
81  detCabling_.push_back(module);
82  gbtCabling_.push_back(module);
83  }
84  // sort the cabling objects
85  std::sort(fedCabling_.begin(),fedCabling_.end(),chOrdering);
86  std::sort(detCabling_.begin(),detCabling_.end(),detidOrdering);
87  std::sort(gbtCabling_.begin(),gbtCabling_.end(),gbtidOrdering);
88 }
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:208
bool Phase2TrackerCabling::poweq ( const Phase2TrackerModule a,
const Phase2TrackerModule b 
)
staticprivate

Definition at line 56 of file Phase2TrackerCabling.cc.

References Phase2TrackerModule::getPowerGroup().

Referenced by summaryDescription().

56  {
57  return (a.getPowerGroup()==b.getPowerGroup());
58 }
uint32_t getPowerGroup() const
bool Phase2TrackerCabling::powerComp ( const Phase2TrackerModule a,
uint32_t  b 
)
staticprivate

Definition at line 54 of file Phase2TrackerCabling.cc.

References b, and Phase2TrackerModule::getPowerGroup().

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

Definition at line 52 of file Phase2TrackerCabling.cc.

References Phase2TrackerModule::getPowerGroup().

Referenced by filterByPowerGroup(), and summaryDescription().

52  {
53  return a.getPowerGroup() < b.getPowerGroup(); }
uint32_t getPowerGroup() const
std::string Phase2TrackerCabling::summaryDescription ( ) const

Definition at line 151 of file Phase2TrackerCabling.cc.

References connections_, cooleq(), coolingOrdering(), fedeq(), poweq(), powerOrdering(), python.multivaluedict::sort(), contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and tmp.

151  {
152  std::string mystring("Summary of the cabling\n======================\n");
153  std::stringstream ss;
154  // number of modules, feds, cooling loop and power groups
155  ss << "Number of modules: " << connections_.size() << std::endl;
156  store orig(connections_);
157  ss << "Number of FEDs: ";
158  cabling tmpc(fedCabling_);
159  ss << std::distance(tmpc.begin(),std::unique(tmpc.begin(),tmpc.end(),fedeq)) << std::endl;
160  ss << "Number of cooling loops: ";
161  std::sort(orig.begin(),orig.end(),coolingOrdering);
162  store tmp(orig);
163  ss << std::distance(tmp.begin(),std::unique(tmp.begin(),tmp.end(),cooleq)) << std::endl;
164  ss << "Number of power groups: ";
165  std::sort(orig.begin(),orig.end(),powerOrdering);
166  tmp = orig;
167  ss << std::distance(tmp.begin(),std::unique(tmp.begin(),tmp.end(),poweq)) << std::endl;
168  mystring += ss.str();
169  return mystring;
170 }
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)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
static bool fedeq(key a, key b)
std::vector< Phase2TrackerModule > store
std::vector< key > cabling

Member Data Documentation

Phase2TrackerCabling::COND_SERIALIZABLE
private

Definition at line 80 of file Phase2TrackerCabling.h.

cabling fedCabling_ Phase2TrackerCabling::COND_TRANSIENT
private

Definition at line 60 of file Phase2TrackerCabling.h.

cabling gbtCabling_ Phase2TrackerCabling::COND_TRANSIENT
private

Definition at line 61 of file Phase2TrackerCabling.h.

cabling detCabling_ Phase2TrackerCabling::COND_TRANSIENT
private

Definition at line 62 of file Phase2TrackerCabling.h.

store Phase2TrackerCabling::connections_
private