CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/DataFormats/TrackingRecHit/interface/TrackingRecHit.h

Go to the documentation of this file.
00001 #ifndef TrackingRecHit_h
00002 #define TrackingRecHit_h
00003 
00004 #include "DataFormats/CLHEP/interface/AlgebraicObjects.h"
00005 #include "DataFormats/DetId/interface/DetId.h"
00006 #include "DataFormats/GeometrySurface/interface/LocalError.h"
00007 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
00008 #include "DataFormats/TrackingRecHit/interface/KfComponentsHolder.h"
00009 #include "FWCore/Utilities/interface/GCC11Compatibility.h"
00010 
00011 class TrackingRecHit {
00012 public:
00013 
00014   friend class MuonTransientTrackingRecHit;
00015 
00016   typedef unsigned int id_type;
00017   
00025   enum Type { valid = 0, missing = 1, inactive = 2, bad = 3 };
00026   static const int typeMask = 0xf;  // mask for the above
00027   static const int rttiShift = 24; // shift amount to get the rtti
00028  
00030   enum SharedInputType {all, some};
00031   
00032   explicit TrackingRecHit(DetId id, Type type=valid ) : m_id(id), m_status(type) {}
00033   explicit TrackingRecHit(id_type id=0, Type type=valid ) : m_id(id), m_status(type) {}
00034 
00035   TrackingRecHit(DetId id, unsigned int rt, Type type=valid  ) : m_id(id), m_status((rt<< rttiShift)|int(type)) {}
00036 
00037   
00038   virtual ~TrackingRecHit() {}
00039   
00040   virtual TrackingRecHit * clone() const = 0;
00041   
00042   virtual AlgebraicVector parameters() const = 0;
00043   
00044   virtual AlgebraicSymMatrix parametersError() const = 0;
00045   
00046   virtual AlgebraicMatrix projectionMatrix() const = 0;
00047 
00048   virtual void getKfComponents( KfComponentsHolder & holder ) const ; 
00049  
00050   virtual int dimension() const = 0;
00051   
00053   virtual std::vector<const TrackingRecHit*> recHits() const = 0;
00054   virtual void recHitsV(std::vector<const TrackingRecHit*> & ) const;
00055   
00057   virtual std::vector<TrackingRecHit*> recHits() = 0;
00058   virtual void recHitsV(std::vector<TrackingRecHit*> & );
00059   
00060 
00061   id_type rawId() const { return m_id;}
00062   DetId geographicalId() const {return m_id;}
00063   
00064   virtual LocalPoint localPosition() const = 0;
00065   
00066   virtual LocalError localPositionError() const = 0;
00067 
00069   virtual bool hasPositionAndError() const {return true;}; 
00070   
00071   virtual float weight() const {return 1.;}
00072   
00073   Type type() const { return Type(typeMask&m_status); }
00074   Type getType() const { return Type(typeMask&m_status); }
00075   bool isValid() const {return getType()==valid;}
00076   
00077   unsigned int getRTTI() const { return m_status >> rttiShift;}
00078 
00084   virtual bool sharesInput( const TrackingRecHit* other, SharedInputType what) const;
00085 
00086 protected:
00087   // used by muon...
00088   void setId(id_type iid) { m_id=iid;}
00089   void setType(Type ttype) { m_status=ttype;}
00090   
00091   void setRTTI (unsigned int rt) { m_status &= (rt<< rttiShift);} // can be done only once...
00092 
00093 private:
00094   
00095   id_type m_id;
00096 
00097   unsigned int m_status; // bit assigned (type 0-8) (rtti 24-31) 
00098     
00099 };
00100 
00101 #endif