ATLAS Offline Software
Loading...
Searching...
No Matches
CaloTowerSeg Class Reference

Data object stores CaloTower segmentation. More...

#include <CaloTowerSeg.h>

Collaboration diagram for CaloTowerSeg:

Classes

class  SubSeg
 A rectangular window within the segmentation. More...
class  SubSegIterator
 Iterator over a rectangular window of towers. More...

Public Types

typedef size_t index_t
 Type for eta, phi indices.

Public Member Functions

 CaloTowerSeg ()
 Default constructor.
 CaloTowerSeg (index_t neta, index_t nphi, double etamin, double etamax, double phimin=s_range.phi_min(), double phimax=s_range.phi_max())
 Constructor.
 ~CaloTowerSeg ()
 Destructor.
index_t neta () const
 Retrieve number of \( \eta \) bins.
index_t nphi () const
 Retrieve number of \( \varphi \) bins.
double deta () const
 Retrieve bin size \( \Delta \eta \).
double dphi () const
 Retrieve bin size \( \Delta \varphi \).
double etamin () const
 Retrieve lower boundary \( \eta \) value range.
double etamax () const
 Retrieve upper boundary \( \eta \) value range.
double phimin () const
 Retrieve lower boundary \( \varphi \) value range.
double phimax () const
 Retrieve upper boundary \( \varphi \) value range.
bool inbound (index_t etaInd, index_t phiInd) const
 Check index range in \( \eta \) and \( \varphi \).
bool inbound (double etaVal, double phiVal) const
 Check value range in \( \eta \) and \( \varphi \).
index_t etaphi (index_t etaInd, index_t phiInd) const
 Returns combined continous index from \( \eta \), \( \varphi \) indices.
double eta (index_t etaInd) const
 Returns \( \eta \) value for a given \( \eta \) index.
index_t etaIndex (double etaVal) const
 Returns \( \eta \) index for a given \( \eta \) value.
index_t etaIndex (index_t comInd) const
 Returns \( \eta \) index for a given combined index.
double phi (index_t phiInd) const
 Returns \( \varphi \) value for a given \( \varphi \) index.
index_t phiIndex (double phiVal) const
 Returns \( \varphi \) index for a given \( \varphi \) value.
index_t phiIndex (index_t comInd) const
 Returns \( \varphi \) index for a given combined index.
SubSeg subseg (double eta, double deta, double phi, double dphi) const
 Return a window within the current segmentation.

Static Public Attributes

static const index_t outOfRange = static_cast<index_t> (-1)
 Used to flag out-of-range indices.

Private Attributes

index_t m_neta
 Number of \( \eta \) bins.
index_t m_nphi
 Number of \( \varphi \) bins.
double m_etamin
 Lower boundary \( \eta \) value range.
double m_etamax
 Upper boundary \( \eta \) value range.
double m_phimin
 Lower boundary \( \varphi \) value range.
double m_phimax
 Upper boundary \( \varphi \) value range.
double m_deta
 Bin size \( \Delta \eta \).
double m_dphi
 Bin size \( \Delta \varphi \).

Static Private Attributes

static const CaloPhiRange s_range

Friends

class CaloTowerSegCnv_p1

Detailed Description

Data object stores CaloTower segmentation.

Author
S. Rajagopalan srini.nosp@m.r@bn.nosp@m.l.gov
P. Loch loch@.nosp@m.phys.nosp@m.ics.a.nosp@m.rizo.nosp@m.na.ed.nosp@m.u
Date
April 1, 2005
Version
2

The CaloTowerSeg class generates an object which stores the tower segmentation in reguar \( \Delta \eta \times \Delta \varphi \) bins. The bin index convention is \( i \in [1,n] \), where \( n \) is the number of bins for a given variable. In addition a continously running index \( k \) is providing by combining the \( \eta \) and \( \varphi \) indices, with \( k \in [0,N-1] \). \( N \) is total number of bins (sum of the numbers of \( \eta \) and \( \varphi \) bins).

Definition at line 36 of file CaloTowerSeg.h.

Member Typedef Documentation

◆ index_t

typedef size_t CaloTowerSeg::index_t

Type for eta, phi indices.

Definition at line 41 of file CaloTowerSeg.h.

Constructor & Destructor Documentation

