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