Belle II Software  release-06-01-15
InputController Class Reference

A static class to control supported input modules. More...

#include <InputController.h>

Collaboration diagram for InputController:

Static Public Member Functions

static bool canControlInput ()
 Is there an input module to be controlled.
 
static void setCanControlInput (bool on)
 Call this function from supported input modules.
 
static void setNextEntry (long entry)
 Set the file entry to be loaded the next time event() is called. More...
 
static long getNextEntry ()
 Return entry 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. More...
 
static long getNextExperiment ()
 Return experiment number set via setNextEntry().
 
static long getNextRun ()
 Return run number set via setNextEntry().
 
static long getNextEvent ()
 Return event number set via setNextEntry().
 
static long getCurrentEntry ()
 returns the entry number currently loaded.
 
static long numEntries ()
 Returns total number of entries in the event tree. More...
 
static std::string getCurrentFileName ()
 Return name of current file in loaded chain (or empty string if none loaded).
 
static void eventLoaded (long entry)
 Indicate that an event (in the given entry) was loaded and reset all members related to the next entry.
 
static void setChain (const TChain *chain)
 Set the loaded TChain (event durability).
 
static void resetForChildProcess ()
 Reset InputController (e.g. More...
 

Static Private Attributes

static bool s_canControlInput = false
 Is there an input module to be controlled?
 
static long s_nextEntry = -1
 entry to be loaded the next time event() is called in an input module. More...
 
static long s_nextExperiment = -1
 Experiment number to load next. More...
 
static long s_nextRun = -1
 Run number to load next.
 
static long s_nextEvent = -1
 Event (not entry!) to load next.
 
static long s_currentEntry = 0
 current entry in file.
 
static const TChain * s_chain = nullptr
 Opened TChain (event durability).
 

Detailed Description

A static class to control supported input modules.

You can use setNextEntry() to request loading of any event in 0..numEntries()-1, which will be done the next time the input module's event() function is called.

Use canControlInput() to check wether control is actually possible.

Definition at line 27 of file InputController.h.

Member Function Documentation

◆ numEntries()

long numEntries ( )
static

Returns total number of entries in the event tree.

If no file is opened, zero is returned.

Definition at line 46 of file InputController.cc.

47 {
48  if (s_chain)
49  return s_chain->GetEntries();
50 
51  return 0;
52 }
static const TChain * s_chain
Opened TChain (event durability).

◆ resetForChildProcess()

void resetForChildProcess ( )
static

Reset InputController (e.g.

after forking a thread)

Definition at line 23 of file InputController.cc.

◆ setNextEntry() [1/2]

static void setNextEntry ( long  entry)
inlinestatic

Set the file entry to be loaded the next time event() is called.

This is mainly useful for interactive applications (e.g. event display).

The input module should call eventLoaded() after the entry was loaded.

Definition at line 41 of file InputController.h.

41 { s_nextEntry = entry; }
static long s_nextEntry
entry to be loaded the next time event() is called in an input module.

◆ setNextEntry() [2/2]

static void setNextEntry ( long  exp,
long  run,
long  event 
)
inlinestatic

Set the file entry to be loaded the next time event() is called, by evt/run/exp number.

The input module should call eventLoaded() after the entry was loaded.

Definition at line 50 of file InputController.h.

Member Data Documentation

◆ s_nextEntry

long s_nextEntry = -1
staticprivate

entry to be loaded the next time event() is called in an input module.

-1 indicates that execution should continue normally.

Definition at line 100 of file InputController.h.

◆ s_nextExperiment

long s_nextExperiment = -1
staticprivate

Experiment number to load next.

-1 by default.

Definition at line 106 of file InputController.h.


The documentation for this class was generated from the following files: