CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

Ring Class Reference

#include <Ring.h>

List of all members.

Public Types

typedef DetIdMap::const_iterator const_iterator
typedef std::pair
< const_iterator,
const_iterator
ConstIteratorRange
typedef std::multimap< double,
DetId
DetIdMap
typedef DetIdMap::iterator iterator
typedef std::pair< iterator,
iterator
IteratorRange
enum  type {
  TIBRing, TOBRing, TIDRing, TECRing,
  PXBRing, PXFRing, Unspecified
}

Public Member Functions

void addId (double phi, DetId id)
const_iterator begin () const
iterator begin ()
bool containsDetId (DetId id, double phi=999999., double dphi_scalefactor=1.5) const
std::string dump () const
const_iterator end () const
iterator end ()
DetIdMap getDetIdMap () const
DetId getFirst () const
unsigned int getindex () const
int getNumDetIds () const
float getrmax () const
float getrmin () const
type getType () const
float getzmax () const
float getzmin () const
void initialize (float rmin, float rmax, float zmin, float zmax)
bool isInitialized () const
const_iterator lower_bound (double phi) const
double map_phi (double phi) const
void notInitializedMsg () const
int operator!= (const Ring &ring) const
 inequality
int operator< (const Ring &ring) const
 comparison
int operator== (const Ring &ring) const
 equality
std::string print () const
 Ring (type input)
 Ring (unsigned int index, float rmin, float rmax, float zmin, float zmax, unsigned int type)
 Ring (Ring *input)
 Ring ()
void setindex (unsigned int input)
void setInitialized (bool input)
void setrmax (float input)
void setrmin (float input)
void setType (type input)
void setzmax (float input)
void setzmin (float input)
const_iterator upper_bound (double phi) const
 ~Ring ()

Private Attributes

DetIdMap detids_
unsigned int index_
bool initialized_
float rmax_
float rmin_
type type_
float zmax_
float zmin_

Detailed Description

Definition at line 31 of file Ring.h.


Member Typedef Documentation

typedef DetIdMap::const_iterator Ring::const_iterator

Definition at line 37 of file Ring.h.

Definition at line 39 of file Ring.h.

typedef std::multimap<double,DetId> Ring::DetIdMap

Definition at line 35 of file Ring.h.

typedef DetIdMap::iterator Ring::iterator

Definition at line 36 of file Ring.h.

Definition at line 38 of file Ring.h.


Member Enumeration Documentation

enum Ring::type
Enumerator:
TIBRing 
TOBRing 
TIDRing 
TECRing 
PXBRing 
PXFRing 
Unspecified 

Definition at line 41 of file Ring.h.


Constructor & Destructor Documentation

Ring::Ring ( ) [inline]

Definition at line 51 of file Ring.h.

         : initialized_(false), 
           rmin_(0.), 
           rmax_(0.), 
           zmin_(0.), 
           zmax_(0.), 
           type_(Unspecified), 
           index_(0) {}
Ring::Ring ( type  input) [inline]

Definition at line 59 of file Ring.h.

                   : initialized_(false), 
                     rmin_(0.), 
                     rmax_(0.), 
                     zmin_(0.), 
                     zmax_(0.), 
                     type_(input), 
                     index_(0) {}
Ring::Ring ( unsigned int  index,
float  rmin,
float  rmax,
float  zmin,
float  zmax,
unsigned int  type 
) [inline]

Definition at line 67 of file Ring.h.

References PXBRing, PXFRing, TECRing, TIBRing, TIDRing, TOBRing, type_, and Unspecified.

                          : initialized_(true), 
                            rmin_(rmin), 
                            rmax_(rmax), 
                            zmin_(zmin), 
                            zmax_(zmax), 
                            index_(index) {
    if ( type == 0 ) {
      type_ = TIBRing;
    } else if ( type == 1 ) {
      type_ = TOBRing;
    } else if ( type == 2 ) {
      type_ = TIDRing;
    } else if ( type == 3 ) {
      type_ = TECRing;
    } else if ( type == 4 ) {
      type_ = PXBRing;
    } else if ( type == 5 ) {
      type_ = PXFRing;
    } else {
      type_ = Unspecified;
    } 
  }
Ring::Ring ( Ring input) [inline]

