Belle II Software development
SPTCRefereeModule.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#pragma once
9
10#include <framework/core/Module.h>
11#include <framework/datastore/StoreArray.h>
12
13#include <tracking/spacePointCreation/SpacePointTrackCand.h>
14
15#include <string>
16#include <vector>
17
18namespace Belle2 {
23
37 class SPTCRefereeModule : public Module {
38
39 public:
41
42 void initialize() override;
43
44 void event() override;
45
46 void terminate() override;
47
48 protected:
49
52 typedef std::tuple<std::vector<int>, std::vector<int>> CheckInfo;
53
54 // ==================================================== PARAMETERS ============================================================
55
57 std::string m_PARAMsptcName = "";
58
60 std::string m_PARAMnewArrayName = "";
61
64 std::string m_PARAMcurlingSuffix = "_curlParts";
65
68
71
74
77
79 bool m_PARAMsplitCurlers = false;
80
83
85 bool m_PARAMuseMCInfo = true;
86
89
92
96
98 double m_PARAMminDistance = 0.;
99
101 std::vector<double> m_PARAMsetOrigin = { 0., 0., 0. };
102
103 // ======================================================= INTERNALLY USED MEMBERS =============================================
104
107
110
111 // ========================================== COUNTER VARIABLES ===============================================================
112
114 unsigned int m_SameSensorCtr;
115
117 unsigned int m_minDistanceCtr;
118
121
124
126 unsigned int m_curlingTracksCtr;
127
129 unsigned int m_regTrackStubsCtr;
130
132 unsigned int m_allInwardsCtr;
133
147
148
149 // ========================================================== MODULE METHODS ==================================================
150
155 static const std::vector<int> checkSameSensor(const Belle2::SpacePointTrackCand* trackCand);
156
160 static const std::vector<int> checkMinDistance(const Belle2::SpacePointTrackCand* trackCand, double minDistance);
161
167 const std::vector<int> checkCurling(Belle2::SpacePointTrackCand* trackCand, bool useMCInfo);
168
172 const std::vector<bool> getDirectionsOfFlight(const std::vector<const Belle2::SpacePoint*>& spacePoints, bool useMCInfo);
173
181 std::vector<Belle2::SpacePointTrackCand>
182 splitTrackCand(const Belle2::SpacePointTrackCand* trackCand, const std::vector<int>& splitIndices, bool onlyFirstPart,
183 const CheckInfo& prevChecksInfo, bool removedHits);
184
192 template <typename TrueHitType>
193 bool getDirOfFlightTrueHit(const Belle2::SpacePoint* spacePoint, B2Vector3F origin);
194
199 std::vector<bool> getDirsOfFlightSpacePoints(const std::vector<const Belle2::SpacePoint*>& spacePoints, B2Vector3F origin);
200
204 bool getDirOfFlightPosMom(B2Vector3F position, B2Vector3F momentum, B2Vector3F origin);
205
210 static void
212
219 const Belle2::SpacePointTrackCand* origTrackCand);
220
224 static unsigned short int getCheckStatus(const Belle2::SpacePointTrackCand* trackCand);
225
230 const std::vector<int> removeSpacePoints(Belle2::SpacePointTrackCand* trackCand, const std::vector<int>& indsToRemove);
231
234 template<typename T>
235 static bool vectorHasValueBetween(std::vector<T> V, std::pair<T, T> P)
236 {
237 return std::find_if(V.begin(), V.end(), [&P](const T & aValue) { return (aValue < P.second && aValue >= P.first);}) != V.end();
238 }
239
240 private:
244 };
245
246}
Module()
Constructor.
Definition Module.cc:30
unsigned int m_kickedSpacePointsCtr
counter of kicked SpacePoints
bool m_PARAMkeepOnlyFirstPart
parameter for keeping only the first part of a curling SpacePointTrackCand
std::vector< bool > getDirsOfFlightSpacePoints(const std::vector< const Belle2::SpacePoint * > &spacePoints, B2Vector3F origin)
get the directions of flight for a vector of SpacePoints using only information from SpacePoints (i....
static const std::vector< int > checkSameSensor(const Belle2::SpacePointTrackCand *trackCand)
Check if two subsequent SpacePoints are on the same sensor.
std::string m_curlingArrayName
name of the StoreArray in which the trackStubs from a curling SPTC are stored
const std::vector< int > checkCurling(Belle2::SpacePointTrackCand *trackCand, bool useMCInfo)
Check if the SpacePointTrackCand shows curling behavior.
StoreArray< SpacePointTrackCand > m_inputSpacePointTrackCands
Input SpacePointTrackCands StoreArray.
unsigned int m_regTrackStubsCtr
counter for the number of track stubs that were registered by this module
StoreArray< SpacePointTrackCand > m_curlingSpacePointTrackCands
Curling SpacePointTrackCands StoreArray.
unsigned int m_SameSensorCtr
counter for TrackCands with SpacePoints on the same sensor
static void copyToNewStoreArray(const Belle2::SpacePointTrackCand *trackCand, Belle2::StoreArray< Belle2::SpacePointTrackCand > newStoreArray)
copy the SpacePointTrackCand to a new StoreArray and register a relation to the original trackCand
double m_PARAMminDistance
minimal distance two subsequent SpacePoints have to be separated
void initialize() override
initialize: check StoreArrays, initialize counters, ...
unsigned int m_minDistanceCtr
counter for TrackCands with SpacePoints not far enough apart
static unsigned short int getCheckStatus(const Belle2::SpacePointTrackCand *trackCand)
get the checked referee status of a SPTC (i.e.
std::vector< double > m_PARAMsetOrigin
assumed interaction point from which the SpacePointTrackCands emerge.
void event() override
event: check SpacePointTrackCands
bool getDirOfFlightTrueHit(const Belle2::SpacePoint *spacePoint, B2Vector3F origin)
get the direction of flight for a SpacePoint by using information from the underlying TrueHit NOTE: t...
void terminate() override
terminate: print some summary information
std::tuple< std::vector< int >, std::vector< int > > CheckInfo
typedef for storing the outcome of previously done checks to have them available later.
unsigned int m_totalTrackCandCtr
counter for the total number of TrackCands
std::string m_PARAMsptcName
Name of input container of SpacePointTrackCands.
B2Vector3F m_origin
origin used internally.
std::vector< Belle2::SpacePointTrackCand > splitTrackCand(const Belle2::SpacePointTrackCand *trackCand, const std::vector< int > &splitIndices, bool onlyFirstPart, const CheckInfo &prevChecksInfo, bool removedHits)
split a curling SpacePointTrackCand into TrackStubs.
StoreArray< SpacePointTrackCand > m_optionalOutputSpacePointTrackCands
Optional output SpacePointTrackCands StoreArray.
int m_PARAMminNumSpacePoints
only keep track candidates which have at least m_PARAMminNumSpacePoints space points
static const std::vector< int > checkMinDistance(const Belle2::SpacePointTrackCand *trackCand, double minDistance)
Check if two subsequent SpacePoints are separated by at least the provided minDistance.
bool getDirOfFlightPosMom(B2Vector3F position, B2Vector3F momentum, B2Vector3F origin)
get the direction of flight provided the global position and momentum of a SpacePoint/TrueHit for the...
unsigned int m_allInwardsCtr
counter for the number of SPTCs which have direction of flight inward for all SpacePoints in them
bool m_PARAMkickSpacePoint
parameter for indicating if only the 'problematic' SpacePoint shall be removed from the SPTC or if th...
bool m_PARAMstoreNewArray
parameter for indicating if all checked SpacePointTrackCands should be stored in a new StoreArray NOT...
unsigned int m_curlingTracksCtr
counter for tracks that curl
void addToStoreArray(const Belle2::SpacePointTrackCand &trackCand, Belle2::StoreArray< Belle2::SpacePointTrackCand > storeArray, const Belle2::SpacePointTrackCand *origTrackCand)
register the SpacePointTrackCand (i.e.
const std::vector< int > removeSpacePoints(Belle2::SpacePointTrackCand *trackCand, const std::vector< int > &indsToRemove)
remove the SpacePoint passed to this function from the SpacePointTrackCand
bool m_PARAMcheckSameSensor
parameter for indicating if the check for subsequent SpacePoints being on the same sensor should be d...
bool m_PARAMcheckMinDistance
parameter for indicating if the check for the minimal distance between two subsequent SpacePoints sho...
std::string m_PARAMcurlingSuffix
Suffix that will be used to get a name for the StoreArray that holds the trackStubs that were obtaine...
std::string m_PARAMnewArrayName
Name of the output container of SpacePointTrackCands if 'storeNewArray' is set to true.
void initializeCounters()
initialize all counters to 0
bool m_PARAMuseMCInfo
parameter for indicating if MC information should be used or not
const std::vector< bool > getDirectionsOfFlight(const std::vector< const Belle2::SpacePoint * > &spacePoints, bool useMCInfo)
get the directions of Flight for every SpacePoint in the passed vector.
bool m_PARAMcheckIfFitted
if true it is looked for any related RecoTrack and if that RecoTrack has a valid fit.
bool m_PARAMsplitCurlers
parameter for switching on/off the splitting of curling SpacePointTrackCands
static bool vectorHasValueBetween(std::vector< T > V, std::pair< T, T > P)
function to determine if any of the values in vector V are between the values of P (i....
bool m_PARAMcheckCurling
parameter for indicating if the SpacePointTrackCand should be checked for curling
Storage for (VXD) SpacePoint-based track candidates.
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Definition SpacePoint.h:42
Accessor to arrays stored in the data store.
Definition StoreArray.h:113
B2Vector3< float > B2Vector3F
typedef for common usage with float
Definition B2Vector3.h:525
Abstract base class for different kinds of events.