Belle II Software light-2405-quaxo
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 };
58
63 {}
64
69
74 void setMethod(EMethod method) {m_method = method;}
75
81 unsigned appendBackgroundDescr(const BackgroundDescr& bgDescr)
82 {
83 m_backgrounds.push_back(bgDescr);
84 return m_backgrounds.size() - 1;
85 }
86
91 void setComponents(const std::vector<std::string>& components)
92 {
93 m_components = components;
94 }
95
100 void setMinTime(double minTime) {m_minTime = minTime;}
101
106 void setMaxTime(double maxTime) {m_maxTime = maxTime;}
107
112 void setMinTimeECL(double minTimeECL) {m_minTimeECL = minTimeECL;}
113
118 void setMaxTimeECL(double maxTimeECL) {m_maxTimeECL = maxTimeECL;}
119
124 void setMinTimePXD(double minTimePXD) {m_minTimePXD = minTimePXD;}
125
130 void setMaxTimePXD(double maxTimePXD) {m_maxTimePXD = maxTimePXD;}
131
136 void setWrapAround(bool wrapAround) {m_wrapAround = wrapAround;}
137
142 void setMaxEdepECL(double maxEdepECL) {m_maxEdepECL = maxEdepECL;}
143
149 void setExtensionName(const std::string& name) {m_extensionName = name;}
150
155 void incrementReusedCounter(unsigned index)
156 {
157 if (index < m_backgrounds.size()) m_backgrounds[index].reused++;
158 }
159
164 EMethod getMethod() const {return m_method;}
165
170 const std::vector<BackgroundDescr>& getBackgrounds() const {return m_backgrounds;}
171
176 const std::vector<std::string>& getComponents() const {return m_components;}
177
182 double getMinTime() const {return m_minTime;}
183
188 double getMaxTime() const {return m_maxTime;}
189
194 double getMinTimeECL() const {return m_minTimeECL;}
195
200 double getMaxTimeECL() const {return m_maxTimeECL;}
201
206 double getMinTimePXD() const {return m_minTimePXD;}
207
212 double getMaxTimePXD() const {return m_maxTimePXD;}
213
218 bool getWrapAround() const {return m_wrapAround;}
219
224 double getMaxEdepECL() const {return m_maxEdepECL;}
225
231 const std::string& getExtensionName() const {return m_extensionName;}
232
236 virtual void merge(const Mergeable* other) override;
237
241 virtual void clear() override;
242
246 void print() const;
247
248 private:
249
255 bool canBeMerged(const BackgroundInfo* other);
256
260 void printForMixing() const;
261
265 void printForOverlay() const;
266
268 std::vector<BackgroundDescr> m_backgrounds;
269 std::vector<std::string> m_components;
270 double m_minTime = 0;
271 double m_maxTime = 0;
272 double m_minTimeECL = 0;
273 double m_maxTimeECL = 0;
274 double m_minTimePXD = 0;
275 double m_maxTimePXD = 0;
276 bool m_wrapAround = false;
277 double m_maxEdepECL = 0;
278 std::string m_extensionName;
281 };
283}
284
285
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
ClassDefOverride(BackgroundInfo, 4)
Class definition.
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.
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
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