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 ()
 
 Phase2TrackerCabling (const Phase2TrackerCabling &src)
 
 Phase2TrackerCabling (const std::vector< Phase2TrackerModule > &cons)
 
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

◆ cabling

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

Definition at line 12 of file Phase2TrackerCabling.h.

◆ key

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

Definition at line 11 of file Phase2TrackerCabling.h.

◆ store

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

Definition at line 10 of file Phase2TrackerCabling.h.

Constructor & Destructor Documentation

◆ Phase2TrackerCabling() [1/3]

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

Definition at line 56 of file Phase2TrackerCabling.cc.

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

References initializeCabling().

◆ Phase2TrackerCabling() [2/3]

Phase2TrackerCabling::Phase2TrackerCabling ( const Phase2TrackerCabling src)

Definition at line 61 of file Phase2TrackerCabling.cc.

61  {
62  connections_ = src.connections_;
63  fedCabling_ = src.fedCabling_;
64  detCabling_ = src.detCabling_;
65  gbtCabling_ = src.gbtCabling_;
66 }

References connections_, detCabling_, fedCabling_, gbtCabling_, and TrackRefitter_38T_cff::src.

◆ Phase2TrackerCabling() [3/3]

Phase2TrackerCabling::Phase2TrackerCabling ( )
inline

Definition at line 22 of file Phase2TrackerCabling.h.

22 {}

◆ ~Phase2TrackerCabling()

virtual Phase2TrackerCabling::~Phase2TrackerCabling ( )
inlinevirtual

Definition at line 25 of file Phase2TrackerCabling.h.

25 {}

Member Function Documentation

◆ chComp()

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

Definition at line 16 of file Phase2TrackerCabling.cc.

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 }

References a, and b.

Referenced by findFedCh().

◆ chOrdering()

bool Phase2TrackerCabling::chOrdering ( Phase2TrackerCabling::key  a,
Phase2TrackerCabling::key  b 
)
staticprivate

Definition at line 10 of file Phase2TrackerCabling.cc.

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 }

References a, and b.

Referenced by initializeCabling().

◆ connections()

const std::vector<Phase2TrackerModule>& Phase2TrackerCabling::connections ( ) const
inline

Definition at line 31 of file Phase2TrackerCabling.h.

31 { return connections_; }

References connections_.

◆ cooleq()

bool Phase2TrackerCabling::cooleq ( const Phase2TrackerModule a,
const Phase2TrackerModule b 
)
staticprivate

Definition at line 41 of file Phase2TrackerCabling.cc.

41  {
42  return (a.getCoolingLoop() == b.getCoolingLoop());
43 }

References a, and b.

Referenced by summaryDescription().

◆ coolingComp()

bool Phase2TrackerCabling::coolingComp ( const Phase2TrackerModule a,
uint32_t  b 
)
staticprivate

Definition at line 40 of file Phase2TrackerCabling.cc.

40 { return a.getCoolingLoop() < b; }

References a, and b.

◆ coolingOrdering()

bool Phase2TrackerCabling::coolingOrdering ( const Phase2TrackerModule a,
const Phase2TrackerModule b 
)
staticprivate

Definition at line 37 of file Phase2TrackerCabling.cc.

37  {
38  return a.getCoolingLoop() < b.getCoolingLoop();
39 }

References a, and b.

Referenced by filterByCoolingLine(), and summaryDescription().

◆ description()

std::string Phase2TrackerCabling::description ( bool  compact = false) const

Definition at line 173 of file Phase2TrackerCabling.cc.

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 }

References connections_, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ detidComp()

bool Phase2TrackerCabling::detidComp ( Phase2TrackerCabling::key  a,
uint32_t  b 
)
staticprivate

Definition at line 28 of file Phase2TrackerCabling.cc.

28 { return a->getDetid() < b; }

References a, and b.

Referenced by findDetid().

◆ detidOrdering()

bool Phase2TrackerCabling::detidOrdering ( Phase2TrackerCabling::key  a,
Phase2TrackerCabling::key  b 
)
staticprivate

