Belle II Software light-2406-ragdoll
TrackIsoCalculatorModule.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/StoreObjPtr.h>
13#include <framework/dataobjects/EventMetaData.h>
14#include <framework/logging/LogConfig.h>
15#include <framework/datastore/StoreArray.h>
16#include <framework/gearbox/Const.h>
17#include <framework/database/DBObjPtr.h>
18
19#include <analysis/dataobjects/Particle.h>
20#include <analysis/dataobjects/ParticleList.h>
21#include <analysis/VariableManager/Manager.h>
22#include <analysis/VariableManager/Utility.h>
23#include <analysis/DecayDescriptor/DecayDescriptor.h>
24#include <analysis/dbobjects/PIDDetectorWeights.h>
25
26
27namespace Belle2 {
40
41 public:
42
47
52
59 void initialize() override;
60
66 void event() override;
67
68
69 private:
70
75
79 std::string m_decayString;
80
84 unsigned short m_nSelectedDaughters;
85
90
94 std::vector<std::string> m_detNames;
95
102 std::unordered_map<std::string, std::string> m_detLayerToDistVariable;
103
109 std::unordered_map<std::string, std::string> m_detLayerToRefPartIdxVariable;
110
116
122
127 std::map<std::pair<std::string, int>, double> m_distThreshPerDetLayer = {
128 { {Const::parseDetectors(Const::CDC), 0}, 5.0 },
129 { {Const::parseDetectors(Const::CDC), 1}, 5.0 },
130 { {Const::parseDetectors(Const::CDC), 2}, 5.0 },
131 { {Const::parseDetectors(Const::CDC), 3}, 5.0 },
132 { {Const::parseDetectors(Const::CDC), 4}, 5.0 },
133 { {Const::parseDetectors(Const::CDC), 5}, 5.0 },
134 { {Const::parseDetectors(Const::CDC), 6}, 5.0 },
135 { {Const::parseDetectors(Const::CDC), 7}, 5.0 },
136 { {Const::parseDetectors(Const::CDC), 8}, 5.0 },
137 { {Const::parseDetectors(Const::TOP), 0}, 22.0 },
138 { {Const::parseDetectors(Const::ARICH), 0}, 10.0 },
139 { {Const::parseDetectors(Const::ECL), 0}, 36.0 },
140 { {Const::parseDetectors(Const::ECL), 1}, 36.0 },
141 { {Const::parseDetectors(Const::KLM), 0}, 20.0 }
142 };
143
148
153
158
163
169
174
178 std::string m_payloadName;
179
183 std::unique_ptr<DBObjPtr<PIDDetectorWeights>> m_DBWeights;
184
189 double getDistAtDetSurface(const Particle* iParticle, const Particle* jParticle, const std::string& detLayerName) const;
190
195 double getDetectorWeight(const Particle* iParticle, const std::string& detName) const;
196
212 double getWeightedSumNonIsoLayers(const Particle* iParticle, const std::string& detName, const float detWeight) const;
213
227 double getWeightedSumInvDists(const Particle* iParticle, const std::string& detName, const float detWeight) const;
228
235 double getDistThreshold(Const::EDetector det, int layer) const
236 {
237 auto detAndLayer = std::make_pair(Const::parseDetectors(det), layer);
238 return m_distThreshPerDetLayer.at(detAndLayer);
239 };
240
245
249 Const::EDetector getDetEnum(const std::string& detName) const
250 {
251
252 if (detName == "CDC") return Const::CDC;
253 else if (detName == "TOP") return Const::TOP;
254 else if (detName == "ARICH") return Const::ARICH;
255 else if (detName == "ECL") return Const::ECL;
256 else if (detName == "KLM") return Const::KLM;
257 else B2FATAL("Unknown detector component: " << detName);
258
259 };
260
261 };
263}
EDetector
Enum for identifying the detector components (detector and subdetector).
Definition: Const.h:42
static std::string parseDetectors(EDetector det)
Converts Const::EDetector object to string.
Definition: UnitConst.cc:162
The DecayDescriptor stores information about a decay tree or parts of a decay tree.
Base class for Modules.
Definition: Module.h:72
Class to store reconstructed particles.
Definition: Particle.h:75
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
Calculate track isolation variables on the input ParticleList.
StoreObjPtr< EventMetaData > m_event_metadata
The event information.
std::unique_ptr< DBObjPtr< PIDDetectorWeights > > m_DBWeights
Interface to get the database payload with the PID detector weights.
~TrackIsoCalculatorModule() override
Destructor, use this to clean up anything you created in the constructor.
void initialize() override
Use this to initialize resources or memory your module needs.
double getDistAtDetSurface(const Particle *iParticle, const Particle *jParticle, const std::string &detLayerName) const
Calculate the distance between the points where the two input extrapolated track helices cross the gi...
void event() override
Called once for each event.
std::unordered_map< std::string, std::string > m_detLayerToDistVariable
Map that associates to each detector layer (e.g., 'CDC6') the name of the variable representing the d...
std::string m_decayString
The name of the input charged stable particle list, or composite particle w/ charged stable daughters...
StoreObjPtr< ParticleList > m_pListTarget
The input ParticleList object for which distances are to be calculated.
std::string m_isoScoreVariable
The name of the variable representing the track isolation score.
double getWeightedSumInvDists(const Particle *iParticle, const std::string &detName, const float detWeight) const
Get the sum of the inverse (scaled) minimum distances over the given detector layers,...
StoreArray< Particle > m_particles
StoreArray of Particles.
std::string m_payloadName
The name of the database payload object with the MVA weights.
std::vector< std::string > m_detNames
The list of names of the detectors at whose inner (cylindrical) surface we extrapolate each track's p...
Const::EDetector getDetEnum(const std::string &detName) const
Get the enum type for this detector name.
std::string m_pListReferenceName
The name of the input ParticleList of reference tracks.
std::unordered_map< std::string, std::string > m_detLayerToRefPartIdxVariable
Map that associates to each detector layer (e.g, 'CDC6') the name of the variable representing the md...
double getDistThreshold(Const::EDetector det, int layer) const
Get the threshold value per detector layer for the distance to closest ext.
bool onlySelectedStdChargedInDecay()
Check whether input particle list and reference list are of a valid charged stable particle.
std::map< std::pair< std::string, int >, double > m_distThreshPerDetLayer
Threshold values for the distance (in [cm]) to closest ext.
double getDetectorWeight(const Particle *iParticle, const std::string &detName) const
Get the PID weight, , for this particle and detector reading it from the payload, if selected.
bool m_excludePIDDetWeights
Exclude the PID detector weights for the isolation score definition.
DecayDescriptor m_decaydescriptor
< Decay descriptor of decays to look for.
TrackIsoCalculatorModule()
Constructor: Sets the description, the properties and the parameters of the module.
double getWeightedSumNonIsoLayers(const Particle *iParticle, const std::string &detName, const float detWeight) const
Get the sum of layers with a close-by track, divided by the total number of layers,...
unsigned short m_nSelectedDaughters
The number of selected daughters in the decay string.
StoreObjPtr< ParticleList > m_pListReference
The input ParticleList object of reference tracks.
std::string m_isoScoreVariableAsWeightedAvg
The name of the variable representing the track isolation score.
bool m_useHighestProbMassForExt
If this option is set, the helix extrapolation for the target and reference particles will use the tr...
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24