CMS 3D CMS Logo

Public Member Functions | Private Attributes | Friends

pftools::CaloRing Class Reference

#include <CaloWindow.h>

List of all members.

Public Member Functions

bool addEnergy (unsigned pane, double energy)
 CaloRing (unsigned nPanes)
 CaloRing ()
std::vector< double > getEnergies () const
double getEnergy (unsigned pane) const
unsigned getNPanes () const
void printEnergies (std::ostream &s, double range=1.0)
void reset ()
bool setEnergy (unsigned pane, double energy)
double totalE () const

Private Attributes

std::vector< double > myPanes_
unsigned panes_

Friends

std::ostream & operator<< (std::ostream &s, const CaloRing &caloRing)

Detailed Description

As we shall see, a CaloWindow is composed of a number of CaloRings. Each ring is divided into panes. Numbering of the panes starts from 0.

Definition at line 17 of file CaloWindow.h.


Constructor & Destructor Documentation

CaloRing::CaloRing ( )

Constructor for just one pane.

Returns:

Definition at line 10 of file CaloWindow.cc.

References myPanes_.

                   :
        panes_(1) {
        myPanes_.push_back(0);
}
CaloRing::CaloRing ( unsigned  nPanes)

Constructor for nPanes

Parameters:
nPanesthe number of panes
Returns:

Definition at line 15 of file CaloWindow.cc.

References j, and myPanes_.

                                  :
        panes_(nPanes) {
        for (unsigned j(0); j < nPanes; ++j)
                myPanes_.push_back(0);
}

Member Function Documentation

bool CaloRing::addEnergy ( unsigned  pane,
double  energy 
)

Adds energy to the specified pane

Parameters:
pane- numbering starts from 0
energy
Returns:
true if the pane exists, false if outside of range

Definition at line 36 of file CaloWindow.cc.

References relval_parameters_module::energy, myPanes_, and panes_.

Referenced by pftools::CaloWindow::addHit().

                                                     {
        if (pane < panes_) {
                myPanes_[pane] += energy;
                return true;
        }
        return false;
}
std::vector<double> pftools::CaloRing::getEnergies ( ) const [inline]

A copy of the vector of energies for each pane

Returns:
a vector of energies

Definition at line 71 of file CaloWindow.h.

References myPanes_.

Referenced by pftools::CaloWindow::stream().

                                              {
                return myPanes_;
        }
double CaloRing::getEnergy ( unsigned  pane) const

Energy contained in that pane

Parameters:
pane- numbering starts from 0
Returns:
energy contained in GeV

Definition at line 21 of file CaloWindow.cc.

References myPanes_, and panes_.

                                              {
        if (pane < panes_)
                return myPanes_[pane];
        else
                return 0;
}
unsigned pftools::CaloRing::getNPanes ( ) const [inline]

Get the number of panes

Returns:

Definition at line 79 of file CaloWindow.h.

References panes_.

                                   {
                return panes_;
        }
void CaloRing::printEnergies ( std::ostream &  s,
double  range = 1.0 
)

Definition at line 60 of file CaloWindow.cc.

References myPanes_.

Referenced by pftools::CaloWindow::printEnergies().

                                                        {
        for (std::vector<double>::iterator cit = myPanes_.begin(); cit
                        != myPanes_.end(); ++cit)
                s << (*cit)/range << "\t";
}
void CaloRing::reset ( void  )

Zeroes all energies contained.

Definition at line 53 of file CaloWindow.cc.

References myPanes_.

                     {
        for (std::vector<double>::iterator cit = myPanes_.begin(); cit
                        != myPanes_.end(); ++cit)
                *cit = 0.0;

}
bool CaloRing::setEnergy ( unsigned  pane,
double  energy 
)

Sets the energy in the specified pane

Parameters:
pane- numbering starts from 0
energy
Returns:
true if pane exists, false if outside of range

Definition at line 28 of file CaloWindow.cc.

References relval_parameters_module::energy, myPanes_, and panes_.

                                                     {
        if (pane < panes_) {
                myPanes_[pane] = energy;
                return true;
        }
        return false;
}
double CaloRing::totalE ( ) const

Total energy contained by this CaloRing

Returns:
energy in GeV

Definition at line 44 of file CaloWindow.cc.

References myPanes_.

                              {
        double ans(0.0);
        for (std::vector<double>::const_iterator cit = myPanes_.begin(); cit
                        != myPanes_.end(); ++cit) {
                ans += *cit;
        }
        return ans;
}

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const CaloRing caloRing 
) [friend]

Member Data Documentation

std::vector<double> pftools::CaloRing::myPanes_ [private]
unsigned pftools::CaloRing::panes_ [private]

Definition at line 87 of file CaloWindow.h.

Referenced by addEnergy(), getEnergy(), getNPanes(), and setEnergy().