CMS 3D CMS Logo

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

◆ cscClassPackerCompare()

template<class T >
bool cscClassPackerCompare ( T t)

Definition at line 28 of file cscPackerCompare.h.

28  {
29  boost::dynamic_bitset<> firstPack = t.pack();
30  unsigned char data[1000];
32  T newObject((unsigned short int *)data);
33  boost::dynamic_bitset<> secondPack = newObject.pack();
34  if (firstPack != secondPack) {
35  std::cerr << "Mismatch in " << typeid(t).name() << "\n";
37  bitset_utilities::printWords(secondPack);
38  return false;
39  }
40  return true;
41 }

References bitset_utilities::bitsetToChar(), beam_dqm_sourceclient-live_cfg::cerr, data, Skims_PA_cff::name, bitset_utilities::printWords(), and OrderedSet::t.

Referenced by CSCTMBData::selfTest().

◆ cscPackAndUnpack()

template<class T >
T cscPackAndUnpack ( T t)

Definition at line 19 of file cscPackerCompare.h.

19  {
20  boost::dynamic_bitset<> firstPack = t.pack();
21  unsigned char data[10000];
23  return T((unsigned short int *)data);
24 }

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

Referenced by CSCEventData::selfTest().

◆ 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 9 of file cscPackerCompare.h.

9  {
10  bool result = true;
11  if (t1 != t2) {
12  std::cerr << "Mismatch:\n" << t1 << "\n" << t2 << std::endl;
13  result = false;
14  }
15  return result;
16 }

References beam_dqm_sourceclient-live_cfg::cerr, mps_fire::result, RandomServiceHelper::t1, and RandomServiceHelper::t2.

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

RandomServiceHelper.t2
t2
Definition: RandomServiceHelper.py:257
bitset_utilities::bitsetToChar
void bitsetToChar(const boost::dynamic_bitset<> &bs, unsigned char *result)
this method takes bitset obj and returns char * array
Definition: bitset_append.cc:32
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
OrderedSet.t
t
Definition: OrderedSet.py:90
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
T
long double T
Definition: Basic3DVectorLD.h:48
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
mps_fire.result
result
Definition: mps_fire.py:303
bitset_utilities::printWords
void printWords(const boost::dynamic_bitset<> &bs)
Definition: bitset_append.cc:40