◆ CaloTowerSeg() [1/2]

CaloTowerSeg::CaloTowerSeg ( )
inline

Default constructor.

Instantiates useless empty tower grid.

Definition at line 51 of file CaloTowerSeg.h.

51 :
52 m_neta(0),m_nphi(0),
53 m_etamin(0.),m_etamax(0.),
54 m_phimin(0.),m_phimax(0.),
55 m_deta(0),m_dphi(0)
56 {}
double m_phimax
Upper boundary value range.
double m_etamax
Upper boundary value range.
index_t m_neta
Number of bins.
index_t m_nphi
Number of bins.
double m_etamin
Lower boundary value range.
double m_deta
Bin size .
double m_dphi
Bin size .
double m_phimin
Lower boundary value range.

◆ CaloTowerSeg() [2/2]

CaloTowerSeg::CaloTowerSeg ( index_t neta,
index_t nphi,
double etamin,
double etamax,
double phimin = s_range.phi_min(),
double phimax = s_range.phi_max() )
inline

Constructor.

Parameters
netainput number of \( \eta \) bins
nphiinput number of \( \varphi \) bins
etamininput lower boundary \( \eta \) value range
etamaxinput upper boundary \( \eta \) value range
phimininput lower boundary \( \varphi \) value range
phimaxinput upper boundary \( \varphi \) value range

\( \varphi \) by default covers the full circle. CaloPhiRange::phi_min() and CaloPhiRange::phi_max() are used to implement the correct \( \varphi \) range convention.

May have phimin > phimax for the case of wraparound.

Only regular (equidistant) bins are supported in both directions.

Definition at line 75 of file CaloTowerSeg.h.

77 :
81 {
84 };
index_t nphi() const
Retrieve number of bins.
double phimin() const
Retrieve lower boundary value range.
index_t neta() const
Retrieve number of bins.
static const CaloPhiRange s_range
double phimax() const
Retrieve upper boundary value range.
double etamin() const
Retrieve lower boundary value range.
double etamax() const
Retrieve upper boundary value range.

◆ ~CaloTowerSeg()

CaloTowerSeg::~CaloTowerSeg ( )
inline

Destructor.

Definition at line 87 of file CaloTowerSeg.h.

88 {
89
90 };

Member Function Documentation

◆ deta()

double CaloTowerSeg::deta ( ) const
inline

Retrieve bin size \( \Delta \eta \).

Definition at line 433 of file CaloTowerSeg.h.

434{
435 return m_deta;
436}

◆ dphi()

double CaloTowerSeg::dphi ( ) const
inline

Retrieve bin size \( \Delta \varphi \).

Definition at line 438 of file CaloTowerSeg.h.

439{
440 return m_dphi;
441}

◆ eta()

double CaloTowerSeg::eta ( index_t etaInd) const
inline

Returns \( \eta \) value for a given \( \eta \) index.

Parameters
etaIndinput \( \eta \) index

Can return \( \eta \) value outside of allowed value range if index out of range (no internal check).

Definition at line 516 of file CaloTowerSeg.h.

517{
518 return m_etamin + (etaInd-0.5) * m_deta ;
519}

◆ etaIndex() [1/2]

CaloTowerSeg::index_t CaloTowerSeg::etaIndex ( double etaVal) const
inline

Returns \( \eta \) index for a given \( \eta \) value.

Parameters
etaValinput \( \eta \) value

Returns size_t(-1) in case of \( \eta \) being out of allowed value range.

Definition at line 489 of file CaloTowerSeg.h.

490{
491 return ( etaVal >= m_etamin && etaVal <= m_etamax )
492 ? (index_t)floor( ( etaVal - m_etamin ) / m_deta ) + 1
493 : outOfRange;
494}
size_t index_t
Type for eta, phi indices.
static const index_t outOfRange
Used to flag out-of-range indices.

◆ etaIndex() [2/2]

CaloTowerSeg::index_t CaloTowerSeg::etaIndex ( index_t comInd) const
inline

Returns \( \eta \) index for a given combined index.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
comIndinput combined index

Can return an invalid \( \eta \) index if comInd is invalid.

Definition at line 495 of file CaloTowerSeg.h.

496{
497 return (index_t)(comInd/m_nphi) + 1;
498}

◆ etamax()

