Belle II Software  release-05-01-25
PXDOccupancyInfoPar.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Benjamin Schwenker *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <TObject.h>
13 #include <unordered_map>
14 
15 
16 namespace Belle2 {
30  class PXDOccupancyInfoPar: public TObject {
31  public:
32 
35 
38  void setNumberOfEvents(int nEvents) { m_nEvents = nEvents; }
39 
42  int getNumberOfEvents() const { return m_nEvents; }
43 
49  void setOccupancy(unsigned short sensorID, float occupancy)
50  {
51  m_MapOccupancy[sensorID] = occupancy;
52  }
53 
59  float getOccupancy(unsigned short sensorID) const
60  {
61  auto mapIter = m_MapOccupancy.find(sensorID);
62  if (mapIter != m_MapOccupancy.end()) {
63  return mapIter->second;
64  }
65  // Fallback when user asks for sensor that was not calibrated
66  return -1;
67  }
68 
69  private:
70 
72  int m_nEvents;
73 
75  std::unordered_map<unsigned short, float> m_MapOccupancy;
76 
78  };
80 } // end of namespace Belle2
Belle2::PXDOccupancyInfoPar::ClassDef
ClassDef(PXDOccupancyInfoPar, 2)
ClassDef, must be the last term before the closing {}.
Belle2::PXDOccupancyInfoPar::m_nEvents
int m_nEvents
Number of collected events used for occupancy computation, may decide to not trust calibrations with ...
Definition: PXDOccupancyInfoPar.h:80
Belle2::PXDOccupancyInfoPar::m_MapOccupancy
std::unordered_map< unsigned short, float > m_MapOccupancy
Map containing mean occupancy per sensor.
Definition: PXDOccupancyInfoPar.h:83
Belle2::PXDOccupancyInfoPar::PXDOccupancyInfoPar
PXDOccupancyInfoPar()
Default constructor.
Definition: PXDOccupancyInfoPar.h:42
Belle2::PXDOccupancyInfoPar::setOccupancy
void setOccupancy(unsigned short sensorID, float occupancy)
Set occupancy.
Definition: PXDOccupancyInfoPar.h:57
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::PXDOccupancyInfoPar::setNumberOfEvents
void setNumberOfEvents(int nEvents)
Set number of events used for occupancy estimation.
Definition: PXDOccupancyInfoPar.h:46
Belle2::PXDOccupancyInfoPar::getNumberOfEvents
int getNumberOfEvents() const
Get number of events used for occupancy estimation.
Definition: PXDOccupancyInfoPar.h:50
Belle2::PXDOccupancyInfoPar::getOccupancy
float getOccupancy(unsigned short sensorID) const
Get occupancy.
Definition: PXDOccupancyInfoPar.h:67
Belle2::PXDOccupancyInfoPar
The payload collecting some meta information from running the masking algorithm.
Definition: PXDOccupancyInfoPar.h:38