CMS 3D CMS Logo

PFRecHit.h

Go to the documentation of this file.
00001 #ifndef ParticleFlowReco_PFRecHit_h
00002 #define ParticleFlowReco_PFRecHit_h
00003 
00005 #include <vector>
00006 #include <map>
00007 #include <iostream>
00008 
00009 #include "DataFormats/Math/interface/Point3D.h"
00010 #include "Rtypes.h" 
00011 #include "DataFormats/Math/interface/Vector3D.h"
00012 // #include "DataFormats/DetId/interface/DetId.h"
00013 #include "Math/GenVector/PositionVector3D.h"
00014 
00015 #include "DataFormats/ParticleFlowReco/interface/PFLayer.h"
00016 
00017 //C decide what is the default rechit index. 
00018 //C maybe 0 ? -> compression 
00019 //C then the position is index-1. 
00020 //C provide a helper class to access the rechit. 
00021 
00022 
00023 namespace reco {
00024 
00031   class PFRecHit {
00032 
00033   public:
00034     
00035     enum {
00036       NONE=0
00037     };
00038 
00039     typedef ROOT::Math::PositionVector3D<ROOT::Math::CylindricalEta3D<Double32_t> > REPPoint;
00040 
00041     typedef std::vector<REPPoint> REPPointVector;
00042  
00044     PFRecHit();
00045 
00047     PFRecHit(unsigned detId,
00048              PFLayer::Layer layer,
00049              double energy, 
00050              const math::XYZPoint& posxyz, 
00051              const math::XYZVector& axisxyz, 
00052              const std::vector< math::XYZPoint >& cornersxyz);
00053 
00054     PFRecHit(unsigned detId,
00055              PFLayer::Layer layer,
00056              double energy, 
00057              double posx, double posy, double posz, 
00058              double axisx, double axisy, double axisz);    
00059 
00061     PFRecHit(const PFRecHit& other);
00062 
00064     virtual ~PFRecHit();
00065 
00067     void calculatePositionREP();
00068 
00069     //C neighbours must be initialized correctly !!
00070     /*     void setNeighbours( const std::vector< unsigned >& neighbours ); */
00071     void add4Neighbour( unsigned index );
00072     void add8Neighbour( unsigned index );
00073     
00074     void clearNeighbours() {
00075       neighbours4_.clear();
00076       neighbours8_.clear();
00077       neighbours4_.reserve(4);
00078       neighbours8_.reserve(8);    
00079     }
00080 
00081     
00082 
00089     // void      findPtrsToNeighbours( const std::map<unsigned,  reco::PFRecHit* >& allhits );
00090 
00091     void      setNWCorner( double posx, double posy, double posz );
00092     void      setSWCorner( double posx, double posy, double posz );
00093     void      setSECorner( double posx, double posy, double posz );
00094     void      setNECorner( double posx, double posy, double posz );
00095 
00097     unsigned detId() const {return detId_;}
00098 
00100     PFLayer::Layer layer() const { return layer_; }
00101 
00103     double energy() const { return energy_; }
00104 
00105     //C remove cause I want to be able to run on const rechits
00107     // int  seedState() const { return seedState_; }
00108     
00110     // bool isSeed() const { return (seedState_>0) ? true : false; }
00111 
00113     // void youAreSeed(int seedstate=1) {seedState_ = seedstate;} 
00114 
00116     const math::XYZPoint& position() const { return position_; }
00117 
00119     const REPPoint& positionREP() const;
00120 
00122     const math::XYZVector& getAxisXYZ() const { return axisxyz_; }    
00123 
00125     const std::vector< math::XYZPoint >& getCornersXYZ() const 
00126       { return cornersxyz_; }    
00127 
00129     const REPPointVector& getCornersREP() const 
00130       { return cornersrep_; }    
00131 
00132     const std::vector< unsigned >& neighbours4() const 
00133       {return neighbours4_;}  
00134 
00135     const std::vector< unsigned >& neighbours8() const 
00136       {return neighbours8_;}  
00137 
00138     const std::vector< unsigned >& neighboursIds4() const 
00139       {return neighboursIds4_;}  
00140 
00141     const std::vector< unsigned >& neighboursIds8() const 
00142       {return neighboursIds8_;}  
00143 
00144     /*     const std::vector< unsigned >& getNeighboursIds4() const  */
00145     /*       {return neighboursIds4_;}   */
00146 
00147     /*     const std::vector< unsigned >& getNeighboursIds8() const  */
00148     /*       {return neighboursIds8_;}   */
00149 
00152     bool  isNeighbour4(unsigned id) const;
00153 
00156     bool  isNeighbour8(unsigned id) const;
00157     
00158 
00159     void size(double& deta, double& dphi) const;
00160 
00162     bool operator>=(const PFRecHit& rhs) const { return (energy_>=rhs.energy_); }
00163 
00165     bool operator> (const PFRecHit& rhs) const { return (energy_> rhs.energy_); }
00166 
00168     bool operator<=(const PFRecHit& rhs) const { return (energy_<=rhs.energy_); }
00169 
00171     bool operator< (const PFRecHit& rhs) const { return (energy_< rhs.energy_); }
00172 
00173     friend std::ostream& operator<<(std::ostream& out, 
00174                                     const reco::PFRecHit& hit);
00175 
00176   private:
00177 
00179     unsigned            detId_;             
00180 
00182     PFLayer::Layer                 layer_;
00183 
00185     double              energy_;
00186 
00188     // int                 seedState_;
00189  
00191     math::XYZPoint      position_;
00192 
00194     REPPoint            posrep_;
00195 
00197     math::XYZVector     axisxyz_;
00198 
00200     std::vector< math::XYZPoint > cornersxyz_;
00201     REPPointVector cornersrep_;
00202   
00204     std::vector< unsigned >   neighbours4_;
00205 
00207     std::vector< unsigned >   neighbours8_;
00208 
00210     std::vector< unsigned >   neighboursIds4_;
00211 
00213     std::vector< unsigned >   neighboursIds8_;
00214 
00216     static const unsigned    nNeighbours_;
00217     
00219     static const unsigned    nCorners_;
00220 
00222     void      setCorner( unsigned i, double posx, double posy, double posz );
00223   };
00224   
00225 }
00226 
00227 #endif

Generated on Tue Jun 9 17:31:22 2009 for CMSSW by  doxygen 1.5.4