File indexing completed on 2024-04-06 11:58:23
0001 #include <memory>
0002
0003 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0004 #include "FWCore/Framework/interface/ESHandle.h"
0005 #include "FWCore/Framework/interface/EventSetup.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008
0009 #include "CalibMuon/CSCCalibration/interface/CSCIndexerBase.h"
0010 #include "CalibMuon/CSCCalibration/interface/CSCIndexerRecord.h"
0011 #include <iostream>
0012
0013 class CSCIndexerAnalyzer : public edm::one::EDAnalyzer<> {
0014 public:
0015 explicit CSCIndexerAnalyzer(const edm::ParameterSet &);
0016 ~CSCIndexerAnalyzer() override = default;
0017
0018 private:
0019 virtual void analyze(const edm::Event &, const edm::EventSetup &) override;
0020 const edm::ESGetToken<CSCIndexerBase, CSCIndexerRecord> theCSCIndexerToken_;
0021
0022 std::string algoName;
0023 };
0024
0025 CSCIndexerAnalyzer::CSCIndexerAnalyzer(const edm::ParameterSet &pset) : theCSCIndexerToken_(esConsumes()) {}
0026
0027 void CSCIndexerAnalyzer::analyze(const edm::Event &ev, const edm::EventSetup &iSetup) {
0028 const int evalues[10] = {1, 2, 1, 2, 1, 2, 1, 2, 1, 2};
0029 const int svalues[10] = {1, 1, 1, 1, 4, 4, 4, 4, 4, 4};
0030 const int rvalues[10] = {1, 1, 4, 4, 2, 2, 2, 2, 2, 2};
0031 const int cvalues[10] = {1, 1, 1, 1, 1, 1, 36, 36, 1, 1};
0032 const int lvalues[10] = {1, 1, 1, 1, 1, 1, 1, 1, 6, 6};
0033 const int tvalues[10] = {1, 1, 1, 1, 1, 1, 1, 1, 80, 80};
0034
0035 const auto indexer_ = &iSetup.getData(theCSCIndexerToken_);
0036 algoName = indexer_->name();
0037
0038 std::cout << "CSCIndexerAnalyzer: analyze sees algorithm " << algoName << " in Event Setup" << std::endl;
0039
0040 for (int i = 0; i < 10; ++i) {
0041 int ie = evalues[i];
0042 int is = svalues[i];
0043 int ir = rvalues[i];
0044 int ic = cvalues[i];
0045 int il = lvalues[i];
0046 int istrip = tvalues[i];
0047
0048 std::cout << "CSCIndexerAnalyzer: calling " << algoName << "::stripChannelIndex(" << ie << "," << is << "," << ir
0049 << "," << ic << "," << il << "," << istrip
0050 << ") = " << indexer_->stripChannelIndex(ie, is, ir, ic, il, istrip) << std::endl;
0051 }
0052 }
0053
0054
0055 DEFINE_FWK_MODULE(CSCIndexerAnalyzer);