Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
KM3NETDAQ::JDAQSummaryFrame Class Reference

Data storage class for rate measurements of all PMTs in one module. More...

#include <JDAQSummaryFrame.hh>

Inheritance diagram for KM3NETDAQ::JDAQSummaryFrame:
KM3NETDAQ::JDAQModuleIdentifier KM3NETDAQ::JDAQFrameStatus

Public Types

typedef JDAQRate::JRate_t JRate_t
 

Public Member Functions

 JDAQSummaryFrame ()
 Default constructor.
 
 JDAQSummaryFrame (const JDAQModuleIdentifier &id)
 Constructor.
 
 JDAQSummaryFrame (const JDAQSuperFrame &input)
 Constructor.
 
const JDAQRateoperator[] (const int tdc) const
 Get DAQ rate of given PMT.
 
JDAQRateoperator[] (const int tdc)
 Get DAQ rate of given PMT.
 
JRate_t getValue (const int tdc) const
 Get value.
 
double getRate (const int tdc, const double factor=1.0) const
 Get count rate.
 
double getWeight (const int tdc, const double factor=1.0) const
 Get weight.
 
void setRate (const int tdc, const double rate_Hz)
 Set count rate.
 
 ClassDefNV (JDAQSummaryFrame, 2)
 
const JDAQModuleIdentifiergetModuleIdentifier () const
 Get Module identifier.
 
void setModuleIdentifier (const JDAQModuleIdentifier &module)
 Set Module identifier.
 
int getModuleID () const
 Get module identifier.
 
 ClassDefNV (JDAQModuleIdentifier, 1)
 
const JDAQFrameStatusgetDAQFrameStatus () const
 Get DAQ frame status.
 
void setDAQFrameStatus (const JDAQFrameStatus &status)
 Set DAQ frame status.
 
int getDAQStatus () const
 Get DAQ status.
 
int getStatus () const
 Get TDC and White Rabbit status.
 
int getFIFOStatus () const
 Get FIFO status.
 
bool testDAQStatus () const
 Test DAQ status of packets.
 
bool testStatus () const
 Test TDC and White Rabbit status.
 
int getUDPNumberOfReceivedPackets () const
 Get number of received UDP packets.
 
int getUDPMaximalSequenceNumber () const
 Get maximal sequence number of UDP packet.
 
bool testWhiteRabbitStatus () const
 Test White Rabbit status.
 
bool testTDCStatus () const
 Test TDC status.
 
bool testHighRateVeto () const
 Test high-rate veto status.
 
bool testHighRateVeto (const int tdc) const
 Test high-rate veto status.
 
int countHighRateVeto () const
 Count high-rate veto status.
 
bool testFIFOStatus () const
 Test FIFO status.
 
bool testFIFOStatus (const int tdc) const
 Test FIFO status.
 
int countFIFOStatus () const
 Count FIFO status.
 
int countActiveChannels () const
 Count active channels.
 
bool hasUDPTrailer () const
 Get UDP trailer status.
 
void setHighRateVeto (const int tdc, const bool value)
 Set high-rate veto.
 
 ClassDefNV (JDAQFrameStatus, 1)
 

Static Public Member Functions

static const JDAQFrameStatusgetInstance ()
 Get reference to unique instance of this class object.
 

Static Public Attributes

static int ROOT_IO_VERSION = -1
 Streamer version of JDAQSummaryslice as obtained from ROOT file.
 

Protected Attributes

JDAQRate data [NUMBER_OF_PMTS]
 
int id
 
int daq
 
int status
 
int fifo
 
int status_3
 
int status_4
 

Friends

size_t getSizeof ()
 Definition of method to get size of data type.
 
JReaderoperator>> (JReader &in, JDAQSummaryFrame &summary)
 Read DAQ summary frame from input.
 
JWriteroperator<< (JWriter &out, const JDAQSummaryFrame &summary)
 Write DAQ summary frame to output.
 

Detailed Description

Data storage class for rate measurements of all PMTs in one module.

Definition at line 332 of file JDAQSummaryFrame.hh.

Member Typedef Documentation

