Belle II Software  release-06-00-14
ParticleMassUpdaterModule.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/ParticleMassUpdater/ParticleMassUpdaterModule.h>
10 #include <analysis/dataobjects/ParticleList.h>
11 
12 #include <framework/datastore/StoreObjPtr.h>
13 #include <framework/gearbox/Const.h>
14 
15 using namespace std;
16 using namespace Belle2;
17 
18 // Register module in the framework
19 REG_MODULE(ParticleMassUpdater)
20 
22 {
23  //Set module properties
24  setDescription("This module replaces the mass of the particles inside the given particleLists with the invariant mass of the particle corresponding to the given pdgCode.");
25  setPropertyFlags(c_ParallelProcessingCertified);
26  //Parameter definition
27  addParam("particleLists", m_strParticleLists, "List of ParticleLists", vector<string>());
28  addParam("pdgCode", m_pdgCode, "PDG code for mass reference", Const::photon.getPDGCode());
29 }
30 
31 void ParticleMassUpdaterModule::initialize()
32 {
33 }
34 
35 void ParticleMassUpdaterModule::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  iParticle -> updateMass(m_pdgCode);
50  }
51  }
52  }
53 }
54 
55 void ParticleMassUpdaterModule::terminate()
56 {
57 }
58 
Base class for Modules.
Definition: Module.h:72
This module replaces the mass of the particles inside the given particleLists with the invariant mass...
Class to store reconstructed particles.
Definition: Particle.h:74
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:95
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.