Belle II Software light-2406-ragdoll
BackgroundMetaData Class Reference

Metadata information about the beam background file. More...

#include <BackgroundMetaData.h>

Inheritance diagram for BackgroundMetaData:
Collaboration diagram for BackgroundMetaData:

Public Types

enum  BG_TAG {
  bg_none = 0 ,
  bg_Coulomb_LER = 1 ,
  bg_Coulomb_HER = 2 ,
  bg_RBB_LER = 3 ,
  bg_RBB_HER = 4 ,
  bg_Touschek_LER = 5 ,
  bg_Touschek_HER = 6 ,
  bg_twoPhoton = 7 ,
  bg_RBB_gamma = 8 ,
  bg_RBB_LER_far = 9 ,
  bg_RBB_HER_far = 10 ,
  bg_Touschek_LER_far = 11 ,
  bg_Touschek_HER_far = 12 ,
  bg_SynchRad_LER = 13 ,
  bg_SynchRad_HER = 14 ,
  bg_BHWide_LER = 15 ,
  bg_BHWide_HER = 16 ,
  bg_RBB = 17 ,
  bg_BHWide = 18 ,
  bg_BHWideLargeAngle = 19 ,
  bg_InjectionLER = 21 ,
  bg_InjectionHER = 22 ,
  bg_Brems_LER = 23 ,
  bg_Brems_HER = 24 ,
  bg_Brems_base_LER = 25 ,
  bg_Brems_dynamic_LER = 26 ,
  bg_Brems_base_HER = 27 ,
  bg_Brems_dynamic_HER = 28 ,
  bg_Coulomb_base_LER = 29 ,
  bg_Coulomb_dynamic_LER = 30 ,
  bg_Coulomb_base_HER = 31 ,
  bg_Coulomb_dynamic_HER = 32 ,
  bg_other = 99
}
 Enum for background tags. More...
 
enum  EFileType {
  c_Usual = 0 ,
  c_ECL = 1 ,
  c_PXD = 2
}
 Enum for BG file types. More...
 

Public Member Functions

 BELLE2_DEFINE_EXCEPTION (BackgroundMetaDataNotMergeable, "BackgroundMetaData: objects cannot be merged")
 Exception definition.
 
 BackgroundMetaData ()
 Constructor.
 
void setBackgroundType (const std::string &type)
 Sets background type.
 
void setBackgroundTag (BG_TAG tag)
 Sets background tag value that corresponds to background type.
 
void setRealTime (float time)
 Sets real time that corresponds to this background sample.
 
void setFileType (EFileType type)
 Sets file type.
 
const std::string & getBackgroundType () const
 Returns the type of background.
 
BG_TAG getBackgroundTag () const
 Returns background tag value.
 
float getRealTime () const
 Returns real time that corresponds to this background sample.
 
EFileType getFileType () const
 Returns file type.
 
virtual void merge (const Mergeable *other) override
 Implementation of abstract class function.
 
virtual void clear () override
 Implementation of abstract class function.
 
virtual void removeSideEffects ()
 An ugly little method that is called before event() for input and worker processes.
 
virtual Long64_t Merge (TCollection *hlist)
 Allow merging using TFileMerger if saved directly to a file.
 
virtual void Reset ()
 Root-like Reset function for "template compatibility" with ROOT objects.
 
virtual void SetDirectory (TDirectory *)
 Root-like SetDirectory function for "template compatibility" with ROOT objects.
 

Static Public Member Functions

static constexpr std::string_view getDefaultBackgroundOverlayType ()
 Returns the default name for background overlay type.
 

Private Member Functions

bool canBeMerged (const BackgroundMetaData *other)
 Checks if other object can be merged with this object.
 
 ClassDefOverride (BackgroundMetaData, 4)
 Class definition required for creation of ROOT dictionary.
 
 ClassDef (Mergeable, 0)
 Abstract base class for objects that can be merged.
 

Private Attributes

std::string m_backgroundType
 beam background type
 
BG_TAG m_backgroundTag = bg_other
 background tag
 
float m_realTime = 0
 real time that corresponds to beam background sample
 
EFileType m_fileType = c_Usual
 file type
 

Static Private Attributes

static constexpr std::string_view c_defaultBackgroundOverlayType = "RandomTrigger"
 default name for background overlay type
 

Detailed Description

Metadata information about the beam background file.

Definition at line 26 of file BackgroundMetaData.h.

Member Enumeration Documentation

◆ BG_TAG

enum BG_TAG

Enum for background tags.

Enumerator
bg_none 

No background.

bg_Coulomb_LER 

Coulomb LER.

bg_Coulomb_HER 

Coulomb HER.

bg_RBB_LER 

Radiative Bhabha LER.

bg_RBB_HER 

Radiative Bhabha HER.

bg_Touschek_LER 

Touschek LER.

bg_Touschek_HER 

Touschek HER.

bg_twoPhoton 

2-photon

bg_RBB_gamma 

Gammas from radiative Bhabha.

bg_RBB_LER_far 

Radiative Bhabha far LER.

bg_RBB_HER_far 

Radiative Bhabha far HER.

