The Gaudi Framework  v36r1 (3e2fb5a8)
FixTESPathDetails Namespace Reference

Functions

std::unique_ptr< IDataHandleVisitorfixDataHandlePath (std::string_view rit, std::string rootName, MsgStream *dbg)
 
std::string fullTESLocation (std::string_view location, std::string_view rit)
 

Function Documentation

◆ fixDataHandlePath()

std::unique_ptr< IDataHandleVisitor > FixTESPathDetails::fixDataHandlePath ( std::string_view  rit,
std::string  rootName,
MsgStream dbg 
)

Definition at line 77 of file FixTESPath.cpp.

77  {
78  if ( !rootName.empty() && '/' != rootName.back() ) rootName += "/";
79  return make_unique_DHHFixer( [rit, rootName = std::move( rootName ), dbg]( std::string const& location ) {
80  auto tokens = boost::tokenizer{location, boost::char_separator{":"}};
81  auto result =
82  std::accumulate( tokens.begin(), tokens.end(), std::string{}, [&]( std::string s, std::string_view tok ) {
83  std::string r = fullTESLocation( tok, rit );
84  // check whether we have an absolute path if yes use it - else prepend DataManager Root
85  if ( r[0] != '/' ) r = rootName + r;
86  return s.empty() ? r : s + ':' + r;
87  } );
88  if ( result != location && dbg ) ( *dbg ) << "Changing " << location << " to " << result << endmsg;
89  return result;
90  } );
91  }

◆ fullTESLocation()

std::string FixTESPathDetails::fullTESLocation ( std::string_view  location,
std::string_view  rit 
)

Definition at line 56 of file FixTESPath.cpp.

56  {
57  // The logic is:
58  // if no R.I.T., give back location
59  // if R.I.T., this is the mapping:
60  // (note that R.I.T. contains a trailing '/')
61  // location -> result
62  // -------------------------------------------------
63  // "" -> R.I.T.[:-1] ("rit")
64  // "/Event" -> R.I.T.[:-1] ("rit")
65  // "/Event/MyObj" -> R.I.T. + "MyObj" ("rit/MyObj")
66  // "MyObj" -> R.I.T. + "MyObj" ("rit/MyObj")
67  return rit.empty()
69  : location.empty() || ( location == "/Event" )
70  ? std::string{rit.substr( 0, rit.size() - 1 )}
71  : location.compare( 0, 7, "/Event/" ) == 0
72  ? std::string{rit}.append( location.substr( 7 ) )
73  : location.compare( 0, 1, "/" ) == 0 ? std::string{rit}.append( location.substr( 1 ) )
74  : std::string{rit}.append( location );
75  }
GaudiPython.HistoUtils.location
location
Definition: HistoUtils.py:947
std::string
STL class.
std::move
T move(T... args)
gaudirun.s
string s
Definition: gaudirun.py:328
std::string::back
T back(T... args)
std::accumulate
T accumulate(T... args)
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:203
std::string::append
T append(T... args)
std::string::substr
T substr(T... args)
std::string::empty
T empty(T... args)