CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

SiStripRegionCabling Class Reference

#include <SiStripRegionCabling.h>

List of all members.

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 Position position, const double deltaeta, const double deltaphi, const SubDet subdet, const uint32_t layer) const
template<class T >
void updateSiStripRefGetter (edm::RefGetter< T > &refgetter, const edm::Handle< edm::LazyGetter< T > > &lazygetter, const ElementIndex) 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

Enumerator:
TIBLAYERS 
TOBLAYERS 
TIDLAYERS 
TECLAYERS 
ALLLAYERS 

Definition at line 31 of file SiStripRegionCabling.h.

{TIBLAYERS = 4, TOBLAYERS = 6, TIDLAYERS = 3, TECLAYERS = 9, ALLLAYERS = 10}; 

enums

Enumerator:
TIB 
TOB 
TID 
TEC 
ALLSUBDETS 

Definition at line 30 of file SiStripRegionCabling.h.

{TIB = 0, TOB = 1, TID = 2, TEC = 3, ALLSUBDETS = 4}; 

Constructor & Destructor Documentation

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

Definition at line 10 of file SiStripRegionCabling.cc.

                                                                                                                        :

  etadivisions_(static_cast<int>(etadivisions)),
  phidivisions_(static_cast<int>(phidivisions)),
  etamax_(etamax),
  regioncabling_()

{}
SiStripRegionCabling::~SiStripRegionCabling ( ) [inline]

Definition at line 50 of file SiStripRegionCabling.h.

{}
SiStripRegionCabling::SiStripRegionCabling ( ) [inline, private]

Definition at line 130 of file SiStripRegionCabling.h.

{;}

Member Function Documentation

const uint32_t SiStripRegionCabling::elementIndex ( const uint32_t  region,
const SubDet  subdet,
const uint32_t  layer 
) [inline, static]
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().

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().

const uint32_t SiStripRegionCabling::etadivisions ( ) const [inline]

Definition at line 151 of file SiStripRegionCabling.h.

References etadivisions_.

                                                               {
  return static_cast<uint32_t>(etadivisions_);
}
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().

                                                                                                                     {
  
  int eta = static_cast<int>(index.first)+deta;
  if (eta > etadivisions_-1) eta = etadivisions_-1;
  else if (eta < 0) eta = 0;
 
  int phi = static_cast<int>(index.second)+dphi;
  while (phi<0) phi+=phidivisions_;
  while (phi>phidivisions_-1) phi-=phidivisions_;

  return PositionIndex(static_cast<uint32_t>(eta),static_cast<uint32_t>(phi));
}
const uint32_t SiStripRegionCabling::layer ( const ElementIndex  index) [inline, static]

Definition at line 192 of file SiStripRegionCabling.h.

References ALLLAYERS.

Referenced by elementIndex(), sistrip::RawToClustersLazyUnpacker::fill(), and physicalLayer().

                                                                      {
  return index%ALLLAYERS;
}
const uint32_t SiStripRegionCabling::layerFromDetId ( const uint32_t  detid) [static]
const uint32_t SiStripRegionCabling::phidivisions ( ) const [inline]

Definition at line 155 of file SiStripRegionCabling.h.

References phidivisions_.

                                                               {
  return static_cast<uint32_t>(phidivisions_);
}
const uint32_t SiStripRegionCabling::physicalLayer ( const SubDet  subdet,
const uint32_t  layer 
) [static]

Definition at line 67 of file SiStripRegionCabling.cc.

References ALLLAYERS, layer(), TEC, TIB, TIBLAYERS, TID, TIDLAYERS, and TOB.

Referenced by physicalLayerFromDetId().

                                                                                            {

  if (subdet == TIB) return layer;
  else if (subdet == TOB) return TIBLAYERS + layer;
  else if (subdet == TID) return layer;
  else if (subdet == TEC) return TIDLAYERS + layer;
  else return ALLLAYERS;
}
const uint32_t SiStripRegionCabling::physicalLayerFromDetId ( const uint32_t  detid) [static]
const SiStripRegionCabling::Position SiStripRegionCabling::position ( const uint32_t  region) const [inline]
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().

                                                                                                        {
  return Position(regionDimensions().first*(index.first+.5) - etamax_, regionDimensions().second*(index.second+.5)- M_PI);
}
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_.

                                                                                                         {
  int eta = static_cast<int>((position.first+etamax_)*etadivisions_/(2.*etamax_));
  int phi = static_cast<int>((position.second+M_PI)*phidivisions_/(2.*M_PI));
  return PositionIndex(static_cast<uint32_t>(eta),static_cast<uint32_t>(phi));
}
void SiStripRegionCabling::print ( std::stringstream &  ss) const

