Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Types | Public Member Functions | Private Attributes | List of all members
MuonML::NodeFeatureList Class Reference

#include <NodeFeatureList.h>

Collaboration diagram for MuonML::NodeFeatureList:

Public Types

using Feature_t = std::shared_ptr< const NodeFeature >
 
using Connector_t = std::shared_ptr< const NodeConnector >
 
using Bucket_t = NodeFeature::Bucket_t
 

Public Member Functions

 NodeFeatureList ()=default
 Empty standard constructor. More...
 
bool operator== (const NodeFeatureList &other) const
 Returns true if the features have pairwise the same name. More...
 
bool isValid () const
 Returns whether the NodeFeatureList is complete, i.e. More...
 
size_t numFeatures () const
 Returns the number of features in the list. More...
 
std::vector< std::string > featureNames () const
 Returns the name of the features in the list. More...
 
void fillInData (const Bucket_t &bucket, GraphRawData &graphData) const
 
More...
 
bool addFeature (const std::string &featName, MsgStream &msg)
 Tries to add a new feature to the list using the predefined list of features in the GraphFeatureFactory. More...
 
bool addFeature (const Feature_t &featPtr, MsgStream &msg)
 Tries to add a particular feature to the list. More...
 
bool setConnector (const std::string &conName, MsgStream &msg)
 Tries to set the graph connector based on the connector name. More...
 
void setConnector (const std::string &conName, NodeConnector::Evaluator_t evalFunc)
 Sets the
More...
 

Private Attributes

std::vector< Feature_tm_features {}
 
Connector_t m_connector {}
 

Detailed Description

Definition at line 14 of file NodeFeatureList.h.

Member Typedef Documentation

◆ Bucket_t

Definition at line 20 of file NodeFeatureList.h.

◆ Connector_t

Definition at line 18 of file NodeFeatureList.h.

◆ Feature_t

Definition at line 17 of file NodeFeatureList.h.

Constructor & Destructor Documentation

◆ NodeFeatureList()

MuonML::NodeFeatureList::NodeFeatureList ( )
default

Empty standard constructor.

Member Function Documentation

◆ addFeature() [1/2]

bool MuonML::NodeFeatureList::addFeature ( const Feature_t featPtr,
MsgStream &  msg 
)

Tries to add a particular feature to the list.

Parameters
featPtrPointer to the instantiated feature
msgReference to the message stream object for logging.

Definition at line 56 of file NodeFeatureList.cxx.

56  {
57  if (!newFeat) {
58  msg<<MSG::ERROR<<"No feature has been parsed. "<<endmsg;
59  return false;
60  }
61  if (std::ranges::find_if(m_features, [&newFeat](const Feature_t& known){
62  return known == newFeat || known->name() == newFeat->name();
63  }) != m_features.end()) {
64  msg<<MSG::ERROR<<" The feature "<<newFeat->name()<<" has already been added & "
65  <<" cannot be added again. "<<endmsg;
66  return false;
67  }
68  if (msg.level() <= MSG::DEBUG) {
69  msg<<MSG::DEBUG<<__FILE__<<":"<<__LINE__<<" - Add new feature "<< newFeat->name()<<endmsg;
70  }
71  m_features.push_back(newFeat);
72  return true;
73  }

◆ addFeature() [2/2]

bool MuonML::NodeFeatureList::addFeature ( const std::string &  featName,
MsgStream &  msg 
)

Tries to add a new feature to the list using the predefined list of features in the GraphFeatureFactory.

Parameters
featNameName of the feature in the factory
msgReference to the message stream object for logging.

Definition at line 52 of file NodeFeatureList.cxx.

52  {
53  return addFeature(Factory::makeFeature(featName, msg), msg);
54  }

◆ featureNames()

std::vector< std::string > MuonML::NodeFeatureList::featureNames ( ) const

Returns the name of the features in the list.

Definition at line 45 of file NodeFeatureList.cxx.

45  {
46  std::vector<std::string> names{};
47  std::ranges::transform(m_features,std::back_inserter(names),
48  [](const Feature_t& ft){ return ft->name();});
49  return names;
50  }

◆ fillInData()

void MuonML::NodeFeatureList::fillInData ( const Bucket_t bucket,
GraphRawData graphData 
) const


Fill the graph features

Connection i->j

Connection j-> i

Definition at line 75 of file NodeFeatureList.cxx.

