Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
#include "DataFormats/METReco/interface/HcalCaloFlagTool.h"
#include <cstring>
#include <cstdio>

HcalCaloFlagTool::HcalCaloFlagTool(const std::string& releaseName)
    : releaseName_(releaseName), standardFormat_(false), major_(0), minor_(0), patch_(0), subpatch_(0) {
  int fields = sscanf(releaseName.c_str(), "CMSSW_%d_%d_%d_%d", &major_, &minor_, &patch_, &subpatch_);
  if (fields >= 3)
    standardFormat_ = true;
}

std::string HcalCaloFlagTool::getFieldName(HcalSubdetector sd, int bit) const { return ""; }

int HcalCaloFlagTool::getFieldWidth(HcalSubdetector sd, int bit) const { return 0; }

int HcalCaloFlagTool::getFieldStart(HcalSubdetector sd, const std::string& field) const { return 0; }

int HcalCaloFlagTool::getFieldWidth(HcalSubdetector sd, const std::string& field) const { return 0; }

bool HcalCaloFlagTool::hasField(HcalSubdetector sd, const std::string& field) const {
  if (standardFormat_) {
    if (major_ < 3)
      return false;
  }
  return getFieldWidth(sd, field) > 0;
}

bool HcalCaloFlagTool::hasField(HcalSubdetector sd, int bit) const {
  if (standardFormat_) {
    if (major_ < 3)
      return false;
  }
  return getFieldWidth(sd, bit) > 0;
}