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