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

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