13#include <tracking/modules/vxdtfRedesign/FastBDTClassifierAnalyzerModule.h>
14#include <tracking/spacePointCreation/MapHelperFunctions.h>
23 "analyzes performance of given FastBDT on a test and a training set and determines a global classification cut. TODO");
34 if (!fbdt.is_open()) {
39 if (!train.is_open()) {
44 if (!test.is_open()) {
64 std::ofstream ofs(
"analyze_trout.dat");
65 B2DEBUG(21,
"Processing the training sample");
72 B2DEBUG(21,
"Processing the test sample");
84 TTree* tree =
new TTree(
"classifierOutputs",
"outputs of FBDTClassifier for the different samples");
85 tree->Branch(
"train_bg_outputs", &trainBgOut);
86 tree->Branch(
"train_sig_outputs", &trainSigOut);
87 tree->Branch(
"test_bg_outputs", &testBgOut);
88 tree->Branch(
"test_sig_outputs", &testSigOut);
void readFromStream(std::istream &is)
read all the necessary data from stream and fill the Forest and the FeatureBinnings NOTE: uses FastBD...
std::string m_PARAMtrainSampleFileName
training sample file name
std::string m_PARAMtestSampleFileName
test sample file name
std::multimap< int, double > m_trainOutput
map containing output for each training event
void initialize() override
Module initialization.
std::multimap< int, double > m_testOutput
map containing output for each test event
std::string m_PARAMrootOutFileName
output file name
FastBDTClassifierAnalyzerModule()
Constructor.
void terminate() override
Module termination.
std::vector< TrainSample > m_trainSample
vector for training sample
std::vector< TrainSample > m_testSample
vector for test sample
Belle2::FBDTClassifier< 9 > m_classifier
classifier
std::string m_PARAMfbdtFileName
weight file name
void setDescription(const std::string &description)
Sets the description of the module.
virtual void event()
This method is the core of the module.
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.
double analyze(const std::array< double, Ndims > &hits) const
calculate the output of the FastBDT.
std::vector< typename MapType::mapped_type > getValuesToKey(const MapType &aMap, typename MapType::key_type aKey)
get all values stored in the map for a given key
static void readSamplesFromStream(std::istream &is, std::vector< FBDTTrainSample< Ndims > > &samples)
read samples from stream and append them to samples
Abstract base class for different kinds of events.