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:
23  std::string hash(void *buf, size_t len) const;
24 
25 public:
26  void analyze(const edm::Event &, const edm::EventSetup &) override;
27 
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 
67  evSetup.get<L1TMuonBarrelKalmanParamsRcd>().get(handle1);
68  std::shared_ptr<L1TMuonBarrelKalmanParams> ptr(new L1TMuonBarrelKalmanParams(*(handle1.product())));
69 
70  // Get the nodes and print out
71  auto pnodes = ptr->pnodes_[ptr->CONFIG];
72  cout << "version : " << ptr->version_ << endl;
73  cout << "fwVersion : " << hex << pnodes.fwVersion_ << dec << endl;
74  cout << "LUTsPath : " << pnodes.kalmanLUTsPath_ << endl;
75 
76  // typedef std::map<short, short, std::less<short> > LUT;
77 }
78 
82 
void openssl_init()
Definition: openssl_init.cc:5
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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
std::string hash(void *buf, size_t len) const
#define EVP_MD_CTX_new
Definition: openssl_init.h:6
T get() const
Definition: EventSetup.h:82
void analyze(const edm::Event &, const edm::EventSetup &) override
L1TMuonBarrelKalmanParamsViewer(const edm::ParameterSet &)
tmp
align.sh
Definition: createJobs.py:716