CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IsoDepositVetos.cc
Go to the documentation of this file.
3 
4 #include <cmath>
5 #include <iostream>
6 
7 using namespace reco::isodeposit;
8 
9 bool ConeVeto::veto(double eta, double phi, float value) const {
10  return ( vetoDir_.deltaR2(Direction(eta,phi)) < dR2_ );
11 }
12 void ConeVeto::centerOn(double eta, double phi) {
13  vetoDir_ = Direction(eta,phi);
14 }
16 
17 bool ThresholdVeto::veto(double eta, double phi, float value) const {
18  return (value <= threshold_);
19 }
20 void ThresholdVeto::centerOn(double eta, double phi) { }
21 
23 
24 bool ThresholdVetoFromTransverse::veto(double eta, double phi, float value) const {
25  return ( value/sin(2*atan(exp(-eta))) <= threshold_); // convert Et to E
26 }
28 
30 
31 bool AbsThresholdVeto::veto(double eta, double phi, float value) const {
32  return ( fabs(value) <= threshold_);
33 }
34 void AbsThresholdVeto::centerOn(double eta, double phi) { }
35 
37 
38 bool AbsThresholdVetoFromTransverse::veto(double eta, double phi, float value) const {
39  return ( fabs(value/sin(2*atan(exp(-eta)))) <= threshold_); // convert Et to E
40 }
42 
44 
45 bool ConeThresholdVeto::veto(double eta, double phi, float value) const {
46  return (value <= threshold_) || ( vetoDir_.deltaR2(Direction(eta,phi)) < dR2_ );
47 }
48 void ConeThresholdVeto::centerOn(double eta, double phi) {
49  vetoDir_ = Direction(eta,phi);
50 }
51 
53 
54 AngleConeVeto::AngleConeVeto(math::XYZVectorD dir, double angle) : vetoDir_(dir.Unit()), cosTheta_(cos(angle)) {
55 }
56 AngleConeVeto::AngleConeVeto(Direction dir, double angle) : vetoDir_(0,0,1), cosTheta_(cos(angle)) {
57  vetoDir_ = math::RhoEtaPhiVectorD(1, dir.eta(), dir.phi()).Unit();
58 }
59 bool AngleConeVeto::veto(double eta, double phi, float value) const {
60  math::RhoEtaPhiVectorD tmp(1, eta, phi);
61  return ( vetoDir_.Dot(tmp.Unit()) > cosTheta_ );
62 }
63 void AngleConeVeto::centerOn(double eta, double phi) {
64  vetoDir_ = math::RhoEtaPhiVectorD(1, eta, phi).Unit();
65 }
66 
68 
69 AngleCone::AngleCone(math::XYZVectorD dir, double angle) : coneDir_(dir.Unit()), cosTheta_(cos(angle)) {
70 }
71 AngleCone::AngleCone(Direction dir, double angle) : coneDir_(0,0,1), cosTheta_(cos(angle)) {
72  coneDir_ = math::RhoEtaPhiVectorD(1, dir.eta(), dir.phi()).Unit();
73 }
74 bool AngleCone::veto(double eta, double phi, float value) const {
75  math::RhoEtaPhiVectorD tmp(1, eta, phi);
76  return ( coneDir_.Dot(tmp.Unit()) < cosTheta_ );
77 }
78 void AngleCone::centerOn(double eta, double phi) {
79  coneDir_ = math::RhoEtaPhiVectorD(1, eta, phi).Unit();
80 }
81 
83 
85  vetoDir_(dir.eta(),dir.phi()), etaMin_(etaMin), etaMax_(etaMax), phiMin_(phiMin), phiMax_(phiMax) {
86 }
87 
89  vetoDir_(dir.eta(),dir.phi()), etaMin_(etaMin), etaMax_(etaMax), phiMin_(phiMin), phiMax_(phiMax) {
90 }
91 
92 bool RectangularEtaPhiVeto::veto(double eta, double phi, float value) const {
93  //vetoDir_.phi() is already [0,2*M_PI], make sure the vetoDir phi is
94  //also assuming that the etaMin_ and etaMax_ are set correctly by user
95  //or possible user only wants a limit in one directions
96  //so should be able to set phi or eta to something extreme (-100,100) e.g.
97  double dPhi = phi - vetoDir_.phi();
98  double dEta = eta - vetoDir_.eta();
99  while( dPhi < -M_PI ) dPhi += 2*M_PI;
100  while( dPhi >= M_PI ) dPhi -= 2*M_PI;
101  return (etaMin_ < dEta) && (dEta < etaMax_) &&
102  (phiMin_ < dPhi) && (dPhi < phiMax_);
103 }
104 
105 void RectangularEtaPhiVeto::centerOn(double eta, double phi) {
106  vetoDir_ = Direction(eta,phi);
107 }
virtual bool veto(double eta, double phi, float value) const
Return &quot;true&quot; if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
virtual void centerOn(double eta, double phi)
virtual void centerOn(double eta, double phi)
virtual void centerOn(double eta, double phi)
virtual bool veto(double eta, double phi, float value) const
Return &quot;true&quot; if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
virtual bool veto(double eta, double phi, float value) const
Return &quot;true&quot; if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
RectangularEtaPhiVeto(math::XYZVectorD dir, double etaMin, double etaMax, double phiMin, double phiMax)
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
virtual void centerOn(double eta, double phi)
T eta() const
AngleConeVeto(math::XYZVectorD dir, double angle)
AngleCone(math::XYZVectorD dir, double angle)
virtual void centerOn(double eta, double phi)
double deltaR2(const Direction &dir2) const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:9
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
virtual void centerOn(double eta, double phi)
virtual bool veto(double eta, double phi, float value) const
Return &quot;true&quot; if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
virtual bool veto(double eta, double phi, float value) const
Return &quot;true&quot; if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
#define M_PI
Definition: BFit3D.cc:3
virtual bool veto(double eta, double phi, float value) const
Return &quot;true&quot; if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
virtual void centerOn(double eta, double phi)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
virtual bool veto(double eta, double phi, float value) const
Return &quot;true&quot; if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
virtual void centerOn(double eta, double phi)
dbl *** dir
Definition: mlp_gen.cc:35
virtual void centerOn(double eta, double phi)
virtual bool veto(double eta, double phi, float value) const
Return &quot;true&quot; if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
virtual bool veto(double eta, double phi, float value) const
Return &quot;true&quot; if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
ROOT::Math::DisplacementVector3D< ROOT::Math::CylindricalEta3D< double > > RhoEtaPhiVectorD
spatial vector with cylindrical internal representation using pseudorapidity
Definition: Vector3D.h:11
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
Definition: DDAxes.h:10