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

#include <SimpleJetStream.h>

Inheritance diagram for SimpleJetStream:
Collaboration diagram for SimpleJetStream:

Public Member Functions

 SimpleJetStream (const std::vector< std::size_t > &jets, std::unique_ptr< IJetStream > neigh, 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 Attributes

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

Friends

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

Detailed Description

Definition at line 26 of file SimpleJetStream.h.

Constructor & Destructor Documentation

◆ SimpleJetStream()

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

Definition at line 36 of file SimpleJetStream.h.

38  :
39  m_jets(jets),
40  m_neigh(std::move(neigh)),
41  m_id{id}
42  {
43  m_valid = !jets.empty();
44  if(m_valid) {
45  m_data = m_jets.at(0);
46  m_ind = 0;
47  }
48  }

Member Function Documentation

◆ bump()

virtual bool SimpleJetStream::bump ( )
inlineoverridevirtual

Implements IJetStream.

Definition at line 59 of file SimpleJetStream.h.

59  {
60  // if there is a neighbor, try bumping it.
61  bool cycled{false};
62  if (m_neigh) {
63  bool neigh_cycled = m_neigh->bump();
64 
65  if (!neigh_cycled) {return false;}
66 
67  // neighbor has cycled as a result of bumping.
68  ++m_ind;
69  cycled = m_ind == m_jets.size();
70 
71  if (cycled) {m_ind = 0;}
72 
73  m_data = m_jets.at(m_ind);
74  return cycled;
75  } else {
76 
77  // no neighbor
78 
79  ++m_ind;
80 
81  cycled = m_ind == m_jets.size();
82 
83  if(cycled) {
84  m_ind = 0;
85  }
86  m_data = m_jets.at(m_ind);
87  return cycled;
88  }
89  }

◆ dump()

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

Implements IJetStream.

Definition at line 100 of file SimpleJetStream.h.

100  {
101  std::stringstream ss;
102 
103  auto result = m_neigh ? m_neigh->dump() : "";
104 
105  ss<< *this << '\n';
106  result += ss.str();
107 
108  return result;
109  }

◆ get()

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

Implements IJetStream.

Definition at line 51 of file SimpleJetStream.h.

51  {
52 
53  auto result = m_neigh ? m_neigh->get() : std::vector<std::size_t>();
54  result.push_back(m_data);
55 
56  return result;
57  }

◆ valid()

virtual bool SimpleJetStream::valid ( ) const
inlineoverridevirtual

Implements IJetStream.

Definition at line 93 of file SimpleJetStream.h.

93  {
94  if (!m_valid) {return false;}
95 
96  if (m_neigh) {return m_neigh->valid();}
97  return true;
98  }

Friends And Related Function Documentation

◆ operator<< [1/2]

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

Definition at line 7 of file SimpleJetStream.cxx.

8  {
9 
10  os << "SimpleJetStream id " << js.m_id
11  << " m_valid " << std::boolalpha << js.m_valid
12  << " no of jets: " << js.m_jets.size()
13  << " m_ind " << js.m_ind;
14  return os;
15 }

◆ operator<< [2/2]

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

Definition at line 17 of file SimpleJetStream.cxx.

18  {
19 
20  os << "SimpleJetStream id " << js.m_id
21  << " m_valid " << std::boolalpha << js.m_valid
22  << " no of jets: " << js.m_jets.size()
23  << " m_ind " << js.m_ind;
24  return os;
25 }

Member Data Documentation

◆ m_data

std::size_t SimpleJetStream::m_data
private

Definition at line 116 of file SimpleJetStream.h.

◆ m_id

std::size_t SimpleJetStream::m_id
private

Definition at line 115 of file SimpleJetStream.h.

◆ m_ind

std::size_t SimpleJetStream::m_ind {0}
private

Definition at line 113 of file SimpleJetStream.h.

◆ m_jets

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

Definition at line 112 of file SimpleJetStream.h.

◆ m_neigh

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

Definition at line 114 of file SimpleJetStream.h.

◆ m_valid

bool SimpleJetStream::m_valid {false}
private

Definition at line 117 of file SimpleJetStream.h.


The documentation for this class was generated from the following file:
get_generator_info.result
result
Definition: get_generator_info.py:21
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
SimpleJetStream::m_jets
std::vector< std::size_t > m_jets
Definition: SimpleJetStream.h:112
SimpleJetStream::m_id
std::size_t m_id
Definition: SimpleJetStream.h:115
SimpleJetStream::m_data
std::size_t m_data
Definition: SimpleJetStream.h:116
SimpleJetStream::m_valid
bool m_valid
Definition: SimpleJetStream.h:117
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
SimpleJetStream::m_neigh
std::unique_ptr< IJetStream > m_neigh
Definition: SimpleJetStream.h:114
SimpleJetStream::m_ind
std::size_t m_ind
Definition: SimpleJetStream.h:113
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24