CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
cscPackerCompare.h File Reference
#include <iostream>
#include <typeinfo>
#include "EventFilter/CSCRawToDigi/src/bitset_append.h"

Go to the source code of this file.

Functions

template<class T >
bool cscClassPackerCompare (T &t)
 
template<class T >
T cscPackAndUnpack (T &t)
 
template<class T >
bool cscPackerCompare (const T &t1, const T &t2)
 

Function Documentation

template<class T >
bool cscClassPackerCompare ( T t)

Definition at line 33 of file cscPackerCompare.h.

References bitset_utilities::bitsetToChar(), ecal_dqm_sourceclient-live_cfg::cerr, data, mergeVDriftHistosByStation::name, bitset_utilities::printWords(), and edmStreamStallGrapher::t.

Referenced by CSCTMBData::selfTest().

34 {
35  boost::dynamic_bitset<> firstPack = t.pack();
36  unsigned char data[1000];
37  bitset_utilities::bitsetToChar(firstPack, data);
38  T newObject((unsigned short int *)data);
39  boost::dynamic_bitset<> secondPack = newObject.pack();
40  if(firstPack != secondPack)
41  {
42  std::cerr << "Mismatch in " << typeid(t).name() << "\n";
44  bitset_utilities::printWords(secondPack);
45  return false;
46  }
47  return true;
48 }
void printWords(const boost::dynamic_bitset<> &bs)
void bitsetToChar(const boost::dynamic_bitset<> &bs, unsigned char *result)
this method takes bitset obj and returns char * array
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
long double T
template<class T >
T cscPackAndUnpack ( T t)

Definition at line 22 of file cscPackerCompare.h.

References bitset_utilities::bitsetToChar(), and data.

Referenced by CSCEventData::selfTest().

23 {
24  boost::dynamic_bitset<> firstPack = t.pack();
25  unsigned char data[10000];
26  bitset_utilities::bitsetToChar(firstPack, data);
27  return T((unsigned short int *)data);
28 }
void bitsetToChar(const boost::dynamic_bitset<> &bs, unsigned char *result)
this method takes bitset obj and returns char * array
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
long double T
template<class T >
bool cscPackerCompare ( const T t1,
const T t2 
)

Compares two objects, and prints them out if they differ

Definition at line 10 of file cscPackerCompare.h.

References ecal_dqm_sourceclient-live_cfg::cerr, and query::result.

Referenced by CSCTMBHeader::selfTest(), and CSCEventData::selfTest().

11 {
12  bool result = true;
13  if(t1 != t2) {
14  std::cerr << "Mismatch:\n"<< t1 << "\n" << t2 << std::endl;
15  result = false;
16  }
17  return result;
18 }
tuple result
Definition: query.py:137