CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
SiStripRegionCabling Class Reference

#include <SiStripRegionCabling.h>

Public Types

typedef std::vector
< RegionCabling
Cabling
 
typedef std::pair< uint32_t,
std::vector
< FedChannelConnection > > 
Element
 
typedef std::vector< ElementElementCabling
 
typedef uint32_t ElementIndex
 
enum  Layer {
  TIBLAYERS = 4, TOBLAYERS = 6, TIDLAYERS = 3, TECLAYERS = 9,
  ALLLAYERS = 10
}
 
typedef std::pair< double, double > Position
 
typedef std::pair< uint32_t,
uint32_t > 
PositionIndex
 
typedef std::vector< WedgeCablingRegionCabling
 
enum  SubDet {
  TIB = 0, TOB = 1, TID = 2, TEC = 3,
  ALLSUBDETS = 4
}
 
typedef std::vector
< ElementCabling
WedgeCabling
 

Public Member Functions

const ElementIndex elementIndex (const PositionIndex, const SubDet, const uint32_t layer) const
 
const ElementIndex elementIndex (const Position, const SubDet, const uint32_t layer) const
 
const uint32_t etadivisions () const
 
const CablinggetRegionCabling () const
 
PositionIndex increment (const PositionIndex, int, int) const
 
const uint32_t phidivisions () const
 
const Position position (const uint32_t) const
 
const Position position (const PositionIndex) const
 
const PositionIndex positionIndex (const uint32_t) const
 
const PositionIndex positionIndex (const Position) const
 
void print (std::stringstream &) const
 
const uint32_t region (const Position) const
 
const uint32_t region (const PositionIndex) const
 
const std::pair< double, double > regionDimensions () const
 
void setRegionCabling (const Cabling &)
 
 SiStripRegionCabling (const uint32_t, const uint32_t, const double)
 
template<class T >
void updateSiStripRefGetter (edm::RefGetter< T > &refgetter, const edm::Handle< edm::LazyGetter< T > > &lazygetter, const ElementIndex) const
 
template<class T >
void updateSiStripRefGetter (edm::RefGetter< T > &refgetter, const edm::Handle< edm::LazyGetter< T > > &lazygetter, const Position position, const double deltaeta, const double deltaphi, const SubDet subdet, const uint32_t layer) const
 
 ~SiStripRegionCabling ()
 

Static Public Member Functions

static const ElementIndex elementIndex (const uint32_t region, const SubDet, const uint32_t layer)
 
static const uint32_t layer (const ElementIndex)
 
static const uint32_t region (const ElementIndex)
 
static const SubDet subdet (const ElementIndex)
 
static const SubDet subdetFromDetId (const uint32_t detid)
 

Private Member Functions

 SiStripRegionCabling ()
 

Private Attributes

int etadivisions_
 
double etamax_
 
int phidivisions_
 
Cabling regioncabling_
 

Detailed Description

Author: pwing Package: CalibFormats/SiStripObjects Class: SiStripRegionCabling Description: Gives a regional view of the silicon strip tracker cabling. Cabling is divided into (eta,phi) "regions". A "region" within a given sub-detector is called a "wedge". A layer within a given wedge is called an "element".

Definition at line 24 of file SiStripRegionCabling.h.

Member Typedef Documentation

Definition at line 37 of file SiStripRegionCabling.h.

typedef std::pair< uint32_t, std::vector<FedChannelConnection> > SiStripRegionCabling::Element

Cabling typedefs

Definition at line 33 of file SiStripRegionCabling.h.

Definition at line 34 of file SiStripRegionCabling.h.

Encoded information typedefs

Definition at line 46 of file SiStripRegionCabling.h.

typedef std::pair<double,double> SiStripRegionCabling::Position

Position typedefs

Definition at line 41 of file SiStripRegionCabling.h.

typedef std::pair<uint32_t,uint32_t> SiStripRegionCabling::PositionIndex

