Belle II Software prerelease-11-00-00a
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 <top/dbobjects/TOPCalTOFCorrection.h>
24#include <framework/gearbox/Const.h>
25#include <vector>
26#include <string>
27#include <limits>
28
29namespace Belle2 {
34
42
43 public:
44
49
55 virtual void initialize() override;
56
60 virtual void event() override;
61
62 private:
63
68
70 std::vector<TOP::PDFConstructor*> PDFs;
72 bool isValid = false;
73
79 PDFCollection(const TOP::TOPTrack& trk, bool deltaRayModeling)
80 {
81 topTrack = &trk;
82 for (const auto& chargedStable : Const::chargedStableSet) {
83 auto* pdf = new TOP::PDFConstructor(trk, chargedStable);
84 if (not pdf->isValid()) {
85 delete pdf;
86 for (auto PDF : PDFs) delete PDF;
87 PDFs.clear();
88 return;
89 }
90 pdf->switchDeltaRayPDF(deltaRayModeling);
91 PDFs.push_back(pdf);
92 }
93 isValid = true;
94 }
95
100 {
101 for (auto pdf : PDFs) delete pdf;
102 PDFs.clear();
103 isValid = false;
104 }
105
110 {
111 if (not isValid) return;
112 double maxLogL = -std::numeric_limits<double>::infinity();
113 for (const auto pdf : PDFs) {
114 double logL = pdf->getLogL().logL;
115 if (logL > maxLogL) {
116 mostProbable = pdf;
117 maxLogL = logL;
118 }
119 }
120 }
121
127 {
128 if (not isValid) return;
129 for (const auto pdf : PDFs) pdf->appendPDFOther(pdfOther);
130 }
131
136 {
137 if (not isValid) return;
138 for (const auto pdf : PDFs) pdf->clearPDFOther();
139 }
140
141 };
142
143 // Module steering parameters
144
145 double m_minTime = 0;
146 double m_maxTime = 0;
147 int m_PDGCode = 0;
149 double m_pTCut;
153
154 // datastore objects
155
163
164 // database
165
167
168 };
169
171} // Belle2 namespace
172
static const ParticleSet chargedStableSet
set of charged stable particles
Definition Const.h:618
Class for accessing objects in the database.
Definition DBObjPtr.h:21
Module()
Constructor.
Definition Module.cc:30
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
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
DBObjPtr< TOPCalTOFCorrection > m_tofCorrections
time-of-flight corrections
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.
PDF construction and log likelihood determination for a given track and particle hypothesis.
Reconstructed track at TOP.
Definition TOPTrack.h:40
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
Abstract base class for different kinds of events.
void setMostProbable()
Sets most probable hypothesis.
PDFCollection(const TOP::TOPTrack &trk, bool deltaRayModeling)
Constructor.
const TOP::PDFConstructor * mostProbable
PDF of most probable particle hypothesis.
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.