8#include <calibration/CalibrationCollectorModule.h>
9#include <framework/pcore/ProcHandler.h>
13using namespace Calibration;
25 "Granularity of data collection. Data is separated by runs (=run) or not separated at all (=all)", std::string(
"run"));
28 "Maximum number of events that will be collected per run. Effectively the code in the collect() function is only "
29 "run for this number of events on each run. Then the collect() function is switched off until a new "
30 "run that hasn't collected the maximum yet begins. -1 is the default and means that the collector runs over all events."
31 "\n\nNote that this is useful for debugging and hard limiting the number of events passed to the collected. However "
32 "you should be limiting the collected data yourself! Check if your collected data object has enough entries for an algorithm "
33 "to complete and then stop filling. Controlling this limit via a module param is encouraged.",
int(-1));
36 "This controls the rate at which events are actually passed to the collect() function. An event passing through this module "
37 "will only have the collect() function run on it it passes a random selection scaled by this parameter i.e. For preScale=1.0 "
38 "all events are collected, but for preScale=0.5 only 50 percent will be. Since this is based on a random choice, you should set the "
39 "random seed to a fixed value if you want repeatable results.\n\n"
40 "Should be a float in range [0.0,1.0], default=1.0",
float(1.0));
61 (*m_eventsCollectedInRun) += 1;
65 B2INFO(
"Reached maximum number of events processed by collector for this run ("
69 <<
"). Turning off collection.");
100 B2INFO(
"New run has had less events than the maximum collected so far ("
104 <<
"). Turning on collection.");
107 B2INFO(
"New run has had more events than the maximum collected so far ("
111 <<
"). Turning off collection.");
132 B2INFO(
"Saving output to TDirectory " <<
m_dir->GetPath());
133 B2DEBUG(100,
"Creating directories for individual collector objects.");
137 m_runRange->SetName(Calibration::RUN_RANGE_OBJ_NAME.c_str());
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)
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.
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...
HistoModule()
Constructor.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
const std::string & getName() const
Returns the name of the module.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
@ c_TerminateInAllProcesses
When using parallel processing, call this module's terminate() function in all processes().
static bool isWorkerProcess()
Return true if the process is a worker process.
static bool parallelProcessingUsed()
Returns true if multiple processes have been spawned, false in single-core mode.
Mergeable object holding (unique) set of (exp,run) pairs.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Abstract base class for different kinds of events.
Struct containing exp number and run number.