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 
5 #include "xAODJet/Jet.h"
7 #include "../src/TLorentzVectorAsIJet.h"
9 #include <TLorentzVector.h>
10 #include "gtest/gtest.h"
11 
12 /*
13 using ::testing::Return;
14 using ::testing::_;
15 using ::testing::SetArgReferee;
16 */
17 
18 class xAODJetCollectorTest: public ::testing::Test {
19 public:
21 };
22 
23 
25  // zero jets in. Jet collector is empty.
26 
28  xAODJetCollector collector;
29  collector.addJets(jets.begin(), jets.end());
30  EXPECT_TRUE(collector.empty());
31 }
32 
33 
34 TEST_F(xAODJetCollectorTest, multipleInputJets){
35  //multiple jets in. Jet collector is not empty and has the correct number.
36 
37  constexpr std::size_t njets{11};
38  std::vector<xAOD::Jet> xaodjets (njets);
40  jets.reserve (njets);
41  for(unsigned int ijet = 0; ijet < njets; ++ijet){
42  jets.emplace_back (new HypoJet::xAODJetAsIJet(&xaodjets[ijet], ijet));
43  }
44 
45  xAODJetCollector collector;
46  collector.addJets(jets.begin(), jets.end());
47 
48  EXPECT_FALSE(collector.empty());
49  EXPECT_FALSE((collector.xAODJets()).size() == 10);
50 }
51 
52 
54  // multiple non-xAOD jets in. Jet collector is empty.
55 
56  unsigned int njets{11};
58  jets.reserve (njets);
59  for(unsigned int ijet = 0; ijet < njets; ++ijet){
60  TLorentzVector v;
61  jets.emplace_back (new TLorentzVectorAsIJet(v));
62  }
63 
64  xAODJetCollector collector;
65  collector.addJets(jets.begin(), jets.end());
66 
67  // These hypoJets are not xAOD jets.
68  EXPECT_FALSE(collector.empty());
69  EXPECT_TRUE(collector.size() == njets);
70  EXPECT_TRUE((collector.hypoJets()).size() == njets);
71  EXPECT_TRUE((collector.xAODJets()).size() == 0);
72 }
73 
xAODJetCollectorTest::xAODJetCollectorTest
xAODJetCollectorTest()
Definition: xAODJetCollectorTest.cxx:20
Jet.h
xAODJetCollector::hypoJets
HypoJetVector hypoJets() const
Definition: xAODJetCollector.cxx:44
xAODJetAsIJet.h
defineDB.jets
jets
Definition: JetTagCalibration/share/defineDB.py:24
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:24
xAODJetCollector::empty
bool empty() const
Definition: xAODJetCollector.cxx:68
xAODJetCollector
Definition: xAODJetCollector.h:20
xAODJetCollectorTest
Definition: xAODJetCollectorTest.cxx:18
TLorentzVectorAsIJet
Definition: TLorentzVectorAsIJet.h:12
python.PyAthena.v
v
Definition: PyAthena.py:154
HypoJet::xAODJetAsIJet
Definition: xAODJetAsIJet.h:16