 |
Belle II Software
release-05-02-19
|
1 #include <tracking/modules/V0Finder/V0FinderModule.h>
3 #include <framework/gearbox/Const.h>
4 #include <framework/logging/Logger.h>
5 #include <framework/core/ModuleParam.templateDetails.h>
7 #include <tracking/dataobjects/RecoTrack.h>
15 setDescription(
"This is a simple V0 finder which matches all positive "
16 "tracks with all negative tracks, fitting a vertex for each "
17 "pair. Depending on the outcome of each fit, a corresponding "
18 "Belle2::V0 is stored or not.\n\n"
20 "No V0s with vertex inside the beam pipe "
21 "are saved. They are recovered in a following step.\n\n"
23 "Outside the beam pipe only a chi^2 cut is applied "
24 "('vertexChi2CutOutside').\n"
25 "The value used as beam pipe radius is a parameter and "
32 "RecoTrack StoreArray name (input)", std::string(
""));
34 "RecoTrack StoreArray name (used for track refitting)", std::string(
"CopiedRecoTracks"));
36 "Belle2::TrackFitResult StoreArray name (in- and output).\n"
37 "Note that the V0s use pointers indices into these arrays, so all hell may break loose, "
38 "if you change this.", std::string(
""));
40 "Belle2::Track StoreArray name (input).\n"
41 "Note that the V0s use pointers indices into these arrays, so all hell may break loose, "
42 "if you change this.", std::string(
""));
51 "Radius at which we switch between the two classes of cuts. "
52 "The default is a little inside the beam pipe to allow some tolerance.",
56 "Maximum chi² for the vertex fit (NDF = 1)", 50.);
59 "designate which fitAndStore function is called in V0Fitter.\n"
60 " 0: store V0 at the first vertex fit, regardless of inner hits \n"
61 " 1: remove hits inside the V0 vertex position\n"
62 " 2: mode 2 + don't use SVD hits if there is only one available SVD hit-pair (default)",
65 addParam(
"massRangeKshort",
m_MassRangeKshort,
"mass range in GeV for reconstructed Kshort used for pre-selection of candidates"
66 " (to be chosen loosely as used momenta ignore material effects)",
m_MassRangeKshort);
67 addParam(
"massRangeLambda",
m_MassRangeLambda,
"mass range in GeV for reconstructed Lambda used for pre-selection of candidates"
68 " (to be chosen loosely as used momenta ignore material effects)",
m_MassRangeLambda);
76 m_tracks.requireRelationTo(recoTracks);
87 B2FATAL(
"The minimum has to be smaller than the maximum of the Kshort mass range! min = " << std::get<0>
91 B2FATAL(
"The minimum has to be smaller than the maximum of the Lambda mass range! min = " << std::get<0>
110 B2DEBUG(200,
m_tracks.getEntries() <<
" tracks in event.");
113 std::vector<const Track*> tracksPlus;
114 tracksPlus.reserve(
m_tracks.getEntries());
116 std::vector<const Track*> tracksMinus;
117 tracksMinus.reserve(
m_tracks.getEntries());
119 for (
const auto& track :
m_tracks) {
121 B2ASSERT(recoTrack,
"No RecoTrack available for given Track.");
124 tracksPlus.push_back(&track);
127 tracksMinus.push_back(&track);
132 if (tracksPlus.empty() || tracksMinus.empty()) {
133 B2DEBUG(200,
"No interesting track pairs. tracksPlus " << tracksPlus.size() <<
", tracksMinus " << tracksMinus.size());
139 for (
auto& trackPlus : tracksPlus) {
140 for (
auto& trackMinus : tracksMinus) {
145 B2WARNING(
"Genfit exception caught. Skipping this track pair for Kshort hypothesis. " <<
LogVar(
"Genfit exception:", e.what()));
153 B2WARNING(
"Genfit exception caught. Skipping this track pair for photon hypothesis. " <<
LogVar(
"Genfit exception:", e.what()));
160 B2WARNING(
"Genfit exception caught. Skipping this track pair for Lambda hypothesis. " <<
LogVar(
"Genfit exception:", e.what()));
167 B2WARNING(
"Genfit exception caught. Skipping this track pair for anti-Lambda hypothesis. " <<
LogVar(
"Genfit exception:",
179 const double* range_m2_min =
nullptr;
180 const double* range_m2_max =
nullptr;
192 const auto trackHypotheses =
m_v0Fitter->getTrackHypotheses(v0Hypothesis);
195 double m_plus = trackHypotheses.first.getMass();
197 double E_plus = sqrt(m_plus * m_plus + p_plus * p_plus);
200 double m_minus = trackHypotheses.second.getMass();
202 double E_minus = sqrt(m_minus * m_minus + p_minus * p_minus);
205 double sum_E2 = (E_minus + E_plus) * (E_minus + E_plus);
208 double candmass_min2 = sum_E2 - (p_plus + p_minus) * (p_plus + p_minus);
209 double candmass_max2 = sum_E2 - (p_plus - p_minus) * (p_plus - p_minus);
212 bool in_range = candmass_max2 > *range_m2_min and candmass_min2 < *range_m2_max;
Exception class for error handling in GENFIT (provides storage for diagnostic information)
static const ParticleType photon
photon particle
void setDescription(const std::string &description)
Sets the description of the module.
static const ParticleType Kshort
K^0_S particle.
TVector3 getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
double m_beamPipeRadius
Radius where inside/outside beampipe is defined.
double m_mKshortMax2
pre-calculated maximum Kshort mass squared
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
double m_vertexChi2CutOutside
Chi2 cut for V0s outside of the beampipe. Applies to all.
std::string m_arrayNameTrack
StoreArray name of the Tracks (Input).
std::string m_arrayNameV0
StoreArray name of the V0 (Output).
bool m_validation
Flag if use validation.
std::unique_ptr< V0Fitter > m_v0Fitter
Object containing the actual algorithm.
void initialize() override
Registration of StoreArrays, Relations, check proper GenFit setup.
double m_mKshortMin2
pre-calculated mininum Kshort mass squared
std::tuple< double, double > m_MassRangeKshort
range for reconstructed Kshort mass used for pre-selection default range set to nomminal KS mass +/- ...
std::string m_arrayNameCopiedRecoTrack
StoreArray name of the RecoTracks.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
This is the Reconstruction Event-Data Model Track.
void event() override
Creates Belle2::V0s from Belle2::Tracks as described in the class documentation.
double m_mLambdaMax2
pre-calculated maximum Lambda mass squared
int m_v0FitterMode
fitter mode (0: store V0 at the first vertex fit, regardless of inner hits, 1: remove hits inside the...
const TrackFitResult * getTrackFitResultWithClosestMass(const Const::ChargedStable &requestedType) const
Return the track fit for a fit hypothesis with the closest mass.
Abstract base class for different kinds of events.
StoreArray< Track > m_tracks
Actually array of mdst Tracks.
Class to store variables with their name which were sent to the logging service.
std::tuple< double, double > m_MassRangeLambda
range for reconstructed Lambda mass used for pre-selection Default range set to nominal Lambda mass +...
bool preFilterTracks(const Track *trackPlus, const Track *trackMinus, const Const::ParticleType &v0Hypothesis)
helper function that gets the approximate mass range for the two given tracks and rejects candidates ...
static const ParticleType antiLambda
Anti-Lambda particle.
std::string m_arrayNameTFResult
StoreArray name of the TrackFitResults (In- and Output).
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
The ParticleType class for identifying different particle types.
std::string m_arrayNameV0ValidationVertex
StoreArray name of the V0ValidationVertex.
Class that bundles various TrackFitResults.
short int getChargeSeed() const
Return the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.
Accessor to arrays stored in the data store.
V0FinderModule()
Setting of module description, parameters.
double m_mLambdaMin2
pre-calculated mininum Lambda mass squared
std::string m_arrayNameRecoTrack
StoreArray name of the RecoTracks (Input).
static const ParticleType Lambda
Lambda particle.