File indexing completed on 2024-04-06 12:26:58
0001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0002 #include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimatorBase.h"
0003 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
0004 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
0005 #include "DataFormats/Math/interface/deltaPhi.h"
0006 #include "DataFormats/Math/interface/deltaR.h"
0007
0008 class EtaPhiEstimator : public Chi2MeasurementEstimatorBase {
0009 public:
0010
0011
0012
0013
0014
0015 explicit EtaPhiEstimator(double eta, double phi, const Chi2MeasurementEstimatorBase* estimator)
0016 : Chi2MeasurementEstimatorBase(estimator->chiSquaredCut(), estimator->nSigmaCut()),
0017 estimator_(estimator),
0018 thedEta(eta),
0019 thedPhi(phi),
0020 thedEta2(eta * eta),
0021 thedPhi2(phi * phi) {}
0022
0023 std::pair<bool, double> estimate(const TrajectoryStateOnSurface& tsos, const TrackingRecHit& aRecHit) const override {
0024 std::pair<bool, double> primaryResult = estimator_->estimate(tsos, aRecHit);
0025
0026 double dEta = fabs(tsos.globalPosition().eta() - aRecHit.globalPosition().eta());
0027 double dPhi = deltaPhi<double>(tsos.globalPosition().phi(), aRecHit.globalPosition().phi());
0028
0029 double check = (dEta * dEta) / (thedEta2) + (dPhi * dPhi) / (thedPhi2);
0030
0031 LogDebug("EtaPhiMeasurementEstimator") << " The state to compare with is \n"
0032 << tsos << " The hit position is:\n"
0033 << aRecHit.globalPosition() << " deta: " << dEta << " dPhi: " << dPhi
0034 << " check: " << check << " primaryly: " << primaryResult.second;
0035
0036 if (check <= 1)
0037
0038 return std::make_pair(true, primaryResult.second);
0039 else
0040 return std::make_pair(false, primaryResult.second);
0041 }
0042
0043 EtaPhiEstimator* clone() const override { return new EtaPhiEstimator(*this); }
0044
0045 private:
0046 const Chi2MeasurementEstimatorBase* estimator_;
0047 double thedEta, thedPhi, thedEta2, thedPhi2;
0048 };