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 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)
Phase2TrackerCabling::Phase2TrackerCabling ( )
inline

Definition at line 23 of file Phase2TrackerCabling.h.

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

Definition at line 26 of file Phase2TrackerCabling.h.

References initializeCabling().

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
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.

Referenced by connections().

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(), mps_fire::result, and Phase2TrackerModule::SS.

Referenced by connections().

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)
std::vector< Phase2TrackerModule > store
Phase2TrackerCabling Phase2TrackerCabling::filterByPowerGroup ( uint32_t  powerGroup) const

Definition at line 134 of file Phase2TrackerCabling.cc.

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

Referenced by connections().

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)
std::vector< Phase2TrackerModule > store
const Phase2TrackerModule & Phase2TrackerCabling::findDetid ( uint32_t  detid) const

Definition at line 99 of file Phase2TrackerCabling.cc.

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

Referenced by connections().

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(), Exception, and fedCabling_.

Referenced by connections(), and 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 TauDecayModes::dec, Exception, gbtCabling_, and gbtidComp().

Referenced by connections().

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_, detCabling_, detidOrdering(), fedCabling_, gbtCabling_, and gbtidOrdering().

Referenced by Phase2TrackerCabling(), and ~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
template<class Archive >
void Phase2TrackerCabling::serialize ( Archive &  ar,
const unsigned int  version 
)
private
std::string Phase2TrackerCabling::summaryDescription ( ) const

Definition at line 151 of file Phase2TrackerCabling.cc.

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

Referenced by connections().

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)
def unique(seq, keepstr=True)
Definition: tier0.py:24
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

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 80 of file Phase2TrackerCabling.h.

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

Definition at line 80 of file Phase2TrackerCabling.h.

Member Data Documentation

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

Definition at line 62 of file Phase2TrackerCabling.h.

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

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

Definition at line 61 of file Phase2TrackerCabling.h.

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