13#include <TDirectory.h>
16#include <framework/core/HistoModule.h>
17#include <framework/dataobjects/EventMetaData.h>
18#include <framework/datastore/StoreObjPtr.h>
20#include <calibration/dataobjects/RunRange.h>
21#include <calibration/CalibObjManager.h>
22#include <calibration/Utilities.h>
57 std::shared_ptr<T> calObj(obj);
58 calObj->SetName(name.c_str());
129 const double randomNumber = gRandom->Uniform();
Manager class for collector registered data. Handles much of the TDirectory/TObject manipulation.
T * getObject(const std::string &name, const Belle2::Calibration::ExpRun expRun)
Gets the collector object of this name for the given exprun.
Calibration collector module base class.
bool m_runCollectOnRun
Whether or not we will run the collect() at all this run, basically skips the event() function if fal...
virtual void startRun()
Replacement for beginRun(). Do anything you would normally do in beginRun here.
Calibration::ExpRun m_expRun
Current ExpRun for object retrieval (becomes -1,-1 for granularity=all)
void registerObject(std::string name, T *obj)
Register object with a name, takes ownership, do not access the pointer beyond prepare()
CalibObjManager m_manager
Controls the creation, collection and access to calibration objects.
void endRun() final
Write the current collector objects to a file and clear their memory.
std::string m_granularity
Granularity of data collection = run|all(= no granularity, exp,run=-1,-1)
void initialize() final
Set up a default RunRange object in datastore and call prepare()
void beginRun() final
Reset the m_runCollectOnRun flag, if necessary, to begin collection again.
void event() final
Check current experiment and run and update if needed, fill into RunRange and collect()
RunRange * m_runRange
Overall list of runs processed.
virtual void prepare()
Replacement for initialize(). Register calibration dataobjects here as well.
TDirectory * m_dir
The top TDirectory that collector objects for this collector will be stored beneath.
virtual void closeRun()
Replacement for endRun(). Do anything you would normally do in endRun here.
StoreObjPtr< EventMetaData > m_evtMetaData
Required input for EventMetaData.
float m_preScale
Prescale module parameter, this fraction of events will have collect() run on them [0....
virtual void inDefineHisto()
Replacement for defineHisto(). Do anything you would normally do in defineHisto here.
void defineHisto() final
Runs due to HistoManager, allows us to discover the correct file.
int * m_eventsCollectedInRun
Will point at correct value in m_expRunEvents.
virtual void collect()
Replacement for event(). Fill you calibration data objects here.
virtual void finish()
Replacement for terminate(). Do anything you would normally do in terminate here.
StoreObjPtr< EventMetaData > m_emd
Current EventMetaData.
int m_maxEventsPerRun
Maximum number of events to be collected at the start of each run (-1 = no maximum)
CalibrationCollectorModule()
Constructor. Sets the default prefix for calibration dataobjects.
void terminate() final
Write the final objects to the file.
virtual ~CalibrationCollectorModule()
Virtual destructor (base class)
bool getPreScaleChoice()
I'm a little worried about floating point precision when comparing to 0.0 and 1.0 as special values.
std::map< Calibration::ExpRun, int > m_expRunEvents
How many events processed for each ExpRun so far, stops counting up once max is hit Only used/increme...
T * getObjectPtr(std::string name)
Calls the CalibObjManager to get the requested stored collector data.
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Mergeable object holding (unique) set of (exp,run) pairs.
Type-safe access to single objects in the data store.
void addObject(const std::string &name, std::shared_ptr< TNamed > object)
Add a new object to manage, this is used as a template for creating future/missing objects.
Abstract base class for different kinds of events.