Public Member Functions | Private Attributes | List of all members
cvn::GCNParticleFlow Class Reference

GCNParticleFlow, a map of true particles to their parents. More...

#include <GCNParticleFlow.h>

Public Member Functions

 GCNParticleFlow ()
 Default constructor. More...
 
 GCNParticleFlow (std::map< unsigned int, unsigned int > truthMap)
 Construct from map. More...
 
 ~GCNParticleFlow ()
 Default destructor. More...
 
void AddParticle (unsigned int particle, unsigned int parent)
 Add a new true particle. More...
 
std::map< unsigned int, unsigned int > GetMap () const
 Retrieve truth information. More...
 
unsigned int GetParent (unsigned int particle)
 

Private Attributes

std::map< unsigned int, unsigned int > fTruthMap
 Map of true particle ID to parent particle ID. More...
 

Detailed Description

GCNParticleFlow, a map of true particles to their parents.

Definition at line 16 of file GCNParticleFlow.h.

Constructor & Destructor Documentation

cvn::GCNParticleFlow::GCNParticleFlow ( )
inline

Default constructor.

Definition at line 21 of file GCNParticleFlow.h.

21 {};
cvn::GCNParticleFlow::GCNParticleFlow ( std::map< unsigned int, unsigned int >  truthMap)

Construct from map.

Constructor.

Definition at line 13 of file GCNParticleFlow.cxx.

14  : fTruthMap(truthMap)
15  {}
std::map< unsigned int, unsigned int > fTruthMap
Map of true particle ID to parent particle ID.
cvn::GCNParticleFlow::~GCNParticleFlow ( )
inline

Default destructor.

Definition at line 25 of file GCNParticleFlow.h.

25 {};

Member Function Documentation

void cvn::GCNParticleFlow::AddParticle ( unsigned int  particle,
unsigned int  parent 
)

Add a new true particle.

Add true particle to map.

Definition at line 18 of file GCNParticleFlow.cxx.

19  {
20 
21  // Check this particle isn't already filled
22  if (fTruthMap.count(particle)) {
23  // If it is filled, just check the results are consistent
24  if (fTruthMap[particle] != parent) {
25  std::ostringstream err;
26  err << "Asked to add parent " << parent << " for particle "
27  << particle << ", but its parent was already assigned as "
28  << fTruthMap[particle] << "!";
29  throw std::runtime_error(err.str());
30  }
31  else return; // If the map is already filled, don't do anything
32  }
33 
34  // Add particle parent
35  fTruthMap[particle] = parent;
36  return;
37 
38  } // function GCNParticleFlow::AddParticle
std::map< unsigned int, unsigned int > fTruthMap
Map of true particle ID to parent particle ID.
void err(const char *fmt,...)
Definition: message.cpp:226
def parent(G, child, parent_type)
Definition: graph.py:67
std::map<unsigned int, unsigned int> cvn::GCNParticleFlow::GetMap ( ) const
inline

Retrieve truth information.

Definition at line 31 of file GCNParticleFlow.h.

31 { return fTruthMap; };
std::map< unsigned int, unsigned int > fTruthMap
Map of true particle ID to parent particle ID.
unsigned int cvn::GCNParticleFlow::GetParent ( unsigned int  particle)

Definition at line 40 of file GCNParticleFlow.cxx.

40  {
41 
42  // Check corresponding map entry is filled
43  if (!fTruthMap.count(particle)) {
44  std::ostringstream err;
45  err << "No parent defined for true particle " << particle << "!";
46  throw std::runtime_error(err.str());
47  }
48 
49  // Otherwise return
50  return fTruthMap[particle];
51 
52  } // function GCNParticleFlow::GetParent
std::map< unsigned int, unsigned int > fTruthMap
Map of true particle ID to parent particle ID.
void err(const char *fmt,...)
Definition: message.cpp:226

Member Data Documentation

std::map<unsigned int, unsigned int> cvn::GCNParticleFlow::fTruthMap
private

Map of true particle ID to parent particle ID.

Definition at line 37 of file GCNParticleFlow.h.


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