Definition at line 42 of file SiStripRegionCabling.h.

Definition at line 36 of file SiStripRegionCabling.h.

Definition at line 35 of file SiStripRegionCabling.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

SiStripRegionCabling::SiStripRegionCabling ( const uint32_t  etadivisions,
const uint32_t  phidivisions,
const double  etamax 
)

Definition at line 7 of file SiStripRegionCabling.cc.

7  :
8 
9  etadivisions_(static_cast<int>(etadivisions)),
10  phidivisions_(static_cast<int>(phidivisions)),
11  etamax_(etamax),
13 
14 {}
const uint32_t phidivisions() const
const uint32_t etadivisions() const
SiStripRegionCabling::~SiStripRegionCabling ( )
inline

Definition at line 50 of file SiStripRegionCabling.h.

50 {}
SiStripRegionCabling::SiStripRegionCabling ( )
inlineprivate

Definition at line 124 of file SiStripRegionCabling.h.

124 {;}

Member Function Documentation

const uint32_t SiStripRegionCabling::elementIndex ( const uint32_t  region,
const SubDet  subdet,
const uint32_t  layer 
)
inlinestatic

Methods for interchanging between region-subdet-layer and the corresponding element index.

Definition at line 174 of file SiStripRegionCabling.h.

References ALLLAYERS, ALLSUBDETS, and layer().

Referenced by elementIndex(), HITSiStripRawToClustersRoI::produce(), HITSiStripRawToClustersRoI::random(), and updateSiStripRefGetter().

174  {
176 }
static const SubDet subdet(const ElementIndex)
const uint32_t region(const Position) const
static const uint32_t layer(const ElementIndex)
const uint32_t SiStripRegionCabling::elementIndex ( const PositionIndex  index,
const SubDet  subdet,
const uint32_t  layer 
) const
inline

Definition at line 178 of file SiStripRegionCabling.h.

References elementIndex(), and region().

178  {
180 }
static const ElementIndex elementIndex(const uint32_t region, const SubDet, const uint32_t layer)
static const SubDet subdet(const ElementIndex)
const uint32_t region(const Position) const
static const uint32_t layer(const ElementIndex)
const uint32_t SiStripRegionCabling::elementIndex ( const Position  position,
const SubDet  subdet,
const uint32_t  layer 
) const
inline

Definition at line 182 of file SiStripRegionCabling.h.

References elementIndex(), and region().

182  {
184 }
static const ElementIndex elementIndex(const uint32_t region, const SubDet, const uint32_t layer)
static const SubDet subdet(const ElementIndex)
const Position position(const uint32_t) const
const uint32_t region(const Position) const
static const uint32_t layer(const ElementIndex)
const uint32_t SiStripRegionCabling::etadivisions ( ) const
inline

Definition at line 145 of file SiStripRegionCabling.h.

References etadivisions_.

145  {
146  return static_cast<uint32_t>(etadivisions_);
147 }
const SiStripRegionCabling::Cabling & SiStripRegionCabling::getRegionCabling ( ) const
inline

Definition at line 141 of file SiStripRegionCabling.h.

References regioncabling_.

141  {
142  return regioncabling_;
143 }
SiStripRegionCabling::PositionIndex SiStripRegionCabling::increment ( const PositionIndex  index,
int  deta,
int  dphi 
) const

Method for incrementing position index.

Definition at line 27 of file SiStripRegionCabling.cc.

References eta, etadivisions_, phi, and phidivisions_.

Referenced by updateSiStripRefGetter().

27  {
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 }
std::pair< uint32_t, uint32_t > PositionIndex
const uint32_t SiStripRegionCabling::layer ( const ElementIndex  index)
inlinestatic
const uint32_t SiStripRegionCabling::phidivisions ( ) const
inline

Definition at line 149 of file SiStripRegionCabling.h.

References phidivisions_.

149  {
150  return static_cast<uint32_t>(phidivisions_);
151 }
const SiStripRegionCabling::Position SiStripRegionCabling::position ( const uint32_t  region) const
inline

