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 | Private Attributes
Ring Class Reference

#include <Ring.h>

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 More...
 
int operator< (const Ring &ring) const
 comparison More...
 
int operator== (const Ring &ring) const
 equality More...
 
std::string print () const
 
 Ring ()
 
 Ring (type input)
 
 Ring (unsigned int index, float rmin, float rmax, float zmin, float zmax, unsigned int type)
 
 Ring (Ring *input)
 
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.

41  {
42  TIBRing,
43  TOBRing,
44  TIDRing,
45  TECRing,
46  PXBRing,
47  PXFRing,
49  };

Constructor & Destructor Documentation

Ring::Ring ( )
inline

Definition at line 51 of file Ring.h.

51  : initialized_(false),
52  rmin_(0.),
53  rmax_(0.),
54  zmin_(0.),
55  zmax_(0.),
57  index_(0) {}
type type_
Definition: Ring.h:245
float zmin_
Definition: Ring.h:242
unsigned int index_
Definition: Ring.h:247
float rmin_
Definition: Ring.h:240
float zmax_
Definition: Ring.h:243
float rmax_
Definition: Ring.h:241
bool initialized_
Definition: Ring.h:238
Ring::Ring ( type  input)
inline

Definition at line 59 of file Ring.h.

59  : initialized_(false),
60  rmin_(0.),
61  rmax_(0.),
62  zmin_(0.),
63  zmax_(0.),
64  type_(input),
65  index_(0) {}
type type_
Definition: Ring.h:245
float zmin_
Definition: Ring.h:242
unsigned int index_
Definition: Ring.h:247
float rmin_
Definition: Ring.h:240
tuple input
Definition: collect_tpl.py:10
float zmax_
Definition: Ring.h:243
float rmax_
Definition: Ring.h:241
bool initialized_
Definition: Ring.h:238
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.

72  : initialized_(true),
73  rmin_(rmin),
74  rmax_(rmax),
75  zmin_(zmin),
76  zmax_(zmax),
77  index_(index) {
78  if ( type == 0 ) {
79  type_ = TIBRing;
80  } else if ( type == 1 ) {
81  type_ = TOBRing;
82  } else if ( type == 2 ) {
83  type_ = TIDRing;
84  } else if ( type == 3 ) {
85  type_ = TECRing;
86  } else if ( type == 4 ) {
87  type_ = PXBRing;
88  } else if ( type == 5 ) {
89  type_ = PXFRing;
90  } else {
92  }
93  }
type
Definition: HCALResponse.h:22
type type_
Definition: Ring.h:245
float zmin_
Definition: Ring.h:242
unsigned int index_
Definition: Ring.h:247
float rmin_
Definition: Ring.h:240
float zmax_
Definition: Ring.h:243
float rmax_
Definition: Ring.h:241
bool initialized_
Definition: Ring.h:238
Ring::Ring ( Ring input)
inline

Definition at line 95 of file Ring.h.

95  : detids_(input->getDetIdMap()),
96  initialized_(input->isInitialized()),
97  rmin_(input->getrmin()),
98  rmax_(input->getrmax()),
99  zmin_(input->getzmin()),
100  zmax_(input->getzmax()),
101  type_(input->getType()),
102  index_(input->getindex()) {}
type type_
Definition: Ring.h:245
float zmin_
Definition: Ring.h:242
unsigned int getindex() const
Definition: Ring.h:185
bool isInitialized() const
Definition: Ring.h:153
type getType() const
Definition: Ring.h:179
DetIdMap getDetIdMap() const
Definition: Ring.h:187
unsigned int index_
Definition: Ring.h:247
float getzmax() const
Definition: Ring.h:158
float getrmin() const
Definition: Ring.h:155
DetIdMap detids_
Definition: Ring.h:236
float rmin_
Definition: Ring.h:240
float getzmin() const
Definition: Ring.h:157
float zmax_
Definition: Ring.h:243
float getrmax() const
Definition: Ring.h:156
float rmax_
Definition: Ring.h:241
bool initialized_
Definition: Ring.h:238
Ring::~Ring ( )
inline

Definition at line 104 of file Ring.h.

104 {}

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_.

150 { return detids_.begin(); }
DetIdMap detids_
Definition: Ring.h:236
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, Geom::pi(), relativeConstraints::ring, and Geom::twoPi().

