Belle II Software light-2406-ragdoll
BackgroundMetaData.cc
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#include <framework/dataobjects/BackgroundMetaData.h>
10#include <framework/logging/Logger.h>
11
12using namespace std;
13using namespace Belle2;
14
15
17{
18
19 if (otherObj->getBackgroundType() != m_backgroundType) {
20 B2ERROR("BackgroundMetaData: objects cannot be merged (different backgroundType)");
21 return false;
22 }
23
24 if (otherObj->getBackgroundTag() != m_backgroundTag) {
25 B2ERROR("BackgroundMetaData: objects cannot be merged (different backgroundTag)");
26 return false;
27 }
28
29 if (otherObj->getFileType() != m_fileType) {
30 B2ERROR("BackgroundMetaData: objects cannot be merged (different fileType)");
31 return false;
32 }
33
34 return true;
35}
36
37
39{
40 auto otherObj = static_cast<const BackgroundMetaData*>(other);
41
42 if (otherObj->getBackgroundType().empty()) return; // no merge for empty object
43
44 if (m_backgroundType.empty()) { // empty, replace it with other
45 *this = *otherObj;
46 return;
47 }
48
49 if (!canBeMerged(otherObj)) throw BackgroundMetaDataNotMergeable();
50
51 m_realTime += otherObj->getRealTime();
52
53}
54
56{
57 m_realTime = 0;
58}
Metadata information about the beam background file.
BG_TAG m_backgroundTag
background tag
float m_realTime
real time that corresponds to beam background sample
bool canBeMerged(const BackgroundMetaData *other)
Checks if other object can be merged with this object.
EFileType getFileType() const
Returns file type.
const std::string & getBackgroundType() const
Returns the type of background.
virtual void merge(const Mergeable *other) override
Implementation of abstract class function.
std::string m_backgroundType
beam background type
BG_TAG getBackgroundTag() const
Returns background tag value.
virtual void clear() override
Implementation of abstract class function.
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
STL namespace.