CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripRegionCabling.cc
Go to the documentation of this file.
7 
8 using namespace sistrip;
9 
10 SiStripRegionCabling::SiStripRegionCabling(const uint32_t etadivisions, const uint32_t phidivisions, const double etamax) :
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 
32  int eta = static_cast<int>(index.first)+deta;
33  if (eta > etadivisions_-1) eta = etadivisions_-1;
34  else if (eta < 0) eta = 0;
35 
36  int phi = static_cast<int>(index.second)+dphi;
37  while (phi<0) phi+=phidivisions_;
38  while (phi>phidivisions_-1) phi-=phidivisions_;
39 
40  return PositionIndex(static_cast<uint32_t>(eta),static_cast<uint32_t>(phi));
41 }
42 
44 
46  if (subdet == 3) return TIB;
47  else if (subdet == 4) return TID;
48  else if (subdet == 5) return TOB;
49  else if (subdet == 6) return TEC;
50  else return ALLSUBDETS;
51 }
52 
53 const uint32_t SiStripRegionCabling::layerFromDetId(const uint32_t detid) {
54 
56  if (subdet == TIB) return TIBDetId(detid).layer();
57  else if (subdet == TID) return TIDDetId(detid).wheel();
58  else if (subdet == TOB) return TOBDetId(detid).layer();
59  else if (subdet == TEC) return TECDetId(detid).wheel();
60  else return ALLLAYERS;
61 }
62 
63 const uint32_t SiStripRegionCabling::physicalLayerFromDetId(const uint32_t detid) {
64  return physicalLayer(subdetFromDetId(detid),layerFromDetId(detid));
65 }
66 
67 const uint32_t SiStripRegionCabling::physicalLayer(const SubDet subdet, const uint32_t layer) {
68 
69  if (subdet == TIB) return layer;
70  else if (subdet == TOB) return TIBLAYERS + layer;
71  else if (subdet == TID) return layer;
72  else if (subdet == TEC) return TIDLAYERS + layer;
73  else return ALLLAYERS;
74 }
75 
76 // -----------------------------------------------------------------------------
77 //
78 void SiStripRegionCabling::print( std::stringstream& ss ) const {
79  uint32_t valid = 0;
80  uint32_t total = 0;
81  ss << "[SiStripRegionCabling::" << __func__ << "] Printing REGION cabling:" << std::endl;
82  ss << "Printing cabling for " << regioncabling_.size() << " regions" << std::endl;
83  Cabling::const_iterator id = regioncabling_.begin();
84  Cabling::const_iterator jd = regioncabling_.end();
85  for ( ; id != jd; ++id ) {
86  ss << "Printing cabling for " << id->size()
87  << " regions for partition " << static_cast<int32_t>( id - regioncabling_.begin() )
88  << std::endl;
89  RegionCabling::const_iterator ir = id->begin();
90  RegionCabling::const_iterator jr = id->end();
91  for ( ; ir != jr; ++ir ) {
92  ss << "Printing cabling for " << ir->size()
93  << " wedges for region " << static_cast<int32_t>( ir - id->begin() )
94  << std::endl;
95  WedgeCabling::const_iterator iw = ir->begin();
96  WedgeCabling::const_iterator jw = ir->end();
97  for ( ; iw != jw; ++iw ) {
98  ss << "Printing cabling for " << iw->size()
99  << " elements for wedge " << static_cast<int32_t>( iw - ir->begin() )
100  << std::endl;
101  ElementCabling::const_iterator ie = iw->begin();
102  ElementCabling::const_iterator je = iw->end();
103  for ( ; ie != je; ++ie ) {
104  ss << "Printing cabling for " << ie->second.size()
105  << " connections for element (DetId) " << ie->first
106  << std::endl;
107  std::vector<FedChannelConnection>::const_iterator ic = ie->second.begin();
108  std::vector<FedChannelConnection>::const_iterator jc = ie->second.end();
109  for ( ; ic != jc; ++ic ) {
110  if ( ic->isConnected() ) { valid++; }
111  total++;
112  ic->print(ss);
113  ss << std::endl;
114  }
115  }
116  }
117  }
118  }
119  ss << "Number of connected: " << valid << std::endl
120  << "Number of connections: " << total << std::endl;
121 }
122 
123 
void print(std::stringstream &) const
static const uint32_t physicalLayer(const SubDet, const uint32_t layer)
unsigned int layer() const
layer id
Definition: TOBDetId.h:39
const PositionIndex positionIndex(const uint32_t) const
T eta() const
static const uint32_t physicalLayerFromDetId(const uint32_t detid)
static const SubDet subdet(const ElementIndex)
static const SubDet subdetFromDetId(const uint32_t detid)
std::pair< double, double > Position
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
SubDetector subDetector() const
Definition: SiStripDetId.h:114
#define M_PI
Definition: BFit3D.cc:3
static const uint32_t layerFromDetId(const uint32_t detid)
unsigned int wheel() const
wheel id
Definition: TECDetId.h:52
unsigned int layer() const
layer id
Definition: TIBDetId.h:41
const uint32_t region(const Position) const
static int position[264][3]
Definition: ReadPGInfo.cc:509
PositionIndex increment(const PositionIndex, int, int) const
std::pair< uint32_t, uint32_t > PositionIndex
static const uint32_t layer(const ElementIndex)
unsigned int wheel() const
wheel id
Definition: TIDDetId.h:50
Definition: DDAxes.h:10