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::map< uint32_t,
std::vector
< FedChannelConnection > > 
ElementCabling
 
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 37 of file SiStripRegionCabling.h.

typedef std::map< uint32_t, std::vector<FedChannelConnection> > SiStripRegionCabling::ElementCabling

Cabling typedefs

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

50 {}
SiStripRegionCabling::SiStripRegionCabling ( )
inlineprivate

Definition at line 130 of file SiStripRegionCabling.h.

130 {;}

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

References ALLLAYERS, ALLSUBDETS, and layer().

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

180  {
182 }
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 184 of file SiStripRegionCabling.h.

References elementIndex(), and region().

184  {
186 }
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 188 of file SiStripRegionCabling.h.

References elementIndex(), and region().

188  {
190 }
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 151 of file SiStripRegionCabling.h.

References etadivisions_.

151  {
152  return static_cast<uint32_t>(etadivisions_);
153 }
const SiStripRegionCabling::Cabling & SiStripRegionCabling::getRegionCabling ( ) const
inline
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 OnDemandMeasurementTracker::OnDemandMeasurementTracker(), 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 155 of file SiStripRegionCabling.h.

References phidivisions_.

155  {
156  return static_cast<uint32_t>(phidivisions_);
157 }
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 163 of file SiStripRegionCabling.h.

References getHLTprescales::index, and positionIndex().

Referenced by OnDemandMeasurementTracker::dumpRegion(), OnDemandMeasurementTracker::OnDemandMeasurementTracker(), and updateSiStripRefGetter().

163  {
165  return position(index);
166 }
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 168 of file SiStripRegionCabling.h.

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

168  {
169  return Position(regionDimensions().first*(index.first+.5) - etamax_, regionDimensions().second*(index.second+.5)- M_PI);
170 }
const std::pair< double, double > regionDimensions() const
U second(std::pair< T, U > const &p)
std::pair< double, double > Position
bool first
Definition: L1TdeRCT.cc:79
#define M_PI
Definition: BFit3D.cc:3
const SiStripRegionCabling::PositionIndex SiStripRegionCabling::positionIndex ( const uint32_t  region) const
inline
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
const Position position(const uint32_t) const
#define M_PI
Definition: BFit3D.cc:3
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 getHLTprescales::index, and positionIndex().

Referenced by OnDemandMeasurementTracker::dumpRegion(), elementIndex(), sistrip::RawToClustersLazyUnpacker::fill(), OnDemandMeasurementTracker::OnDemandMeasurementTracker(), 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 176 of file SiStripRegionCabling.h.

References phidivisions_.

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

References etadivisions_, etamax_, M_PI, and phidivisions_.

Referenced by position(), and updateSiStripRefGetter().

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

Set and get methods for cabling.

Definition at line 143 of file SiStripRegionCabling.h.

References regioncabling_.

Referenced by SiStripRegionConnectivity::produceRegionCabling().

143  {
144  regioncabling_ = regioncabling;
145 }
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(), OnDemandMeasurementTracker::OnDemandMeasurementTracker(), 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:102
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 205 of file SiStripRegionCabling.h.

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

Referenced by SiStripRawToClustersRoI::bjets(), OnDemandMeasurementTracker::define(), SiStripRawToClustersRoI::electrons(), SiStripRawToClustersRoI::muons(), SiStripRawToClustersRoI::random(), and SiStripRawToClustersRoI::taujets().

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

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

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

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

double SiStripRegionCabling::etamax_
private

Tracker extent in eta

Definition at line 137 of file SiStripRegionCabling.h.

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

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

Cabling

Definition at line 140 of file SiStripRegionCabling.h.

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