Belle II Software development
PXDClustersFromTracksModule.cc
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#include <pxd/modules/pxdPerformance/PXDClustersFromTracksModule.h>
10#include <vxd/geometry/GeoCache.h>
11#include <vxd/geometry/SensorInfoBase.h>
12
13#include <tracking/dataobjects/RecoTrack.h>
14#include <mdst/dataobjects/Track.h>
15
16#include <framework/datastore/StoreArray.h>
17
18
19using namespace Belle2;
20
21//-----------------------------------------------------------------
22// Register the Module
23//-----------------------------------------------------------------
24REG_MODULE(PXDClustersFromTracks);
25
26//-----------------------------------------------------------------
27// Implementation
28//-----------------------------------------------------------------
29
31{
32 B2DEBUG(1, "Constructor");
33 // Set module properties
34 setDescription("PXDClustersFromTracks module for creating a new StoreArray of track matched PXDCluster.");
36
37 // Parameter definitions
38 addParam("PXDClustersName", m_pxdClustersName, "StoreArray name of the input PXD clusters", std::string("PXDClusters"));
39 addParam("TracksName", m_tracksName, "StoreArray name of the input tracks", std::string("Tracks"));
40 addParam("RecoTracksName", m_recoTracksName, "StoreArray name of the input recoTracks", std::string("RecoTracks"));
41 addParam("outputArrayName", m_outputArrayName, "StoreArray name of the output PXD clusters",
42 std::string("PXDClustersFromTracks"));
43 addParam("InheritRelations", m_inheritance,
44 "Set true if you want to inherit PXDCluster relation with StoreArray RecoTracks, the default is true", bool(true));
45}
46
48{
49 B2DEBUG(20, "Destructor");
50}
51
52
54{
55
56 B2DEBUG(10, "PXDClustersName: " << m_pxdClustersName);
57 B2DEBUG(10, "TracksName: " << m_tracksName);
58 B2DEBUG(10, "RecoTracksName: " << m_recoTracksName);
59 B2DEBUG(10, "outputArrayName: " << m_outputArrayName);
60 B2DEBUG(10, "InheritRelations: " << m_inheritance);
61
65 pxdClusters.isRequired();
66 recoTracks.isRequired();
67 tracks.isRequired();
68 m_selectedPXDClusters.registerSubset(pxdClusters, m_outputArrayName);
69 if (m_inheritance) {
70 m_selectedPXDClusters.inheritRelationsTo(recoTracks);
71 }
72
73}
74
75
76
78{
80
81 m_selectedPXDClusters.select([](const PXDCluster * thePXDCluster) {
82 return isRelatedToTrack(thePXDCluster);
83 });
84
85}
86
88{
89 RelationVector<RecoTrack> recoTrack_cluster = pxdCluster->getRelationsTo<RecoTrack>();
90 if (recoTrack_cluster.size() == 0) {
91 return false;
92 } else {
93 RelationVector<Track> track_recoTrack = recoTrack_cluster[0]->getRelationsFrom<Track>();
94 if (!track_recoTrack.size()) {
95 return false;
96 } else {
97 return true;
98 }
99 }
100}
void setDescription(const std::string &description)
Sets the description of the module.
Definition Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition Module.cc:208
Module()
Constructor.
Definition Module.cc:30
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition Module.h:80
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
Definition PXDCluster.h:30
PXDClustersFromTracksModule()
Constructor: Sets the description, the properties and the parameters of the module.
virtual void initialize() override
init the module
virtual void event() override
processes the event
virtual ~PXDClustersFromTracksModule() override
if required
SelectSubset< PXDCluster > m_selectedPXDClusters
all PXD clusters
static bool isRelatedToTrack(const PXDCluster *pxdCluster)
select the PXD clusters related to tracks
std::string m_pxdClustersName
SVDCLuster store array.
std::string m_recoTracksName
reco track store array
bool m_inheritance
if true all relations are inherited
std::string m_outputArrayName
StoreArray with the selected PXD clusters.
This is the Reconstruction Event-Data Model Track.
Definition RecoTrack.h:79
Class for type safe access to objects that are referred to in relations.
size_t size() const
Get number of relations.
RelationVector< TO > getRelationsTo(const std::string &name="", const std::string &namedRelation="") const
Get the relations that point from this object to another store array.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Accessor to arrays stored in the data store.
Definition StoreArray.h:113
Class that bundles various TrackFitResults.
Definition Track.h:25
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition Module.h:559
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition Module.h:649
Abstract base class for different kinds of events.