Belle II Software development
CurlingTrackCandSplitterModule.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 <tracking/spacePointCreation/SpacePointTrackCand.h>
14#include <tracking/spacePointCreation/SpacePoint.h>
15
16#include <array>
17
18#include <framework/geometry/B2Vector3.h>
19
20#include <TFile.h>
21#include <TTree.h>
22
23namespace Belle2 {
46
47 public:
48
52 void initialize() override;
53
54 void event() override;
56 void terminate() override;
59 enum {
60 c_nSVDPlanes = 4,
61 c_nPXDPlanes = 2,
62
63 c_nPlanes = c_nSVDPlanes + c_nPXDPlanes,
64 };
65
68 std::array<std::vector<double>, c_nPlanes> SpacePointXGlobal;
69 std::array<std::vector<double>, c_nPlanes> SpacePointYGlobal;
70 std::array<std::vector<double>, c_nPlanes> SpacePointZGlobal;
72 std::array<std::vector<double>, c_nPlanes> SpacePointULocal;
73 std::array<std::vector<double>, c_nPlanes> SpacePointVLocal;
74// std::array<std::vector<double>, c_nPlanes> SpacePointZLocal; /**< local z-positions of SpacePoints (layerwise)*/
75
76 std::array<std::vector<double>, c_nPlanes> TrueHitXGlobal;
77 std::array<std::vector<double>, c_nPlanes> TrueHitYGlobal;
78 std::array<std::vector<double>, c_nPlanes> TrueHitZGlobal;
81 std::array<std::vector<double>, c_nPlanes> PosResidueXGlobal;
83 std::array<std::vector<double>, c_nPlanes> PosResidueYGlobal;
85 std::array<std::vector<double>, c_nPlanes> PosResidueZGlobal;
86
88 std::array<std::vector<double>, c_nPlanes> PosResidueULocal;
90 std::array<std::vector<double>, c_nPlanes> PosResidueVLocal;
91
92 std::array<std::vector<double>, c_nPlanes> TrueHitULocal;
93 std::array<std::vector<double>, c_nPlanes> TrueHitVLocal;
94// std::array<std::vector<double>, c_nPlanes> TrueHitZLocal; /**< local z-positions of TrueHits (layerwise) */
95
96 std::array<std::vector<double>, c_nPlanes> PosResiduesLocal;
97 std::array<std::vector<double>, c_nPlanes> PosResiduesGlobal;
100 std::array<std::vector<double>, c_nPlanes> MisMatchPosResiduals;
102 std::array<std::vector<double>, c_nPlanes> MisMatchPosX;
104 std::array<std::vector<double>, c_nPlanes> MisMatchPosY;
106 std::array<std::vector<double>, c_nPlanes> MisMatchPosZ;
107
109 std::array<std::vector<double>, c_nPlanes> MisMatchPosU;
111 std::array<std::vector<double>, c_nPlanes> MisMatchPosV;
112
114 std::array<std::vector<double>, c_nPlanes> MisMatchMomX;
116 std::array<std::vector<double>, c_nPlanes> MisMatchMomY;
118 std::array<std::vector<double>, c_nPlanes> MisMatchMomZ;
119 };
120
124 struct TaggedUVPos {
125 bool m_setU;
126 bool m_setV;
127 double m_U;
128 double m_V;
131 TaggedUVPos() : m_setU(false), m_setV(false), m_U(0.), m_V(0.) {}
132 };
133
134 protected:
135
138 std::string m_PARAMsptcName;
142
150 std::vector<double> m_PARAMsetOrigin;
151
178 void initializeCounters();
183 const std::vector<int> checkTrackCandForCurling(const Belle2::SpacePointTrackCand&, RootVariables& rootVariables);
184
190 template<class TrueHit>
191 std::pair<const B2Vector3D, const B2Vector3D >
193
197 const std::vector<Belle2::SpacePointTrackCand>
198 splitCurlingTrackCand(const Belle2::SpacePointTrackCand& SPTrackCand, int NTracklets, const std::vector<int>& splitIndices);
199
201 bool getDirectionOfFlight(std::pair<const B2Vector3D, const B2Vector3D > const& hitPosAndMom,
202 const B2Vector3D& origin);
203
207 BELLE2_DEFINE_EXCEPTION(FoundNoTrueHit, "Found no TrueHit for one (or more) Cluster(s). "
208 "Without a TrueHit a decision if a TrackCand is curling is not possible");
209
213 BELLE2_DEFINE_EXCEPTION(TrueHitsNotMatching, "The TrueHits related to the two SVDClusters of a SpacePoint are not the same!")
214
215
218 BELLE2_DEFINE_EXCEPTION(FoundNoCluster, "No related Cluster to a SpacePoint was found.");
219
222 std::vector<std::string> m_PARAMrootFileName;
224 TTree* m_treePtr;
226 std::array<std::vector<double>, c_nPlanes> m_rootSpacePointXGlobals;
227 std::array<std::vector<double>, c_nPlanes> m_rootSpacePointYGlobals;
228 std::array<std::vector<double>, c_nPlanes> m_rootSpacePointZGlobals;
230 std::array<std::vector<double>, c_nPlanes> m_rootSpacePointULocals;
231 std::array<std::vector<double>, c_nPlanes> m_rootSpacePointVLocals;
232// std::array<std::vector<double>, c_nPlanes> m_rootSpacePointZLocals; /**< Local Z-Positions of SpacePoints (layerwise) */
233
234 std::array<std::vector<double>, c_nPlanes> m_rootTrueHitXGlobals;
235 std::array<std::vector<double>, c_nPlanes> m_rootTrueHitYGlobals;
236 std::array<std::vector<double>, c_nPlanes> m_rootTrueHitZGlobals;
238 std::array<std::vector<double>, c_nPlanes> m_rootTrueHitULocals;
239 std::array<std::vector<double>, c_nPlanes> m_rootTrueHitVLocals;
240// std::vector<double> m_rootTrueHitZLocals; /**< Local Z-Positions of TrueHits (layerwise) */
241
243 std::array<std::vector<double>, c_nPlanes> m_rootPosResidueXGlobal;
245 std::array<std::vector<double>, c_nPlanes> m_rootPosResidueYGlobal;
247 std::array<std::vector<double>, c_nPlanes> m_rootPosResidueZGlobal;
248
250 std::array<std::vector<double>, c_nPlanes> m_rootPosResidueULocal;
252 std::array<std::vector<double>, c_nPlanes> m_rootPosResidueVLocal;
253
255 std::array<std::vector<double>, c_nPlanes> m_rootLocalPosResiduals;
257 std::array<std::vector<double>, c_nPlanes> m_rootGlobalPosResiduals;
258
260 std::array<std::vector<double>, c_nPlanes> m_rootMisMatchPosDistance;
262 std::array<std::vector<double>, c_nPlanes> m_rootMisMatchPosX;
264 std::array<std::vector<double>, c_nPlanes> m_rootMisMatchPosY;
266 std::array<std::vector<double>, c_nPlanes> m_rootMisMatchPosZ;
267
269 std::array<std::vector<double>, c_nPlanes> m_rootMisMatchPosU;
271 std::array<std::vector<double>, c_nPlanes> m_rootMisMatchPosV;
272
274 std::array<std::vector<double>, c_nPlanes> m_rootMisMatchMomX;
276 std::array<std::vector<double>, c_nPlanes> m_rootMisMatchMomY;
278 std::array<std::vector<double>, c_nPlanes> m_rootMisMatchMomZ;
279
281 TaggedUVPos getUV(const SpacePoint* spacePoint);
282
284 template <class TrueHit>
285 void getValuesForRoot(const SpacePoint* spacePoint, const TrueHit* trueHit, RootVariables& rootVariables);
286
287 void writeToRoot(const RootVariables& rootVariables);
288 };
290}
Class to collect log likelihoods from Clusters from ECL and KLM aimed for output to mdst includes fun...
Definition: Cluster.h:26
Module for checking SpacePointTrackCandidates for curling behaviour and splitting them into Track Can...
std::array< std::vector< double >, c_nPlanes > m_rootMisMatchPosX
Difference of X-positions (global) for mismatched TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootMisMatchPosV
Difference of V-positions (local) for mismatched TrueHits (layerwise)
int m_NoCurlingTCsCtr
Counter for SPTCs that were not curling and hence were added to the StoreArray of first out parts.
StoreArray< SpacePointTrackCand > m_spacePointTCs
SpacePointTrackCand StoreArray.
std::string m_PARAMcurlingOutRestName
collection name of all but the first outgoing parts of a curling TrackCand
std::array< std::vector< double >, c_nPlanes > m_rootPosResidueYGlobal
Y-position (global) difference between TrueHit and SpacePoint (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootSpacePointZGlobals
Global Z-Positions of SpacePoints (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootMisMatchPosU
Difference of U-positions (local) for mismatched TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootMisMatchMomX
Difference of Momentum in X-Direction for TrueHits that do not match but are related from one SpacePo...
StoreArray< SpacePointTrackCand > m_curlingAllIns
Curling SpacePointTrackCand StoreArray.
StoreArray< SpacePointTrackCand > m_curlingFirstOuts
Curling SpacePointTrackCand StoreArray.
bool m_saveCompleteCurler
set to true if all parts of a curling TrackCand should be stored in a separate StoreArray (no paramet...
void initialize() override
initialize: initialize counters, register stuff in DataStore, check if all necessary StoreArrays are ...
std::array< std::vector< double >, c_nPlanes > m_rootSpacePointYGlobals
Global Y-Positions of SpacePoints (layerwise)
std::vector< double > m_PARAMsetOrigin
set the origin to a specific point.
B2Vector3D m_origin
origin used internally (set from user set value)
void event() override
event: check SpacePointTrackCand for curling behaviour, split if needed (and wanted by user)
std::array< std::vector< double >, c_nPlanes > m_rootGlobalPosResiduals
Global Position Residuals between TrueHits and SpacePoints (layerwise)
int m_PARAMnTrackStubs
maximum number of TrackCand Stubs to be stored for a curling TrackCand
std::string m_PARAMcurlingAllInName
collection name of all ingoing parts of a curling TrackCand
std::array< std::vector< double >, c_nPlanes > m_rootTrueHitXGlobals
Global U-Positions of TrueHits (layerwise)
void terminate() override
terminate: print some summary on the modules work
std::array< std::vector< double >, c_nPlanes > m_rootMisMatchPosDistance
Distance of TrueHits that do not match but are related from one SpacePoint (layerwise)
std::pair< const B2Vector3D, const B2Vector3D > getGlobalPositionAndMomentum(TrueHit *aTrueHit)
Get the global position and momentum for a given TrueHit (PXD or SVD at the moment).
std::string m_PARAMcompleteCurlerName
collection name of all parts of a curling TrackCand
std::string m_PARAMsptcName
collection name of the SpacePointTrackCands to be analyzed
int m_NoSingleTrueHitCtr
Counter for SpacePoints that relate to more than one TrueHit.
int m_createdTrackStubsCtr
Counter for created TrackCand Stubs by splitting a SpacePointTrackCand.
std::array< std::vector< double >, c_nPlanes > m_rootPosResidueXGlobal
X-position (global) difference between TrueHit and SpacePoint (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootMisMatchMomZ
Difference of Momentum in Z-Direction for TrueHits that do not match but are related from one SpacePo...
std::array< std::vector< double >, c_nPlanes > m_rootSpacePointXGlobals
Global X-Positions of SpacePoints (layerwise)
bool getDirectionOfFlight(std::pair< const B2Vector3D, const B2Vector3D > const &hitPosAndMom, const B2Vector3D &origin)
determine the direction of flight of a particle for a given hit and the origin (assumed interaction p...
std::array< std::vector< double >, c_nPlanes > m_rootSpacePointULocals
Local U-Positions of SpacePoints (layerwise)
std::vector< std::string > m_PARAMrootFileName
two entries accepted.
const std::vector< int > checkTrackCandForCurling(const Belle2::SpacePointTrackCand &, RootVariables &rootVariables)
Check if the track candidate is curling.
std::array< std::vector< double >, c_nPlanes > m_rootMisMatchMomY
Difference of Momentum in Y-Direction for TrueHits that do not match but are related from one SpacePo...
void getValuesForRoot(const SpacePoint *spacePoint, const TrueHit *trueHit, RootVariables &rootVariables)
Get The Values that are later written to a ROOT file.
std::array< std::vector< double >, c_nPlanes > m_rootMisMatchPosZ
Difference of Z-positions (global) for mismatched TrueHits (layerwise)
TaggedUVPos getUV(const SpacePoint *spacePoint)
get U&V for a SpacePoint (via its relation to Clusters) (SpacePoint can only return normalized U&V co...
StoreArray< SpacePointTrackCand > m_curlingCompletes
Curling SpacePointTrackCand StoreArray.
void writeToRoot(const RootVariables &rootVariables)
Write previously collected values to ROOT file.
std::array< std::vector< double >, c_nPlanes > m_rootSpacePointVLocals
Local V-Positions of SpacePoints (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootPosResidueZGlobal
Z-position (global) difference between TrueHit and SpacePoint (layerwise)
int m_noDecisionPossibleCtr
Counter for TrackCands where a decision if curling or not is not possible.
std::array< std::vector< double >, c_nPlanes > m_rootLocalPosResiduals
Local Position Residuals between TrueHits and SpacePoints (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootTrueHitYGlobals
Global V-Positions of TrueHits (layerwise)
bool m_PARAMuseNonSingleTHinPA
Switch for using SpacePoints in position Analysis that are related to more than one TrueHit.
std::string m_PARAMcurlingOutFirstName
collection name of the first outgoing (i.e.
const std::vector< Belle2::SpacePointTrackCand > splitCurlingTrackCand(const Belle2::SpacePointTrackCand &SPTrackCand, int NTracklets, const std::vector< int > &splitIndices)
Split a culring track candidate into (up to NTracklets) tracklets.
std::array< std::vector< double >, c_nPlanes > m_rootTrueHitVLocals
Local Y-Positions of TrueHits (layerwise)
int m_curlingTCCtr
Counter for TrackCands that show curling behaviour.
int m_spacePointTCCtr
Counter for presented SpacePointTrackCands.
void initializeCounters()
initialize all counters to 0 for avoiding undeterministic behaviour.
std::array< std::vector< double >, c_nPlanes > m_rootMisMatchPosY
Difference of Y-positions (global) for mismatched TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootTrueHitULocals
Local X-Positions of TrueHits (layerwise)
BELLE2_DEFINE_EXCEPTION(FoundNoTrueHit, "Found no TrueHit for one (or more) Cluster(s). " "Without a TrueHit a decision if a TrackCand is curling is not possible")
Exception for case when no TrueHit can be found for a Cluster.
std::array< std::vector< double >, c_nPlanes > m_rootTrueHitZGlobals
Global Z-Positions of TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootPosResidueVLocal
V-position (local) difference between TrueHit and SpacePoint (layerwise)
bool m_PARAMpositionAnalysis
Set to true if output to ROOT file is desired with the positions and position differences of SpacePoi...
StoreArray< SpacePointTrackCand > m_curlingRestOuts
Curling SpacePointTrackCand StoreArray.
bool m_PARAMsplitCurlers
indicating if the SpacePointTrackCands should only be analyzed for curling behaviour,...
std::array< std::vector< double >, c_nPlanes > m_rootPosResidueULocal
U-position (local) differnece between TrueHit and SpacePoint (layerwise)
Base class for Modules.
Definition: Module.h:72
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
#define BELLE2_DEFINE_EXCEPTION(ClassName, Message)
Macro that defines an exception with the given message template.
Abstract base class for different kinds of events.
STL namespace.
std::array< std::vector< double >, c_nPlanes > PosResidueVLocal
V-position (local) difference between TrueHit and SpacePoint (layerwise)
std::array< std::vector< double >, c_nPlanes > MisMatchMomZ
Difference of Momentum in Z-Direction for TrueHits that do not match but are related from one SpacePo...
std::array< std::vector< double >, c_nPlanes > MisMatchPosZ
Difference of Z-positions (global) for mismatched TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > MisMatchPosU
Difference of U-positions (local) for mismatched TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > PosResidueZGlobal
Z-position (global) difference between TrueHit and SpacePoint (layerwise)
std::array< std::vector< double >, c_nPlanes > MisMatchMomX
Difference of Momentum in X-Direction for TrueHits that do not match but are related from one SpacePo...
std::array< std::vector< double >, c_nPlanes > MisMatchPosV
Difference of V-positions (local) for mismatched TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > MisMatchPosResiduals
Distance between TrueHits that do not match but are related from one SpacePoint (layerwise)
std::array< std::vector< double >, c_nPlanes > MisMatchPosY
Difference of Y-positions (global) for mismatched TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > SpacePointYGlobal
global y-positions of SpacePoints (layerwise)
std::array< std::vector< double >, c_nPlanes > MisMatchPosX
Difference of X-positions (global) for mismatched TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > SpacePointVLocal
local v-positions of SpacePoints (layerwise)
std::array< std::vector< double >, c_nPlanes > TrueHitULocal
local u-positions of TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > SpacePointZGlobal
global z-positions of SpacePoints (layerwise)
std::array< std::vector< double >, c_nPlanes > PosResidueULocal
U-position (local) differnece between TrueHit and SpacePoint (layerwise)
std::array< std::vector< double >, c_nPlanes > TrueHitXGlobal
global x-positions of TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > PosResiduesGlobal
position differences in global coordinates (layerwise)
std::array< std::vector< double >, c_nPlanes > SpacePointULocal
local u-positions of SpacePoints (layerwise)
std::array< std::vector< double >, c_nPlanes > TrueHitVLocal
local v-positions of TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > MisMatchMomY
Difference of Momentum in Y-Direction for TrueHits that do not match but are related from one SpacePo...
std::array< std::vector< double >, c_nPlanes > PosResidueYGlobal
Y-position (global) difference between TrueHit and SpacePoint (layerwise)
std::array< std::vector< double >, c_nPlanes > SpacePointXGlobal
global x-positions of SpacePoints (layerwise)
std::array< std::vector< double >, c_nPlanes > PosResiduesLocal
position differences in local coordinates (layerwise)
std::array< std::vector< double >, c_nPlanes > PosResidueXGlobal
X-position (global) difference between TrueHit and SpacePoint (layerwise)
std::array< std::vector< double >, c_nPlanes > TrueHitZGlobal
global z-positions of TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > TrueHitYGlobal
global y-positions of TrueHits (layerwise)
struct for easier handling of getting U- & V-position of SpacePoints and some difficulties that arise...
TaggedUVPos()
default constructor initializes both bools to false and both doubles to 0.