Belle II Software  release-06-00-14
InputController.cc
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 #include <framework/core/InputController.h>
9 
10 #include <TChain.h>
11 #include <TFile.h>
12 
13 using namespace Belle2;
14 
21 const TChain* InputController::s_chain = nullptr;
22 
24 {
25  s_canControlInput = false;
26  s_nextEntry = -1;
27  s_nextExperiment = -1;
28  s_nextRun = -1;
29  s_nextEvent = -1;
30  s_currentEntry = 0;
31  //s_chain is not touched, so numEntries() still works
32 }
33 
35 {
36  if (!s_chain)
37  return "";
38 
39  const TFile* f = s_chain->GetFile();
40  if (!f)
41  return "";
42 
43  return f->GetName();
44 }
45 
47 {
48  if (s_chain)
49  return s_chain->GetEntries();
50 
51  return 0;
52 }
static const TChain * s_chain
Opened TChain (event durability).
static long numEntries()
Returns total number of entries in the event tree.
static void resetForChildProcess()
Reset InputController (e.g.
static long s_nextExperiment
Experiment number to load next.
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 bool s_canControlInput
Is there an input module to be controlled?
Abstract base class for different kinds of events.