bg_Touschek_LER_far 

Touschek far LER.

bg_Touschek_HER_far 

Touschek far HER.

bg_SynchRad_LER 

Synchrotron radiation LER.

bg_SynchRad_HER 

Synchrotron radiation HER.

bg_BHWide_LER 

Wide angle radiative Bhabha LER.

bg_BHWide_HER 

Wide angle radiative Bhabha HER.

bg_RBB 

Radiative Bhabha.

bg_BHWide 

Wide angle radiative Bhabha.

bg_BHWideLargeAngle 

Large angle radiative Bhabha.

bg_InjectionLER 

injection background LER

bg_InjectionHER 

injection background HER

bg_Brems_LER 

bremsstrahlung LER

bg_Brems_HER 

bremsstrahlung HER

bg_Brems_base_LER 

bremsstrahlung base LER

bg_Brems_dynamic_LER 

bremsstrahlung dynamic LER

bg_Brems_base_HER 

bremsstrahlung base HER

bg_Brems_dynamic_HER 

bremsstrahlung dynamic HER

bg_Coulomb_base_LER 

Coulomb base LER.

bg_Coulomb_dynamic_LER 

Coulomb dynamic LER.

bg_Coulomb_base_HER 

Coulomb base HER.

bg_Coulomb_dynamic_HER 

Coulomb dynamic HER.

bg_other 

Other type of background.

Definition at line 33 of file BackgroundMetaData.h.

33 { bg_none = 0,
34 bg_Coulomb_LER = 1,
35 bg_Coulomb_HER = 2,
36 bg_RBB_LER = 3,
37 bg_RBB_HER = 4,
38 bg_Touschek_LER = 5,
39 bg_Touschek_HER = 6,
40 bg_twoPhoton = 7,
41 bg_RBB_gamma = 8,
42 bg_RBB_LER_far = 9,
43 bg_RBB_HER_far = 10,
46 bg_SynchRad_LER = 13,
47 bg_SynchRad_HER = 14,
48 bg_BHWide_LER = 15,
49 bg_BHWide_HER = 16,
50 bg_RBB = 17,
51 bg_BHWide = 18,
53 bg_InjectionLER = 21,
54 bg_InjectionHER = 22,
55 bg_Brems_LER = 23,
56 bg_Brems_HER = 24,
65 bg_other = 99
66 };
@ bg_RBB_HER_far
Radiative Bhabha far HER.
@ bg_BHWide_LER
Wide angle radiative Bhabha LER.
@ bg_Coulomb_dynamic_LER
Coulomb dynamic LER.
@ bg_Coulomb_dynamic_HER
Coulomb dynamic HER.
@ bg_BHWideLargeAngle
Large angle radiative Bhabha.
@ bg_RBB_LER
Radiative Bhabha LER.
@ bg_Brems_base_HER
bremsstrahlung base HER
@ bg_Touschek_HER_far
Touschek far HER.
@ bg_Brems_LER
bremsstrahlung LER
@ bg_InjectionLER
injection background LER
@ bg_Brems_dynamic_HER
bremsstrahlung dynamic HER
@ bg_BHWide_HER
Wide angle radiative Bhabha HER.
@ bg_Coulomb_base_HER
Coulomb base HER.
@ bg_SynchRad_HER
Synchrotron radiation HER.
@ bg_Coulomb_base_LER
Coulomb base LER.
@ bg_Brems_HER
bremsstrahlung HER
@ bg_Brems_dynamic_LER
bremsstrahlung dynamic LER
@ bg_Touschek_LER_far
Touschek far LER.
@ bg_BHWide
Wide angle radiative Bhabha.
@ bg_RBB_HER
Radiative Bhabha HER.
@ bg_SynchRad_LER
Synchrotron radiation LER.
@ bg_InjectionHER
injection background HER
@ bg_RBB_LER_far
Radiative Bhabha far LER.
@ bg_other
Other type of background.
@ bg_Brems_base_LER
bremsstrahlung base LER
@ bg_RBB_gamma
Gammas from radiative Bhabha.

◆ EFileType

enum EFileType

Enum for BG file types.

Enumerator
c_Usual 

usual BG file

c_ECL 

additional for ECL

c_PXD 

additional for PXD

Definition at line 77 of file BackgroundMetaData.h.

77 { c_Usual = 0,
78 c_ECL = 1,
79 c_PXD = 2
80 };

Constructor & Destructor Documentation

◆ BackgroundMetaData()

BackgroundMetaData ( )
inline

Constructor.

Definition at line 85 of file BackgroundMetaData.h.

86 {}

Member Function Documentation

◆ canBeMerged()

bool canBeMerged ( const BackgroundMetaData other)
private

Checks if other object can be merged with this object.

Parameters
otherobject to be merged with this object
Returns
true, if can be merged

Definition at line 16 of file BackgroundMetaData.cc.

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}
BG_TAG m_backgroundTag
background tag
std::string m_backgroundType
beam background type

◆ clear()

void clear ( )
overridevirtual

Implementation of abstract class function.

Implements Mergeable.