◆ JRate_t

Constructor & Destructor Documentation

◆ JDAQSummaryFrame() [1/3]

KM3NETDAQ::JDAQSummaryFrame::JDAQSummaryFrame ( )
inline

Default constructor.

Definition at line 347 of file JDAQSummaryFrame.hh.

347 :
350 {}
JDAQFrameStatus()
Default constructor.
JDAQModuleIdentifier()
Default constructor.

◆ JDAQSummaryFrame() [2/3]

KM3NETDAQ::JDAQSummaryFrame::JDAQSummaryFrame ( const JDAQModuleIdentifier & id)
inline

Constructor.

Parameters
idmodule identifier

Definition at line 358 of file JDAQSummaryFrame.hh.

358 :
361 {}
static const JDAQFrameStatus & getInstance()
Get reference to unique instance of this class object.

◆ JDAQSummaryFrame() [3/3]

KM3NETDAQ::JDAQSummaryFrame::JDAQSummaryFrame ( const JDAQSuperFrame & input)
inline

Constructor.

Note that normally the rate is set to the number of hits per unit frame time but if either the high-rate veto or FIFO (almost) full bit is on, the rate is set to the number of hits divided by the time of the last hit.

Parameters
inputsuper frame

Definition at line 373 of file JDAQSummaryFrame.hh.

373 :
376 {
377 using namespace std;
378
379 typedef JDAQHit::JPMT_t JPMT_t;
380 typedef JDAQHit::JTDC_t JTDC_t;
381
382 vector<int> counter(numeric_limits<JPMT_t>::max(), 0);
383
384 int n = input.size();
385
386 for (JDAQSuperFrame::const_iterator i = input.begin(); n != 0; --n, ++i) {
387 ++counter[i->getPMT()];
388 }
389
390 for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
391 data[i].setValue(counter[i], getFrameTime());
392 }
393
394 if (input.testHighRateVeto() || input.testFIFOStatus()) {
395
396 // determine last hit for each PMT
397
398 vector<JTDC_t> limit(numeric_limits<JPMT_t>::max(), 0);
399
400 int n = input.size();
401
402 for (JDAQSuperFrame::const_iterator i = input.begin(); n != 0; --n, ++i) {
403 if (i->getT() > limit[i->getPMT()]) {
404 limit[i->getPMT()] = i->getT();
405 }
406 }
407
408 for (int i = 0; i != NUMBER_OF_PMTS; ++i) {
409 if (input.testHighRateVeto(i) || input.testFIFOStatus(i)) {
410 if (limit[i] != 0) {
411 data[i].setValue((double) counter[i] * 1.0e9 / (double) limit[i]);
412 }
413 }
414 }
415 }
416 }
bool testFIFOStatus() const
Test FIFO status.
const JDAQFrameStatus & getDAQFrameStatus() const
Get DAQ frame status.
bool testHighRateVeto() const
Test high-rate veto status.
const_iterator begin() const
Definition JDAQFrame.hh:165
Hit data structure.
Definition JDAQHit.hh:35
unsigned int JTDC_t
leading edge [ns]
Definition JDAQHit.hh:39
unsigned char JPMT_t
PMT channel in FPGA.
Definition JDAQHit.hh:38
int getModuleID() const
Get module identifier.
void setValue(const int numberOfHits, const double frameTime_ns)
Set value.
JDAQRate data[NUMBER_OF_PMTS]
const int n
Definition JPolint.hh:791
double getFrameTime()
Get frame time duration.
Definition JDAQClock.hh:162
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition JDAQ.hh:26
Auxiliary class for TDC constraints.
Definition JTDC_t.hh:39

Member Function Documentation

◆ operator[]() [1/2]

const JDAQRate & KM3NETDAQ::JDAQSummaryFrame::operator[] ( const int tdc) const
inline

Get DAQ rate of given PMT.

Parameters
tdcTDC
Returns
JDAQRate

Definition at line 425 of file JDAQSummaryFrame.hh.

426 {
427 if (tdc >= 0 && tdc < NUMBER_OF_PMTS)
428 return data[tdc];
429 else
430 throw JDAQException("TDC out of range.");
431 }
General exception.

