CMS 3D CMS Logo

L1TMuonGlobalParamsViewer.cc
Go to the documentation of this file.
1 #include <iomanip>
2 #include <iostream>
3 
5 
8 
11 
18 
19 #include <iostream>
20 using namespace std;
21 
23 private:
24  // bool printLayerMap;
25  std::string hash(void* buf, size_t len) const;
26  void printLUT(l1t::LUT* lut, const char* name) const;
27 
28 public:
29  void analyze(const edm::Event&, const edm::EventSetup&) override;
30  // string hash(void *buf, size_t len) const ;
31 
32  explicit L1TMuonGlobalParamsViewer(const edm::ParameterSet& pset) : edm::EDAnalyzer() {
33  // printLayerMap = pset.getUntrackedParameter<bool>("printLayerMap", false);
34  }
35  ~L1TMuonGlobalParamsViewer(void) override {}
36 };
37 
39 #include <cmath>
40 #include <iostream>
41 using namespace std;
42 
43 string L1TMuonGlobalParamsViewer::hash(void* buf, size_t len) const {
45  EVP_MD_CTX* mdctx = EVP_MD_CTX_new();
46  const EVP_MD* md = EVP_get_digestbyname("SHA1");
47  if (!EVP_DigestInit_ex(mdctx, md, nullptr))
48  throw cms::Exception("L1TMuonGlobalParamsViewer::hash") << "SHA1 initialization error";
49 
50  if (!EVP_DigestUpdate(mdctx, buf, len))
51  throw cms::Exception("L1TMuonGlobalParamsViewer::hash") << "SHA1 processing error";
52 
53  unsigned char hash[EVP_MAX_MD_SIZE];
54  unsigned int md_len = 0;
55  if (!EVP_DigestFinal_ex(mdctx, hash, &md_len))
56  throw cms::Exception("L1TMuonGlobalParamsViewer::hash") << "SHA1 finalization error";
57 
58  EVP_MD_CTX_free(mdctx);
59 
60  // re-write bytes in hex
61  char tmp[EVP_MAX_MD_SIZE * 2 + 1];
62  if (md_len > 20)
63  md_len = 20;
64  for (unsigned int i = 0; i < md_len; i++)
65  ::sprintf(&tmp[i * 2], "%02x", hash[i]);
66 
67  tmp[md_len * 2] = 0;
68  return string(tmp);
69 }
70 
71 void L1TMuonGlobalParamsViewer::printLUT(l1t::LUT* lut, const char* name) const {
72  if (!lut->empty()) {
73  cout << " " << std::setw(24) << name << "[" << lut->maxSize() << "] " << flush;
74  int pod[lut->maxSize()];
75  for (unsigned int i = 0; i < lut->maxSize(); i++)
76  pod[i] = lut->data(i);
77  cout << hash(pod, sizeof(int) * lut->maxSize()) << endl;
78  } else {
79  cout << " " << std::setw(24) << name << "[0]" << endl;
80  }
81 }
82 
84  // Pull the config from the ES
86  evSetup.get<L1TMuonGlobalParamsRcd>().get(handle1);
87  std::shared_ptr<L1TMuonGlobalParams> ptr1(new L1TMuonGlobalParams(*(handle1.product())));
88 
89  // cout<<"Some fields in L1TMuonGlobalParams: "<<endl;
90 
91  // ((L1TMuonGlobalParamsHelper*)ptr1.get())->print(cout);
92 
93  printLUT(ptr1.get()->absIsoCheckMemLUT(), "absIsoCheckMemLUT");
94  printLUT(ptr1.get()->absIsoCheckMemLUT(), "absIsoCheckMemLUT");
95  printLUT(ptr1.get()->relIsoCheckMemLUT(), "relIsoCheckMemLUT");
96  printLUT(ptr1.get()->idxSelMemPhiLUT(), "idxSelMemPhiLUT");
97  printLUT(ptr1.get()->idxSelMemEtaLUT(), "idxSelMemEtaLUT");
98  //l1t::LUT* brlSingleMatchQualLUT();
99  printLUT(ptr1.get()->fwdPosSingleMatchQualLUT(), "fwdPosSingleMatchQualLUT");
100  printLUT(ptr1.get()->fwdNegSingleMatchQualLUT(), "fwdNegSingleMatchQualLUT");
101  printLUT(ptr1.get()->ovlPosSingleMatchQualLUT(), "ovlPosSingleMatchQualLUT");
102  printLUT(ptr1.get()->ovlNegSingleMatchQualLUT(), "ovlNegSingleMatchQualLUT");
103  printLUT(ptr1.get()->bOPosMatchQualLUT(), "bOPosMatchQualLUT");
104  printLUT(ptr1.get()->bONegMatchQualLUT(), "bONegMatchQualLUT");
105  printLUT(ptr1.get()->fOPosMatchQualLUT(), "fOPosMatchQualLUT");
106  printLUT(ptr1.get()->fONegMatchQualLUT(), "fONegMatchQualLUT");
107  printLUT(ptr1.get()->bPhiExtrapolationLUT(), "bPhiExtrapolationLUT");
108  printLUT(ptr1.get()->oPhiExtrapolationLUT(), "oPhiExtrapolationLUT");
109  printLUT(ptr1.get()->fPhiExtrapolationLUT(), "fPhiExtrapolationLUT");
110  printLUT(ptr1.get()->bEtaExtrapolationLUT(), "bEtaExtrapolationLUT");
111  printLUT(ptr1.get()->oEtaExtrapolationLUT(), "oEtaExtrapolationLUT");
112  printLUT(ptr1.get()->fEtaExtrapolationLUT(), "fEtaExtrapolationLUT");
113  printLUT(ptr1.get()->sortRankLUT(), "sortRankLUT");
114 
115  std::cout << "absIsoCheckMemLUTPath: " << ptr1.get()->absIsoCheckMemLUTPath() << std::endl;
116  std::cout << "relIsoCheckMemLUTPath: " << ptr1.get()->relIsoCheckMemLUTPath() << std::endl;
117  std::cout << "idxSelMemPhiLUTPath: " << ptr1.get()->idxSelMemPhiLUTPath() << std::endl;
118  std::cout << "idxSelMemEtaLUTPath: " << ptr1.get()->idxSelMemEtaLUTPath() << std::endl;
119  //std::string brlSingleMatchQualLUTPath() const { return pnodes_[brlSingleMatchQual].sparams_.size() > spIdx::fname ? pnodes_[brlSingleMatchQual].sparams_[spIdx::fname] : ""; }
120  std::cout << "fwdPosSingleMatchQualLUTPath: " << ptr1.get()->fwdPosSingleMatchQualLUTPath() << std::endl;
121  std::cout << "fwdNegSingleMatchQualLUTPath: " << ptr1.get()->fwdNegSingleMatchQualLUTPath() << std::endl;
122  std::cout << "ovlPosSingleMatchQualLUTPath: " << ptr1.get()->ovlPosSingleMatchQualLUTPath() << std::endl;
123  std::cout << "ovlNegSingleMatchQualLUTPath: " << ptr1.get()->ovlNegSingleMatchQualLUTPath() << std::endl;
124  std::cout << "bOPosMatchQualLUTPath: " << ptr1.get()->bOPosMatchQualLUTPath() << std::endl;
125  std::cout << "bONegMatchQualLUTPath: " << ptr1.get()->bONegMatchQualLUTPath() << std::endl;
126  std::cout << "fOPosMatchQualLUTPath: " << ptr1.get()->fOPosMatchQualLUTPath() << std::endl;
127  std::cout << "fONegMatchQualLUTPath: " << ptr1.get()->fONegMatchQualLUTPath() << std::endl;
128  std::cout << "bPhiExtrapolationLUTPath: " << ptr1.get()->bPhiExtrapolationLUTPath() << std::endl;
129  std::cout << "oPhiExtrapolationLUTPath: " << ptr1.get()->oPhiExtrapolationLUTPath() << std::endl;
130  std::cout << "fPhiExtrapolationLUTPath: " << ptr1.get()->fPhiExtrapolationLUTPath() << std::endl;
131  std::cout << "bEtaExtrapolationLUTPath: " << ptr1.get()->bEtaExtrapolationLUTPath() << std::endl;
132  std::cout << "oEtaExtrapolationLUTPath: " << ptr1.get()->oEtaExtrapolationLUTPath() << std::endl;
133  std::cout << "fEtaExtrapolationLUTPath: " << ptr1.get()->fEtaExtrapolationLUTPath() << std::endl;
134  std::cout << "sortRankLUTPath: " << ptr1.get()->sortRankLUTPath() << std::endl;
135 
136  std::cout << "fwdPosSingleMatchQualLUTMaxDR: " << ptr1.get()->fwdPosSingleMatchQualLUTMaxDR() << std::endl;
137  std::cout << "fwdNegSingleMatchQualLUTMaxDR: " << ptr1.get()->fwdNegSingleMatchQualLUTMaxDR() << std::endl;
138  std::cout << "ovlPosSingleMatchQualLUTMaxDR: " << ptr1.get()->ovlPosSingleMatchQualLUTMaxDR() << std::endl;
139  std::cout << "ovlNegSingleMatchQualLUTMaxDR: " << ptr1.get()->ovlNegSingleMatchQualLUTMaxDR() << std::endl;
140  std::cout << "bOPosMatchQualLUTMaxDR: " << ptr1.get()->bOPosMatchQualLUTMaxDR() << std::endl;
141  std::cout << "bONegMatchQualLUTMaxDR: " << ptr1.get()->bONegMatchQualLUTMaxDR() << std::endl;
142  std::cout << "bOPosMatchQualLUTMaxDREtaFine: " << ptr1.get()->bOPosMatchQualLUTMaxDREtaFine() << std::endl;
143  std::cout << "bONegMatchQualLUTMaxDREtaFine: " << ptr1.get()->bONegMatchQualLUTMaxDREtaFine() << std::endl;
144  std::cout << "fOPosMatchQualLUTMaxDR: " << ptr1.get()->fOPosMatchQualLUTMaxDR() << std::endl;
145  std::cout << "fONegMatchQualLUTMaxDR: " << ptr1.get()->fONegMatchQualLUTMaxDR() << std::endl;
146 
147  // Sort rank LUT factors for pT and quality
148  std::cout << "sortRankLUTPtFactor: " << ptr1.get()->sortRankLUTPtFactor() << std::endl;
149  std::cout << "sortRankLUTQualFactor: " << ptr1.get()->sortRankLUTQualFactor() << std::endl;
150 }
151 
155 
void openssl_init()
Definition: openssl_init.cc:5
unsigned int maxSize() const
Definition: LUT.h:55
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::string hash(void *buf, size_t len) const
bool empty() const
Definition: LUT.h:58
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
#define EVP_MD_CTX_free
Definition: openssl_init.h:7
int iEvent
Definition: GenABIO.cc:224
T const * product() const
Definition: ESHandle.h:86
#define EVP_MD_CTX_new
Definition: openssl_init.h:6
int data(unsigned int address) const
Definition: LUT.h:46
T get() const
Definition: EventSetup.h:82
void analyze(const edm::Event &, const edm::EventSetup &) override
void printLUT(l1t::LUT *lut, const char *name) const
Definition: LUT.h:29
L1TMuonGlobalParamsViewer(const edm::ParameterSet &pset)
HLT enums.
tmp
align.sh
Definition: createJobs.py:716