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 <framework/datastore/StoreArray.h>
14
15
16using namespace Belle2;
17
18//-----------------------------------------------------------------
19// Register the Module
20//-----------------------------------------------------------------
21REG_MODULE(PXDClustersFromTracks);
22
23//-----------------------------------------------------------------
24// Implementation
25//-----------------------------------------------------------------
26
28{
29 B2DEBUG(1, "Constructor");
30 // Set module properties
31 setDescription("PXDClustersFromTracks module for creating a new StoreArray of track matched PXDCluster.");
33
34 // Parameter definitions
35 addParam("PXDClustersName", m_pxdClustersName, "StoreArray name of the input PXD clusters", std::string("PXDClusters"));
36 addParam("TracksName", m_tracksName, "StoreArray name of the input tracks", std::string("Tracks"));
37 addParam("RecoTracksName", m_recoTracksName, "StoreArray name of the input recoTracks", std::string("RecoTracks"));
38 addParam("outputArrayName", m_outputArrayName, "StoreArray name of the output PXD clusters",
39 std::string("PXDClustersFromTracks"));
40 addParam("InheritRelations", m_inheritance,
41 "Set true if you want to inherit PXDCluster relation with StoreArray RecoTracks, the default is true", bool(true));
42}
43
45{
46 B2DEBUG(20, "Destructor");
47}
48
49
51{
52
53 B2DEBUG(10, "PXDClustersName: " << m_pxdClustersName);
54 B2DEBUG(10, "TracksName: " << m_tracksName);
55 B2DEBUG(10, "RecoTracksName: " << m_recoTracksName);
56 B2DEBUG(10, "outputArrayName: " << m_outputArrayName);
57 B2DEBUG(10, "InheritRelations: " << m_inheritance);
58
62 pxdClusters.isRequired();
63 recoTracks.isRequired();
64 tracks.isRequired();
65 m_selectedPXDClusters.registerSubset(pxdClusters, m_outputArrayName);
66 if (m_inheritance) {
67 m_selectedPXDClusters.inheritRelationsTo(recoTracks);
68 }
69
70}
71
72
74{
75}
76
77
79{
81
82 m_selectedPXDClusters.select([](const PXDCluster * thePXDCluster) {
83 return isRelatedToTrack(thePXDCluster);
84 });
85
86}
87
89{
90}
91
93{
94}
95
97{
98 RelationVector<RecoTrack> recoTrack_cluster = pxdCluster->getRelationsTo<RecoTrack>();
99 if (recoTrack_cluster.size() == 0) {
100 return false;
101 } else {
102 RelationVector<Track> track_recoTrack = recoTrack_cluster[0]->getRelationsFrom<Track>();
103 if (!track_recoTrack.size()) {
104 return false;
105 } else {
106 return true;
107 }
108 }
109}
Base class for Modules.
Definition: Module.h:72
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
@ 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 void endRun() override
end the run
SelectSubset< PXDCluster > m_selectedPXDClusters
all PXD clusters
static bool isRelatedToTrack(const PXDCluster *pxdCluster)
select the PXD clusters related to tracks
virtual void terminate() override
terminates the module
std::string m_pxdClustersName
SVDCLuster store array.
virtual void beginRun() override
initializes the module
std::string m_recoTracksName
reco track store array
bool m_inheritance
if true all relations are inherited
std::string m_tracksName
Track store array.
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:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.