Belle II Software  release-05-01-25
PXDReadRawONSEN.h
1 //+
2 // File : PXDReadRawONSEN.h
3 // Description : Module to Load Raw PXD Data from ONSEN network-dump file and store it as RawPXD in Data Store
4 // This is meant for lab use (standalone testing, debugging) without an event builder.
5 //
6 // Author : Bjoern Spruck
7 // Date : 15 - Apr - 2014
8 //-
9 
10 #pragma once
11 
12 #include <framework/core/Module.h>
13 #include <framework/pcore/MsgHandler.h>
14 #include <framework/datastore/StoreObjPtr.h>
15 
16 #include <framework/dataobjects/EventMetaData.h>
17 #include <rawdata/dataobjects/RawPXD.h>
18 
19 #include <string>
20 #include <stdlib.h>
21 
22 
23 namespace Belle2 {
29  namespace PXD {
30 
34  class PXDReadRawONSENModule : public Module {
35  enum {MAXEVTSIZE = 4 * 1024 * 1024};
36 
37  // Public functions
38  public:
39 
43 
44 
45  private:
46 
48  void initialize() override final;
49 
51  void event() override final;
52  void terminate() override final;
53 
54 
55  // Data members
56 
59 
63  std::string m_filename;
64 
67 
70 
72  int m_nread;
73 
75  int* m_buffer;
76 
78  FILE* fh;
79 
80  int readOneEvent(void);
81  int read_data(char* data, size_t len);
82  bool getTrigNr(RawPXD& px);
83  bool unpack_dhc_frame(void* data);
84  };
85 
86  } // end namespace PXD
88 } // end namespace Belle2
89 
Belle2::PXD::PXDReadRawONSENModule::m_setEvtMeta
bool m_setEvtMeta
Set Event Meta Info.
Definition: PXDReadRawONSEN.h:61
Belle2::PXD::PXDReadRawONSENModule::m_buffer
int * m_buffer
buffer
Definition: PXDReadRawONSEN.h:75
Belle2::PXD::PXDReadRawONSENModule::getTrigNr
bool getTrigNr(RawPXD &px)
get the trigger number
Definition: PXDReadRawONSEN.cc:171
Belle2::PXD::PXDReadRawONSENModule::fh
FILE * fh
File handle.
Definition: PXDReadRawONSEN.h:78
Belle2::PXD::PXDReadRawONSENModule::unpack_dhc_frame
bool unpack_dhc_frame(void *data)
unpack the dhc frame
Definition: PXDReadRawONSEN.cc:233
Belle2::PXD::PXDReadRawONSENModule::PXDReadRawONSENModule
PXDReadRawONSENModule()
Constructor / Destructor.
Definition: PXDReadRawONSEN.cc:32
Belle2::PXD::PXDReadRawONSENModule::m_eventMetaDataPtr
StoreObjPtr< EventMetaData > m_eventMetaDataPtr
Event Meta Data.
Definition: PXDReadRawONSEN.h:58
Belle2::PXD::PXDReadRawONSENModule::m_compressionLevel
int m_compressionLevel
Compression Level.
Definition: PXDReadRawONSEN.h:69
Belle2::PXD::PXDReadRawONSENModule::m_msghandler
MsgHandler * m_msghandler
Message handler.
Definition: PXDReadRawONSEN.h:66
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::RawPXD
The Raw PXD class.
Definition: RawPXD.h:28
Belle2::PXD::PXDReadRawONSENModule::m_nread
int m_nread
No. of sent events.
Definition: PXDReadRawONSEN.h:72
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::StoreObjPtr
Type-safe access to single objects in the data store.
Definition: ParticleList.h:33
Belle2::PXD::PXDReadRawONSENModule::initialize
void initialize() override final
Module functions to be called from main process.
Definition: PXDReadRawONSEN.cc:57
Belle2::PXD::PXDReadRawONSENModule::read_data
int read_data(char *data, size_t len)
Read amount of data (len bytes) from file to ptr data.
Definition: PXDReadRawONSEN.cc:81
Belle2::PXD::PXDReadRawONSENModule::readOneEvent
int readOneEvent(void)
Read data of one Event from File.
Definition: PXDReadRawONSEN.cc:89
Belle2::PXD::PXDReadRawONSENModule
A class definition of an input module for Sequential ROOT I/O.
Definition: PXDReadRawONSEN.h:34
Belle2::PXD::PXDReadRawONSENModule::terminate
void terminate() override final
This method is called at the end of the event processing.
Definition: PXDReadRawONSEN.cc:164
Belle2::PXD::PXDReadRawONSENModule::event
void event() override final
Module functions to be called from event process.
Definition: PXDReadRawONSEN.cc:126
Belle2::PXD::PXDReadRawONSENModule::m_filename
std::string m_filename
File Name.
Definition: PXDReadRawONSEN.h:63
Belle2::MsgHandler
A class to encode/decode an EvtMessage.
Definition: MsgHandler.h:104