13 #include <analysis/modules/DuplicateVertexMarker/DuplicateVertexMarkerModule.h>
15 #include <analysis/dataobjects/Particle.h>
17 #include <framework/logging/Logger.h>
31 setDescription(
"Identify duplicate vertices (distinct particles, but built from the same daughters) and mark the one with best chi2. Only works if the particle has exactly two daughters. Mainly used to deal when merging V0 vertices with hand-built ones.");
32 setPropertyFlags(c_ParallelProcessingCertified);
35 addParam(
"particleList", m_particleList,
"Input ParticleList name");
36 addParam(
"extraInfoName", m_extraInfoName,
37 "Extra-info field added to all particles in the input list. 1 for the best vertex, 0 for lower ranked ones.",
38 string(
"highQualityVertex"));
39 addParam(
"prioritiseV0", m_prioritiseV0,
40 "If a vertex is a V0, select it over its duplicate even if chi2 is worse.",
44 void DuplicateVertexMarkerModule::initialize()
46 m_inPList.isRequired(m_particleList);
49 m_targetVar = manager.getVariable(
"chiProb");
50 if (m_targetVar ==
nullptr) {
51 B2ERROR(
"DuplicateVertexMarker: Variable::Manager doesn't have variable chiProb");
55 void DuplicateVertexMarkerModule::event()
57 const int size = m_inPList->getListSize();
58 for (
int i = 0; i < size; i++) {
59 Particle* part = m_inPList->getParticle(i);
60 if (part->getNDaughters() != 2) {
61 B2WARNING(
"Vertex does not have exactly 2 daughters! SKIP.");
64 if (part->hasExtraInfo(
66 B2DEBUG(10,
"Extra Info with given name is already set!");
69 for (
int j = 0; j < size; j++) {
70 Particle* cloneCand = m_inPList->getParticle(j);
71 bool particleFight =
false;
73 if (part == cloneCand)
continue;
75 B2DEBUG(10,
"part has daughters (" << part->getDaughter(0)->getTrack() <<
") and (" << part->getDaughter(1)->getTrack() <<
")");
88 bool partNotV0 = part->hasExtraInfo(
"decayModeID");
89 bool cloneNotV0 = cloneCand->
hasExtraInfo(
"decayModeID");
90 if (partNotV0 != cloneNotV0) {
91 (partNotV0) ? (part->addExtraInfo(m_extraInfoName, 0.0)) : (cloneCand->
addExtraInfo(m_extraInfoName, 0.0));
93 B2DEBUG(10,
"V0: Discarding Particle.");
94 }
else B2DEBUG(10,
"V0: Discarding Clone");
97 if (!(part->hasExtraInfo(m_extraInfoName) || cloneCand->
hasExtraInfo(m_extraInfoName))) {
99 B2DEBUG(10, m_targetVar->function(part) <<
" vs " << m_targetVar->function(cloneCand));
100 if (m_targetVar->function(part) > m_targetVar->function(cloneCand)) {
103 part->addExtraInfo(m_extraInfoName, 0.0);
109 if (!(part->hasExtraInfo(m_extraInfoName))) {
110 part->addExtraInfo(m_extraInfoName, 1.0);
Identify duplicate vertices (distinct particles, but built from the same daughters) and mark the one ...
Class to store reconstructed particles.
const Track * getTrack() const
Returns the pointer to the Track object that was used to create this Particle (ParticleType == c_Trac...
bool hasExtraInfo(const std::string &name) const
Return whether the extra info with the given name is set.
void addExtraInfo(const std::string &name, float value)
Sets the user-defined data of given name to the given value.
unsigned getNDaughters(void) const
Returns number of daughter particles.
const Particle * getDaughter(unsigned i) const
Returns a pointer to the i-th daughter particle.
Global list of available variables.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.