1 | #include "HeadersFTM.h"
|
---|
2 |
|
---|
3 | #include <string.h>
|
---|
4 |
|
---|
5 | #include <iomanip>
|
---|
6 |
|
---|
7 | #include "Converter.h"
|
---|
8 |
|
---|
9 | using namespace std;
|
---|
10 |
|
---|
11 | void FTM::Header::print(std::ostream &out) const
|
---|
12 | {
|
---|
13 | out << "State=" << std::dec << (fState&kFtmStates);
|
---|
14 | out << " Type=" << fType;
|
---|
15 | out << " (len=" << fDataSize << ")";
|
---|
16 | out << " Id=0x" << std::hex << fBoardId;
|
---|
17 | out << " FW=" << fFirmwareId;
|
---|
18 | out << " TriggerCounter=" << std::dec << fTriggerCounter;
|
---|
19 | out << " TimeStamp=" << fTimeStamp;
|
---|
20 | if (fState&kFtmLocked)
|
---|
21 | out << " [locked]";
|
---|
22 | out << std::endl;
|
---|
23 | }
|
---|
24 |
|
---|
25 | void FTM::FtuResponse::print(std::ostream &out) const
|
---|
26 | {
|
---|
27 | out << std::hex << "Pings=" << ((fPingAddr>>8)&0x3);
|
---|
28 | out << " Addr=" << std::setw(2) << (fPingAddr&0x1f);
|
---|
29 | out << " DNA=" << std::setw(16) << fDNA;
|
---|
30 | out << " ErrorCounter=" << std::dec << fErrorCounter << std::endl;
|
---|
31 | }
|
---|
32 |
|
---|
33 | void FTM::FtuList::print(std::ostream &out) const
|
---|
34 | {
|
---|
35 | out << "Number of boards responded: " << std::dec << fNumBoards << " (";
|
---|
36 | out << fNumBoardsCrate[0] << ", ";
|
---|
37 | out << fNumBoardsCrate[1] << ", ";
|
---|
38 | out << fNumBoardsCrate[2] << ", ";
|
---|
39 | out << fNumBoardsCrate[3] << ")" << std::endl;
|
---|
40 | out << "Active boards: " << std::hex;
|
---|
41 | out << std::setfill('0');
|
---|
42 | out << std::setw(4) << fActiveFTU[0];
|
---|
43 | out << std::setw(4) << fActiveFTU[1];
|
---|
44 | out << std::setw(4) << fActiveFTU[2];
|
---|
45 | out << std::setw(4) << fActiveFTU[3] << std::dec << std::endl;
|
---|
46 | for (int c=0; c<4; c++)
|
---|
47 | for (int b=0; b<10; b++)
|
---|
48 | {
|
---|
49 | out << ' ' << c << ':' << std::setfill('0') << std::setw(2) << b << ": ";
|
---|
50 | out << fFTU[c][b];
|
---|
51 | }
|
---|
52 | }
|
---|
53 |
|
---|
54 | void FTM::DynamicDataBoard::print(std::ostream &out) const
|
---|
55 | {
|
---|
56 | out << "Rate=" << std::setw(5) << fRateTotal << " (";
|
---|
57 | out << std::setw(5) << fRatePatch[0] << ", ";
|
---|
58 | out << std::setw(5) << fRatePatch[1] << ", ";
|
---|
59 | out << std::setw(5) << fRatePatch[2] << ", ";
|
---|
60 | out << std::setw(5) << fRatePatch[3] << ") ";
|
---|
61 | out << "Overflow=" << fOverflow << " ";
|
---|
62 | out << "CrcError=" << fCrcError << std::endl;
|
---|
63 | }
|
---|
64 |
|
---|
65 | void FTM::DynamicData::print(std::ostream &out) const
|
---|
66 | {
|
---|
67 | out << "OnTime=" << std::dec << fOnTimeCounter << " ";
|
---|
68 | out << "Temp=(";
|
---|
69 | out << fTempSensor[0] << ",";
|
---|
70 | out << fTempSensor[1] << ",";
|
---|
71 | out << fTempSensor[2] << ",";
|
---|
72 | out << fTempSensor[3] << ")" << std::endl;
|
---|
73 |
|
---|
74 | for (int c=0; c<4; c++)
|
---|
75 | for (int b=0; b<10; b++)
|
---|
76 | {
|
---|
77 | out << ' ' << c << ':' << std::setfill('0') << std::setw(2) << b << ": ";
|
---|
78 | out << fBoard[c][b];
|
---|
79 | }
|
---|
80 | }
|
---|
81 |
|
---|
82 | void FTM::StaticDataBoard::print(std::ostream &out) const
|
---|
83 | {
|
---|
84 | out << "Enable=( " << std::hex;
|
---|
85 | for (int i=0; i<4; i++)
|
---|
86 | out << std::setw(4) << fEnable[i] << " ";
|
---|
87 | out << ") " << std::dec;
|
---|
88 |
|
---|
89 | out << "DAC A=" << fDAC[0] << " ";
|
---|
90 | out << "B=" << fDAC[1] << " ";
|
---|
91 | out << "C=" << fDAC[2] << " ";
|
---|
92 | out << "D=" << fDAC[3] << " ";
|
---|
93 | out << "H=" << fDAC[4] << " ";
|
---|
94 |
|
---|
95 | out << "Prescaling=" << fPrescaling << endl;
|
---|
96 | }
|
---|
97 |
|
---|
98 | void FTM::StaticData::print(std::ostream &out) const
|
---|
99 | {
|
---|
100 | out << std::hex;
|
---|
101 | out << "General settings: ";
|
---|
102 | if (IsEnabled(kTrigger))
|
---|
103 | out << " Trigger";
|
---|
104 | if (IsEnabled(kPedestal))
|
---|
105 | out << " Pedestal";
|
---|
106 | if (IsEnabled(kLPint))
|
---|
107 | out << " LPint";
|
---|
108 | if (IsEnabled(kLPext))
|
---|
109 | out << " LPext";
|
---|
110 | if (IsEnabled(kExt1))
|
---|
111 | out << " Ext1";
|
---|
112 | if (IsEnabled(kExt2))
|
---|
113 | out << " Ext2";
|
---|
114 | if (IsEnabled(kVeto))
|
---|
115 | out << " Veto";
|
---|
116 | if (IsEnabled(kClockConditioner))
|
---|
117 | out << " ClockCond";
|
---|
118 | out << " (" << fGeneralSettings << ")" << endl;
|
---|
119 | out << "Status LEDs: " << fStatusLEDs << endl;
|
---|
120 | out << std::dec;
|
---|
121 | out << "TriggerInterval: " << fTriggerInterval << " ms" << endl;
|
---|
122 | out << "TriggerSequence: ";
|
---|
123 | out << (fTriggerSequence &0x1f) << ":";
|
---|
124 | out << ((fTriggerSequence>> 5)&0x1f) << ":";
|
---|
125 | out << ((fTriggerSequence>>10)&0x1f) << " (LPint:LPext:PED)" << endl;
|
---|
126 | out << "Coinc. physics: " << std::setw(2) << fMultiplicityPhysics << "/N ";
|
---|
127 | out << fWindowPhysics*4+8 << "ns" << endl;
|
---|
128 | out << "Coinc. calib: " << std::setw(2) << fMultiplicityCalib << "/N ";
|
---|
129 | out << fWindowCalib*4+8 << "ns" << endl;
|
---|
130 | out << "Trigger delay: " << fDelayTrigger*4+8 << "ns" << endl;
|
---|
131 | out << "Time marker delay: " << fDelayTimeMarker*4+8 << "ns" << endl;
|
---|
132 | out << "Dead time: " << fDeadTime*4+8 << "ns" << endl;
|
---|
133 | out << "Clock conditioner:";
|
---|
134 | out << std::hex << setfill('0');
|
---|
135 | for (int i=0; i<8; i++)
|
---|
136 | out << " " << setw(8) << fClockConditioner[i];
|
---|
137 | out << endl;
|
---|
138 | out << "Active FTUs: ";
|
---|
139 | out << fActiveFTU[0] << " ";
|
---|
140 | out << fActiveFTU[1] << " ";
|
---|
141 | out << fActiveFTU[2] << " ";
|
---|
142 | out << fActiveFTU[3] << endl;
|
---|
143 | out << std::dec;
|
---|
144 |
|
---|
145 | for (int c=0; c<4; c++)
|
---|
146 | for (int b=0; b<10; b++)
|
---|
147 | {
|
---|
148 | out << ' ' << c << ':' << std::setfill('0') << std::setw(2) << b << ": ";
|
---|
149 | out << fBoard[c][b];
|
---|
150 | }
|
---|
151 | }
|
---|
152 |
|
---|
153 | void FTM::Error::print(std::ostream &out) const
|
---|
154 | {
|
---|
155 | out << dec;
|
---|
156 | out << "ERROR: Num Calls = " << fNumCalls;
|
---|
157 | if (fNumCalls==0)
|
---|
158 | out << " (too many)";
|
---|
159 | out << endl;
|
---|
160 | out << " Delimiter = " << (fDelimiter=='@'?"ok":"wrong") << endl;
|
---|
161 | out << " Path = ";
|
---|
162 | if (fSrcAddress==0xc0)
|
---|
163 | out << "FTM(192)";
|
---|
164 | else
|
---|
165 | out << "FTU(" << (fSrcAddress &0x3) << ":" << (fSrcAddress >>2) << ")";
|
---|
166 | out << " --> ";
|
---|
167 | if (fDestAddress==0xc0)
|
---|
168 | out << "FTM(192)";
|
---|
169 | else
|
---|
170 | out << "FTU(" << (fDestAddress&0x3) << ":" << (fDestAddress>>2) << ")";
|
---|
171 | out << endl;
|
---|
172 | out << " FirmwareId = " << hex << fFirmwareId << endl;
|
---|
173 | out << " Command = " << hex << fCommand << endl;
|
---|
174 | out << " CRC counter = " << dec << fCrcErrorCounter << endl;
|
---|
175 | out << " CRC = " << hex << fCrcCheckSum << endl;
|
---|
176 | out << " Data: " << Converter::GetHex<unsigned short>(fData, 0, false) << endl;
|
---|
177 | }
|
---|