CMS 3D CMS Logo

IsoDepositVetos.cc

Go to the documentation of this file.
00001 #include "DataFormats/RecoCandidate/interface/IsoDepositVetos.h"
00002 #include "DataFormats/RecoCandidate/interface/IsoDepositDirection.h"
00003 
00004 #include <cmath>
00005 #include <iostream>
00006 
00007 using namespace std;
00008 using namespace reco::isodeposit;
00009 
00010 bool ConeVeto::veto(double eta, double phi, float value) const {
00011   return ( vetoDir_.deltaR2(Direction(eta,phi)) < dR2_ );
00012 }
00013 void ConeVeto::centerOn(double eta, double phi) { 
00014         vetoDir_ = Direction(eta,phi);
00015 }
00017 
00018 bool ThresholdVeto::veto(double eta, double phi, float value) const {
00019     return (value <= threshold_);
00020 }
00021 void ThresholdVeto::centerOn(double eta, double phi) { }
00022 
00024 
00025 bool ThresholdVetoFromTransverse::veto(double eta, double phi, float value) const {
00026   return ( value/sin(2*atan(exp(-eta)))  <= threshold_);  // convert Et to E
00027 }
00028 void ThresholdVetoFromTransverse::centerOn(double eta, double phi) { }
00029 
00031 
00032 bool AbsThresholdVeto::veto(double eta, double phi, float value) const {
00033     return ( fabs(value) <= threshold_);
00034 }
00035 void AbsThresholdVeto::centerOn(double eta, double phi) { }
00036 
00038 
00039 bool AbsThresholdVetoFromTransverse::veto(double eta, double phi, float value) const {
00040   return ( fabs(value/sin(2*atan(exp(-eta))))  <= threshold_);  // convert Et to E
00041 }
00042 void AbsThresholdVetoFromTransverse::centerOn(double eta, double phi) { }
00043 
00045 
00046 bool ConeThresholdVeto::veto(double eta, double phi, float value) const {
00047   return (value <= threshold_) || ( vetoDir_.deltaR2(Direction(eta,phi)) < dR2_ );
00048 }
00049 void ConeThresholdVeto::centerOn(double eta, double phi) { 
00050         vetoDir_ = Direction(eta,phi);
00051 }
00052 
00054 
00055 AngleConeVeto::AngleConeVeto(math::XYZVectorD dir, double angle) : vetoDir_(dir.Unit()), cosTheta_(cos(angle)) {
00056 }
00057 AngleConeVeto::AngleConeVeto(Direction dir, double angle) : vetoDir_(0,0,1), cosTheta_(cos(angle)) {
00058     vetoDir_ = math::RhoEtaPhiVectorD(1, dir.eta(), dir.phi()).Unit(); 
00059 }
00060 bool AngleConeVeto::veto(double eta, double phi, float value) const {
00061     math::RhoEtaPhiVectorD tmp(1, eta, phi); 
00062     return ( vetoDir_.Dot(tmp.Unit()) > cosTheta_ );
00063 }
00064 void AngleConeVeto::centerOn(double eta, double phi) { 
00065         vetoDir_ = math::RhoEtaPhiVectorD(1, eta, phi).Unit(); 
00066 }
00067 
00069 
00070 AngleCone::AngleCone(math::XYZVectorD dir, double angle) : coneDir_(dir.Unit()), cosTheta_(cos(angle)) {
00071 }
00072 AngleCone::AngleCone(Direction dir, double angle) : coneDir_(0,0,1), cosTheta_(cos(angle)) {
00073     coneDir_ = math::RhoEtaPhiVectorD(1, dir.eta(), dir.phi()).Unit(); 
00074 }
00075 bool AngleCone::veto(double eta, double phi, float value) const {
00076     math::RhoEtaPhiVectorD tmp(1, eta, phi); 
00077     return ( coneDir_.Dot(tmp.Unit()) < cosTheta_ );
00078 }
00079 void AngleCone::centerOn(double eta, double phi) { 
00080         coneDir_ = math::RhoEtaPhiVectorD(1, eta, phi).Unit(); 
00081 }
00082 
00084                 
00085 RectangularEtaPhiVeto::RectangularEtaPhiVeto(math::XYZVectorD dir, double etaMin, double etaMax, double phiMin, double phiMax) :
00086         vetoDir_(dir.eta(),dir.phi()), etaMin_(etaMin), etaMax_(etaMax), phiMin_(phiMin), phiMax_(phiMax) {
00087 }
00088 
00089 RectangularEtaPhiVeto::RectangularEtaPhiVeto(Direction dir, double etaMin, double etaMax, double phiMin, double phiMax) :
00090         vetoDir_(dir.eta(),dir.phi()), etaMin_(etaMin), etaMax_(etaMax), phiMin_(phiMin), phiMax_(phiMax) {
00091 }
00092 
00093 bool RectangularEtaPhiVeto::veto(double eta, double phi, float value) const  {
00094         //vetoDir_.phi() is already [0,2*M_PI], make sure the vetoDir phi is 
00095         //also assuming that the etaMin_ and etaMax_ are set correctly by user
00096         //or possible user only wants a limit in one directions
00097         //so should be able to set phi or eta to something extreme (-100,100) e.g.
00098         double dPhi = phi - vetoDir_.phi();
00099         double dEta = eta - vetoDir_.eta();
00100         while( dPhi < -M_PI )   dPhi += 2*M_PI;
00101         while( dPhi >= M_PI )   dPhi -= 2*M_PI;
00102     return (etaMin_ < dEta) && (dEta < etaMax_) && 
00103            (phiMin_ < dPhi) && (dPhi < phiMax_); 
00104 }
00105 
00106 void RectangularEtaPhiVeto::centerOn(double eta, double phi) { 
00107         vetoDir_ = Direction(eta,phi);
00108 }

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