ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1RPChardware
src
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
5
#include "
TrigT1RPChardware/CMROCompare.h
"
6
7
#include <cmath>
8
#include <iostream>
9
10
using namespace
std
;
11
12
//----------------------------------------------------------------------------//
13
CMROCompare::CMROCompare
(
MatrixReadOut
*
h
,
MatrixReadOut
*s) :
BaseObject
(
Hardware
,
"CMROCompare"
) {
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
//----------------------------------------------------------------------------//
33
void
CMROCompare::compare
() {
34
compareHead
();
35
compareSubh
();
36
compareBody
();
37
compareFoot
();
38
}
// end-of-CMROCompare::compare()
39
//----------------------------------------------------------------------------//
40
void
CMROCompare::compareHead
() {
41
ubit16
hardHeader =
m_hardware
->readHeader();
42
ubit16
simuHeader =
m_simulation
->readHeader();
43
if
(hardHeader != simuHeader)
m_diffOutput
+= 1000000000;
44
}
// end-of-compareHead
45
//----------------------------------------------------------------------------//
46
void
CMROCompare::compareSubh
() {
47
ubit16
hardSubHeader =
m_hardware
->readSubHeader();
48
ubit16
simuSubHeader =
m_simulation
->readSubHeader();
49
if
(hardSubHeader != simuSubHeader)
m_diffOutput
+= 100000000;
50
}
// end-of-compareSubh
51
//----------------------------------------------------------------------------//
52
void
CMROCompare::compareBody
() {
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
{
69
m_hardware
->topCMABody();
70
m_simulation
->topCMABody();
71
for
(
ubit16
i = 0; i < numberOfBodyRecHard; i++) {
72
ubit16
hardRec =
m_hardware
->readCMABodyCurrent();
73
ubit16
simuRec =
m_simulation
->readCMABodyCurrent();
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
//----------------------------------------------------------------------------//
96
void
CMROCompare::compareFoot
() {
97
ubit16
hardFooter =
m_hardware
->readFooter();
98
ubit16
simuFooter =
m_simulation
->readFooter();
99
if
(hardFooter != simuFooter)
m_diffOutput
+= 10000000;
100
}
// end-of-compareFoot
101
//----------------------------------------------------------------------------//
Hardware
@ Hardware
Definition
BaseObject.h:11
CMROCompare.h
ubit16
unsigned short int ubit16
Definition
RpcByteStreamEncoder.h:20
BaseObject::BaseObject
BaseObject(ObjectType, const std::string &)
Definition
BaseObject.cxx:7
CMROCompare::compareBody
void compareBody()
Definition
CMROCompare.cxx:52
CMROCompare::compareHead
void compareHead()
Definition
CMROCompare.cxx:40
CMROCompare::compareSubh
void compareSubh()
Definition
CMROCompare.cxx:46
CMROCompare::CMROCompare
CMROCompare(MatrixReadOut *h, MatrixReadOut *s)
Definition
CMROCompare.cxx:13
CMROCompare::compareFoot
void compareFoot()
Definition
CMROCompare.cxx:96
CMROCompare::m_simulation
MatrixReadOut * m_simulation
Definition
CMROCompare.h:25
CMROCompare::m_diffOutput
CMAword m_diffOutput
Definition
CMROCompare.h:26
CMROCompare::~CMROCompare
~CMROCompare()
Definition
CMROCompare.cxx:31
CMROCompare::m_hardware
MatrixReadOut * m_hardware
Definition
CMROCompare.h:24
CMROCompare::compare
void compare()
Definition
CMROCompare.cxx:33
MatrixReadOut
Definition
MatrixReadOut.h:18
h
std
STL namespace.
Generated on
for ATLAS Offline Software by
1.17.0