LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
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 19 of file LArVoxelList.cxx.

Referenced by sim::operator*(), operator*(), and operator+().

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

Definition at line 22 of file LArVoxelList.cxx.

22 {}

Member Function Documentation

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

Definition at line 94 of file LArVoxelList.h.

References m_voxelList.

Referenced by Add(), sim::SimListUtils::GetLArVoxelList(), and operator+=().

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

Definition at line 95 of file LArVoxelList.h.

References Add(), and m_voxelList.

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
double energy
Definition: plottest35.C:25
void sim::LArVoxelList::Add ( const LArVoxelList other)

Definition at line 25 of file LArVoxelList.cxx.

References m_voxelList.

26  {
27  // Go through "other" list, adding its voxels to "this" list.
28  for ( const_iterator i = other.m_voxelList.begin(); i != m_voxelList.end(); ++i ){
29  m_voxelList[ (*i).first ] += (*i).second;
30  }
31  }
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.

References m_voxelList.

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

Definition at line 156 of file LArVoxelList.h.

References m_voxelList.

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

Definition at line 131 of file LArVoxelList.h.

References m_voxelList.

Referenced by evd::SimulationDrawer::MCTruth3D(), evd::SimulationDrawer::MCTruthOrtho(), and sim::operator<<().

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.

References m_voxelList.

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 ( void  )
inline

Definition at line 143 of file LArVoxelList.h.

References m_voxelList.

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 53 of file LArVoxelList.cxx.

References m_voxelList.

Referenced by operator*().

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

Definition at line 141 of file LArVoxelList.h.

References m_voxelList.

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.

References m_voxelList.

Referenced by evd::SimulationDrawer::MCTruth3D(), evd::SimulationDrawer::MCTruthOrtho(), and sim::operator<<().

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.

References m_voxelList.

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 84 of file LArVoxelList.cxx.

References m_voxelList.

Referenced by operator*().

85  {
86  const_iterator i = m_voxelList.begin();
87  std::advance(i,index);
88  return (*i).second.Energy();
89  }
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.

References m_voxelList.

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

Definition at line 145 of file LArVoxelList.h.

References m_voxelList.

Referenced by sim::SimListUtils::GetLArVoxelList().

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

Definition at line 146 of file LArVoxelList.h.

References m_voxelList.

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

Definition at line 76 of file LArVoxelList.cxx.

References m_voxelList.

Referenced by operator*().

77  {
78  const_iterator i = m_voxelList.begin();
79  std::advance(i,index);
80  return (*i).first;
81  }
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.

References m_voxelList, and fhicl::detail::atom::value().

162 { m_voxelList[key] = value; }
list_type m_voxelList
A sorted list of <LArVoxelID,double> pairs = (voxel ID, energy)
Definition: LArVoxelList.h:167
std::string value(boost::any const &)
iterator sim::LArVoxelList::lower_bound ( const key_type key)
inline

Definition at line 149 of file LArVoxelList.h.

References m_voxelList.

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
const_iterator sim::LArVoxelList::lower_bound ( const key_type key) const
inline

Definition at line 150 of file LArVoxelList.h.

References m_voxelList.

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
const LArVoxelList sim::LArVoxelList::operator* ( const double &  value) const
inline

Definition at line 111 of file LArVoxelList.h.

References Cut(), Energy(), ID(), LArVoxelList(), operator<<, and fhicl::detail::atom::value().

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

Definition at line 34 of file LArVoxelList.cxx.

References m_voxelList, and fhicl::detail::atom::value().

Referenced by operator+().

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

Definition at line 105 of file LArVoxelList.h.

References LArVoxelList(), operator*=(), fhicl::other, and fhicl::detail::atom::value().

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

Definition at line 100 of file LArVoxelList.h.

References Add().

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.

References m_voxelList.

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

Definition at line 154 of file LArVoxelList.h.

References m_voxelList.

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

Definition at line 135 of file LArVoxelList.h.

References m_voxelList.

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.

References m_voxelList.

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.

References m_voxelList.

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.

References m_voxelList.

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.

References m_voxelList.

Referenced by evd::SimulationDrawer::MCTruth3D(), evd::SimulationDrawer::MCTruthOrtho(), and sim::operator<<().

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.

References m_voxelList.

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.

References m_voxelList.

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
const_iterator sim::LArVoxelList::upper_bound ( const key_type key) const
inline

Definition at line 148 of file LArVoxelList.h.

References m_voxelList.

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

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 46 of file LArVoxelList.cxx.

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

Definition at line 92 of file LArVoxelList.cxx.

Referenced by operator*().

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

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.

Referenced by Add(), at(), begin(), clear(), Cut(), empty(), end(), Energy(), erase(), find(), ID(), insert(), lower_bound(), operator*=(), operator[](), rbegin(), rend(), size(), swap(), and upper_bound().


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