Belle II Software development
CDCMCManager.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 <tracking/trackFindingCDC/mclookup/CDCMCManager.h>
10
11#include <tracking/trackFindingCDC/mclookup/CDCMCHitLookUp.h>
12#include <tracking/trackFindingCDC/mclookup/CDCMCSegment2DLookUp.h>
13#include <tracking/trackFindingCDC/mclookup/CDCMCSegment3DLookUp.h>
14#include <tracking/trackFindingCDC/mclookup/CDCMCTrackLookUp.h>
15
16#include <tracking/trackFindingCDC/mclookup/CDCMCTrackStore.h>
17#include <tracking/trackFindingCDC/mclookup/CDCSimHitLookUp.h>
18
19#include <tracking/trackFindingCDC/mclookup/CDCMCMap.h>
20
21#include <framework/datastore/StoreArray.h>
22#include <framework/datastore/StoreObjPtr.h>
23
24#include <cdc/dataobjects/CDCSimHit.h>
25#include <mdst/dataobjects/MCParticle.h>
26
27using namespace Belle2;
28using namespace TrackFindingCDC;
29
30namespace {
31 CDCMCMap& getMCMapInstance()
32 {
33 static CDCMCMap mcMap;
34 return mcMap;
35 }
36
37 CDCMCTrackStore& getMCTrackStoreInstance()
38 {
39 static CDCMCTrackStore mcTrackStore;
40 return mcTrackStore;
41 }
42
43 CDCSimHitLookUp& getSimHitLookUpInstance()
44 {
45 static CDCSimHitLookUp simHitLookUp;
46 return simHitLookUp;
47 }
48
49 CDCMCHitLookUp& getMCHitLookUpInstance()
50 {
51 static CDCMCHitLookUp mcHitLookUp;
52 return mcHitLookUp;
53 }
54
55 CDCMCSegment2DLookUp& getMCSegment2DLookUpInstance()
56 {
57 static CDCMCSegment2DLookUp mcSegment2DLookUp;
58 return mcSegment2DLookUp;
59 }
60
61 CDCMCSegment3DLookUp& getMCSegment3DLookUpInstance()
62 {
63 static CDCMCSegment3DLookUp mcSegment3DLookUp;
64 return mcSegment3DLookUp;
65 }
66
67 CDCMCTrackLookUp& getMCTrackLookUpInstance()
68 {
69 static CDCMCTrackLookUp mcTrackLookUp;
70 return mcTrackLookUp;
71 }
72}
73
75{
76 static CDCMCManager mcManager;
77 return mcManager;
78}
79
81{
82 return ::getMCMapInstance();
83}
84
86{
87 return ::getMCTrackStoreInstance();
88}
89
91{
92 return ::getSimHitLookUpInstance();
93}
94
96{
97 return ::getMCHitLookUpInstance();
98}
99
101{
102 return ::getMCSegment2DLookUpInstance();
103}
104
106{
107 return ::getMCSegment3DLookUpInstance();
108}
109
111{
112 return ::getMCTrackLookUpInstance();
113}
114
116{
117 StoreArray <CDCSimHit> cdcSimHits;
118 cdcSimHits.isRequired();
119 StoreArray <MCParticle> mcParticles;
120 mcParticles.isRequired();
121}
122
124{
125 ::getMCTrackLookUpInstance().clear();
126 ::getMCSegment3DLookUpInstance().clear();
127 ::getMCSegment2DLookUpInstance().clear();
128 //::getMCHitLookUpInstance().clear(); // Currently has no clear
129
130 ::getMCTrackStoreInstance().clear();
131 ::getSimHitLookUpInstance().clear();
132 ::getMCMapInstance().clear();
133}
134
136{
137 StoreObjPtr<EventMetaData> storedEventMetaData;
138
139 if (storedEventMetaData.isValid()) {
140 if (m_eventMetaData == *storedEventMetaData) {
141 // Instance has already been filled with the current event
142 return;
143 }
144 }
145
146 clear();
147
148 ::getMCMapInstance().fill();
149 const CDCMCMap* ptrMCMap = &getMCMap();
150 ::getSimHitLookUpInstance().fill(ptrMCMap);
151
152 const CDCSimHitLookUp* ptrSimHitLookUp = &getSimHitLookUp();
153 ::getMCTrackStoreInstance().fill(ptrMCMap, ptrSimHitLookUp);
154
155 if (storedEventMetaData.isValid()) {
156 //after filling store the event numbers
157 m_eventMetaData = *storedEventMetaData;
158 }
159}
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
bool isValid() const
Check whether the object was created.
Definition: StoreObjPtr.h:111
Interface class to the Monte Carlo information for individual hits.
Class to organize and present the Monte Carlo hit information.
Definition: CDCMCManager.h:29
static const CDCSimHitLookUp & getSimHitLookUp()
Getter for the singleton instance of the CDCSimHitLookUp.
Definition: CDCMCManager.cc:90
static const CDCMCSegment2DLookUp & getMCSegment2DLookUp()
Getter for the singleton instance of the CDCMCSegment2DLookUp.
static const CDCMCSegment3DLookUp & getMCSegment3DLookUp()
Getter for the singleton instance of the CDCMCSegment3DLookUp.
static const CDCMCHitLookUp & getMCHitLookUp()
Getter for the singleton instance of the CDCMCHitLookUp.
Definition: CDCMCManager.cc:95
static const CDCMCTrackLookUp & getMCTrackLookUp()
Getter for the singleton instance of the CDCMCTrackLookUp.
static const CDCMCTrackStore & getMCTrackStore()
Getter for the singleton instance of the CDCMCTrackStore.
Definition: CDCMCManager.cc:85
EventMetaData m_eventMetaData
Memory for the event, run and experiment number corresponding to the currently stored data.
Definition: CDCMCManager.h:78
void requireTruthInformation()
Require the MC information store arrays.
void clear()
Clears all Monte Carlo information present in the last event.
static const CDCMCMap & getMCMap()
Getter for the singleton instance of the CDCMCMap.
Definition: CDCMCManager.cc:80
void fill()
Fill Monte Carlo look up maps from the DataStore.
static CDCMCManager & getInstance()
Getter for the singleton instance.
Definition: CDCMCManager.cc:74
Class to organize and present the Monte Carlo hit information.
Definition: CDCMCMap.h:28
Specialisation of the lookup for the truth values of two dimensional segments.
Specialisation of the lookup for the truth values of two dimensional segments.
Specialisation of the lookup for the truth values of reconstructed tracks.
Class to organize and present the monte carlo hit information.
Singletone class to gather local information about the hits.
Abstract base class for different kinds of events.