LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
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 76 of file LArVoxelData.h.

Constructor & Destructor Documentation

sim::LArVoxelData::LArVoxelData ( )

Definition at line 14 of file LArVoxelData.cxx.

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

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

Definition at line 20 of file LArVoxelData.cxx.

20 {}

Member Function Documentation

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

Definition at line 230 of file LArVoxelData.h.

References energy, and ftrackEnergy.

Referenced by operator+=().

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

Definition at line 233 of file LArVoxelData.h.

References energy, and fenergy.

234 { fenergy += energy; }
mapped_type fenergy
Definition: LArVoxelData.h:96
double energy
Definition: plottest35.C:25
void sim::LArVoxelData::Add ( const LArVoxelData other)

Definition at line 39 of file LArVoxelData.cxx.

References Energy(), fenergy, and RemoveAllTracks().

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

Definition at line 286 of file LArVoxelData.h.

References util::VectorMap< _Key, _Tp, _Compare >::at(), and ftrackEnergy.

287 { return ftrackEnergy.at(key); }
mapped_type & at(const key_type &__k)
Definition: VectorMap.h:272
list_type ftrackEnergy
Definition: LArVoxelData.h:101
const sim::LArVoxelData::mapped_type & sim::LArVoxelData::at ( const key_type key) const
inline

Definition at line 288 of file LArVoxelData.h.

References util::VectorMap< _Key, _Tp, _Compare >::at(), and ftrackEnergy.

289 { return ftrackEnergy.at(key); }
mapped_type & at(const key_type &__k)
Definition: VectorMap.h:272
list_type ftrackEnergy
Definition: LArVoxelData.h:101
sim::LArVoxelData::iterator sim::LArVoxelData::begin ( )
inline

Definition at line 248 of file LArVoxelData.h.

References util::VectorMap< _Key, _Tp, _Compare >::begin(), and ftrackEnergy.

Referenced by sim::operator<<().

