Belle II Software release-09-00-00
TOPReconstructorModule.h
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#pragma once
10
11#include <framework/core/Module.h>
12#include <framework/datastore/StoreArray.h>
13#include <framework/datastore/StoreObjPtr.h>
14#include <mdst/dataobjects/Track.h>
15#include <tracking/dataobjects/ExtHit.h>
16#include <top/dataobjects/TOPDigit.h>
17#include <top/dataobjects/TOPRecBunch.h>
18#include <top/dataobjects/TOPBarHit.h>
19#include <top/dataobjects/TOPLikelihood.h>
20#include <top/dataobjects/TOPPull.h>
21#include <top/reconstruction_cpp/PDFConstructor.h>
22#include <top/reconstruction_cpp/TOPTrack.h>
23#include <framework/gearbox/Const.h>
24#include <vector>
25#include <string>
26#include <limits>
27
28namespace Belle2 {
41
42 public:
43
48
53 {}
54
60 virtual void initialize() override;
61
65 virtual void event() override;
66
67 private:
68
73
75 std::vector<TOP::PDFConstructor*> PDFs;
77 bool isValid = false;
84 PDFCollection(const TOP::TOPTrack& trk, bool deltaRayModeling)
85 {
86 topTrack = &trk;
87 for (const auto& chargedStable : Const::chargedStableSet) {
88 auto* pdf = new TOP::PDFConstructor(trk, chargedStable);
89 if (not pdf->isValid()) {
90 delete pdf;
91 for (auto PDF : PDFs) delete PDF;
92 PDFs.clear();
93 return;
94 }
95 pdf->switchDeltaRayPDF(deltaRayModeling);
96 PDFs.push_back(pdf);
97 }
98 isValid = true;
99 }
100
105 {
106 for (auto pdf : PDFs) delete pdf;
107 PDFs.clear();
108 isValid = false;
109 }
110
115 {
116 if (not isValid) return;
117 double maxLogL = -std::numeric_limits<double>::infinity();
118 for (const auto pdf : PDFs) {
119 double logL = pdf->getLogL().logL;
120 if (logL > maxLogL) {
121 mostProbable = pdf;
122 maxLogL = logL;
123 }
124 }
125 }
126
132 {
133 if (not isValid) return;
134 for (const auto pdf : PDFs) pdf->appendPDFOther(pdfOther);
135 }
136
141 {
142 if (not isValid) return;
143 for (const auto pdf : PDFs) pdf->clearPDFOther();
144 }
145
146 };
147
148 // Module steering parameters
149
150 double m_minTime = 0;
151 double m_maxTime = 0;
152 int m_PDGCode = 0;
154 double m_pTCut;
159 // datastore objects
160
169 };
170
172} // Belle2 namespace
173
static const ParticleSet chargedStableSet
set of charged stable particles
Definition: Const.h:618
Base class for Modules.
Definition: Module.h:72
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
TOP reconstruction module.
bool m_deltaRayModeling
include or exclude delta-ray modeling in log likelihood calculation
StoreObjPtr< TOPRecBunch > m_recBunch
reconstructed bunch
StoreArray< TOPLikelihood > m_likelihoods
collection of likelihoods
std::string m_topDigitCollectionName
name of the collection of TOPDigits
double m_maxTime
optional upper time limit for photons
double m_minTime
optional lower time limit for photons
StoreArray< Track > m_tracks
collection of tracks
StoreArray< TOPPull > m_topPulls
collection of pulls
double m_pTCut
pT cut to suppress badly extrapolated tracks that cannot reach TOP counter
std::string m_topLikelihoodCollectionName
name of the collection of created TOPLikelihoods
StoreArray< TOPDigit > m_digits
collection of digits
StoreArray< ExtHit > m_extHits
collection of extrapolated hits
StoreArray< TOPBarHit > m_barHits
collection of MCParticle hits at TOP
std::string m_topPullCollectionName
name of the collection of created TOPPulls
int m_PDGCode
PDG code of hypothesis to construct pulls.
virtual ~TOPReconstructorModule()
Destructor.
PDF construction and log likelihood determination for a given track and particle hypothesis.
Reconstructed track at TOP.
Definition: TOPTrack.h:39
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
Abstract base class for different kinds of events.
A collection of PDF's of charged stable particles for a given track.
void setMostProbable()
Sets most probable hypothesis.
PDFCollection(const TOP::TOPTrack &trk, bool deltaRayModeling)
Constructor.
const TOP::PDFConstructor * mostProbable
PDF of most probable particle hypothesis.
bool isValid
true if all PDF's are provided
void deletePDFs()
Release memory allocated in the constructor.
std::vector< TOP::PDFConstructor * > PDFs
PDF's of charged stable particles.
void clearPDFOther()
Clear the containers of PDF's of other tracks.
void appendPDFOther(const TOP::PDFConstructor *pdfOther)
Append most probable PDF of other track in the same module.