Belle II Software development
CDCGeometryLoader.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#include <tracking/trackFindingCDC/topology/CDCGeometryLoader.h>
9
10#include <cdc/geometry/CDCGeometryPar.h>
11
12#include <framework/database/Database.h>
13#include <framework/database/DBStore.h>
14#include <framework/datastore/StoreObjPtr.h>
15#include <framework/datastore/DataStore.h>
16#include <framework/dataobjects/EventMetaData.h>
17
18using namespace Belle2;
19using namespace TrackFindingCDC;
20
22{
23 // Setup the DataStore and
24 // create the default event number to be used for the DB parameter
28 evtPtr.registerInDataStore();
30 // use experiment 0 for MC-only events
31 evtPtr.construct(1, 0, 0);
32
34 // load database content for IoV in EventMetaData
36
37 DBObjPtr<CDCGeometry> cdcGeometry;
38 if (!cdcGeometry) {
39 B2FATAL("No CDC configuration can be loaded!");
40 } else {
41 B2INFO("CDC Geometry loaded from DB");
42 }
43
44 CDC::CDCGeometryPar::Instance(&(*cdcGeometry));
45}
46
48{
51}
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
static DataStore & Instance()
Instance of singleton Store.
Definition: DataStore.cc:54
void setInitializeActive(bool active)
Setter for m_initializeActive.
Definition: DataStore.cc:94
void reset(EDurability durability)
Frees memory occupied by data store items and removes all objects from the map.
Definition: DataStore.cc:86
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
bool construct(Args &&... params)
Construct an object of type T in this StoreObjPtr, using the provided constructor arguments.
Definition: StoreObjPtr.h:119
static void closeDatabase()
Helper function to close and reset the database - only for tests offside the standard event processin...
static void loadDatabase()
Helper function to open the database - only for tests offside the standard event processing.
static DBStore & Instance()
Instance of a singleton DBStore.
Definition: DBStore.cc:28
void update()
Updates all objects that are outside their interval of validity.
Definition: DBStore.cc:79
static void reset(bool keepConfig=false)
Reset the database instance.
Definition: Database.cc:50
Abstract base class for different kinds of events.