LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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 75 of file LArVoxelData.h.

Constructor & Destructor Documentation

sim::LArVoxelData::LArVoxelData ( )

Definition at line 16 of file LArVoxelData.cxx.

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

16 : fenergy(0) {}
mapped_type fenergy
Definition: LArVoxelData.h:95
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 238 of file LArVoxelData.h.

References energy, and ftrackEnergy.

Referenced by operator+=().

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

Definition at line 243 of file LArVoxelData.h.

References energy, and fenergy.

244 {
245  fenergy += energy;
246 }
mapped_type fenergy
Definition: LArVoxelData.h:95
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:95
sim::LArVoxelData::mapped_type sim::LArVoxelData::AssignedEnergy ( ) const
inline
sim::LArVoxelData::mapped_type & sim::LArVoxelData::at ( const key_type key)
inline

Definition at line 357 of file LArVoxelData.h.

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

358 {
359  return ftrackEnergy.at(key);
360 }
mapped_type & at(const key_type &__k)
Definition: VectorMap.h:234
list_type ftrackEnergy
Definition: LArVoxelData.h:100
const sim::LArVoxelData::mapped_type & sim::LArVoxelData::at ( const key_type key) const
inline

Definition at line 361 of file LArVoxelData.h.

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

363 {
364  return ftrackEnergy.at(key);
365 }
mapped_type & at(const key_type &__k)
Definition: VectorMap.h:234
list_type ftrackEnergy
Definition: LArVoxelData.h:100
sim::LArVoxelData::iterator sim::LArVoxelData::begin ( )
inline

Definition at line 260 of file LArVoxelData.h.

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

Referenced by sim::operator<<().

261 {
262  return ftrackEnergy.begin();
263 }
list_type ftrackEnergy
Definition: LArVoxelData.h:100
iterator begin()
Definition: VectorMap.h:183
sim::LArVoxelData::const_iterator sim::LArVoxelData::begin ( ) const
inline

Definition at line 264 of file LArVoxelData.h.

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

265 {
266  return ftrackEnergy.begin();
267 }
list_type ftrackEnergy
Definition: LArVoxelData.h:100
iterator begin()
Definition: VectorMap.h:183
void sim::LArVoxelData::clear ( )
inline

Definition at line 308 of file LArVoxelData.h.

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

309 {
310  fenergy = 0.;
312 }
list_type ftrackEnergy
Definition: LArVoxelData.h:100
mapped_type fenergy
Definition: LArVoxelData.h:95
bool sim::LArVoxelData::empty ( ) const
inline

Definition at line 297 of file LArVoxelData.h.

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

298 {
299  return ftrackEnergy.empty();
300 }
list_type ftrackEnergy
Definition: LArVoxelData.h:100
bool empty() const
Definition: VectorMap.h:199
sim::LArVoxelData::iterator sim::LArVoxelData::end ( void  )
inline

Definition at line 268 of file LArVoxelData.h.

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

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

269 {
270  return ftrackEnergy.end();
271 }
iterator end()
Definition: VectorMap.h:187
list_type ftrackEnergy
Definition: LArVoxelData.h:100
sim::LArVoxelData::const_iterator sim::LArVoxelData::end ( void  ) const
inline

Definition at line 272 of file LArVoxelData.h.

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

273 {
274  return ftrackEnergy.end();
275 }
iterator end()
Definition: VectorMap.h:187
list_type ftrackEnergy
Definition: LArVoxelData.h:100
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:100
iterator begin()
Definition: VectorMap.h:183
sim::LArVoxelData::size_type sim::LArVoxelData::erase ( const key_type key)
inline

Definition at line 342 of file LArVoxelData.h.

References RemoveTrack().

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

Definition at line 313 of file LArVoxelData.h.

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

314 {
315  return ftrackEnergy.find(key);
316 }
list_type ftrackEnergy
Definition: LArVoxelData.h:100
iterator find(const key_type &key)
Definition: VectorMap.h:329
sim::LArVoxelData::const_iterator sim::LArVoxelData::find ( const key_type key) const
inline

Definition at line 317 of file LArVoxelData.h.

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

319 {
320  return ftrackEnergy.find(key);
321 }
list_type ftrackEnergy
Definition: LArVoxelData.h:100
iterator find(const key_type &key)
Definition: VectorMap.h:329
void sim::LArVoxelData::insert ( const key_type key,
const mapped_type value 
)
inline

