Belle II Software development
InclusiveDstarReconstructionModule.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <analysis/modules/InclusiveDstarReconstruction/InclusiveDstarReconstructionModule.h>
10#include <analysis/utility/PCmsLabTransform.h>
11
12#include <analysis/DecayDescriptor/ParticleListName.h>
13
14#include <framework/gearbox/Const.h>
15
16#include <TDatabasePDG.h>
17
18using namespace Belle2;
19
20//-----------------------------------------------------------------
21// Register the Module
22//-----------------------------------------------------------------
23REG_MODULE(InclusiveDstarReconstruction);
24
25//-----------------------------------------------------------------
26// Implementation
27//-----------------------------------------------------------------
29{
30 // Set module properties
31 setDescription("Inclusive Dstar reconstruction by estimating the four vector using slow pions");
32
33 // Parameter definitions
34 addParam("decayString", m_decayString, "Input DecayDescriptor string", std::string(""));
35 addParam("slowPionCut", m_slowPionCut, "Cut for slow pions", std::string("useCMSFrame(p) < 0.2"));
36 addParam("DstarCut", m_DstarCut, "Cut for Dstar", std::string(""));
37
40 m_d_pdg_mass = 0;
41}
42
44
46{
49 m_pionListName = "";
50
52 if (!valid)
53 B2ERROR("Invalid input DecayString: " << m_decayString);
54
55 // mother particle: D*
57 m_dstar_pdg_code = mother->getPDGCode();
58
59 // daughter particle: pion (is the only daughter)
60 int pion_pdg_code = 0;
62 m_pionListName = daughter->getFullName();
64 pion_pdg_code = daughter->getPDGCode();
65
66 if (!pionCompatibleWithDstar(pion_pdg_code))
67 B2ERROR("Pion PDG code " << pion_pdg_code << " not compatible with D* PDG code " << m_dstar_pdg_code);
68
69 // create and register output particle list
70 m_outputListName = mother->getFullName();
71 m_outputDstarList.registerInDataStore(m_outputListName);
72 // create and register output antiparticle list
75
78
79 m_dstar_pdg_mass = TDatabasePDG::Instance()->GetParticle(m_dstar_pdg_code)->Mass();
80
81 // get the mass of daughter-D:
82 /*
83 decay 1. D*+ {413} -> pi+ {211} D0 {421}
84 decay 2. D*+ {413} -> pi0 {111} D+ {411}
85 decay 3. D*0 {423} -> pi0 {111} D0 {421}
86 */
87 int d_pdg_code = 0;
88 if (abs(m_dstar_pdg_code) == 413) {
89 d_pdg_code = (pion_pdg_code == Const::pi0.getPDGCode()) ? 411 : 421;
90 } else {
91 d_pdg_code = 421;
92 }
93 m_d_pdg_mass = TDatabasePDG::Instance()->GetParticle(d_pdg_code)->Mass();
94}
95
97{
98
99 m_outputDstarList.create();
101
102 m_outputAntiDstarList.create();
104 m_outputDstarList->bindAntiParticleList(*m_outputAntiDstarList);
105
106 unsigned int num_pions = m_inputPionList->getListSize();
107
108 for (unsigned int pion_index = 0; pion_index < num_pions; pion_index++) {
109 const Particle* pion = m_inputPionList->getParticle(pion_index);
110
111 if (!m_cut_pion->check(pion)) continue;
112
113 ROOT::Math::PxPyPzEVector dstar_four_vector = estimateDstarFourMomentum(pion);
114
115 if (isnan(dstar_four_vector.P())) continue;
116
117 /*
118 decay 1:
119 - pion-charge > 0: m_dstar_pdg_code
120 - pion-charge < 0: -m_dstar_pdg_code
121 decay 2 and 3:
122 - pion-charge = 0: m_dstar_pdg_code as well as -m_dstar_pdg_code
123 - for these cases we need to store the particleList and antiParticleList
124 with the same candidates
125 */
126
132
133 // for decay 1 and decay 2/3 with positive flavor
134 int output_dstar_pdg = getDstarOutputPDG(pion->getCharge(), m_dstar_pdg_code);
135 Particle dstar = Particle(dstar_four_vector, output_dstar_pdg,
137 particle_properties, pion->getArrayPointer());
138
139 Particle* new_dstar = m_particles.appendNew(dstar);
140 if (!m_cut_dstar->check(new_dstar)) continue;
141 m_outputDstarList->addParticle(new_dstar);
142
143 // for decay 2/3 with negative flavor
144 if (pion->getCharge() == 0) {
145 Particle antidstar = Particle(dstar_four_vector, -m_dstar_pdg_code,
147 particle_properties, pion->getArrayPointer());
148
149 Particle* new_antidstar = m_particles.appendNew(antidstar);
150 if (!m_cut_dstar->check(new_antidstar)) continue;
151 m_outputAntiDstarList->addParticle(new_antidstar);
152 }
153 }
154}
155
157{
158 // estimate D* energy and absolute momentum using the slow pion energy
159 double energy_dstar = pion->getEnergy() * m_dstar_pdg_mass / (m_dstar_pdg_mass - m_d_pdg_mass);
160 double abs_momentum_dstar = sqrt(energy_dstar * energy_dstar - m_dstar_pdg_mass * m_dstar_pdg_mass);
161
162 // dstar momentum approximated collinear to pion direction
163 ROOT::Math::PxPyPzEVector vector_pion = pion->get4Vector();
164 ROOT::Math::PxPyPzEVector vec_dstar = abs_momentum_dstar * vector_pion / vector_pion.P();
165 vec_dstar.SetE(energy_dstar);
166
167 return vec_dstar;
168}
169
171{
172 bool is_compatible = false;
173 if (pion_pdg_code == Const::pi0.getPDGCode()) {
174 is_compatible = true;
175 } else if (pion_pdg_code == Const::pion.getPDGCode()) {
176 is_compatible = (m_dstar_pdg_code == 413);
177 } else if (pion_pdg_code == -Const::pion.getPDGCode()) {
178 is_compatible = (m_dstar_pdg_code == -413);
179 }
180 return is_compatible;
181}
182
183int InclusiveDstarReconstructionModule::getDstarOutputPDG(int pion_charge, int input_dstar_pdg)
184{
185 // Helper function to get the correct D* PDG code depending on the input (DecayDescriptor)
186 // and the charge of the reconstructed pion
187
188 // DecayDescriptor: D*+ -> pi0 or D*0 -> pi0
189 // the opposite (D*- -> pi0 or anti-D*0 -> pi0) are treated from line 150.
190 if (pion_charge == 0) {
191 return input_dstar_pdg;
192 }
193
194 else {
195 // DecayDescriptor: D*+ -> pi+
196 if (input_dstar_pdg > 0) {
197 return (pion_charge > 0) ? input_dstar_pdg : -input_dstar_pdg;
198 }
199 // DecayDescriptor: D* -> pi-
200 else {
201 return (pion_charge < 0) ? input_dstar_pdg : -input_dstar_pdg;
202 }
203 }
204
205}
int getPDGCode() const
PDG code.
Definition: Const.h:473
static const ParticleType pi0
neutral pion particle
Definition: Const.h:674
static const ChargedStable pion
charged pion particle
Definition: Const.h:661
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 DecayDescriptor * getDaughter(int i) const
return i-th daughter (0 based index).
const DecayDescriptorParticle * getMother() const
return mother.
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...
Definition: GeneralCut.h:84
std::unique_ptr< Variable::Cut > m_cut_dstar
cut object which performs the cuts
bool pionCompatibleWithDstar(int pion_pdg_code)
Checks if the given pion is list if compatible with the charge of the D* particle.
virtual void initialize() override
Initialize the Module.
int m_dstar_pdg_code
PDG code of the given D* particle list.
StoreObjPtr< ParticleList > m_inputPionList
input pion particle list
std::string m_decayString
Input DecayDescriptor string.
StoreArray< Particle > m_particles
StoreArray of Particles.
virtual ~InclusiveDstarReconstructionModule()
Destructor.
StoreObjPtr< ParticleList > m_outputDstarList
output Dstar particle list
StoreObjPtr< ParticleList > m_outputAntiDstarList
output anti-Dstar particle list
DecayDescriptor m_decaydescriptor
Decay descriptor for parsing the user specified DecayString.
int getDstarOutputPDG(int pion_charge, int input_dstar_pdg)
Helper function to get the correct D* PDG code for the output list, depending on the input (DecayStri...
std::string m_pionListName
Name of the input pion particle list.
ROOT::Math::PxPyPzEVector estimateDstarFourMomentum(const Particle *pion)
Estimates the D* four momentum given a slow pion.
std::unique_ptr< Variable::Cut > m_cut_pion
cut object which performs the cuts
std::string m_outputAntiListName
Name of the output anti-D* particle list.
std::string m_outputListName
Name of the output D* particle list.
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
Class to store reconstructed particles.
Definition: Particle.h:75
double getEnergy() const
Returns total energy.
Definition: Particle.h:535
TClonesArray * getArrayPointer() const
Returns the pointer to the store array which holds the daughter particles.
Definition: Particle.h:953
double getCharge(void) const
Returns particle charge.
Definition: Particle.cc:622
ROOT::Math::PxPyPzEVector get4Vector() const
Returns Lorentz vector.
Definition: Particle.h:547
@ c_Flavored
Is either particle or antiparticle.
Definition: Particle.h:96
@ c_IsIgnoreNeutrino
Is the particle MC matched with the ignore missing neutrino flag set?
Definition: Particle.h:122
@ c_IsIgnoreRadiatedPhotons
Is the particle MC matched with the ignore radiated photon flag set?
Definition: Particle.h:119
@ c_IsIgnoreGamma
Is the particle MC matched with the ignore missing gamma flag set?
Definition: Particle.h:123
@ c_IsIgnoreIntermediate
Is the particle MC matched with the ignore intermediate resonances flag set?
Definition: Particle.h:120
@ c_IsIgnoreMassive
Is the particle MC matched with the ignore missing massive particle flag set?
Definition: Particle.h:121
int getArrayIndex() const
Returns this object's array index (in StoreArray), or -1 if not found.
T * appendNew()
Construct a new T object at the end of the array.
Definition: StoreArray.h:246
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
std::string antiParticleListName(const std::string &listName)
Returns name of anti-particle-list corresponding to listName.
Abstract base class for different kinds of events.