ATLAS Offline Software
AthToolSupport/AsgDataHandles/AsgDataHandles/DecorKeyHelpers.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration.
3  */
4 
5 #ifndef ASG_DATA_HANDLES_DECOR_KEY_HELPERS_H
6 #define ASG_DATA_HANDLES_DECOR_KEY_HELPERS_H
7 
8 #ifndef XAOD_STANDALONE
10 #else
11 
12 #include <stdexcept>
13 #include <string>
14 
15 namespace SG {
16 
17 inline std::string contKeyFromKey (const std::string& key)
18 {
19  const auto split = key.rfind ('.');
20  if (split == std::string::npos)
21  return key;
22  return key.substr (0, split);
23 }
24 
25 inline std::string decorKeyFromKey (const std::string& key)
26 {
27  const auto split = key.rfind ('.');
28  if (split == std::string::npos)
29  return "";
30  return key.substr (split + 1);
31 }
32 
33 }
34 
35 #endif
36 
37 #endif
SG::contKeyFromKey
std::string contKeyFromKey(const std::string &key)
Extract the container part of key.
Definition: DecorKeyHelpers.cxx:26
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::decorKeyFromKey
std::string decorKeyFromKey(const std::string &key)
Extract the decoration part of key.
Definition: DecorKeyHelpers.cxx:41
DecorKeyHelpers.h
Some common helper functions used by decoration handles.
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37