ATLAS Offline Software
FastGraph.h
Go to the documentation of this file.
1 // this is -*- C++ -*-
2 /*
3  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
4 */
5 
6 // Any modifications to this file may be copied to lwtnn[1] without
7 // attribution.
8 //
9 // [1]: https::www.github.com/lwtnn/lwtnn
10 
11 #ifndef LWTNN_UTILS_FAST_GRAPH_H
12 #define LWTNN_UTILS_FAST_GRAPH_H
13 
14 #include "lwtnn/lightweight_network_config.hh"
15 #include "lwtnn/Graph.hh"
17 #include <Eigen/Dense>
18 
19 namespace lwt::atlas {
20 
21  class FastInputPreprocessor;
22  class FastInputVectorPreprocessor;
23  struct InputOrder;
24 
26  {
27  std::vector<size_t> scalar;
28  std::vector<size_t> sequence;
29  };
30 
31  // Graph class
32  class FastGraph
33  {
34  public:
35  // Since a graph has multiple input nodes, we actually call
36  typedef std::vector<Eigen::VectorXd> NodeVec;
37  typedef std::vector<Eigen::MatrixXd> SeqNodeVec;
38 
39 
40  // In cases where the graph has multiple outputs, we have to
41  // define a "default" output, so that calling "compute" with no
42  // output specified doesn't lead to ambiguity.
43  FastGraph(const GraphConfig& config, const InputOrder& order,
44  std::string default_output = "");
45 
46  ~FastGraph();
47  FastGraph(FastGraph&) = delete;
49 
50  // The simpler "compute" function
51  Eigen::VectorXd compute(const NodeVec&, const SeqNodeVec& = {}) const;
52 
53  // the other "compute" which allows you to select an arbitrary output
54  Eigen::VectorXd compute(const NodeVec&, const SeqNodeVec&, size_t) const;
55 
56  private:
59  typedef std::vector<IP*> Preprocs;
60  typedef std::vector<IVP*> VecPreprocs;
61 
62  Graph* m_graph;
66  // the mapping from a node in the network to a user input node
68  };
69 }
70 
71 #endif
lwt::atlas::FastGraph::m_vec_preprocs
VecPreprocs m_vec_preprocs
Definition: FastGraph.h:64
lwt::atlas::FastGraph::VecPreprocs
std::vector< IVP * > VecPreprocs
Definition: FastGraph.h:60
lwt::atlas::FastGraph::IP
FastInputPreprocessor IP
Definition: FastGraph.h:57
lwt::atlas::FastGraph::m_graph
Graph * m_graph
Definition: FastGraph.h:62
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
lwt::atlas::FastGraph::m_input_indices
SourceIndices m_input_indices
Definition: FastGraph.h:67
lwt::atlas::FastGraph::compute
Eigen::VectorXd compute(const NodeVec &, const SeqNodeVec &={}) const
Definition: FastGraph.cxx:158
lwt::atlas::FastGraph::FastGraph
FastGraph(const GraphConfig &config, const InputOrder &order, std::string default_output="")
Definition: FastGraph.cxx:109
lwt::atlas::FastGraph::~FastGraph
~FastGraph()
Definition: FastGraph.cxx:146
mc.order
order
Configure Herwig7.
Definition: mc.Herwig7_Dijet.py:12
lwt::atlas::FastGraph::operator=
FastGraph & operator=(FastGraph &)=delete
lwt::atlas::InputOrder
Definition: InputOrder.h:28
lwt::atlas::FastGraph::IVP
FastInputVectorPreprocessor IVP
Definition: FastGraph.h:58
lwt::atlas::FastInputVectorPreprocessor
Definition: FastInputPreprocessor.h:46
lwt::atlas::FastGraph::m_default_output
size_t m_default_output
Definition: FastGraph.h:65
lwt::atlas::FastGraph
Definition: FastGraph.h:33
lwt::atlas
Ensure that the extensions for the Vector3D are properly loaded.
Definition: LWTNNCondAlg.h:24
lwt::atlas::SourceIndices
Definition: FastGraph.h:26
EventPrimitives.h
lwt::atlas::FastGraph::m_preprocs
Preprocs m_preprocs
Definition: FastGraph.h:63
lwt::atlas::FastGraph::SeqNodeVec
std::vector< Eigen::MatrixXd > SeqNodeVec
Definition: FastGraph.h:37
lwt::atlas::FastGraph::FastGraph
FastGraph(FastGraph &)=delete
lwt::atlas::FastGraph::NodeVec
std::vector< Eigen::VectorXd > NodeVec
Definition: FastGraph.h:36
lwt::atlas::SourceIndices::sequence
std::vector< size_t > sequence
Definition: FastGraph.h:28
lwt::atlas::NodeVec
FastGraph::NodeVec NodeVec
Definition: FastGraph.cxx:108
lwt::atlas::FastGraph::Preprocs
std::vector< IP * > Preprocs
Definition: FastGraph.h:59
lwt::atlas::SourceIndices::scalar
std::vector< size_t > scalar
Definition: FastGraph.h:27
lwt::atlas::FastInputPreprocessor
Definition: FastInputPreprocessor.h:33