Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Digitization

Each EPU creates a self-contained stream of LSEP datagrams segmented into CCSDS packets. In order to reconstruct the complete sequence of events read out from the detector, it is necessary to merge these streams at the event level. Some prototype code has been implemented to perform this function, making use of the following underlying utilities:

  • The RawArchive library to retrieve CCSDS packets for a specified timespan
  • the DFI library to assemble and parse the LSEP datagrams
  • the LDF library to extract the low-level contribution data from each event.

The prototype code implements an EventMerger object with the following declaration:

Code Block

  class EventMerger {
  public:
    typedef void (*valcb_t)( const LDFContext&, const LDFData&, void* );
    EventMerger( const std::vector< RetDef >& rets, int src, const std::string& archroot, valcb_t valCB, void* cbData );
    ~EventMerger();
    void merge();

  private:
    void operator()();
    static void* threadCB( void* tdata );

    MergeState* m_mstate;
    std::vector< EventRetriever* > m_readers;
    std::vector< pthread_t* > m_threads;
    valcb_t m_valCB;
    void* m_cbData;
  };

This object is constructed from the following items:

  • a vector of RetDef objects (which define the CCSDS APIDS and timespans to be retrieved)
  • a source id (which defines the entity which created the CCSDS data)
  • a disk location for the root of the packet archive,
  • a user-specified function obeying the "valcb_t" prototype to receive the event and context data
  • a pointer to a user-defined argument to the callback function

As each event in the merged stream becomes available, the EventMerger will call the user-defined function with objects containing the context and data for that event.

An example of usage is as follows:

Code Block

void valCB( const LPAMerge::LDFContext& ctx, const LPAMerge::LDFData& ldf, void* userData )
{
  printf( "==========================================\n" );
  printf( "\nEvent %d context:\n", ctx.scalers.sequence );
  ctx.dump();

  printf( "\nEvent %d data:\n", ctx.scalers.sequence );
  MyEBFeventIterator eei;
  eei.iterate( const_cast< EBFevent* >( ldf.start() ), 
	       const_cast< EBFevent* >( ldf.end() ) );
  printf( "\n" );
}

int main( int argc, char* argv[] )
{
  std::vector< LPAMerge::RetDef > rets;
  rets.push_back( LPAMerge::RetDef( 955, 1137447000.0, 1137447160.0 ) );
  rets.push_back( LPAMerge::RetDef( 956, 1137447000.0, 1137447160.0 ) );

  LPAMerge::EventMerger em( rets, 99, "./arch", valCB, NULL );
  em.merge();
}

The first part of the sample output for this program is as follows (the LDF dump has been truncated):

...

Merging Event Streams