◆ operator[]() [2/2]

JDAQRate & KM3NETDAQ::JDAQSummaryFrame::operator[] ( const int tdc)
inline

Get DAQ rate of given PMT.

Parameters
tdcTDC
Returns
JDAQRate

Definition at line 440 of file JDAQSummaryFrame.hh.

441 {
442 if (tdc >= 0 && tdc < NUMBER_OF_PMTS)
443 return data[tdc];
444 else
445 throw JDAQException("TDC out of range.");
446 }

◆ getValue()

JRate_t KM3NETDAQ::JDAQSummaryFrame::getValue ( const int tdc) const
inline

Get value.

Parameters
tdcTDC
Returns
value

Definition at line 455 of file JDAQSummaryFrame.hh.

456 {
457 return data[tdc].getValue();
458 }
static JRate_t getValue(const int numberOfHits, const double frameTime_ns)
Get value.

◆ getRate()

double KM3NETDAQ::JDAQSummaryFrame::getRate ( const int tdc,
const double factor = 1.0 ) const
inline

Get count rate.

Parameters
tdcTDC
factorscaling factor
Returns
rate x scaling factor [Hz]

Definition at line 468 of file JDAQSummaryFrame.hh.

469 {
470 return data[tdc].getRate() * factor;
471 }
static double getRate(const JRate_t value)
Get count rate.

◆ getWeight()

double KM3NETDAQ::JDAQSummaryFrame::getWeight ( const int tdc,
const double factor = 1.0 ) const
inline

Get weight.

Parameters
tdcTDC
factorscaling factor
Returns
weight / scaling factor [Hz^-1]

Definition at line 481 of file JDAQSummaryFrame.hh.

482 {
483 return data[tdc].getWeight() / factor;
484 }
static double getWeight(const JRate_t value)
Get weight.

◆ setRate()

void KM3NETDAQ::JDAQSummaryFrame::setRate ( const int tdc,
const double rate_Hz )
inline

Set count rate.

Parameters
tdcTDC
rate_Hzrate [Hz]

Definition at line 493 of file JDAQSummaryFrame.hh.

494 {
495 return data[tdc].setValue(rate_Hz);
496 }

◆ ClassDefNV() [1/3]

KM3NETDAQ::JDAQSummaryFrame::ClassDefNV ( JDAQSummaryFrame ,
2  )

◆ getModuleIdentifier()

const JDAQModuleIdentifier & KM3NETDAQ::JDAQModuleIdentifier::getModuleIdentifier ( ) const
inlineinherited

Get Module identifier.

Returns
Module identifier

Definition at line 50 of file JDAQModuleIdentifier.hh.

51 {
52 return *this;
53 }

◆ setModuleIdentifier()

void KM3NETDAQ::JDAQModuleIdentifier::setModuleIdentifier ( const JDAQModuleIdentifier & module)
inlineinherited

Set Module identifier.

Parameters
moduleModule identifier

Definition at line 61 of file JDAQModuleIdentifier.hh.

62 {
63 *this = module;
64 }

◆ getModuleID()

int KM3NETDAQ::JDAQModuleIdentifier::getModuleID ( ) const
inlineinherited

Get module identifier.

Returns
module identifier

Definition at line 72 of file JDAQModuleIdentifier.hh.

◆ ClassDefNV() [2/3]

KM3NETDAQ::JDAQModuleIdentifier::ClassDefNV ( JDAQModuleIdentifier ,
1  )
inherited

◆ getInstance()

static const JDAQFrameStatus & KM3NETDAQ::JDAQFrameStatus::getInstance ( )
inlinestaticinherited

Get reference to unique instance of this class object.

This instance has default values which correspond to a valid DAQ frame status.

Returns
reference to this class object

Definition at line 65 of file JDAQFrameStatus.hh.