248 { 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 249 of file LArVoxelData.h.

References util::VectorMap< _Key, _Tp, _Compare >::begin(), and ftrackEnergy.

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

Definition at line 266 of file LArVoxelData.h.

References util::VectorMap< _Key, _Tp, _Compare >::clear(), fenergy, and ftrackEnergy.

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

Definition at line 258 of file LArVoxelData.h.

References util::VectorMap< _Key, _Tp, _Compare >::empty(), and ftrackEnergy.

258 { 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 250 of file LArVoxelData.h.

References util::VectorMap< _Key, _Tp, _Compare >::end(), and ftrackEnergy.

Referenced by operator*=(), and sim::operator<<().

250 { 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 251 of file LArVoxelData.h.

References util::VectorMap< _Key, _Tp, _Compare >::end(), and ftrackEnergy.

251 { return ftrackEnergy.end(); }
iterator end()
Definition: VectorMap.h:198
list_type ftrackEnergy
Definition: LArVoxelData.h:101
const LArVoxelData::mapped_type & sim::LArVoxelData::Energy ( const size_type  index) const

Definition at line 31 of file LArVoxelData.cxx.

References util::VectorMap< _Key, _Tp, _Compare >::begin(), and ftrackEnergy.

32  {
34  std::advance(i,index);
35  return (*i).second;
36  }
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 279 of file LArVoxelData.h.

References RemoveTrack().

280 { return this->RemoveTrack(key); }
size_type RemoveTrack(const int &track)
Definition: LArVoxelData.h:214
sim::LArVoxelData::iterator sim::LArVoxelData::find ( const key_type key)
inline

Definition at line 267 of file LArVoxelData.h.

References util::VectorMap< _Key, _Tp, _Compare >::find(), and ftrackEnergy.

268 { return ftrackEnergy.find(key); }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
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 269 of file LArVoxelData.h.

References util::VectorMap< _Key, _Tp, _Compare >::find(), and ftrackEnergy.

270 { return ftrackEnergy.find(key); }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
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 290 of file LArVoxelData.h.

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

291 { ftrackEnergy[key] = value; }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
std::string value(boost::any const &)
sim::LArVoxelData::iterator sim::LArVoxelData::lower_bound ( const key_type key)
inline

Definition at line 275 of file LArVoxelData.h.

References ftrackEnergy, and util::VectorMap< _Key, _Tp, _Compare >::lower_bound().

276 { return ftrackEnergy.lower_bound(key); }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
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 277 of file LArVoxelData.h.

References ftrackEnergy, and util::VectorMap< _Key, _Tp, _Compare >::lower_bound().

278 { return ftrackEnergy.lower_bound(key); }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
iterator lower_bound(const key_type &__x)
Definition: VectorMap.h:408
sim::LArVoxelData::size_type sim::LArVoxelData::NumberParticles ( ) const
inline

Definition at line 202 of file LArVoxelData.h.

References size().

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

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

Definition at line 244 of file LArVoxelData.h.

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

245 {
246  return LArVoxelData(*this) *= value;
247 }
std::string value(boost::any const &)
LArVoxelData & sim::LArVoxelData::operator*= ( const double &  value)

Definition at line 54 of file LArVoxelData.cxx.

References util::VectorMap< _Key, _Tp, _Compare >::begin(), end(), util::VectorMap< _Key, _Tp, _Compare >::end(), fenergy, ftrackEnergy, and fhicl::detail::atom::value().

55  {
56  // Multiply all energies by the value.
57  for ( iterator i = ftrackEnergy.begin(), end = ftrackEnergy.end(); i != end; ++i )
58  {
59  (*i).second *= value;
60  }
61  fenergy *= value;
62 
63  return (*this);
64  }
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
std::string value(boost::any const &)
const sim::LArVoxelData sim::LArVoxelData::operator+ ( const LArVoxelData other) const
inline

Definition at line 240 of file LArVoxelData.h.

References LArVoxelData(), and fhicl::other.

241 {
242  return LArVoxelData(*this) += other;
243 }
sim::LArVoxelData & sim::LArVoxelData::operator+= ( const LArVoxelData other)
inline

Definition at line 235 of file LArVoxelData.h.

References Add().

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

Definition at line 282 of file LArVoxelData.h.

References ftrackEnergy.

283 { return ftrackEnergy[key]; }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
const sim::LArVoxelData::mapped_type & sim::LArVoxelData::operator[] ( const key_type key) const
inline

Definition at line 284 of file LArVoxelData.h.

References util::VectorMap< _Key, _Tp, _Compare >::at(), and ftrackEnergy.

285 { return ftrackEnergy.at(key); }
mapped_type & at(const key_type &__k)
Definition: VectorMap.h:272
list_type ftrackEnergy
Definition: LArVoxelData.h:101
sim::LArVoxelData::reverse_iterator sim::LArVoxelData::rbegin ( )
inline

Definition at line 252 of file LArVoxelData.h.

References ftrackEnergy, and util::VectorMap< _Key, _Tp, _Compare >::rbegin().

252 { 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 253 of file LArVoxelData.h.

References ftrackEnergy, and util::VectorMap< _Key, _Tp, _Compare >::rbegin().

253 { 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 225 of file LArVoxelData.h.

References util::VectorMap< _Key, _Tp, _Compare >::clear(), Energy(), fenergy, and ftrackEnergy.

Referenced by Add().

226 {
227  fenergy = this->Energy();
229 }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
mapped_type fenergy
Definition: LArVoxelData.h:96
mapped_type Energy() const
Definition: LArVoxelData.h:209
sim::LArVoxelData::size_type sim::LArVoxelData::RemoveTrack ( const int &  track)
inline

Definition at line 214 of file LArVoxelData.h.

References util::VectorMap< _Key, _Tp, _Compare >::end(), util::VectorMap< _Key, _Tp, _Compare >::erase(), fenergy, util::VectorMap< _Key, _Tp, _Compare >::find(), and ftrackEnergy.

Referenced by erase().

215 {
216  iterator search = ftrackEnergy.find( track );
217  if ( search != ftrackEnergy.end() )
218  {
219  fenergy += (*search).second;
220  ftrackEnergy.erase( search );
221  return 1;
222  }
223  else return 0;
224 }
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
iterator find(const key_type &key)
Definition: VectorMap.h:383
Float_t track
Definition: plot.C:34
sim::LArVoxelData::reverse_iterator sim::LArVoxelData::rend ( )
inline

Definition at line 254 of file LArVoxelData.h.

References ftrackEnergy, and util::VectorMap< _Key, _Tp, _Compare >::rend().

254 { 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 255 of file LArVoxelData.h.

References ftrackEnergy, and util::VectorMap< _Key, _Tp, _Compare >::rend().

255 { 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 200 of file LArVoxelData.h.

References fVoxelID.

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

Definition at line 257 of file LArVoxelData.h.

References ftrackEnergy, and util::VectorMap< _Key, _Tp, _Compare >::size().

Referenced by NumberParticles().

257 { 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 259 of file LArVoxelData.h.

References fenergy, ftrackEnergy, and util::VectorMap< _Key, _Tp, _Compare >::swap().

260 {
261  ftrackEnergy.swap( other.ftrackEnergy );
262  double temp = fenergy;
263  fenergy = other.fenergy;
264  other.fenergy = temp;
265 }
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 23 of file LArVoxelData.cxx.

References util::VectorMap< _Key, _Tp, _Compare >::begin(), and ftrackEnergy.

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

24  {
26  std::advance(i,index);
27  return (*i).first;
28  }
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 203 of file LArVoxelData.h.

References fenergy.

Referenced by sim::operator<<().

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

Definition at line 271 of file LArVoxelData.h.

References ftrackEnergy, and util::VectorMap< _Key, _Tp, _Compare >::upper_bound().

272 { return ftrackEnergy.upper_bound(key); }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
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 273 of file LArVoxelData.h.

References ftrackEnergy, and util::VectorMap< _Key, _Tp, _Compare >::upper_bound().

274 { return ftrackEnergy.upper_bound(key); }
list_type ftrackEnergy
Definition: LArVoxelData.h:101
iterator upper_bound(const key_type &__x)
Definition: VectorMap.h:418
sim::LArVoxelID sim::LArVoxelData::VoxelID ( ) const
inline

Definition at line 201 of file LArVoxelData.h.

References fVoxelID.

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

201 { 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 69 of file LArVoxelData.cxx.

70  {
71  return LArVoxelData(data) *= value;
72  }
std::string value(boost::any const &)
std::ostream& operator<< ( std::ostream &  output,
const LArVoxelData data 
)
friend

Definition at line 75 of file LArVoxelData.cxx.

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

Member Data Documentation

mapped_type sim::LArVoxelData::fenergy
private
sim::LArVoxelID sim::LArVoxelData::fVoxelID
private

Definition at line 103 of file LArVoxelData.h.

Referenced by SetVoxelID(), and VoxelID().


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