CMS 3D CMS Logo

PixelFEDLink.cc
Go to the documentation of this file.
5 
6 #include <sstream>
7 
8 using namespace std;
9 using namespace sipixelobjects;
10 
11 void PixelFEDLink::addItem(const PixelROC& roc) {
12  // INFO roc numbering vs vector has offset=1
13  if (roc.idInLink() > theROCs.size())
14  theROCs.resize(roc.idInLink());
15  theROCs[roc.idInLink() - 1] = roc;
16 }
17 
18 bool PixelFEDLink::checkRocNumbering() const {
19  bool result = true;
20  unsigned int idx_expected = 0;
21  typedef ROCs::const_iterator CIR;
22  for (CIR it = theROCs.begin(); it != theROCs.end(); it++) {
23  idx_expected++;
24  if (idx_expected != (*it).idInLink()) {
25  result = false;
26  cout << "** PixelFEDLink, idInLink in ROC, expected: " << idx_expected << " has: " << (*it).idInLink() << endl;
27  }
28  }
29  return result;
30 }
31 
32 void PixelFEDLink::add(const ROCs& rocs) { theROCs.insert(theROCs.end(), rocs.begin(), rocs.end()); }
33 
34 string PixelFEDLink::print(int depth) const {
35  ostringstream out;
36  // if (id() < 0) return out.str(); // id() >= 0, since it returns an unsigned
37 
38  if (depth-- >= 0) {
39  if (id() < 10)
40  out << " LNK: " << id();
41  else
42  out << " LNK: " << id();
43  if (depth == 0)
44  out << printForMap();
45  else {
46  out << endl;
47  typedef ROCs::const_iterator CIR;
48  for (CIR ir = theROCs.begin(); ir != theROCs.end(); ir++)
49  out << (ir)->print(depth);
50  out << "# total number of ROCs: " << numberOfROCs() << endl;
51  }
52  }
53  return out.str();
54 }
55 
56 string PixelFEDLink::printForMap() const {
57  typedef ROCs::const_iterator CIR;
58  ostringstream out;
59 
60  // barrel
61  {
62  int minroc = 9999;
63  int maxroc = -1;
64  bool first = true;
65  PixelBarrelName prev;
66  for (CIR ir = theROCs.begin(); ir < theROCs.end(); ir++) {
67  DetId detid = DetId(ir->rawId());
68  bool barrel = PixelModuleName::isBarrel(detid.rawId());
69  if (!barrel)
70  continue;
71  PixelBarrelName curr(detid);
72  if (first)
73  prev = curr;
74 
75  int idRoc = ir->idInDetUnit();
76  if (curr == prev) {
77  minroc = min(idRoc, minroc);
78  maxroc = max(idRoc, maxroc);
79  }
80 
81  if (!(curr == prev)) {
82  out << " MOD: " << prev.name() << " ROC: " << minroc << ", " << maxroc << std::endl;
83  prev = curr;
84  maxroc = minroc = idRoc;
85  // minroc = idRoc;
86  // maxroc = idRoc;
87  }
88 
89  if (ir == theROCs.end() - 1) {
90  out << " MOD: " << curr.name() << " ROC: " << minroc << ", " << maxroc << std::endl;
91  }
92  }
93  }
94 
95  // same for endcpap
96  {
97  bool first = true;
98  PixelEndcapName prev;
99  for (CIR ir = theROCs.begin(); ir < theROCs.end(); ir++) {
100  DetId detid = DetId(ir->rawId());
101  bool barrel = PixelModuleName::isBarrel(detid.rawId());
102  if (barrel)
103  continue;
104  PixelEndcapName tmp(detid);
105  PixelEndcapName curr(tmp.halfCylinder(), tmp.diskName(), tmp.bladeName(), tmp.pannelName());
106  if (first)
107  prev = curr;
108  if (!(curr == prev))
109  out << " MOD: " << prev.name() << std::endl;
110  if (ir == theROCs.end() - 1)
111  out << " MOD: " << curr.name() << std::endl;
112  }
113  }
114  return out.str();
115 }
PixelMapPlotter.rocs
rocs
Definition: PixelMapPlotter.py:497
PixelBarrelName.h
Reference_intrackfit_cff.barrel
list barrel
Definition: Reference_intrackfit_cff.py:37
min
T min(T a, T b)
Definition: MathUtil.h:58
gather_cfg.cout
cout
Definition: gather_cfg.py:144
PixelBarrelName
Definition: PixelBarrelName.h:16
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
dqmdumpme.first
first
Definition: dqmdumpme.py:55
DetId
Definition: DetId.h:17
PixelBarrelName::name
std::string name() const override
from base class
Definition: PixelBarrelName.cc:731
PixelEndcapName
Definition: PixelEndcapName.h:16
sipixelobjects
Definition: CablingPathToDetUnit.h:4
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
PVValHelper::add
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
Definition: PVValidationHelpers.cc:12
PixelModuleName::isBarrel
virtual bool isBarrel() const
true for barrel modules
Definition: PixelModuleName.h:20
sipixelobjects::PixelROC
Definition: PixelROC.h:23
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
DetId.h
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
PixelMapPlotter.roc
roc
Definition: PixelMapPlotter.py:498
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
mps_fire.result
result
Definition: mps_fire.py:311
PixelEndcapName::name
std::string name() const override
from base class
Definition: PixelEndcapName.cc:365
PixelEndcapName.h