Public Types | Public Member Functions | Private Attributes | Friends | List of all members
sim::LArVoxelList Class Reference

#include <LArVoxelList.h>

Public Types

typedef std::map< LArVoxelID, LArVoxelDatalist_type
 
typedef list_type::key_type key_type
 
typedef list_type::mapped_type mapped_type
 
typedef list_type::value_type value_type
 
typedef list_type::iterator iterator
 
typedef list_type::const_iterator const_iterator
 
typedef list_type::reverse_iterator reverse_iterator
 
typedef list_type::const_reverse_iterator const_reverse_iterator
 
typedef list_type::size_type size_type
 
typedef list_type::difference_type difference_type
 
typedef list_type::key_compare key_compare
 
typedef list_type::allocator_type allocator_type
 

Public Member Functions

 LArVoxelList ()
 
virtual ~LArVoxelList ()
 
void Add (const key_type &key, const double &energy)
 
void Add (const key_type &key, const double &energy, const int &id)
 
void Add (const LArVoxelList &)
 
LArVoxelListoperator+= (const LArVoxelList &other)
 
const LArVoxelList operator+ (const LArVoxelList &other) const
 
LArVoxelListoperator*= (const double &value)
 
const LArVoxelList operator* (const double &value) const
 
void Cut (const double &)
 Apply an energy cut to the voxels. More...
 
const key_typeID (const size_type) const
 
double Energy (const size_type) const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
size_type size () const
 
bool empty () const
 
void swap (LArVoxelList &other)
 
void clear ()
 
iterator find (const key_type &key)
 
const_iterator find (const key_type &key) const
 
iterator upper_bound (const key_type &key)
 
const_iterator upper_bound (const key_type &key) const
 
iterator lower_bound (const key_type &key)
 
const_iterator lower_bound (const key_type &key) const
 
mapped_typeoperator[] (const key_type &key)
 
const mapped_typeoperator[] (const key_type &key) const
 
mapped_typeat (const key_type &key)
 
const mapped_typeat (const key_type &key) const
 
void insert (const key_type &key, const mapped_type &value)
 
size_type erase (const key_type &key)
 

Private Attributes

list_type m_voxelList
 A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy) More...
 

Friends

const LArVoxelList operator* (const double &value, const LArVoxelList &list)
 
std::ostream & operator<< (std::ostream &output, const LArVoxelList &)
 

Detailed Description

Definition at line 68 of file LArVoxelList.h.

Member Typedef Documentation

typedef list_type::allocator_type sim::LArVoxelList::allocator_type

Definition at line 85 of file LArVoxelList.h.

typedef list_type::const_iterator sim::LArVoxelList::const_iterator

Definition at line 79 of file LArVoxelList.h.

typedef list_type::const_reverse_iterator sim::LArVoxelList::const_reverse_iterator

Definition at line 81 of file LArVoxelList.h.

typedef list_type::difference_type sim::LArVoxelList::difference_type

Definition at line 83 of file LArVoxelList.h.

typedef list_type::iterator sim::LArVoxelList::iterator

Definition at line 78 of file LArVoxelList.h.

typedef list_type::key_compare sim::LArVoxelList::key_compare

Definition at line 84 of file LArVoxelList.h.

typedef list_type::key_type sim::LArVoxelList::key_type

Definition at line 75 of file LArVoxelList.h.

