ATLAS Offline Software
MockJetWithLorentzVector.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGHLTJETHYPOUNITTESTS_MOCKJETWITHLORENTZVECTOR_H
6 #define TRIGHLTJETHYPOUNITTESTS_MOCKJETWITHLORENTZVECTOR_H
7 
9 #include "gtest/gtest.h"
10 #include "gmock/gmock.h"
11 #include <TLorentzVector.h>
12 
13 using ::testing::Invoke;
14 using ::testing::Return;
16 using ::testing::SetArgReferee;
17 using ::testing::AnyNumber;
18 
20 public:
21 
22  MockJetWithLorentzVector(const TLorentzVector& lv):m_lv{lv} {
23  ON_CALL(*this, eta())
24  .WillByDefault(Invoke(&m_lv, &TLorentzVector::Eta));
25  ON_CALL(*this, et())
26  .WillByDefault(Invoke(&m_lv,
27  static_cast<double(TLorentzVector::*)() const>
28  (&TLorentzVector::Et)));
29  }
30 
31  MOCK_CONST_METHOD0(pt, double());
32  MOCK_CONST_METHOD0(eta, double());
33  MOCK_CONST_METHOD0(phi, double());
34  MOCK_CONST_METHOD0(m, double ());
35  MOCK_CONST_METHOD0(e, double());
36  MOCK_CONST_METHOD0(et, double());
38  virtual TLorentzVector p4() const override {return m_lv;}
39  virtual std::string toString() const override {
40  double etav = eta();
41  double etv = et();
42  std::string s = "et: " + std::to_string(etv) +
43  " eta: " + std::to_string(etav);
44  return s;
45  }
46 
47  MOCK_CONST_METHOD0(position, unsigned int());
48  MOCK_CONST_METHOD2(getAttribute, bool (const std::string&, float&));
49 
50  // Had problems compiling mock method
51  // MOCK_CONST_METHOD0(xAODJet, std::optional<const xAOD::Jet*>);
52  virtual std::optional<const xAOD::Jet*> xAODJet() const override{
53  return std::optional<const xAOD::Jet*> ();
54  }
55  private:
56  TLorentzVector m_lv;
57 
58 };
59 #endif
MockJetWithLorentzVector::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(e, double())
MockJetWithLorentzVector
Definition: MockJetWithLorentzVector.h:19
et
Extra patterns decribing particle interation process.
MockJetWithLorentzVector::m_lv
TLorentzVector m_lv
Definition: MockJetWithLorentzVector.h:56
MockJetWithLorentzVector::xAODJet
virtual std::optional< const xAOD::Jet * > xAODJet() const override
Definition: MockJetWithLorentzVector.h:52
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
MockJetWithLorentzVector::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(rapidity, double())
HypoJet::IJet::et
virtual double et() const =0
Run3DQTestingDriver._
_
Definition: Run3DQTestingDriver.py:35
MockJetWithLorentzVector::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(pt, double())
IJet.h
HypoJet::IJet::pt
virtual double pt() const =0
HypoJet::IJet::position
virtual unsigned int position() const =0
MockJetWithLorentzVector::MOCK_CONST_METHOD2
MOCK_CONST_METHOD2(getAttribute, bool(const std::string &, float &))
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
MockJetWithLorentzVector::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(phi, double())
HypoJet::IJet::eta
virtual double eta() const =0
MockJetWithLorentzVector::toString
virtual std::string toString() const override
Definition: MockJetWithLorentzVector.h:39
MockJetWithLorentzVector::p4
virtual TLorentzVector p4() const override
Definition: MockJetWithLorentzVector.h:38
MockJetWithLorentzVector::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(m, double())
HypoJet::IJet
Definition: IJet.h:16
HypoJet::IJet::m
virtual double m() const =0
MockJetWithLorentzVector::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(et, double())
MockJetWithLorentzVector::MockJetWithLorentzVector
MockJetWithLorentzVector(const TLorentzVector &lv)
Definition: MockJetWithLorentzVector.h:22
HypoJet::IJet::e
virtual double e() const =0
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
MockJetWithLorentzVector::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(position, unsigned int())
HypoJet::IJet::rapidity
virtual double rapidity() const =0
MockJetWithLorentzVector::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(eta, double())
HypoJet::IJet::phi
virtual double phi() const =0
HypoJet::IJet::getAttribute
virtual bool getAttribute(const std::string &name, float &) const =0
Eta
@ Eta
Definition: RPCdef.h:8