ATLAS Offline Software
Loading...
Searching...
No Matches
METComponent.cxx
Go to the documentation of this file.
1/*
2 * Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4
6#include <cmath>
7
8namespace HLT { namespace MET {
10 mpx(met.ex() ),
11 mpy(met.ey() ),
12 mpz(met.ez() ),
13 sumE(met.sumE() ),
14 sumEt(met.sumEt() ),
15 status(met.flag() )
16 {}
17
19 std::size_t idx, const xAOD::TrigMissingET& met) :
20 mpx(met.exComponent(idx) ),
21 mpy(met.eyComponent(idx) ),
22 mpz(met.ezComponent(idx) ),
23 sumE(met.sumEComponent(idx) ),
24 sumEt(met.sumEtComponent(idx) ),
25 status(met.statusComponent(idx) )
26 {}
27
28 float METComponent::met() const {
29 return sqrt(mpx*mpx+mpy*mpy);
30 }
31
33 return sqrt(mpx*mpx+mpy*mpy+mpz*mpz);
34 }
35
36 float METComponent::phi() const {
37 if (mpy == 0 && mpx == 0)
38 return 0;
39 return std::atan2(mpy, mpx);
40 }
41
42 float METComponent::eta() const {
43 if (met() == 0)
44 return 0;
45 return std::asinh(mpz/met() );
46 }
47
49 const METComponent& lhs,
50 const METComponent& rhs)
51 {
52 METComponent ret(lhs);
53 ret += rhs;
54 return ret;
55 }
56
58 const METComponent& other)
59 {
60 mpx += other.mpx;
61 mpy += other.mpy;
62 mpz += other.mpz;
63 sumE += other.sumE;
64 sumEt += other.sumEt;
65 status |= other.status;
66 return *this;
67 }
68
70 const TLorentzVector& otherP4)
71 {
72 mpx -= otherP4.Px();
73 mpy -= otherP4.Py();
74 mpz -= otherP4.Pz();
75 sumE += otherP4.E();
76 sumEt += otherP4.Pt();
77 return *this;
78 }
79
81 const SignedKinematics& kin)
82 {
83 mpx -= kin.px();
84 mpy -= kin.py();
85 mpz -= kin.pz();
86 sumE += kin.energy();
87 sumEt += kin.pt();
88 return *this;
89 }
90
92 {
93 met.setEx(mpx);
94 met.setEy(mpy);
95 met.setEz(mpz);
96 met.setSumE(sumE);
97 met.setSumEt(sumEt);
98 met.setFlag(status);
99 }
100
102 std::size_t ii, xAOD::TrigMissingET& met) const
103 {
104 met.setExComponent(ii, mpx);
105 met.setEyComponent(ii, mpy);
106 met.setEzComponent(ii, mpy);
107 met.setSumEComponent(ii, sumE);
108 met.setSumEtComponent(ii, sumEt);
109 met.setStatusComponent(ii, status);
110 }
111
112 std::ostream& operator<<(std::ostream& os, const METComponent& component)
113 {
114 os << "(mpx, mpy, mpz, met, sumEt, sumE) = ("
115 << component.mpx << ", "
116 << component.mpy << ", "
117 << component.mpz << ", "
118 << component.met() << ", "
119 << component.sumEt << ", "
120 << component.sumE << ") [MeV]";
121 return os;
122 }
123} } //> end namespace HLT::MET
Helper struct to build up MET values before moving them into the EDM.
float mpx
Momentum components x momentum.
float sumE
Also store the sumE.
float mpz
z momentum
float sumEt
And the sumEt.
float eta() const
The (pseudo) eta.
float mpy
y momentum
METComponent & operator+=(const METComponent &other)
Add one to us.
int status
The status flag.
float phi() const
The direction.
float magnitude() const
The magnitude of the missing 3-vector.
void fillMETComponent(std::size_t idx, xAOD::TrigMissingET &met) const
Fill a component of the MET with this.
void fillMET(xAOD::TrigMissingET &met) const
Fill the main component of the MET with this.
float met() const
The actual met.
Class to describe the kinematics of an object that can have negative energies.
double energy() const
Energy values (signed) energy.
double pt() const
(signed) pt
METComponent operator+(const METComponent &lhs, const METComponent &rhs)
std::ostream & operator<<(std::ostream &os, const METComponent &component)
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition MET.py:1
TrigMissingET_v1 TrigMissingET
Define the most recent version of the TrigMissingET class.