Belle II Software  release-06-01-15
ExtraInfoRemoverModule.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/ExtraInfoRemover/ExtraInfoRemoverModule.h>
10 #include <analysis/dataobjects/ParticleList.h>
11 
12 using namespace std;
13 using namespace Belle2;
14 
15 // Register module in the framework
16 REG_MODULE(ExtraInfoRemover)
17 
19 {
20  //Set module properties
21  setDescription("Deletes the ExtraInfo from each particle in the given ParticleLists.");
22  setPropertyFlags(c_ParallelProcessingCertified);
23  //Parameter definition
24  addParam("particleLists", m_strParticleLists, "List of ParticleLists", vector<string>());
25  addParam("removeEventExtraInfo", m_removeEventExtraInfo, "If True, also eventExtraInfo will be removed", false);
26 
27 }
28 
29 void ExtraInfoRemoverModule::initialize()
30 {
31 }
32 
33 void ExtraInfoRemoverModule::event()
34 {
35 
36  for (auto& iList : m_strParticleLists) {
37 
38  StoreObjPtr<ParticleList> particleList(iList);
39  if (!particleList.isValid()) {
40  B2INFO("ParticleList " << iList << " not found");
41  continue;
42  } else {
43  for (unsigned int i = 0; i < particleList->getListSize(); ++i) {
44  Particle* iParticle = particleList ->getParticle(i);
45  iParticle->removeExtraInfo();
46  }
47  }
48  }
49 
50  if (m_removeEventExtraInfo) {
51  m_eventExtraInfo->removeExtraInfo();
52  }
53 
54 }
This module deletes the extrainfo of each particle in the given ParticleLists.
Base class for Modules.
Definition: Module.h:72
Class to store reconstructed particles.
Definition: Particle.h:74
void removeExtraInfo()
Remove all stored extra info fields.
Definition: Particle.cc:1237
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.