ATLAS Offline Software
FPGATrackSimNNMap.cxx
Go to the documentation of this file.
1 // Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
11 
12 #include <string>
13 #include <sstream>
14 #include <exception>
16 
17 using namespace std;
18 using namespace asg::msgUserCode;
19 
21 // Constructor/Desctructor
23 
24 
25 
26 FPGATrackSimNNMap::FPGATrackSimNNMap(const std::string & filepath)
27 {
28 
29  // Open file with NN weights
30  std::string weightsFileName = filepath;
31  std::ifstream input_cfg(weightsFileName.c_str());
32  if (input_cfg.is_open())
33  ANA_MSG_INFO("Opened file: " << weightsFileName);
34  else {
35  ANA_MSG_FATAL("Unable to open file: " << weightsFileName);
36  throw ("FPGATrackSimNNMap could not open " + weightsFileName);
37  }
38 
39  auto cfg = lwt::parse_json_graph( input_cfg );
40  m_lwnn_map = std::shared_ptr<lwt::LightweightGraph> (new lwt::LightweightGraph( cfg ));
41 }
42 
43 // Returns pointer to NN weighting map
44 
45 std::shared_ptr<lwt::LightweightGraph> FPGATrackSimNNMap::getNNMap() const {return m_lwnn_map;}
46 
FPGATrackSimNNMap.h
Map for NN tracking.
FPGATrackSimNNMap::FPGATrackSimNNMap
FPGATrackSimNNMap(const std::string &filepath)
Definition: FPGATrackSimNNMap.cxx:26
ANA_MSG_INFO
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:290
MessageCheck.h
macros for messaging and checking status codes
FPGATrackSimNNMap::getNNMap
std::shared_ptr< lwt::LightweightGraph > getNNMap() const
Definition: FPGATrackSimNNMap.cxx:45
ANA_MSG_FATAL
#define ANA_MSG_FATAL(xmsg)
Macro printing fatal messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:296
WriteCaloSwCorrections.cfg
cfg
Definition: WriteCaloSwCorrections.py:23
lwtDev::parse_json_graph
GraphConfig parse_json_graph(std::istream &json)
Definition: parse_json.cxx:71