11 #include <analysis/modules/RestOfEventUpdater/RestOfEventUpdaterModule.h>
13 #include <framework/datastore/StoreArray.h>
14 #include <framework/datastore/StoreObjPtr.h>
16 #include <framework/logging/Logger.h>
40 setDescription(
"Updates an existing mask (map of boolean values) for tracks or eclClusters in RestOfEvent with an available property (e.g. after performing training).");
41 setPropertyFlags(c_ParallelProcessingCertified);
44 std::vector<std::string> emptyMaskVector;
45 std::string emptyCutString;
47 addParam(
"particleList", m_inputListName,
"Name of the ParticleList which contains information that will be used for updating");
48 addParam(
"updateMasks", m_maskNamesForUpdating,
"List of all mask names which will be updated", emptyMaskVector);
49 addParam(
"cutString", m_selection,
"Cut string which will be used for updating masks", emptyCutString);
50 addParam(
"discard", m_discard,
51 "Update the ROE mask by passing or discarding particles in the provided particle list, default is to pass",
false);
54 void RestOfEventUpdaterModule::initialize()
57 m_inputList.isRequired(m_inputListName);
59 m_cut = Variable::Cut::compile(m_selection);
61 B2INFO(
"RestOfEventUpdater updated track/eclCluster ROEMask(s) with infoList: " << m_inputListName <<
" and cut: " << m_selection);
64 void RestOfEventUpdaterModule::event()
67 B2WARNING(
"Input list " << m_inputList.getName() <<
" was not created?");
72 B2WARNING(
"ROE list is not valid somehow, ROE masks are not updated!");
75 std::set<Particle::EParticleSourceObject> encounteredSources;
79 std::vector<const Particle*> particlesFromTracksToUpdate;
80 std::vector<const Particle*> particlesFromECLClustersToUpdate;
81 std::vector<const Particle*> particlesFromKLMClustersToUpdate;
82 std::vector<const Particle*> compositeParticlesToUpdate;
83 for (
unsigned j = 0; j < m_inputList->getListSize(); j++) {
84 const Particle* partWithInfo = m_inputList->getParticle(j);
86 encounteredSources.insert(mdstSource);
87 if (m_cut->check(partWithInfo)) {
88 if (mdstSource == Particle::EParticleSourceObject::c_Track) {
89 particlesFromTracksToUpdate.push_back(partWithInfo);
90 }
else if (mdstSource == Particle::EParticleSourceObject::c_ECLCluster) {
91 particlesFromECLClustersToUpdate.push_back(partWithInfo);
92 }
else if (mdstSource == Particle::EParticleSourceObject::c_KLMCluster) {
93 particlesFromKLMClustersToUpdate.push_back(partWithInfo);
94 }
else if (mdstSource == Particle::EParticleSourceObject::c_Composite or
95 mdstSource == Particle::EParticleSourceObject::c_V0) {
96 compositeParticlesToUpdate.push_back(partWithInfo);
100 if (encounteredSources.count(Particle::EParticleSourceObject::c_Track) > 0) {
101 updateMasksWithParticles(roe, particlesFromTracksToUpdate, Particle::EParticleSourceObject::c_Track);
103 if (encounteredSources.count(Particle::EParticleSourceObject::c_ECLCluster) > 0) {
104 updateMasksWithParticles(roe, particlesFromECLClustersToUpdate, Particle::EParticleSourceObject::c_ECLCluster);
106 if (encounteredSources.count(Particle::EParticleSourceObject::c_KLMCluster) > 0) {
107 updateMasksWithParticles(roe, particlesFromKLMClustersToUpdate, Particle::EParticleSourceObject::c_KLMCluster);
109 updateMasksWithV0(roe, compositeParticlesToUpdate);
114 std::vector<const Particle*>& particlesToUpdate)
116 if (particlesToUpdate.size() == 0) {
117 B2DEBUG(10,
"No particles in list provided, nothing to do");
120 for (
auto& maskToUpdate : m_maskNamesForUpdating) {
121 if (maskToUpdate ==
"") {
122 B2FATAL(
"Cannot update ROE mask with no name!");
124 for (
auto* particleV0 : particlesToUpdate) {
125 if (!roe->checkCompatibilityOfMaskAndV0(maskToUpdate, particleV0)) {
128 roe->updateMaskWithV0(maskToUpdate, particleV0);
136 for (
auto& maskToUpdate : m_maskNamesForUpdating) {
137 if (maskToUpdate ==
"") {
138 B2FATAL(
"Cannot update ROE mask with no name!");
140 if (!roe->hasMask(maskToUpdate)) {
142 roe->initializeMask(maskToUpdate,
"ROEUpdaterModule");
144 roe->excludeParticlesFromMask(maskToUpdate, particlesToUpdate, listType, m_discard);