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>
18using namespace CurlTagger;
36 m_IsCurl = Variable::genParticleIndex(iPart) == Variable::genParticleIndex(jPart);
42 m_PtDiffEW = std::abs(Variable::particlePt(iPart) - Variable::particlePt(jPart)) /
sqrt(pow(Variable::particlePtErr(
43 iPart), 2) + pow(Variable::particlePtErr(jPart), 2));
45 m_PzDiffEW = std::abs(Variable::particlePz(iPart) - Variable::particlePz(jPart)) /
sqrt(pow(Variable::particlePzErr(
46 iPart), 2) + pow(Variable::particlePzErr(jPart), 2));
48 m_TrackD0DiffEW = std::abs(Variable::trackD0(iPart) - Variable::trackD0(jPart)) /
sqrt(pow(Variable::trackD0Error(
49 iPart), 2) + pow(Variable::trackD0Error(jPart), 2));
51 m_TrackZ0DiffEW = std::abs(Variable::trackZ0(iPart) - Variable::trackZ0(jPart)) /
sqrt(pow(Variable::trackZ0Error(
52 iPart), 2) + pow(Variable::trackZ0Error(jPart), 2));
55 Variable::trackTanLambdaError(
56 iPart), 2) + pow(Variable::trackTanLambdaError(jPart), 2));
58 m_TrackPhi0DiffEW = std::abs(Variable::trackPhi0(iPart) - Variable::trackPhi0(jPart)) /
sqrt(pow(Variable::trackPhi0Error(
59 iPart), 2) + pow(Variable::trackPhi0Error(jPart), 2));
61 m_TrackOmegaDiffEW = std::abs(Variable::trackOmega(iPart) - Variable::trackOmega(jPart)) /
sqrt(pow(Variable::trackOmegaError(
62 iPart), 2) + pow(Variable::trackOmegaError(jPart), 2));
84 m_TTree =
new TTree(
"ntuple",
"Training Data for the Curl Tagger MVA");
100 "PzDiffEW",
"TrackD0DiffEW",
"TrackZ0DiffEW",
101 "TrackTanLambdaDiffEW",
"TrackPhi0DiffEW",
"TrackOmegaDiffEW"
115 std::stringstream ss((*m_weightfile_representation)->m_data);
127 std::string elementIdentfier =
"optimal_cut";
129 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
Wraps the data of a single event into a Dataset.
static Weightfile loadFromStream(std::istream &stream)
Static function which deserializes a Weightfile from a stream.
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.