Belle II Software  release-05-01-25
V0DaughterMassUpdaterModule.cc
1 /**************************************************************************
2 * BASF2 (Belle Analysis Framework 2) *
3 * Copyright(C) 2018 - Belle II Collaboration *
4 * *
5 * Author: The Belle II Collaboration *
6 * Contributors: Yefan Tao ustctao@ufl.edu *
7 * *
8 * This software is provided "as is" without any warranty. *
9 **************************************************************************/
10 
11 #include <analysis/modules/V0DaughterMassUpdater/V0DaughterMassUpdaterModule.h>
12 #include <analysis/dataobjects/ParticleList.h>
13 
14 #include <framework/datastore/StoreObjPtr.h>
15 
16 using namespace std;
17 using namespace Belle2;
18 
19 // Register module in the framework
20 REG_MODULE(V0DaughterMassUpdater)
21 
23 {
24  //Set module properties
25  setDescription("This module replaces the mass of two daughters of the selected V0 particles inside the given particleLists with masses of given pdgCode. The particle in selected particleList has to have 2 daughters.");
26  setPropertyFlags(c_ParallelProcessingCertified);
27  //Parameter definition
28  addParam("particleLists", m_strParticleLists, "List of ParticleLists", vector<string>());
29  addParam("pdgCodeOfV0posDaughter", m_pdg_pos_dau, "PDG code of daughter with positive charge", 11);
30  addParam("pdgCodeOfV0negDaughter", m_pdg_neg_dau, "PDG code of daughter with negative charge", 11);
31 
32 }
33 
34 
35 void V0DaughterMassUpdaterModule::event()
36 {
37 
38 
39  for (auto& iList : m_strParticleLists) {
40 
41  StoreObjPtr<ParticleList> particlelist(iList);
42  if (!particlelist) {
43  B2ERROR("ParticleList " << iList << " not found");
44  continue;
45  } else {
46  if (particlelist->getListSize() == 0) continue;
47  for (unsigned int i = 0; i < particlelist->getListSize(); ++i) {
48  Particle* iParticle = particlelist->getParticle(i);
49  if (iParticle->getParticleSource() != Particle::EParticleSourceObject::c_Composite)
50  B2FATAL("This V0 particle is not a composite particle!");
51  else {
52  std::vector<Belle2::Particle*> dau = iParticle -> getDaughters();
53  if (dau.size() != 2)
54  B2FATAL("This V0 particle has " << dau.size() << " daughters, the number of daughters has to be 2.");
55  else {
56  // To check daughters order of V0 is correct (first positive, second negative)
57  bool correctOrder = true;
58  if (dau[0]->getCharge() < 0 && dau[1]->getCharge() > 0) correctOrder = false;
59  if (correctOrder) {
60  dau[0]->updateMass(m_pdg_pos_dau);
61  dau[1]->updateMass(m_pdg_neg_dau);
62  } else {
63  dau[0]->updateMass(m_pdg_neg_dau);
64  dau[1]->updateMass(m_pdg_pos_dau);
65  }
66  }
67  }
68  }
69  }
70  }
71 }
72 
Belle2::V0DaughterMassUpdaterModule
This module replaces the mass of two daughters of the selected V0 particles inside the given particle...
Definition: V0DaughterMassUpdaterModule.h:33
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::Module
Base class for Modules.
Definition: Module.h:74
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::Particle
Class to store reconstructed particles.
Definition: Particle.h:77
Belle2::Particle::getParticleSource
EParticleSourceObject getParticleSource() const
Returns particle source as defined with enum EParticleSourceObject.
Definition: Particle.h:404