CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/RecoMuon/L3TrackFinder/src/EtaPhiEstimator.h

Go to the documentation of this file.
00001 #include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimatorBase.h"
00002 #include "DataFormats/Math/interface/deltaPhi.h"
00003 #include "DataFormats/Math/interface/deltaR.h"
00004 
00005 class EtaPhiEstimator : public Chi2MeasurementEstimatorBase {
00006  public:
00007 
00013   explicit EtaPhiEstimator(double eta, double phi,
00014                            const Chi2MeasurementEstimatorBase * estimator): 
00015     Chi2MeasurementEstimatorBase(estimator->chiSquaredCut(),
00016                                  estimator->nSigmaCut()),
00017     estimator_(estimator),
00018     thedEta(eta),
00019     thedPhi(phi),
00020     thedEta2(eta*eta),
00021     thedPhi2(phi*phi)
00022       { }
00023 
00024     virtual std::pair<bool,double> estimate(const TrajectoryStateOnSurface& tsos,
00025                                             const TransientTrackingRecHit& aRecHit) const{
00026       
00027       std::pair<bool,double> primaryResult = estimator_->estimate(tsos,aRecHit);
00028 
00029       double dEta = fabs(tsos.globalPosition().eta() - aRecHit.globalPosition().eta());
00030       double dPhi = deltaPhi< double > (tsos.globalPosition().phi(), aRecHit.globalPosition().phi());
00031 
00032       double check = (dEta*dEta)/(thedEta2) + (dPhi*dPhi)/(thedPhi2);
00033       
00034       LogDebug("EtaPhiMeasurementEstimator")<< " The state to compare with is \n"<< tsos
00035                                             << " The hit position is:\n" << aRecHit.globalPosition()
00036                                             << " deta: "<< dEta<< " dPhi: "<<dPhi<<" check: "<<check<<" primaryly: "<< primaryResult.second;
00037 
00038       if (check <= 1)
00039         //      if (dEta < thedEta && dPhi <thedPhi)
00040         return std::make_pair(true, primaryResult.second);
00041       else
00042         return std::make_pair(false, primaryResult.second);
00043     }
00044     
00045     virtual EtaPhiEstimator* clone() const {
00046       return new EtaPhiEstimator(*this);
00047     }
00048 
00049  private:
00050     const Chi2MeasurementEstimatorBase * estimator_;
00051     double thedEta,thedPhi,thedEta2,thedPhi2;
00052 };