ATLAS Offline Software
xAODJetCollector.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "xAODJetCollector.h"
6 
7 #include <algorithm>
8 #include <cassert>
9 
11  const HypoJetCIter& end,
12  int chainPartInd){
13  auto& jets = m_jets[chainPartInd];
14  jets.insert(jets.end(), begin, end);
15 }
16 
17 
18 std::vector<const xAOD::Jet*> xAODJetCollector::xAODJets() const {
19 
21  for (const auto& p : m_jets){
22  std::copy(p.second.cbegin(),
23  p.second.cend(),
24  std::back_inserter(all)
25  );
26  }
27  return xAODJets_(all.cbegin(), all.cend());
28 }
29 
30 
31 std::vector<const xAOD::Jet*>
32 xAODJetCollector::xAODJets(int chainPartInd) const {
33 
34  if (m_jets.count(chainPartInd) == 0){
35  std::vector<const xAOD::Jet*> empty;
36  return empty;
37  }
38 
39  const auto& jets = m_jets.at(chainPartInd);
40  return xAODJets_(jets.cbegin(), jets.cend());
41 }
42 
43 
46  for (const auto& p : m_jets){
47  std::copy(p.second.cbegin(),
48  p.second.cend(),
49  std::back_inserter(all)
50  );
51  }
52  HypoJetSet js(all.begin(), all.end());
53  return HypoJetVector(js.begin(), js.end());
54 }
55 
56 
57 
58 HypoJetVector xAODJetCollector::hypoJets(int chainPartInd) const {
59  auto begin = m_jets.at(chainPartInd).cbegin();
60  auto end = m_jets.at(chainPartInd).cend();
61  HypoJetSet js(begin, end);
62  return HypoJetVector(js.begin(), js.end());
63 }
64 
65 
66 std::size_t xAODJetCollector::size() const {return hypoJets().size();}
67 
68 bool xAODJetCollector::empty() const {return hypoJets().empty();}
69 
70 std::vector<const xAOD::Jet*>
71 xAODJetCollector::xAODJets_(const HypoJetVector::const_iterator begin,
72  const HypoJetVector::const_iterator end
73  ) const {
74 
76 
77  auto new_end =
78  std::partition(hypoJets.begin(),
79  hypoJets.end(),
80  [](const pHypoJet& j){
81  return (j->xAODJet()).has_value();});
82  // add xAOD::Jet* to m_jets
83  std::vector<const xAOD::Jet*> xJets;
84  xJets.reserve(new_end - hypoJets.begin());
85  std::transform(hypoJets.begin(),
86  new_end,
87  back_inserter(xJets),
88  [](const pHypoJet j){return *(j->xAODJet());});
89 
90  std::set<const xAOD::Jet*> js(xJets.begin(), xJets.end());
91  return std::vector<const xAOD::Jet*> (js.begin(), js.end());
92 }
93 
94 
95 std::vector<int> xAODJetCollector::legInds() const {
96  std::vector<int> legInds;
97 
98  for(auto it = m_jets.begin(); it != m_jets.end(); ++it){
99  legInds.push_back(it->first);
100  }
101 
102  return legInds;
103 }
xAODJetCollector::hypoJets
HypoJetVector hypoJets() const
Definition: xAODJetCollector.cxx:44
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
xAODJetCollector::m_jets
std::map< int, HypoJetVector > m_jets
Definition: xAODJetCollector.h:45
HypoJetSet
std::set< pHypoJet > HypoJetSet
Definition: HypoJetDefs.h:30
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
skel.it
it
Definition: skel.GENtoEVGEN.py:423
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
xAODJetCollector::xAODJets
std::vector< const xAOD::Jet * > xAODJets() const
Definition: xAODJetCollector.cxx:18
pHypoJet
std::shared_ptr< const HypoJet::IJet > pHypoJet
Definition: HypoJetDefs.h:25
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
HypoJetCIter
HypoJetVector::const_iterator HypoJetCIter
Definition: HypoJetDefs.h:29
xAODJetCollector::legInds
std::vector< int > legInds() const
Definition: xAODJetCollector.cxx:95
xAODJetCollector.h
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
HypoJetVector
std::vector< pHypoJet > HypoJetVector
Definition: HypoJetDefs.h:27
xAODJetCollector::empty
bool empty() const
Definition: xAODJetCollector.cxx:68
Cut::all
@ all
Definition: SUSYToolsAlg.cxx:64
xAODJetCollector::xAODJets_
std::vector< const xAOD::Jet * > xAODJets_(const HypoJetVector::const_iterator begin, const HypoJetVector::const_iterator end) const
Definition: xAODJetCollector.cxx:71
StateLessPT_NewConfig.partition
partition
Definition: StateLessPT_NewConfig.py:49
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
calibdata.copy
bool copy
Definition: calibdata.py:27