Definition at line 366 of file LArVoxelData.h.

References ftrackEnergy, and value.

368 {
369  ftrackEnergy[key] = value;
370 }
list_type ftrackEnergy
Definition: LArVoxelData.h:100
double value
Definition: spectrum.C:18
sim::LArVoxelData::iterator sim::LArVoxelData::lower_bound ( const key_type key)
inline

Definition at line 332 of file LArVoxelData.h.

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

334 {
335  return ftrackEnergy.lower_bound(key);
336 }
list_type ftrackEnergy
Definition: LArVoxelData.h:100
iterator lower_bound(const key_type &__x)
Definition: VectorMap.h:349
sim::LArVoxelData::const_iterator sim::LArVoxelData::lower_bound ( const key_type key) const
inline

Definition at line 337 of file LArVoxelData.h.

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

339 {
340  return ftrackEnergy.lower_bound(key);
341 }
list_type ftrackEnergy
Definition: LArVoxelData.h:100
iterator lower_bound(const key_type &__x)
Definition: VectorMap.h:349
sim::LArVoxelData::size_type sim::LArVoxelData::NumberParticles ( ) const
inline

Definition at line 200 of file LArVoxelData.h.

References size().

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

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

Definition at line 256 of file LArVoxelData.h.

References LArVoxelData(), and value.

257 {
258  return LArVoxelData(*this) *= value;
259 }
double value
Definition: spectrum.C:18
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 value.

55  {
56  // Multiply all energies by the value.
57  for (iterator i = ftrackEnergy.begin(), end = ftrackEnergy.end(); i != end; ++i) {
58  (*i).second *= value;
59  }
60  fenergy *= value;
61 
62  return (*this);
63  }
iterator end()
Definition: VectorMap.h:187
list_type ftrackEnergy
Definition: LArVoxelData.h:100
iterator begin()
Definition: VectorMap.h:183
mapped_type fenergy
Definition: LArVoxelData.h:95
double value
Definition: spectrum.C:18
const sim::LArVoxelData sim::LArVoxelData::operator+ ( const LArVoxelData other) const
inline

Definition at line 252 of file LArVoxelData.h.

References LArVoxelData(), and fhicl::other.

253 {
254  return LArVoxelData(*this) += other;
255 }
sim::LArVoxelData & sim::LArVoxelData::operator+= ( const LArVoxelData other)
inline

Definition at line 247 of file LArVoxelData.h.

References Add().

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

Definition at line 347 of file LArVoxelData.h.

References ftrackEnergy.

349 {
350  return ftrackEnergy[key];
351 }
list_type ftrackEnergy
Definition: LArVoxelData.h:100
const sim::LArVoxelData::mapped_type & sim::LArVoxelData::operator[] ( const key_type key) const
inline

Definition at line 352 of file LArVoxelData.h.

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

354 {
355  return ftrackEnergy.at(key);
356 }
mapped_type & at(const key_type &__k)
Definition: VectorMap.h:234
list_type ftrackEnergy
Definition: LArVoxelData.h:100
sim::LArVoxelData::reverse_iterator sim::LArVoxelData::rbegin ( )
inline

Definition at line 276 of file LArVoxelData.h.

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

277 {
278  return ftrackEnergy.rbegin();
279 }
reverse_iterator rbegin()
Definition: VectorMap.h:191
list_type ftrackEnergy
Definition: LArVoxelData.h:100
sim::LArVoxelData::const_reverse_iterator sim::LArVoxelData::rbegin ( ) const
inline

Definition at line 280 of file LArVoxelData.h.

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

281 {
282  return ftrackEnergy.rbegin();
283 }
reverse_iterator rbegin()
Definition: VectorMap.h:191
list_type ftrackEnergy
Definition: LArVoxelData.h:100
void sim::LArVoxelData::RemoveAllTracks ( )
inline

Definition at line 233 of file LArVoxelData.h.

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

Referenced by Add().

234 {
235  fenergy = this->Energy();
237 }
list_type ftrackEnergy
Definition: LArVoxelData.h:100
mapped_type fenergy
Definition: LArVoxelData.h:95
mapped_type Energy() const
Definition: LArVoxelData.h:215
sim::LArVoxelData::size_type sim::LArVoxelData::RemoveTrack ( const int &  track)
inline

Definition at line 222 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().

