9#include <calibration/example_caf_lib/modules/CaTest/CaTestModule.h>
17#include <alignment/dataobjects/MilleData.h>
18#include <framework/pcore/ProcHandler.h>
38 "Number of entries that we fill into the saved tree per event. As we increase this we start storing larger amonuts of data in a smaller number of events to test the limits.",
41 "Spread of gaussian (mean=42) filling of test histogram (range=<0,100>) - probability of algo iterations depend on it",
int(17.));
47 std::string objectName =
"MyTree";
49 TTree* tree =
new TTree(objectName.c_str(),
"");
50 tree->Branch<
int>(
"event", &
m_evt);
51 tree->Branch<
int>(
"run", &
m_run);
52 tree->Branch<
int>(
"exp", &
m_exp);
53 tree->Branch<
double>(
"hitX", &
m_hitX);
54 tree->Branch<
double>(
"hitY", &
m_hitY);
55 tree->Branch<
double>(
"hitZ", &
m_hitZ);
56 tree->Branch<
double>(
"trackX", &
m_trackX);
57 tree->Branch<
double>(
"trackY", &
m_trackY);
58 tree->Branch<
double>(
"trackZ", &
m_trackZ);
59 tree->Branch<
double>(
"chisq", &
m_chisq);
60 tree->Branch<
double>(
"pvalue", &
m_pvalue);
61 tree->Branch<
double>(
"dof", &
m_dof);
66 registerObject<TTree>(objectName, tree);
68 auto hist =
new TH1F(
"histo",
"Test histogram, which mean value should be found by test calibration algo", 100, 0., 100.);
69 registerObject<TH1F>(
"MyHisto", hist);
72 registerObject<MilleData>(
"test_mille", mille);
91 auto mille = getObjectPtr<MilleData>(
"test_mille");
92 if (mille->isOpen()) {
93 for (
auto& fileName : mille->getFiles()) {
94 B2DEBUG(100,
"Stored Mille binary file: " << fileName);
108 std::string objectName =
"MyTree";
109 auto tree = getObjectPtr<TTree>(objectName);
110 auto hist = getObjectPtr<TH1F>(
"MyHisto");
121 m_dof = gRandom->Gaus();
123 hist->Fill(gRandom->Gaus(42.,
m_spread));
126 auto mille = getObjectPtr<MilleData>(
"test_mille");
128 if (!mille->isOpen()) {
129 string newFileName = to_string(
m_exp) +
"-" + to_string(
m_run) +
"-sevt-" + to_string(
m_evt) +
"-pid" + std::to_string(
131 B2INFO(
"Opening new binary file " << newFileName);
132 mille->open(newFileName);
146 +
"\nThe gDirectory is " + gDirectory->GetPath());
void describeProcess(const std::string &functionName)
Describe process (gives debug output)
int m_evt
Current event id.
double m_hitX
Fake x coordinate of a hit.
virtual void startRun() override
Replacement for beginRun(). Do anything you would normally do in beginRun here.
double m_hitY
Fake y coordinate of a hit.
virtual void collect() override
Replacement for event(). Fill you calibration data objects here.
double m_hitZ
Fake z coordinate of a hit.
virtual void closeRun() override
Replacement for endRun(). Do anything you would normally do in endRun here.
int m_spread
Spread of gaussian (mean=42) filling test histogram (range=<0,100>) - probability of algo iterations ...
int m_exp
Current experiment id.
virtual void prepare() override
Replacement for initialize(). Register calibration dataobjects here as well.
virtual void finish() override
Replacement for terminate(). Do anything you would normally do in terminate here.
int m_entriesPerEvent
Number of entries created in the saved tree per event.
virtual void inDefineHisto() override
Runs during the defineHisto() function.
StoreObjPtr< EventMetaData > m_emdata
emdata
CaTestModule()
Constructor: Sets the description, the properties and the parameters of the module.
Calibration collector module base class.
Mergeable class holding list of so far opened mille binaries and providing the binaries.
void setDescription(const std::string &description)
Sets the description of the module.
static int EvtProcID()
Return ID of the current process.
static bool parallelProcessingUsed()
Returns true if multiple processes have been spawned, false in single-core mode.
static std::string getProcessName()
Get a name for this process.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.