Belle II Software light-2406-ragdoll
BackgroundInfo.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 <framework/pcore/Mergeable.h>
12#include <framework/dataobjects/BackgroundMetaData.h>
13#include <framework/core/FrameworkExceptions.h>
14#include <string>
15#include <vector>
16
17namespace Belle2 {
26 class BackgroundInfo: public Mergeable {
27
28 public:
29
33 BELLE2_DEFINE_EXCEPTION(BackgroundInfoNotMergeable,
34 "BackgroundInfo: objects cannot be merged");
35
39 enum EMethod {c_Unknown = 0,
41 c_Overlay = 2
42 };
43
49 std::string type;
51 std::vector<std::string> fileNames;
52 double realTime = 0;
53 unsigned numEvents = 0;
54 double scaleFactor = 1;
55 double rate = 0;
56 unsigned reused = 0;
57 int runNumber = 0;
58 };
59
64 {}
65
70
75 void setMethod(EMethod method) {m_method = method;}
76
82 unsigned appendBackgroundDescr(const BackgroundDescr& bgDescr)
83 {
84 m_backgrounds.push_back(bgDescr);
85 return m_backgrounds.size() - 1;
86 }
87
92 void setComponents(const std::vector<std::string>& components)
93 {
94 m_components = components;
95 }
96
101 void setMinTime(double minTime) {m_minTime = minTime;}
102
107 void setMaxTime(double maxTime) {m_maxTime = maxTime;}
108
113 void setMinTimeECL(double minTimeECL) {m_minTimeECL = minTimeECL;}
114
119 void setMaxTimeECL(double maxTimeECL) {m_maxTimeECL = maxTimeECL;}
120
125 void setMinTimePXD(double minTimePXD) {m_minTimePXD = minTimePXD;}
126
131 void setMaxTimePXD(double maxTimePXD) {m_maxTimePXD = maxTimePXD;}
132
137 void setWrapAround(bool wrapAround) {m_wrapAround = wrapAround;}
138
143 void setMaxEdepECL(double maxEdepECL) {m_maxEdepECL = maxEdepECL;}
144
150 void setExtensionName(const std::string& name) {m_extensionName = name;}
151
156 void incrementReusedCounter(unsigned index)
157 {
158 if (index < m_backgrounds.size()) m_backgrounds[index].reused++;
159 }
160
165 EMethod getMethod() const {return m_method;}
166
171 const std::vector<BackgroundDescr>& getBackgrounds() const {return m_backgrounds;}
172
177 const std::vector<std::string>& getComponents() const {return m_components;}
178
183 double getMinTime() const {return m_minTime;}
184
189 double getMaxTime() const {return m_maxTime;}
190
195 double getMinTimeECL() const {return m_minTimeECL;}
196
201 double getMaxTimeECL() const {return m_maxTimeECL;}
202
207 double getMinTimePXD() const {return m_minTimePXD;}
208
213 double getMaxTimePXD() const {return m_maxTimePXD;}
214
219 bool getWrapAround() const {return m_wrapAround;}
220
225 double getMaxEdepECL() const {return m_maxEdepECL;}
226
232 const std::string& getExtensionName() const {return m_extensionName;}
233
237 virtual void merge(const Mergeable* other) override;
238
242 virtual void clear() override;
243
247 void print() const;
248
249 private:
250
256 bool canBeMerged(const BackgroundInfo* other);
257
261 void printForMixing() const;
262
266 void printForOverlay() const;
267
269 std::vector<BackgroundDescr> m_backgrounds;
270 std::vector<std::string> m_components;
271 double m_minTime = 0;
272 double m_maxTime = 0;
273 double m_minTimeECL = 0;
274 double m_maxTimeECL = 0;
275 double m_minTimePXD = 0;
276 double m_maxTimePXD = 0;
277 bool m_wrapAround = false;
278 double m_maxEdepECL = 0;
279 std::string m_extensionName;
282 };
284}
285
286
This class stores the information about what background was mixed or overlayed.
double m_maxEdepECL
maximal allowed deposited energy in ECL
void setMaxTime(double maxTime)
Set upper edge of the narrow time window.
double m_maxTimeECL
maximal time shift of background event for ECL
BELLE2_DEFINE_EXCEPTION(BackgroundInfoNotMergeable, "BackgroundInfo: objects cannot be merged")
Exception definition.
void setWrapAround(bool wrapAround)
Set wrap-around flag.
void setMethod(EMethod method)
Set method that is used to add BG.
void setMinTimePXD(double minTimePXD)
Set lower edge of PXD time window.
std::vector< std::string > m_components
detector components included
double getMaxTime() const
Returns upper edge of the narrow time window.
void printForOverlay() const
Print info when BG overlay is used.
double m_minTimePXD
minimal time shift of background event for PXD
double getMaxTimeECL() const
Returns upper edge of ECL time window.
std::vector< BackgroundDescr > m_backgrounds
background descriptions
double getMaxEdepECL() const
Returns maximal alowed energy deposited in ECL to use BG events.
EMethod getMethod() const
Returns method enum used to add BG.
double m_maxTime
maximal time shift of background event
bool getWrapAround() const
Returns wrap-around flag.
double m_minTime
minimal time shift of background event
bool m_wrapAround
wrap around events in the tail after maxTime
const std::string & getExtensionName() const
Returns name added to default branch names of background collections Used primarily to pass this name...
double getMaxTimePXD() const
Returns upper edge of PXD time window.
double m_maxTimePXD
maximal time shift of background event for PXD
void printForMixing() const
Print info when BG mixing is used.
EMethod
enum for methods used to add BG
void setMaxTimeECL(double maxTimeECL)
Set upper edge of ECL time window.
double getMinTimePXD() const
Returns lower edge of PXD time window.
void setExtensionName(const std::string &name)
Set name that is added to default branch names of background collections Used primarily to pass this ...
std::string m_extensionName
name added to default branch names of background
void setMaxTimePXD(double maxTimePXD)
Set upper edge of PXD time window.
virtual void merge(const Mergeable *other) override
Implementation of abstract class function.
~BackgroundInfo()
Destructor.
unsigned appendBackgroundDescr(const BackgroundDescr &bgDescr)
Append background description of a sample.
void setMinTime(double minTime)
Set lower edge of the narrow time window.
void setMaxEdepECL(double maxEdepECL)
Set maximal alowed energy deposited in ECL to use BG events.
void incrementReusedCounter(unsigned index)
Increments sample reused counter.
const std::vector< std::string > & getComponents() const
Returns included components.
BackgroundInfo()
Default constructor.
void setComponents(const std::vector< std::string > &components)
Set components included.
bool canBeMerged(const BackgroundInfo *other)
Checks if other object can be merged with this object.
const std::vector< BackgroundDescr > & getBackgrounds() const
Returns background descriptions.
void print() const
Print the info.
double getMinTimeECL() const
Returns lower edge of ECL time window.
double m_minTimeECL
minimal time shift of background event for ECL
void setMinTimeECL(double minTimeECL)
Set lower edge of ECL time window.
virtual void clear() override
Implementation of abstract class function.
double getMinTime() const
Returns lower edge of the narrow time window.
ClassDefOverride(BackgroundInfo, 5)
Class definition.
EFileType
Enum for BG file types.
BG_TAG
Enum for background tags.
Abstract base class for objects that can be merged.
Definition: Mergeable.h:31
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24
Structure for background description.
std::vector< std::string > fileNames
file names
double rate
background rate of the sample
unsigned reused
number of times the sample is reused
int runNumber
run number of run-dependent overlay, otherwise 0
BackgroundMetaData::BG_TAG tag
background tag denoting type
std::string type
background type
double scaleFactor
scale factor for the rate
double realTime
real time of BG samlpe
unsigned numEvents
number of events (tree entries) in the sample
BackgroundMetaData::EFileType fileType
file type