ATLAS Offline Software
xAODJetCollectorTest.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 #include "xAODJet/Jet.h"
10 #include "../src/TLorentzVectorAsIJet.h"
12 #include <TLorentzVector.h>
13 #include "gtest/gtest.h"
14 
15 /*
16 using ::testing::Return;
17 using ::testing::_;
18 using ::testing::SetArgReferee;
19 */
20 
21 class xAODJetCollectorTest: public ::testing::Test {
22 public:
24 };
25 
26 
28  // zero jets in. Jet collector is empty.
29 
31  xAODJetCollector collector;
32  collector.addJets(jets.begin(), jets.end());
33  EXPECT_TRUE(collector.empty());
34 }
35 
36 
37 TEST_F(xAODJetCollectorTest, multipleInputJets){
38  //multiple jets in. Jet collector is not empty and has the correct number.
39 
40  constexpr std::size_t njets{11};
41  std::vector<xAOD::Jet> xaodjets (njets);
43  jets.reserve (njets);
44  for(unsigned int ijet = 0; ijet < njets; ++ijet){
45  jets.emplace_back (new HypoJet::xAODJetAsIJet(&xaodjets[ijet], ijet));
46  }
47 
48  xAODJetCollector collector;
49  collector.addJets(jets.begin(), jets.end());
50 
51  EXPECT_FALSE(collector.empty());
52  EXPECT_FALSE((collector.xAODJets()).size() == 10);
53 }
54 
55 
57  // multiple non-xAOD jets in. Jet collector is empty.
58 
59  unsigned int njets{11};
61  jets.reserve (njets);
62  for(unsigned int ijet = 0; ijet < njets; ++ijet){
63  TLorentzVector v;
64  jets.emplace_back (new TLorentzVectorAsIJet(v));
65  }
66 
67  xAODJetCollector collector;
68  collector.addJets(jets.begin(), jets.end());
69 
70  // These hypoJets are not xAOD jets.
71  EXPECT_FALSE(collector.empty());
72  EXPECT_TRUE(collector.size() == njets);
73  EXPECT_TRUE((collector.hypoJets()).size() == njets);
74  EXPECT_TRUE((collector.xAODJets()).size() == 0);
75 }
76 
xAODJetCollectorTest::xAODJetCollectorTest
xAODJetCollectorTest()
Definition: xAODJetCollectorTest.cxx:23
Jet.h
xAODJetCollector::hypoJets
HypoJetVector hypoJets() const
Definition: xAODJetCollector.cxx:44
xAODJetAsIJet.h
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
Definition: xAODJetCollectorTest.cxx:6
xAODJetCollector::xAODJets
std::vector< const xAOD::Jet * > xAODJets() const
Definition: xAODJetCollector.cxx:18
xAODJetCollector::size
std::size_t size() const
Definition: xAODJetCollector.cxx:66
xAODJetCollector::addJets
void addJets(const HypoJetCIter &begin, const HypoJetCIter &end, int chainPartInd=-1)
Definition: xAODJetCollector.cxx:10
xAODJetCollector.h
HypoJetVector
std::vector< pHypoJet > HypoJetVector
Definition: HypoJetDefs.h:27
TEST_F
TEST_F(xAODJetCollectorTest, zeroJets)
Definition: xAODJetCollectorTest.cxx:27
xAODJetCollector::empty
bool empty() const
Definition: xAODJetCollector.cxx:68
xAODJetCollector
Definition: xAODJetCollector.h:20
xAODJetCollectorTest
Definition: xAODJetCollectorTest.cxx:21
TLorentzVectorAsIJet
Definition: TLorentzVectorAsIJet.h:12
python.PyAthena.v
v
Definition: PyAthena.py:157
HypoJet::xAODJetAsIJet
Definition: xAODJetAsIJet.h:16
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
checker_macros.h
Define macros for attributes used to control the static checker.