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.

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 }

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().

◆ cscPackAndUnpack()

template<class T >
T cscPackAndUnpack ( T t)

Definition at line 22 of file cscPackerCompare.h.

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

References bitset_utilities::bitsetToChar(), data, and submitPVValidationJobs::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 12 of file cscPackerCompare.h.

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 }

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::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
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:311
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
bitset_utilities::printWords
void printWords(const boost::dynamic_bitset<> &bs)
Definition: bitset_append.cc:40