30 #include <openssl/sha.h>
36 char tmp[SHA_DIGEST_LENGTH*2+1];
37 bzero(tmp,
sizeof(tmp));
39 if( !SHA1_Init( &ctx ) )
40 throw cms::Exception(
"L1TGlobalPrescalesVetosViewer::hash")<<
"SHA1 initialization error";
42 if( !SHA1_Update( &ctx, buf, len ) )
43 throw cms::Exception(
"L1TGlobalPrescalesVetosViewer::hash")<<
"SHA1 processing error";
45 unsigned char hash[SHA_DIGEST_LENGTH];
46 if( !SHA1_Final(hash, &ctx) )
47 throw cms::Exception(
"L1TGlobalPrescalesVetosViewer::hash")<<
"SHA1 finalization error";
50 for(
unsigned int i=0;
i<20;
i++)
51 ::sprintf(&tmp[
i*2],
"%02x", hash[i]);
66 cout<<
" version_ = "<<ptr->version_<<endl;
67 cout<<
" bxmask_default_ = "<<ptr->bxmask_default_<<endl;
69 size_t len_prescale_table_ = 0;
70 for(
size_t col=0;
col<ptr->prescale_table_.size();
col++){
71 size_t nRows = (ptr->prescale_table_)[
col ].
size();
72 len_prescale_table_ += nRows;
73 if( prescale_table_verbosity > 0 ){
75 for(
size_t row=0; row<nRows; row++)
76 column[ row ] = (ptr->prescale_table_)[
col ][ row ];
77 cout <<
" prescale_table_[" <<
col<<
"][" << nRows <<
"] = ";
79 cout <<
hash( column,
sizeof(
int)*nRows ) << endl;
80 else cout << 0 << endl;
83 int prescale_table_[len_prescale_table_];
84 for(
size_t col=0, pos=0;
col<ptr->prescale_table_.size();
col++){
85 size_t nRows = (ptr->prescale_table_)[
col ].
size();
86 for(
size_t row=0; row<nRows; row++,pos++)
87 prescale_table_[ pos ] = (ptr->prescale_table_)[
col ][ row ];
89 cout <<
" prescale_table_[["<<len_prescale_table_<<
"]] = ";
90 if( len_prescale_table_ )
91 cout <<
hash( prescale_table_,
sizeof(
int)*len_prescale_table_ ) << endl;
92 else cout << 0 << endl;
94 size_t len_bxmask_map_ = 0;
95 for(std::map<
int, std::vector<int> >::const_iterator it = (ptr->bxmask_map_).begin(); it != (ptr->bxmask_map_).
end(); it++){
96 len_bxmask_map_ += it->second.size();
97 if( bxmask_map_verbosity > 0 ){
98 int masks[ it->second.size() ];
99 for(
size_t i=0;
i<it->second.size();
i++)
100 masks[
i ] = it->second[
i];
101 cout <<
" bxmask_map_[" << it->first <<
"][" << it->second.size() <<
"] = ";
102 if( it->second.size() )
103 cout <<
hash( masks,
sizeof(
int)*it->second.size() ) << endl;
104 else cout << 0 << endl;
107 int bxmask_map_[ len_bxmask_map_ ];
109 for(std::map<
int, std::vector<int> >::const_iterator it = (ptr->bxmask_map_).begin(); it != (ptr->bxmask_map_).
end(); it++){
110 for(
size_t i=0;
i<it->second.size();
i++,pos++) bxmask_map_[ pos ] = it->second[
i];
112 cout <<
" bxmask_map_[["<< len_bxmask_map_ <<
"]] = ";
113 if( len_bxmask_map_ )
114 cout <<
hash( bxmask_map_,
sizeof(
int)*len_bxmask_map_ ) << endl;
115 else cout << 0 << endl;
117 int veto_[ (ptr->veto_).
size() ];
118 for(
size_t i=0;
i<(ptr->veto_).
size();
i++) veto_[
i] = (ptr->veto_)[
i];
119 cout <<
" veto_[" << (ptr->veto_).
size() <<
"] = ";
120 if( (ptr->veto_).size() )
121 cout <<
hash( veto_,
sizeof(
int)*(ptr->veto_).
size() ) << endl;
122 else cout << 0 << endl;
124 int exp_ints_[ (ptr->exp_ints_).
size() ];
125 for(
size_t i=0;
i<(ptr->exp_ints_).
size();
i++) exp_ints_[
i] = (ptr->exp_ints_)[
i];
126 cout <<
" exp_ints_[" << (ptr->exp_ints_).
size() <<
"] = ";
127 if( (ptr->exp_ints_).size() )
128 cout <<
hash( exp_ints_,
sizeof(
int)*(ptr->exp_ints_).
size() ) << endl;
129 else cout << 0 << endl;
131 int exp_doubles_[ (ptr->exp_doubles_).
size() ];
132 for(
size_t i=0;
i<(ptr->exp_doubles_).
size();
i++) exp_ints_[
i] = (ptr->exp_doubles_)[
i];
133 cout <<
" exp_doubles_[" << (ptr->exp_doubles_).
size() <<
"] = ";
134 if( (ptr->exp_doubles_).size() )
135 cout <<
hash( exp_doubles_,
sizeof(
int)*(ptr->exp_doubles_).
size() ) << endl;
136 else cout << 0 << endl;
tuple L1TGlobalPrescalesVetos
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_FWK_MODULE(type)
L1TGlobalPrescalesVetosViewer(const edm::ParameterSet &pset)
int32_t prescale_table_verbosity
virtual void analyze(const edm::Event &, const edm::EventSetup &)
int32_t bxmask_map_verbosity
virtual ~L1TGlobalPrescalesVetosViewer(void)
T const * product() const
std::vector< std::vector< double > > tmp
constexpr uint32_t masks[]
std::string hash(void *buf, size_t len) const
tuple size
Write out results.