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
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "Geometry/CommonTopologies/interface/GeomDetEnumerators.h"

#include <iostream>

int main(void) {
  // Test that each SubDetector is either barrel or endcap

  bool success = true;
  for (int subdetRaw = GeomDetEnumerators::PixelBarrel; subdetRaw != GeomDetEnumerators::invalidDet; ++subdetRaw) {
    auto subdet = static_cast<GeomDetEnumerators::SubDetector>(subdetRaw);
    if (!(GeomDetEnumerators::isBarrel(subdet) || GeomDetEnumerators::isEndcap(subdet))) {
      success = false;
      edm::LogVerbatim("CommonTopologies")
          << "GeomDetEnumerator::SubDetector " << subdet << " (" << subdetRaw << ") is not barrel or endcap!";
    }
    if (GeomDetEnumerators::isBarrel(subdet) && GeomDetEnumerators::isEndcap(subdet)) {
      success = false;
      edm::LogVerbatim("CommonTopologies")
          << "GeomDetEnumerator::SubDetector " << subdet << " (" << subdetRaw << ") is both barrel and endcap!";
    }
  }

  return success ? 0 : 1;
}