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