Belle II Software  release-08-01-10
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 
18 ExtraInfoRemoverModule::ExtraInfoRemoverModule() : Module()
19 {
20  //Set module properties
21  setDescription("Deletes the ExtraInfo from each particle in the given ParticleLists.");
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 
30 {
31 }
32 
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 
51  m_eventExtraInfo->removeExtraInfo();
52  }
53 
54 }
virtual void initialize() override
Initialises the module.
bool m_removeEventExtraInfo
Removes or not EventExtraInfo.
virtual void event() override
Method called for each event.
std::vector< std::string > m_strParticleLists
Name of the lists.
StoreObjPtr< EventExtraInfo > m_eventExtraInfo
event extra info object pointer
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
Class to store reconstructed particles.
Definition: Particle.h:75
void removeExtraInfo()
Remove all stored extra info fields.
Definition: Particle.cc:1285
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#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.