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

#include <LArVoxelData.h>

Public Types

typedef util::VectorMap< int, double > list_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

 LArVoxelData ()
 
virtual ~LArVoxelData ()
 
mapped_type AssignedEnergy () const
 
mapped_type UnassignedEnergy () const
 
mapped_type Energy () const
 
size_type NumberParticles () const
 
const key_typeTrackID (const size_type) const
 
const mapped_typeEnergy (const size_type) const
 
void Add (const mapped_type &energy, const key_type &trackID)
 
void Add (const mapped_type &energy)
 
sim::LArVoxelID VoxelID () const
 
void SetVoxelID (sim::LArVoxelID voxID)
 
void Add (const LArVoxelData &)
 
LArVoxelDataoperator+= (const LArVoxelData &other)
 
const LArVoxelData operator+ (const LArVoxelData &other) const
 
LArVoxelDataoperator*= (const double &value)
 
const LArVoxelData operator* (const double &value) const
 
size_type RemoveTrack (const int &track)
 
void RemoveAllTracks ()
 
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 (LArVoxelData &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
 
size_type erase (const key_type &key)
 
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)
 

Private Attributes

mapped_type fenergy
 
list_type ftrackEnergy
 
sim::LArVoxelID fVoxelID
 

Friends

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

Detailed Description

Definition at line 70 of file LArVoxelData.h.

Member Typedef Documentation

Definition at line 87 of file LArVoxelData.h.

Definition at line 81 of file LArVoxelData.h.

Definition at line 83 of file LArVoxelData.h.

Definition at line 85 of file LArVoxelData.h.

Definition at line 80 of file LArVoxelData.h.

Definition at line 86 of file LArVoxelData.h.

Definition at line 77 of file LArVoxelData.h.

Definition at line 76 of file LArVoxelData.h.

Definition at line 78 of file LArVoxelData.h.

Definition at line 82 of file LArVoxelData.h.

Definition at line 84 of file LArVoxelData.h.

Definition at line 79 of file LArVoxelData.h.

Constructor & Destructor Documentation

sim::LArVoxelData::LArVoxelData ( )

Definition at line 16 of file LArVoxelData.cxx.

17  : fenergy(0)
18  {}
mapped_type fenergy
Definition: LArVoxelData.h:96
sim::LArVoxelData::~LArVoxelData ( )
virtual

Definition at line 22 of file LArVoxelData.cxx.

22 {}

Member Function Documentation

void sim::LArVoxelData::Add ( const mapped_type energy,
const key_type trackID 
)
inline

Definition at line 224 of file LArVoxelData.h.

226 { ftrackEnergy[trackID] += energy; }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
void sim::LArVoxelData::Add ( const mapped_type energy)
inline

Definition at line 227 of file LArVoxelData.h.

228 { fenergy += energy; }
mapped_type fenergy
Definition: LArVoxelData.h:96
void sim::LArVoxelData::Add ( const LArVoxelData other)

Definition at line 41 of file LArVoxelData.cxx.

42  {
43  // When we add one voxel's data to another, it becomes impossible
44  // to keep the particle<->energy assignments anymore; the most
45  // likely reason to add two voxels is because we're adding events
46  // to make overlays, and so the particles' track numbers change.
47 
48  // So if we're adding another LArVoxelData to this one, move all
49  // the energies to "unassigned" in the sum.
50 
51  this->RemoveAllTracks();
52  fenergy += other.Energy();
53  }
mapped_type fenergy
Definition: LArVoxelData.h:96
sim::LArVoxelData::mapped_type sim::LArVoxelData::AssignedEnergy ( ) const
inline

Definition at line 198 of file LArVoxelData.h.