66 {
70
71 return status;
72 }
static const JBits DAQ_UDP_RECEIVED_PACKETS(0, 15)
Mask of UDP received packets.
static const JBits DAQ_UDP_SEQUENCE_NUMBER(16, 31)
Mask of UDP sequence number.
static const JBits DAQ_FIFO(0, 30)
FIFO almost full bits.
static const JBit DAQ_WHITE_RABBIT(31)
White Rabbit status.
static const JBit DAQ_UDP_TRAILER(31)
UDP trailer.
int write(const int value) const
Write given value as bit mask.
Definition JDAQ.hh:115
int write(const int value) const
Write given value as bit mask.
Definition JDAQ.hh:238

◆ getDAQFrameStatus()

const JDAQFrameStatus & KM3NETDAQ::JDAQFrameStatus::getDAQFrameStatus ( ) const
inlineinherited

Get DAQ frame status.

Returns
DAQ frame status

Definition at line 80 of file JDAQFrameStatus.hh.

81 {
82 return static_cast<const JDAQFrameStatus&>(*this);
83 }

◆ setDAQFrameStatus()

void KM3NETDAQ::JDAQFrameStatus::setDAQFrameStatus ( const JDAQFrameStatus & status)
inlineinherited

Set DAQ frame status.

Parameters
statusDAQ frame status

Definition at line 91 of file JDAQFrameStatus.hh.

92 {
93 static_cast<JDAQFrameStatus&>(*this) = status;
94 }

◆ getDAQStatus()

int KM3NETDAQ::JDAQFrameStatus::getDAQStatus ( ) const
inlineinherited

Get DAQ status.

Returns
DAQ status

Definition at line 102 of file JDAQFrameStatus.hh.

103 {
104 return this->daq;
105 }

◆ getStatus()

int KM3NETDAQ::JDAQFrameStatus::getStatus ( ) const
inlineinherited

Get TDC and White Rabbit status.

Returns
status

Definition at line 113 of file JDAQFrameStatus.hh.

114 {
115 return this->status;
116 }

◆ getFIFOStatus()

int KM3NETDAQ::JDAQFrameStatus::getFIFOStatus ( ) const
inlineinherited

Get FIFO status.

Returns
FIFO status

Definition at line 124 of file JDAQFrameStatus.hh.

125 {
126 return this->fifo;
127 }

◆ testDAQStatus()

bool KM3NETDAQ::JDAQFrameStatus::testDAQStatus ( ) const
inlineinherited

Test DAQ status of packets.

Returns
true if okay; else false

Definition at line 135 of file JDAQFrameStatus.hh.

136 {
138 }
int getUDPNumberOfReceivedPackets() const
Get number of received UDP packets.
bool hasUDPTrailer() const
Get UDP trailer status.
int getUDPMaximalSequenceNumber() const
Get maximal sequence number of UDP packet.

◆ testStatus()

bool KM3NETDAQ::JDAQFrameStatus::testStatus ( ) const
inlineinherited

Test TDC and White Rabbit status.

Returns
true if okay; else false

Definition at line 146 of file JDAQFrameStatus.hh.

147 {
149 }
bool testTDCStatus() const
Test TDC status.
bool testWhiteRabbitStatus() const
Test White Rabbit status.

◆ getUDPNumberOfReceivedPackets()

int KM3NETDAQ::JDAQFrameStatus::getUDPNumberOfReceivedPackets ( ) const
inlineinherited

Get number of received UDP packets.

Returns
UDP received packets

Definition at line 157 of file JDAQFrameStatus.hh.

158 {
159 return DAQ_UDP_RECEIVED_PACKETS.read(this->daq);
160 }
int read(const int mask) const
Read given bit mask as value.
Definition JDAQ.hh:250

◆ getUDPMaximalSequenceNumber()

int KM3NETDAQ::JDAQFrameStatus::getUDPMaximalSequenceNumber ( ) const
inlineinherited

Get maximal sequence number of UDP packet.

Returns
UDP sequence number

Definition at line 168 of file JDAQFrameStatus.hh.

169 {
170 return DAQ_UDP_SEQUENCE_NUMBER.read(this->daq);
171 }

◆ testWhiteRabbitStatus()

bool KM3NETDAQ::JDAQFrameStatus::testWhiteRabbitStatus ( ) const
inlineinherited