Definition at line 95 of file Ring.h.

                    : detids_(input->getDetIdMap()), 
                      initialized_(input->isInitialized()), 
                      rmin_(input->getrmin()), 
                      rmax_(input->getrmax()), 
                      zmin_(input->getzmin()), 
                      zmax_(input->getzmax()), 
                      type_(input->getType()), 
                      index_(input->getindex()) {}
Ring::~Ring ( ) [inline]

Definition at line 104 of file Ring.h.

{}

Member Function Documentation

void Ring::addId ( double  phi,
DetId  id 
) [inline]
const_iterator Ring::begin ( void  ) const [inline]
iterator Ring::begin ( void  ) [inline]

Definition at line 150 of file Ring.h.

References detids_.

{ return detids_.begin(); }
bool Ring::containsDetId ( DetId  id,
double  phi = 999999.,
double  dphi_scalefactor = 1.5 
) const [inline]

Definition at line 110 of file Ring.h.

References kinem::delta_phi(), detids_, map_phi(), phi, pi, relativeConstraints::ring, and Geom::twoPi().

                                                                 {
    // calculate window around given phi (if phi == 999999. set window to [-pi,pi])
    // determine phi segmentation from number of detids in ring
    // window is += 1.5 times the phi segmentation
    double phi_inner = -Geom::pi();
    double phi_outer =  Geom::pi();
    double delta_phi = Geom::twoPi() / detids_.size();
    if ( phi != 999999. ) {
      phi_inner = map_phi(phi - dphi_scalefactor*delta_phi);
      phi_outer = map_phi(phi + dphi_scalefactor*delta_phi);
    }

    // check for out of bounds of [0,2pi]
    if ( phi_inner > phi_outer ) {
      // double loop
      for ( const_iterator ring = detids_.lower_bound(phi_inner); ring != detids_.end(); ++ring ) {
        if ( id == ring->second ) {
          return true;
        }
      }
      for ( const_iterator ring = detids_.begin(); ring != detids_.upper_bound(phi_outer); ++ring ) {
        if ( id == ring->second ) {
          return true;
        }
      }
    } else {
      for ( const_iterator ring = detids_.lower_bound(phi_inner); ring != detids_.upper_bound(phi_outer); ++ring ) {
        if ( id == ring->second ) {
          return true;
        }
      }
    }

    return false;
  }
std::string Ring::dump ( void  ) const [inline]

Definition at line 207 of file Ring.h.

References detids_, index_, rmax_, rmin_, type_, zmax_, and zmin_.

                                {
    std::ostringstream stream;
    stream << "### Ring with index: " << index_ << " ###" << std::endl;
    stream << index_
           << " " << rmin_
           << " " << rmax_
           << " " << zmin_
           << " " << zmax_ 
           << " " << type_ << std::endl;
    stream << detids_.size() << std::endl;
    for ( const_iterator entry = detids_.begin(); entry != detids_.end(); ++entry ) {
      stream << entry->first << " " << entry->second.rawId() << std::endl;
    }
    return stream.str();
  }
const_iterator Ring::end ( void  ) const [inline]
iterator Ring::end ( void  ) [inline]

Definition at line 151 of file Ring.h.

References detids_.

{ return detids_.end();   }
DetIdMap Ring::getDetIdMap ( ) const [inline]

Definition at line 187 of file Ring.h.

References detids_.

{ return detids_; }
DetId Ring::getFirst ( ) const [inline]

Definition at line 181 of file Ring.h.

References detids_.

Referenced by RoadMaker::RingInBarrel(), RoadSearchSeedFinderAlgorithm::ringsOnSameLayer(), and RoadMaker::RingsOnSameLayer().

{ return detids_.begin()->second; }
unsigned int Ring::getindex ( ) const [inline]
int Ring::getNumDetIds ( ) const [inline]
float Ring::getrmax ( ) const [inline]
float Ring::getrmin ( ) const [inline]
type Ring::getType ( void  ) const [inline]

Definition at line 179 of file Ring.h.

References type_.

{ return type_; }
float Ring::getzmax ( ) const [inline]
float Ring::getzmin ( ) const [inline]
void Ring::initialize ( float  rmin,
float  rmax,
float  zmin,
float  zmax 
) [inline]
bool Ring::isInitialized ( ) const [inline]

