10#include <analysis/modules/LowEnergyPi0VetoExpert/LowEnergyPi0VetoExpertModule.h>
13#include <analysis/variables/ECLVariables.h>
14#include <analysis/variables/HelicityVariables.h>
17#include <mva/interface/Interface.h>
20#include <boost/algorithm/string/predicate.hpp>
23#include <Math/Vector3D.h>
24#include <Math/Vector4D.h>
25#include <Math/VectorUtil.h>
36 "Veto for pi0 daughters (maximum over all pairs excluding this pi0).",
39 std::string(
"gamma"));
44 "Database identifier or file used to load the weights.",
75 std::stringstream ss((*m_weightfile_representation)->m_data);
95 m_expert = supported_interfaces[general_options.m_method]->getExpert();
97 std::vector<float> dummy;
103 nInputVariables = 11;
104 dummy.resize(nInputVariables, 0);
113 for (
int i = 0; i < n; ++i) {
115 if (gamma1 == gamma2)
117 if (pi0Gamma !=
nullptr) {
118 if (pi0Gamma == gamma2)
122 if (pi0Mass < 0.07 || pi0Mass > 0.20)
124 const Particle* gammaLowEnergy, *gammaHighEnergy;
126 gammaLowEnergy = gamma2;
127 gammaHighEnergy = gamma1;
129 gammaLowEnergy = gamma1;
130 gammaHighEnergy = gamma2;
132 double gammaLowEnergyEnergy, gammaHighEnergyEnergy;
133 double gammaLowEnergyE9E21, gammaHighEnergyE9E21;
134 double gammaLowEnergyClusterTheta, gammaHighEnergyClusterTheta;
135 double gammaLowEnergyZernikeMVA, gammaHighEnergyZernikeMVA;
136 double gammaLowEnergyIsolation, gammaHighEnergyIsolation;
137 double cosHelicityAngleMomentum;
138 gammaLowEnergyEnergy = gammaLowEnergy->
getEnergy();
139 gammaHighEnergyEnergy = gammaHighEnergy->
getEnergy();
140 ROOT::Math::PxPyPzEVector gammaHighEnergyMomentum(
141 gammaHighEnergy->
getPx(), gammaHighEnergy->
getPy(),
142 gammaHighEnergy->
getPz(), gammaHighEnergyEnergy);
143 ROOT::Math::PxPyPzEVector gammaLowEnergyMomentum(
144 gammaLowEnergy->
getPx(), gammaLowEnergy->
getPy(),
145 gammaLowEnergy->
getPz(), gammaLowEnergyEnergy);
146 ROOT::Math::PxPyPzEVector momentum = gammaHighEnergyMomentum +
147 gammaLowEnergyMomentum;
148 ROOT::Math::XYZVector boost = momentum.BoostToCM();
149 gammaHighEnergyMomentum =
150 ROOT::Math::VectorUtil::boost(gammaHighEnergyMomentum, boost);
151 cosHelicityAngleMomentum =
152 fabs(ROOT::Math::VectorUtil::CosTheta(momentum.Vect(),
153 gammaHighEnergyMomentum.Vect()));
154 gammaLowEnergyE9E21 = Variable::eclClusterE9E21(gammaLowEnergy);
155 gammaHighEnergyE9E21 = Variable::eclClusterE9E21(gammaHighEnergy);
156 gammaLowEnergyClusterTheta = Variable::eclClusterTheta(gammaLowEnergy);
157 gammaHighEnergyClusterTheta = Variable::eclClusterTheta(gammaHighEnergy);
159 gammaLowEnergyZernikeMVA =
160 Variable::eclClusterZernikeMVA(gammaLowEnergy);
161 gammaHighEnergyZernikeMVA =
162 Variable::eclClusterZernikeMVA(gammaHighEnergy);
163 gammaLowEnergyIsolation = Variable::eclClusterIsolation(gammaLowEnergy);
164 gammaHighEnergyIsolation =
165 Variable::eclClusterIsolation(gammaHighEnergy);
167 m_dataset->m_input[0] = gammaLowEnergyEnergy;
169 m_dataset->m_input[2] = cosHelicityAngleMomentum;
170 m_dataset->m_input[3] = gammaLowEnergyE9E21;
171 m_dataset->m_input[4] = gammaHighEnergyE9E21;
172 m_dataset->m_input[5] = gammaLowEnergyClusterTheta;
173 m_dataset->m_input[6] = gammaHighEnergyClusterTheta;
175 m_dataset->m_input[7] = gammaLowEnergyZernikeMVA;
176 m_dataset->m_input[8] = gammaHighEnergyZernikeMVA;
177 m_dataset->m_input[9] = gammaLowEnergyIsolation;
178 m_dataset->m_input[10] = gammaHighEnergyIsolation;
191 for (
int i = 0; i < n; ++i) {
195 const Particle* gammaLowEnergy, *gammaHighEnergy;
197 gammaLowEnergy = gamma2;
198 gammaHighEnergy = gamma1;
200 gammaLowEnergy = gamma1;
201 gammaHighEnergy = gamma2;
204 pi0->
addExtraInfo(
"lowEnergyPi0VetoGammaLowEnergy", maxVeto);
206 pi0->
addExtraInfo(
"lowEnergyPi0VetoGammaHighEnergy", maxVeto);
210 for (
int i = 0; i < n; ++i) {
Class for accessing objects in the database.
~LowEnergyPi0VetoExpertModule()
Destructor.
std::unique_ptr< MVA::SingleDataset > m_dataset
Pointer to the current dataset.
StoreObjPtr< ParticleList > m_ListGamma
Gamma candidates.
bool m_Belle1
Belle 1 data analysis.
void initialize() override
Initializer.
void event() override
This method is called for each event.
void endRun() override
This method is called if the current run ends.
void terminate() override
This method is called at the end of the event processing.
std::unique_ptr< MVA::Expert > m_expert
Pointer to the current MVA expert.
LowEnergyPi0VetoExpertModule()
Constructor.
std::unique_ptr< DBObjPtr< DatabaseRepresentationOfWeightfile > > m_weightfile_representation
Database pointer to the database representation of the weightfile.
void beginRun() override
Called when entering a new run.
bool m_VetoPi0Daughters
Calculate veto for pi0 daughter photons (maximum over all pairs excluding this pi0).
StoreObjPtr< ParticleList > m_ListPi0
Pi0 candidates.
void init_mva(MVA::Weightfile &weightfile)
Initialize mva expert, dataset and features Called every time the weightfile in the database changes ...
std::string m_GammaListName
Gamma particle list name.
std::string m_Pi0ListName
Pi0 particle list name.
float getMaximumVeto(const Particle *gamma1, const Particle *pi0Gamma)
Get maximum veto value over all gamma pairs including the photon gamma1.
std::string m_identifier
Database identifier or file used to load the weights.
static void initSupportedInterfaces()
Static function which initliazes all supported interfaces, has to be called once before getSupportedI...
static std::map< std::string, AbstractInterface * > getSupportedInterfaces()
Returns interfaces supported by the MVA Interface.
General options which are shared by all MVA trainings.
Wraps the data of a single event into a Dataset.
The Weightfile class serializes all information about a training into an xml tree.
static Weightfile loadFromStream(std::istream &stream)
Static function which deserializes a Weightfile from a stream.
void getOptions(Options &options) const
Fills an Option object from the xml tree.
static Weightfile loadFromFile(const std::string &filename)
Static function which loads a Weightfile from a file.
void addSignalFraction(float signal_fraction)
Saves the signal fraction in the xml tree.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Class to store reconstructed particles.
double getPx() const
Returns x component of momentum.
double getPz() const
Returns z component of momentum.
double getEnergy() const
Returns total energy.
double getPy() const
Returns y component of momentum.
ROOT::Math::PxPyPzEVector get4Vector() const
Returns Lorentz vector.
void addExtraInfo(const std::string &name, double value)
Sets the user-defined data of given name to the given value.
const Particle * getDaughter(unsigned i) const
Returns a pointer to the i-th daughter particle.
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.