Belle II Software  release-05-01-25
SVDShaperDigitsFromTracksModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2013 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Giulia Casarosa & Luigi Corona *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <svd/modules/svdPerformance/SVDShaperDigitsFromTracksModule.h>
12 
13 #include <svd/dataobjects/SVDCluster.h>
14 #include <svd/dataobjects/SVDRecoDigit.h>
15 
16 #include <tracking/dataobjects/RecoTrack.h>
17 #include <mdst/dataobjects/Track.h>
18 
19 #include <framework/datastore/StoreArray.h>
20 
21 
22 using namespace Belle2;
23 
24 //-----------------------------------------------------------------
25 // Register the Module
26 //-----------------------------------------------------------------
27 REG_MODULE(SVDShaperDigitsFromTracks)
28 
29 //-----------------------------------------------------------------
30 // Implementation
31 //-----------------------------------------------------------------
32 
34 {
35  B2DEBUG(1, "Constructor");
36  // Set module properties
37  setDescription("generates two new StoreArray from the input StoreArray. One contains all ShaperDigits related to Tracks and the other contains all SahperDigits not related to tracks");
38 
39  // Parameter definitions
40  addParam("SVDShaperDigits", m_svdshaper, "StoreArray with the input shaperdigits", std::string("SVDShaperDigits"));
41  addParam("SVDRecoDigits", m_svdreco, "StoreArray with the input recodigits", std::string("SVDRecoDigits"));
42  addParam("SVDClusters", m_svdcluster, "StoreArray with the input clusters", std::string("SVDClusters"));
43  addParam("Tracks", m_track, "StoreArray with the input tracks", std::string("Tracks"));
44  addParam("RecoTracks", m_recotrack, "StoreArray with the input recotracks", std::string("RecoTracks"));
45  addParam("outputINArrayName", m_outputINArrayName, "StoreArray with the output shaperdigits",
46  std::string("SVDShaperDigitsFromTracks"));
47  addParam("outputOUTArrayName", m_outputOUTArrayName, "StoreArray with the output shaperdigits",
48  std::string("SVDShaperDigitsNotFromTracks"));
49  addParam("InheritAllRelations", m_inheritance,
50  "Set true if you want to inherit all relations between StoreArray, the default is false", bool(false));
51 }
52 
54 {
55  B2DEBUG(20, "Destructor");
56 }
57 
58 
60 {
61 
62  B2DEBUG(10, "SVDShaperDigits: " << m_svdshaper);
63  B2DEBUG(10, "SVDRecoDigits: " << m_svdreco);
64  B2DEBUG(10, "SVDClusters: " << m_svdcluster);
65  B2DEBUG(10, "Tracks: " << m_track);
66  B2DEBUG(10, "RecoTracks: " << m_recotrack);
67  B2DEBUG(10, "outputINArrayName: " << m_outputINArrayName);
68  B2DEBUG(10, "outputOUTArrayName: " << m_outputOUTArrayName);
69  B2DEBUG(10, "InheritAllRelations: " << m_inheritance);
70 
75  StoreArray<Track> tracks(m_track);
76  ShaperDigits.isRequired();
77  Clusters.isRequired();
78  RecoDigits.isRequired();
79  recoTracks.isRequired();
80  tracks.isRequired();
81  m_selectedShaperDigits.registerSubset(ShaperDigits, m_outputINArrayName);
82  if (m_inheritance) {
83  m_selectedShaperDigits.inheritAllRelations();
84  }
85  if (m_outputOUTArrayName != "") {
86  m_notSelectedShaperDigits.registerSubset(ShaperDigits, m_outputOUTArrayName);
87  if (m_inheritance) {
88  m_notSelectedShaperDigits.inheritAllRelations();
89  }
90  }
91 
92 }
93 
94 
96 {
97 }
98 
99 
101 {
103 
104  m_selectedShaperDigits.select([](const SVDShaperDigit * theSVDShaperDigit) {
105  return isRelatedToTrack(theSVDShaperDigit);
106  });
107 
108 
109  m_notSelectedShaperDigits.select([](const SVDShaperDigit * theSVDShaperDigit) {
110  return !isRelatedToTrack(theSVDShaperDigit);
111  });
112 }
113 
115 {
116 }
117 
119 {
120 }
121 
123 {
124  RelationVector<SVDRecoDigit> reco_rel_shape = shaperdigit->getRelationsFrom<SVDRecoDigit>();
125  if (reco_rel_shape.size() == 0) {return false;}
126  else {
127  RelationVector<SVDCluster> cluster_rel_reco = reco_rel_shape[0]->getRelationsFrom<SVDCluster>();
128  if (cluster_rel_reco.size() == 0) {return false;}
129  else {
130  RelationVector<RecoTrack> recotrack_rel_cluster = cluster_rel_reco[0]->getRelationsTo<RecoTrack>();
131  if (recotrack_rel_cluster.size() == 0) {return false;}
132  else {
133  RelationVector<Track> track_rel_recotrack = recotrack_rel_cluster[0]->getRelationsFrom<Track>();
134  if (track_rel_recotrack.size() == 0) {return false;}
135  else {return true;}
136  }
137  }
138  }
139 }
Belle2::RelationVector::size
size_t size() const
Get number of relations.
Definition: RelationVector.h:98
Belle2::SVDShaperDigitsFromTracksModule::m_outputOUTArrayName
std::string m_outputOUTArrayName
StoreArray with the NOT selected output shaperdigits.
Definition: SVDShaperDigitsFromTracksModule.h:78
Belle2::SVDShaperDigitsFromTracksModule::m_svdshaper
std::string m_svdshaper
StoreArray with the input shaperdigits.
Definition: SVDShaperDigitsFromTracksModule.h:69
Belle2::SVDShaperDigitsFromTracksModule::m_notSelectedShaperDigits
SelectSubset< SVDShaperDigit > m_notSelectedShaperDigits
all shaperdigits from tracks
Definition: SVDShaperDigitsFromTracksModule.h:81
Belle2::SVDShaperDigitsFromTracksModule::initialize
virtual void initialize() override
init the module
Definition: SVDShaperDigitsFromTracksModule.cc:59
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::SVDShaperDigitsFromTracksModule::terminate
virtual void terminate() override
terminates the module
Definition: SVDShaperDigitsFromTracksModule.cc:118
Belle2::SVDShaperDigitsFromTracksModule::m_recotrack
std::string m_recotrack
reco track store array
Definition: SVDShaperDigitsFromTracksModule.h:72
Belle2::SVDShaperDigitsFromTracksModule
generates two new StoreArray from the input StoreArray.
Definition: SVDShaperDigitsFromTracksModule.h:40
Belle2::SVDShaperDigitsFromTracksModule::m_selectedShaperDigits
SelectSubset< SVDShaperDigit > m_selectedShaperDigits
all shaperdigits
Definition: SVDShaperDigitsFromTracksModule.h:80
Belle2::SVDShaperDigitsFromTracksModule::endRun
virtual void endRun() override
end the run
Definition: SVDShaperDigitsFromTracksModule.cc:114
Belle2::SVDShaperDigit
The SVD ShaperDigit class.
Definition: SVDShaperDigit.h:46
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::SVDShaperDigitsFromTracksModule::m_svdreco
std::string m_svdreco
SVDRecoDigits StoreArray.
Definition: SVDShaperDigitsFromTracksModule.h:70
Belle2::RecoTrack
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:78
Belle2::RelationVector
Class for type safe access to objects that are referred to in relations.
Definition: DataStore.h:38
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::SVDShaperDigitsFromTracksModule::m_inheritance
bool m_inheritance
if true all relations are inherited
Definition: SVDShaperDigitsFromTracksModule.h:75
Belle2::RelationsInterface::getRelationsFrom
RelationVector< FROM > getRelationsFrom(const std::string &name="", const std::string &namedRelation="") const
Get the relations that point from another store array to this object.
Definition: RelationsObject.h:214
Belle2::SVDShaperDigitsFromTracksModule::event
virtual void event() override
processes the event
Definition: SVDShaperDigitsFromTracksModule.cc:100
Belle2::SVDShaperDigitsFromTracksModule::m_track
std::string m_track
Track store array.
Definition: SVDShaperDigitsFromTracksModule.h:73
Belle2::SVDShaperDigitsFromTracksModule::m_outputINArrayName
std::string m_outputINArrayName
StoreArray with the selected output shaperdigits.
Definition: SVDShaperDigitsFromTracksModule.h:77
Belle2::SVDCluster
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Definition: SVDCluster.h:38
Belle2::SVDShaperDigitsFromTracksModule::~SVDShaperDigitsFromTracksModule
virtual ~SVDShaperDigitsFromTracksModule()
if required
Definition: SVDShaperDigitsFromTracksModule.cc:53
Belle2::Track
Class that bundles various TrackFitResults.
Definition: Track.h:35
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::SVDShaperDigitsFromTracksModule::m_svdcluster
std::string m_svdcluster
SVDCLuster store array.
Definition: SVDShaperDigitsFromTracksModule.h:71
Belle2::SVDRecoDigit
The SVD RecoDigit class.
Definition: SVDRecoDigit.h:54
Belle2::SVDShaperDigitsFromTracksModule::isRelatedToTrack
static bool isRelatedToTrack(const SVDShaperDigit *shaperdigit)
select the shaperdigits related to tracks
Definition: SVDShaperDigitsFromTracksModule.cc:122
Belle2::SVDShaperDigitsFromTracksModule::beginRun
virtual void beginRun() override
initializes the module
Definition: SVDShaperDigitsFromTracksModule.cc:95