 |
Belle II Software
release-05-02-19
|
12 #include <framework/core/FrameworkExceptions.h>
13 #include <framework/core/Module.h>
15 #include <framework/datastore/StoreArray.h>
16 #include <framework/datastore/RelationArray.h>
18 #include <tracking/spacePointCreation/SpacePoint.h>
19 #include <pxd/dataobjects/PXDTrueHit.h>
20 #include <svd/dataobjects/SVDTrueHit.h>
27 #include <unordered_map>
72 return (std::tuple<int, double>(b.m_U + b.m_V, b.m_wU + b.m_wV) < std::tuple<int, double>(
m_U +
m_V,
m_wU +
m_wV));
91 os <<
"Id " << thInfo.m_Id <<
": wU = " << thInfo.m_wU <<
", setU = " << thInfo.m_U <<
". wV = " <<
92 thInfo.m_wV <<
", setV = " << thInfo.m_V;
126 void event()
override;
131 "Found no related Cluster for a SpacePoint!");
134 struct RootVariables {
169 typedef std::unordered_map<int, TrueHitInfo>
baseMapT;
185 c_primaryParticle = 16,
187 c_nonUniqueRelation = 64,
188 c_registeredRelation = 128,
189 c_noiseCluster = 256,
315 template <
typename MapType,
typename TrueHitType>
323 template <
typename TrueHitType>
333 template<
typename MapType,
typename ClusterType,
typename TrueHitType>
341 template<
typename MapType>
347 template<
typename MapType>
353 template<
typename TrueHitType>
359 template<
typename ClusterType>
366 template<
typename ClusterType>
367 std::vector<std::pair<ClusterType*, double> >
375 template<
typename TrueHitType>
387 template<
typename MapType>
394 template<
typename TrueHitType>
433 simpleBitfield(
const simpleBitfield<T>& __otherBitfield) =
delete;
434 simpleBitfield<T>&
operator = (simpleBitfield<T>&) =
delete;
437 const T
hasStatus(T __statusBits)
const {
return (
__bits & __statusBits) == __statusBits; }
std::vector< double > TrueHitZGlobal
TrueHit global Z-position.
SpacePoint2TrueHitConnectorModule()
Constructor.
unsigned int m_rejectedNoPrimaryCtr
Count how many times a relation was rejected because TrueHit was not related to primary.
std::vector< unsigned int > ClusterSizeU
size of the u-cluster (resp.
helper struct to access root variables inside the module
void removeStatus(T __statusBits)
remove a status from the bitfield
e_relationStatus
enum for better code readability
std::pair< TrueHitType *, double > getTHwithWeight(const MapType &aMap, Belle2::StoreArray< TrueHitType > trueHits, Belle2::SpacePoint *spacePoint, e_detTypes detType)
get the TrueHit from information that is stored in the map (conditions are checked in the following o...
double m_wU
weight of relation between U-Cluster and TrueHit
std::vector< e_detTypes > m_detectorTypes
storing the detector types for each container in vector, needed in initialize
std::vector< unsigned short int > RelationStatus
different flags of the relation stored in here (see c_relationStatus)
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
std::vector< double > SpacePointErrorU
position error of SpacePoint in U direction
void registerOneRelation(Belle2::SpacePoint *spacePoint, std::pair< TrueHitType *, double > trueHitwWeight, e_detTypes)
register Relation between SpacePoint and TrueHit (and if neccessary also between SpacePoint and Clust...
Belle2::StoreArray< Belle2::SVDCluster > m_SVDClusters
PXDClusters StoreArray used throughout the module.
const T hasStatus(T __statusBits) const
check if a certain status has been set to the bitfield
double m_PARAMmaxPosSigma
defining th maximum difference of local coordinates in units of PitchSize / sqrt(12)
unsigned int m_nContainers
number of passed containers -> storing the size of an input vector for not having to obtain it every ...
Belle2::StoreArray< Belle2::PXDCluster > m_PXDClusters
PXDTClusters StoreArray used throughout the module.
void initializeRootFile()
initialize the root file that is used for output
std::vector< unsigned int > ClusterSizeV
size of the v-cluster (resp.
bool m_PARAMregisterAll
switch for registereing all relations for all TrueHits for all SpacePoints (there can be more than 1 ...
double m_PARAMmaxGlobalDiff
maximum difference of global position coordinates for each direction between TrueHit and SpacePoint
bool m_PARAMrequirePrimary
require the TrueHit to be related to a primary particle in order for the relation to get registered!
std::pair< double, double > getLocalPos(Belle2::SpacePoint *spacePoint)
get the local position of a SpacePoint
void event() override
event: try to find the appropriate TrueHit to all SpacePoints
std::vector< double > TrueHitXGlobal
TrueHit global X-position.
void reRegisterClusterRelations(Belle2::SpacePoint *origSpacePoint, Belle2::SpacePoint *newSpacePoint, std::string clusterName="ALL")
register all the relations to Clusters that origSpacePoint had for newSpacePoint
std::vector< std::string > m_PARAMspacePointNames
names of containers of SpacePoints
helper struct that holds information that is needed for the registration of the relation between Spac...
std::pair< TVector3, TVector3 > getTrueHitPositions(TrueHitType *trueHit)
get the local (.first) and global (.second) position of a TrueHit (passed by index)
std::vector< unsigned int > m_noTrueHitCtr
Number of SpacePoints that contained a Cluster to which no TrueHit could be found (i....
unsigned int m_iCont
'helper variable' needed to not have to pass one integer down to processSpacePoint only to have a han...
TTree * m_treePtr
pointer to tree in root file
std::vector< std::string > m_PARAMrootFileName
name and update status of root file
helper class for setting up a bitfield that can be used to store several flags in one variable TODO: ...
std::unordered_map< int, TrueHitInfo > baseMapT
typedef for shorter notation throughout the module
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
unsigned int m_weightTooSmallCtr
Count the omitted relations because of a too small weight.
simpleBitfield< T > & operator=(simpleBitfield< T > &)=delete
not needed
Belle2::StoreArray< Belle2::PXDTrueHit > m_PXDTrueHits
PXDTrueHits StoreArray used throughout the module.
std::vector< std::array< unsigned int, 5 > > m_nRelTrueHitsCtr
counting different numbers of related TrueHits (to a SpacePoint) with one variable
void initializeCounters()
initialize all counters to 0 WARNING: only call in constructor of module!
double m_wV
weight of relation between V-Cluster and TrueHit
bool compatibleCombination(Belle2::SpacePoint *spacePoint, TrueHitType *trueHit)
compares the TrueHit and the SpacePoint positions (global) to decide whether they are compatible NOTE...
TFile * m_rootFilePtr
pointer to root file
void addStatus(T __statusBits)
add a status to the bitfield (if it has not already been added)
e_detTypes
enum to distinguish the detectortypes
std::pair< unsigned short int, unsigned short int > getClusterSizes(Belle2::SpacePoint *spacePoint, e_detTypes detType)
get the sizes of the related Clusters of a SpacePoint
std::vector< double > SpacePointULocal
SpacePoint local U-position.
double getWeightSum() const
get sum of relation weights
Abstract base class for different kinds of events.
std::vector< unsigned short int > HitVxdID
VxdID of the SpacePoint/TrueHit.
void initialize() override
initialize: initialize counters, check StoreArrays, register StoreArrays, ...
bool m_PARAMrequireProximity
require the TrueHit to be close to the SpacePoint.
std::vector< unsigned int > m_regRelationsCtr
Number of registered relations.
std::vector< unsigned int > NRelations
Number of related TrueHits to a SpacePoint.
std::vector< Belle2::StoreArray< Belle2::SpacePoint > > m_outputSpacePoints
StoreArray of all output SpacePoints.
Module that tries to register a relation between SpacePoints and TrueHits, hence making some MC Infor...
Belle2::StoreArray< Belle2::SVDTrueHit > m_SVDTrueHits
SVDTrueHits StoreArray used throughout the module.
short getNClusters() const
get the number of Clusters that point to this TrueHit
T __bits
member holding the bits that are maniuplated
MapType getRelatedTrueHits(Belle2::SpacePoint *spacePoint, std::string clusterName="ALL", std::string trueHitName="ALL")
get all the related TrueHits to the SpacePoint, including their weights in a map (multimap!...
std::vector< double > WeightU
weight of the relation between the U-Cluster of the SpacePoint and the TrueHit
double calculateRelationWeight(const TrueHitInfo &trueHitInfo, Belle2::SpacePoint *spacePoint)
calculate the Relation weight to be used (for SVD only, although method works with PXD as well!...
std::vector< unsigned int > m_noClusterCtr
Number of SpacePoints without relation to a Cluster (i.e.
std::vector< std::string > m_PARAMdetectorTypes
detector type names as strings to determine which name belongs to which detector type
bool m_PARAMstoreSeparate
switch for storing the SpacePoints that can be related to a TrueHit into separate StoreArrays,...
simpleBitfield(const simpleBitfield< T > &__otherBitfield)=delete
not needed
std::vector< unsigned int > m_ghostHitCtr
Number of SpacePoints that are considered ghost hits.
void positionAnalysis(Belle2::SpacePoint *spacePoint, const MapType &trueHitMap, const int &index, e_detTypes detType)
Analyze the position of SpacePoints and corresponding TrueHits.
std::vector< double > SpacePointXGlobal
SpacePoint global X-position.
BELLE2_DEFINE_EXCEPTION(NoClusterToSpacePoint, "Found no related Cluster for a SpacePoint!")
Exception for when no related Cluster can be found for a SpacePoint.
std::vector< unsigned int > m_rejectedRelsCtr
Number of SpacePoints that were not related to a TrueHit (i.e.
TrueHitInfo()
default ctor, initializing Id to -1, weights to 0, and bools to false
std::vector< double > SpacePointErrorY
positiion error of SpacePoint in Y direction (global)
bool m_PARAMpositionAnalysis
switch for doing the analysis of positions of SpacePoints and TrueHits
std::vector< std::string > m_PARAMclusterNames
names of containers of Clusters
bool m_U
if true, U-Cluster is used by SpacePoint
int m_Id
TrueHit ID (StoreArray Index)
void setUWeight(double weight)
set the weight for the U-Cluster
std::vector< double > SpacePointVLocal
SpacePoint local V-position.
std::vector< std::string > m_PARAMtrueHitNames
names of containers of TrueHits
std::vector< double > TrueHitVLocal
TrueHit local V-position.
MapType processSpacePoint(Belle2::SpacePoint *spacePoint, e_detTypes detType)
process a SpacePoint.
std::vector< double > SpacePointYGlobal
SpacePoint global Y-position.
RootVariables m_rootVariables
Root variables used for collecting data eventwise.
std::vector< double > WeightV
weight of the relation between the V-Cluster of the SpacePoint and the TrueHit
void registerAllRelations(Belle2::SpacePoint *spacePoint, MapType trueHitMap, e_detTypes detType)
register a Relation to all the TrueHits in the trueHitMap for the passed SpacePoint
std::vector< std::pair< ClusterType *, double > > getRelatedClusters(Belle2::SpacePoint *spacePoint, std::string clusterName="ALL")
get the pointers to the related Clusters and the weight of the original Relations between the spacePo...
std::vector< double > SpacePointZGlobal
SpacePoint global Z-position.
double m_PARAMminWeight
define a minimal weight a relation between Cluster and TrueHit.
void clear()
reset bitfield
std::vector< std::pair< Belle2::StoreArray< Belle2::SpacePoint >, e_detTypes > > m_inputSpacePoints
StoreArray of all input SpacePoints.
std::string m_PARAMoutputSuffix
suffix that will be appended to the StoreArray names of the output StoreArrays
void registerTrueHitRelation(Belle2::SpacePoint *spacePoint, int index, double weight, Belle2::StoreArray< TrueHitType > trueHits)
register the relation between a SpacePoint and the TrueHit (passed by index in the correspoinding Tru...
std::vector< unsigned int > m_SpacePointsCtr
Number of SpacePoints presented to the module.
void closeRootFile()
close root file
std::vector< double > TrueHitYGlobal
TrueHit global Y-position.
double m_maxGlobalDiff
storing the squared value of m_PARAMmaxGlobalDiff here to not alter the parameter input
std::vector< double > TrueHitULocal
TrueHit local U-position.
std::vector< double > SpacePointErrorV
position error of SpacePoint in V direction
const T getStatus() const
get the status of the bitfield
bool m_V
if true, V-Cluster is used by SpacePoint
std::pair< double, double > getLocalError(Belle2::SpacePoint *spacePoint)
get the position error of SpacePoints in local coordinates @retuns .first is U position error,...
std::vector< double > SpacePointErrorZ
positiion error of SpacePoint in Z direction (global)
void setStatus(T __statusBits)
set the status of the bitfield (CAUTION: overwrites any previously defined status!...
void terminate() override
terminate: print some summary information
bool operator<(const TrueHitInfo &b) const
comparison operator ensuring strict weak ordering sorts by the number of Clusters first,...
std::vector< double > SpacePointErrorX
positiion error of SpacePoint in X direction (global)
void setVWeight(double weight)
set the weight for the V-Cluster