CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes | Friends
pftools::CaloRing Class Reference

#include <CaloWindow.h>

Public Member Functions

bool addEnergy (unsigned pane, double energy)
 
 CaloRing ()
 
 CaloRing (unsigned nPanes)
 
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_.

10  :
11  panes_(1) {
12  myPanes_.push_back(0);
13 }
unsigned panes_
Definition: CaloWindow.h:87
std::vector< double > myPanes_
Definition: CaloWindow.h:88
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_.

15  :
16  panes_(nPanes) {
17  for (unsigned j(0); j < nPanes; ++j)
18  myPanes_.push_back(0);
19 }
unsigned panes_
Definition: CaloWindow.h:87
int j
Definition: DBlmapReader.cc:9
std::vector< double > myPanes_
Definition: CaloWindow.h:88

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

36  {
37  if (pane < panes_) {
38  myPanes_[pane] += energy;
39  return true;
40  }
41  return false;
42 }
unsigned panes_
Definition: CaloWindow.h:87
std::vector< double > myPanes_
Definition: CaloWindow.h:88
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().

71  {
72  return myPanes_;
73  }
std::vector< double > myPanes_
Definition: CaloWindow.h:88
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_.

21  {
22  if (pane < panes_)
23  return myPanes_[pane];
24  else
25  return 0;
26 }
unsigned panes_
Definition: CaloWindow.h:87
std::vector< double > myPanes_
Definition: CaloWindow.h:88
unsigned pftools::CaloRing::getNPanes ( ) const
inline

Get the number of panes

Returns

Definition at line 79 of file CaloWindow.h.

References panes_.

79  {
80  return panes_;
81  }
unsigned panes_
Definition: CaloWindow.h:87
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().

60  {
61  for (std::vector<double>::iterator cit = myPanes_.begin(); cit
62  != myPanes_.end(); ++cit)
63  s << (*cit)/range << "\t";
64 }
std::vector< double > myPanes_
Definition: CaloWindow.h:88
void CaloRing::reset ( void  )

Zeroes all energies contained.

Definition at line 53 of file CaloWindow.cc.

References myPanes_.

53  {
54  for (std::vector<double>::iterator cit = myPanes_.begin(); cit
55  != myPanes_.end(); ++cit)
56  *cit = 0.0;
57 
58 }
std::vector< double > myPanes_
Definition: CaloWindow.h:88
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_.

28  {
29  if (pane < panes_) {
30  myPanes_[pane] = energy;
31  return true;
32  }
33  return false;
34 }
unsigned panes_
Definition: CaloWindow.h:87
std::vector< double > myPanes_
Definition: CaloWindow.h:88
double CaloRing::totalE ( ) const

Total energy contained by this CaloRing

Returns
energy in GeV

Definition at line 44 of file CaloWindow.cc.

References myPanes_.

44  {
45  double ans(0.0);
46  for (std::vector<double>::const_iterator cit = myPanes_.begin(); cit
47  != myPanes_.end(); ++cit) {
48  ans += *cit;
49  }
50  return ans;
51 }
std::vector< double > myPanes_
Definition: CaloWindow.h:88

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