199 {
200  return std::accumulate( ftrackEnergy.begin(), ftrackEnergy.end(), 0.0,
202 }
iterator end()
Definition: VectorMap.h:198
list_type ftrackEnergy
Definition: LArVoxelData.h:101
iterator begin()
Definition: VectorMap.h:188
sim::LArVoxelData::mapped_type & sim::LArVoxelData::at ( const key_type key)
inline

Definition at line 280 of file LArVoxelData.h.

281 { return ftrackEnergy.at(key); }
mapped_type & at(const key_type &__k)
Definition: VectorMap.h:272
list_type ftrackEnergy
Definition: LArVoxelData.h:101
def key(type, name=None)
Definition: graph.py:13
const sim::LArVoxelData::mapped_type & sim::LArVoxelData::at ( const key_type key) const
inline

Definition at line 282 of file LArVoxelData.h.

283 { return ftrackEnergy.at(key); }
mapped_type & at(const key_type &__k)
Definition: VectorMap.h:272
list_type ftrackEnergy
Definition: LArVoxelData.h:101
def key(type, name=None)
Definition: graph.py:13
sim::LArVoxelData::iterator sim::LArVoxelData::begin ( )
inline

Definition at line 242 of file LArVoxelData.h.

242 { return ftrackEnergy.begin(); }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
iterator begin()
Definition: VectorMap.h:188
sim::LArVoxelData::const_iterator sim::LArVoxelData::begin ( ) const
inline

Definition at line 243 of file LArVoxelData.h.

243 { return ftrackEnergy.begin(); }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
iterator begin()
Definition: VectorMap.h:188
void sim::LArVoxelData::clear ( )
inline

Definition at line 260 of file LArVoxelData.h.

260 { fenergy = 0.; ftrackEnergy.clear(); }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
mapped_type fenergy
Definition: LArVoxelData.h:96
bool sim::LArVoxelData::empty ( ) const
inline

Definition at line 252 of file LArVoxelData.h.

252 { return ftrackEnergy.empty(); }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
bool empty() const
Definition: VectorMap.h:228
sim::LArVoxelData::iterator sim::LArVoxelData::end ( void  )
inline

Definition at line 244 of file LArVoxelData.h.

244 { return ftrackEnergy.end(); }
iterator end()
Definition: VectorMap.h:198
list_type ftrackEnergy
Definition: LArVoxelData.h:101
sim::LArVoxelData::const_iterator sim::LArVoxelData::end ( void  ) const
inline

Definition at line 245 of file LArVoxelData.h.

245 { return ftrackEnergy.end(); }
iterator end()
Definition: VectorMap.h:198
list_type ftrackEnergy
Definition: LArVoxelData.h:101
sim::LArVoxelData::mapped_type sim::LArVoxelData::Energy ( void  ) const
inline

Definition at line 203 of file LArVoxelData.h.

204 {
205  return std::accumulate( ftrackEnergy.begin(), ftrackEnergy.end(), fenergy,
207 }
iterator end()
Definition: VectorMap.h:198
list_type ftrackEnergy
Definition: LArVoxelData.h:101
iterator begin()
Definition: VectorMap.h:188
mapped_type fenergy
Definition: LArVoxelData.h:96
const LArVoxelData::mapped_type & sim::LArVoxelData::Energy ( const size_type  index) const

Definition at line 33 of file LArVoxelData.cxx.

34  {
36  std::advance(i,index);
37  return (*i).second;
38  }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
iterator begin()
Definition: VectorMap.h:188
sim::LArVoxelData::size_type sim::LArVoxelData::erase ( const key_type key)
inline

Definition at line 273 of file LArVoxelData.h.

274 { return this->RemoveTrack(key); }
def key(type, name=None)
Definition: graph.py:13
size_type RemoveTrack(const int &track)
Definition: LArVoxelData.h:208
sim::LArVoxelData::iterator sim::LArVoxelData::find ( const key_type key)
inline

Definition at line 261 of file LArVoxelData.h.

262 { return ftrackEnergy.find(key); }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
def key(type, name=None)
Definition: graph.py:13
iterator find(const key_type &key)
Definition: VectorMap.h:383
sim::LArVoxelData::const_iterator sim::LArVoxelData::find ( const key_type key) const
inline

Definition at line 263 of file LArVoxelData.h.

264 { return ftrackEnergy.find(key); }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
def key(type, name=None)
Definition: graph.py:13
iterator find(const key_type &key)
Definition: VectorMap.h:383
void sim::LArVoxelData::insert ( const key_type key,
const mapped_type value 
)
inline

Definition at line 284 of file LArVoxelData.h.

285 { ftrackEnergy[key] = value; }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
def key(type, name=None)
Definition: graph.py:13
sim::LArVoxelData::iterator sim::LArVoxelData::lower_bound ( const key_type key)
inline

Definition at line 269 of file LArVoxelData.h.

270 { return ftrackEnergy.lower_bound(key); }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
def key(type, name=None)
Definition: graph.py:13
iterator lower_bound(const key_type &__x)
Definition: VectorMap.h:408
sim::LArVoxelData::const_iterator sim::LArVoxelData::lower_bound ( const key_type key) const
inline

Definition at line 271 of file LArVoxelData.h.

272 { return ftrackEnergy.lower_bound(key); }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
def key(type, name=None)
Definition: graph.py:13
iterator lower_bound(const key_type &__x)
Definition: VectorMap.h:408
sim::LArVoxelData::size_type sim::LArVoxelData::NumberParticles ( ) const
inline

Definition at line 196 of file LArVoxelData.h.

196 { return size(); }
size_type size() const
Definition: LArVoxelData.h:251
const sim::LArVoxelData sim::LArVoxelData::operator* ( const double &  value) const
inline

Definition at line 238 of file LArVoxelData.h.

239 {
240  return LArVoxelData(*this) *= value;
241 }
LArVoxelData & sim::LArVoxelData::operator*= ( const double &  value)

Definition at line 56 of file LArVoxelData.cxx.

57  {
58  // Multiply all energies by the value.
59  for ( iterator i = ftrackEnergy.begin(), end = ftrackEnergy.end(); i != end; ++i )
60  {
61  (*i).second *= value;
62  }
63  fenergy *= value;
64 
65  return (*this);
66  }
iterator end()
Definition: VectorMap.h:198
list_type ftrackEnergy
Definition: LArVoxelData.h:101
iterator begin()
Definition: VectorMap.h:188
mapped_type fenergy
Definition: LArVoxelData.h:96
const sim::LArVoxelData sim::LArVoxelData::operator+ ( const LArVoxelData other) const
inline

Definition at line 234 of file LArVoxelData.h.

235 {
236  return LArVoxelData(*this) += other;
237 }
sim::LArVoxelData & sim::LArVoxelData::operator+= ( const LArVoxelData other)
inline

Definition at line 229 of file LArVoxelData.h.

230 {
231  this->Add(other);
232  return *this;
233 }
void Add(const mapped_type &energy, const key_type &trackID)
Definition: LArVoxelData.h:224
sim::LArVoxelData::mapped_type & sim::LArVoxelData::operator[] ( const key_type key)
inline

Definition at line 276 of file LArVoxelData.h.

277 { return ftrackEnergy[key]; }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
def key(type, name=None)
Definition: graph.py:13
const sim::LArVoxelData::mapped_type & sim::LArVoxelData::operator[] ( const key_type key) const
inline

Definition at line 278 of file LArVoxelData.h.

279 { return ftrackEnergy.at(key); }
mapped_type & at(const key_type &__k)
Definition: VectorMap.h:272
list_type ftrackEnergy
Definition: LArVoxelData.h:101
def key(type, name=None)
Definition: graph.py:13
sim::LArVoxelData::reverse_iterator sim::LArVoxelData::rbegin ( )
inline

Definition at line 246 of file LArVoxelData.h.

246 { return ftrackEnergy.rbegin(); }
reverse_iterator rbegin()
Definition: VectorMap.h:208
list_type ftrackEnergy
Definition: LArVoxelData.h:101
sim::LArVoxelData::const_reverse_iterator sim::LArVoxelData::rbegin ( ) const
inline

Definition at line 247 of file LArVoxelData.h.

247 { return ftrackEnergy.rbegin(); }
reverse_iterator rbegin()
Definition: VectorMap.h:208
list_type ftrackEnergy
Definition: LArVoxelData.h:101
void sim::LArVoxelData::RemoveAllTracks ( )
inline

Definition at line 219 of file LArVoxelData.h.

220 {
221  fenergy = this->Energy();
223 }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
mapped_type fenergy
Definition: LArVoxelData.h:96
mapped_type Energy() const
Definition: LArVoxelData.h:203
sim::LArVoxelData::size_type sim::LArVoxelData::RemoveTrack ( const int &  track)
inline

Definition at line 208 of file LArVoxelData.h.

209 {
210  iterator search = ftrackEnergy.find( track );
211  if ( search != ftrackEnergy.end() )
212  {
213  fenergy += (*search).second;
214  ftrackEnergy.erase( search );
215  return 1;
216  }
217  else return 0;
218 }
iterator end()
Definition: VectorMap.h:198
void erase(iterator __position)
Definition: VectorMap.h:332
list_type ftrackEnergy
Definition: LArVoxelData.h:101
mapped_type fenergy
Definition: LArVoxelData.h:96
Definition: search.py:1
iterator find(const key_type &key)
Definition: VectorMap.h:383
sim::LArVoxelData::reverse_iterator sim::LArVoxelData::rend ( )
inline

Definition at line 248 of file LArVoxelData.h.

248 { return ftrackEnergy.rend(); }
reverse_iterator rend()
Definition: VectorMap.h:218
list_type ftrackEnergy
Definition: LArVoxelData.h:101
sim::LArVoxelData::const_reverse_iterator sim::LArVoxelData::rend ( ) const
inline

Definition at line 249 of file LArVoxelData.h.

249 { return ftrackEnergy.rend(); }
reverse_iterator rend()
Definition: VectorMap.h:218
list_type ftrackEnergy
Definition: LArVoxelData.h:101
void sim::LArVoxelData::SetVoxelID ( sim::LArVoxelID  voxID)
inline

Definition at line 194 of file LArVoxelData.h.

194 { fVoxelID = voxID; }
sim::LArVoxelID fVoxelID
Definition: LArVoxelData.h:103
sim::LArVoxelData::size_type sim::LArVoxelData::size ( void  ) const
inline

Definition at line 251 of file LArVoxelData.h.

251 { return ftrackEnergy.size(); }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
size_t size() const
Definition: VectorMap.h:233
void sim::LArVoxelData::swap ( LArVoxelData other)
inline

Definition at line 253 of file LArVoxelData.h.

254 {
255  ftrackEnergy.swap( other.ftrackEnergy );
256  double temp = fenergy;
257  fenergy = other.fenergy;
258  other.fenergy = temp;
259 }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
mapped_type fenergy
Definition: LArVoxelData.h:96
void swap(VectorMap &other)
Definition: VectorMap.h:357
const LArVoxelData::key_type & sim::LArVoxelData::TrackID ( const size_type  index) const

Definition at line 25 of file LArVoxelData.cxx.

26  {
28  std::advance(i,index);
29  return (*i).first;
30  }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
iterator begin()
Definition: VectorMap.h:188
sim::LArVoxelData::mapped_type sim::LArVoxelData::UnassignedEnergy ( ) const
inline

Definition at line 197 of file LArVoxelData.h.

197 { return fenergy; }
mapped_type fenergy
Definition: LArVoxelData.h:96
sim::LArVoxelData::iterator sim::LArVoxelData::upper_bound ( const key_type key)
inline

Definition at line 265 of file LArVoxelData.h.

266 { return ftrackEnergy.upper_bound(key); }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
def key(type, name=None)
Definition: graph.py:13
iterator upper_bound(const key_type &__x)
Definition: VectorMap.h:418
sim::LArVoxelData::const_iterator sim::LArVoxelData::upper_bound ( const key_type key) const
inline

Definition at line 267 of file LArVoxelData.h.

268 { return ftrackEnergy.upper_bound(key); }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
def key(type, name=None)
Definition: graph.py:13
iterator upper_bound(const key_type &__x)
Definition: VectorMap.h:418
sim::LArVoxelID sim::LArVoxelData::VoxelID ( ) const
inline

Definition at line 195 of file LArVoxelData.h.

195 { return fVoxelID; }
sim::LArVoxelID fVoxelID
Definition: LArVoxelData.h:103

Friends And Related Function Documentation

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

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

Definition at line 71 of file LArVoxelData.cxx.

std::ostream& operator<< ( std::ostream &  output,
const LArVoxelData data 
)
friend

Definition at line 77 of file LArVoxelData.cxx.

78  {
79  output << "Voxel: " << data.VoxelID() << std::endl;
80 
81  double unassigned = data.UnassignedEnergy();
82  // Display the total energy then the breakdown of
83  // the sum.
84  output << data.Energy() << " = <ID,E>=";
85  for ( LArVoxelData::const_iterator i = data.begin(); i != data.end(); ++i){
86  if ( i != data.begin() )
87  output << ",";
88 
89  output << "<" << (*i).first << "," << (*i).second << ">";
90  }
91  if( unassigned > 0 )
92  output << ",<*," << unassigned << ">";
93 
94  return output;
95  }
list_type::const_iterator const_iterator
Definition: LArVoxelData.h:81
QTextStream & endl(QTextStream &s)

Member Data Documentation

mapped_type sim::LArVoxelData::fenergy
private

Definition at line 96 of file LArVoxelData.h.

list_type sim::LArVoxelData::ftrackEnergy
private

Definition at line 101 of file LArVoxelData.h.

sim::LArVoxelID sim::LArVoxelData::fVoxelID
private

Definition at line 103 of file LArVoxelData.h.


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