Belle II Software  release-08-01-10
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 bool getEventMerging ()
 Get if we are merging events from two paths.
 
static void enableEventMerging (Module *steerRootInputModule)
 Set that we are merging events from two paths.
 
static void setNextEntry (long entry, bool independentPath=false)
 Set the file entry to be loaded the next time event() is called. More...
 
static long getNextEntry (bool independentPath=false)
 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 void setSkippedEntries (long entries, bool independentPath=false)
 set the number of entries skipped by the RootInputModule.
 
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 (bool independentPath=false)
 returns the entry number currently loaded.
 
static long getSkippedEntries (bool independentPath=false)
 returns the number of entries skipped by the RootInputModule.
 
static long numEntries (bool independentPath=false)
 Returns total number of entries in the event tree. More...
 
static std::string getCurrentFileName (bool independentPath=false)
 Return name of current file in loaded chain (or empty string if none loaded).
 
static void eventLoaded (long entry, bool independentPath=false)
 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, bool independentPath=false)
 Set the loaded TChain (event durability).
 
static void resetForChildProcess ()
 Reset InputController (e.g. More...
 
static long getNumEntriesToProcess ()
 Necessary to make sure the ProgressModule shows reasonable output.
 

Static Private Attributes

static bool s_canControlInput = false
 Is there an input module to be controlled?
 
static bool s_doEventMerging = false
 Are we merging events from two paths?
 
static Modules_steerRootInputModule = nullptr
 Explicit pointer to steerRootInput.
 
static std::pair< long, long > s_nextEntry = { -1, -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 std::pair< long, long > s_eventNumbers
 number of events in paths if two input modules are used (independent paths)
 
static std::pair< long, long > s_currentEntry = { 0, 0}
 current entry in file. More...
 
static std::pair< long, long > s_skippedEntries = { 0, 0}
 entries skipped by RootInputModule (if any) Storing two values (second one if independent path is executed)
 
static std::pair< const TChain *, const TChain * > s_chain = { nullptr, nullptr}
 Opened TChain (event durability). More...
 

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 30 of file InputController.h.

Member Function Documentation

◆ numEntries()

long numEntries ( bool  independentPath = false)
static

Returns total number of entries in the event tree.

If no file is opened, zero is returned.

Definition at line 81 of file InputController.cc.

82 {
83  if (!independentPath) {
84  if (s_chain.first)
85  return s_chain.first->GetEntries();
86  } else {
87  if (s_chain.second)
88  return s_chain.second->GetEntries();
89  }
90 
91  return 0;
92 }
static std::pair< const TChain *, const TChain * > s_chain
Opened TChain (event durability).

◆ resetForChildProcess()

void resetForChildProcess ( )
static

Reset InputController (e.g.

after forking a thread)

Definition at line 57 of file InputController.cc.

◆ setNextEntry() [1/2]

static void setNextEntry ( long  entry,
bool  independentPath = false 
)
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 50 of file InputController.h.

50 { (!independentPath) ? s_nextEntry.first = entry : s_nextEntry.second = entry; }
static std::pair< long, 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 59 of file InputController.h.

Member Data Documentation

◆ s_chain

std::pair< const TChain *, const TChain * > s_chain = { nullptr, nullptr}
staticprivate

Opened TChain (event durability).

Storing two values (second one if independent path is executed)

Definition at line 148 of file InputController.h.

◆ s_currentEntry

std::pair< long, long > s_currentEntry = { 0, 0}
staticprivate

current entry in file.

Storing two values (second one if independent path is executed)

Definition at line 138 of file InputController.h.

◆ s_nextEntry

std::pair< long, long > s_nextEntry = { -1, -1}
staticprivate

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

Storing two values (second one if independent path is executed) -1 indicates that execution should continue normally.

Definition at line 118 of file InputController.h.

◆ s_nextExperiment

long s_nextExperiment = -1
staticprivate

Experiment number to load next.

-1 by default.

Definition at line 124 of file InputController.h.


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