CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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) { vetoDir_ = Direction(eta, phi); }
14 
15 bool ThresholdVeto::veto(double eta, double phi, float value) const { return (value <= threshold_); }
16 void ThresholdVeto::centerOn(double eta, double phi) {}
17 
19 
20 bool ThresholdVetoFromTransverse::veto(double eta, double phi, float value) const {
21  return (value / sin(2 * atan(exp(-eta))) <= threshold_); // convert Et to E
22 }
23 void ThresholdVetoFromTransverse::centerOn(double eta, double phi) {}
24 
26 
27 bool AbsThresholdVeto::veto(double eta, double phi, float value) const { return (fabs(value) <= threshold_); }
28 void AbsThresholdVeto::centerOn(double eta, double phi) {}
29 
31 
32 bool AbsThresholdVetoFromTransverse::veto(double eta, double phi, float value) const {
33  return (fabs(value / sin(2 * atan(exp(-eta)))) <= threshold_); // convert Et to E
34 }
35 void AbsThresholdVetoFromTransverse::centerOn(double eta, double phi) {}
36 
38 
39 bool ConeThresholdVeto::veto(double eta, double phi, float value) const {
40  return (value <= threshold_) || (vetoDir_.deltaR2(Direction(eta, phi)) < dR2_);
41 }
42 void ConeThresholdVeto::centerOn(double eta, double phi) { vetoDir_ = Direction(eta, phi); }
43 
45 
46 AngleConeVeto::AngleConeVeto(const math::XYZVectorD& dir, double angle) : vetoDir_(dir.Unit()), cosTheta_(cos(angle)) {}
47 AngleConeVeto::AngleConeVeto(Direction dir, double angle) : vetoDir_(0, 0, 1), cosTheta_(cos(angle)) {
48  vetoDir_ = math::RhoEtaPhiVectorD(1, dir.eta(), dir.phi()).Unit();
49 }
50 bool AngleConeVeto::veto(double eta, double phi, float value) const {
51  math::RhoEtaPhiVectorD tmp(1, eta, phi);
52  return (vetoDir_.Dot(tmp.Unit()) > cosTheta_);
53 }
54 void AngleConeVeto::centerOn(double eta, double phi) { vetoDir_ = math::RhoEtaPhiVectorD(1, eta, phi).Unit(); }
55 
57 
58 AngleCone::AngleCone(const math::XYZVectorD& dir, double angle) : coneDir_(dir.Unit()), cosTheta_(cos(angle)) {}
59 AngleCone::AngleCone(Direction dir, double angle) : coneDir_(0, 0, 1), cosTheta_(cos(angle)) {
60  coneDir_ = math::RhoEtaPhiVectorD(1, dir.eta(), dir.phi()).Unit();
61 }
62 bool AngleCone::veto(double eta, double phi, float value) const {
63  math::RhoEtaPhiVectorD tmp(1, eta, phi);
64  return (coneDir_.Dot(tmp.Unit()) < cosTheta_);
65 }
66 void AngleCone::centerOn(double eta, double phi) { coneDir_ = math::RhoEtaPhiVectorD(1, eta, phi).Unit(); }
67 
69 
71  const math::XYZVectorD& dir, double etaMin, double etaMax, double phiMin, double phiMax)
72  : vetoDir_(dir.eta(), dir.phi()), etaMin_(etaMin), etaMax_(etaMax), phiMin_(phiMin), phiMax_(phiMax) {}
73 
75  : vetoDir_(dir.eta(), dir.phi()), etaMin_(etaMin), etaMax_(etaMax), phiMin_(phiMin), phiMax_(phiMax) {}
76 
77 bool RectangularEtaPhiVeto::veto(double eta, double phi, float value) const {
78  //vetoDir_.phi() is already [0,2*M_PI], make sure the vetoDir phi is
79  //also assuming that the etaMin_ and etaMax_ are set correctly by user
80  //or possible user only wants a limit in one directions
81  //so should be able to set phi or eta to something extreme (-100,100) e.g.
82  double dPhi = phi - vetoDir_.phi();
83  double dEta = eta - vetoDir_.eta();
84  while (dPhi < -M_PI)
85  dPhi += 2 * M_PI;
86  while (dPhi >= M_PI)
87  dPhi -= 2 * M_PI;
88  return (etaMin_ < dEta) && (dEta < etaMax_) && (phiMin_ < dPhi) && (dPhi < phiMax_);
89 }
90 
91 void RectangularEtaPhiVeto::centerOn(double eta, double phi) { vetoDir_ = Direction(eta, phi); }
bool veto(double eta, double phi, float value) const override
Return &quot;true&quot; if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
bool veto(double eta, double phi, float value) const override
Return &quot;true&quot; if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
void centerOn(double eta, double phi) override
bool veto(double eta, double phi, float value) const override
Return &quot;true&quot; if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
bool veto(double eta, double phi, float value) const override
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
void centerOn(double eta, double phi) override
void centerOn(double eta, double phi) override
tuple etaMin
Definition: Puppi_cff.py:45
AngleCone(const math::XYZVectorD &dir, double angle)
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
etaMax_(conf.getParameter< double >("etaMax"))
void centerOn(double eta, double phi) override
bool veto(double eta, double phi, float value) const override
Return &quot;true&quot; if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
double deltaR2(const Direction &dir2) const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void centerOn(double eta, double phi) override
bool veto(double eta, double phi, float value) const override
Return &quot;true&quot; if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
void centerOn(double eta, double phi) override
bool veto(double eta, double phi, float value) const override
Return &quot;true&quot; if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
void centerOn(double eta, double phi) override
#define M_PI
AngleConeVeto(const math::XYZVectorD &dir, double angle)
bool veto(double eta, double phi, float value) const override
Return &quot;true&quot; if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
RectangularEtaPhiVeto(const math::XYZVectorD &dir, double etaMin, double etaMax, double phiMin, double phiMax)
void centerOn(double eta, double phi) override
void centerOn(double eta, double phi) override
tuple etaMax
Definition: Puppi_cff.py:46
tmp
align.sh
Definition: createJobs.py:716
etaMin_(conf.getParameter< double >("etaMin"))
bool veto(double eta, double phi, float value) const override
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:10
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11