ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
CombinationsJetStream Class Reference

#include <CombinationsJetStream.h>

Inheritance diagram for CombinationsJetStream:
Collaboration diagram for CombinationsJetStream:

Public Member Functions

 CombinationsJetStream (const std::vector< std::size_t > &jets, std::unique_ptr< IJetStream > neigh, std::size_t k, std::size_t id)
 
virtual std::vector< std::size_t > get () override
 
virtual bool bump () override
 
virtual bool valid () const override
 
virtual std::string dump () const override
 

Private Member Functions

bool empty () const
 

Private Attributes

std::vector< std::size_t > m_jets
 
std::unique_ptr< IJetStreamm_neigh {nullptr}
 
std::size_t m_id
 
std::vector< std::size_t > m_data
 
std::unique_ptr< CombinationsGeneratorm_combgen {nullptr}
 
bool m_valid {false}
 

Friends

std::ostream & operator<< (std::ostream &, const CombinationsJetStream &)
 
std::stringstream & operator<< (std::stringstream &, const CombinationsJetStream &)
 

Detailed Description

Definition at line 35 of file CombinationsJetStream.h.

Constructor & Destructor Documentation

◆ CombinationsJetStream()

CombinationsJetStream::CombinationsJetStream ( const std::vector< std::size_t > &  jets,
std::unique_ptr< IJetStream neigh,
std::size_t  k,
std::size_t  id 
)
inline

Definition at line 43 of file CombinationsJetStream.h.

46  :
47  m_jets(jets),
48  m_neigh(std::move(neigh)),
49  m_id{id}
50  {
51  auto n = m_jets.size();
52 
53  m_valid = k <= n and !jets.empty();
54  if (m_valid) {
55  m_combgen.reset(new CombinationsGenerator(n, k));
56  auto indices = m_combgen->get();
57  m_data.clear();
58  for (const auto i : indices) {m_data.push_back(m_jets.at(i));}
59  }
60  }

Member Function Documentation

◆ bump()

virtual bool CombinationsJetStream::bump ( )
inlineoverridevirtual

Implements IJetStream.

Definition at line 71 of file CombinationsJetStream.h.

71  {
72 
73  // if there is a neighor, bump it. If it returns
74  // true, it has cycled, in which case try bumping this stream
75 
76  bool cycled{false};
77  if (m_neigh) {
78  bool neigh_cycled = m_neigh->bump();
79  if (!neigh_cycled) {return false;}
80 
81  cycled = m_combgen->bump();
82 
83  auto indices = m_combgen->get();
84  m_data.clear();
85  for (const auto i : indices) {m_data.push_back(m_jets.at(i));}
86  return cycled;
87  } else {
88  // no neighbor
89  cycled = m_combgen->bump();
90 
91  auto indices = m_combgen->get();
92  m_data.clear();
93  for (const auto& i : indices) {
94  m_data.push_back(m_jets.at(i));
95  }
96  return cycled;
97  }
98  }

◆ dump()

virtual std::string CombinationsJetStream::dump ( ) const
inlineoverridevirtual

Implements IJetStream.

Definition at line 108 of file CombinationsJetStream.h.

108  {
109 
110  auto result = m_neigh ? m_neigh->dump() : "";
111 
112  std::stringstream ss;
113  ss << *this;
114  result += ss.str();
115 
116  return result;
117  }

◆ empty()

bool CombinationsJetStream::empty ( ) const
inlineprivate

Definition at line 129 of file CombinationsJetStream.h.

129  {
130  return m_jets.empty();
131  }

◆ get()

virtual std::vector<std::size_t> CombinationsJetStream::get ( )
inlineoverridevirtual

Implements IJetStream.

Definition at line 62 of file CombinationsJetStream.h.

62  {
63 
64 
65  auto result = m_neigh ? m_neigh->get() : std::vector<std::size_t>();
66  result.insert(result.end(), m_data.begin(), m_data.end());
67  return result;
68  }

◆ valid()

virtual bool CombinationsJetStream::valid ( ) const
inlineoverridevirtual

Implements IJetStream.

Definition at line 101 of file CombinationsJetStream.h.

101  {
102  if (!m_valid){return false;}
103 
104  if (m_neigh) {return m_neigh->valid();}
105  return true;
106  }

Friends And Related Function Documentation

◆ operator<< [1/2]

std::ostream& operator<< ( std::ostream &  ,
const CombinationsJetStream  
)
friend

Definition at line 8 of file CombinationsJetStream.cxx.

8  {
9  os << "CombinationsJetStream m_combgen " << str.m_id << '\n'
10  << *str.m_combgen << '\n';
11  return os;
12 }

◆ operator<< [2/2]

std::stringstream& operator<< ( std::stringstream &  ,
const CombinationsJetStream  
)
friend

Definition at line 14 of file CombinationsJetStream.cxx.

14  {
15  os << "CombinationsJetStream id: " << str.m_id
16  << " m_combgen: " << *str.m_combgen
17  <<" data: ";
18  for (const auto& d : str.m_data){os << d << " ";}
19  os <<'\n';
20 
21  return os;
22 }

Member Data Documentation

◆ m_combgen

std::unique_ptr<CombinationsGenerator> CombinationsJetStream::m_combgen {nullptr}
private

Definition at line 124 of file CombinationsJetStream.h.

◆ m_data

std::vector<std::size_t> CombinationsJetStream::m_data
private

Definition at line 123 of file CombinationsJetStream.h.

◆ m_id

std::size_t CombinationsJetStream::m_id
private

Definition at line 122 of file CombinationsJetStream.h.

◆ m_jets

std::vector<std::size_t> CombinationsJetStream::m_jets
private

Definition at line 120 of file CombinationsJetStream.h.

◆ m_neigh

std::unique_ptr<IJetStream> CombinationsJetStream::m_neigh {nullptr}
private

Definition at line 121 of file CombinationsJetStream.h.

◆ m_valid

bool CombinationsJetStream::m_valid {false}
private

Definition at line 125 of file CombinationsJetStream.h.


The documentation for this class was generated from the following file:
CombinationsJetStream::m_id
std::size_t m_id
Definition: CombinationsJetStream.h:122
get_generator_info.result
result
Definition: get_generator_info.py:21
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
hist_file_dump.d
d
Definition: hist_file_dump.py:137
CombinationsJetStream::m_combgen
std::unique_ptr< CombinationsGenerator > m_combgen
Definition: CombinationsJetStream.h:124
Trk::indices
std::pair< long int, long int > indices
Definition: AlSymMatBase.h:24
CombinationsJetStream::m_jets
std::vector< std::size_t > m_jets
Definition: CombinationsJetStream.h:120
CombinationsGenerator
Definition: CombinationsGenerator.h:24
CombinationsJetStream::m_valid
bool m_valid
Definition: CombinationsJetStream.h:125
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
CombinationsJetStream::m_neigh
std::unique_ptr< IJetStream > m_neigh
Definition: CombinationsJetStream.h:121
CombinationsJetStream::m_data
std::vector< std::size_t > m_data
Definition: CombinationsJetStream.h:123
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
str
Definition: BTagTrackIpAccessor.cxx:11
fitman.k
k
Definition: fitman.py:528