Belle II Software release-09-00-00
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 {
40 class SPTCRefereeModule : public Module {
41
42 public:
45 void initialize() override;
47 void event() override;
49 void terminate() override;
51 protected:
52
55 typedef std::tuple<std::vector<int>, std::vector<int>> CheckInfo;
56
57 // ==================================================== PARAMETERS ============================================================
58
60 std::string m_PARAMsptcName = "";
61
63 std::string m_PARAMnewArrayName = "";
64
67 std::string m_PARAMcurlingSuffix = "_curlParts";
68
71
74
77
80
82 bool m_PARAMsplitCurlers = false;
83
86
88 bool m_PARAMuseMCInfo = true;
89
92
95
99
102
104 std::vector<double> m_PARAMsetOrigin = { 0., 0., 0. };
105
106 // ======================================================= INTERNALY USED MEMBERS =============================================
107
110
113
114 // ========================================== COUNTER VARIABLES ===============================================================
115
117 unsigned int m_SameSensorCtr;
118
120 unsigned int m_minDistanceCtr;
121
124
127
129 unsigned int m_curlingTracksCtr;
130
132 unsigned int m_regTrackStubsCtr;
133
135 unsigned int m_allInwardsCtr;
136
141 {
142 m_SameSensorCtr = 0;
148 m_allInwardsCtr = 0;
149 }
150
151
152 // ========================================================== MODULE METHODS ==================================================
153
158 const std::vector<int> checkSameSensor(Belle2::SpacePointTrackCand* trackCand);
159
163 const std::vector<int> checkMinDistance(Belle2::SpacePointTrackCand* trackCand, double minDistance);
164
170 const std::vector<int> checkCurling(Belle2::SpacePointTrackCand* trackCand, bool useMCInfo);
171
175 const std::vector<bool> getDirectionsOfFlight(const std::vector<const Belle2::SpacePoint*>& spacePoints, bool useMCInfo);
176
184 std::vector<Belle2::SpacePointTrackCand>
185 splitTrackCand(const Belle2::SpacePointTrackCand* trackCand, const std::vector<int>& splitIndices, bool onlyFirstPart,
186 const CheckInfo& prevChecksInfo, bool removedHits);
187
195 template <typename TrueHitType>
196 bool getDirOfFlightTrueHit(const Belle2::SpacePoint* spacePoint, B2Vector3F origin);
197
202 std::vector<bool> getDirsOfFlightSpacePoints(const std::vector<const Belle2::SpacePoint*>& spacePoints, B2Vector3F origin);
203
207 bool getDirOfFlightPosMom(B2Vector3F position, B2Vector3F momentum, B2Vector3F origin);
208
213 void
215
222 const Belle2::SpacePointTrackCand* origTrackCand);
223
227 unsigned short int getCheckStatus(const Belle2::SpacePointTrackCand* trackCand);
228
233 const std::vector<int> removeSpacePoints(Belle2::SpacePointTrackCand* trackCand, const std::vector<int>& indsToRemove);
234
237 template<typename T>
238 bool vectorHasValueBetween(std::vector<T> V, std::pair<T, T> P)
239 {
240 return std::find_if(V.begin(), V.end(), [&P](const T & aValue) { return (aValue < P.second && aValue >= P.first);}) != V.end();
241 }
242
243 private:
247 };
249}
Base class for Modules.
Definition: Module.h:72
Module that does some sanity checks on SpacePointTrackCands that have been created by conversion from...
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....
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
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 seperated
void initialize() override
initialize: check StoreArrays, initialize counters, ...
unsigned int m_minDistanceCtr
counter for TrackCands with SpacePoints not far enough apart
const std::vector< int > checkMinDistance(Belle2::SpacePointTrackCand *trackCand, double minDistance)
Check if two subsequent SpacePoints are seperated by at least the provided minDistance.
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
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.
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....
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.
const std::vector< int > checkSameSensor(Belle2::SpacePointTrackCand *trackCand)
Check if two subsequent SpacePoints are on the same sensor.
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
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
Abstract base class for different kinds of events.