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::SpaceVoxel Class Reference

A multi-dimensional volume element to subdivide the detector into different calibration regions. More...

#include <SpaceVoxel.h>

Public Member Functions

virtual bool contains (const double &eta, const double &phi, const double &energy) const
 
virtual bool contains (const double &eta, const double &phi, const double &energy, const bool &ecalValid, const bool &hcalValid) const
 
virtual bool containsEnergy (const double &energy) const
 
virtual bool containsEta (const double &eta) const
 
virtual bool containsPhi (const double &phi) const
 
virtual bool ecalValid () const
 
void getName (std::string &s) const
 
virtual bool hcalValid () const
 
double maxEnergy () const
 
double minEnergy () const
 
bool operator() (const SpaceVoxel &sv1, const SpaceVoxel &sv2)
 
bool operator() (const boost::shared_ptr< SpaceVoxel > &sv1, const boost::shared_ptr< SpaceVoxel > &sv2)
 
void print (std::ostream &s) const
 
void printMsg ()
 
 SpaceVoxel (double etaBegin=0, double etaEnd=0, double phiBegin=0, double phiEnd=0, double energyBegin=0, double energyEnd=0, bool ecalValid=true, bool hcalValid=true)
 
virtual ~SpaceVoxel ()
 

Private Attributes

bool ecalValid_
 
bool hcalValid_
 
double myEnergyMax
 
double myEnergyMin
 
double myEtaMax
 
double myEtaMin
 
double myPhiMax
 
double myPhiMin
 

Friends

std::ostream & operator<< (std::ostream &s, const pftools::SpaceVoxel &sv)
 

Detailed Description

A multi-dimensional volume element to subdivide the detector into different calibration regions.

Author
Jamie Ballin
Date
April 2008

Definition at line 15 of file SpaceVoxel.h.

Constructor & Destructor Documentation

SpaceVoxel::SpaceVoxel ( double  etaBegin = 0,
double  etaEnd = 0,
double  phiBegin = 0,
double  phiEnd = 0,
double  energyBegin = 0,
double  energyEnd = 0,
bool  ecalValid = true,
bool  hcalValid = true 
)

Definition at line 6 of file SpaceVoxel.cc.

References gather_cfg::cout, ecalValid_, and hcalValid_.

7  :
8  myEtaMin(etaBegin), myEtaMax(etaEnd), myPhiMin(phiBegin), myPhiMax(phiEnd),
9  myEnergyMin(energyBegin), myEnergyMax(energyEnd),
11  if (!ecalValid_ && !hcalValid_) {
12  //erm, it has to be valid for one of them at least!
13  std::cout << __PRETTY_FUNCTION__
14  << ": WARNING! Constructed with both ecalValid and hcalValid = false!"
15  << std::endl;
16  }
17 }
virtual bool ecalValid() const
Definition: SpaceVoxel.h:51
virtual bool hcalValid() const
Definition: SpaceVoxel.h:55
tuple cout
Definition: gather_cfg.py:121
SpaceVoxel::~SpaceVoxel ( )
virtual

Definition at line 19 of file SpaceVoxel.cc.

19  {
20 }

Member Function Documentation

bool SpaceVoxel::contains ( const double &  eta,
const double &  phi,
const double &  energy 
) const
virtual

Definition at line 22 of file SpaceVoxel.cc.

References containsEnergy(), containsEta(), and containsPhi().

Referenced by contains().

23  {
25  return true;
26  return false;
27 }
virtual bool containsPhi(const double &phi) const
Definition: SpaceVoxel.cc:46
virtual bool containsEta(const double &eta) const
Definition: SpaceVoxel.cc:37
virtual bool containsEnergy(const double &energy) const
Definition: SpaceVoxel.cc:56
bool SpaceVoxel::contains ( const double &  eta,
const double &  phi,
const double &  energy,
const bool &  ecalValid,
const bool &  hcalValid 
) const
virtual

Definition at line 29 of file SpaceVoxel.cc.

References contains(), ecalValid_, and hcalValid_.

30  {
32  == hcalValid_)
33  return true;
34  return false;
35 }
virtual bool ecalValid() const
Definition: SpaceVoxel.h:51
virtual bool hcalValid() const
Definition: SpaceVoxel.h:55
virtual bool contains(const double &eta, const double &phi, const double &energy) const
Definition: SpaceVoxel.cc:22
bool SpaceVoxel::containsEnergy ( const double &  energy) const
virtual

Definition at line 56 of file SpaceVoxel.cc.

References myEnergyMax, and myEnergyMin.

Referenced by contains().

56  {
57  if (myEnergyMin == myEnergyMax)
58  return true;
59  if (energy < myEnergyMax && energy >= myEnergyMin)
60  return true;
61  //std::cout << "\tenergy fails!: input " << energy << " not in " << myEnergyMin << ", " << myEnergyMax <<"\n";
62  return false;
63 }
bool SpaceVoxel::containsEta ( const double &  eta) const
virtual

Definition at line 37 of file SpaceVoxel.cc.

References myEtaMax, and myEtaMin.

Referenced by contains().

37  {
38  if (myEtaMin == myEtaMax)
39  return true;
40  if (eta < myEtaMax && eta >= myEtaMin)
41  return true;
42  //::cout << "\teta fails!\n";
43  return false;
44 }
bool SpaceVoxel::containsPhi ( const double &  phi) const
virtual

