ATLAS Offline Software
CMROCompare.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <cmath>
8 #include <iostream>
9 
10 using namespace std;
11 
12 //----------------------------------------------------------------------------//
14  m_hardware = h;
15  m_simulation = s;
16  m_diffOutput = 0;
17  //
18  // m_diffOutput= 0 no differences
19  // 1 1 1 1 1 1 1 1 1 1
20  // ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
21  // | | | | | * * * * * --- number of record in Body that shows the first discrepancy
22  // | | | | --------------- at least one Body record is different
23  // | | | ----------------- number of Body records is different
24  // | | ------------------- Footer record is different
25  // | --------------------- SubHeader record is different
26  // ----------------------- Header record is different
27  //
28  compare();
29 } // end-of-CMROCompare
30 //----------------------------------------------------------------------------//
31 CMROCompare::~CMROCompare() {} // distructor
32 //----------------------------------------------------------------------------//
34  compareHead();
35  compareSubh();
36  compareBody();
37  compareFoot();
38 } // end-of-CMROCompare::compare()
39 //----------------------------------------------------------------------------//
41  ubit16 hardHeader = m_hardware->readHeader();
42  ubit16 simuHeader = m_simulation->readHeader();
43  if (hardHeader != simuHeader) m_diffOutput += 1000000000;
44 } // end-of-compareHead
45 //----------------------------------------------------------------------------//
47  ubit16 hardSubHeader = m_hardware->readSubHeader();
48  ubit16 simuSubHeader = m_simulation->readSubHeader();
49  if (hardSubHeader != simuSubHeader) m_diffOutput += 100000000;
50 } // end-of-compareSubh
51 //----------------------------------------------------------------------------//
53  bool FragmentOK = true;
54  bool firstDiff = true;
55 
56  cout << " ora stampo la matrice hardware" << endl
57  << m_hardware << endl
58  << " ora stampo la matrice simulata" << endl
59  << m_simulation << endl;
60 
61  ubit16 numberOfBodyRecHard = m_hardware->numberOfBodyWords();
62  ubit16 numberOfBodyRecSimu = m_simulation->numberOfBodyWords();
63  if (numberOfBodyRecHard != numberOfBodyRecSimu) {
64  FragmentOK = false;
65  m_diffOutput += 1000000;
66  cout << " CMROCompare: different number of body words " << endl
67  << " hardware: " << numberOfBodyRecHard << " simulation: " << numberOfBodyRecSimu << endl;
68  } else {
71  for (ubit16 i = 0; i < numberOfBodyRecHard; i++) {
74  if (hardRec != simuRec) {
75  FragmentOK = false;
76  cout << " CMROCompare: different body words "
77  << " hardware: " << std::hex << hardRec << std::dec << " simulation: " << std::hex << simuRec << std::dec
78  << std::endl;
79  if (firstDiff) {
80  if (i < 50000)
81  m_diffOutput += 100000 + (i + 1);
82  else
83  m_diffOutput += 150000;
84  firstDiff = false;
85  }
86  } // end-of-if
87  } // end-of-for
88  } // end-of-if(number...
89  if (FragmentOK) {
90  cout << " CMROCompare: Fragment OK " << endl;
91  } else {
92  cout << " CMROCompare: Fragment NOT OK " << endl;
93  } // end-of-if(FragmentOK)
94 } // end-of-CMROCompare::compareBody()
95 //----------------------------------------------------------------------------//
97  ubit16 hardFooter = m_hardware->readFooter();
98  ubit16 simuFooter = m_simulation->readFooter();
99  if (hardFooter != simuFooter) m_diffOutput += 10000000;
100 } // end-of-compareFoot
101 //----------------------------------------------------------------------------//
MatrixReadOut::readFooter
ubit16 readFooter()
Definition: MatrixReadOut.cxx:661
CMROCompare::compareBody
void compareBody()
Definition: CMROCompare.cxx:52
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
CMROCompare::compareFoot
void compareFoot()
Definition: CMROCompare.cxx:96
CMROCompare::m_diffOutput
CMAword m_diffOutput
Definition: CMROCompare.h:26
MatrixReadOut::readSubHeader
ubit16 readSubHeader()
Definition: MatrixReadOut.cxx:659
CMROCompare::compareSubh
void compareSubh()
Definition: CMROCompare.cxx:46
MatrixReadOut::readHeader
ubit16 readHeader()
Definition: MatrixReadOut.cxx:657
CMROCompare::~CMROCompare
~CMROCompare()
Definition: CMROCompare.cxx:31
CMROCompare::m_hardware
MatrixReadOut * m_hardware
Definition: CMROCompare.h:21
MatrixReadOut
Definition: MatrixReadOut.h:18
lumiFormat.i
int i
Definition: lumiFormat.py:85
h
extractSporadic.h
list h
Definition: extractSporadic.py:97
CMROCompare::compare
void compare()
Definition: CMROCompare.cxx:33
MatrixReadOut::topCMABody
void topCMABody()
Definition: MatrixReadOut.cxx:718
MatrixReadOut::readCMABodyCurrent
ubit16 readCMABodyCurrent()
Definition: MatrixReadOut.cxx:663
Hardware
@ Hardware
Definition: BaseObject.h:11
BaseObject
Definition: BaseObject.h:13
MatrixReadOut::numberOfBodyWords
ubit16 numberOfBodyWords()
Definition: MatrixReadOut.h:49
CMROCompare.h
CMROCompare::CMROCompare
CMROCompare(MatrixReadOut *h, MatrixReadOut *s)
Definition: CMROCompare.cxx:13
ubit16
unsigned short int ubit16
Definition: RpcByteStreamEncoder.h:20
CMROCompare::m_simulation
MatrixReadOut * m_simulation
Definition: CMROCompare.h:25
CMROCompare::compareHead
void compareHead()
Definition: CMROCompare.cxx:40