1 #ifndef FACT_HeadersFTM 2 #define FACT_HeadersFTM 117 std::vector<uint16_t>
HtoN()
const 137 void print(std::ostream &out)
const;
147 fBoardId(h.fBoardId),
148 fFirmwareId(h.fFirmwareId)
175 void print(std::ostream &out)
const;
249 std::vector<uint16_t>
HtoN()
const 252 for (
int i=0;
i<8;
i++)
260 for (
int i=0;
i<4;
i++)
261 for (
int j=0; j<10; j++)
262 memcpy(d.
fBoard[
i][j].
fDAC, fBoard[
i][j].fDAC,
sizeof(uint16_t)*5);
269 void print(std::ostream &out)
const;
283 fEnableLPint |= group;
285 fEnableLPint &= ~group;
291 fEnableLPext |= group;
293 fEnableLPext &= ~group;
301 fGeneralSettings |= uint16_t(type);
303 fGeneralSettings &= ~uint16_t(type);
310 const int pixel = idx%9;
311 const int patch = (idx/9)%4;
312 const int board = (idx/9)/4;
314 uint16_t &pix = fBoard[board/10][board%10].fEnable[patch];
326 const int patch = idx%4;
327 const int board = idx/4;
329 fBoard[board/10][board%10].fEnable[patch] = enable ? 0x1ff : 0;
334 for (
int c=0; c<4; c++)
335 for (
int b=0; b<10; b++)
336 for (
int p=0; p<4; p++)
342 const int pixel = idx%9;
343 const int patch = (idx/9)%4;
344 const int board = (idx/9)/4;
346 return (fBoard[board/10][board%10].
fEnable[patch]>>pixel)&1;
355 fTriggerSequence = ((ped&0x1f)<<10)|((lpint&0x1f)<<5)|(lpext&0x1f);
364 for (
int i=0;
i<8;
i++)
365 fClockConditioner[
i] = reg[
i];
370 for (
int c=0; c<4; c++)
371 for (
int b=0; b<10; b++)
407 uint32_t fClockConditioner[8];
429 bool IsActive(
int i)
const {
return fActiveFTU&(uint64_t(1)<<
i); }
430 bool IsEnabled(
int i)
const {
return fEnable[i/16]&(1<<(i%16)); }
435 fTimeStamp(h.fTimeStamp),
436 fGeneralSettings(d.fGeneralSettings),
437 fStatusLEDs(d.fStatusLEDs),
438 fActiveFTU( uint64_t(d.fActiveFTU[0]) |
439 (uint64_t(d.fActiveFTU[1])<<10) |
440 (uint64_t(d.fActiveFTU[2])<<20) |
441 (uint64_t(d.fActiveFTU[3])<<30)),
442 fTriggerInterval(d.fTriggerInterval),
443 fTriggerSeqLPint((d.fTriggerSequence>>5)&0x1f),
444 fTriggerSeqLPext((d.fTriggerSequence)&0x1f),
445 fTriggerSeqPed((d.fTriggerSequence>>10)&0x1f),
446 fEnableLPint(d.fEnableLPint),
447 fEnableLPext(d.fEnableLPext),
448 fIntensityLPint(d.fIntensityLPint),
449 fIntensityLPext(d.fIntensityLPext),
450 fMultiplicityPhysics(d.fMultiplicityPhysics),
451 fMultiplicityCalib(d.fMultiplicityCalib),
452 fWindowPhysics(d.fWindowPhysics*4+8),
453 fWindowCalib(d.fWindowCalib*4+8),
454 fDelayTrigger(d.fDelayTrigger*4+8),
455 fDelayTimeMarker(d.fDelayTimeMarker*4+8),
456 fDeadTime(uint32_t(d.fDeadTime)*4+8)
461 for (
int i=0;
i<40;
i++)
463 for (
int j=0; j<4; j++)
465 src[
i*4+j] = d[
i].fEnable[j];
466 fThreshold[
i*4+j] = d[
i].fDAC[j];
469 fMultiplicity[
i] = d[
i].fDAC[4];
470 fPrescaling[
i] = d[
i].fPrescaling+1;
472 bitcpy(fEnable, 90, src, 160, 9);
486 void print(std::ostream &out)
const;
490 for (
int i=0;
i<4;
i++)
510 std::vector<uint16_t>
HtoN()
const 516 for (
int c=0; c<4; c++)
517 for (
int b=0; b<10; b++)
529 for (
int c=0; c<4; c++)
530 for (
int b=0; b<10; b++)
535 void print(std::ostream &out)
const;
562 fTimeStamp(h.fTimeStamp),
563 fOnTimeCounter(d.fOnTimeCounter),
566 for (
int i=0;
i<4;
i++)
569 for (
int i=0;
i<40;
i++)
571 fRateBoard[
i] = d[
i].fRateTotal;
572 fRateOverflow[
i] = d[
i].fOverflow;
573 fCrcError[
i] = d[
i].fCrcError;
574 for (
int j=0; j<4; j++)
575 fRatePatch[
i*4+j] = d[
i].fRatePatch[j];
577 fPrescaling[
i] = s[
i].fPrescaling+1;
598 fTimeStamp(h.fTimeStamp), fOnTimeCounter(d.fOnTimeCounter),
599 fTriggerCounter(h.fTriggerCounter), fTriggerRate(rate),
600 fElapsedTime(et), fOnTime(ot)
602 for (
int i=0;
i<40;
i++)
605 fBoardRate[
i] = float(UINT32_MAX+1)*2/(s[
i].fPrescaling+1);
607 fBoardRate[
i] = float(d[
i].
fRateTotal)*2/(s[
i].fPrescaling+1);
611 for (
int j=0; j<4; j++)
613 fPatchRate[
i*4+j] =
float(UINT32_MAX+1)*2/(s[
i].fPrescaling+1);
615 fPatchRate[
i*4+j] = float(d[
i].
fRatePatch[j])*2/(s[
i].fPrescaling+1);
630 void print(std::ostream &out)
const;
638 uint16_t fActiveFTU[4];
644 std::vector<uint16_t>
HtoN()
const 648 for (
int c=0; c<4; c++)
649 for (
int b=0; b<10; b++)
659 for (
int c=0; c<4; c++)
660 for (
int b=0; b<10; b++)
665 void print(std::ostream &out)
const;
685 fTimeStamp(h.fTimeStamp),
686 fActiveFTU( uint64_t(d.fActiveFTU[0]) |
687 (uint64_t(d.fActiveFTU[1])<<10) |
688 (uint64_t(d.fActiveFTU[2])<<20) |
689 (uint64_t(d.fActiveFTU[3])<<30)),
690 fNumBoards(d.fNumBoards)
692 for (
int i=0;
i<4;
i++)
695 for (
int i=0;
i<40;
i++)
698 fAddr[
i] = d[
i].fPingAddr&0x3f;
699 fPing[
i] = (d[
i].fPingAddr>>8)&0x3;
703 bool IsActive(
int i)
const {
return fActiveFTU&(uint64_t(1)<<
i); }
723 std::vector<uint16_t>
HtoN()
const 733 const uint16_t &
operator[](
int idx)
const {
return fData[idx]; }
735 void print(std::ostream &out)
const;
745 fTimeStamp(h.fTimeStamp),
StaticDataBoard fBoard[4][10]
void EnablePatch(int idx, bool enable)
uint8_t GetSequencePed() const
const FtuResponse & operator[](int i) const
Enable the trigger output.
Reboot (no power cycle) all FTUs and FADs of one crate.
void print(std::ostream &out) const
FtuResponse fFTU[4][10]
List of active FTU boards in crate 0-3.
uint16_t fPrescaling
0-3 (A-D) Threshold of patches, 4 (H) Threshold for N out of 4 (12 bit each)
void operator=(const std::vector< uint16_t > &vec)
uint16_t * EnablePixel(int idx, bool enable)
std::vector< uint16_t > htoncpy(const S &s)
std::vector< uint16_t > HtoN() const
DimTriggerRates(const Header &h, const DynamicData &d, const StaticData &s, float rate, float et, float ot)
uint8_t GetSequenceLPint() const
Class for a state machine implementation just on the console.
uint16_t fTriggerSequence
[ms] Interval between two artificial triggers (no matter which type) minimum 1ms, 10 bit ...
External trigger signal 2.
uint8_t fIntensityLPext
Intensity of LEDs (0-127)
void operator=(const std::vector< uint16_t > &vec)
void print(std::ostream &out) const
uint16_t & operator[](int idx)
...fixed number of events
Types
Types sent in the header of the following data.
uint16_t fMultiplicityPhysics
Intensity of LEDs (0-127)
uint8_t fEnableLPext
Enable for LED group 1/2 (LightPulserEnable)
uint8_t fIntensityLPint
Enable for LED group 1/2 (LightPulserEnable)
Select clock conditioner frequency (1) / time marker (0) as output.
Static (configuration) data.
FTM and FTUs are being reconfigured.
void print(std::ostream &out) const
DimError(const Header &h, const Error &e)
std::vector< uint16_t > HtoN() const
uint16_t fDelayTimeMarker
DimStaticData(const Header &h, const StaticData &d)
Specifies that dynamic data is read/written.
void SetSequence(uint8_t ped, uint8_t lpint, uint8_t lpext)
uint32_t fClockConditioner[8]
(4ns * x + 8ns) FTM internal programmable dead time after trigger decision
void print(std::ostream &out) const
void print(std::ostream &out) const
Specifies that a register is read/written.
const DynamicDataBoard & operator[](int i) const
DynamicDataBoard & operator[](int i)
uint16_t fGeneralSettings
void SetPrescaling(uint16_t val)
const StaticDataBoard & operator[](int i) const
Specifies that static (configuration) data is read/written.
External trigger signal 1.
StaticDataBoard()
Internal readout time of FTUs for trigger counter.
bool operator==(StaticData d) const
uint8_t GetSequenceLPext() const
enum FTM::State::StateMachine __attribute__
void EnableLPext(LightPulserEnable group, bool enable)
DynamicDataBoard fBoard[4][10]
DimDynamicData(const Header &h, const DynamicData &d, const StaticData &s)
std::vector< uint16_t > HtoN() const
bool Enabled(uint16_t idx) const
uint16_t fNumBoardsCrate[4]
Total number of boards responded.
Disable the trigger output.
Enable trigger decision after light pulse (CalibrationTrigger, LP1)
void operator=(const std::vector< uint16_t > &vec)
uint16_t fCrcErrorCounter
Disable transmission of rate-reports (dynamic data)
Enable artificial trigger after light pulse (LP2)
Pedestal trigger (artifical)
Local extension to identify a header in fCounter.
uint16_t fTriggerInterval
FTU list (answer of ping)
uint16_t fMultiplicityCalib
uint16_t fDAC[5]
enable of 4x9 pixels coded as 4x9bits
Start delimiter send before each header.
bool HasClockConditioner() const
uint32_t & operator[](int i)
void Enable(GeneralSettings type, bool enable)
FtuResponse & operator[](int i)
uint16_t fTriggerSeqLPint
bool IsEnabled(int i) const
std::vector< uint16_t > HtoN() const
uint16_t fTriggerSeqLPext
bool IsActive(int i) const
bool IsEnabled(GeneralSettings type) const
std::ostream & operator<<(std::ostream &out, const FtuResponse &h)
void print(std::ostream &out) const
A requested register value.
Veto trigger decision / artifical triggers.
Trigger output disabled, configuration possible.
void print(std::ostream &out) const
void ntohcpy(const std::vector< uint16_t > &vec, S &s)
End delimiter send after each data block.
Configure single FTU board.
void SetClockRegister(const uint64_t reg[])
void bitcpy(T *target, size_t ntarget, const S *source, size_t nsource, size_t ss=0, size_t ts=0)
bool IsActive(int i) const
DimPassport(const Header &h)
Ping all FTUs (get FTU list)
const uint16_t & operator[](int idx) const
Physics trigger decision (PhysicTrigger)
Trigger output enabled, configuration ignored.
Commands
Command codes for FTM communication.
DimFtuList(const Header &h, const FtuList &d)
Number of pings until response (same as in Error)
Error list (error when FTU communication failed)