ATLAS Offline Software
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 
8 namespace 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 
32  float METComponent::magnitude() const {
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
METComponent.h
HLT::MET::SignedKinematics::px
double px() const
Definition: SignedKinematics.cxx:121
HLT::MET::METComponent::mpx
float mpx
Momentum components x momentum.
Definition: METComponent.h:55
HLT::MET::METComponent::fillMET
void fillMET(xAOD::TrigMissingET &met) const
Fill the main component of the MET with this.
Definition: METComponent.cxx:91
HLT::MET::METComponent::sumEt
float sumEt
And the sumEt.
Definition: METComponent.h:72
HLT::MET::operator<<
std::ostream & operator<<(std::ostream &os, const METComponent &component)
Definition: METComponent.cxx:112
HLT::MET::METComponent::status
int status
The status flag.
Definition: METComponent.h:74
HLT::MET::SignedKinematics::pt
double pt() const
(signed) pt
Definition: SignedKinematics.cxx:112
HLT::MET::METComponent::sumE
float sumE
Also store the sumE.
Definition: METComponent.h:70
met
Definition: IMETSignificance.h:24
HLT::MET::METComponent::magnitude
float magnitude() const
The magnitude of the missing 3-vector.
Definition: METComponent.cxx:32
HLT::MET::SignedKinematics
Class to describe the kinematics of an object that can have negative energies.
Definition: SignedKinematics.h:42
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition: HLTResultReader.h:26
master.flag
bool flag
Definition: master.py:29
HLT::MET::METComponent::operator+=
METComponent & operator+=(const METComponent &other)
Add one to us.
Definition: METComponent.cxx:57
HLT::MET::METComponent::METComponent
METComponent()
Definition: METComponent.h:48
python.Dumpers.asinh
def asinh(x)
helper methods ---------------------------------------------------------—
Definition: Dumpers.py:89
HLT::MET::METComponent::phi
float phi() const
The direction.
Definition: METComponent.cxx:36
HLT::MET::METComponent::fillMETComponent
void fillMETComponent(std::size_t idx, xAOD::TrigMissingET &met) const
Fill a component of the MET with this.
Definition: METComponent.cxx:101
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
HLT::MET::METComponent::mpy
float mpy
y momentum
Definition: METComponent.h:57
HLT::MET::METComponent
Helper struct to build up MET values before moving them into the EDM.
Definition: METComponent.h:40
MET
Definition: MET.py:1
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
HLT::MET::METComponent::met
float met() const
The actual met.
Definition: METComponent.cxx:28
xAOD::TrigMissingET_v1
Class holding the Missing ET trigger fex results.
Definition: TrigMissingET_v1.h:32
HLT::MET::METComponent::eta
float eta() const
The (pseudo) eta.
Definition: METComponent.cxx:42
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
merge.status
status
Definition: merge.py:17
HLT::MET::SignedKinematics::energy
double energy() const
Energy values (signed) energy.
Definition: SignedKinematics.cxx:131
HLT::MET::SignedKinematics::pz
double pz() const
Definition: SignedKinematics.cxx:127
HLT::MET::operator+
METComponent operator+(const METComponent &lhs, const METComponent &rhs)
Definition: METComponent.cxx:48
HLT::MET::METComponent::mpz
float mpz
z momentum
Definition: METComponent.h:59
HLT::MET::SignedKinematics::py
double py() const
Definition: SignedKinematics.cxx:124