11#include <framework/core/Module.h>
12#include <framework/datastore/StoreArray.h>
13#include <tracking/spacePointCreation/SpacePoint.h>
15#include <tracking/spacePointCreation/SpacePointTrackCand.h>
17#include <pxd/dataobjects/PXDTrueHit.h>
18#include <svd/dataobjects/SVDTrueHit.h>
20#include <genfit/TrackCand.h>
21#include <genfit/TrackCandHit.h>
25#include <boost/tuple/tuple.hpp>
74 void event()
override;
99 switch (intToConvert) {
235 template<
typename ClusterType>
238 short unsigned int layerNumber = cluster->getSensorID().getLayerNumber();
239 if (layerNumber > 6)
throw SpacePointTrackCand::UnsupportedDetType();
275 std::pair<double, const HitType*>;
279 boost::tuple<bool, T, T>;
291 std::pair<const Belle2::SpacePointTrackCand, conversionStatus>
297 std::pair<Belle2::SpacePoint*, conversionStatus>
310 template<
typename ClusterType,
typename TrueHitType>
311 std::pair<Belle2::SpacePoint*, conversionStatus>
313 std::string arrayName =
"");
322 template<
typename ClusterType>
323 std::pair<Belle2::SpacePoint*, conversionStatus>
341 const std::vector<std::pair<int, int> >& clusterPositions);
347 template<
typename ClusterType>
361 template <
typename TrueHitType>
368 "Not all hits of the genfit::TrackCand have been marked as used. This indicates that not all hits have been used to create a SpacePointTrackCand.");
Module for converting genfit::TrackCands to SpacePointTrackCands.
unsigned int m_abortedNoSPCtr
Counter for aborted conversions because no SpacePoint has been found.
StoreArray< SpacePoint > m_SingleClusterSpacePoints
SVD SpacePoints StoreArray only consisting of one SVDCluster.
int getNDF(Belle2::SpacePoint *spacePoint)
get the NDF of a SpacePoint
int m_PARAMminNDF
parameter for specifying a minimal number of degrees of freedom a SpacePointTrackCand has to have in ...
unsigned int m_skippedPXDunsuitableCtr
Counter for skipped PXD Clusters due to unsuitable GFTC.
bool m_PARAMskipCluster
Switch for controlling the behavior of the converter, when for one or more Clusters no appropriate Sp...
conversionStatus
enum for differentiating different reasons why a conversion failed negative values mean fail!
@ c_nonSingleSP
conversion failed because there were more than one single Cluster SpacePoints related to a Cluster
@ c_foundNoSpacePoint
conversion failed because no related SpacePoint was found to a Cluster/Hit of the GFTC
@ c_singleClusterSP
had to use a singleCluster SpacePoint (also returned if PXD is passed!
@ c_lowNDF
conversion failed because the created SpacePointTrackCand had not enough degrees of freedom
@ c_unusedHits
conversion failed because there were unused Hits
@ c_noValidSP
conversion failed because there was no valid SpacePoint (only possible for double Cluster SpacePoints...
@ c_foundNoTrueHit
conversion failed because there was no related SpacePoint to a TrueHit
@ c_unsuitableGFTC
conversion failed because the GFTC is considered not suitable for conversion
@ c_noFail
conversion without any problems
unsigned int m_skippedSVDnoValidSPCtr
Counter for skipped SVD Clusters due to no found valid SpacePoint.
std::string m_SingleClusterSVDSPName
Single Cluster SVD SpacePoints collection name.
unsigned int m_abortedUnsuitableTCCtr
Counter for aborted conversions due to unsuitable genfit::TrackCand.
std::pair< double, const HitType * > HitInfo
container used for storing information, that is then put into the SpacePointTrackCand
StoreArray< SVDCluster > m_SVDClusters
SVDClusters StoreArray.
std::string m_NoSingleClusterSVDSPName
Non SingleCluster SVD SpacePoints collection name.
void initialize() override
initialize module (e.g.
StoreArray< SpacePointTrackCand > m_SpacePointTrackCands
SpacePointTrackCands StoreArray.
void event() override
event: convert genfit::TrackCands to SpacePointTrackCands
std::string m_PXDClusterName
PXDCluster collection name.
unsigned int m_skippedSVDunsuitableCtr
Counter for skipped SVD Clusters due to unsuitable GFTC.
StoreArray< PXDTrueHit > m_PXDTrueHits
PXDTrueHits StoreArray.
void terminate() override
terminate: print some summary information on the processed events
GFTC2SPTCConverterModule()
Constructor.
bool foundRelatedTrueHit(const Belle2::SpacePoint *spacePoint, unsigned int allowedRelations=1)
check if there is a related TrueHit for a given SpacePoint.
unsigned int m_skippedSVDnoSPCtr
Counter for skipped SVD Clusters, due to no found SpacePoint.
unsigned int m_genfitTCCtr
Counter for genfit::TrackCands which were presented to the module.
std::string m_genfitTCName
Name of collection of genfit::TrackCand StoreArray.
void increaseSkippedCounter(conversionStatus status, ClusterType *cluster)
increase the appropriate counter variable if a Cluster is skipped (i.e.
bool m_PARAMcheckTrueHits
Parameter Indicating if the TrueHits related from the Clusters forming a SpacePoint should be checked...
unsigned int m_skippedSVDnoTHCtr
Counter for skipped SVD Clusters, due to no related TrueHit to a SpacePoint.
StoreArray< genfit::TrackCand > m_GenfitTrackCands
Genfit::TrackCand StoreArray.
bool m_PARAMuseSingleClusterSP
Parameter Indicating if SingleCluster SVD SpacePoints should be used if no double Cluster SVD SpacePo...
std::pair< Belle2::SpacePoint *, conversionStatus > processTrackCandHit(genfit::TrackCandHit *hit, std::vector< flaggedPair< int > > &flaggedHitIDs, int iHit)
process a TrackCandHit (i.e.
unsigned int m_nonSingleSPCtr
Counter for cases where there is more than one single Cluster SpacePoint related to a Cluster.
unsigned int m_noTwoClusterSPCtr
Counter for cases where no related two Cluster could be found for a Cluster.
StoreArray< PXDCluster > m_PXDClusters
PXDClusters StoreArray.
unsigned int m_abortedNoValidSPCtr
Counter for aborted conversions due to no found valid SpacePoint to any Cluster of the GFTC.
boost::tuple< bool, T, T > flaggedPair
typedef, for avoiding having a vector<bool> and a vector<pair<T,T>>
std::string m_SPTCName
Name of collection under which SpacePointTrackCands will be stored in the StoreArray.
conversionStatus getFailEnum(int intToConvert)
get the enum representation of an integer
void increaseFailCounter(conversionStatus status)
increase the counter that 'belongs' to the conversionStatus
void markHitAsUsed(std::vector< flaggedPair< int > > &flaggedHitIDs, int hitToMark)
mark a hit as used, i.e.
unsigned int m_skippedPXDnoSPCtr
Counter for skipped PXD Clusters, due to no found SpacePoint.
std::pair< Belle2::SpacePoint *, conversionStatus > findAppropriateSpacePoint(const Belle2::RelationVector< Belle2::SpacePoint > &spacePoints, std::vector< flaggedPair< int > > &flaggedHitIDs)
given a RelationVector with SpacePoints in it, it tries to get the appropriate one (see main document...
unsigned int m_skippedPXDnoValidSPCtr
Counter for skipped PXD Clusters due to no found valid SpacePoint.
std::string m_SVDClusterName
SVDCluster collection name.
std::string m_PXDClusterSPName
PXDCluster SpacePoints collection name.
unsigned int m_skippedPXDnoTHCtr
Counter for skipped PXD Clusters, due to no related TrueHit to a SpacePoint.
std::pair< int, int > checkExistAndValid(int clusterInd, int detID, std::vector< flaggedPair< int > > &flaggedHitIDs)
check if the Cluster (of a SpacePoint) is valid and/or exists in a genfit::TrackCand
unsigned int m_skippedCluster
Counter for skipped Cluster.
std::pair< Belle2::SpacePoint *, conversionStatus > getSpacePoint(const ClusterType *cluster, std::vector< flaggedPair< int > > &flaggedHitIDs, int iHit, bool singleCluster, std::string arrayName="")
templated version to get a SpacePoint from a Cluster
bool m_PARAMcheckNoSingleSVDSP
Switch for checking the StoreArray of non-single cluster SVD SpacePoints in initialize.
unsigned int m_SpacePointTCCtr
Counter for SpacePointTrackCands which were converted (if a curling track is split up,...
unsigned int m_abortedLowNDFCtr
Counter for SpacePointTrackCands that were not stored due to a too small number of degrees of freedom...
bool checkUsedAllHits(std::vector< flaggedPair< int > > &flaggedHitIDs)
check if all hits have been used (i.e.
std::vector< int > getClusterIndices(const Belle2::SpacePoint *spacePoint, std::string storeArrayName)
get the indices of the Clusters related to the SpacePoint.
void initializeCounters()
reset counters to 0 to avoid indeterministic behaviour
unsigned int m_abortedMiscCtr
temporary counter used for counting all failed conversions for which the reason cannot be deduced at ...
int m_NDF
number of degrees of freedom.
unsigned int m_singleClusterSPCtr
Counter for single cluster SVD SpacePoints.
std::pair< const Belle2::SpacePointTrackCand, conversionStatus > createSpacePointTC(const genfit::TrackCand *genfitTC)
create a SpacePointTrackCand from the genfit::TrackCand
int getAppropriateSpacePointIndex(const std::vector< std::pair< bool, bool > > &existAndValidSPs, const std::vector< std::pair< int, int > > &clusterPositions)
get the position of the appropriate SpacePoint inside the RelationVector NOTE: returns negative index...
StoreArray< SpacePoint > m_PXDSpacePoints
PXDSpacePoints StoreArray.
StoreArray< SpacePoint > m_NoSingleClusterSpacePoints
SVD SpacePoints StoreArray consisting of two SVDClusters.
StoreArray< SVDTrueHit > m_SVDTrueHits
SVDTrueHits StoreArray.
std::string svdMainArrayName
Name of the Array of SVD SpacePoints that shall be searched first.
unsigned int m_abortedTrueHitCtr
Counting discarded conversions due to check for TrueHits not good.
BELLE2_DEFINE_EXCEPTION(UnusedHits, "Not all hits of the genfit::TrackCand have been marked as used. This indicates that not all hits have been used to create a SpacePointTrackCand.")
Exception thrown, when not all hits of a genfit::TrackCand have been used for conversion.
Class for type safe access to objects that are referred to in relations.
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Accessor to arrays stored in the data store.
Abstract base class for different kinds of events.