source: trunk/FACT++/src/HeadersFTM.cc@ 10623

Last change on this file since 10623 was 10598, checked in by tbretz, 13 years ago
Don't show error data block - it gives an exception - to be fixed.
File size: 5.2 KB
Line 
1#include "HeadersFTM.h"
2
3#include <string.h>
4
5#include <iomanip>
6
7#include "Converter.h"
8
9using namespace std;
10
11void FTM::Header::print(std::ostream &out) const
12{
13 out << "State=" << std::dec << fState;
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 << std::endl;
20}
21
22void FTM::FtuResponse::print(std::ostream &out) const
23{
24 out << std::hex << "Pings=" << ((fPingAddr>>8)&0x3);
25 out << " Addr=" << std::setw(2) << (fPingAddr&0x1f);
26 out << " DNA=" << std::setw(16) << fDNA;
27 out << " ErrorCounter=" << std::dec << fErrorCounter << std::endl;
28}
29
30void FTM::FtuList::print(std::ostream &out) const
31{
32 out << "Number of boards responded: " << std::dec << fNumBoards << " (";
33 out << fNumBoardsCrate[0] << ", ";
34 out << fNumBoardsCrate[1] << ", ";
35 out << fNumBoardsCrate[2] << ", ";
36 out << fNumBoardsCrate[3] << ")" << std::endl;
37 out << "Active boards: " << std::hex;
38 out << std::setfill('0');
39 out << std::setw(4) << fActiveFTU[0];
40 out << std::setw(4) << fActiveFTU[1];
41 out << std::setw(4) << fActiveFTU[2];
42 out << std::setw(4) << fActiveFTU[3] << std::dec << std::endl;
43 for (int c=0; c<4; c++)
44 for (int b=0; b<10; b++)
45 {
46 out << ' ' << c << ':' << std::setfill('0') << std::setw(2) << b << ": ";
47 out << fFTU[c][b];
48 }
49}
50
51void FTM::DynamicDataBoard::print(std::ostream &out) const
52{
53 out << "Rate=" << std::setw(5) << fRateTotal << " (";
54 out << std::setw(5) << fRatePatch[0] << ", ";
55 out << std::setw(5) << fRatePatch[1] << ", ";
56 out << std::setw(5) << fRatePatch[2] << ", ";
57 out << std::setw(5) << fRatePatch[3] << ") ";
58 out << "Overflow=" << fOverflow << " ";
59 out << "CrcError=" << fCrcError << std::endl;
60}
61
62void FTM::DynamicData::print(std::ostream &out) const
63{
64 out << "OnTime=" << std::dec << fOnTimeCounter << " ";
65 out << "Temp=(";
66 out << fTempSensor[0] << ",";
67 out << fTempSensor[1] << ",";
68 out << fTempSensor[2] << ",";
69 out << fTempSensor[3] << ")" << std::endl;
70
71 for (int c=0; c<4; c++)
72 for (int b=0; b<10; b++)
73 {
74 out << ' ' << c << ':' << std::setfill('0') << std::setw(2) << b << ": ";
75 out << fBoard[c][b];
76 }
77}
78
79void FTM::StaticDataBoard::print(std::ostream &out) const
80{
81 out << "Enable=( " << std::hex;
82 for (int i=0; i<4; i++)
83 out << std::setw(4) << fEnable[i] << " ";
84 out << ") " << std::dec;
85
86 out << "DAC A=" << fDAC[0] << " ";
87 out << "B=" << fDAC[1] << " ";
88 out << "C=" << fDAC[2] << " ";
89 out << "D=" << fDAC[3] << " ";
90 out << "H=" << fDAC[4] << " ";
91
92 out << "Prescaling=" << fPrescaling << endl;
93}
94
95void FTM::StaticData::print(std::ostream &out) const
96{
97 out << std::hex;
98 out << "General settings: " << fGeneralSettings << endl;
99 out << "Status LEDs: " << fStatusLEDs << endl;
100 out << std::dec;
101 out << "TriggerInterval: " << fTriggerInterval << " ms" << endl;
102 out << "TriggerSequence: ";
103 out << (fTriggerSequence &0x1f) << ":";
104 out << ((fTriggerSequence>> 5)&0x1f) << ":";
105 out << ((fTriggerSequence>>10)&0x1f) << " (LPint:LPext:PED)" << endl;
106 out << "Coinc. physics: " << std::setw(2) << fCoincidencePhysics << "/N ";
107 out << fWindowPhysics*4+8 << "ns" << endl;
108 out << "Coinc. calib: " << std::setw(2) << fCoincidenceCalib << "/N ";
109 out << fWindowCalib*4+8 << "ns" << endl;
110 out << "Trigger delay: " << fDelayTrigger*4+8 << "ns" << endl;
111 out << "Time marker delay: " << fDelayTimeMarker*4+8 << "ns" << endl;
112 out << "Dead time: " << fDeadTime*4+8 << "ns" << endl;
113 out << "Clock conditioner:";
114 out << std::hex << setfill('0');
115 for (int i=0; i<8; i++)
116 out << " " << setw(8) << fClockConditioner[i];
117 out << endl;
118 out << "Active FTUs: ";
119 out << fActiveFTU[0] << " ";
120 out << fActiveFTU[1] << " ";
121 out << fActiveFTU[2] << " ";
122 out << fActiveFTU[3] << endl;
123 out << std::dec;
124
125 for (int c=0; c<4; c++)
126 for (int b=0; b<10; b++)
127 {
128 out << ' ' << c << ':' << std::setfill('0') << std::setw(2) << b << ": ";
129 out << fBoard[c][b];
130 }
131}
132
133void FTM::Error::print(std::ostream &out) const
134{
135 out << dec;
136 out << "ERROR: Num Calls = " << fNumCalls << endl;
137 out << " Delimiter = " << (fDelimiter=='@'?"ok":"wrong") << endl;
138 out << " Path = ";
139 if (fSrcAddress==0xc0)
140 out << "FTM(192)";
141 else
142 out << "FTU(" << (fSrcAddress &0x3) << ":" << (fSrcAddress >>2) << ")";
143 out << " --> ";
144 if (fDestAddress==0xc0)
145 out << "FTM(192)";
146 else
147 out << "FTU(" << (fDestAddress&0x3) << ":" << (fDestAddress>>2) << ")";
148 out << endl;
149 out << " FirmwareId = " << hex << fFirmwareId << endl;
150 out << " Command = " << hex << fCommand << endl;
151 out << " CRC counter = " << dec << fCrcErrorCounter << endl;
152 out << " CRC = " << hex << fCrcCheckSum << endl;
153// out << " Data: " << Converter::GetHex<unsigned short>(fData, 0, false) << endl;
154}
Note: See TracBrowser for help on using the repository browser.