CMS 3D CMS Logo

Functions

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/DataFormats/L1GlobalTrigger/src/L1GtObject.cc File Reference

#include "DataFormats/L1GlobalTrigger/interface/L1GtObject.h"
#include <cstring>
#include "FWCore/MessageLogger/interface/MessageLogger.h"

Go to the source code of this file.

Functions

std::string l1GtObjectEnumToString (const L1GtObject &gtObject)
L1GtObject l1GtObjectStringToEnum (const std::string &label)

Function Documentation

std::string l1GtObjectEnumToString ( const L1GtObject gtObject)

Definition at line 76 of file L1GtObject.cc.

References BPTX, CenJet, ETM, ETT, ForJet, GtExternal, HfBitCounts, HfRingEtSums, HTM, HTT, IsoEG, JetCounts, Mu, NoIsoEG, ObjNull, TauJet, and TechTrig.

Referenced by L1GtEtaPhiConversions::convertEtaIndex(), L1GtCorrelationCondition::evaluateCondition(), L1GtHwValidation::excludedAlgoList(), L1GtEtaPhiConversions::gtObjectNrBinsPhi(), L1GtEtaPhiConversions::gtObjectPairIndex(), and L1GtEtaPhiConversions::L1GtEtaPhiConversions().

                                                             {

    std::string gtObjectString;

    switch (gtObject) {

        case Mu: {
            gtObjectString = "Mu";
        }
            break;

        case NoIsoEG: {
            gtObjectString = "NoIsoEG";
        }
            break;

        case IsoEG: {
            gtObjectString = "IsoEG";
        }
            break;

        case CenJet: {
            gtObjectString = "CenJet";
        }
            break;

        case ForJet: {
            gtObjectString = "ForJet";
        }
            break;

        case TauJet: {
            gtObjectString = "TauJet";
        }
            break;

        case ETM: {
            gtObjectString = "ETM";
        }
            break;

        case ETT: {
            gtObjectString = "ETT";
        }
            break;

        case HTT: {
            gtObjectString = "HTT";
        }
            break;

        case HTM: {
            gtObjectString = "HTM";
        }
            break;

        case JetCounts: {
            gtObjectString = "JetCounts";
        }
            break;

        case HfBitCounts: {
            gtObjectString = "HfBitCounts";
        }
            break;

        case HfRingEtSums: {
            gtObjectString = "HfRingEtSums";
        }
            break;

        case TechTrig: {
            gtObjectString = "TechTrig";
        }
            break;

        case Castor: {
            gtObjectString = "Castor";
        }
            break;

        case BPTX: {
            gtObjectString = "BPTX";
        }
            break;

        case GtExternal: {
            gtObjectString = "GtExternal";
        }
            break;

        case ObjNull: {
            gtObjectString = "ObjNull";
            edm::LogInfo("L1GtObject")
                    << "\n  ObjNull means no valid L1GtObject defined!";
        }
            break;

        default: {
            edm::LogInfo("L1GtObject") << "\n  '" << gtObject
                    << "' is not a recognized L1GtObject. "
                    << "\n  Return ObjNull, which means no valid L1GtObject defined!";

            gtObjectString = "ObjNull";

        }
            break;
    }

    return gtObjectString;

}
L1GtObject l1GtObjectStringToEnum ( const std::string &  label)

Definition at line 26 of file L1GtObject.cc.

References BPTX, CenJet, ETM, ETT, ForJet, newFWLiteAna::found, GtExternal, HfBitCounts, HfRingEtSums, HTM, HTT, i, IsoEG, JetCounts, L1GtObjectStringToEnum::label, Mu, NoIsoEG, ObjNull, TauJet, TechTrig, L1GtObjectStringToEnum::value, and relativeConstraints::value.

Referenced by L1GtHwValidation::L1GtHwValidation().

                                                          {

    static L1GtObjectStringToEnum l1GtObjectStringToEnumMap[] = {
            {"Mu", Mu},
            {"NoIsoEG", NoIsoEG},
            {"IsoEG", IsoEG},
            {"CenJet", CenJet},
            {"ForJet", ForJet},
            {"TauJet", TauJet},
            {"ETM", ETM},
            {"ETT", ETT},
            {"HTT", HTT},
            {"HTM", HTM},
            {"JetCounts", JetCounts},
            {"HfBitCounts", HfBitCounts},
            {"HfRingEtSums", HfRingEtSums},
            {"TechTrig", TechTrig},
            {"Castor", Castor},
            {"BPTX", BPTX},
            {"GtExternal", GtExternal},
            {"ObjNull", ObjNull},
            {0, (L1GtObject) - 1}
    };

    L1GtObject value = (L1GtObject) - 1;

    bool found = false;
    for (int i = 0; l1GtObjectStringToEnumMap[i].label && (!found); ++i)
        if (!std::strcmp(label.c_str(), l1GtObjectStringToEnumMap[i].label)) {
            found = true;
            value = l1GtObjectStringToEnumMap[i].value;
        }

    // in case of unrecognized L1GtObject, returns Mu
    // and write a warning (to not throw an exception)
    if (!found) {
        edm::LogInfo("L1GtObject") << "\n  '" << label
                << "' is not a recognized L1GtObject. \n  Return ObjNull.";

        value = ObjNull;
    }

    if (value == ObjNull) {
        edm::LogInfo("L1GtObject")
                << "\n  ObjNull means no valid L1GtObject defined!";
    }

    return value;
}