Definition at line 157 of file SiStripRegionCabling.h.

References cmsHarvester::index, and positionIndex().

Referenced by updateSiStripRefGetter().

157  {
159  return position(index);
160 }
const PositionIndex positionIndex(const uint32_t) const
const Position position(const uint32_t) const
const uint32_t region(const Position) const
std::pair< uint32_t, uint32_t > PositionIndex
const SiStripRegionCabling::Position SiStripRegionCabling::position ( const PositionIndex  index) const
inline

Definition at line 162 of file SiStripRegionCabling.h.

References etamax_, plotBeamSpotDB::first, M_PI, regionDimensions(), and edm::second().

162  {
163  return Position(regionDimensions().first*(index.first+.5) - etamax_, regionDimensions().second*(index.second+.5)- M_PI);
164 }
const std::pair< double, double > regionDimensions() const
U second(std::pair< T, U > const &p)
std::pair< double, double > Position
#define M_PI
const SiStripRegionCabling::PositionIndex SiStripRegionCabling::positionIndex ( const uint32_t  region) const
inline

Definition at line 166 of file SiStripRegionCabling.h.

References phidivisions_.

Referenced by position(), region(), and updateSiStripRefGetter().

166  {
168 }
const uint32_t region(const Position) const
std::pair< uint32_t, uint32_t > PositionIndex
const SiStripRegionCabling::PositionIndex SiStripRegionCabling::positionIndex ( const Position  position) const

Definition at line 16 of file SiStripRegionCabling.cc.

References eta, etadivisions_, etamax_, M_PI, phi, and phidivisions_.

16  {
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 }
#define M_PI
const Position position(const uint32_t) const
std::pair< uint32_t, uint32_t > PositionIndex
void SiStripRegionCabling::print ( std::stringstream &  ss) const

Definition at line 51 of file SiStripRegionCabling.cc.

References regioncabling_, and pileupDistInMC::total.

51  {
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 }
const uint32_t SiStripRegionCabling::region ( const Position  position) const

Definition at line 22 of file SiStripRegionCabling.cc.

References cmsHarvester::index, and positionIndex().

Referenced by elementIndex(), and SiStripRegionConnectivity::produceRegionCabling().

22  {
24  return region(index);
25 }
const PositionIndex positionIndex(const uint32_t) const
const Position position(const uint32_t) const
const uint32_t region(const Position) const
std::pair< uint32_t, uint32_t > PositionIndex
const uint32_t SiStripRegionCabling::region ( const PositionIndex  index) const
inline

Definition at line 170 of file SiStripRegionCabling.h.

References phidivisions_.

170  {
171  return index.first*phidivisions_ + index.second;
172 }
const uint32_t SiStripRegionCabling::region ( const ElementIndex  index)
inlinestatic
const std::pair< double, double > SiStripRegionCabling::regionDimensions ( ) const
inline

Methods for interchanging between region, region-index and eta/phi-position.

Definition at line 153 of file SiStripRegionCabling.h.

References etadivisions_, etamax_, M_PI, and phidivisions_.

Referenced by position(), and updateSiStripRefGetter().

153  {
154  return std::pair<double,double>((2.*etamax_)/etadivisions_,2.*M_PI/phidivisions_);
155 }
#define M_PI
void SiStripRegionCabling::setRegionCabling ( const Cabling regioncabling)
inline

Set and get methods for cabling.

Definition at line 137 of file SiStripRegionCabling.h.

References regioncabling_.

Referenced by SiStripRegionConnectivity::produceRegionCabling().

137  {
138  regioncabling_ = regioncabling;
139 }
const SiStripRegionCabling::SubDet SiStripRegionCabling::subdet ( const ElementIndex  index)
inlinestatic
const SiStripRegionCabling::SubDet SiStripRegionCabling::subdetFromDetId ( const uint32_t  detid)
static

