CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoParticleFlow/PFClusterTools/interface/SpaceVoxel.h

Go to the documentation of this file.
00001 #ifndef SPACEVOXEL_HH_
00002 #define SPACEVOXEL_HH_
00003 #include <iostream>
00004 #include <boost/shared_ptr.hpp>
00005 #include <string>
00006 
00007 namespace pftools {
00008 
00015 class SpaceVoxel {
00016 public:
00017         /*
00018          * Constructs a SpaceVoxel over the specified region.
00019          * 
00020          * Upper edges are exclusive; Lower edges are inclusive.
00021          * 
00022          * If any of XXXBegin == XXXEnd, then this criterion is ignored and the corresponding
00023          * containsXXX(y) will return true.
00024          */
00025         SpaceVoxel(double etaBegin = 0, double etaEnd = 0, double phiBegin = 0,
00026                         double phiEnd = 0, double energyBegin = 0, double energyEnd = 0, bool ecalValid = true, bool hcalValid = true);
00027         
00028 
00029         virtual ~SpaceVoxel();
00030 
00031         virtual bool contains(const double& eta, const double& phi,
00032                         const double& energy) const;
00033         
00034         virtual bool contains(const double& eta, const double& phi,
00035                                 const double& energy, const bool& ecalValid, const bool& hcalValid) const;
00036 
00037         virtual bool containsEta(const double& eta) const;
00038 
00039         virtual bool containsPhi(const double& phi) const;
00040 
00041         virtual bool containsEnergy(const double& energy) const;
00042         
00043         double minEnergy() const {
00044                 return myEnergyMin;
00045         }
00046         
00047         double maxEnergy() const {
00048                 return myEnergyMax;
00049         }
00050         
00051         virtual bool ecalValid() const {
00052                 return ecalValid_;
00053         }
00054         
00055         virtual bool hcalValid() const {
00056                 return hcalValid_;
00057         }
00058 
00059         void print(std::ostream& s) const;
00060         
00061         void printMsg() {
00062                 std::cout << "Hello!\n";
00063         }
00064         
00065         
00066         //Prints this SpaceVoxel's name into the supplied string
00067         void getName(std::string& s) const;
00068 
00069         friend std::ostream& operator<<(std::ostream& s,
00070                         const pftools::SpaceVoxel& sv);
00071         
00072         bool operator()(const SpaceVoxel& sv1, const SpaceVoxel& sv2) ;
00073         
00074         bool operator()(const boost::shared_ptr<SpaceVoxel>& sv1, const boost::shared_ptr<SpaceVoxel>& sv2) ;
00075         
00076 
00077 private:
00078         double myEtaMin;
00079         double myEtaMax;
00080         double myPhiMin;
00081         double myPhiMax;
00082         double myEnergyMin;
00083         double myEnergyMax;
00084         bool ecalValid_;
00085         bool hcalValid_;
00086 
00087 };
00088 
00089 typedef boost::shared_ptr<SpaceVoxel> SpaceVoxelPtr;
00090 
00091 std::ostream& operator<<(std::ostream& s, const pftools::SpaceVoxel& sv);
00092 
00093 }
00094 #endif /*SPACEVOXEL_HH_*/