AmpGen
2.1
Toggle main menu visibility
Loading...
Searching...
No Matches
FastDT.h
Go to the documentation of this file.
1
#ifndef AMPGEN_FASTDT_H
2
#define AMPGEN_FASTDT_H
3
#include <memory.h>
4
#include <stddef.h>
5
#include <array>
6
#include <fstream>
7
#include <functional>
8
#include <iomanip>
9
#include <iostream>
10
#include <fstream>
11
#include <map>
12
#include <memory>
13
#include <queue>
14
#include <string>
15
#include <utility>
16
#include <vector>
17
18
#include "
AmpGen/ArgumentPack.h
"
19
#include "
AmpGen/EventList.h
"
20
#include "
AmpGen/MsgService.h
"
21
#include "
AmpGen/Types.h
"
22
23
namespace
AmpGen
{
24
class
FastDT
{
25
public
:
26
enum
Strategy
{
best
,
random
};
27
struct
Node
{
28
int
index
;
29
int
left
;
30
int
right
;
31
double
cutValue
;
32
Node
() =
default
;
33
Node
(
const
int
&
index
,
const
int
&
left
,
const
int
&
right
,
const
double
&
cutValue
) :
index
(
index
),
left
(
left
),
right
(
right
),
cutValue
(
cutValue
) {};
34
};
35
FastDT
() =
default
;
36
template
<
typename
... arg_types>
FastDT
(
const
arg_types &...args) :
FastDT
(
ArgumentPack
(args...)) {}
37
FastDT
(
const
ArgumentPack
&args);
38
FastDT
(
const
std::string &textFile);
39
FastDT
(std::ifstream &,
const
unsigned
&);
40
int
getBinNumber
(
const
double
*event)
const
{
return
findNode
(event); }
41
int
findNode
(
const
double
*event)
const
;
42
std::pair<double, double>
43
bestCut_ls
(
const
std::vector<double *> &source,
const
std::vector<double *> &target,
int
index,
const
size_t
&dim,
const
size_t
&minEvents);
44
std::vector<Node>
const_nodes
()
const
{
return
m_nodes
; }
45
std::vector<Node>
m_nodes
;
46
std::queue<unsigned>
m_queueOrdering
;
47
unsigned
m_dim
= {0};
48
unsigned
m_minEvents
= {0};
49
unsigned
m_maxDepth
= {0};
50
int
m_endNodeCounter
= {0};
51
Strategy
m_strategy
= {
Strategy::random
};
52
std::vector<double>
m_minStep
;
53
std::vector<int>
makeQueue
();
54
void
setStep
(
const
std::vector<double> &step) {
m_minStep
= step; }
55
int
makeNodes
(std::vector<double *> &, std::queue<unsigned>,
const
unsigned
&);
56
int
makeNodes
(std::vector<double *>, std::vector<double *>);
57
int
makeNodes
(std::vector<double *>, std::vector<double *>, std::vector<int>,
const
unsigned
&);
58
void
refreshQueue
(std::vector<double *> &evts, std::queue<unsigned> &indexQueue,
const
unsigned
&depth);
59
void
serialise
(std::ofstream &);
60
void
setQueueOrdering
(std::vector<unsigned> &) {};
61
void
readFromStream
(std::ifstream &stream,
const
int
&n_nodes);
62
};
63
}
64
#endif
ArgumentPack.h
EventList.h
MsgService.h
Types.h
AmpGen::ArgumentPack
Container for a set of arguments Contains a set of arguments packed from a variadic constructor,...
Definition
ArgumentPack.h:65
AmpGen::FastDT::FastDT
FastDT()=default
AmpGen::FastDT::m_dim
unsigned m_dim
Definition
FastDT.h:47
AmpGen::FastDT::makeNodes
int makeNodes(std::vector< double * > &, std::queue< unsigned >, const unsigned &)
AmpGen::FastDT::m_minStep
std::vector< double > m_minStep
Definition
FastDT.h:52
AmpGen::FastDT::readFromStream
void readFromStream(std::ifstream &stream, const int &n_nodes)
AmpGen::FastDT::FastDT
FastDT(const ArgumentPack &args)
AmpGen::FastDT::m_endNodeCounter
int m_endNodeCounter
Definition
FastDT.h:50
AmpGen::FastDT::FastDT
FastDT(const std::string &textFile)
AmpGen::FastDT::makeQueue
std::vector< int > makeQueue()
AmpGen::FastDT::m_nodes
std::vector< Node > m_nodes
Definition
FastDT.h:45
AmpGen::FastDT::findNode
int findNode(const double *event) const
AmpGen::FastDT::setQueueOrdering
void setQueueOrdering(std::vector< unsigned > &)
Definition
FastDT.h:60
AmpGen::FastDT::FastDT
FastDT(const arg_types &...args)
Definition
FastDT.h:36
AmpGen::FastDT::const_nodes
std::vector< Node > const_nodes() const
Definition
FastDT.h:44
AmpGen::FastDT::m_strategy
Strategy m_strategy
Definition
FastDT.h:51
AmpGen::FastDT::makeNodes
int makeNodes(std::vector< double * >, std::vector< double * >)
AmpGen::FastDT::m_maxDepth
unsigned m_maxDepth
Definition
FastDT.h:49
AmpGen::FastDT::FastDT
FastDT(std::ifstream &, const unsigned &)
AmpGen::FastDT::setStep
void setStep(const std::vector< double > &step)
Definition
FastDT.h:54
AmpGen::FastDT::m_minEvents
unsigned m_minEvents
Definition
FastDT.h:48
AmpGen::FastDT::bestCut_ls
std::pair< double, double > bestCut_ls(const std::vector< double * > &source, const std::vector< double * > &target, int index, const size_t &dim, const size_t &minEvents)
AmpGen::FastDT::makeNodes
int makeNodes(std::vector< double * >, std::vector< double * >, std::vector< int >, const unsigned &)
AmpGen::FastDT::refreshQueue
void refreshQueue(std::vector< double * > &evts, std::queue< unsigned > &indexQueue, const unsigned &depth)
AmpGen::FastDT::m_queueOrdering
std::queue< unsigned > m_queueOrdering
Definition
FastDT.h:46
AmpGen::FastDT::Strategy
Strategy
Definition
FastDT.h:26
AmpGen::FastDT::random
@ random
Definition
FastDT.h:26
AmpGen::FastDT::best
@ best
Definition
FastDT.h:26
AmpGen::FastDT::getBinNumber
int getBinNumber(const double *event) const
Definition
FastDT.h:40
AmpGen::FastDT::serialise
void serialise(std::ofstream &)
AmpGen
Definition
AddCPConjugate.h:2
AmpGen::FastDT::Node::right
int right
Definition
FastDT.h:30
AmpGen::FastDT::Node::left
int left
Definition
FastDT.h:29
AmpGen::FastDT::Node::cutValue
double cutValue
Definition
FastDT.h:31
AmpGen::FastDT::Node::index
int index
Definition
FastDT.h:28
AmpGen::FastDT::Node::Node
Node(const int &index, const int &left, const int &right, const double &cutValue)
Definition
FastDT.h:33
AmpGen::FastDT::Node::Node
Node()=default
AmpGen
FastDT.h
Generated on
for AmpGen by
1.17.0