CMS 3D CMS Logo

PixelEndcapLinkMaker.cc
Go to the documentation of this file.
6 #include <ostream>
7 
8 using namespace std;
9 using namespace sipixelobjects;
10 
12  bool res = true;
13  const PixelEndcapName& n1 = *u1.name;
14  const PixelEndcapName& n2 = *u2.name;
15 
16  if (n1.halfCylinder() < n2.halfCylinder())
17  res = true;
18  else if (n1.halfCylinder() > n2.halfCylinder())
19  res = false;
20  else if (n1.diskName() < n2.diskName())
21  res = true;
22  else if (n1.diskName() > n2.diskName())
23  res = false;
24  else if (n1.bladeName() < n2.bladeName())
25  res = true;
26  else if (n1.bladeName() > n2.bladeName())
27  res = false;
28  else if (n1.pannelName() < n2.pannelName())
29  res = true;
30  else if (n1.pannelName() > n2.pannelName())
31  res = false;
32  else if (n1.plaquetteName() < n2.plaquetteName())
33  res = true;
34  else if (n1.plaquetteName() > n2.plaquetteName())
35  res = false;
36 
37  return res;
38 }
39 
41  Links result;
42  typedef Names::const_iterator CIN;
43 
44  //
45  // split names to 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  PixelEndcapName* e = dynamic_cast<PixelEndcapName*>(n[idx]);
53  uint32_t d = u[idx];
54  item.name = e;
55  item.unit = d;
56  Range rocIds(-1, -1);
57  PixelModuleName::ModuleType type = e->moduleType();
58  switch (type) {
59  case (PixelModuleName::v1x2): {
60  rocIds = Range(0, 1);
61  break;
62  }
63  case (PixelModuleName::v1x5): {
64  rocIds = Range(0, 4);
65  break;
66  }
67  case (PixelModuleName::v2x3): {
68  rocIds = Range(0, 5);
69  break;
70  }
71  case (PixelModuleName::v2x4): {
72  rocIds = Range(0, 7);
73  break;
74  }
75  case (PixelModuleName::v2x5): {
76  rocIds = Range(0, 9);
77  break;
78  }
79  default:
80  edm::LogError("PixelEndcapLinkMaker") << " *** UNEXPECTED roc: " << e->name();
81  };
82  item.rocIds = rocIds;
83  linkItems.push_back(item);
84  }
85  //
86  // sort names to get the order as in links
87  //
88 
89  sort(linkItems.begin(), linkItems.end(), Order());
90 
91  //
92  // DEBUG
93  //
94  ostringstream str;
95  for (CIU it = linkItems.begin(); it != linkItems.end(); it++) {
96  str << (*it).name->name() << " r=" << (*it).rocIds << endl;
97  }
98  LogDebug(" sorted ENDCAP links: ") << str.str();
99 
100  result.reserve(36);
101  int lastPannelId = -1;
102  int idLink = 0;
103  int idRoc = 0;
104  PixelFEDLink link(idLink); // dummy object, id=0
105 
106  for (CIU it = linkItems.begin(); it != linkItems.end(); it++) {
108  int pannelId = it->name->pannelName();
109 
110  if (pannelId != lastPannelId) {
111  lastPannelId = pannelId;
112  if (idLink > 0)
113  result.push_back(link);
114  idRoc = 0;
115  link = PixelFEDLink(++idLink); // real link, to be filled
116  }
117 
118  for (int id = (*it).rocIds.min(); id <= (*it).rocIds.max(); id++) {
119  ++idRoc;
120  rocs.push_back(PixelROC(it->unit, id, idRoc));
121  }
122 
123  link.add(rocs);
124  }
125 
126  if (idLink > 0)
127  result.push_back(link);
128  return result;
129 }
PixelMapPlotter.rocs
rocs
Definition: PixelMapPlotter.py:497
PixelEndcapLinkMaker::DetUnits
std::vector< uint32_t > DetUnits
Definition: PixelEndcapLinkMaker.h:21
PixelModuleName::v2x3
Definition: PixelModuleName.h:14
MessageLogger.h
PixelModuleName::v2x4
Definition: PixelModuleName.h:14
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
MainPageGenerator.link
link
Definition: MainPageGenerator.py:271
PixelEndcapLinkMaker::Order
Definition: PixelEndcapLinkMaker.h:57
Range
PixelRecoRange< float > Range
Definition: PixelTripletHLTGenerator.cc:31
PixelEndcapLinkMaker.h
PixelEndcapName::halfCylinder
HalfCylinder halfCylinder() const
Definition: PixelEndcapName.h:42
PixelModuleName::v2x5
Definition: PixelModuleName.h:14
PixelEndcapName::pannelName
int pannelName() const
pannel id
Definition: PixelEndcapName.h:51
PixelEndcapName::bladeName
int bladeName() const
blade id
Definition: PixelEndcapName.h:48
PixelModuleName::v1x5
Definition: PixelModuleName.h:14
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
PixelEndcapLinkMaker::Names
std::vector< PixelModuleName * > Names
Definition: PixelEndcapLinkMaker.h:20
PixelEndcapName
Definition: PixelEndcapName.h:16
sipixelobjects
Definition: CablingPathToDetUnit.h:4
PixelModuleName::ModuleType
ModuleType
Definition: PixelModuleName.h:14
PixelModuleName::v1x2
Definition: PixelModuleName.h:14
str
#define str(s)
Definition: TestProcessor.cc:52
TRange< int >
PixelModuleName.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
PixelROC.h
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
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
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
res
Definition: Electron.h:6
sipixelobjects::PixelROC
Definition: PixelROC.h:23
std
Definition: JetResolutionObject.h:76
PixelEndcapName::diskName
int diskName() const
disk id
Definition: PixelEndcapName.h:45
ztail.d
d
Definition: ztail.py:151
mps_fire.result
result
Definition: mps_fire.py:311
PixelEndcapName::plaquetteName
int plaquetteName() const
plaquetteId (in pannel)
Definition: PixelEndcapName.h:54
PixelEndcapLinkMaker::Links
PixelFEDCabling::Links Links
Definition: PixelEndcapLinkMaker.h:22
MetAnalyzer.u2
u2
Definition: MetAnalyzer.py:61
PixelEndcapLinkMaker::links
Links links(const Names &n, const DetUnits &u) const
Definition: PixelEndcapLinkMaker.cc:40
PixelEndcapLinkMaker::Order::operator()
bool operator()(const Item &, const Item &) const
Definition: PixelEndcapLinkMaker.cc:11
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
PixelEndcapName.h
PixelEndcapLinkMaker::Item
Definition: PixelEndcapLinkMaker.h:44