File indexing completed on 2024-04-06 12:02:13
0001 #ifndef HcalL1TriggerObjects_h
0002 #define HcalL1TriggerObjects_h
0003
0004 #include "CondFormats/Serialization/interface/Serializable.h"
0005
0006 #include <cstring>
0007 #include <string>
0008
0009 #include "CondFormats/HcalObjects/interface/HcalL1TriggerObject.h"
0010 #include "CondFormats/HcalObjects/interface/HcalCondObjectContainer.h"
0011
0012 #include "FWCore/Utilities/interface/Exception.h"
0013
0014 class HcalL1TriggerObjects : public HcalCondObjectContainer<HcalL1TriggerObject> {
0015 public:
0016 #ifndef HCAL_COND_SUPPRESS_DEFAULT
0017 HcalL1TriggerObjects() : HcalCondObjectContainer<HcalL1TriggerObject>(nullptr) {}
0018 #endif
0019 HcalL1TriggerObjects(const HcalTopology* topo) : HcalCondObjectContainer<HcalL1TriggerObject>(topo) {}
0020
0021
0022 void setTagString(std::string const& fTag) {
0023 std::size_t maxCharacters = charArraySize - 1;
0024 if (fTag.size() > maxCharacters) {
0025 throw cms::Exception("HcalL1TriggerObjects::setTagString: string exceeds array size");
0026 }
0027 strncpy(mTag, fTag.c_str(), maxCharacters);
0028 mTag[maxCharacters] = '\0';
0029 }
0030
0031 void setAlgoString(std::string const& fAlgo) {
0032 std::size_t maxCharacters = charArraySize - 1;
0033 if (fAlgo.size() > maxCharacters) {
0034 throw cms::Exception("HcalL1TriggerObjects::setAlgoString: string exceeds array size");
0035 }
0036 strncpy(mAlgo, fAlgo.c_str(), maxCharacters);
0037 mAlgo[maxCharacters] = '\0';
0038 }
0039
0040 std::string getTagString() const { return mTag; }
0041 std::string getAlgoString() const { return mAlgo; }
0042 std::string myname() const override { return "HcalL1TriggerObjects"; }
0043
0044 private:
0045 static constexpr std::size_t charArraySize = 128;
0046 char mTag[charArraySize];
0047 char mAlgo[charArraySize];
0048
0049 COND_SERIALIZABLE;
0050 };
0051 #endif