Methods for extracting det-id information

Definition at line 40 of file SiStripRegionCabling.cc.

References ALLSUBDETS, DetId::subdetId(), StripSubdetector::TEC, TEC, StripSubdetector::TIB, TIB, StripSubdetector::TID, TID, StripSubdetector::TOB, and TOB.

Referenced by SiStripRegionConnectivity::produceRegionCabling().

40  {
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 }
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
template<class T >
void SiStripRegionCabling::updateSiStripRefGetter ( edm::RefGetter< T > &  refgetter,
const edm::Handle< edm::LazyGetter< T > > &  lazygetter,
const ElementIndex  index 
) const

Methods for updating a SiStripRefGetter<T> container with elements of interest

Definition at line 199 of file SiStripRegionCabling.h.

References edm::RefGetter< T >::find(), and edm::RefGetter< T >::push_back().

199  {
200  if (!refgetter.find(index)) refgetter.push_back(lazygetter,index);
201 }
void push_back(const edm::Handle< LazyGetter< T > > &, const uint32_t &)
Add a new region to the end of the collection.
Definition: RefGetter.h:110
bool find(uint32_t) const
Returns true if region already defined.
Definition: RefGetter.h:170
template<class T >
void SiStripRegionCabling::updateSiStripRefGetter ( edm::RefGetter< T > &  refgetter,
const edm::Handle< edm::LazyGetter< T > > &  lazygetter,
const Position  position,
const double  deltaeta,
const double  deltaphi,
const SubDet  subdet,
const uint32_t  layer 
) const

Definition at line 204 of file SiStripRegionCabling.h.

References elementIndex(), i, increment(), cmsHarvester::index, j, relval_steps::k, position(), positionIndex(), and regionDimensions().

204  {
205 
207  Position center = position(index);
208  double offeta = pos.first-center.first;
209  double offphi = pos.second-center.second;
210  double toteta = deltaeta/regionDimensions().first;
211  double totphi = deltaphi/regionDimensions().second;
212  uint32_t plueta = static_cast<uint32_t>(offeta+.5+toteta);
213  uint32_t pluphi = static_cast<uint32_t>(offphi+.5+totphi);
214  uint32_t mineta = static_cast<uint32_t>(-offeta+.5+toteta);
215  uint32_t minphi = static_cast<uint32_t>(-offphi+.5+totphi);
216 
217  for (uint32_t i=0;i<mineta+plueta+1;i++) {
218  for (uint32_t j=0;j<minphi+pluphi+1;j++) {
219  const uint32_t k=elementIndex(increment(index,i-mineta,j-minphi),sub,layer);
220  updateSiStripRefGetter<T>(refgetter,lazygetter,k);
221  }
222  }
223 }
static const ElementIndex elementIndex(const uint32_t region, const SubDet, const uint32_t layer)
const std::pair< double, double > regionDimensions() const
int i
Definition: DBlmapReader.cc:9
const PositionIndex positionIndex(const uint32_t) const
std::pair< double, double > Position
int j
Definition: DBlmapReader.cc:9
const Position position(const uint32_t) const
PositionIndex increment(const PositionIndex, int, int) const
std::pair< uint32_t, uint32_t > PositionIndex
static const uint32_t layer(const ElementIndex)

Member Data Documentation

int SiStripRegionCabling::etadivisions_
private

Number of regions in eta,phi

Definition at line 127 of file SiStripRegionCabling.h.

Referenced by etadivisions(), increment(), positionIndex(), and regionDimensions().

double SiStripRegionCabling::etamax_
private

Tracker extent in eta

Definition at line 131 of file SiStripRegionCabling.h.

Referenced by position(), positionIndex(), and regionDimensions().

int SiStripRegionCabling::phidivisions_
private
Cabling SiStripRegionCabling::regioncabling_
private

Cabling

Definition at line 134 of file SiStripRegionCabling.h.

Referenced by getRegionCabling(), print(), and setRegionCabling().