Definition at line 46 of file SpaceVoxel.cc.

References myPhiMax, and myPhiMin.

Referenced by contains().

46  {
47  if (myPhiMin == myPhiMax)
48  return true;
49  if (phi < myPhiMax && phi >= myPhiMin)
50  return true;
51  //std::cout << "\tphi fails!\n";
52  return false;
53 
54 }
virtual bool pftools::SpaceVoxel::ecalValid ( ) const
inlinevirtual

Definition at line 51 of file SpaceVoxel.h.

References ecalValid_.

51  {
52  return ecalValid_;
53  }
void SpaceVoxel::getName ( std::string &  s) const

Definition at line 76 of file SpaceVoxel.cc.

References ecalValid_, hcalValid_, myEnergyMax, myEnergyMin, myEtaMax, myEtaMin, myPhiMax, myPhiMin, and toolbox::toString().

76  {
77  s.append("SpaceVoxel: ");
78  if (ecalValid_)
79  s.append("E");
80  if (hcalValid_)
81  s.append("H");
82  s.append(", eta: [");
83  s.append(toString(myEtaMin));
84  s.append(", ");
85  s.append(toString(myEtaMax));
86  s.append("] phi: [");
87  s.append(toString(myPhiMin));
88  s.append(", ");
89  s.append(toString(myPhiMax));
90  s.append("], en: [");
91  s.append(toString(myEnergyMin));
92  s.append(", ");
93  s.append(toString(myEnergyMax));
94  s.append("]");
95 }
std::string toString(const char *format,...)
Definition: xdaq_compat.cc:4
virtual bool pftools::SpaceVoxel::hcalValid ( ) const
inlinevirtual

Definition at line 55 of file SpaceVoxel.h.

References hcalValid_.

55  {
56  return hcalValid_;
57  }
double pftools::SpaceVoxel::maxEnergy ( ) const
inline

Definition at line 47 of file SpaceVoxel.h.

References myEnergyMax.

Referenced by operator()().

47  {
48  return myEnergyMax;
49  }
double pftools::SpaceVoxel::minEnergy ( ) const
inline

Definition at line 43 of file SpaceVoxel.h.

References myEnergyMin.

Referenced by operator()().

43  {
44  return myEnergyMin;
45  }
bool SpaceVoxel::operator() ( const SpaceVoxel sv1,
const SpaceVoxel sv2 
)

Definition at line 97 of file SpaceVoxel.cc.

References maxEnergy(), and minEnergy().

97  {
98  if(sv1.minEnergy() < sv2.maxEnergy())
99  return true;
100 
101  return false;
102 }
double maxEnergy() const
Definition: SpaceVoxel.h:47
double minEnergy() const
Definition: SpaceVoxel.h:43
bool pftools::SpaceVoxel::operator() ( const boost::shared_ptr< SpaceVoxel > &  sv1,
const boost::shared_ptr< SpaceVoxel > &  sv2 
)
void SpaceVoxel::print ( std::ostream &  s) const

Definition at line 65 of file SpaceVoxel.cc.

References ecalValid_, hcalValid_, myEnergyMax, myEnergyMin, myEtaMax, myEtaMin, myPhiMax, and myPhiMin.

Referenced by pftools::operator<<().

65  {
66  s << "SpaceVoxel: ";
67  if (ecalValid_)
68  s << "E";
69  if (hcalValid_)
70  s << "H, ";
71  s << "eta: ["<< myEtaMin << ", "<< myEtaMax << "]\t phi: ["<< myPhiMin
72  << ". "<< myPhiMax << "]\t energy: ["<< myEnergyMin<< ", "
73  << myEnergyMax << "]";
74 }
void pftools::SpaceVoxel::printMsg ( )
inline

Definition at line 61 of file SpaceVoxel.h.

References gather_cfg::cout.

61  {
62  std::cout << "Hello!\n";
63  }
tuple cout
Definition: gather_cfg.py:121

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const pftools::SpaceVoxel sv 
)
friend

Member Data Documentation

bool pftools::SpaceVoxel::ecalValid_
private

Definition at line 84 of file SpaceVoxel.h.

Referenced by contains(), ecalValid(), getName(), print(), and SpaceVoxel().

bool pftools::SpaceVoxel::hcalValid_
private

Definition at line 85 of file SpaceVoxel.h.

Referenced by contains(), getName(), hcalValid(), print(), and SpaceVoxel().

double pftools::SpaceVoxel::myEnergyMax
private

Definition at line 83 of file SpaceVoxel.h.

Referenced by containsEnergy(), getName(), maxEnergy(), and print().

double pftools::SpaceVoxel::myEnergyMin
private

Definition at line 82 of file SpaceVoxel.h.

Referenced by containsEnergy(), getName(), minEnergy(), and print().

double pftools::SpaceVoxel::myEtaMax
private

Definition at line 79 of file SpaceVoxel.h.

Referenced by containsEta(), getName(), and print().

double pftools::SpaceVoxel::myEtaMin
private

Definition at line 78 of file SpaceVoxel.h.

Referenced by containsEta(), getName(), and print().

double pftools::SpaceVoxel::myPhiMax
private

Definition at line 81 of file SpaceVoxel.h.

Referenced by containsPhi(), getName(), and print().

double pftools::SpaceVoxel::myPhiMin
private

Definition at line 80 of file SpaceVoxel.h.

Referenced by containsPhi(), getName(), and print().