CMS 3D CMS Logo

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 {
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 
48 const SiStripRegionCabling::SubDet SiStripRegionCabling::subdetFromDetId(const uint32_t detid) {
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 }
SiStripRegionCabling::Position
std::pair< double, double > Position
Definition: SiStripRegionCabling.h:38
SiStripRegionCabling::print
void print(std::stringstream &) const
Definition: SiStripRegionCabling.cc:64
SiStripRegionCabling::increment
PositionIndex increment(const PositionIndex, int, int) const
Definition: SiStripRegionCabling.cc:30
SiStripRegionCabling::TOB
Definition: SiStripRegionCabling.h:26
SiStripRegionCabling::TID
Definition: SiStripRegionCabling.h:26
SiStripRegionCabling::positionIndex
const PositionIndex positionIndex(const uint32_t) const
Definition: SiStripRegionCabling.h:138
SiStripRegionCabling::position
const Position position(const uint32_t) const
Definition: SiStripRegionCabling.h:128
SiStripRegionCabling::ALLSUBDETS
Definition: SiStripRegionCabling.h:26
SiStripRegionCabling::phidivisions_
int phidivisions_
Definition: SiStripRegionCabling.h:107
typelookup.h
SiStripRegionCabling::TEC
Definition: SiStripRegionCabling.h:26
SiStripRegionCabling::SubDet
SubDet
Definition: SiStripRegionCabling.h:26
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
DetId
Definition: DetId.h:17
PVValHelper::eta
Definition: PVValidationHelpers.h:70
StripSubdetector::TIB
static constexpr auto TIB
Definition: StripSubdetector.h:16
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
SiStripRegionCabling::etamax_
double etamax_
Definition: SiStripRegionCabling.h:110
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
createfilelist.int
int
Definition: createfilelist.py:10
SiStripRegionCabling::SiStripRegionCabling
SiStripRegionCabling()
Definition: SiStripRegionCabling.h:103
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
SiStripRegionCabling::etadivisions_
int etadivisions_
Definition: SiStripRegionCabling.h:106
SiStripRegionCabling::TIB
Definition: SiStripRegionCabling.h:26
SiStripRegionCabling.h
DDAxes::phi
SiStripRegionCabling::region
const uint32_t region(const Position) const
Definition: SiStripRegionCabling.cc:25
StripSubdetector::TEC
static constexpr auto TEC
Definition: StripSubdetector.h:19
SiStripRegionCabling::regioncabling_
Cabling regioncabling_
Definition: SiStripRegionCabling.h:113
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
muonTiming_cfi.etamax
etamax
Definition: muonTiming_cfi.py:23
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
dqmMemoryStats.total
total
Definition: dqmMemoryStats.py:152
SiStripRegionCabling::PositionIndex
std::pair< uint32_t, uint32_t > PositionIndex
Definition: SiStripRegionCabling.h:39
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
sistrip
sistrip classes
Definition: EnsembleCalibrationLA.cc:10
StripSubdetector.h
StripSubdetector::TID
static constexpr auto TID
Definition: StripSubdetector.h:17