Definition at line 78 of file SiStripRegionCabling.cc.

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

                                                            {
  uint32_t valid = 0;
  uint32_t total = 0;
  ss << "[SiStripRegionCabling::" << __func__ << "] Printing REGION cabling:" << std::endl;
  ss << "Printing cabling for " << regioncabling_.size() << " regions" << std::endl;
  Cabling::const_iterator id = regioncabling_.begin();
  Cabling::const_iterator jd = regioncabling_.end();
  for ( ; id != jd; ++id ) {
    ss << "Printing cabling for " << id->size()
       << " regions for partition " << static_cast<int32_t>( id - regioncabling_.begin() )
       << std::endl;
    RegionCabling::const_iterator ir = id->begin();
    RegionCabling::const_iterator jr = id->end();
    for ( ; ir != jr; ++ir ) {
      ss << "Printing cabling for " << ir->size()
         << " wedges for region " << static_cast<int32_t>( ir - id->begin() )
         << std::endl;
      WedgeCabling::const_iterator iw = ir->begin();
      WedgeCabling::const_iterator jw = ir->end();
      for ( ; iw != jw; ++iw ) {
        ss << "Printing cabling for " << iw->size()
           << " elements for wedge " << static_cast<int32_t>( iw - ir->begin() )
           << std::endl;
        ElementCabling::const_iterator ie = iw->begin();
        ElementCabling::const_iterator je = iw->end();
        for ( ; ie != je; ++ie ) {
          ss << "Printing cabling for " << ie->second.size()
             << " connections for element (DetId) " << ie->first
             << std::endl;
          std::vector<FedChannelConnection>::const_iterator ic = ie->second.begin();
          std::vector<FedChannelConnection>::const_iterator jc = ie->second.end();
          for ( ; ic != jc; ++ic ) {
            if ( ic->isConnected() ) { valid++; }
            total++;
            ic->print(ss);
            ss << std::endl;
          }
        }
      }
    }
  }
  ss << "Number of connected:   " << valid << std::endl
     << "Number of connections: " << total << std::endl;
}
const uint32_t SiStripRegionCabling::region ( const PositionIndex  index) const [inline]

Definition at line 176 of file SiStripRegionCabling.h.

References phidivisions_.

                                                                                  {
  return index.first*phidivisions_ + index.second;
}
const uint32_t SiStripRegionCabling::region ( const ElementIndex  index) [inline, static]

Definition at line 200 of file SiStripRegionCabling.h.

References ALLLAYERS, and ALLSUBDETS.

                                                                       {
  return index/(ALLSUBDETS*ALLLAYERS);
}
const uint32_t SiStripRegionCabling::region ( const Position  position) const
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().

                                                                                 {
  return std::pair<double,double>((2.*etamax_)/etadivisions_,2.*M_PI/phidivisions_);
}
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().

                                                                               {
  regioncabling_ = regioncabling;
}
const SiStripRegionCabling::SubDet SiStripRegionCabling::subdet ( const ElementIndex  index) [inline, static]
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().

                                                                                           {

  SiStripDetId::SubDetector subdet = SiStripDetId(detid).subDetector();
  if (subdet == 3) return TIB;
  else if (subdet == 4) return TID;
  else if (subdet == 5) return TOB;
  else if (subdet == 6) return TEC;
  else return ALLSUBDETS;
}
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().

                                                                                                                                                                                                                                                                 {

  PositionIndex index = positionIndex(pos);
  Position center = position(index);
  double offeta = pos.first-center.first;
  double offphi = pos.second-center.second;
  double toteta = deltaeta/regionDimensions().first;
  double totphi = deltaphi/regionDimensions().second; 
  uint32_t plueta = static_cast<uint32_t>(offeta+.5+toteta);
  uint32_t pluphi = static_cast<uint32_t>(offphi+.5+totphi);
  uint32_t mineta = static_cast<uint32_t>(-offeta+.5+toteta);
  uint32_t minphi = static_cast<uint32_t>(-offphi+.5+totphi);
 
  for (uint32_t i=0;i<mineta+plueta+1;i++) {
    for (uint32_t j=0;j<minphi+pluphi+1;j++) {
      const uint32_t k=elementIndex(increment(index,i-mineta,j-minphi),sub,layer);
      updateSiStripRefGetter<T>(refgetter,lazygetter,k);
    }
  } 
}
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().

                                                                                                                                                         {
  if (!refgetter.find(index)) refgetter.push_back(lazygetter,index);
}

Member Data Documentation

Number of regions in eta,phi

Definition at line 133 of file SiStripRegionCabling.h.

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

Tracker extent in eta

Definition at line 137 of file SiStripRegionCabling.h.

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

Cabling

Definition at line 140 of file SiStripRegionCabling.h.

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