9#include <analysis/modules/CurlTagger/SelectorMVA.h>
11#include <analysis/variables/TrackVariables.h>
12#include <analysis/variables/MCTruthVariables.h>
13#include <analysis/variables/Variables.h>
16using namespace CurlTagger;
34 m_IsCurl = Variable::genParticleIndex(iPart) == Variable::genParticleIndex(jPart);
40 m_PtDiffEW = abs(Variable::particlePt(iPart) - Variable::particlePt(jPart)) /
sqrt(pow(Variable::particlePtErr(
41 iPart), 2) + pow(Variable::particlePtErr(jPart), 2));
43 m_PzDiffEW = abs(Variable::particlePz(iPart) - Variable::particlePz(jPart)) /
sqrt(pow(Variable::particlePzErr(
44 iPart), 2) + pow(Variable::particlePzErr(jPart), 2));
46 m_TrackD0DiffEW = abs(Variable::trackD0(iPart) - Variable::trackD0(jPart)) /
sqrt(pow(Variable::trackD0Error(
47 iPart), 2) + pow(Variable::trackD0Error(jPart), 2));
49 m_TrackZ0DiffEW = abs(Variable::trackZ0(iPart) - Variable::trackZ0(jPart)) /
sqrt(pow(Variable::trackZ0Error(
50 iPart), 2) + pow(Variable::trackZ0Error(jPart), 2));
53 Variable::trackTanLambdaError(
54 iPart), 2) + pow(Variable::trackTanLambdaError(jPart), 2));
56 m_TrackPhi0DiffEW = abs(Variable::trackPhi0(iPart) - Variable::trackPhi0(jPart)) /
sqrt(pow(Variable::trackPhi0Error(
57 iPart), 2) + pow(Variable::trackPhi0Error(jPart), 2));
59 m_TrackOmegaDiffEW = abs(Variable::trackOmega(iPart) - Variable::trackOmega(jPart)) /
sqrt(pow(Variable::trackOmegaError(
60 iPart), 2) + pow(Variable::trackOmegaError(jPart), 2));
82 m_TTree =
new TTree(
"ntuple",
"Training Data for the Curl Tagger MVA");
98 "PzDiffEW",
"TrackD0DiffEW",
"TrackZ0DiffEW",
99 "TrackTanLambdaDiffEW",
"TrackPhi0DiffEW",
"TrackOmegaDiffEW"
113 std::stringstream ss((*m_weightfile_representation)->m_data);
125 std::string elementIdentfier =
"optimal_cut";
127 B2FATAL(
"No optimal cut stored in curlTagger MVA payload!");
void updateVariables(Particle *iPart, Particle *jPart)
updates the value of the MVA variable
virtual std::vector< float > getVariables(Particle *iPart, Particle *jPart) override
returns vector of variables used by this selector.
~SelectorMVA()
Destructor.
Float_t m_TrackTanLambdaDiffEW
error weighted track tan lambda diff difference
virtual float getOptimalResponseCut() override
returns optimal cut to use with selector
std::vector< std::string > m_variables
names of variables used by mva
Float_t m_TrackZ0DiffEW
error weighted track Z0 difference
virtual void initialize() override
initialize whatever needs to be initialized (root file etc)
Float_t m_PtDiffEW
error weighted particle Pt difference
Float_t m_PPhi
angle between particle momentum vectors
Float_t m_TrackPhi0DiffEW
error weighted track Phi0 difference
TFile * m_TFile
output file for training data
Float_t m_PzDiffEW
error weighted particle Pz difference
MVA::Weightfile m_weightfile
mva weightfile
Float_t m_TrackD0DiffEW
error weighted track D0 difference
virtual void finalize() override
finalize whatever needs to be finalized (train the MVA)
Float_t m_ChargeProduct
charge(p1) * charge(p2)
void initializeMVA()
initialize the MVA Expert
std::unique_ptr< DBObjPtr< DatabaseRepresentationOfWeightfile > > m_weightfile_representation
Database pointer to the Database representation of the weightfile.
bool m_TrainFlag
applying mva or training it
MVA::FastBDTExpert m_expert
mva expert
virtual void collectTrainingInfo(Particle *iPart, Particle *jPart) override
collect training data and save to a root file
std::string m_TFileName
name of output file for training data
virtual float getResponse(Particle *iPart, Particle *jPart) override
Selector response that this pair of particles come from the same mc/actual particle.
Bool_t m_IsCurl
isCurl Truth
MVA::GeneralOptions m_generalOptions
mva general options (for the expert)
std::string m_target_variable
name of target variable (isCurl)
SelectorMVA(bool belleFlag, bool trainFlag, std::string tFileName)
Constructor.
Float_t m_TrackOmegaDiffEW
error weighted track Omega difference
TTree * m_TTree
training data tree
std::string m_identifier
mva identifier
virtual std::vector< float > apply(Dataset &test_data) const override
Apply this expert onto a dataset.
virtual void load(Weightfile &weightfile) override
Load the expert from a Weightfile.
Wraps the data of a single event into a Dataset.
T getElement(const std::string &identifier) const
Returns a stored element from the xml tree.
static Weightfile loadFromStream(std::istream &stream)
Static function which deserializes a Weightfile from a stream.
bool containsElement(const std::string &identifier) const
Returns true if given element is stored in the property tree.
void getOptions(Options &options) const
Fills an Option object from the xml tree.
Class to store reconstructed particles.
double getCharge(void) const
Returns particle charge.
ROOT::Math::XYZVector getMomentum() const
Returns momentum vector.
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.