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

Last change on this file since 19808 was 15058, checked in by tbretz, 12 years ago
Fixed a typo in an enum.
File size: 6.8 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&kFtmStates);
14 switch (fState&kFtmStates)
15 {
16 case kFtmIdle: out << " [idle]"; break;
17 case kFtmConfig: out << " [config]"; break;
18 case kFtmRunning: out << " [running]"; break;
19 case kFtmCalib: out << " [calib]"; break;
20 }
21
22 out << " Type=" << fType;
23 switch (fType)
24 {
25 case kHeader: out << " [header]"; break;
26 case kStaticData: out << " [static]"; break;
27 case kDynamicData: out << " [dynamic]"; break;
28 case kFtuList: out << " [ftulist]"; break;
29 case kErrorList: out << " [errorlist]"; break;
30 case kRegister: out << " [register]"; break;
31 }
32
33 out << " (len=" << fDataSize << ")";
34 out << " Id=0x" << std::hex << fBoardId;
35 out << " FW=" << fFirmwareId;
36 out << " TriggerCounter=" << std::dec << fTriggerCounter;
37 out << " TimeStamp=" << fTimeStamp;
38 if (fState&kFtmLocked)
39 out << " [locked]";
40 else
41 out << " [unlocked]";
42 out << std::endl;
43}
44
45void FTM::FtuResponse::print(std::ostream &out) const
46{
47 out << std::hex << "Pings=" << ((fPingAddr>>8)&0x3);
48 out << " Addr=" << std::setw(2) << (fPingAddr&0x1f);
49 out << " DNA=" << std::setw(16) << fDNA;
50 out << " ErrorCounter=" << std::dec << fErrorCounter << std::endl;
51}
52
53void FTM::FtuList::print(std::ostream &out) const
54{
55 out << "Number of boards responded: " << std::dec << fNumBoards << " (";
56 out << fNumBoardsCrate[0] << ", ";
57 out << fNumBoardsCrate[1] << ", ";
58 out << fNumBoardsCrate[2] << ", ";
59 out << fNumBoardsCrate[3] << ")" << std::endl;
60 out << "Active boards: " << std::hex;
61 out << std::setfill('0');
62 out << std::setw(4) << fActiveFTU[0];
63 out << std::setw(4) << fActiveFTU[1];
64 out << std::setw(4) << fActiveFTU[2];
65 out << std::setw(4) << fActiveFTU[3] << std::dec << std::endl;
66 for (int c=0; c<4; c++)
67 for (int b=0; b<10; b++)
68 {
69 out << ' ' << c << ':' << std::setfill('0') << std::setw(2) << b << ": ";
70 out << fFTU[c][b];
71 }
72}
73
74void FTM::DynamicDataBoard::print(std::ostream &out) const
75{
76 out << "Rate=" << std::setw(5) << fRateTotal << " (";
77 out << std::setw(5) << fRatePatch[0] << ", ";
78 out << std::setw(5) << fRatePatch[1] << ", ";
79 out << std::setw(5) << fRatePatch[2] << ", ";
80 out << std::setw(5) << fRatePatch[3] << ") ";
81 out << "Overflow=" << fOverflow << " ";
82 out << "CrcError=" << fCrcError << std::endl;
83}
84
85void FTM::DynamicData::print(std::ostream &out) const
86{
87 out << "OnTime=" << std::dec << fOnTimeCounter << " ";
88 out << "Temp=(";
89 out << fTempSensor[0] << ",";
90 out << fTempSensor[1] << ",";
91 out << fTempSensor[2] << ",";
92 out << fTempSensor[3] << ")" << std::endl;
93
94 for (int c=0; c<4; c++)
95 for (int b=0; b<10; b++)
96 {
97 out << ' ' << c << ':' << std::setfill('0') << std::setw(2) << b << ": ";
98 out << fBoard[c][b];
99 }
100}
101
102void FTM::StaticDataBoard::print(std::ostream &out) const
103{
104 out << "Enable=( " << std::hex;
105 for (int i=0; i<4; i++)
106 out << std::setw(4) << fEnable[i] << " ";
107 out << ") " << std::dec;
108
109 out << "DAC A=" << fDAC[0] << " ";
110 out << "B=" << fDAC[1] << " ";
111 out << "C=" << fDAC[2] << " ";
112 out << "D=" << fDAC[3] << " ";
113 out << "H=" << fDAC[4] << " ";
114
115 out << "Prescaling=" << fPrescaling << endl;
116}
117
118void FTM::StaticData::print(std::ostream &out) const
119{
120 out << std::hex;
121 out << "General settings: ";
122 if (IsEnabled(kTrigger))
123 out << " Trigger";
124 if (IsEnabled(kPedestal))
125 out << " Pedestal";
126 if (IsEnabled(kLPint))
127 out << " LPint";
128 if (IsEnabled(kLPext))
129 out << " LPext";
130 if (IsEnabled(kExt1))
131 out << " Ext1";
132 if (IsEnabled(kExt2))
133 out << " Ext2";
134 if (IsEnabled(kVeto))
135 out << " Veto";
136 if (IsEnabled(kClockConditioner))
137 out << " ClockCond";
138 out << " (" << fGeneralSettings << ")" << endl;
139 out << "Status LEDs: " << fStatusLEDs << endl;
140 out << std::dec;
141 out << "TriggerInterval: " << fTriggerInterval << " ms" << endl;
142 out << "TriggerSequence: ";
143 out << (fTriggerSequence &0x1f) << ":";
144 out << ((fTriggerSequence>> 5)&0x1f) << ":";
145 out << ((fTriggerSequence>>10)&0x1f) << " (LPint:LPext:PED)" << endl;
146 out << "Coinc. physics: " << std::setw(2) << fMultiplicityPhysics << "/N ";
147 out << fWindowPhysics*4+8 << "ns" << endl;
148 out << "Coinc. calib: " << std::setw(2) << fMultiplicityCalib << "/N ";
149 out << fWindowCalib*4+8 << "ns" << endl;
150 out << "Trigger delay: " << fDelayTrigger*4+8 << "ns" << endl;
151 out << "Time marker delay: " << fDelayTimeMarker*4+8 << "ns" << endl;
152 out << "Dead time: " << fDeadTime*4+8 << "ns" << endl;
153 out << "Light pulser (int): " << dec << (int)fIntensityLPint;
154 if (fEnableLPint&kGroup1)
155 out << " + Group1";
156 if (fEnableLPint&kGroup2)
157 out << " + Group2";
158 out << endl;
159 out << "Light pulser (ext): " << dec << (int)fIntensityLPext;
160 if (fEnableLPext&kGroup1)
161 out << " + Group1";
162 if (fEnableLPext&kGroup2)
163 out << " + Group2";
164 out << endl;
165 out << "Clock conditioner:";
166 out << std::hex << setfill('0');
167 for (int i=0; i<8; i++)
168 out << " " << setw(8) << fClockConditioner[i];
169 out << endl;
170 out << "Active FTUs: ";
171 out << fActiveFTU[0] << " ";
172 out << fActiveFTU[1] << " ";
173 out << fActiveFTU[2] << " ";
174 out << fActiveFTU[3] << endl;
175 out << std::dec;
176
177 for (int c=0; c<4; c++)
178 for (int b=0; b<10; b++)
179 {
180 out << ' ' << c << ':' << std::setfill('0') << std::setw(2) << b << ": ";
181 out << fBoard[c][b];
182 }
183}
184
185void FTM::Error::print(std::ostream &out) const
186{
187 out << dec;
188 out << "ERROR: Num Calls = " << fNumCalls;
189 if (fNumCalls==0)
190 out << " (too many)";
191 out << endl;
192 out << " Delimiter = " << (fDelimiter=='@'?"ok":"wrong") << endl;
193 out << " Path = ";
194 if (fSrcAddress==0xc0)
195 out << "FTM(192)";
196 else
197 out << "FTU(" << (fSrcAddress &0x3) << ":" << (fSrcAddress >>2) << ")";
198 out << " --> ";
199 if (fDestAddress==0xc0)
200 out << "FTM(192)";
201 else
202 out << "FTU(" << (fDestAddress&0x3) << ":" << (fDestAddress>>2) << ")";
203 out << endl;
204 out << " FirmwareId = " << hex << fFirmwareId << endl;
205 out << " Command = " << hex << fCommand << endl;
206 out << " CRC counter = " << dec << fCrcErrorCounter << endl;
207 out << " CRC = " << hex << fCrcCheckSum << endl;
208 out << " Data: " << Converter::GetHex<unsigned short>(fData, 0, false) << endl;
209}
Note: See TracBrowser for help on using the repository browser.