9 #include <analysis/modules/RestOfEventUpdater/RestOfEventUpdaterModule.h>
11 #include <framework/datastore/StoreArray.h>
12 #include <framework/datastore/StoreObjPtr.h>
14 #include <framework/logging/Logger.h>
38 setDescription(
"Updates an existing mask (map of boolean values) for tracks or eclClusters in RestOfEvent with an available property (e.g. after performing training).");
39 setPropertyFlags(c_ParallelProcessingCertified);
42 std::vector<std::string> emptyMaskVector;
43 std::string emptyCutString;
45 addParam(
"particleList", m_inputListName,
"Name of the ParticleList which contains information that will be used for updating");
46 addParam(
"updateMasks", m_maskNamesForUpdating,
"List of all mask names which will be updated", emptyMaskVector);
47 addParam(
"cutString", m_selection,
"Cut string which will be used for updating masks", emptyCutString);
48 addParam(
"discard", m_discard,
49 "Update the ROE mask by passing or discarding particles in the provided particle list, default is to pass",
false);
52 void RestOfEventUpdaterModule::initialize()
55 m_inputList.isRequired(m_inputListName);
57 m_cut = Variable::Cut::compile(m_selection);
59 B2INFO(
"RestOfEventUpdater updated track/eclCluster ROEMask(s) with infoList: " << m_inputListName <<
" and cut: " << m_selection);
62 void RestOfEventUpdaterModule::event()
65 B2WARNING(
"Input list " << m_inputList.getName() <<
" was not created?");
70 B2WARNING(
"ROE list is not valid somehow, ROE masks are not updated!");
73 std::set<Particle::EParticleSourceObject> encounteredSources;
77 std::vector<const Particle*> particlesFromTracksToUpdate;
78 std::vector<const Particle*> particlesFromECLClustersToUpdate;
79 std::vector<const Particle*> particlesFromKLMClustersToUpdate;
80 std::vector<const Particle*> compositeParticlesToUpdate;
81 for (
unsigned j = 0; j < m_inputList->getListSize(); j++) {
82 const Particle* partWithInfo = m_inputList->getParticle(j);
84 encounteredSources.insert(mdstSource);
85 if (m_cut->check(partWithInfo)) {
86 if (mdstSource == Particle::EParticleSourceObject::c_Track) {
87 particlesFromTracksToUpdate.push_back(partWithInfo);
88 }
else if (mdstSource == Particle::EParticleSourceObject::c_ECLCluster) {
89 particlesFromECLClustersToUpdate.push_back(partWithInfo);
90 }
else if (mdstSource == Particle::EParticleSourceObject::c_KLMCluster) {
91 particlesFromKLMClustersToUpdate.push_back(partWithInfo);
92 }
else if (mdstSource == Particle::EParticleSourceObject::c_Composite or
93 mdstSource == Particle::EParticleSourceObject::c_V0) {
94 compositeParticlesToUpdate.push_back(partWithInfo);
98 if (encounteredSources.count(Particle::EParticleSourceObject::c_Track) > 0) {
99 updateMasksWithParticles(roe, particlesFromTracksToUpdate, Particle::EParticleSourceObject::c_Track);
101 if (encounteredSources.count(Particle::EParticleSourceObject::c_ECLCluster) > 0) {
102 updateMasksWithParticles(roe, particlesFromECLClustersToUpdate, Particle::EParticleSourceObject::c_ECLCluster);
104 if (encounteredSources.count(Particle::EParticleSourceObject::c_KLMCluster) > 0) {
105 updateMasksWithParticles(roe, particlesFromKLMClustersToUpdate, Particle::EParticleSourceObject::c_KLMCluster);
107 updateMasksWithV0(roe, compositeParticlesToUpdate);
112 std::vector<const Particle*>& particlesToUpdate)
114 if (particlesToUpdate.size() == 0) {
115 B2DEBUG(10,
"No particles in list provided, nothing to do");
118 for (
auto& maskToUpdate : m_maskNamesForUpdating) {
119 if (maskToUpdate ==
"") {
120 B2FATAL(
"Cannot update ROE mask with no name!");
122 for (
auto* particleV0 : particlesToUpdate) {
123 if (!roe->checkCompatibilityOfMaskAndV0(maskToUpdate, particleV0)) {
126 roe->updateMaskWithV0(maskToUpdate, particleV0);
134 for (
auto& maskToUpdate : m_maskNamesForUpdating) {
135 if (maskToUpdate ==
"") {
136 B2FATAL(
"Cannot update ROE mask with no name!");
138 if (!roe->hasMask(maskToUpdate)) {
140 roe->initializeMask(maskToUpdate,
"ROEUpdaterModule");
142 roe->excludeParticlesFromMask(maskToUpdate, particlesToUpdate, listType, m_discard);
Class to store reconstructed particles.
EParticleSourceObject
particle source enumerators
EParticleSourceObject getParticleSource() const
Returns particle source as defined with enum EParticleSourceObject.
Updates an existing mask (map of boolean values) for tracks or eclClusters in RestOfEvent with an ava...
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Accessor to arrays stored in the data store.
Type-safe access to single objects in the data store.
bool isValid() const
Check whether the object was created.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.