Skip to content
Snippets Groups Projects
Commit 6a4b7ee7 authored by Scott Snyder's avatar Scott Snyder Committed by scott snyder
Browse files

TileIdentifier: Add string converters for enums.

Add helpers to convert the enums TileFragHash::TYPE and
TileRawChannelUnit::UNIT to strings.
parent 637f2e27
No related branches found
No related tags found
1 merge request!20779WIP: Migrate DataQualityTools to ToolHandles
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/ */
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
class TileHWID; class TileHWID;
#include <vector> #include <vector>
#include <string>
/** /**
* @class TileFragHash * @class TileFragHash
...@@ -52,8 +53,13 @@ class TileFragHash { ...@@ -52,8 +53,13 @@ class TileFragHash {
/**return hash type */ /**return hash type */
TYPE type() const {return m_type;} TYPE type() const {return m_type;}
private:
/** Printable representation of a type. */
static std::string typeToString (TYPE type);
private:
/** total number of IDs */ /** total number of IDs */
int m_size; // total number of IDs int m_size; // total number of IDs
int m_offset; // different offset for different types of collections int m_offset; // different offset for different types of collections
......
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/ */
#ifndef TILECONDITIONS_TILERAWCHANNELUNIT__H #ifndef TILECONDITIONS_TILERAWCHANNELUNIT_H
#define TILECONDITIONS_TILERAWCHANNELUNIT__H #define TILECONDITIONS_TILERAWCHANNELUNIT_H
#include <string>
class TileRawChannelUnit class TileRawChannelUnit
{ {
...@@ -21,6 +25,10 @@ class TileRawChannelUnit ...@@ -21,6 +25,10 @@ class TileRawChannelUnit
OnlineOffset = 4, OnlineOffset = 4,
Invalid = 99 Invalid = 99
}; };
/** Printable representation of a unit. */
static std::string unitToString (UNIT type);
}; };
#endif #endif
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/ */
...@@ -78,3 +78,26 @@ int TileFragHash::hash (const ID& id) const ...@@ -78,3 +78,26 @@ int TileFragHash::hash (const ID& id) const
return m_lookup[id]; return m_lookup[id];
} }
/**
* @brief Printable representation of a type.
*/
std::string TileFragHash::typeToString (TYPE type)
{
switch (type) {
#define CASE(X) case TileFragHash::X: return #X
CASE(Digitizer);
CASE(OptFilterDsp);
CASE(OptFilterOffline);
CASE(OptFilterDspCompressed);
CASE(ManyAmps);
CASE(MF);
CASE(FitFilter);
CASE(FitFilterCool);
CASE(FlatFilter);
CASE(Beam);
#undef CASE
default: break;
};
return "UNKNOWN";
}
/*
* Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration.
*/
#include "TileIdentifier/TileRawChannelUnit.h"
/**
* @brief Printable representation of a unit.
*/
std::string TileRawChannelUnit::unitToString (UNIT unit)
{
switch (unit) {
#define CASE(X) case TileRawChannelUnit::X: return #X
CASE(ADCcounts);
CASE(PicoCoulombs);
CASE(CesiumPicoCoulombs);
CASE(MegaElectronVolts);
CASE(OnlineADCcounts);
CASE(OnlinePicoCoulombs);
CASE(OnlineCesiumPicoCoulombs);
CASE(OnlineMegaElectronVolts);
#undef CASE
default: break;
};
return "UNKNOWN";
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment