Belle II Software development
SVDChargeSimulationCalibrations.h
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#pragma once
10
11#include <vxd/dataobjects/VxdID.h>
12#include <svd/dbobjects/SVDCalibrationsBase.h>
13#include <svd/dbobjects/SVDCalibrationsScalar.h>
14#include <svd/dbobjects/SVDChargeSimCal.h>
15#include <framework/database/DBObjPtr.h>
16
17namespace Belle2 {
27 public:
28 static std::string name;
34 {
35 m_aDBObjPtr.addCallback([ this ](const std::string&) -> void {
36 B2DEBUG(20, "SVDChargeSimulationCalibrations: from now on we are using " <<
37 this->m_aDBObjPtr -> get_uniqueID()); });
38
39 }
40
53 inline float getCouplingConstant(const VxdID& sensorID, const bool& isU, const std::string& couplingName) const
54 {
55 float coupling_constant = 0;
56 try {
57 coupling_constant = m_aDBObjPtr->getReference(sensorID.getLayerNumber(), sensorID.getLadderNumber(),
58 sensorID.getSensorNumber(), m_aDBObjPtr->sideIndex(isU), 0).couplingConstant.at(couplingName);
59 } catch (const std::out_of_range& oor) {
60 B2ERROR("Cannot find coupling constant " << couplingName << " in database.");
61 }
62 return coupling_constant;
63 }
64
72 inline float getElectronWeight(const VxdID& sensorID, const bool& isU) const
73 {
74 return m_aDBObjPtr->getReference(sensorID.getLayerNumber(), sensorID.getLadderNumber(),
75 sensorID.getSensorNumber(), m_aDBObjPtr->sideIndex(isU), 0).electronWeight;
76 }
77
79 TString getUniqueID() { return m_aDBObjPtr->get_uniqueID(); }
80
82 bool isValid() { return m_aDBObjPtr.isValid(); }
83
84 private:
85 DBObjPtr <t_payload> m_aDBObjPtr;
87 };
88
90}
base class for calibrations classes
This class defines the dbobject and the methods to access SVD simulation calibrations; coupling const...
float getCouplingConstant(const VxdID &sensorID, const bool &isU, const std::string &couplingName) const
Return coupling constant.
SVDCalibrationsBase< SVDCalibrationsScalar< SVDChargeSimCal > > t_payload
typedef of the SVDChargeSimulationCalibrations payload
float getElectronWeight(const VxdID &sensorID, const bool &isU) const
Return Geant4 electron weight.
SVDChargeSimulationCalibrations()
Constructor, no input argument is required.
DBObjPtr< t_payload > m_aDBObjPtr
the SVDChargeSimulationCalibrations payload
static std::string name
name of the SVDChargeSimulationCalibrations payload
TString getUniqueID()
returns the unique ID of the payload
bool isValid()
returns true if the m_aDBObtPtr is valid in the requested IoV
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
baseType getSensorNumber() const
Get the sensor id.
Definition: VxdID.h:100
baseType getLadderNumber() const
Get the ladder id.
Definition: VxdID.h:98
baseType getLayerNumber() const
Get the layer id.
Definition: VxdID.h:96
Abstract base class for different kinds of events.