Definition at line 55 of file BackgroundMetaData.cc.

56{
57 m_realTime = 0;
58}
float m_realTime
real time that corresponds to beam background sample

◆ getBackgroundTag()

BG_TAG getBackgroundTag ( ) const
inline

Returns background tag value.

Returns
tag value

Definition at line 122 of file BackgroundMetaData.h.

122{return m_backgroundTag;}

◆ getBackgroundType()

const std::string & getBackgroundType ( ) const
inline

Returns the type of background.

Returns
background type

Definition at line 116 of file BackgroundMetaData.h.

116{return m_backgroundType;}

◆ getDefaultBackgroundOverlayType()

static constexpr std::string_view getDefaultBackgroundOverlayType ( )
inlinestaticconstexpr

Returns the default name for background overlay type.

Definition at line 139 of file BackgroundMetaData.h.

static constexpr std::string_view c_defaultBackgroundOverlayType
default name for background overlay type

◆ getFileType()

EFileType getFileType ( ) const
inline

Returns file type.

Returns
file type

Definition at line 134 of file BackgroundMetaData.h.

134{return m_fileType;}

◆ getRealTime()

float getRealTime ( ) const
inline

Returns real time that corresponds to this background sample.

Returns
real time

Definition at line 128 of file BackgroundMetaData.h.

128{return m_realTime;}

◆ merge()

void merge ( const Mergeable other)
overridevirtual

Implementation of abstract class function.

Implements Mergeable.

Definition at line 38 of file BackgroundMetaData.cc.

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}
Metadata information about the beam background file.
bool canBeMerged(const BackgroundMetaData *other)
Checks if other object can be merged with this object.

◆ Merge()

Long64_t Merge ( TCollection *  hlist)
virtualinherited

Allow merging using TFileMerger if saved directly to a file.

Note
dictionaries containing your Mergeable class need to be loaded, so 'hadd' will not work currently.

Definition at line 14 of file Mergeable.cc.

15{
16 Long64_t nMerged = 0;
17 if (hlist) {
18 const Mergeable* xh = nullptr;
19 TIter nxh(hlist);
20 while ((xh = dynamic_cast<Mergeable*>(nxh()))) {
21 // Add xh to me
22 merge(xh);
23 ++nMerged;
24 }
25 }
26 return nMerged;
27}
Abstract base class for objects that can be merged.
Definition: Mergeable.h:31
virtual void merge(const Mergeable *other)=0
Merge object 'other' into this one.

◆ removeSideEffects()

virtual void removeSideEffects ( )
inlinevirtualinherited

An ugly little method that is called before event() for input and worker processes.

Main use case is to detach any attached TFile from this object. In the output process, it can stay attached (and grow as much as it likes).

Reimplemented in RootMergeable< T >.

Definition at line 58 of file Mergeable.h.

58{}

◆ Reset()

virtual void Reset ( )
inlinevirtualinherited

Root-like Reset function for "template compatibility" with ROOT objects.

Alias for clear().

Definition at line 66 of file Mergeable.h.

66{clear();}
virtual void clear()=0
Clear content of this object (e.g.

◆ setBackgroundTag()

void setBackgroundTag ( BG_TAG  tag)
inline

Sets background tag value that corresponds to background type.

Parameters
taga tag value

Definition at line 98 of file BackgroundMetaData.h.

98{m_backgroundTag = tag;}

◆ setBackgroundType()

void setBackgroundType ( const std::string &  type)
inline

Sets background type.

Parameters
typebackground type

Definition at line 92 of file BackgroundMetaData.h.

92{m_backgroundType = type;}

◆ SetDirectory()

virtual void SetDirectory ( TDirectory *  )
inlinevirtualinherited

Root-like SetDirectory function for "template compatibility" with ROOT objects.

Does nothing.

Definition at line 68 of file Mergeable.h.

68{}

◆ setFileType()

void setFileType ( EFileType  type)
inline

Sets file type.

Parameters
typefile type

Definition at line 110 of file BackgroundMetaData.h.

110{m_fileType = type;}

◆ setRealTime()

void setRealTime ( float  time)
inline

Sets real time that corresponds to this background sample.

Parameters
timereal time

Definition at line 104 of file BackgroundMetaData.h.

104{m_realTime = time;}

Member Data Documentation

◆ c_defaultBackgroundOverlayType

constexpr std::string_view c_defaultBackgroundOverlayType = "RandomTrigger"
staticconstexprprivate

default name for background overlay type

Definition at line 165 of file BackgroundMetaData.h.

◆ m_backgroundTag

BG_TAG m_backgroundTag = bg_other
private

background tag

Definition at line 162 of file BackgroundMetaData.h.

◆ m_backgroundType

std::string m_backgroundType
private

beam background type

Definition at line 161 of file BackgroundMetaData.h.

◆ m_fileType

EFileType m_fileType = c_Usual
private

file type

Definition at line 164 of file BackgroundMetaData.h.

◆ m_realTime

float m_realTime = 0
private

real time that corresponds to beam background sample

Definition at line 163 of file BackgroundMetaData.h.


The documentation for this class was generated from the following files: