Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:06:53

0001 // -*- C++ -*-
0002 #include "Rivet/Tools/Logging.hh"
0003 #include "Rivet/Analysis.hh"
0004 #include "Rivet/Tools/Logging.hh"
0005 #include "Rivet/AnalysisHandler.hh"
0006 #include "Rivet/ProjectionHandler.hh"
0007 
0008 #ifndef RIVET_RivetProjectionTree_HH
0009 #define RIVET_RivetProjectionTree_HH
0010 
0011 
0012 namespace Rivet{
0013 
0014   /// @brief Class that deals with generating projection trees (for debugging etc.)
0015   class ProjectionTreeGenerator{
0016     private:
0017       ///@name Private member variables that dictate output of the tree
0018       ///{
0019       ///path to save tree to.
0020       std::string _path;
0021 
0022       //Title of digraph (by default the last bit of the name minus the '.gv')
0023       std::string _title;
0024 
0025       ///flag to keep track of whether or not a tree has been generated
0026       bool _treeGenerated;
0027 
0028       //Tracks how many analyses are involved for the projection tree
0029       size_t _nAnalyses;
0030       ///}
0031 
0032       ///@name The vectors that store the projection tree itself.
0033       ///{
0034       ///Stores all the projections in the tree
0035       std::vector<Rivet::ConstProjectionPtr> _projVector;
0036 
0037       ///Stores all the edges: an edge is directional and stored as pair<size_t, size_t>{start, finish};
0038       ///(switched from array<size_t,2> to pair as cython doesn't wrap std::array)
0039       std::vector<std::pair<size_t, size_t>> _edgeVector;
0040 
0041       ///Stores the name labels of the projections in _projVector
0042       std::vector<std::string> _nameVector; //Should be 1<->1 with _projVector;
0043       ///}
0044       
0045 
0046     public:
0047       ///Standard constructor with name of gv pre-supplied
0048       ProjectionTreeGenerator(const std::string& path);
0049 
0050       ///Standard constructor
0051       ProjectionTreeGenerator();
0052 
0053       ///Set the path
0054       void setPath(const std::string& path);
0055 
0056       ///Set the title (defaults to last bit of path without '.gv')
0057       void setTitle(const std::string& title);
0058     
0059       ///Generate the projection tree for the supplied analyses (constructs dummy analysisHandler for you)
0060       int generateProjTree(const std::vector<std::string>& analyses);
0061 
0062       ///Get a projection tree from the supplied analysishandler
0063       int getProjTree(const AnalysisHandler& ah);
0064 
0065       ///Save the projection tree to the path specifed by _path
0066       void writeProjTree() const;
0067 
0068       ///Get the vector of projection names
0069       ///TODO: I'd have preferred a pass-by-reference solution but cython wasn't co-operating.
0070       inline const std::vector<string>& getProjNames() const{
0071         return _nameVector;
0072       }
0073 
0074       ///Get the vector of edges - format pair<size_t,size_t>(start-index,end-index)
0075       inline const std::vector<std::pair<size_t, size_t>>& getEdges() const {
0076         return _edgeVector;
0077       }
0078 
0079       /// Get a logger object.
0080       Log& getLog() const;
0081   };
0082 }
0083 
0084 #endif