Definition at line 25 of file Phase2TrackerCabling.cc.

25  {
26  return a->getDetid() < b->getDetid();
27 }

References a, and b.

Referenced by initializeCabling().

◆ fedeq()

bool Phase2TrackerCabling::fedeq ( key  a,
key  b 
)
staticprivate

Definition at line 22 of file Phase2TrackerCabling.cc.

22 { return (a->getCh().first == b->getCh().first); }

References a, and b.

Referenced by summaryDescription().

◆ filterByCoolingLine()

Phase2TrackerCabling Phase2TrackerCabling::filterByCoolingLine ( uint32_t  coolingLine) const

Definition at line 114 of file Phase2TrackerCabling.cc.

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 }

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

◆ filterByPowerGroup()

Phase2TrackerCabling Phase2TrackerCabling::filterByPowerGroup ( uint32_t  powerGroup) const

Definition at line 133 of file Phase2TrackerCabling.cc.

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 }

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

◆ findDetid()

const Phase2TrackerModule & Phase2TrackerCabling::findDetid ( uint32_t  detid) const

Definition at line 94 of file Phase2TrackerCabling.cc.

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 }

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

◆ findFedCh()

const Phase2TrackerModule & Phase2TrackerCabling::findFedCh ( std::pair< unsigned int, unsigned int >  fedch) const

Definition at line 84 of file Phase2TrackerCabling.cc.

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 }

References chComp(), Exception, fedCabling_, and pfDeepBoostedJetPreprocessParams_cfi::lower_bound.

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

◆ findGbtid()

const Phase2TrackerModule & Phase2TrackerCabling::findGbtid ( uint32_t  gbtid) const

Definition at line 104 of file Phase2TrackerCabling.cc.

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 }

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

◆ gbtidComp()

bool Phase2TrackerCabling::gbtidComp ( Phase2TrackerCabling::key  a,
uint32_t  b 
)
staticprivate

Definition at line 34 of file Phase2TrackerCabling.cc.

34 { return a->getGbtid() < b; }

References a, and b.

Referenced by findGbtid().

◆ gbtidOrdering()

bool Phase2TrackerCabling::gbtidOrdering ( Phase2TrackerCabling::key  a,
Phase2TrackerCabling::key  b 
)
staticprivate

Definition at line 31 of file Phase2TrackerCabling.cc.

31  {
32  return a->getGbtid() < b->getGbtid();
33 }

References a, and b.

Referenced by initializeCabling().

◆ initializeCabling()

void Phase2TrackerCabling::initializeCabling ( )

Definition at line 68 of file Phase2TrackerCabling.cc.

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
82 }

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

Referenced by Phase2TrackerCabling().

◆ poweq()

bool Phase2TrackerCabling::poweq ( const Phase2TrackerModule a,
const Phase2TrackerModule b 
)
staticprivate

Definition at line 50 of file Phase2TrackerCabling.cc.

50  {
51  return (a.getPowerGroup() == b.getPowerGroup());
52 }

References a, and b.

Referenced by summaryDescription().

◆ powerComp()

bool Phase2TrackerCabling::powerComp ( const Phase2TrackerModule a,
uint32_t  b 
)
staticprivate

Definition at line 49 of file Phase2TrackerCabling.cc.

49 { return a.getPowerGroup() < b; }

References a, and b.

◆ powerOrdering()

bool Phase2TrackerCabling::powerOrdering ( const Phase2TrackerModule a,
const Phase2TrackerModule b 
)
staticprivate

Definition at line 46 of file Phase2TrackerCabling.cc.

46  {
47  return a.getPowerGroup() < b.getPowerGroup();
48 }

References a, and b.

Referenced by filterByPowerGroup(), and summaryDescription().

◆ serialize()

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

◆ summaryDescription()

std::string Phase2TrackerCabling::summaryDescription ( ) const

Definition at line 152 of file Phase2TrackerCabling.cc.

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 }

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

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 79 of file Phase2TrackerCabling.h.