76  {
77  for (size_t sp = 0 ; sp < bucket.size(); ++sp) {
79  for(const Feature_t& feat : m_features) {
80  assert(prepGraph.currLeave != prepGraph.featureLeaves.end());
81  (*prepGraph.currLeave++) = feat->eval(bucket, sp);
82  }
83  for (size_t ot = 0; ot < sp; ++ot) {
84  size_t from = prepGraph.nodeIndex +sp;
85  size_t to = prepGraph.nodeIndex + ot;
86  if (m_connector->connect(bucket, sp, ot)) {
88  prepGraph.srcEdges.emplace_back(from);
89  prepGraph.desEdges.emplace_back(to);
91  prepGraph.srcEdges.emplace_back(to);
92  prepGraph.desEdges.emplace_back(from);
93  }
94  }
95  }
96  prepGraph.nodeIndex+=bucket.size();
97  }

◆ isValid()

bool MuonML::NodeFeatureList::isValid ( ) const

Returns whether the NodeFeatureList is complete, i.e.

it must have at least one feature and the node connector

Definition at line 15 of file NodeFeatureList.cxx.

15  {
16  return m_connector && numFeatures();
17  }

◆ numFeatures()

size_t MuonML::NodeFeatureList::numFeatures ( ) const

Returns the number of features in the list.

Definition at line 40 of file NodeFeatureList.cxx.

40  {
41  return m_features.size();
42  }

◆ operator==()

bool MuonML::NodeFeatureList::operator== ( const NodeFeatureList other) const

Returns true if the features have pairwise the same name.

Definition at line 26 of file NodeFeatureList.cxx.

26  {
27  if (numFeatures() != other.numFeatures()) {
28  return false;
29  }
30  if (!m_connector || !other.m_connector || m_connector->name() != other.m_connector->name()) {
31  return false;
32  }
33  for (size_t f =0 ; f < numFeatures(); ++f) {
34  if (m_features[f]->name() != other.m_features[f]->name()) {
35  return false;
36  }
37  }
38  return true;
39  }

◆ setConnector() [1/2]

bool MuonML::NodeFeatureList::setConnector ( const std::string &  conName,
MsgStream &  msg 
)

Tries to set the graph connector based on the connector name.

Parameters
conNameName of the connector to extract from the factory
msgReference to the message stream object for logging.

Definition at line 18 of file NodeFeatureList.cxx.

18  {
20  return m_connector != nullptr;
21  }

◆ setConnector() [2/2]

void MuonML::NodeFeatureList::setConnector ( const std::string &  conName,
NodeConnector::Evaluator_t  evalFunc 
)

Sets the

Definition at line 23 of file NodeFeatureList.cxx.

23  {
24  m_connector = std::make_unique<NodeConnector>(conName, evalFunc);
25  }

Member Data Documentation

◆ m_connector

Connector_t MuonML::NodeFeatureList::m_connector {}
private

Definition at line 57 of file NodeFeatureList.h.

◆ m_features

std::vector<Feature_t> MuonML::NodeFeatureList::m_features {}
private

Definition at line 56 of file NodeFeatureList.h.


The documentation for this class was generated from the following files:
PlotCalibFromCool.ft
ft
Definition: PlotCalibFromCool.py:329
MuonML::NodeFeatureList::numFeatures
size_t numFeatures() const
Returns the number of features in the list.
Definition: NodeFeatureList.cxx:40
MuonML::NodeFeatureList::Feature_t
std::shared_ptr< const NodeFeature > Feature_t
Definition: NodeFeatureList.h:17
ReadFromCoolCompare.ot
ot
Definition: ReadFromCoolCompare.py:229
MuonML::Factory::makeConnector
NodeFeatureList::Connector_t makeConnector(const std::string &connName, MsgStream &log)
Factory function that builds a connector relation between two edges in the bucket.
Definition: NodeFeatureFactory.cxx:128
MuonML::Factory::makeFeature
NodeFeatureList::Feature_t makeFeature(const std::string &featName, MsgStream &log)
Factory function that builds a NodeFeature from a predefined list of features.
Definition: NodeFeatureFactory.cxx:38
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
python.subdetectors.mmg.names
names
Definition: mmg.py:8
MuonML::NodeFeatureList::m_features
std::vector< Feature_t > m_features
Definition: NodeFeatureList.h:56
MuonML::NodeFeatureList::m_connector
Connector_t m_connector
Definition: NodeFeatureList.h:57
MuonML::NodeFeatureList::addFeature
bool addFeature(const std::string &featName, MsgStream &msg)
Tries to add a new feature to the list using the predefined list of features in the GraphFeatureFacto...
Definition: NodeFeatureList.cxx:52
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
hist_file_dump.f
f
Definition: hist_file_dump.py:141
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
CxxUtils::to
CONT to(RANGE &&r)
Definition: ranges.h:39
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
known
Definition: TrigBStoxAODTool.cxx:107
DEBUG
#define DEBUG
Definition: page_access.h:11
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7