10#include <analysis/modules/LowEnergyPi0VetoExpert/LowEnergyPi0VetoExpertModule.h>
13#include <analysis/variables/ECLVariables.h>
16#include <mva/interface/Interface.h>
19#include <boost/algorithm/string/predicate.hpp>
22#include <Math/Vector3D.h>
23#include <Math/Vector4D.h>
24#include <Math/VectorUtil.h>
35 "Veto for pi0 daughters (maximum over all pairs excluding this pi0).",
38 std::string(
"gamma"));
43 "Database identifier or file used to load the weights.",
74 std::stringstream ss((*m_weightfile_representation)->m_data);
94 m_expert = supported_interfaces[general_options.m_method]->getExpert();
96 std::vector<float> dummy;
102 nInputVariables = 11;
103 dummy.resize(nInputVariables, 0);
112 for (
int i = 0; i < n; ++i) {
114 if (gamma1 == gamma2)
116 if (pi0Gamma !=
nullptr) {
117 if (pi0Gamma == gamma2)
121 if (pi0Mass < 0.07 || pi0Mass > 0.20)
123 const Particle* gammaLowEnergy, *gammaHighEnergy;
125 gammaLowEnergy = gamma2;
126 gammaHighEnergy = gamma1;
128 gammaLowEnergy = gamma1;
129 gammaHighEnergy = gamma2;
131 double gammaLowEnergyEnergy, gammaHighEnergyEnergy;
132 double gammaLowEnergyE9E21, gammaHighEnergyE9E21;
133 double gammaLowEnergyClusterTheta, gammaHighEnergyClusterTheta;
134 double gammaLowEnergyZernikeMVA, gammaHighEnergyZernikeMVA;
135 double gammaLowEnergyIsolation, gammaHighEnergyIsolation;
136 double cosHelicityAngleMomentum;
137 gammaLowEnergyEnergy = gammaLowEnergy->
getEnergy();
138 gammaHighEnergyEnergy = gammaHighEnergy->
getEnergy();
139 ROOT::Math::PxPyPzEVector gammaHighEnergyMomentum(
140 gammaHighEnergy->
getPx(), gammaHighEnergy->
getPy(),
141 gammaHighEnergy->
getPz(), gammaHighEnergyEnergy);
142 ROOT::Math::PxPyPzEVector gammaLowEnergyMomentum(
143 gammaLowEnergy->
getPx(), gammaLowEnergy->
getPy(),
144 gammaLowEnergy->
getPz(), gammaLowEnergyEnergy);
145 ROOT::Math::PxPyPzEVector momentum = gammaHighEnergyMomentum +
146 gammaLowEnergyMomentum;
147 ROOT::Math::XYZVector boost = momentum.BoostToCM();
148 gammaHighEnergyMomentum =
149 ROOT::Math::VectorUtil::boost(gammaHighEnergyMomentum, boost);
150 cosHelicityAngleMomentum =
151 fabs(ROOT::Math::VectorUtil::CosTheta(momentum.Vect(),
152 gammaHighEnergyMomentum.Vect()));
153 gammaLowEnergyE9E21 = Variable::eclClusterE9E21(gammaLowEnergy);
154 gammaHighEnergyE9E21 = Variable::eclClusterE9E21(gammaHighEnergy);
155 gammaLowEnergyClusterTheta = Variable::eclClusterTheta(gammaLowEnergy);
156 gammaHighEnergyClusterTheta = Variable::eclClusterTheta(gammaHighEnergy);
158 gammaLowEnergyZernikeMVA =
159 Variable::eclClusterZernikeMVA(gammaLowEnergy);
160 gammaHighEnergyZernikeMVA =
161 Variable::eclClusterZernikeMVA(gammaHighEnergy);
162 gammaLowEnergyIsolation = Variable::eclClusterIsolation(gammaLowEnergy);
163 gammaHighEnergyIsolation =
164 Variable::eclClusterIsolation(gammaHighEnergy);
166 m_dataset->m_input[0] = gammaLowEnergyEnergy;
168 m_dataset->m_input[2] = cosHelicityAngleMomentum;
169 m_dataset->m_input[3] = gammaLowEnergyE9E21;
170 m_dataset->m_input[4] = gammaHighEnergyE9E21;
171 m_dataset->m_input[5] = gammaLowEnergyClusterTheta;
172 m_dataset->m_input[6] = gammaHighEnergyClusterTheta;
174 m_dataset->m_input[7] = gammaLowEnergyZernikeMVA;
175 m_dataset->m_input[8] = gammaHighEnergyZernikeMVA;
176 m_dataset->m_input[9] = gammaLowEnergyIsolation;
177 m_dataset->m_input[10] = gammaHighEnergyIsolation;
190 for (
int i = 0; i < n; ++i) {
194 const Particle* gammaLowEnergy, *gammaHighEnergy;
196 gammaLowEnergy = gamma2;
197 gammaHighEnergy = gamma1;
199 gammaLowEnergy = gamma1;
200 gammaHighEnergy = gamma2;
203 pi0->
addExtraInfo(
"lowEnergyPi0VetoGammaLowEnergy", maxVeto);
205 pi0->
addExtraInfo(
"lowEnergyPi0VetoGammaHighEnergy", maxVeto);
209 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.