CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/DataFormats/TrackReco/interface/TrackResiduals.h

Go to the documentation of this file.
00001 #ifndef TrackReco_TrackResiduals_h
00002 #define TrackReco_TrackResiduals_h
00003 
00010 #include <iostream>
00011 #include "DataFormats/TrackingRecHit/interface/TrackingRecHitFwd.h"
00012 #include "DataFormats/TrackReco/interface/TrackResiduals.h"
00013 
00014 class Trajectory;
00015 
00016 namespace reco {
00017      class HitPattern;
00018      class TrackResiduals {
00019           friend class Trajectory;
00020      public:
00021           enum ResidualType { X_Y_RESIDUALS, X_Y_PULLS };
00022           
00023      protected:
00025           enum { numResiduals = 0x40 };
00026           
00027      public:
00028           TrackResiduals ();
00029           TrackResiduals (enum ResidualType);
00030           
00031      public:
00032           void setResidualXY (int idx, double residualX, double residualY);
00033           void setPullXY (int idx, double pullX, double pullY);
00034           void setResidualType (enum ResidualType);
00035           void print (std::ostream &stream = std::cout) const;
00036           void print (const HitPattern &, std::ostream &stream = std::cout) const;
00037           /* Example usage:
00038            * 
00039            * HitPattern p;
00040            * TrackResiduals r;
00041            * int numHits = p.numberOfValidHits() +        
00042            *   p.numberOfLostHits() +         
00043            *   p.numberOfValidMuonHits() +    
00044            *   p.numberOfLostMuonHits() +     
00045            *   p.numberOfValidTrackerHits() + 
00046            *   p.numberOfLostTrackerHits() +  
00047            *   p.numberOfValidPixelHits() +   
00048            *   p.numberOfLostPixelHits();
00049            * for (int i = 0; i < numHits; ++i) {
00050            *   printf("hit %d: pattern 0x%x, residual (local x) %f\n", i
00051            *         p.getHitPattern(i), r.residualX(p, i));
00052            * }
00053            */
00056           double                residualX (int i, const HitPattern &) const;
00057           double                residualY (int i, const HitPattern &) const;
00060           double                residualX (int i) const;
00061           double                residualY (int i) const;
00062        
00063      protected:
00064           static double         unpack_pull (unsigned char);
00065           static unsigned char          pack_pull (double);
00066           static double         unpack_residual (unsigned char);
00067           static unsigned char          pack_residual (double);
00068        
00069      private:
00071           unsigned char         residuals_[numResiduals];
00072           char                  residualType;
00073      };
00074 }
00075 
00076 #endif