CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SiStripRegionCabling.cc
Go to the documentation of this file.
4 
5 using namespace sistrip;
6 
7 SiStripRegionCabling::SiStripRegionCabling(const uint32_t etadivisions,
8  const uint32_t phidivisions,
9  const double etamax)
10  :
11 
12  etadivisions_(static_cast<int>(etadivisions)),
13  phidivisions_(static_cast<int>(phidivisions)),
14  etamax_(etamax),
15  regioncabling_()
16 
17 {}
18 
20  int eta = static_cast<int>((position.first + etamax_) * etadivisions_ / (2. * etamax_));
21  int phi = static_cast<int>((position.second + M_PI) * phidivisions_ / (2. * M_PI));
22  return PositionIndex(static_cast<uint32_t>(eta), static_cast<uint32_t>(phi));
23 }
24 
25 const uint32_t SiStripRegionCabling::region(const Position position) const {
26  PositionIndex index = positionIndex(position);
27  return region(index);
28 }
29 
31  int deta,
32  int dphi) const {
33  int eta = static_cast<int>(index.first) + deta;
34  if (eta > etadivisions_ - 1)
35  eta = etadivisions_ - 1;
36  else if (eta < 0)
37  eta = 0;
38 
39  int phi = static_cast<int>(index.second) + dphi;
40  while (phi < 0)
41  phi += phidivisions_;
42  while (phi > phidivisions_ - 1)
43  phi -= phidivisions_;
44 
45  return PositionIndex(static_cast<uint32_t>(eta), static_cast<uint32_t>(phi));
46 }
47 
49  DetId detectorId = DetId(detid);
50  if (detectorId.subdetId() == StripSubdetector::TIB)
51  return TIB;
52  else if (detectorId.subdetId() == StripSubdetector::TID)
53  return TID;
54  else if (detectorId.subdetId() == StripSubdetector::TOB)
55  return TOB;
56  else if (detectorId.subdetId() == StripSubdetector::TEC)
57  return TEC;
58  else
59  return ALLSUBDETS;
60 }
61 
62 // -----------------------------------------------------------------------------
63 //
64 void SiStripRegionCabling::print(std::stringstream &ss) const {
65  uint32_t valid = 0;
66  uint32_t total = 0;
67  ss << "[SiStripRegionCabling::" << __func__ << "] Printing REGION cabling:" << std::endl;
68  ss << "Printing cabling for " << regioncabling_.size() << " regions" << std::endl;
69  Cabling::const_iterator id = regioncabling_.begin();
70  Cabling::const_iterator jd = regioncabling_.end();
71  for (; id != jd; ++id) {
72  ss << "Printing cabling for " << id->size() << " regions for partition "
73  << static_cast<int32_t>(id - regioncabling_.begin()) << std::endl;
74  RegionCabling::const_iterator ir = id->begin();
75  RegionCabling::const_iterator jr = id->end();
76  for (; ir != jr; ++ir) {
77  ss << "Printing cabling for " << ir->size() << " wedges for region " << static_cast<int32_t>(ir - id->begin())
78  << std::endl;
79  WedgeCabling::const_iterator iw = ir->begin();
80  WedgeCabling::const_iterator jw = ir->end();
81  for (; iw != jw; ++iw) {
82  ss << "Printing cabling for " << iw->size() << " elements for wedge " << static_cast<int32_t>(iw - ir->begin())
83  << std::endl;
84  ElementCabling::const_iterator ie = iw->begin();
85  ElementCabling::const_iterator je = iw->end();
86  for (; ie != je; ++ie) {
87  ss << "Printing cabling for " << ie->second.size() << " connections for element (DetId) " << ie->first
88  << std::endl;
89  std::vector<FedChannelConnection>::const_iterator ic = ie->second.begin();
90  std::vector<FedChannelConnection>::const_iterator jc = ie->second.end();
91  for (; ic != jc; ++ic) {
92  if (ic->isConnected()) {
93  valid++;
94  }
95  total++;
96  ic->print(ss);
97  ss << std::endl;
98  }
99  }
100  }
101  }
102  }
103  ss << "Number of connected: " << valid << std::endl << "Number of connections: " << total << std::endl;
104 }
static constexpr auto TEC
void print(std::stringstream &) const
std::pair< uint32_t, uint32_t > PositionIndex
uint16_t *__restrict__ id
const PositionIndex positionIndex(const uint32_t) const
static const SubDet subdetFromDetId(const uint32_t detid)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
#define M_PI
Definition: DetId.h:17
static constexpr auto TIB
std::pair< double, double > Position
const uint32_t region(const Position) const
static int position[264][3]
Definition: ReadPGInfo.cc:289
PositionIndex increment(const PositionIndex, int, int) const
static constexpr auto TID