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 layerFromDetId (const uint32_t detid)
 
static const uint32_t physicalLayer (const SubDet, const uint32_t layer)
 
static const uint32_t physicalLayerFromDetId (const uint32_t detid)
 
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 25 of file SiStripRegionCabling.h.

Member Typedef Documentation

Definition at line 38 of file SiStripRegionCabling.h.

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

Cabling typedefs

Definition at line 34 of file SiStripRegionCabling.h.

Definition at line 35 of file SiStripRegionCabling.h.

Encoded information typedefs

Definition at line 47 of file SiStripRegionCabling.h.

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

Position typedefs

Definition at line 42 of file SiStripRegionCabling.h.

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

Definition at line 43 of file SiStripRegionCabling.h.

Definition at line 37 of file SiStripRegionCabling.h.

Definition at line 36 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 10 of file SiStripRegionCabling.cc.

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

Definition at line 51 of file SiStripRegionCabling.h.

51 {}
SiStripRegionCabling::SiStripRegionCabling ( )
inlineprivate

Definition at line 131 of file SiStripRegionCabling.h.

131 {;}

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 181 of file SiStripRegionCabling.h.

References ALLLAYERS, ALLSUBDETS, and layer().

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

181  {
183 }
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 185 of file SiStripRegionCabling.h.

References elementIndex(), and region().

185  {
187 }
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 189 of file SiStripRegionCabling.h.

References elementIndex(), and region().

189  {
191 }
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 152 of file SiStripRegionCabling.h.

References etadivisions_.

152  {
153  return static_cast<uint32_t>(etadivisions_);
154 }
const SiStripRegionCabling::Cabling & SiStripRegionCabling::getRegionCabling ( ) const
inline

Definition at line 148 of file SiStripRegionCabling.h.

References regioncabling_.

148  {
149  return regioncabling_;
150 }
SiStripRegionCabling::PositionIndex SiStripRegionCabling::increment ( const PositionIndex  index,
int  deta,
int  dphi 
) const

Method for incrementing position index.

Definition at line 30 of file SiStripRegionCabling.cc.

References eta(), etadivisions_, phi, and phidivisions_.

Referenced by updateSiStripRefGetter().

30  {
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 }
T eta() const
std::pair< uint32_t, uint32_t > PositionIndex
Definition: DDAxes.h:10
const uint32_t SiStripRegionCabling::layer ( const ElementIndex  index)
inlinestatic
const uint32_t SiStripRegionCabling::layerFromDetId ( const uint32_t  detid)
static

Definition at line 53 of file SiStripRegionCabling.cc.

References ALLLAYERS, TOBDetId::layer(), TIBDetId::layer(), subdet(), subdetFromDetId(), TEC, TIB, TID, TOB, TIDDetId::wheel(), and TECDetId::wheel().

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

53  {
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 }
unsigned int layer() const
layer id
Definition: TOBDetId.h:39
static const SubDet subdet(const ElementIndex)
static const SubDet subdetFromDetId(const uint32_t detid)
unsigned int wheel() const
wheel id
Definition: TECDetId.h:52
unsigned int layer() const
layer id
Definition: TIBDetId.h:41
unsigned int wheel() const
wheel id
Definition: TIDDetId.h:50
const uint32_t SiStripRegionCabling::phidivisions ( ) const
inline

Definition at line 156 of file SiStripRegionCabling.h.

References phidivisions_.

156  {
157  return static_cast<uint32_t>(phidivisions_);
158 }
const uint32_t SiStripRegionCabling::physicalLayer ( const SubDet  subdet,
const uint32_t  layer 
)
static
const uint32_t SiStripRegionCabling::physicalLayerFromDetId ( const uint32_t  detid)
static

Definition at line 63 of file SiStripRegionCabling.cc.

References layerFromDetId(), physicalLayer(), and subdetFromDetId().