double CaloTowerSeg::etamax ( ) const
inline

Retrieve upper boundary \( \eta \) value range.

Definition at line 448 of file CaloTowerSeg.h.

449{
450 return m_etamax;
451}

◆ etamin()

double CaloTowerSeg::etamin ( ) const
inline

Retrieve lower boundary \( \eta \) value range.

Definition at line 443 of file CaloTowerSeg.h.

444{
445 return m_etamin;
446}

◆ etaphi()

size_t CaloTowerSeg::etaphi ( index_t etaInd,
index_t phiInd ) const
inline

Returns combined continous index from \( \eta \), \( \varphi \) indices.

Parameters
etaIndinput \( \eta \) index
phiIndinput \( \varphi \) index

Calculates a common running index from \(\eta\) and \(\phi\) . Returns size_t(-1) if input outside of allowed index ranges.

Definition at line 481 of file CaloTowerSeg.h.

482{
483 return this->inbound(etaInd,phiInd)
484 ? (etaInd-1) * m_nphi + (phiInd-1)
485 : outOfRange;
486}
bool inbound(index_t etaInd, index_t phiInd) const
Check index range in and .

◆ inbound() [1/2]

bool CaloTowerSeg::inbound ( double etaVal,
double phiVal ) const
inline

Check value range in \( \eta \) and \( \varphi \).

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
etaValinput \( \eta \) coordinate
phiValinput \( \varphi \) coordinate

Returns true when both eta and phi are inside their respective allowed value ranges.

Definition at line 470 of file CaloTowerSeg.h.

471{
472 if ( ! ( etaVal >= m_etamin && etaVal <= m_etamax ) ) return false;
473 if (m_phimax > m_phimin)
474 return phiVal >= m_phimin && phiVal <= m_phimax;
475 else
476 return phiVal <= m_phimax || phiVal >= m_phimin;
477}

◆ inbound() [2/2]

bool CaloTowerSeg::inbound ( index_t etaInd,
index_t phiInd ) const
inline

Check index range in \( \eta \) and \( \varphi \).

Parameters
etaIndinput \( \eta \) index
phiIndinput \( \varphi \) index

Returns true when both eta and phi are within their respective allowed index ranges.

Definition at line 463 of file CaloTowerSeg.h.

464{
465 return
466 etaInd >= 1 && etaInd <= m_neta &&
467 phiInd >= 1 && phiInd <= m_nphi;
468}

◆ neta()

CaloTowerSeg::index_t CaloTowerSeg::neta ( ) const
inline

Retrieve number of \( \eta \) bins.

Definition at line 423 of file CaloTowerSeg.h.

424{
425 return m_neta;
426}

◆ nphi()

CaloTowerSeg::index_t CaloTowerSeg::nphi ( ) const
inline

Retrieve number of \( \varphi \) bins.

Definition at line 428 of file CaloTowerSeg.h.

429{
430 return m_nphi;
431}

◆ phi()

double CaloTowerSeg::phi ( index_t phiInd) const
inline

Returns \( \varphi \) value for a given \( \varphi \) index.

Parameters
phiIndinput \( \varphi \) index

Can return \( \varphi \) value outside of allowed value range if index out of range (no internal check).

Definition at line 521 of file CaloTowerSeg.h.

522{
523 double ret = m_phimin + (phiInd-0.5) * m_dphi;
524 if (m_phimin > m_phimax)
525 ret = s_range.fix (ret);
526 return ret;
527}

◆ phiIndex() [1/2]

CaloTowerSeg::index_t CaloTowerSeg::phiIndex ( double phiVal) const
inline

Returns \( \varphi \) index for a given \( \varphi \) value.

Parameters
phiValinput \( \varphi \) value

Returns size_t(-1) in case of \( \varphi \) being out of allowed value range.

Definition at line 499 of file CaloTowerSeg.h.

500{
501 if (m_phimax > m_phimin)
502 return ( phiVal >= m_phimin && phiVal <= m_phimax )
503 ? (index_t)floor( ( phiVal - m_phimin ) / m_dphi ) + 1
504 : outOfRange;
505 else
506 return ( phiVal >= m_phimin || phiVal <= m_phimax )
507 ? (index_t)floor( s_range.diff ( phiVal, m_phimin ) / m_dphi ) + 1
508 : outOfRange;
509}

