CMS 3D CMS Logo

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>

List of all members.

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 boost::shared_ptr< SpaceVoxel > &sv1, const boost::shared_ptr< SpaceVoxel > &sv2)
bool operator() (const SpaceVoxel &sv1, const 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_.

                                                                                                     :
        myEtaMin(etaBegin), myEtaMax(etaEnd), myPhiMin(phiBegin), myPhiMax(phiEnd),
                        myEnergyMin(energyBegin), myEnergyMax(energyEnd),
                        ecalValid_(ecalValid), hcalValid_(hcalValid) {
        if (!ecalValid_ && !hcalValid_) {
                //erm, it has to be valid for one of them at least!
                std::cout << __PRETTY_FUNCTION__
                                << ": WARNING! Constructed with both ecalValid and hcalValid = false!"
                                << std::endl;
        }
}
SpaceVoxel::~SpaceVoxel ( ) [virtual]

Definition at line 19 of file SpaceVoxel.cc.

                        {
}

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

                                            {
        if (containsEta(eta) && containsPhi(phi) && containsEnergy(energy))
                return true;
        return false;
}
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_.

                                                                                          {
        if (contains(eta, phi, energy) && ecalValid == ecalValid_ && hcalValid
                        == hcalValid_)
                return true;
        return false;
}
bool SpaceVoxel::containsEnergy ( const double &  energy) const [virtual]

Definition at line 56 of file SpaceVoxel.cc.

References myEnergyMax, and myEnergyMin.

Referenced by contains().

                                                          {
        if (myEnergyMin == myEnergyMax)
                return true;
        if (energy < myEnergyMax && energy >= myEnergyMin)
                return true;
        //std::cout << "\tenergy fails!: input " << energy << " not in " << myEnergyMin << ", " << myEnergyMax <<"\n";
        return false;
}
bool SpaceVoxel::containsEta ( const double &  eta) const [virtual]

Definition at line 37 of file SpaceVoxel.cc.

References myEtaMax, and myEtaMin.

Referenced by contains().

                                                    {
        if (myEtaMin == myEtaMax)
                return true;
        if (eta < myEtaMax && eta >= myEtaMin)
                return true;
        //::cout << "\teta fails!\n";
        return false;
}
bool SpaceVoxel::containsPhi ( const double &  phi) const [virtual]

Definition at line 46 of file SpaceVoxel.cc.

References myPhiMax, and myPhiMin.

Referenced by contains().

                                                    {
        if (myPhiMin == myPhiMax)
                return true;
        if (phi < myPhiMax && phi >= myPhiMin)
                return true;
        //std::cout << "\tphi fails!\n";
        return false;

}
virtual bool pftools::SpaceVoxel::ecalValid ( ) const [inline, virtual]

Definition at line 51 of file SpaceVoxel.h.

References ecalValid_.

                                       {
                return ecalValid_;
        }
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 toString().

                                           {
        s.append("SpaceVoxel: ");
        if (ecalValid_)
                s.append("E");
        if (hcalValid_)
                s.append("H");
        s.append(", eta: [");
        s.append(toString(myEtaMin));
        s.append(", ");
        s.append(toString(myEtaMax));
        s.append("] phi: [");
        s.append(toString(myPhiMin));
        s.append(", ");
        s.append(toString(myPhiMax));
        s.append("], en: [");
        s.append(toString(myEnergyMin));
        s.append(", ");
        s.append(toString(myEnergyMax));
        s.append("]");
}
virtual bool pftools::SpaceVoxel::hcalValid ( ) const [inline, virtual]

Definition at line 55 of file SpaceVoxel.h.

References hcalValid_.

                                       {
                return hcalValid_;
        }
double pftools::SpaceVoxel::maxEnergy ( ) const [inline]

Definition at line 47 of file SpaceVoxel.h.

References myEnergyMax.

Referenced by operator()().

                                 {
                return myEnergyMax;
        }
double pftools::SpaceVoxel::minEnergy ( ) const [inline]

Definition at line 43 of file SpaceVoxel.h.

References myEnergyMin.

Referenced by operator()().

                                 {
                return myEnergyMin;
        }
bool pftools::SpaceVoxel::operator() ( const boost::shared_ptr< SpaceVoxel > &  sv1,
const boost::shared_ptr< SpaceVoxel > &  sv2 
)
bool SpaceVoxel::operator() ( const SpaceVoxel sv1,
const SpaceVoxel sv2 
)

Definition at line 97 of file SpaceVoxel.cc.

References maxEnergy(), and minEnergy().

                                                                         {
        if(sv1.minEnergy() < sv2.maxEnergy())
                return true;
        
        return false;
}
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<<().

                                          {
        s << "SpaceVoxel: ";
        if (ecalValid_)
                s << "E";
        if (hcalValid_)
                s << "H, ";
        s << "eta: ["<< myEtaMin << ", "<< myEtaMax << "]\t phi: ["<< myPhiMin
                        << ". "<< myPhiMax << "]\t energy: ["<< myEnergyMin<< ", "
                        << myEnergyMax << "]";
}
void pftools::SpaceVoxel::printMsg ( ) [inline]

Definition at line 61 of file SpaceVoxel.h.

References gather_cfg::cout.

                        {
                std::cout << "Hello!\n";
        }

Friends And Related Function Documentation

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

Member Data Documentation

Definition at line 84 of file SpaceVoxel.h.

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

Definition at line 85 of file SpaceVoxel.h.

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

Definition at line 83 of file SpaceVoxel.h.

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

Definition at line 82 of file SpaceVoxel.h.

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

Definition at line 79 of file SpaceVoxel.h.

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

Definition at line 78 of file SpaceVoxel.h.

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

Definition at line 81 of file SpaceVoxel.h.

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

Definition at line 80 of file SpaceVoxel.h.

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