CMS 3D CMS Logo

L1TMuonBarrelKalmanParamsViewer.cc
Go to the documentation of this file.
1 #include <iomanip>
2 #include <iostream>
3 
5 
8 
11 
17 
18 #include <iostream>
19 using namespace std;
20 
22 private:
24  std::string hash(void *buf, size_t len) const;
25 
26 public:
27  void analyze(const edm::Event &, const edm::EventSetup &) override;
28 
30 };
31 
33 #include <cmath>
34 #include <iostream>
35 using namespace std;
36 
39  EVP_MD_CTX *mdctx = EVP_MD_CTX_new();
40  const EVP_MD *md = EVP_get_digestbyname("SHA1");
41  if (!EVP_DigestInit_ex(mdctx, md, nullptr))
42  throw cms::Exception("L1TMuonBarrelKalmanParamsViewer::hash") << "SHA1 initialization error";
43 
44  if (!EVP_DigestUpdate(mdctx, buf, len))
45  throw cms::Exception("L1TMuonBarrelKalmanParamsViewer::hash") << "SHA1 processing error";
46 
47  unsigned char hash[EVP_MAX_MD_SIZE];
48  unsigned int md_len = 0;
49  if (!EVP_DigestFinal_ex(mdctx, hash, &md_len))
50  throw cms::Exception("L1TMuonBarrelKalmanParamsViewer::hash") << "SHA1 finalization error";
51 
52  EVP_MD_CTX_free(mdctx);
53 
54  // re-write bytes in hex
55  char tmp[EVP_MAX_MD_SIZE * 2 + 1];
56  if (md_len > 20)
57  md_len = 20;
58  for (unsigned int i = 0; i < md_len; i++)
59  ::sprintf(&tmp[i * 2], "%02x", hash[i]);
60 
61  tmp[md_len * 2] = 0;
62  return std::string(tmp);
63 }
64 
66  L1TMuonBarrelKalmanParams const &ptr = evSetup.getData(token_);
67 
68  // Get the nodes and print out
69  auto pnodes = ptr.pnodes_[ptr.CONFIG];
70  cout << "version : " << ptr.version_ << endl;
71  cout << "fwVersion : " << hex << pnodes.fwVersion_ << dec << endl;
72  cout << "LUTsPath : " << pnodes.kalmanLUTsPath_ << endl;
73 
74  // typedef std::map<short, short, std::less<short> > LUT;
75 }
76 
80 
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
void openssl_init()
Definition: openssl_init.cc:5
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
edm::ESGetToken< L1TMuonBarrelKalmanParams, L1TMuonBarrelKalmanParamsRcd > token_
std::string hash(void *buf, size_t len) const
#define EVP_MD_CTX_new
Definition: openssl_init.h:6
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool getData(T &iHolder) const
Definition: EventSetup.h:122
void analyze(const edm::Event &, const edm::EventSetup &) override
L1TMuonBarrelKalmanParamsViewer(const edm::ParameterSet &)
tmp
align.sh
Definition: createJobs.py:716