Definition at line 153 of file Ring.h.

References initialized_.

Referenced by getrmax(), getrmin(), getzmax(), and getzmin().

{ return initialized_; }
const_iterator Ring::lower_bound ( double  phi) const [inline]
double Ring::map_phi ( double  phi) const [inline]

Definition at line 226 of file Ring.h.

References phi, Geom::pi(), query::result, and Geom::twoPi().

Referenced by containsDetId().

                                          {
    // map phi to [-pi,pi]
    double result = phi;
    if ( result < -Geom::pi()) result += Geom::twoPi();
    if ( result >  Geom::pi()) result -= Geom::twoPi();
    return result;
  }
void Ring::notInitializedMsg ( ) const [inline]

Definition at line 174 of file Ring.h.

References index_.

Referenced by getrmax(), getrmin(), getzmax(), and getzmin().

                                        { 
    edm::LogWarning("RoadSearch") << "Ring " << index_ << " does not have initialized values for r_min, r_max, z_min, z_max! Using default value of 0. !"; }
int Ring::operator!= ( const Ring ring) const [inline]

inequality

Definition at line 192 of file Ring.h.

References getindex(), and index_.

{ return index_!=ring.getindex(); }
int Ring::operator< ( const Ring ring) const [inline]

comparison

Definition at line 194 of file Ring.h.

References getindex(), and index_.

{ return index_<ring.getindex(); }
int Ring::operator== ( const Ring ring) const [inline]

equality

Definition at line 190 of file Ring.h.

References getindex(), and index_.

{ return index_==ring.getindex(); }
std::string Ring::print ( void  ) const [inline]

Definition at line 196 of file Ring.h.

References detids_, index_, rmax_, rmin_, zmax_, and zmin_.

                                 {
    std::ostringstream stream;
    stream << "Ring: " << index_
           << " rmin: " << rmin_
           << " rmax: " << rmax_
           << " zmin: " << zmin_
           << " zmax: " << zmax_
           << " number of DetUnits: " << detids_.size();
    return stream.str();
  }
void Ring::setindex ( unsigned int  input) [inline]
void Ring::setInitialized ( bool  input) [inline]

Definition at line 165 of file Ring.h.

References initialized_, and collect_tpl::input.

void Ring::setrmax ( float  input) [inline]

Definition at line 161 of file Ring.h.

References collect_tpl::input, and rmax_.

{ rmax_ = input; }
void Ring::setrmin ( float  input) [inline]

Definition at line 160 of file Ring.h.

References collect_tpl::input, and rmin_.

{ rmin_ = input; }
void Ring::setType ( type  input) [inline]

Definition at line 177 of file Ring.h.

References collect_tpl::input, and type_.

{ type_ = input; }
void Ring::setzmax ( float  input) [inline]

Definition at line 163 of file Ring.h.

References collect_tpl::input, and zmax_.

{ zmax_ = input; }
void Ring::setzmin ( float  input) [inline]

Definition at line 162 of file Ring.h.

References collect_tpl::input, and zmin_.

{ zmin_ = input; }
const_iterator Ring::upper_bound ( double  phi) const [inline]

Member Data Documentation

unsigned int Ring::index_ [private]

Definition at line 247 of file Ring.h.

Referenced by dump(), getindex(), notInitializedMsg(), operator!=(), operator<(), operator==(), print(), and setindex().

bool Ring::initialized_ [private]

Definition at line 238 of file Ring.h.

Referenced by initialize(), isInitialized(), and setInitialized().

float Ring::rmax_ [private]

Definition at line 241 of file Ring.h.

Referenced by dump(), getrmax(), initialize(), print(), and setrmax().

float Ring::rmin_ [private]

Definition at line 240 of file Ring.h.

Referenced by dump(), getrmin(), initialize(), print(), and setrmin().

type Ring::type_ [private]

Definition at line 245 of file Ring.h.

Referenced by dump(), getType(), Ring(), and setType().

float Ring::zmax_ [private]

Definition at line 243 of file Ring.h.

Referenced by dump(), getzmax(), initialize(), print(), and setzmax().

float Ring::zmin_ [private]

Definition at line 242 of file Ring.h.

Referenced by dump(), getzmin(), initialize(), print(), and setzmin().