CMS 3D CMS Logo

cscPackerCompare.h File Reference

#include <iostream>
#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>
cscPackAndUnpack (T &t)
template<class T>
bool cscPackerCompare (const T &t1, const T &t2)
 Compares two objects, and prints them out if they differ.


Function Documentation

template<class T>
bool cscClassPackerCompare ( T &  t  )  [inline]

Definition at line 32 of file cscPackerCompare.h.

References bitset_utilities::bitsetToChar(), TestMuL1L2Filter_cff::cerr, data, name, and bitset_utilities::printWords().

Referenced by CSCTMBData::selfTest(), and CSCALCTHeader::selfTest().

00033 {
00034   boost::dynamic_bitset<> firstPack = t.pack();
00035   unsigned char data[1000];
00036   bitset_utilities::bitsetToChar(firstPack, data);
00037   T newObject((unsigned short int *)data);
00038   boost::dynamic_bitset<> secondPack = newObject.pack();
00039   if(firstPack != secondPack)
00040   {
00041     std::cerr << "Mismatch in " << typeid(t).name() << "\n";
00042     bitset_utilities::printWords(firstPack);
00043     bitset_utilities::printWords(secondPack);
00044     return false;
00045   }
00046   return true;
00047 }

template<class T>
T cscPackAndUnpack ( T &  t  )  [inline]

Definition at line 21 of file cscPackerCompare.h.

References bitset_utilities::bitsetToChar(), and data.

Referenced by CSCEventData::selfTest().

00022 {
00023   boost::dynamic_bitset<> firstPack = t.pack();
00024   unsigned char data[10000];
00025   bitset_utilities::bitsetToChar(firstPack, data);
00026   return T((unsigned short int *)data);
00027 }

template<class T>
bool cscPackerCompare ( const T &  t1,
const T &  t2 
) [inline]

Compares two objects, and prints them out if they differ.

Definition at line 9 of file cscPackerCompare.h.

References TestMuL1L2Filter_cff::cerr, lat::endl(), and HLT_VtxMuL3::result.

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

00010 {
00011   bool result = true;
00012   if(t1 != t2) {
00013     std::cerr << "Mismatch:\n"<< t1 << "\n" << t2 << std::endl;
00014     result = false;
00015   }
00016   return result;
00017 }


Generated on Tue Jun 9 17:52:47 2009 for CMSSW by  doxygen 1.5.4