Belle II Software  release-05-02-19
InputController.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2012 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Christian Pulvermacher *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <string>
14 
15 class TChain;
16 
17 namespace Belle2 {
30  public:
32  static bool canControlInput() { return s_canControlInput; }
33 
35  static void setCanControlInput(bool on) { s_canControlInput = on; }
36 
43  static void setNextEntry(long entry) { s_nextEntry = entry; }
44 
46  static long getNextEntry() { return s_nextEntry; }
47 
52  static void setNextEntry(long exp, long run, long event) { s_nextExperiment = exp; s_nextRun = run; s_nextEvent = event; }
53 
55  static long getNextExperiment() { return s_nextExperiment; }
56 
58  static long getNextRun() { return s_nextRun; }
59 
61  static long getNextEvent() { return s_nextEvent; }
62 
64  static long getCurrentEntry() { return s_currentEntry; }
65 
70  static long numEntries();
71 
73  static std::string getCurrentFileName();
74 
76  static void eventLoaded(long entry)
77  {
78  s_nextEntry = -1;
79  s_nextExperiment = -1;
80  s_nextRun = -1;
81  s_nextEvent = -1;
82  s_currentEntry = entry;
83  }
84 
86  static void setChain(const TChain* chain) { s_chain = chain; }
87 
89  static void resetForChildProcess();
90 
91  private:
92  InputController() { }
93  ~InputController() { }
94 
96  static bool s_canControlInput;
97 
102  static long s_nextEntry;
103 
108  static long s_nextExperiment;
109 
111  static long s_nextRun;
112 
114  static long s_nextEvent;
115 
116 
118  static long s_currentEntry;
119 
121  static const TChain* s_chain;
122  };
124 }
Belle2::InputController::eventLoaded
static void eventLoaded(long entry)
Indicate that an event (in the given entry) was loaded and reset all members related to the next entr...
Definition: InputController.h:76
Belle2::InputController::setChain
static void setChain(const TChain *chain)
Set the loaded TChain (event durability).
Definition: InputController.h:86
Belle2::InputController::getNextEvent
static long getNextEvent()
Return event number set via setNextEntry().
Definition: InputController.h:61
Belle2::InputController::getNextExperiment
static long getNextExperiment()
Return experiment number set via setNextEntry().
Definition: InputController.h:55
Belle2::InputController::resetForChildProcess
static void resetForChildProcess()
Reset InputController (e.g.
Definition: InputController.cc:16
Belle2::InputController::getNextEntry
static long getNextEntry()
Return entry number set via setNextEntry().
Definition: InputController.h:46
Belle2::InputController::setNextEntry
static void setNextEntry(long entry)
Set the file entry to be loaded the next time event() is called.
Definition: InputController.h:43
Belle2::InputController::setCanControlInput
static void setCanControlInput(bool on)
Call this function from supported input modules.
Definition: InputController.h:35
Belle2::InputController::s_nextEntry
static long s_nextEntry
entry to be loaded the next time event() is called in an input module.
Definition: InputController.h:102
Belle2::InputController::s_nextExperiment
static long s_nextExperiment
Experiment number to load next.
Definition: InputController.h:108
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::InputController::getNextRun
static long getNextRun()
Return run number set via setNextEntry().
Definition: InputController.h:58
Belle2::InputController::s_nextEvent
static long s_nextEvent
Event (not entry!) to load next.
Definition: InputController.h:114
Belle2::InputController::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.
Definition: InputController.h:52
Belle2::InputController::s_currentEntry
static long s_currentEntry
current entry in file.
Definition: InputController.h:118
Belle2::InputController
A static class to control supported input modules.
Definition: InputController.h:29
Belle2::InputController::s_chain
static const TChain * s_chain
Opened TChain (event durability).
Definition: InputController.h:121
Belle2::InputController::numEntries
static long numEntries()
Returns total number of entries in the event tree.
Definition: InputController.cc:39
Belle2::InputController::s_canControlInput
static bool s_canControlInput
Is there an input module to be controlled?
Definition: InputController.h:96
Belle2::InputController::getCurrentFileName
static std::string getCurrentFileName()
Return name of current file in loaded chain (or empty string if none loaded).
Definition: InputController.cc:27
Belle2::InputController::getCurrentEntry
static long getCurrentEntry()
returns the entry number currently loaded.
Definition: InputController.h:64
Belle2::InputController::s_nextRun
static long s_nextRun
Run number to load next.
Definition: InputController.h:111
Belle2::InputController::canControlInput
static bool canControlInput()
Is there an input module to be controlled.
Definition: InputController.h:32