CMS 3D CMS Logo

Functions

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/EventFilter/CSCRawToDigi/src/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(), benchmark_cfg::cerr, runTheMatrix::data, mergeVDriftHistosByStation::name, bitset_utilities::printWords(), and matplotRender::t.

Referenced by CSCTMBData::selfTest().

{
  boost::dynamic_bitset<> firstPack = t.pack();
  unsigned char data[1000];
  bitset_utilities::bitsetToChar(firstPack, data);
  T newObject((unsigned short int *)data);
  boost::dynamic_bitset<> secondPack = newObject.pack();
  if(firstPack != secondPack)
  {
    std::cerr << "Mismatch in " << typeid(t).name() << "\n";
    bitset_utilities::printWords(firstPack);
    bitset_utilities::printWords(secondPack);
    return false;
  }
  return true;
}
template<class T >
T cscPackAndUnpack ( T t)

Definition at line 22 of file cscPackerCompare.h.

References bitset_utilities::bitsetToChar(), and runTheMatrix::data.

Referenced by CSCEventData::selfTest().

{
  boost::dynamic_bitset<> firstPack = t.pack();
  unsigned char data[10000];
  bitset_utilities::bitsetToChar(firstPack, data);
  return T((unsigned short int *)data);
}
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 benchmark_cfg::cerr, and query::result.

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

{
  bool result = true;
  if(t1 != t2) {
    std::cerr << "Mismatch:\n"<< t1 << "\n" << t2 << std::endl;
    result = false;
  }
  return result;
}