Some type definitions to make life easier, and to help "hide" the implementation details. (If you're not familiar with STL, you can ignore these definitions.)

Definition at line 74 of file LArVoxelList.h.

typedef list_type::mapped_type sim::LArVoxelList::mapped_type

Definition at line 76 of file LArVoxelList.h.

typedef list_type::reverse_iterator sim::LArVoxelList::reverse_iterator

Definition at line 80 of file LArVoxelList.h.

typedef list_type::size_type sim::LArVoxelList::size_type

Definition at line 82 of file LArVoxelList.h.

typedef list_type::value_type sim::LArVoxelList::value_type

Definition at line 77 of file LArVoxelList.h.

Constructor & Destructor Documentation

sim::LArVoxelList::LArVoxelList ( )

Definition at line 18 of file LArVoxelList.cxx.

18 {}
sim::LArVoxelList::~LArVoxelList ( )
virtual

Definition at line 21 of file LArVoxelList.cxx.

21 {}

Member Function Documentation

void sim::LArVoxelList::Add ( const key_type key,
const double &  energy 
)
inline

Definition at line 94 of file LArVoxelList.h.

94 { m_voxelList[key].Add(energy); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
def key(type, name=None)
Definition: graph.py:13
void sim::LArVoxelList::Add ( const key_type key,
const double &  energy,
const int &  id 
)
inline

Definition at line 95 of file LArVoxelList.h.

95 { m_voxelList[key].Add(energy,id); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
def key(type, name=None)
Definition: graph.py:13
void sim::LArVoxelList::Add ( const LArVoxelList other)

Definition at line 24 of file LArVoxelList.cxx.

25  {
26  // Go through "other" list, adding its voxels to "this" list.
27  for ( const_iterator i = other.m_voxelList.begin(); i != m_voxelList.end(); ++i ){
28  m_voxelList[ (*i).first ] += (*i).second;
29  }
30  }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
mapped_type& sim::LArVoxelList::at ( const key_type key)
inline

Definition at line 155 of file LArVoxelList.h.

155 { return m_voxelList.at(key); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
def key(type, name=None)
Definition: graph.py:13
const mapped_type& sim::LArVoxelList::at ( const key_type key) const
inline

Definition at line 156 of file LArVoxelList.h.

156 { return m_voxelList.at(key); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
def key(type, name=None)
Definition: graph.py:13
iterator sim::LArVoxelList::begin ( )
inline

Definition at line 131 of file LArVoxelList.h.

131 { return m_voxelList.begin(); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
const_iterator sim::LArVoxelList::begin ( ) const
inline

Definition at line 132 of file LArVoxelList.h.

132 { return m_voxelList.begin(); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
void sim::LArVoxelList::clear ( )
inline

Definition at line 143 of file LArVoxelList.h.

143 { m_voxelList.clear(); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
void sim::LArVoxelList::Cut ( const double &  cut)

Apply an energy cut to the voxels.

Definition at line 52 of file LArVoxelList.cxx.

53  {
54  // The safest way to do this is to create a list of voxel IDs that
55  // fail the cut, then delete those IDs.
56 
57  // Define a list of IDs.
58  typedef std::vector< key_type > keyList_type;
59  keyList_type keyList;
60 
61  // Add each ID that fails the cut to the list.
62  for ( const_iterator i = m_voxelList.begin(); i != m_voxelList.end(); ++i ){
63  if ( (*i).second.Energy() < cut ) {
64  keyList.push_back( (*i).first );
65  }
66  }
67 
68  // Go through the list, deleting the voxels that are on the list.
69  for ( keyList_type::const_iterator i = keyList.begin(); i != keyList.end(); ++i ){
70  m_voxelList.erase( (*i) );
71  }
72  }
intermediate_table::const_iterator const_iterator
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
bool sim::LArVoxelList::empty ( ) const
inline

Definition at line 141 of file LArVoxelList.h.

141 { return m_voxelList.empty(); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
iterator sim::LArVoxelList::end ( void  )
inline

Definition at line 133 of file LArVoxelList.h.

133 { return m_voxelList.end(); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
const_iterator sim::LArVoxelList::end ( void  ) const
inline

Definition at line 134 of file LArVoxelList.h.

134 { return m_voxelList.end(); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
double sim::LArVoxelList::Energy ( const size_type  index) const

Definition at line 83 of file LArVoxelList.cxx.

84  {
85  const_iterator i = m_voxelList.begin();
86  std::advance(i,index);
87  return (*i).second.Energy();
88  }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
size_type sim::LArVoxelList::erase ( const key_type key)
inline

Definition at line 164 of file LArVoxelList.h.

164 { return m_voxelList.erase(key); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
def key(type, name=None)
Definition: graph.py:13
iterator sim::LArVoxelList::find ( const key_type key)
inline

Definition at line 145 of file LArVoxelList.h.

145 { return m_voxelList.find(key); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
def key(type, name=None)
Definition: graph.py:13
const_iterator sim::LArVoxelList::find ( const key_type key) const
inline

Definition at line 146 of file LArVoxelList.h.

146 { return m_voxelList.find(key); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
def key(type, name=None)
Definition: graph.py:13
const LArVoxelList::key_type & sim::LArVoxelList::ID ( const size_type  index) const

Definition at line 75 of file LArVoxelList.cxx.

76  {
77  const_iterator i = m_voxelList.begin();
78  std::advance(i,index);
79  return (*i).first;
80  }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
void sim::LArVoxelList::insert ( const key_type key,
const mapped_type value 
)
inline

Definition at line 162 of file LArVoxelList.h.

162 { m_voxelList[key] = value; }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
def key(type, name=None)
Definition: graph.py:13
iterator sim::LArVoxelList::lower_bound ( const key_type key)
inline

Definition at line 149 of file LArVoxelList.h.

149 { return m_voxelList.lower_bound(key); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
def key(type, name=None)
Definition: graph.py:13
const_iterator sim::LArVoxelList::lower_bound ( const key_type key) const
inline

Definition at line 150 of file LArVoxelList.h.

150 { return m_voxelList.lower_bound(key); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
def key(type, name=None)
Definition: graph.py:13
const LArVoxelList sim::LArVoxelList::operator* ( const double &  value) const
inline

Definition at line 111 of file LArVoxelList.h.

112  {
113  return LArVoxelList(*this) *= value;
114  }
LArVoxelList & sim::LArVoxelList::operator*= ( const double &  value)

Definition at line 33 of file LArVoxelList.cxx.

34  {
35  // Multiply each voxel energy by the value.
36  for ( iterator i = m_voxelList.begin(); i != m_voxelList.end(); ++i ){
37  (*i).second *= value;
38  }
39  return (*this);
40  }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
const LArVoxelList sim::LArVoxelList::operator+ ( const LArVoxelList other) const
inline

Definition at line 105 of file LArVoxelList.h.

106  {
107  return LArVoxelList(*this) += other;
108  }
LArVoxelList& sim::LArVoxelList::operator+= ( const LArVoxelList other)
inline

Definition at line 100 of file LArVoxelList.h.

101  {
102  this->Add(other);
103  return *this;
104  }
void Add(const key_type &key, const double &energy)
Definition: LArVoxelList.h:94
mapped_type& sim::LArVoxelList::operator[] ( const key_type key)
inline

Definition at line 152 of file LArVoxelList.h.

152 { return m_voxelList[key]; }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
def key(type, name=None)
Definition: graph.py:13
const mapped_type& sim::LArVoxelList::operator[] ( const key_type key) const
inline

Definition at line 154 of file LArVoxelList.h.

154 { return m_voxelList.at(key); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
def key(type, name=None)
Definition: graph.py:13
reverse_iterator sim::LArVoxelList::rbegin ( )
inline

Definition at line 135 of file LArVoxelList.h.

135 { return m_voxelList.rbegin(); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
const_reverse_iterator sim::LArVoxelList::rbegin ( ) const
inline

Definition at line 136 of file LArVoxelList.h.

136 { return m_voxelList.rbegin(); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
reverse_iterator sim::LArVoxelList::rend ( )
inline

Definition at line 137 of file LArVoxelList.h.

137 { return m_voxelList.rend(); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
const_reverse_iterator sim::LArVoxelList::rend ( ) const
inline

Definition at line 138 of file LArVoxelList.h.

138 { return m_voxelList.rend(); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
size_type sim::LArVoxelList::size ( void  ) const
inline

Definition at line 140 of file LArVoxelList.h.

140 { return m_voxelList.size(); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
void sim::LArVoxelList::swap ( LArVoxelList other)
inline

Definition at line 142 of file LArVoxelList.h.

142 { m_voxelList.swap( other.m_voxelList ); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
iterator sim::LArVoxelList::upper_bound ( const key_type key)
inline

Definition at line 147 of file LArVoxelList.h.

147 { return m_voxelList.upper_bound(key); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
def key(type, name=None)
Definition: graph.py:13
const_iterator sim::LArVoxelList::upper_bound ( const key_type key) const
inline

Definition at line 148 of file LArVoxelList.h.

148 { return m_voxelList.upper_bound(key); }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
def key(type, name=None)
Definition: graph.py:13

Friends And Related Function Documentation

const LArVoxelList operator* ( const double &  value,
const LArVoxelList list 
)
friend

Just in case: define the result of "scalar * LArVoxelList" to be the same as "LArVoxelList * scalar".

Definition at line 45 of file LArVoxelList.cxx.

46  {
47  return LArVoxelList(list) *= value;
48  }
std::ostream& operator<< ( std::ostream &  output,
const LArVoxelList list 
)
friend

Definition at line 91 of file LArVoxelList.cxx.

92  {
93  // Determine a field width for the voxel number.
94  LArVoxelList::size_type numberOfVoxels = list.size();
95  int numberOfDigits = (int) std::log10( (double) numberOfVoxels ) + 1;
96 
97  // A simple header.
98  output.width( numberOfDigits );
99  output << "#" << ": < ID, energy >" << std::endl;
100 
101  // Write each voxel on a separate line.
102  LArVoxelList::size_type nVoxel = 0;
103  for ( LArVoxelList::const_iterator voxel = list.begin(); voxel != list.end(); ++voxel, ++nVoxel ){
104  output.width( numberOfDigits );
105  output << nVoxel << ": "
106  << "< " << (*voxel).first
107  << ", " << (*voxel).second
108  << " >\n";
109  }
110 
111  return output;
112  }
list_type::const_iterator const_iterator
Definition: LArVoxelList.h:79
list_type::size_type size_type
Definition: LArVoxelList.h:82
QTextStream & endl(QTextStream &s)

Member Data Documentation

list_type sim::LArVoxelList::m_voxelList
private

A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)

Definition at line 167 of file LArVoxelList.h.


The documentation for this class was generated from the following files: