Belle II Software  release-08-01-10
PXDReadRawBonnDAQMatched.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 #include <framework/core/Module.h>
12 #include <framework/datastore/StoreObjPtr.h>
13 #include <framework/datastore/StoreArray.h>
14 
15 #include <framework/dataobjects/EventMetaData.h>
16 #include <rawdata/dataobjects/RawPXD.h>
17 
18 #include <string>
19 #include <map>
20 #include <stdlib.h>
21 
22 
23 namespace Belle2 {
29  namespace PXD {
30 
35  class PXDReadRawBonnDAQMatchedModule final : public Module {
36  enum {MAXEVTSIZE = 4 * 1024 * 1024 + 256 * 4 + 16};
37  // Public functions
38  public:
39 
42 
43  private:
44 
45  ~PXDReadRawBonnDAQMatchedModule() override final;
46 
48  void initialize() override final;
49 
51  void event() override final;
52 
54  void terminate() override final;
55 
56  // Data members
57 
58  // Parallel processing parameters
59 
62 
65 
67  std::string m_filename;
68 
69  std::string m_RawPXDsName;
72  int* m_buffer;
73 
75  FILE* fh;
76 
77  int readOneEvent(unsigned int& tnr);
78  int read_data(char* data, size_t len);
79 
80  std::map <unsigned int, off_t> m_event_offset;
81  off_t m_last_offset{0};
82  };
83 
84  } // end namespace PXD
86 } // end namespace Belle2
Base class for Modules.
Definition: Module.h:72
Module to Load BonnDAQ file and store it as RawPXD in Data Store This is meant for lab use (standalon...
std::map< unsigned int, off_t > m_event_offset
map event nr to offsets
int read_data(char *data, size_t len)
Read amount of data (len bytes) from file to ptr data.
std::string m_RawPXDsName
The name of the StoreArray RawPXDs to create.
int readOneEvent(unsigned int &tnr)
Read event and store it in datastore if trigger nr matches.
StoreObjPtr< EventMetaData > m_eventMetaDataPtr
Event Meta Data.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Abstract base class for different kinds of events.