111  {
112  // calculate window around given phi (if phi == 999999. set window to [-pi,pi])
113  // determine phi segmentation from number of detids in ring
114  // window is += 1.5 times the phi segmentation
115  double phi_inner = -Geom::pi();
116  double phi_outer = Geom::pi();
117  double delta_phi = Geom::twoPi() / detids_.size();
118  if ( phi != 999999. ) {
119  phi_inner = map_phi(phi - dphi_scalefactor*delta_phi);
120  phi_outer = map_phi(phi + dphi_scalefactor*delta_phi);
121  }
122 
123  // check for out of bounds of [0,2pi]
124  if ( phi_inner > phi_outer ) {
125  // double loop
126  for ( const_iterator ring = detids_.lower_bound(phi_inner); ring != detids_.end(); ++ring ) {
127  if ( id == ring->second ) {
128  return true;
129  }
130  }
131  for ( const_iterator ring = detids_.begin(); ring != detids_.upper_bound(phi_outer); ++ring ) {
132  if ( id == ring->second ) {
133  return true;
134  }
135  }
136  } else {
137  for ( const_iterator ring = detids_.lower_bound(phi_inner); ring != detids_.upper_bound(phi_outer); ++ring ) {
138  if ( id == ring->second ) {
139  return true;
140  }
141  }
142  }
143 
144  return false;
145  }
DetIdMap detids_
Definition: Ring.h:236
double delta_phi(double ph11, double phi2)
Definition: AnglesUtil.h:91
double map_phi(double phi) const
Definition: Ring.h:226
double pi()
Definition: Pi.h:31
double twoPi()
Definition: Pi.h:32
DetIdMap::const_iterator const_iterator
Definition: Ring.h:37
Definition: DDAxes.h:10
std::string Ring::dump ( void  ) const
inline

Definition at line 207 of file Ring.h.

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

207  {
208  std::ostringstream stream;
209  stream << "### Ring with index: " << index_ << " ###" << std::endl;
210  stream << index_
211  << " " << rmin_
212  << " " << rmax_
213  << " " << zmin_
214  << " " << zmax_
215  << " " << type_ << std::endl;
216  stream << detids_.size() << std::endl;
217  for ( const_iterator entry = detids_.begin(); entry != detids_.end(); ++entry ) {
218  stream << entry->first << " " << entry->second.rawId() << std::endl;
219  }
220  return stream.str();
221  }
type type_
Definition: Ring.h:245
float zmin_
Definition: Ring.h:242
unsigned int index_
Definition: Ring.h:247
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
DetIdMap detids_
Definition: Ring.h:236
float rmin_
Definition: Ring.h:240
float zmax_
Definition: Ring.h:243
DetIdMap::const_iterator const_iterator
Definition: Ring.h:37
float rmax_
Definition: Ring.h:241
const_iterator Ring::end ( void  ) const
inline
iterator Ring::end ( void  )
inline

Definition at line 151 of file Ring.h.

References detids_.

151 { return detids_.end(); }
DetIdMap detids_
Definition: Ring.h:236
DetIdMap Ring::getDetIdMap ( ) const
inline

Definition at line 187 of file Ring.h.

References detids_.

187 { return detids_; }
DetIdMap detids_
Definition: Ring.h:236
DetId Ring::getFirst ( ) const
inline

Definition at line 181 of file Ring.h.

References detids_.

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

181 { return detids_.begin()->second; }
DetIdMap detids_
Definition: Ring.h:236
unsigned int Ring::getindex ( ) const
inline
int Ring::getNumDetIds ( ) const
inline
float Ring::getrmax ( ) const
inline

Definition at line 156 of file Ring.h.

References isInitialized(), notInitializedMsg(), and rmax_.

Referenced by RoadMaker::CompatibleWithLines(), RoadMaker::LinesThroughRingAndBS(), and RoadMaker::LinesThroughRings().

156 { if ( !isInitialized() ) notInitializedMsg(); return rmax_; }
bool isInitialized() const
Definition: Ring.h:153
void notInitializedMsg() const
Definition: Ring.h:174
float rmax_
Definition: Ring.h:241
float Ring::getrmin ( ) const
inline

Definition at line 155 of file Ring.h.

References isInitialized(), notInitializedMsg(), and rmin_.

Referenced by RoadMaker::CompatibleWithLines(), RoadMaker::LinesThroughRingAndBS(), and RoadMaker::LinesThroughRings().

155 { if ( !isInitialized() ) notInitializedMsg(); return rmin_; }
bool isInitialized() const
Definition: Ring.h:153
void notInitializedMsg() const
Definition: Ring.h:174
float rmin_
Definition: Ring.h:240
type Ring::getType ( void  ) const
inline

Definition at line 179 of file Ring.h.

References type_.

179 { return type_; }
type type_
Definition: Ring.h:245
float Ring::getzmax ( ) const
inline
float Ring::getzmin ( ) const
inline
void Ring::initialize ( float  rmin,
float  rmax,
float  zmin,
float  zmax 
)
inline

