Belle II Software  release-08-01-10
SVDHitTimeSelection.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/SVDHitTimeSelectionFunction.h>
15 #include <framework/database/DBObjPtr.h>
16 #include <framework/logging/Logger.h>
17 #include <string>
18 
19 namespace Belle2 {
30  public:
31  static std::string name;
37  : m_aDBObjPtr(name)
38  {
39  m_aDBObjPtr.addCallback([ this ](const std::string&) -> void {
40  B2DEBUG(20, "SVDHitTimeSelection: from now on we are using " <<
41  this->m_aDBObjPtr -> get_uniqueID()); });
42  }
43 
44 
45 
59  inline bool isClusterInTime(
60  const Belle2::VxdID& sensorID,
61  const bool& isU,
62  const double& svdTime, const double& svdTimeError = 0,
63  const double& t0 = 0, const double& t0Error = 0
64  ) const
65  {
66  return m_aDBObjPtr->getReference(sensorID.getLayerNumber(),
67  sensorID.getLadderNumber(),
68  sensorID.getSensorNumber(),
69  m_aDBObjPtr->sideIndex(isU),
70  0 //strip not relevant
71  ).isInTime(svdTime, svdTimeError, t0, t0Error);
72 
73  }
74 
85  const Belle2::VxdID& sensorID,
86  const double& uTime, const double& vTime = 0
87  ) const
88  {
89  return m_aDBObjPtr->getReference(sensorID.getLayerNumber(),
90  sensorID.getLadderNumber(),
91  sensorID.getSensorNumber(),
92  m_aDBObjPtr->sideIndex(true), // side not relevant
93  0 // strip not relevant
94  ).areClustersInTime(uTime, vTime);
95  }
96 
97 
109  const Belle2::VxdID& sensorID,
110  const bool& isU
111  ) const
112  {
113  return m_aDBObjPtr->getReference(sensorID.getLayerNumber(),
114  sensorID.getLadderNumber(),
115  sensorID.getSensorNumber(),
116  m_aDBObjPtr->sideIndex(isU),
117  0 // strip not relevant
118  ).getFunctionID();
119 
120  }
121 
132  inline float getMinClusterTime(
133  const Belle2::VxdID& sensorID,
134  const bool& isU
135  ) const
136  {
137  return m_aDBObjPtr->getReference(sensorID.getLayerNumber(),
138  sensorID.getLadderNumber(),
139  sensorID.getSensorNumber(),
140  m_aDBObjPtr->sideIndex(isU),
141  0 // strip not relevant
142  ).getMinTime();
143 
144  }
145 
146 
148  TString getUniqueID() { return m_aDBObjPtr->get_uniqueID(); }
149 
151  bool isValid() { return m_aDBObjPtr.isValid(); }
152 
153 
154  private:
155 
157  };
159 }
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
base class for calibrations classes
This class defines the dbobject and the methods to access the calibration of the cluster reconstructi...
SVDCalibrationsBase< SVDCalibrationsScalar< SVDHitTimeSelectionFunction > > t_payload
typedef for the of SVDHitTimeSelectionFunction payload of all SVD sensors
bool isClusterInTime(const Belle2::VxdID &sensorID, const bool &isU, const double &svdTime, const double &svdTimeError=0, const double &t0=0, const double &t0Error=0) const
Return whether the cluster is estimated to be in time with the event or off-time.
SVDHitTimeSelection()
Constructor, no input argument is required.
static std::string name
name of SVDHitTimeSelectionFunction payload
float getMinClusterTime(const Belle2::VxdID &sensorID, const bool &isU) const
Return the min value of the cluster time to use it for reconstruction.
bool areClusterTimesCompatible(const Belle2::VxdID &sensorID, const double &uTime, const double &vTime=0) const
Return whether the cluster is estimated to be in time with the event or off-time.
int getTimeSelectionFunction(const Belle2::VxdID &sensorID, const bool &isU) const
Return the version of the function used to determine whether the cluster time is acceptable at the SP...
TString getUniqueID()
returns the unique ID of the payload
DBObjPtr< t_payload > m_aDBObjPtr
SVDHitTimeSelectionFunction paylaod.
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.