223 {
224  iterator search = ftrackEnergy.find(track);
225  if (search != ftrackEnergy.end()) {
226  fenergy += (*search).second;
227  ftrackEnergy.erase(search);
228  return 1;
229  }
230  else
231  return 0;
232 }
iterator end()
Definition: VectorMap.h:187
void erase(iterator __position)
Definition: VectorMap.h:293
list_type ftrackEnergy
Definition: LArVoxelData.h:100
mapped_type fenergy
Definition: LArVoxelData.h:95
iterator find(const key_type &key)
Definition: VectorMap.h:329
Float_t track
Definition: plot.C:35
sim::LArVoxelData::reverse_iterator sim::LArVoxelData::rend ( )
inline

Definition at line 284 of file LArVoxelData.h.

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

285 {
286  return ftrackEnergy.rend();
287 }
reverse_iterator rend()
Definition: VectorMap.h:195
list_type ftrackEnergy
Definition: LArVoxelData.h:100
sim::LArVoxelData::const_reverse_iterator sim::LArVoxelData::rend ( ) const
inline

Definition at line 288 of file LArVoxelData.h.

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

289 {
290  return ftrackEnergy.rend();
291 }
reverse_iterator rend()
Definition: VectorMap.h:195
list_type ftrackEnergy
Definition: LArVoxelData.h:100
void sim::LArVoxelData::SetVoxelID ( sim::LArVoxelID  voxID)
inline

Definition at line 192 of file LArVoxelData.h.

References fVoxelID.

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

Definition at line 293 of file LArVoxelData.h.

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

Referenced by NumberParticles().

294 {
295  return ftrackEnergy.size();
296 }
list_type ftrackEnergy
Definition: LArVoxelData.h:100
size_t size() const
Definition: VectorMap.h:201
void sim::LArVoxelData::swap ( LArVoxelData other)
inline

Definition at line 301 of file LArVoxelData.h.

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

302 {
303  ftrackEnergy.swap(other.ftrackEnergy);
304  double temp = fenergy;
305  fenergy = other.fenergy;
306  other.fenergy = temp;
307 }
list_type ftrackEnergy
Definition: LArVoxelData.h:100
mapped_type fenergy
Definition: LArVoxelData.h:95
void swap(VectorMap &other)
Definition: VectorMap.h:312
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 evdb_tool::DrawLArVoxel3D::Draw(), evd::SimulationDrawer::MCTruth3D(), and evd::SimulationDrawer::MCTruthOrtho().

24  {
26  std::advance(i, index);
27  return (*i).first;
28  }
list_type ftrackEnergy
Definition: LArVoxelData.h:100
iterator begin()
Definition: VectorMap.h:183
sim::LArVoxelData::mapped_type sim::LArVoxelData::UnassignedEnergy ( ) const
inline

Definition at line 204 of file LArVoxelData.h.

References fenergy.

Referenced by sim::operator<<().

205 {
206  return fenergy;
207 }
mapped_type fenergy
Definition: LArVoxelData.h:95
sim::LArVoxelData::iterator sim::LArVoxelData::upper_bound ( const key_type key)
inline

Definition at line 322 of file LArVoxelData.h.

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

324 {
325  return ftrackEnergy.upper_bound(key);
326 }
list_type ftrackEnergy
Definition: LArVoxelData.h:100
iterator upper_bound(const key_type &__x)
Definition: VectorMap.h:359
sim::LArVoxelData::const_iterator sim::LArVoxelData::upper_bound ( const key_type key) const
inline

Definition at line 327 of file LArVoxelData.h.

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

329 {
330  return ftrackEnergy.upper_bound(key);
331 }
list_type ftrackEnergy
Definition: LArVoxelData.h:100
iterator upper_bound(const key_type &__x)
Definition: VectorMap.h:359
sim::LArVoxelID sim::LArVoxelData::VoxelID ( ) const
inline

Definition at line 196 of file LArVoxelData.h.

References fVoxelID.

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

197 {
198  return fVoxelID;
199 }
sim::LArVoxelID fVoxelID
Definition: LArVoxelData.h:102

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 68 of file LArVoxelData.cxx.

69  {
70  return LArVoxelData(data) *= value;
71  }
double value
Definition: spectrum.C:18
std::ostream& operator<< ( std::ostream &  output,
const LArVoxelData data 
)
friend

Definition at line 74 of file LArVoxelData.cxx.

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

Member Data Documentation

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

Definition at line 102 of file LArVoxelData.h.

Referenced by SetVoxelID(), and VoxelID().


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