◆ phiIndex() [2/2]

CaloTowerSeg::index_t CaloTowerSeg::phiIndex ( index_t comInd) const
inline

Returns \( \varphi \) index for a given combined index.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
comIndinput combined index

Can return an invalid \( \varphi \) index if comInd is invalid.

Definition at line 510 of file CaloTowerSeg.h.

511{
512 return (index_t)(comInd % m_nphi) + 1;
513}

◆ phimax()

double CaloTowerSeg::phimax ( ) const
inline

Retrieve upper boundary \( \varphi \) value range.

Definition at line 458 of file CaloTowerSeg.h.

459{
460 return m_phimax;
461}

◆ phimin()

double CaloTowerSeg::phimin ( ) const
inline

Retrieve lower boundary \( \varphi \) value range.

Definition at line 453 of file CaloTowerSeg.h.

454{
455 return m_phimin;
456}

◆ subseg()

CaloTowerSeg::SubSeg CaloTowerSeg::subseg ( double eta,
double deta,
double phi,
double dphi ) const

Return a window within the current segmentation.

The window is centered at eta/phi with half-widths deta/dphi.

Definition at line 23 of file CaloTowerSeg.cxx.

25{
27
28 index_t etamin = this->etaIndex (eta - deta + 0.001);
30 etamin = 1;
31
32 index_t etamax = this->etaIndex (eta + deta - 0.001);
34 etamax = this->neta();
35
36 index_t phimin = this->phiIndex (CaloPhiRange::fix (phi - dphi + 0.001));
38 phimin = this->phiIndex (this->phimin());
39
40 index_t phimax = this->phiIndex (CaloPhiRange::fix (phi + dphi - 0.001));
42 phimax = this->phiIndex (this->phimax() - this->dphi()/2);
43
44 return SubSeg (*this, etamin, etamax, phimin, phimax);
45}
static double fix(double phi)
A rectangular window within the segmentation.
CaloTowerSeg::index_t index_t
double deta() const
Retrieve bin size .
double dphi() const
Retrieve bin size .
index_t phiIndex(double phiVal) const
Returns index for a given value.
double phi(index_t phiInd) const
Returns value for a given index.
double eta(index_t etaInd) const
Returns value for a given index.
index_t etaIndex(double etaVal) const
Returns index for a given value.

◆ CaloTowerSegCnv_p1

friend class CaloTowerSegCnv_p1
friend

Definition at line 389 of file CaloTowerSeg.h.

Member Data Documentation

◆ m_deta

double CaloTowerSeg::m_deta
private

Bin size \( \Delta \eta \).

Definition at line 411 of file CaloTowerSeg.h.

◆ m_dphi

double CaloTowerSeg::m_dphi
private

Bin size \( \Delta \varphi \).

Definition at line 413 of file CaloTowerSeg.h.

◆ m_etamax

double CaloTowerSeg::m_etamax
private

Upper boundary \( \eta \) value range.

Definition at line 404 of file CaloTowerSeg.h.

◆ m_etamin

double CaloTowerSeg::m_etamin
private

Lower boundary \( \eta \) value range.

Definition at line 402 of file CaloTowerSeg.h.

◆ m_neta

index_t CaloTowerSeg::m_neta
private

Number of \( \eta \) bins.

Definition at line 397 of file CaloTowerSeg.h.

◆ m_nphi

index_t CaloTowerSeg::m_nphi
private

Number of \( \varphi \) bins.

Definition at line 399 of file CaloTowerSeg.h.

◆ m_phimax

double CaloTowerSeg::m_phimax
private

Upper boundary \( \varphi \) value range.

Definition at line 408 of file CaloTowerSeg.h.

◆ m_phimin

double CaloTowerSeg::m_phimin
private

Lower boundary \( \varphi \) value range.

Definition at line 406 of file CaloTowerSeg.h.

◆ outOfRange

const index_t CaloTowerSeg::outOfRange = static_cast<index_t> (-1)
static

Used to flag out-of-range indices.

Definition at line 44 of file CaloTowerSeg.h.

◆ s_range

const CaloPhiRange CaloTowerSeg::s_range
staticprivate

Definition at line 417 of file CaloTowerSeg.h.


The documentation for this class was generated from the following files: