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