File indexing completed on 2024-04-06 12:05:15
0001
0002 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
0003 #include "DataFormats/SiStripCommon/interface/SiStripEnumsAndStrings.h"
0004 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0005 #include "FWCore/Framework/interface/Event.h"
0006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0007
0008
0009 #include <iomanip>
0010 #include <iostream>
0011 #include <sstream>
0012 #include <string>
0013 #include <vector>
0014
0015
0016
0017
0018
0019
0020 class testSiStripEnumsAndStrings : public edm::one::EDAnalyzer<> {
0021 public:
0022 testSiStripEnumsAndStrings(const edm::ParameterSet&);
0023 ~testSiStripEnumsAndStrings();
0024
0025 void beginJob();
0026 void analyze(const edm::Event&, const edm::EventSetup&);
0027 };
0028
0029 using namespace sistrip;
0030
0031
0032
0033 testSiStripEnumsAndStrings::testSiStripEnumsAndStrings(const edm::ParameterSet& pset) {
0034 LogTrace(mlDqmCommon_) << "[testSiStripEnumsAndStrings::" << __func__ << "]"
0035 << " Constructing object...";
0036 }
0037
0038
0039
0040 testSiStripEnumsAndStrings::~testSiStripEnumsAndStrings() {
0041 LogTrace(mlDqmCommon_) << "[testSiStripEnumsAndStrings::" << __func__ << "]"
0042 << " Destructing object...";
0043 }
0044
0045
0046
0047 void testSiStripEnumsAndStrings::beginJob() {
0048
0049 {
0050 LogTrace(mlDqmCommon_) << "[SiStripEnumsAndStrings::" << __func__ << "]"
0051 << " Checking sistrip::View...";
0052 bool first = true;
0053 for (uint32_t cntr = 0; cntr <= sistrip::invalid_; cntr++) {
0054 sistrip::View in = static_cast<sistrip::View>(cntr);
0055 std::string str = SiStripEnumsAndStrings::view(in);
0056 sistrip::View out = SiStripEnumsAndStrings::view(str);
0057 if (out != sistrip::UNKNOWN_VIEW || (out == sistrip::UNKNOWN_VIEW && first)) {
0058 first = false;
0059 std::stringstream ss;
0060 ss << "[testSiStripEnumsAndStrings::" << __func__ << "]"
0061 << " cntr: " << std::setw(8) << cntr << " in: " << std::setw(8) << in << " out: " << std::setw(8) << out
0062 << " str: " << str;
0063 LogTrace(mlDqmCommon_) << ss.str();
0064 }
0065 }
0066 }
0067
0068
0069 std::vector<sistrip::RunType> run_types;
0070 {
0071 LogTrace(mlDqmCommon_) << "[SiStripEnumsAndStrings::" << __func__ << "]"
0072 << " Checking sistrip::RunType...";
0073 bool first = true;
0074 for (uint32_t cntr = 0; cntr <= sistrip::invalid_; cntr++) {
0075 sistrip::RunType in = static_cast<sistrip::RunType>(cntr);
0076 std::string str = SiStripEnumsAndStrings::runType(in);
0077 sistrip::RunType out = SiStripEnumsAndStrings::runType(str);
0078 if (out != sistrip::UNKNOWN_RUN_TYPE || (out == sistrip::UNKNOWN_RUN_TYPE && first)) {
0079 first = false;
0080 std::stringstream ss;
0081 ss << "[testSiStripEnumsAndStrings::" << __func__ << "]"
0082 << " cntr: " << std::setw(8) << cntr << " in: " << std::setw(8) << in << " out: " << std::setw(8) << out
0083 << " str: " << str;
0084 LogTrace(mlDqmCommon_) << ss.str();
0085 if (out != sistrip::UNKNOWN_RUN_TYPE) {
0086 run_types.push_back(in);
0087 }
0088 }
0089 }
0090 }
0091
0092
0093 std::vector<sistrip::KeyType> key_types;
0094 {
0095 LogTrace(mlDqmCommon_) << "[SiStripEnumsAndStrings::" << __func__ << "]"
0096 << " Checking sistrip::KeyType...";
0097 bool first = true;
0098 for (uint32_t cntr = 0; cntr <= sistrip::invalid_; cntr++) {
0099 sistrip::KeyType in = static_cast<sistrip::KeyType>(cntr);
0100 std::string str = SiStripEnumsAndStrings::keyType(in);
0101 sistrip::KeyType out = SiStripEnumsAndStrings::keyType(str);
0102 if (out != sistrip::UNKNOWN_KEY || (out == sistrip::UNKNOWN_KEY && first)) {
0103 first = false;
0104 std::stringstream ss;
0105 ss << "[testSiStripEnumsAndStrings::" << __func__ << "]"
0106 << " cntr: " << std::setw(8) << cntr << " in: " << std::setw(8) << in << " out: " << std::setw(8) << out
0107 << " str: " << str;
0108 LogTrace(mlDqmCommon_) << ss.str();
0109 if (out != sistrip::UNKNOWN_KEY) {
0110 key_types.push_back(in);
0111 }
0112 }
0113 }
0114 }
0115
0116
0117 std::vector<sistrip::Granularity> grans;
0118 {
0119 LogTrace(mlDqmCommon_) << "[SiStripEnumsAndStrings::" << __func__ << "]"
0120 << " Checking sistrip::Granularity...";
0121 bool first = true;
0122 for (uint32_t cntr = 0; cntr <= sistrip::invalid_; cntr++) {
0123 sistrip::Granularity in = static_cast<sistrip::Granularity>(cntr);
0124 std::string str = SiStripEnumsAndStrings::granularity(in);
0125 sistrip::Granularity out = SiStripEnumsAndStrings::granularity(str);
0126 if (out != sistrip::UNKNOWN_GRAN || (out == sistrip::UNKNOWN_GRAN && first)) {
0127 first = false;
0128 std::stringstream ss;
0129 ss << "[testSiStripEnumsAndStrings::" << __func__ << "]"
0130 << " cntr: " << std::setw(8) << cntr << " in: " << std::setw(8) << in << " out: " << std::setw(8) << out
0131 << " str: " << str;
0132 LogTrace(mlDqmCommon_) << ss.str();
0133 if (out != sistrip::UNKNOWN_GRAN) {
0134 grans.push_back(in);
0135 }
0136 }
0137 }
0138 }
0139
0140
0141 std::vector<sistrip::ApvReadoutMode> apv_modes;
0142 {
0143 LogTrace(mlDqmCommon_) << "[SiStripEnumsAndStrings::" << __func__ << "]"
0144 << " Checking sistrip::ApvReadoutMode...";
0145 bool first = true;
0146 for (uint32_t cntr = 0; cntr <= sistrip::invalid_; cntr++) {
0147 sistrip::ApvReadoutMode in = static_cast<sistrip::ApvReadoutMode>(cntr);
0148 std::string str = SiStripEnumsAndStrings::apvReadoutMode(in);
0149 sistrip::ApvReadoutMode out = SiStripEnumsAndStrings::apvReadoutMode(str);
0150 if (out != sistrip::UNKNOWN_APV_READOUT_MODE || (out == sistrip::UNKNOWN_APV_READOUT_MODE && first)) {
0151 first = false;
0152 std::stringstream ss;
0153 ss << "[testSiStripEnumsAndStrings::" << __func__ << "]"
0154 << " cntr: " << std::setw(8) << cntr << " in: " << std::setw(8) << in << " out: " << std::setw(8) << out
0155 << " str: " << str;
0156 LogTrace(mlDqmCommon_) << ss.str();
0157 if (out != sistrip::UNKNOWN_APV_READOUT_MODE) {
0158 apv_modes.push_back(in);
0159 }
0160 }
0161 }
0162 }
0163
0164
0165 std::vector<sistrip::FedReadoutMode> fed_modes;
0166 {
0167 LogTrace(mlDqmCommon_) << "[SiStripEnumsAndStrings::" << __func__ << "]"
0168 << " Checking sistrip::FedReadoutMode...";
0169 bool first = true;
0170 for (uint32_t cntr = 0; cntr <= sistrip::invalid_; cntr++) {
0171 sistrip::FedReadoutMode in = static_cast<sistrip::FedReadoutMode>(cntr);
0172 std::string str = SiStripEnumsAndStrings::fedReadoutMode(in);
0173 sistrip::FedReadoutMode out = SiStripEnumsAndStrings::fedReadoutMode(str);
0174 if (out != sistrip::UNKNOWN_FED_READOUT_MODE || (out == sistrip::UNKNOWN_FED_READOUT_MODE && first)) {
0175 first = false;
0176 std::stringstream ss;
0177 ss << "[testSiStripEnumsAndStrings::" << __func__ << "]"
0178 << " cntr: " << std::setw(8) << cntr << " in: " << std::setw(8) << in << " out: " << std::setw(8) << out
0179 << " str: " << str;
0180 LogTrace(mlDqmCommon_) << ss.str();
0181 if (out != sistrip::UNKNOWN_FED_READOUT_MODE) {
0182 fed_modes.push_back(in);
0183 }
0184 }
0185 }
0186 }
0187
0188
0189 {
0190 LogTrace(mlDqmCommon_) << "[SiStripEnumsAndStrings::" << __func__ << "]"
0191 << " Checking sistrip::Monitorable...";
0192 bool first = true;
0193 for (uint32_t cntr = 0; cntr <= sistrip::invalid_; cntr++) {
0194 sistrip::Monitorable in = static_cast<sistrip::Monitorable>(cntr);
0195 std::string str = SiStripEnumsAndStrings::monitorable(in);
0196 sistrip::Monitorable out = SiStripEnumsAndStrings::monitorable(str);
0197 if (out != sistrip::UNKNOWN_MONITORABLE || (out == sistrip::UNKNOWN_MONITORABLE && first)) {
0198 first = false;
0199 std::stringstream ss;
0200 ss << "[testSiStripEnumsAndStrings::" << __func__ << "]"
0201 << " cntr: " << std::setw(8) << cntr << " in: " << std::setw(8) << in << " out: " << std::setw(8) << out
0202 << " str: " << str;
0203 LogTrace(mlDqmCommon_) << ss.str();
0204 }
0205 }
0206 }
0207
0208
0209 {
0210 LogTrace(mlDqmCommon_) << "[SiStripEnumsAndStrings::" << __func__ << "]"
0211 << " Checking sistrip::Presentation...";
0212 bool first = true;
0213 for (uint32_t cntr = 0; cntr <= sistrip::invalid_; cntr++) {
0214 sistrip::Presentation in = static_cast<sistrip::Presentation>(cntr);
0215 std::string str = SiStripEnumsAndStrings::presentation(in);
0216 sistrip::Presentation out = SiStripEnumsAndStrings::presentation(str);
0217 if (out != sistrip::UNKNOWN_PRESENTATION || (out == sistrip::UNKNOWN_PRESENTATION && first)) {
0218 first = false;
0219 std::stringstream ss;
0220 ss << "[testSiStripEnumsAndStrings::" << __func__ << "]"
0221 << " cntr: " << std::setw(8) << cntr << " in: " << std::setw(8) << in << " out: " << std::setw(8) << out
0222 << " str: " << str;
0223 LogTrace(mlDqmCommon_) << ss.str();
0224 }
0225 }
0226 }
0227 }
0228
0229
0230
0231 void testSiStripEnumsAndStrings::analyze(const edm::Event& event, const edm::EventSetup& setup) {
0232 LogTrace(mlDqmCommon_) << "[SiStripEnumsAndStrings::" << __func__ << "]"
0233 << " Analyzing run/event " << event.id().run() << "/" << event.id().event();
0234 }
0235
0236 #include "FWCore/Framework/interface/MakerMacros.h"
0237 DEFINE_FWK_MODULE(testSiStripEnumsAndStrings);