Test White Rabbit status.

Returns
true if okay; else false

Definition at line 179 of file JDAQFrameStatus.hh.

180 {
181 return DAQ_WHITE_RABBIT.has(this->status);
182 }
bool has(const int mask) const
Test bit.
Definition JDAQ.hh:139

◆ testTDCStatus()

bool KM3NETDAQ::JDAQFrameStatus::testTDCStatus ( ) const
inlineinherited

Test TDC status.

Returns
true if okay; else false

Definition at line 190 of file JDAQFrameStatus.hh.

191 {
192 return !testHighRateVeto();
193 }

◆ testHighRateVeto() [1/2]

bool KM3NETDAQ::JDAQFrameStatus::testHighRateVeto ( ) const
inlineinherited

Test high-rate veto status.

Returns
true if one of the TDCs is high-rate vetoed; else false

Definition at line 201 of file JDAQFrameStatus.hh.

202 {
203 return DAQ_TDC.has(this->status);
204 }
static const JBits DAQ_TDC(0, 30)
TDC high-rate veto status.
bool has(const int mask) const
Test bit mask.
Definition JDAQ.hh:262

◆ testHighRateVeto() [2/2]

bool KM3NETDAQ::JDAQFrameStatus::testHighRateVeto ( const int tdc) const
inlineinherited

Test high-rate veto status.

Parameters
tdcTDC
Returns
true if TDC is high-rate vetoed; else false

Definition at line 213 of file JDAQFrameStatus.hh.

214 {
215 return JBit(tdc).has(this->status);
216 }
Auxiliary data structure for single bit.
Definition JDAQ.hh:36

◆ countHighRateVeto()

int KM3NETDAQ::JDAQFrameStatus::countHighRateVeto ( ) const
inlineinherited

Count high-rate veto status.

Returns
number of the TDCs with high-rate veto

Definition at line 224 of file JDAQFrameStatus.hh.

225 {
226 int n = 0;
227
228 if (testHighRateVeto()) {
229 for (int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
230 if (JBit(pmt).has(this->status)) {
231 ++n;
232 }
233 }
234 }
235
236 return n;
237 }

◆ testFIFOStatus() [1/2]

bool KM3NETDAQ::JDAQFrameStatus::testFIFOStatus ( ) const
inlineinherited

Test FIFO status.

Returns
true if one of the TDCs has FIFO almost full; else false

Definition at line 245 of file JDAQFrameStatus.hh.

246 {
247 return DAQ_FIFO.has(this->fifo);
248 }

◆ testFIFOStatus() [2/2]

bool KM3NETDAQ::JDAQFrameStatus::testFIFOStatus ( const int tdc) const
inlineinherited

Test FIFO status.

Parameters
tdcTDC
Returns
true if FIFO is almost full; else false

Definition at line 257 of file JDAQFrameStatus.hh.

258 {
259 return JBit(tdc).has(this->fifo);
260 }

◆ countFIFOStatus()

int KM3NETDAQ::JDAQFrameStatus::countFIFOStatus ( ) const
inlineinherited

Count FIFO status.

Returns
number of the TDCs with FIFO almost full

Definition at line 268 of file JDAQFrameStatus.hh.

269 {
270 int n = 0;
271
272 if (testFIFOStatus()) {
273 for (int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
274 if (JBit(pmt).has(this->fifo)) {
275 ++n;
276 }
277 }
278 }
279
280 return n;
281 }

◆ countActiveChannels()

int KM3NETDAQ::JDAQFrameStatus::countActiveChannels ( ) const
inlineinherited

Count active channels.

Returns
number of TDCs without high rate veto or FIFO almost full

Definition at line 287 of file JDAQFrameStatus.hh.

288 {
289 int n = NUMBER_OF_PMTS;
290
291 if (testHighRateVeto() || testFIFOStatus()) {
292 for (int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
293 if ( JBit(pmt).has(this->status) || JBit(pmt).has(this->fifo) ) {
294 --n;
295 }
296 }
297 }
298
299 return n;
300
301 }