Definition at line 167 of file Ring.h.

References initialized_, rmax_, rmin_, zmax_, and zmin_.

Referenced by RingMaker::constructPXBRing(), RingMaker::constructPXFRing(), RingMaker::constructTECRing(), RingMaker::constructTIBRing(), RingMaker::constructTIDRing(), and RingMaker::constructTOBRing().

167  {
168  rmin_ = rmin;
169  rmax_ = rmax;
170  zmin_ = zmin;
171  zmax_ = zmax;
172  initialized_ = true; }
float zmin_
Definition: Ring.h:242
float rmin_
Definition: Ring.h:240
float zmax_
Definition: Ring.h:243
float rmax_
Definition: Ring.h:241
bool initialized_
Definition: Ring.h:238
bool Ring::isInitialized ( ) const
inline

Definition at line 153 of file Ring.h.

References initialized_.

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

153 { return initialized_; }
bool initialized_
Definition: Ring.h:238
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().

226  {
227  // map phi to [-pi,pi]
228  double result = phi;
229  if ( result < -Geom::pi()) result += Geom::twoPi();
230  if ( result > Geom::pi()) result -= Geom::twoPi();
231  return result;
232  }
tuple result
Definition: query.py:137
double pi()
Definition: Pi.h:31
double twoPi()
Definition: Pi.h:32
Definition: DDAxes.h:10
void Ring::notInitializedMsg ( ) const
inline

Definition at line 174 of file Ring.h.

References index_.

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

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

inequality

Definition at line 192 of file Ring.h.

References getindex(), and index_.

192 { return index_!=ring.getindex(); }
unsigned int getindex() const
Definition: Ring.h:185
unsigned int index_
Definition: Ring.h:247
int Ring::operator< ( const Ring ring) const
inline

comparison

Definition at line 194 of file Ring.h.

References getindex(), and index_.

194 { return index_<ring.getindex(); }
unsigned int getindex() const
Definition: Ring.h:185
unsigned int index_
Definition: Ring.h:247
int Ring::operator== ( const Ring ring) const
inline

equality

Definition at line 190 of file Ring.h.

References getindex(), and index_.

190 { return index_==ring.getindex(); }
unsigned int getindex() const
Definition: Ring.h:185
unsigned int index_
Definition: Ring.h:247
std::string Ring::print ( void  ) const
inline

Definition at line 196 of file Ring.h.

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

196  {
197  std::ostringstream stream;
198  stream << "Ring: " << index_
199  << " rmin: " << rmin_
200  << " rmax: " << rmax_
201  << " zmin: " << zmin_
202  << " zmax: " << zmax_
203  << " number of DetUnits: " << detids_.size();
204  return stream.str();
205  }
float zmin_
Definition: Ring.h:242
unsigned int index_
Definition: Ring.h:247
DetIdMap detids_
Definition: Ring.h:236
float rmin_
Definition: Ring.h:240
float zmax_
Definition: Ring.h:243
float rmax_
Definition: Ring.h:241
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.

165 { initialized_ = input; }
tuple input
Definition: collect_tpl.py:10
bool initialized_
Definition: Ring.h:238
void Ring::setrmax ( float  input)
inline

Definition at line 161 of file Ring.h.

References collect_tpl::input, and rmax_.

161 { rmax_ = input; }
tuple input
Definition: collect_tpl.py:10
float rmax_
Definition: Ring.h:241
void Ring::setrmin ( float  input)
inline

Definition at line 160 of file Ring.h.

References collect_tpl::input, and rmin_.

160 { rmin_ = input; }
float rmin_
Definition: Ring.h:240
tuple input
Definition: collect_tpl.py:10
void Ring::setType ( type  input)
inline

Definition at line 177 of file Ring.h.

References collect_tpl::input, and type_.

177 { type_ = input; }
type type_
Definition: Ring.h:245
tuple input
Definition: collect_tpl.py:10
void Ring::setzmax ( float  input)
inline

Definition at line 163 of file Ring.h.

References collect_tpl::input, and zmax_.

163 { zmax_ = input; }
tuple input
Definition: collect_tpl.py:10
float zmax_
Definition: Ring.h:243
void Ring::setzmin ( float  input)
inline

Definition at line 162 of file Ring.h.

References collect_tpl::input, and zmin_.

162 { zmin_ = input; }
float zmin_
Definition: Ring.h:242
tuple input
Definition: collect_tpl.py:10
const_iterator Ring::upper_bound ( double  phi) const
inline

Member Data Documentation

DetIdMap Ring::detids_
private
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
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().