CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
cscPackerCompare.h File Reference
#include <iostream>
#include <typeinfo>
#include "EventFilter/CSCRawToDigi/interface/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 31 of file cscPackerCompare.h.

References bitset_utilities::bitsetToChar(), EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, data, mergeVDriftHistosByStation::name, bitset_utilities::printWords(), and submitPVValidationJobs::t.

Referenced by CSCTMBData::selfTest().

31  {
32  boost::dynamic_bitset<> firstPack = t.pack();
33  unsigned char data[1000];
34  bitset_utilities::bitsetToChar(firstPack, data);
35  T newObject((unsigned short int *)data);
36  boost::dynamic_bitset<> secondPack = newObject.pack();
37  if (firstPack != secondPack) {
38  std::cerr << "Mismatch in " << typeid(t).name() << "\n";
40  bitset_utilities::printWords(secondPack);
41  return false;
42  }
43  return true;
44 }
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:79
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().

22  {
23  boost::dynamic_bitset<> firstPack = t.pack();
24  unsigned char data[10000];
25  bitset_utilities::bitsetToChar(firstPack, data);
26  return T((unsigned short int *)data);
27 }
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:79
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 12 of file cscPackerCompare.h.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, and mps_fire::result.

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

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