CMS 3D CMS Logo

PixelBarrelLinkMaker.cc
Go to the documentation of this file.
5 
7 
8 #include <ostream>
9 using namespace std;
10 using namespace sipixelobjects;
11 
13  const PixelBarrelName& n1 = *u1.name;
14  const PixelBarrelName& n2 = *u2.name;
15 
16  bool res = false;
17 
18  if (n1.layerName() < n2.layerName())
19  res = true;
20  else if (n1.layerName() > n2.layerName())
21  res = false;
22  else if (n1.ladderName() < n2.ladderName())
23  res = true;
24  else if (n1.ladderName() > n2.ladderName())
25  res = false;
26  else if (abs(n1.moduleName()) < abs(n2.moduleName()))
27  res = true;
28  else if (abs(n1.moduleName()) > abs(n2.moduleName()))
29  res = false;
30  else if (u1.rocIds.min() < u2.rocIds.min())
31  res = true;
32  else if (u1.rocIds.min() > u2.rocIds.min())
33  res = false;
34 
35  return res;
36 }
37 
39  Links result;
40  typedef Names::const_iterator CIN;
41 
42  //
43  // construct link items from names.
44  // the item is equivalent to name for layer=3.
45  // for layer=1,2 each module has 2 links
46  //
47  vector<Item> linkItems;
48  typedef vector<Item>::const_iterator CIU;
49 
50  for (unsigned int idx = 0; idx < n.size(); idx++) {
51  Item item;
52  PixelBarrelName* b = dynamic_cast<PixelBarrelName*>(n[idx]);
53  uint32_t d = u[idx];
54  item.name = b;
55  item.unit = d;
56 
57  if (b->isHalfModule()) {
58  item.rocIds = Range(0, 7); // half modules
59  linkItems.push_back(item);
60  } else if (b->layerName() <= 2) {
61  item.rocIds = Range(0, 7); // first link for modules in Layer=1,2
62  linkItems.push_back(item);
63  item.rocIds = Range(8, 15); // second link for modules in Layer=1,2
64  linkItems.push_back(item);
65  } else {
66  item.rocIds = Range(0, 15); // one module per link
67  linkItems.push_back(item);
68  }
69  }
70 
71  //
72  // sort link items to get the order as in links
73  //
74 
75  Order myLess;
76  sort(linkItems.begin(), linkItems.end(), myLess);
77 
78  //
79  // DEBUG
80  //
81  ostringstream str;
82  for (CIU it = linkItems.begin(); it != linkItems.end(); it++) {
83  str << (*it).name->name() << " r=" << (*it).rocIds << endl;
84  }
85  LogDebug(" sorted BARREL links: ") << str.str();
86 
87  //
88  // create corresponding PixelROC and link
89  //
90  int idLink = 0;
91  result.reserve(linkItems.size());
92  for (CIU it = linkItems.begin(); it != linkItems.end(); it++) {
94  PixelFEDLink link(++idLink);
95  int idRoc = 0;
96  for (int id = (*it).rocIds.min(); id <= (*it).rocIds.max(); id++) {
97  idRoc++;
98  rocs.push_back(PixelROC(it->unit, id, idRoc));
99  }
100  link.add(rocs);
101  result.push_back(link);
102  }
103 
104  return result;
105 }
PixelMapPlotter.rocs
rocs
Definition: PixelMapPlotter.py:497
PixelBarrelName.h
MessageLogger.h
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
MainPageGenerator.link
link
Definition: MainPageGenerator.py:271
Range
PixelRecoRange< float > Range
Definition: PixelTripletHLTGenerator.cc:31
PixelBarrelLinkMaker::Order
Definition: PixelBarrelLinkMaker.h:57
PixelBarrelName
Definition: PixelBarrelName.h:16
PixelBarrelLinkMaker::Links
PixelFEDCabling::Links Links
Definition: PixelBarrelLinkMaker.h:26
PixelBarrelLinkMaker.h
PixelBarrelName::layerName
int layerName() const
layer id
Definition: PixelBarrelName.h:43
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
sipixelobjects
Definition: CablingPathToDetUnit.h:4
str
#define str(s)
Definition: TestProcessor.cc:53
callgraph.n2
n2
Definition: callgraph.py:50
b
double b
Definition: hdecay.h:118
PixelBarrelName::ladderName
int ladderName() const
ladder id (index in phi)
Definition: PixelBarrelName.h:49
PixelModuleName.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
PixelBarrelLinkMaker::Order::operator()
bool operator()(const Item &, const Item &) const
Definition: PixelBarrelLinkMaker.cc:12
PixelROC.h
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
testProducerWithPsetDescEmpty_cfi.u1
u1
Definition: testProducerWithPsetDescEmpty_cfi.py:49
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
PixelBarrelLinkMaker::Item
Definition: PixelBarrelLinkMaker.h:46
PixelBarrelName::moduleName
int moduleName() const
module id (index in z)
Definition: PixelBarrelName.h:46
res
Definition: Electron.h:6
sipixelobjects::PixelROC
Definition: PixelROC.h:23
std
Definition: JetResolutionObject.h:76
PixelBarrelLinkMaker::Names
std::vector< PixelModuleName * > Names
Definition: PixelBarrelLinkMaker.h:24
ztail.d
d
Definition: ztail.py:151
mps_fire.result
result
Definition: mps_fire.py:311
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MetAnalyzer.u2
u2
Definition: MetAnalyzer.py:61
PixelBarrelLinkMaker::DetUnits
std::vector< uint32_t > DetUnits
Definition: PixelBarrelLinkMaker.h:25
PixelBarrelLinkMaker::links
Links links(const Names &n, const DetUnits &u) const
Definition: PixelBarrelLinkMaker.cc:38