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

Last change on this file since 11027 was 10767, checked in by tbretz, 14 years ago
Deconded general setting for output, added some const-qualifiers
File size: 5.7 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: ";
99 if (IsEnabled(kTrigger))
100 out << " Trigger";
101 if (IsEnabled(kPedestal))
102 out << " Pedestal";
103 if (IsEnabled(kLPint))
104 out << " LPint";
105 if (IsEnabled(kLPext))
106 out << " LPext";
107 if (IsEnabled(kExt1))
108 out << " Ext1";
109 if (IsEnabled(kExt2))
110 out << " Ext2";
111 if (IsEnabled(kVeto))
112 out << " Veto";
113 if (IsEnabled(kClockConditioner))
114 out << " ClockCond";
115 out << " (" << fGeneralSettings << ")" << endl;
116 out << "Status LEDs: " << fStatusLEDs << endl;
117 out << std::dec;
118 out << "TriggerInterval: " << fTriggerInterval << " ms" << endl;
119 out << "TriggerSequence: ";
120 out << (fTriggerSequence &0x1f) << ":";
121 out << ((fTriggerSequence>> 5)&0x1f) << ":";
122 out << ((fTriggerSequence>>10)&0x1f) << " (LPint:LPext:PED)" << endl;
123 out << "Coinc. physics: " << std::setw(2) << fMultiplicityPhysics << "/N ";
124 out << fWindowPhysics*4+8 << "ns" << endl;
125 out << "Coinc. calib: " << std::setw(2) << fMultiplicityCalib << "/N ";
126 out << fWindowCalib*4+8 << "ns" << endl;
127 out << "Trigger delay: " << fDelayTrigger*4+8 << "ns" << endl;
128 out << "Time marker delay: " << fDelayTimeMarker*4+8 << "ns" << endl;
129 out << "Dead time: " << fDeadTime*4+8 << "ns" << endl;
130 out << "Clock conditioner:";
131 out << std::hex << setfill('0');
132 for (int i=0; i<8; i++)
133 out << " " << setw(8) << fClockConditioner[i];
134 out << endl;
135 out << "Active FTUs: ";
136 out << fActiveFTU[0] << " ";
137 out << fActiveFTU[1] << " ";
138 out << fActiveFTU[2] << " ";
139 out << fActiveFTU[3] << endl;
140 out << std::dec;
141
142 for (int c=0; c<4; c++)
143 for (int b=0; b<10; b++)
144 {
145 out << ' ' << c << ':' << std::setfill('0') << std::setw(2) << b << ": ";
146 out << fBoard[c][b];
147 }
148}
149
150void FTM::Error::print(std::ostream &out) const
151{
152 out << dec;
153 out << "ERROR: Num Calls = " << fNumCalls;
154 if (fNumCalls==0)
155 out << " (too many)";
156 out << endl;
157 out << " Delimiter = " << (fDelimiter=='@'?"ok":"wrong") << endl;
158 out << " Path = ";
159 if (fSrcAddress==0xc0)
160 out << "FTM(192)";
161 else
162 out << "FTU(" << (fSrcAddress &0x3) << ":" << (fSrcAddress >>2) << ")";
163 out << " --> ";
164 if (fDestAddress==0xc0)
165 out << "FTM(192)";
166 else
167 out << "FTU(" << (fDestAddress&0x3) << ":" << (fDestAddress>>2) << ")";
168 out << endl;
169 out << " FirmwareId = " << hex << fFirmwareId << endl;
170 out << " Command = " << hex << fCommand << endl;
171 out << " CRC counter = " << dec << fCrcErrorCounter << endl;
172 out << " CRC = " << hex << fCrcCheckSum << endl;
173 out << " Data: " << Converter::GetHex<unsigned short>(fData, 0, false) << endl;
174}
Note: See TracBrowser for help on using the repository browser.