◆ cond::serialization::access

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

Definition at line 79 of file Phase2TrackerCabling.h.

Member Data Documentation

◆ connections_

store Phase2TrackerCabling::connections_
private

◆ detCabling_

cabling Phase2TrackerCabling::detCabling_
private

Definition at line 61 of file Phase2TrackerCabling.h.

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

◆ fedCabling_

cabling Phase2TrackerCabling::fedCabling_
private

◆ gbtCabling_

cabling Phase2TrackerCabling::gbtCabling_
private

Definition at line 60 of file Phase2TrackerCabling.h.

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

Phase2TrackerCabling::poweq
static bool poweq(const Phase2TrackerModule &a, const Phase2TrackerModule &b)
Definition: Phase2TrackerCabling.cc:50
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
Phase2TrackerCabling::gbtCabling_
cabling gbtCabling_
Definition: Phase2TrackerCabling.h:60
Phase2TrackerCabling::detCabling_
cabling detCabling_
Definition: Phase2TrackerCabling.h:61
Phase2TrackerCabling::gbtidOrdering
static bool gbtidOrdering(key a, key b)
Definition: Phase2TrackerCabling.cc:31
Phase2TrackerCabling
Definition: Phase2TrackerCabling.h:9
Phase2TrackerCabling::cabling
std::vector< key > cabling
Definition: Phase2TrackerCabling.h:12
Phase2TrackerCabling::coolingOrdering
static bool coolingOrdering(const Phase2TrackerModule &a, const Phase2TrackerModule &b)
Definition: Phase2TrackerCabling.cc:37
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
Phase2TrackerCabling::cooleq
static bool cooleq(const Phase2TrackerModule &a, const Phase2TrackerModule &b)
Definition: Phase2TrackerCabling.cc:41
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
Phase2TrackerCabling::chOrdering
static bool chOrdering(key a, key b)
Definition: Phase2TrackerCabling.cc:10
Phase2TrackerCabling::initializeCabling
void initializeCabling()
Definition: Phase2TrackerCabling.cc:68
Phase2TrackerCabling::key
std::vector< Phase2TrackerModule >::const_iterator key
Definition: Phase2TrackerCabling.h:11
b
double b
Definition: hdecay.h:118
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
a
double a
Definition: hdecay.h:119
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
Phase2TrackerModule
Definition: Phase2TrackerModule.h:9
Phase2TrackerCabling::store
std::vector< Phase2TrackerModule > store
Definition: Phase2TrackerCabling.h:10
tier0.unique
def unique(seq, keepstr=True)
Definition: tier0.py:24
Phase2TrackerModule::SS
Definition: Phase2TrackerModule.h:11
Phase2TrackerCabling::detidOrdering
static bool detidOrdering(key a, key b)
Definition: Phase2TrackerCabling.cc:25
Phase2TrackerCabling::connections_
store connections_
Definition: Phase2TrackerCabling.h:56
Phase2TrackerCabling::fedeq
static bool fedeq(key a, key b)
Definition: Phase2TrackerCabling.cc:22
Exception
Definition: hltDiff.cc:245
Phase2TrackerCabling::detidComp
static bool detidComp(key a, uint32_t b)
Definition: Phase2TrackerCabling.cc:28
Phase2TrackerCabling::chComp
static bool chComp(key a, std::pair< unsigned int, unsigned int > b)
Definition: Phase2TrackerCabling.cc:16
Phase2TrackerCabling::fedCabling_
cabling fedCabling_
Definition: Phase2TrackerCabling.h:59
mps_fire.result
result
Definition: mps_fire.py:311
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7733
Phase2TrackerCabling::powerOrdering
static bool powerOrdering(const Phase2TrackerModule &a, const Phase2TrackerModule &b)
Definition: Phase2TrackerCabling.cc:46
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
Phase2TrackerCabling::gbtidComp
static bool gbtidComp(key a, uint32_t b)
Definition: Phase2TrackerCabling.cc:34