Belle II Software  release-05-01-25
CDCGeometryLoader.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost, Thomas Hauth *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/trackFindingCDC/topology/CDCGeometryLoader.h>
11 
12 #include <cdc/geometry/CDCGeometryPar.h>
13 
14 #include <framework/database/Database.h>
15 #include <framework/database/DBStore.h>
16 #include <framework/datastore/StoreObjPtr.h>
17 #include <framework/datastore/DataStore.h>
18 #include <framework/dataobjects/EventMetaData.h>
19 
20 using namespace Belle2;
21 using namespace TrackFindingCDC;
22 
24 {
25  // Setup the DataStore and
26  // create the default event number to be used for the DB parameter
30  evtPtr.registerInDataStore();
32  // use experiment 0 for MC-only events
33  evtPtr.construct(1, 0, 0);
34 
36  // load database content for IoV in EventMetaData
38 
39  DBObjPtr<CDCGeometry> cdcGeometry;
40  if (!cdcGeometry) {
41  B2FATAL("No CDC configuration can be loaded!");
42  } else {
43  B2INFO("CDC Geometry loaded from DB");
44  }
45 
46  CDC::CDCGeometryPar::Instance(&(*cdcGeometry));
47 }
48 
50 {
53 }
Belle2::DataStore::Instance
static DataStore & Instance()
Instance of singleton Store.
Definition: DataStore.cc:54
Belle2::DataStore::setInitializeActive
void setInitializeActive(bool active)
Setter for m_initializeActive.
Definition: DataStore.cc:94
Belle2::Database::reset
static void reset(bool keepConfig=false)
Reset the database instance.
Definition: Database.cc:62
Belle2::DBObjPtr
Class for accessing objects in the database.
Definition: DBObjPtr.h:31
Belle2::DataStore::reset
void reset(EDurability durability)
Frees memory occupied by data store items and removes all objects from the map.
Definition: DataStore.cc:86
Belle2::StoreObjPtr::construct
bool construct(Args &&... params)
Construct an object of type T in this StoreObjPtr, using the provided constructor arguments.
Definition: StoreObjPtr.h:128
Belle2::CDC::CDCGeometryPar::Instance
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.
Definition: CDCGeometryPar.cc:41
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::DBStore::Instance
static DBStore & Instance()
Instance of a singleton DBStore.
Definition: DBStore.cc:36
Belle2::TrackFindingCDC::CDCGeometryLoader::closeDatabase
static void closeDatabase()
Helper function to close and reset the database - only for tests offside the standard event processin...
Definition: CDCGeometryLoader.cc:49
Belle2::TrackFindingCDC::CDCGeometryLoader::loadDatabase
static void loadDatabase()
Helper function to open the database - only for tests offside the standard event processing.
Definition: CDCGeometryLoader.cc:23
Belle2::DBStore::update
void update()
Updates all objects that are outside their interval of validity.
Definition: DBStore.cc:87