◆ hasUDPTrailer()

bool KM3NETDAQ::JDAQFrameStatus::hasUDPTrailer ( ) const
inlineinherited

Get UDP trailer status.

Returns
true if UDP trailer present; else false

Definition at line 309 of file JDAQFrameStatus.hh.

310 {
311 return DAQ_UDP_TRAILER.has(this->fifo);
312 }

◆ setHighRateVeto()

void KM3NETDAQ::JDAQFrameStatus::setHighRateVeto ( const int tdc,
const bool value )
inlineinherited

Set high-rate veto.

Parameters
tdcTDC
valuevalue

Definition at line 321 of file JDAQFrameStatus.hh.

322 {
323 JBit(tdc).set(this->status, value);
324 }
void set(int &mask) const
Set bit in given bit mask.
Definition JDAQ.hh:77

◆ ClassDefNV() [3/3]

KM3NETDAQ::JDAQFrameStatus::ClassDefNV ( JDAQFrameStatus ,
1  )
inherited

Friends And Related Symbol Documentation

◆ getSizeof

size_t getSizeof ( )
friend

Definition of method to get size of data type.

This method should be specialised for each desired data type with fixed length.

Returns
number of bytes

◆ operator>>

JReader & operator>> ( JReader & in,
JDAQSummaryFrame & summary )
friend

Read DAQ summary frame from input.

Parameters
inreader
summaryDAQ summary frame
Returns
reader

Definition at line 37 of file JDAQSummaryFrameIO.hh.

38 {
39 in >> static_cast<JDAQModuleIdentifier&>(summary);
40 in >> static_cast<JDAQFrameStatus&> (summary);
41
42 in.read((char*) summary.data, NUMBER_OF_PMTS * sizeof(JDAQRate::JRate_t));
43
44 return in;
45 }
virtual int read(char *buffer, const int length)=0
Read byte array.

◆ operator<<

JWriter & operator<< ( JWriter & out,
const JDAQSummaryFrame & summary )
friend

Write DAQ summary frame to output.

Parameters
outwriter
summaryDAQ summary frame
Returns
writer

Definition at line 55 of file JDAQSummaryFrameIO.hh.

56 {
57 out << static_cast<const JDAQModuleIdentifier&>(summary);
58 out << static_cast<const JDAQFrameStatus&> (summary);
59
60 out.write((char*) summary.data, NUMBER_OF_PMTS * sizeof(JDAQRate::JRate_t));
61
62 return out;
63 }
virtual int write(const char *buffer, const int length)=0
Write byte array.

Member Data Documentation

◆ ROOT_IO_VERSION

int KM3NETDAQ::JDAQSummaryFrame::ROOT_IO_VERSION = -1
static

Streamer version of JDAQSummaryslice as obtained from ROOT file.

Author
mdejong

Definition at line 499 of file JDAQSummaryFrame.hh.

◆ data

JDAQRate KM3NETDAQ::JDAQSummaryFrame::data[NUMBER_OF_PMTS]
protected

Definition at line 507 of file JDAQSummaryFrame.hh.

◆ id

int KM3NETDAQ::JDAQModuleIdentifier::id
protectedinherited

Definition at line 112 of file JDAQModuleIdentifier.hh.

◆ daq

int KM3NETDAQ::JDAQFrameStatus::daq
protectedinherited

Definition at line 330 of file JDAQFrameStatus.hh.

◆ status

int KM3NETDAQ::JDAQFrameStatus::status
protectedinherited

Definition at line 331 of file JDAQFrameStatus.hh.

◆ fifo

int KM3NETDAQ::JDAQFrameStatus::fifo
protectedinherited

Definition at line 332 of file JDAQFrameStatus.hh.

◆ status_3

int KM3NETDAQ::JDAQFrameStatus::status_3
protectedinherited

Definition at line 333 of file JDAQFrameStatus.hh.

◆ status_4

int KM3NETDAQ::JDAQFrameStatus::status_4
protectedinherited

Definition at line 334 of file JDAQFrameStatus.hh.


The documentation for this class was generated from the following files: