Belle II Software  release-05-01-25
InclusiveDstarReconstructionModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2020 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Maximilian Welsch *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 
12 #include <analysis/modules/InclusiveDstarReconstruction/InclusiveDstarReconstructionModule.h>
13 #include <analysis/utility/PCmsLabTransform.h>
14 
15 #include <framework/datastore/StoreObjPtr.h>
16 #include <framework/datastore/StoreArray.h>
17 
18 #include <analysis/dataobjects/ParticleList.h>
19 #include <analysis/DecayDescriptor/ParticleListName.h>
20 
21 #include <TVector3.h>
22 #include <TDatabasePDG.h>
23 
24 using namespace Belle2;
25 
26 //-----------------------------------------------------------------
27 // Register the Module
28 //-----------------------------------------------------------------
29 REG_MODULE(InclusiveDstarReconstruction)
30 
31 //-----------------------------------------------------------------
32 // Implementation
33 //-----------------------------------------------------------------
35 {
36  // Set module properties
37  setDescription("Inclusive Dstar reconstruction by estimating the four vector using slow pions");
38 
39  // Parameter definitions
40  addParam("pionListName", m_inputPionListName, "Name of the input pion ParticleList", std::string(""));
41  addParam("DstarListName", m_outputDstarListName, "Name of the output D* ParticleList", std::string(""));
42  addParam("slowPionCut", m_slowPionCut, "Cut for selecting slow pions", std::string("useCMSFrame(p) < 0.2"));
43 
44  m_dstar_pdg_code = 0;
45  m_dstar_pdg_mass = 0;
46  m_d_pdg_mass = 0;
47 
48 }
49 
51 
53 {
54 
55  // check the validity of output ParticleList name
57  if (!valid)
58  B2ERROR("InclusiveDstarReconstructionModule::initialize Invalid Output ParticleList Name: " << m_outputDstarListName);
59 
60  // get output particle pdg code
62  m_dstar_pdg_code = mother->getPDGCode();
63 
65  if (!valid)
66  B2ERROR("InclusiveDstarReconstructionModule::initialize Invalid Input ParticleList Name: " << m_outputDstarListName);
67 
68  // get input particle pdg code
69  mother = m_decaydescriptor.getMother();
70  int pion_pdg_code = mother->getPDGCode();
71 
72  // check compatibility of particle lists like (D*+ needs either pi+ or pi0, D*0 only compatible with pi0)
73  if (!pionCompatibleWithDstar(pion_pdg_code))
74  B2ERROR("Pion PDG code " << pion_pdg_code << " not compatible with D* PDG code " << m_dstar_pdg_code);
75 
76  // ensure that input pion list has been registered in data store previously
78  inputPionList.isRequired();
79 
80  // create and register output particle list
82  outputDstarList.registerInDataStore();
84  outputAntiDstarList.registerInDataStore();
85 
87 
88  m_dstar_pdg_mass = TDatabasePDG::Instance()->GetParticle(m_dstar_pdg_code)->Mass();
89 
90  if (abs(m_dstar_pdg_code) == 413) {
91  m_d_pdg_mass = (pion_pdg_code == 111) ? TDatabasePDG::Instance()->GetParticle(421)->Mass() : TDatabasePDG::Instance()->GetParticle(
92  411)->Mass();
93  } else {
94  m_d_pdg_mass = TDatabasePDG::Instance()->GetParticle(421)->Mass();
95  }
96 
97 }
98 
100 {
101  StoreArray<Particle> particles;
102 
103  // create output particle lists and bind anti-particle list
105  outputDstarList.create();
106  outputDstarList->initialize(m_dstar_pdg_code, outputDstarList.getName());
107 
109  outputAntiDstarList.create();
111  outputDstarList->bindAntiParticleList(*outputAntiDstarList);
112 
113  // loop over all pions and cut on slow pion cut
115  unsigned int num_pions = inputPionList->getListSize();
116 
117  for (unsigned int pion_index = 0; pion_index < num_pions; pion_index++) {
118  const Particle* pion = inputPionList->getParticle(pion_index);
119 
120  if (!m_cut->check(pion)) {
121  continue;
122  };
123 
124  TLorentzVector dstar_four_vector = estimateDstarFourMomentum(pion);
125 
126  if (isnan(dstar_four_vector.P())) continue;
127 
128  Particle dstar = Particle(dstar_four_vector, m_dstar_pdg_code, Particle::EFlavorType::c_Flavored, {pion->getArrayIndex()},
129  pion->getArrayPointer());
130  Particle* new_dstar = particles.appendNew(dstar);
131  outputDstarList->addParticle(new_dstar);
132 
133  }
134 }
135 
137 {
138 // // estimate D* energy and absolute momentum using the slow pion energy
139  double energy_dstar = pion->getEnergy() * m_dstar_pdg_mass / (m_dstar_pdg_mass - m_d_pdg_mass);
140  double abs_momentum_dstar = sqrt(energy_dstar * energy_dstar - m_dstar_pdg_mass * m_dstar_pdg_mass);
141 
142  // dstar momentum approximated colinear to pion direction
143  TVector3 momentum_vector_pion = pion->getMomentum();
144  TVector3 momentum_vec_dstar = abs_momentum_dstar * momentum_vector_pion.Unit();
145 
146  return TLorentzVector(momentum_vec_dstar, energy_dstar);
147 }
148 
150 {
151  bool is_compatible = false;
152  if (pion_pdg_code == 111) {
153  is_compatible = true;
154  } else if (pion_pdg_code == 211) {
155  is_compatible = (m_dstar_pdg_code == 413);
156  } else if (pion_pdg_code == -211) {
157  is_compatible = (m_dstar_pdg_code == -413);
158  }
159 
160  return is_compatible;
161 }
Belle2::GeneralCut::compile
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:114
Belle2::InclusiveDstarReconstructionModule::estimateDstarFourMomentum
TLorentzVector estimateDstarFourMomentum(const Particle *pion)
Estimates the D* four momentum given a slow pion.
Definition: InclusiveDstarReconstructionModule.cc:136
Belle2::InclusiveDstarReconstructionModule::m_d_pdg_mass
float m_d_pdg_mass
PDG mass for the D daughter of the D*.
Definition: InclusiveDstarReconstructionModule.h:104
Belle2::Particle::getArrayPointer
TClonesArray * getArrayPointer() const
Returns the pointer to the store array which holds the daughter particles.
Definition: Particle.h:844
Belle2::InclusiveDstarReconstructionModule::m_decaydescriptor
DecayDescriptor m_decaydescriptor
Decay descriptor for parsing the user specifed DecayString.
Definition: InclusiveDstarReconstructionModule.h:100
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::InclusiveDstarReconstructionModule::m_inputPionListName
std::string m_inputPionListName
Name of the input pion particle list.
Definition: InclusiveDstarReconstructionModule.h:95
Belle2::DecayDescriptorParticle
Represents a particle in the DecayDescriptor.
Definition: DecayDescriptorParticle.h:37
Belle2::InclusiveDstarReconstructionModule::pionCompatibleWithDstar
bool pionCompatibleWithDstar(int pion_pdg_code)
Checks if the given pion is list if compatible with the charge of the D* particle.
Definition: InclusiveDstarReconstructionModule.cc:149
Belle2::DecayDescriptor::init
bool init(const std::string &str)
Initialise the DecayDescriptor from given string.
Definition: DecayDescriptor.cc:47
Belle2::InclusiveDstarReconstructionModule::m_slowPionCut
std::string m_slowPionCut
Cut used to identify slow pions.
Definition: InclusiveDstarReconstructionModule.h:97
Belle2::ParticleListName::antiParticleListName
std::string antiParticleListName(const std::string &listName)
Returns name of anti-particle-list corresponding to listName.
Definition: ParticleListName.cc:10
Belle2::InclusiveDstarReconstructionModule
Inclusive D* reconstruction module.
Definition: InclusiveDstarReconstructionModule.h:49
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::Particle::getEnergy
float getEnergy() const
Returns total energy.
Definition: Particle.h:455
Belle2::InclusiveDstarReconstructionModule::~InclusiveDstarReconstructionModule
virtual ~InclusiveDstarReconstructionModule()
Destructor.
Belle2::InclusiveDstarReconstructionModule::m_dstar_pdg_mass
float m_dstar_pdg_mass
PDG mass of the give D* particle list.
Definition: InclusiveDstarReconstructionModule.h:103
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::StoreObjPtr
Type-safe access to single objects in the data store.
Definition: ParticleList.h:33
Belle2::InclusiveDstarReconstructionModule::initialize
virtual void initialize() override
Initialize the Module.
Definition: InclusiveDstarReconstructionModule.cc:52
Belle2::RelationsInterface::getArrayIndex
int getArrayIndex() const
Returns this object's array index (in StoreArray), or -1 if not found.
Definition: RelationsObject.h:387
Belle2::Particle::getMomentum
TVector3 getMomentum() const
Returns momentum vector.
Definition: Particle.h:475
Belle2::InclusiveDstarReconstructionModule::m_dstar_pdg_code
int m_dstar_pdg_code
PDG code of the given D* particle list.
Definition: InclusiveDstarReconstructionModule.h:102
Belle2::Particle
Class to store reconstructed particles.
Definition: Particle.h:77
Belle2::InclusiveDstarReconstructionModule::m_cut
std::unique_ptr< Variable::Cut > m_cut
cut object which performs the cuts
Definition: InclusiveDstarReconstructionModule.h:98
Belle2::InclusiveDstarReconstructionModule::m_outputDstarListName
std::string m_outputDstarListName
Name of the output D* particle list.
Definition: InclusiveDstarReconstructionModule.h:96
Belle2::StoreArray< Particle >
Belle2::DecayDescriptor::getMother
const DecayDescriptorParticle * getMother() const
return mother.
Definition: DecayDescriptor.h:136
Belle2::InclusiveDstarReconstructionModule::event
virtual void event() override
Event Processor.
Definition: InclusiveDstarReconstructionModule.cc:99