63  {
65 }
static const uint32_t physicalLayer(const SubDet, const uint32_t layer)
static const SubDet subdetFromDetId(const uint32_t detid)
static const uint32_t layerFromDetId(const uint32_t detid)
const SiStripRegionCabling::Position SiStripRegionCabling::position ( const uint32_t  region) const
inline

Definition at line 164 of file SiStripRegionCabling.h.

References cmsHarvester::index, and positionIndex().

Referenced by updateSiStripRefGetter().

164  {
166  return position(index);
167 }
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 169 of file SiStripRegionCabling.h.

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

169  {
170  return Position(regionDimensions().first*(index.first+.5) - etamax_, regionDimensions().second*(index.second+.5)- M_PI);
171 }
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 173 of file SiStripRegionCabling.h.

References phidivisions_.

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

173  {
175 }
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 19 of file SiStripRegionCabling.cc.

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

19  {
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 }
T eta() const
#define M_PI
const Position position(const uint32_t) const
std::pair< uint32_t, uint32_t > PositionIndex
Definition: DDAxes.h:10
void SiStripRegionCabling::print ( std::stringstream &  ss) const

Definition at line 78 of file SiStripRegionCabling.cc.

References regioncabling_, pileupDistInMC::total, and TrackValidation_HighPurity_cff::valid.

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

Definition at line 25 of file SiStripRegionCabling.cc.

References cmsHarvester::index, and positionIndex().

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

25  {
27  return region(index);
28 }
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 177 of file SiStripRegionCabling.h.

References phidivisions_.

177  {
178  return index.first*phidivisions_ + index.second;
179 }
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 160 of file SiStripRegionCabling.h.

References etadivisions_, etamax_, M_PI, and phidivisions_.

Referenced by position(), and updateSiStripRefGetter().

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

Set and get methods for cabling.

Definition at line 144 of file SiStripRegionCabling.h.

References regioncabling_.

Referenced by SiStripRegionConnectivity::produceRegionCabling().

144  {
145  regioncabling_ = regioncabling;
146 }
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 43 of file SiStripRegionCabling.cc.

References ALLSUBDETS, subdet(), SiStripDetId::subDetector(), TEC, TIB, TID, and TOB.

Referenced by layerFromDetId(), physicalLayerFromDetId(), and SiStripRegionConnectivity::produceRegionCabling().

43  {
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 }
static const SubDet subdet(const ElementIndex)
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
SubDetector subDetector() const
Definition: SiStripDetId.h:114
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 206 of file SiStripRegionCabling.h.

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

206  {
207  if (!refgetter.find(index)) refgetter.push_back(lazygetter,index);
208 }
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 211 of file SiStripRegionCabling.h.

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

211  {
212 
214  Position center = position(index);
215  double offeta = pos.first-center.first;
216  double offphi = pos.second-center.second;
217  double toteta = deltaeta/regionDimensions().first;
218  double totphi = deltaphi/regionDimensions().second;
219  uint32_t plueta = static_cast<uint32_t>(offeta+.5+toteta);
220  uint32_t pluphi = static_cast<uint32_t>(offphi+.5+totphi);
221  uint32_t mineta = static_cast<uint32_t>(-offeta+.5+toteta);
222  uint32_t minphi = static_cast<uint32_t>(-offphi+.5+totphi);
223 
224  for (uint32_t i=0;i<mineta+plueta+1;i++) {
225  for (uint32_t j=0;j<minphi+pluphi+1;j++) {
226  const uint32_t k=elementIndex(increment(index,i-mineta,j-minphi),sub,layer);
227  updateSiStripRefGetter<T>(refgetter,lazygetter,k);
228  }
229  }
230 }
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 134 of file SiStripRegionCabling.h.

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

double SiStripRegionCabling::etamax_
private

Tracker extent in eta

Definition at line 138 of file SiStripRegionCabling.h.

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

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

Cabling

Definition at line 141 of file SiStripRegionCabling.h.

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