FACT++  1.0
HeadersFTM.cc
Go to the documentation of this file.
1 #include "HeadersFTM.h"
2 
3 #include <string.h>
4 
5 #include <iomanip>
6 
7 #include "Converter.h"
8 
9 using namespace std;
10 
11 void 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 
45 void 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 
53 void 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 
74 void 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 
85 void 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 
102 void 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 
118 void 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";
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 
185 void 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 }
uint8_t fIntensityLPext
Ratio between trigger types send as artificial trigger (in this order) 3x5bit.
Definition: HeadersFTM.h:226
uint16_t fCrcError
Definition: HeadersFTM.h:190
Physics trigger decision (PhysicTrigger)
Definition: HeadersFTM.h:206
uint32_t fRatePatch[4]
Definition: HeadersFTM.h:186
void print(std::ostream &out) const
Definition: HeadersFTM.cc:85
uint16_t fCrcErrorCounter
Definition: HeadersFTM.h:194
uint16_t fMultiplicityPhysics
Intensity of LEDs (0-127)
Definition: HeadersFTM.h:231
uint8_t fIntensityLPint
Enable for LED group 1/2 (LightPulserEnable)
Definition: HeadersFTM.h:228
uint16_t fTriggerSequence
[ms] Interval between two artificial triggers (no matter which type) minimum 1ms, 10 bit ...
Definition: HeadersFTM.h:225
uint16_t fNumBoardsCrate[4]
Total number of boards responded.
Definition: HeadersFTM.h:187
uint16_t fActiveFTU[4]
Num of board responded in crate 0-3.
Definition: HeadersFTM.h:243
Dynamic data (rates)
Definition: HeadersFTM.h:90
int i
Definition: db_dim_client.c:21
uint16_t fTriggerInterval
only 8 bit used
Definition: HeadersFTM.h:224
uint16_t fBoardId
Definition: HeadersFAD.h:182
void print(std::ostream &out) const
Definition: HeadersFTM.cc:102
uint16_t fEnable[4]
Definition: HeadersFTM.h:186
uint16_t fDelayTrigger
Required trigger multiplicity calibration (LPext) triggers (0-40)
Definition: HeadersFTM.h:233
uint16_t fPrescaling
0-3 (A-D) Threshold of patches, 4 (H) Threshold for N out of 4 (12 bit each)
Definition: HeadersFTM.h:188
uint8_t fEnableLPext
Intensity of LEDs (0-127)
Definition: HeadersFTM.h:227
STL namespace.
uint16_t fWindowPhysics
R0, R1, R8, R9, R11, R13, R14, R15.
Definition: HeadersFTM.h:237
uint16_t fDataSize
Size in words to be received after the header (incl end delim.)
Definition: HeadersFTM.h:188
uint16_t fGeneralSettings
Definition: HeadersFTM.h:222
uint32_t fTriggerCounter
Definition: HeadersFAD.h:177
uint16_t fState
State of the FTM central state machine.
Definition: HeadersFTM.h:189
Static (configuration) data.
Definition: HeadersFTM.h:89
uint16_t fTempSensor[4]
Definition: HeadersFTM.h:187
bool IsEnabled(GeneralSettings type) const
Definition: HeadersFTM.h:311
uint16_t fDeadTime
(4ns * x + 8ns) FTM internal programmable delay between trigger descision and time marker output ...
Definition: HeadersFTM.h:235
uint16_t fMultiplicityCalib
Required trigger multiplicity for physcis triggers (0-40)
Definition: HeadersFTM.h:232
FTM and FTUs are being reconfigured.
Definition: HeadersFTM.h:22
uint32_t fRateTotal
Definition: HeadersFTM.h:187
External trigger signal 2.
Definition: HeadersFTM.h:210
void print(std::ostream &out) const
Definition: HeadersFTM.cc:11
void print(std::ostream &out) const
Definition: HeadersFTM.cc:45
Select clock conditioner frequency (1) / time marker (0) as output.
Definition: HeadersFTM.h:213
void print(std::ostream &out) const
Definition: HeadersFTM.cc:118
void print(std::ostream &out) const
Definition: HeadersFTM.cc:53
uint16_t fNumCalls
Definition: HeadersFTM.h:186
uint16_t fWindowCalib
(4ns * x + 8ns) At least N (multiplicity) rising edges (trigger signal) within this window ...
Definition: HeadersFTM.h:238
uint16_t fCrcCheckSum
Definition: HeadersFTM.h:195
uint16_t fType
Type of the data to be received after the header.
Definition: HeadersFTM.h:187
uint16_t fFirmwareId
Version number.
Definition: HeadersFTM.h:191
uint32_t fTimeStamp
Definition: HeadersFAD.h:189
uint64_t fDNA
Number of boards answered per crate.
Definition: HeadersFAD.h:187
StaticDataBoard fBoard[4][10]
Definition: HeadersFTM.h:241
Pedestal trigger (artifical)
Definition: HeadersFTM.h:207
uint32_t fClockConditioner[8]
(4ns * x + 8ns) FTM internal programmable dead time after trigger decision
Definition: HeadersFTM.h:236
Enable artificial trigger after light pulse (LP2)
Definition: HeadersFTM.h:208
uint16_t fCommand
Definition: HeadersFTM.h:192
Local extension to identify a header in fCounter.
Definition: HeadersFTM.h:88
External trigger signal 1.
Definition: HeadersFTM.h:211
uint16_t fErrorCounter
Definition: HeadersFTM.h:188
FTU list (answer of ping)
Definition: HeadersFTM.h:91
uint64_t fOnTimeCounter
Definition: HeadersFTM.h:186
uint16_t fDestAddress
Definition: HeadersFTM.h:189
void print(std::ostream &out) const
Definition: HeadersFTM.cc:185
A requested register value.
Definition: HeadersFTM.h:93
uint16_t fStatusLEDs
Enable for different trigger types / select for TIM/ClockConditioner output (only 8 bit used) ...
Definition: HeadersFTM.h:223
uint16_t fDelayTimeMarker
(4ns * x + 8ns) FTM internal programmable delay between trigger decision and output ...
Definition: HeadersFTM.h:234
uint16_t fDelimiter
Start delimiter.
Definition: HeadersFTM.h:186
Veto trigger decision / artifical triggers.
Definition: HeadersFTM.h:212
Trigger output disabled, configuration possible.
Definition: HeadersFTM.h:21
FtuResponse fFTU[4][10]
List of active FTU boards in crate 0-3.
Definition: HeadersFTM.h:190
void print(std::ostream &out) const
Definition: HeadersFTM.cc:74
uint16_t fSrcAddress
Definition: HeadersFTM.h:190
uint8_t fEnableLPint
Intensity of LEDs (0-127)
Definition: HeadersFTM.h:229
uint16_t fNumBoards
Definition: HeadersFTM.h:186
uint16_t fPingAddr
Definition: HeadersFTM.h:186
Trigger output enabled, configuration ignored.
Definition: HeadersFTM.h:23
uint16_t fOverflow
Definition: HeadersFTM.h:189
Enable trigger decision after light pulse (CalibrationTrigger, LP1)
Definition: HeadersFTM.h:209
uint16_t fData[21]
Definition: HeadersFTM.h:193
Error list (error when FTU communication failed)
Definition: HeadersFTM.h:92
uint16_t fDAC[5]
enable of 4x9 pixels coded as 4x9bits
Definition: HeadersFTM.h:187