10 #include <analysis/modules/KlongDecayReconstructor/KlongMomentumCalculatorExpertModule.h>
13 #include <framework/logging/Logger.h>
16 #include <analysis/dataobjects/Particle.h>
19 #include <analysis/DecayDescriptor/DecayDescriptorParticle.h>
22 #include <analysis/DecayDescriptor/ParticleListName.h>
23 #include <analysis/utility/ParticleCopy.h>
25 #include <Math/Vector4D.h>
42 KlongMomentumCalculatorExpertModule::KlongMomentumCalculatorExpertModule() :
47 setDescription(
"This module is used to employ kinematic constraints to determine the momentum of Klongs for two body B decays containing a K_L0 and something else. The module creates a list of K_L0 candidates whose K_L0 momentum is reconstructed by combining the reconstructed direction (from either the ECL or KLM) of the K_L0 and kinematic constraints of the intial state.");
52 "Input DecayDescriptor string.");
55 "Don't reconstruct channel if more candidates than given are produced.", -1);
56 addParam(
"decayMode",
m_decayModeID,
"User-specified decay mode identifier (saved in 'decayModeID' extra-info for each Particle)",
59 "If true, the output ParticleList will be saved by RootOutput. If false, it will be ignored when writing the file.",
false);
61 "Suffix attached to the output K_L list, if not defined it is set to '_reco' \n", std::string(
"_reco"));
94 for (
int i = 0; i < nProducts; ++i) {
105 B2FATAL(
"This module is meant to reconstruct decays with a K_L0 in the final state. There is no K_L0 in this decay!");
123 int numberOfCandidates = 0;
130 bool is_physical =
true;
132 const std::vector<Particle*> daughters = particle.
getDaughters();
134 if (daughters.size() < 2)
135 B2FATAL(
"Reconstructing particle as a daughter of a decay with less then 2 daughters!");
137 if (daughters.size() > 3)
138 B2FATAL(
"Higher multiplicity (>2) missing momentum decays not implemented yet!");
140 ROOT::Math::PxPyPzEVector pDaughters;
141 for (
auto daughter : daughters) {
143 pDaughters += daughter->get4Vector();
147 ROOT::Math::PxPyPzEVector klDaughters;
148 for (
auto daughter : daughters) {
151 klDaughters += daughter->get4Vector();
163 for (
auto daughter : daughters) {
165 m_j = daughter->getPDGMass();
166 idx = daughter->getArrayIndex() + idx * 100;
170 if (daughters.size() == 3) {
171 m_j = pDaughters.M();
174 double s_p = (klDaughters.Vect().Unit()).Dot(pDaughters.Vect());
175 double m_sum = (m_b * m_b) - (m_j * m_j) - (m_k * m_k);
176 double e_j = pDaughters.E();
178 double s_p2 = s_p * s_p;
179 double m_sum2 = m_sum * m_sum;
180 double s_pm = s_p * m_sum;
181 double e_j2 = e_j * e_j;
182 double m_k2 = m_k * m_k;
184 k_mag1 = (s_pm + std::sqrt((s_p2) * (m_sum2) - 4 * ((e_j2) - (s_p2)) * ((e_j2) * (m_k2) - (m_sum2) / 4))) / (2 * (e_j2 - s_p2));
185 k_mag2 = (s_pm - std::sqrt((s_p2) * (m_sum2) - 4 * ((e_j2) - (s_p2)) * ((e_j2) * (m_k2) - (m_sum2) / 4))) / (2 * (e_j2 - s_p2));
187 ROOT::Math::PxPyPzEVector missDaughters;
190 missDaughters = k_mag1 * klDaughters / klDaughters.P();
192 missDaughters = k_mag2 * klDaughters / klDaughters.P();
193 missDaughters.SetE(std::sqrt(m_k * m_k + missDaughters.P2()));
195 for (
auto daughter : daughters) {
197 if (!isnan(missDaughters.P())) {
205 ROOT::Math::PxPyPzEVector mom = pDaughters + missDaughters;
206 mom.SetE(std::sqrt(m_b * m_b + mom.P2()));
212 if (!
m_cut->check(&particle))
218 numberOfCandidates++;
int getPDGCode() const
PDG code.
double getMass() const
Particle mass.
static const ParticleType Klong
K^0_L particle.
EStoreFlags
Flags describing behaviours of objects etc.
@ c_WriteOut
Object/array should be saved by output modules.
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
Represents a particle in the DecayDescriptor.
int getPDGCode() const
Return PDG code.
std::string getFullName() const
returns the full name of the particle full_name = name:label
bool init(const std::string &str)
Initialise the DecayDescriptor from given string.
const DecayDescriptorParticle * getMother() const
return mother.
int getNDaughters() const
return number of direct daughters.
const DecayDescriptor * getDaughter(int i) const
return i-th daughter (0 based index).
static std::unique_ptr< GeneralCut > compile(const std::string &cut)
Creates an instance of a cut and returns a unique_ptr to it, if you need a copy-able object instead y...
bool m_isSelfConjugatedParticle
flag that indicates whether an anti-particle mother does not exist and should not be reconstructed as...
StoreObjPtr< ParticleList > m_koutputList
Klong output particle list.
int m_maximumNumberOfCandidates
drop all candidates if more candidates than this parameter are produced
std::string m_antiListName
output anti-particle list name
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
std::string m_decayString
Input DecayString specifying the decay being reconstructed.
std::string m_listName
output particle list name
std::string m_recoList
Suffix attached to the output K_L list, if not defined it is set to '_reco'
std::unique_ptr< ParticleGenerator > m_generator
Generates the combinations.
std::unique_ptr< Variable::Cut > m_cut
cut object which performs the cuts
int m_decayModeID
user specified decay mode identifier
std::string m_cutParameter
selection criteria
DecayDescriptor m_decaydescriptor
Decay descriptor of the decay being reconstructed.
bool m_writeOut
toggle output particle list btw.
int m_pdgCode
PDG code of the combined mother particle.
std::string m_klistName
output K_L0 particle list name
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.
std::vector< Belle2::Particle * > getDaughters() const
Returns a vector of pointers to daughter particles.
double getPDGMass(void) const
Returns uncertainty on the invariant mass (requires valid momentum error matrix)
void addExtraInfo(const std::string &name, double value)
Sets the user-defined data of given name to the given value.
void set4Vector(const ROOT::Math::PxPyPzEVector &p4)
Sets Lorentz vector.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Accessor to arrays stored in the data store.
Type-safe access to single objects in the data store.
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.
Particle * copyParticle(const Particle *original)
Function takes argument Particle and creates a copy of it and copies of all its (grand-)^n-daughters.
std::string antiParticleListName(const std::string &listName)
Returns name of anti-particle-list corresponding to listName.
Abstract base class for different kinds of events.