/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Private Member Functions | Private Attributes
DybDaq::DaqRawEvent Class Reference

#include <DaqRawEvent.h>

List of all members.

Public Member Functions

 DaqRawEvent (const uint32_t *event)
virtual ~DaqRawEvent ()
int event_size ()
DaqRomDatanext_rom ()
int second ()
int nanoSecond ()
bool timeRevise ()

Private Member Functions

bool get_time ()
 DaqRawEvent ()

Private Attributes

const uint32_t * m_evt
int m_evtSize
int m_cbltFix
int m_iRom
int m_sec
long m_nSec

Detailed Description

Definition at line 36 of file DaqRawEvent.h.


Constructor & Destructor Documentation

DaqRawEvent::DaqRawEvent ( const uint32_t *  event)

Definition at line 81 of file DaqRawEvent.cc.

    : m_evt(event),
      m_iRom(RawRecordPoolUtil::EVENT_HEADER_SIZE),
      m_sec(-1)
{
    m_evtSize = (m_evt[2]&0xFFFFFF);
    m_cbltFix = (m_evt[7]&0x20000)>>17;
}
DaqRawEvent::~DaqRawEvent ( ) [virtual]

Definition at line 90 of file DaqRawEvent.cc.

{
}
DybDaq::DaqRawEvent::DaqRawEvent ( ) [private]

Member Function Documentation

int DybDaq::DaqRawEvent::event_size ( ) [inline]

Definition at line 43 of file DaqRawEvent.h.

{ return m_evtSize; }
DaqRomData * DaqRawEvent::next_rom ( )

Definition at line 94 of file DaqRawEvent.cc.

{
    DaqRomData* rom = 0;
    while ( rom == 0 && m_iRom < m_evtSize ) {
        rom = new DaqRomData((m_evt+m_iRom), m_cbltFix);
        m_iRom += rom->rom_size();
        if ( rom->rom_size() < 7 ) {
            delete rom;
            rom = 0;
        }
    }
    return rom;
}
int DaqRawEvent::second ( )

Definition at line 108 of file DaqRawEvent.cc.

{
    get_time();
    return m_sec;
}
int DaqRawEvent::nanoSecond ( )

Definition at line 114 of file DaqRawEvent.cc.

{
    get_time();
    return m_nSec;
}
bool DaqRawEvent::timeRevise ( )

Definition at line 120 of file DaqRawEvent.cc.

{
    bool result = false;
    int site = ((m_evt[3]>>20) & 0xF) - 1;
    int detector = ((m_evt[3]>>16) & 0xF) - 1;
    int shift = RawRecordPoolUtil::EVENT_TIME_REVISE[site][detector];
    DaqRomData* rom = next_rom();
    while ( rom != 0 ) {
        if ( rom->is_ltb() ) {
            const uint32_t* ltb = rom->next_ltb();
            while ( ltb != 0 ) {
                uint32_t* time = const_cast<uint32_t*>(ltb + 1);
                int acc = int( (time[3]<<4) | ((time[1]>>20) & 0xF) ) - shift;
                time[3] = ( (time[3]&0xF0000000) | (acc>>4) );
                time[1] = ( (time[1]&0xFF0FFFFF) | ((acc&0xF)<<20) );
                if ( m_sec < 0 ) {
                    m_sec  = ( (time[0] << 16) | (time[1] & 0xFFFF) );
                    m_nSec = int( (time[2] <<  4) | ((time[1]>>16) & 0xF) );
                    m_nSec += acc;  //accumulation
                }
                ltb = rom->next_ltb();
            }
            result = true;
        }
        else if ( rom->is_rtm() ) {
            const uint32_t* rtm = rom->next_rtm();
            while ( rtm != 0 ) {
                uint32_t* time = const_cast<uint32_t*>(rtm + 1);
                time[2] -= shift;
                if ( m_sec < 0 ) {
                    m_sec  = time[0];
                    m_nSec = int(time[1]);
                    m_nSec += int(time[2]);  //accumulation
                }
                rtm = rom->next_rtm();
            }
            result = true;
        }
        delete rom;
        if ( result ) break;
        rom = next_rom();
    }

    if ( result ) {
        if ( m_nSec >= 2000000000 ) {
            ++m_sec;
            m_nSec -= 2000000000;
        }
        else if ( m_nSec < 0 ) {
            --m_sec;
            m_nSec += 2000000000;
        }
    }

    return result;
}
bool DaqRawEvent::get_time ( ) [private]

Definition at line 177 of file DaqRawEvent.cc.

{
    if ( m_sec >= 0 ) return true;

    while ( m_sec < 0 ) {
        DaqRomData* rom = next_rom();
        if ( rom == 0 ) return false;
        if ( rom->is_ltb() ) {
            const uint32_t* ltb = rom->next_ltb();
            const uint32_t* time = ltb + 1;
            m_sec  = ( (time[0] << 16) | (time[1] & 0xFFFF) );
            m_nSec = int( (time[2] <<  4) | ((time[1]>>16) & 0xF) );
            m_nSec += int( (time[3] <<  4) | ((time[1]>>20) & 0xF) );  //accumulation
        }
        else if ( rom->is_rtm() ) {
            const uint32_t* rtm = rom->next_rtm();
            const uint32_t* time = rtm + 1;
            m_sec  = time[0];
            m_nSec = int(time[1]);
            m_nSec += int(time[2]);  //accumulation
        }
        delete rom;
    }

    if ( m_nSec >= 2000000000 ) {
        ++m_sec;
        m_nSec -= 2000000000;
    }
    else if ( m_nSec < 0 ) {
        --m_sec;
        m_nSec += 2000000000;
    }

    return true;
}

Member Data Documentation

const uint32_t* DybDaq::DaqRawEvent::m_evt [private]

Definition at line 57 of file DaqRawEvent.h.

Definition at line 59 of file DaqRawEvent.h.

Definition at line 60 of file DaqRawEvent.h.

Definition at line 61 of file DaqRawEvent.h.

Definition at line 63 of file DaqRawEvent.h.

Definition at line 64 of file DaqRawEvent.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:52:46 for RawRecordPool by doxygen 1.7.4