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