Belle II Software  release-05-02-19
ParticleMassUpdaterModule.cc
1 /**************************************************************************
2 * BASF2 (Belle Analysis Framework 2) *
3 * Copyright(C) 2010 - Belle II Collaboration *
4 * *
5 * Author: The Belle II Collaboration *
6 * Contributors: Fernando Abudinen *
7 * *
8 * This software is provided "as is" without any warranty. *
9 **************************************************************************/
10 
11 #include <analysis/modules/ParticleMassUpdater/ParticleMassUpdaterModule.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(ParticleMassUpdater)
21 
23 {
24  //Set module properties
25  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.");
26  setPropertyFlags(c_ParallelProcessingCertified);
27  //Parameter definition
28  addParam("particleLists", m_strParticleLists, "List of ParticleLists", vector<string>());
29  addParam("pdgCode", m_pdgCode, "PDG code for mass reference", 22);
30 }
31 
32 void ParticleMassUpdaterModule::initialize()
33 {
34 }
35 
36 void ParticleMassUpdaterModule::event()
37 {
38 
39 
40  for (auto& iList : m_strParticleLists) {
41 
42  StoreObjPtr<ParticleList> particlelist(iList);
43  if (!particlelist) {
44  B2ERROR("ParticleList " << iList << " not found");
45  continue;
46  } else {
47  if (particlelist->getListSize() == 0) continue;
48  for (unsigned int i = 0; i < particlelist->getListSize(); ++i) {
49  Particle* iParticle = particlelist->getParticle(i);
50  iParticle -> updateMass(m_pdgCode);
51  }
52  }
53  }
54 }
55 
56 void ParticleMassUpdaterModule::terminate()
57 {
58 }
59 
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::ParticleMassUpdaterModule
This module replaces the mass of the particles inside the given particleLists with the invariant mass...
Definition: ParticleMassUpdaterModule.h:35