Belle II Software development
PXDOccupancyInfoPar.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#pragma once
9
10#include <TObject.h>
11#include <unordered_map>
12
13
14namespace Belle2 {
28 class PXDOccupancyInfoPar: public TObject {
29 public:
30
33
36 void setNumberOfEvents(int nEvents) { m_nEvents = nEvents; }
37
40 int getNumberOfEvents() const { return m_nEvents; }
41
47 void setOccupancy(unsigned short sensorID, float occupancy)
48 {
49 m_MapOccupancy[sensorID] = occupancy;
50 }
51
57 float getOccupancy(unsigned short sensorID) const
58 {
59 auto mapIter = m_MapOccupancy.find(sensorID);
60 if (mapIter != m_MapOccupancy.end()) {
61 return mapIter->second;
62 }
63 // Fallback when user asks for sensor that was not calibrated
64 return -1;
65 }
66
67 private:
68
71
73 std::unordered_map<unsigned short, float> m_MapOccupancy;
74
76 };
78} // end of namespace Belle2
The payload collecting some meta information from running the masking algorithm.
void setOccupancy(unsigned short sensorID, float occupancy)
Set occupancy.
int getNumberOfEvents() const
Get number of events used for occupancy estimation.
ClassDef(PXDOccupancyInfoPar, 2)
ClassDef, must be the last term before the closing {}.
void setNumberOfEvents(int nEvents)
Set number of events used for occupancy estimation.
PXDOccupancyInfoPar()
Default constructor.
float getOccupancy(unsigned short sensorID) const
Get occupancy.
std::unordered_map< unsigned short, float > m_MapOccupancy
Map containing mean occupancy per sensor.
int m_nEvents
Number of collected events used for occupancy computation, may decide to not trust calibrations with ...
Abstract base class for different kinds of events.