The Gaudi Framework  v36r9p1 (5c15b2bb)
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 74 of file FixTESPath.cpp.

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

◆ 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() ? std::string{ location }
68  : location.empty() || ( location == "/Event" ) ? std::string{ rit.substr( 0, rit.size() - 1 ) }
69  : location.compare( 0, 7, "/Event/" ) == 0 ? std::string{ rit }.append( location.substr( 7 ) )
70  : location.compare( 0, 1, "/" ) == 0 ? std::string{ rit }.append( location.substr( 1 ) )
71  : std::string{ rit }.append( location );
72  }
GaudiPython.HistoUtils.location
location
Definition: HistoUtils.py:965
std::string
STL class.
std::move
T move(T... args)
gaudirun.s
string s
Definition: gaudirun.py:346
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)