Belle II Software  release-05-02-19
SVDOccupancyCalibrations.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Laura Zani *
7  * *
8  * This software is provided "as is" without any warranty. *
9  * WARNING: Do not try to fry it with water. Use only olive oil. *
10  **************************************************************************/
11 
12 #pragma once
13 
14 #include <vxd/dataobjects/VxdID.h>
15 #include <svd/dbobjects/SVDCalibrationsBase.h>
16 #include <svd/dbobjects/SVDCalibrationsVector.h>
17 #include <framework/database/DBObjPtr.h>
18 
19 #include <string>
20 
21 namespace Belle2 {
33  class SVDOccupancyCalibrations {
34  public:
35  static std::string name;
36  typedef SVDCalibrationsBase< SVDCalibrationsVector< float > > t_payload;
38  // unused at the moment, but do not forget it!
39  // static std::string threshold_name; /**< name of the threshold payload */
40  // typedef SVDCalibrationsBase< SVDCalibrationsVector< float > > t_threshold_payload; /**< typedef of the threshold payload of all SVD strips*/
41 
45  {
46  m_aDBObjPtr.addCallback([ this ](const std::string&) -> void {
47  B2INFO("SVDOccupancyCalibrations: from now on we are using " <<
48  this->m_aDBObjPtr -> get_uniqueID()); });
49  }
50 
51 
62  inline float getOccupancy(const VxdID& sensorID, const bool& isU , const unsigned short& strip) const
63  {
64  return m_aDBObjPtr->get(sensorID.getLayerNumber(), sensorID.getLadderNumber(),
65  sensorID.getSensorNumber(), m_aDBObjPtr->sideIndex(isU),
66  strip);
67  }
68 
69 
71  TString getUniqueID() { return m_aDBObjPtr->get_uniqueID(); }
72 
74  bool isValid() { return m_aDBObjPtr.isValid(); }
75 
76  private:
77  DBObjPtr< t_payload > m_aDBObjPtr;
80  };
82 }
83 
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
Belle2::VxdID::getLadderNumber
baseType getLadderNumber() const
Get the ladder id.
Definition: VxdID.h:108
Belle2::SVDOccupancyCalibrations::getUniqueID
TString getUniqueID()
returns the unique ID of the payload
Definition: SVDOccupancyCalibrations.h:80
Belle2::SVDOccupancyCalibrations::SVDOccupancyCalibrations
SVDOccupancyCalibrations()
Constructor, no input argument is required.
Definition: SVDOccupancyCalibrations.h:52
Belle2::SVDOccupancyCalibrations::m_aDBObjPtr
DBObjPtr< t_payload > m_aDBObjPtr
payload of the occupancy
Definition: SVDOccupancyCalibrations.h:86
Belle2::SVDOccupancyCalibrations::getOccupancy
float getOccupancy(const VxdID &sensorID, const bool &isU, const unsigned short &strip) const
This is the method for getting the occupancy, or the deviation from the average, still to be decided.
Definition: SVDOccupancyCalibrations.h:71
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::VxdID::getSensorNumber
baseType getSensorNumber() const
Get the sensor id.
Definition: VxdID.h:110
Belle2::SVDOccupancyCalibrations::isValid
bool isValid()
returns true if the m_aDBObtPtr is valid in the requested IoV
Definition: SVDOccupancyCalibrations.h:83
Belle2::SVDOccupancyCalibrations::t_payload
SVDCalibrationsBase< SVDCalibrationsVector< float > > t_payload
typedef of the Occupancy payload of all SVD strips
Definition: SVDOccupancyCalibrations.h:45
Belle2::VxdID::getLayerNumber
baseType getLayerNumber() const
Get the layer id.
Definition: VxdID.h:106
Belle2::SVDOccupancyCalibrations::name
static std::string name
name of the ccupancy payload
Definition: SVDOccupancyCalibrations.h:44