30 void removeDefaultTemplateParameters( std::string& name,
31 const std::string& vectorName ) {
34 while( ( vecPos =
name.find( vectorName +
"<", vecPos ) ) !=
38 vecPos += ( vectorName.size() + 1 );
43 size_t commaPos = std::string::npos;
44 for(
size_t pos = vecPos;
pos <
name.size(); ++
pos ) {
45 switch( name[ pos ] ) {
60 if( commaPos != std::string::npos ) {
66 if( commaPos == std::string::npos ) {
72 size_t closingPos = std::string::npos;
73 for(
size_t pos = commaPos;
pos <
name.size(); ++
pos ) {
74 switch( name[ pos ] ) {
88 if( closingPos != std::string::npos ) {
94 if( closingPos == std::string::npos ) {
95 ::Error(
"removeDefaultTemplateParameters",
102 name.erase( commaPos, closingPos - commaPos );
127 static constexpr SG::sgkey_t MASK = (~static_cast<SG::sgkey_t>(0)) >> 2;
130 static const std::hash< std::string > helper;
200 return typeid( Char_t );
202 return typeid( UChar_t );
204 return typeid( Short_t );
206 return typeid( UShort_t );
209 return typeid( Int_t );
212 case kDataTypeAliasUnsigned_t:
213 return typeid( UInt_t );
215 return typeid( Long_t );
217 return typeid( ULong_t );
219 return typeid( Float_t );
221 return typeid( Double_t );
223 return typeid( Double32_t );
225 return typeid( Bool_t );
227 return typeid( Long64_t );
229 return typeid( ULong64_t );
231 return typeid( Float16_t );
233 return typeid(
char* );
235 return typeid( void );
237 ::Error(
"xAOD::Utils::getTypeInfo",
239 static_cast< int >(
type ) );
240 return typeid( void );
245#define TYPE_CHECK_INSTANTIATE(MACRO) \
247 MACRO(std::uint8_t) \
248 MACRO(std::int16_t) \
249 MACRO(std::uint16_t) \
250 MACRO(std::int32_t) \
251 MACRO(std::uint32_t) \
252 MACRO(std::int64_t) \
253 MACRO(std::uint64_t) \
260#define GETTYPEINFO_SPECIALIZE(TYPE) \
261 if(typeName == #TYPE) { \
262 return typeid(TYPE); \
267 ::Error(
"xAOD::Utils::getTypeInfo",
273#undef GETTYPEINFO_SPECIALIZE
275#define ISPRIMITIVETYPE_SPECIALIZE(TYPE) \
276 if(typeName == #TYPE) { \
285#undef ISPRIMITIVETYPE_SPECIALIZE
286#undef TYPE_CHECK_INSTANTIATE
298 switch( typeidType ) {
337 Error(
"xAOD::Utils::rootType",
338 XAOD_MESSAGE(
"Received an unknown type: %c" ), typeidType );
357 std::string
result = AthContainers_detail::typeinfoName( ti );
361 if( (
result.find(
"DataVector<" ) == std::string::npos ) &&
362 (
result.find(
"std::vector<" ) == std::string::npos ) &&
363 (
result.find(
"std::__1::vector<") == std::string::npos ) ) {
368 removeDefaultTemplateParameters(
result,
"DataVector" );
369 removeDefaultTemplateParameters(
result,
"std::vector" );
370 removeDefaultTemplateParameters(
result,
"std::__1::vector" );
374 while( ( pos =
result.find(
">>" ) ) != std::string::npos ) {
375 result.replace( pos, 2,
"> >" );
379 while( ( pos =
result.find(
"__1::" ) ) != std::string::npos ) {
380 result.replace( pos, 5,
"" );
395 const std::string& pre ) {
396 const TObjArray * pBranches =
tree->GetListOfBranches();
397 const std::regex pattern(
".*" + pre +
".*" );
399 for(
int i = 0, nLast = pBranches->GetLast(); i <= nLast; ++i ) {
400 const std::string
name = pBranches->At(i)->GetName();
402 if( std::regex_match(
name, pattern ) )
#define TYPE_CHECK_INSTANTIATE(MACRO)
Macro instantiating another macro for all usual "primitive" types.
#define ISPRIMITIVETYPE_SPECIALIZE(TYPE)
#define GETTYPEINFO_SPECIALIZE(TYPE)
Macro returning the type info for a given type name.
Helper for emitting error messages.
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
const std::type_info & getTypeInfo(EDataType type)
This function is used when reading a primitive branch from an input file without the user explicitly ...
SG::sgkey_t hash(const std::string &name)
This function provides a hashed version of the key (branch) names used in the xAOD file,...
std::string dynBranchPrefix(const std::string &key)
This function is used to figure out what to name dynamic auxiliary branches coming from a container c...
char rootType(char typeidType)
This function is used internally in the code when creating primitive dynamic auxiliary branches.
std::string getFirstBranchMatch(TTree *tree, const std::string &pre)
This function is used to search for a branch in a TTree that contains a given substring.
bool isPrimitiveType(std::string_view typeName)
Check if the type name describes a primitive type.
std::string getTypeName(const std::type_info &ti)
This function is necessary in order to create type names that ROOT can understand.
std::string dynFieldPrefix(const std::string &key)
This function is used to figure out what to name dynamic auxiliary field coming from a container call...
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.