CMS 3D CMS Logo

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

◆ cscClassPackerCompare()

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, Skims_PA_cff::name, bitset_utilities::printWords(), and submitPVValidationJobs::t.

Referenced by CSCTMBData::selfTest().

31  {
32  boost::dynamic_bitset<> firstPack = t.pack();
33  unsigned char data[1000];
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

◆ cscPackAndUnpack()

template<class T >
T cscPackAndUnpack ( T t)

Definition at line 22 of file cscPackerCompare.h.

References bitset_utilities::bitsetToChar(), data, and submitPVValidationJobs::t.

Referenced by CSCEventData::selfTest().

22  {
23  boost::dynamic_bitset<> firstPack = t.pack();
24  unsigned char data[10000];
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

◆ cscPackerCompare()

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, mps_fire::result, RandomServiceHelper::t1, and RandomServiceHelper::t2.

Referenced by CSCEventData::selfTest(), and CSCTMBHeader::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 }