Belle II Software  release-06-02-00
InputController.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 <string>
12 
13 class TChain;
14 
15 namespace Belle2 {
28  public:
30  static bool canControlInput() { return s_canControlInput; }
31 
33  static void setCanControlInput(bool on) { s_canControlInput = on; }
34 
41  static void setNextEntry(long entry) { s_nextEntry = entry; }
42 
44  static long getNextEntry() { return s_nextEntry; }
45 
50  static void setNextEntry(long exp, long run, long event) { s_nextExperiment = exp; s_nextRun = run; s_nextEvent = event; }
51 
53  static long getNextExperiment() { return s_nextExperiment; }
54 
56  static long getNextRun() { return s_nextRun; }
57 
59  static long getNextEvent() { return s_nextEvent; }
60 
62  static long getCurrentEntry() { return s_currentEntry; }
63 
68  static long numEntries();
69 
71  static std::string getCurrentFileName();
72 
74  static void eventLoaded(long entry)
75  {
76  s_nextEntry = -1;
77  s_nextExperiment = -1;
78  s_nextRun = -1;
79  s_nextEvent = -1;
80  s_currentEntry = entry;
81  }
82 
84  static void setChain(const TChain* chain) { s_chain = chain; }
85 
87  static void resetForChildProcess();
88 
89  private:
90  InputController() { }
91  ~InputController() { }
92 
94  static bool s_canControlInput;
95 
100  static long s_nextEntry;
101 
106  static long s_nextExperiment;
107 
109  static long s_nextRun;
110 
112  static long s_nextEvent;
113 
114 
116  static long s_currentEntry;
117 
119  static const TChain* s_chain;
120  };
122 }
A static class to control supported input modules.
static void setChain(const TChain *chain)
Set the loaded TChain (event durability).
static long getNextEntry()
Return entry number set via setNextEntry().
static const TChain * s_chain
Opened TChain (event durability).
static long getNextRun()
Return run number set via setNextEntry().
static long getNextExperiment()
Return experiment number set via setNextEntry().
static void setNextEntry(long entry)
Set the file entry to be loaded the next time event() is called.
static long numEntries()
Returns total number of entries in the event tree.
static long getCurrentEntry()
returns the entry number currently loaded.
static void resetForChildProcess()
Reset InputController (e.g.
static long s_nextExperiment
Experiment number to load next.
static bool canControlInput()
Is there an input module to be controlled.
static long s_nextEvent
Event (not entry!) to load next.
static long s_currentEntry
current entry in file.
static long s_nextRun
Run number to load next.
static std::string getCurrentFileName()
Return name of current file in loaded chain (or empty string if none loaded).
static long s_nextEntry
entry to be loaded the next time event() is called in an input module.
static void eventLoaded(long entry)
Indicate that an event (in the given entry) was loaded and reset all members related to the next entr...
static void setCanControlInput(bool on)
Call this function from supported input modules.
static bool s_canControlInput
Is there an input module to be controlled?
static long getNextEvent()
Return event number set via setNextEntry().
static void setNextEntry(long exp, long run, long event)
Set the file entry to be loaded the next time event() is called, by evt/run/exp number.
Abstract base class for different kinds of events.