Belle II Software  release-05-02-19
B2BIIMdstInputModule.h
1 //+
2 // File : B2BIIMdstInputModule.h
3 // Description : A module to read Panther record in basf2 from Belle MDST file
4 //
5 // Author : Ryosuke Itoh, IPNS, KEK
6 // Date : 16 - Feb - 2015
7 //-
8 
9 #pragma once
10 
11 #include <framework/core/Module.h>
12 #include <framework/datastore/DataStore.h>
13 #include <framework/datastore/StoreObjPtr.h>
14 #include <framework/dataobjects/EventMetaData.h>
15 #include <framework/dataobjects/FileMetaData.h>
16 
17 #define BELLE_TARGET_H "belle-x86_64-unknown-linux-gnu-g++.h"
18 #include "belle_legacy/panther/panther.h"
19 #include "belle_legacy/panther/panther_group.h"
20 
21 #include <string>
22 #include <set>
23 
24 namespace Belle2 {
35  class B2BIIMdstInputModule : public Module {
36 
37  // Public functions
38  public:
39 
43  virtual ~B2BIIMdstInputModule() override;
44 
46  virtual void initialize() override;
47 
49  virtual void beginRun() override;
51  virtual void event() override;
53  virtual void endRun() override;
55  virtual void terminate() override;
56 
57  // Data members
58  private:
59 
63  std::vector<std::string> getInputFiles() const;
64 
67  bool openNextFile();
70  bool readNextEvent();
71 
75  void initializeDataStore();
76 
77  //-----------------------------------------------------------------------------
78  // MISC
79  //-----------------------------------------------------------------------------
80 
82  std::string m_inputFileName;
84  std::vector<std::string> m_inputFileNames;
88  std::vector<std::string> m_entrySequences;
89 
91  Belle::Panther_FileIO* m_fd{nullptr};
92 
94  int m_nevt;
95 
98 
101 
104 
107  };
108 
110 } // end namespace Belle2
Belle2::B2BIIMdstInputModule::beginRun
virtual void beginRun() override
Called when a new run is started.
Definition: B2BIIMdstInputModule.cc:159
Belle2::B2BIIMdstInputModule::m_evtMetaData
StoreObjPtr< EventMetaData > m_evtMetaData
event meta data Object pointer
Definition: B2BIIMdstInputModule.h:60
Belle2::B2BIIMdstInputModule::m_valid_entries_in_current_file
std::set< int64_t > m_valid_entries_in_current_file
Entries numbers which are valid for the current file.
Definition: B2BIIMdstInputModule.h:103
Belle2::B2BIIMdstInputModule::~B2BIIMdstInputModule
virtual ~B2BIIMdstInputModule() override
Destructor.
Definition: B2BIIMdstInputModule.cc:85
Belle2::B2BIIMdstInputModule::m_inputFileNames
std::vector< std::string > m_inputFileNames
List of input MDST filenames.
Definition: B2BIIMdstInputModule.h:84
Belle2::B2BIIMdstInputModule
Module reads Belle MDST files and converts Belle_event record to Belle II EventMetaData StoreObjectPo...
Definition: B2BIIMdstInputModule.h:35
Belle2::B2BIIMdstInputModule::terminate
virtual void terminate() override
Terminates the module.
Definition: B2BIIMdstInputModule.cc:323
Belle2::B2BIIMdstInputModule::B2BIIMdstInputModule
B2BIIMdstInputModule()
Constructor.
Definition: B2BIIMdstInputModule.cc:61
Belle2::B2BIIMdstInputModule::openNextFile
bool openNextFile()
Open the next file from the list of files.
Definition: B2BIIMdstInputModule.cc:164
Belle2::B2BIIMdstInputModule::event
virtual void event() override
Called for each event.
Definition: B2BIIMdstInputModule.cc:223
Belle2::B2BIIMdstInputModule::m_current_file_position
int m_current_file_position
File counter.
Definition: B2BIIMdstInputModule.h:97
Belle2::B2BIIMdstInputModule::m_current_file_entry
int m_current_file_entry
Entry counter in current file.
Definition: B2BIIMdstInputModule.h:100
Belle2::B2BIIMdstInputModule::initializeDataStore
void initializeDataStore()
Initializes Belle II DataStore.
Definition: B2BIIMdstInputModule.cc:149
Belle2::Module
Base class for Modules.
Definition: Module.h:74
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::B2BIIMdstInputModule::m_inputFileName
std::string m_inputFileName
Input MDST file name for backwards compatibility.
Definition: B2BIIMdstInputModule.h:82
Belle2::B2BIIMdstInputModule::endRun
virtual void endRun() override
Called when the current run finished.
Definition: B2BIIMdstInputModule.cc:317
Belle2::B2BIIMdstInputModule::getInputFiles
std::vector< std::string > getInputFiles() const
Get list of input files, taking -i command line overrides into account.
Definition: B2BIIMdstInputModule.cc:89
Belle2::B2BIIMdstInputModule::initialize
virtual void initialize() override
Initialize the module.
Definition: B2BIIMdstInputModule.cc:101
Belle2::B2BIIMdstInputModule::readNextEvent
bool readNextEvent()
Read the next event from the currently open file.
Definition: B2BIIMdstInputModule.cc:196
Belle2::DataStore::c_Persistent
@ c_Persistent
Object is available during entire execution time.
Definition: DataStore.h:62
Belle2::B2BIIMdstInputModule::m_fd
Belle::Panther_FileIO * m_fd
PantherFile.
Definition: B2BIIMdstInputModule.h:91
Belle2::B2BIIMdstInputModule::m_entrySequences
std::vector< std::string > m_entrySequences
The number sequences (e.g.
Definition: B2BIIMdstInputModule.h:88
Belle2::B2BIIMdstInputModule::m_nevt
int m_nevt
Global event counter.
Definition: B2BIIMdstInputModule.h:94
Belle2::B2BIIMdstInputModule::m_fileMetadata
StoreObjPtr< FileMetaData > m_fileMetadata
File metadata to declare if we process real data or simulated data.
Definition: B2BIIMdstInputModule.h:106