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

Last change on this file since 12682 was 11761, checked in by tbretz, 13 years ago
Fixed the light pulser control (DimStaticData)
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 out << std::endl;
23}
24
25void 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
33void 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
54void 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
65void 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
82void 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
98void 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 << "Light pulser (int): " << dec << (int)fIntensityLPint;
134 if (fEnableLPint&kGroup1)
135 out << " + Group1";
136 if (fEnableLPint&kGroup2)
137 out << " + Group2";
138 out << endl;
139 out << "Light pulser (ext): " << dec << (int)fIntensityLPext;
140 if (fEnableLPext&kGroup1)
141 out << " + Group1";
142 if (fEnableLPext&kGroup2)
143 out << " + Group2";
144 out << endl;
145 out << "Clock conditioner:";
146 out << std::hex << setfill('0');
147 for (int i=0; i<8; i++)
148 out << " " << setw(8) << fClockConditioner[i];
149 out << endl;
150 out << "Active FTUs: ";
151 out << fActiveFTU[0] << " ";
152 out << fActiveFTU[1] << " ";
153 out << fActiveFTU[2] << " ";
154 out << fActiveFTU[3] << endl;
155 out << std::dec;
156
157 for (int c=0; c<4; c++)
158 for (int b=0; b<10; b++)
159 {
160 out << ' ' << c << ':' << std::setfill('0') << std::setw(2) << b << ": ";
161 out << fBoard[c][b];
162 }
163}
164
165void FTM::Error::print(std::ostream &out) const
166{
167 out << dec;
168 out << "ERROR: Num Calls = " << fNumCalls;
169 if (fNumCalls==0)
170 out << " (too many)";
171 out << endl;
172 out << " Delimiter = " << (fDelimiter=='@'?"ok":"wrong") << endl;
173 out << " Path = ";
174 if (fSrcAddress==0xc0)
175 out << "FTM(192)";
176 else
177 out << "FTU(" << (fSrcAddress &0x3) << ":" << (fSrcAddress >>2) << ")";
178 out << " --> ";
179 if (fDestAddress==0xc0)
180 out << "FTM(192)";
181 else
182 out << "FTU(" << (fDestAddress&0x3) << ":" << (fDestAddress>>2) << ")";
183 out << endl;
184 out << " FirmwareId = " << hex << fFirmwareId << endl;
185 out << " Command = " << hex << fCommand << endl;
186 out << " CRC counter = " << dec << fCrcErrorCounter << endl;
187 out << " CRC = " << hex << fCrcCheckSum << endl;
188 out << " Data: " << Converter::GetHex<unsigned short>(fData, 0, false) << endl;
189}
Note: See TracBrowser for help on using the repository browser.