10 #include <analysis/modules/LowEnergyPi0VetoExpert/LowEnergyPi0VetoExpertModule.h>
13 #include <analysis/variables/ECLVariables.h>
14 #include <analysis/variables/HelicityVariables.h>
15 #include <mva/interface/Interface.h>
16 #include <boost/algorithm/string/predicate.hpp>
19 #include <Math/Vector3D.h>
20 #include <Math/Vector4D.h>
21 #include <Math/VectorUtil.h>
32 "Veto for pi0 daughters (maximum over all pairs excluding this pi0).",
35 std::string(
"gamma"));
40 "Database identifier or file used to load the weights.",
71 std::stringstream ss((*m_weightfile_representation)->m_data);
91 m_expert = supported_interfaces[general_options.m_method]->getExpert();
93 std::vector<float> dummy;
100 dummy.resize(nInputVariables, 0);
109 for (
int i = 0; i < n; ++i) {
111 if (gamma1 == gamma2)
113 if (pi0Gamma !=
nullptr) {
114 if (pi0Gamma == gamma2)
118 if (pi0Mass < 0.07 || pi0Mass > 0.20)
120 const Particle* gammaLowEnergy, *gammaHighEnergy;
122 gammaLowEnergy = gamma2;
123 gammaHighEnergy = gamma1;
125 gammaLowEnergy = gamma1;
126 gammaHighEnergy = gamma2;
128 double gammaLowEnergyEnergy, gammaHighEnergyEnergy;
129 double gammaLowEnergyE9E21, gammaHighEnergyE9E21;
130 double gammaLowEnergyClusterTheta, gammaHighEnergyClusterTheta;
131 double gammaLowEnergyZernikeMVA, gammaHighEnergyZernikeMVA;
132 double gammaLowEnergyIsolation, gammaHighEnergyIsolation;
133 double cosHelicityAngleMomentum;
134 gammaLowEnergyEnergy = gammaLowEnergy->
getEnergy();
135 gammaHighEnergyEnergy = gammaHighEnergy->
getEnergy();
136 ROOT::Math::PxPyPzEVector gammaHighEnergyMomentum(
137 gammaHighEnergy->
getPx(), gammaHighEnergy->
getPy(),
138 gammaHighEnergy->
getPz(), gammaHighEnergyEnergy);
139 ROOT::Math::PxPyPzEVector gammaLowEnergyMomentum(
140 gammaLowEnergy->
getPx(), gammaLowEnergy->
getPy(),
141 gammaLowEnergy->
getPz(), gammaLowEnergyEnergy);
142 ROOT::Math::PxPyPzEVector momentum = gammaHighEnergyMomentum +
143 gammaLowEnergyMomentum;
144 ROOT::Math::XYZVector boost = momentum.BoostToCM();
145 gammaHighEnergyMomentum =
146 ROOT::Math::VectorUtil::boost(gammaHighEnergyMomentum, boost);
147 cosHelicityAngleMomentum =
148 fabs(ROOT::Math::VectorUtil::CosTheta(momentum.Vect(),
149 gammaHighEnergyMomentum.Vect()));
150 gammaLowEnergyE9E21 = Variable::eclClusterE9E21(gammaLowEnergy);
151 gammaHighEnergyE9E21 = Variable::eclClusterE9E21(gammaHighEnergy);
152 gammaLowEnergyClusterTheta = Variable::eclClusterTheta(gammaLowEnergy);
153 gammaHighEnergyClusterTheta = Variable::eclClusterTheta(gammaHighEnergy);
155 gammaLowEnergyZernikeMVA =
156 Variable::eclClusterZernikeMVA(gammaLowEnergy);
157 gammaHighEnergyZernikeMVA =
158 Variable::eclClusterZernikeMVA(gammaHighEnergy);
159 gammaLowEnergyIsolation = Variable::eclClusterIsolation(gammaLowEnergy);
160 gammaHighEnergyIsolation =
161 Variable::eclClusterIsolation(gammaHighEnergy);
163 m_dataset->m_input[0] = gammaLowEnergyEnergy;
165 m_dataset->m_input[2] = cosHelicityAngleMomentum;
166 m_dataset->m_input[3] = gammaLowEnergyE9E21;
167 m_dataset->m_input[4] = gammaHighEnergyE9E21;
168 m_dataset->m_input[5] = gammaLowEnergyClusterTheta;
169 m_dataset->m_input[6] = gammaHighEnergyClusterTheta;
171 m_dataset->m_input[7] = gammaLowEnergyZernikeMVA;
172 m_dataset->m_input[8] = gammaHighEnergyZernikeMVA;
173 m_dataset->m_input[9] = gammaLowEnergyIsolation;
174 m_dataset->m_input[10] = gammaHighEnergyIsolation;
187 for (
int i = 0; i < n; ++i) {
191 const Particle* gammaLowEnergy, *gammaHighEnergy;
193 gammaLowEnergy = gamma2;
194 gammaHighEnergy = gamma1;
196 gammaLowEnergy = gamma1;
197 gammaHighEnergy = gamma2;
200 pi0->
addExtraInfo(
"lowEnergyPi0VetoGammaLowEnergy", maxVeto);
202 pi0->
addExtraInfo(
"lowEnergyPi0VetoGammaHighEnergy", maxVeto);
206 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 everytime the weightfile in the database changes i...
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 std::map< std::string, AbstractInterface * > getSupportedInterfaces()
Returns interfaces supported by the MVA Interface.
static void initSupportedInterfaces()
Static function which initliazes all supported interfaces, has to be called once before getSupportedI...
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.
REG_MODULE(B2BIIConvertBeamParams)
Register the module.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Abstract base class for different kinds of events.