Belle II Software development
RestOfEvent::Mask Struct Reference

Structure of Rest of Event mask. More...

#include <RestOfEvent.h>

Public Member Functions

 Mask (const std::string &name=c_defaultMaskName, const std::string &origin="unknown")
 Default constructor.
 
std::string getName () const
 Get mask name.
 
bool isValid () const
 Get mask validity.
 
void addParticles (const std::vector< const Particle * > &particles)
 Add selected particles to the mask.
 
std::set< int > getParticles () const
 Get selected particles associated to the mask.
 
std::set< int > getV0s () const
 Get selected particles associated to the V0 of mask.
 
void addV0 (const Particle *v0, std::vector< int > &toErase)
 Get selected particles associated to the V0 of mask.
 
bool hasV0 (const Particle *v0) const
 Has selected particles associated to the mask.
 
void clearParticles ()
 Clear selected particles associated to the mask.
 
void print () const
 Print mask and selected particles associated to the mask.
 

Private Attributes

std::string m_name
 Mask name.
 
std::string m_origin
 Mask origin for debug.
 
bool m_isValid
 Check if mask has elements or correctly initialized.
 
std::set< int > m_maskedParticleIndices
 StoreArray indices for masked ROE particles.
 
std::set< int > m_maskedV0Indices
 StoreArray indices for masked V0 ROE particles.
 

Detailed Description

Structure of Rest of Event mask.

It contains array indices of particles, which were selected and associated to this mask after some selection. Host ROE object always check that masks do not contain extra particles, which are not included in ROE initially for consistency. TODO: Will it be written to StoreArray? Maybe should be moved to private.

Definition at line 66 of file RestOfEvent.h.

Constructor & Destructor Documentation

◆ Mask()

Mask ( const std::string & name = c_defaultMaskName,
const std::string & origin = "unknown" )
inline

Default constructor.

All private members are set to 0 (all vectors are empty).

Parameters
namename of mask
originorigin of mask, for debug

Definition at line 74 of file RestOfEvent.h.

74 : m_name(name),
75 m_origin(origin)
76 {
77 B2DEBUG(10, "Mask " << name << " is being initialized by " << origin);
78 m_isValid = false;
79 };

Member Function Documentation

◆ addParticles()

void addParticles ( const std::vector< const Particle * > & particles)
inline

Add selected particles to the mask.

Definition at line 97 of file RestOfEvent.h.

98 {
99 if (isValid()) {
100 B2INFO("Mask " + m_name + " originating from " + m_origin + " is valid, cannot write to it!");
101 return;
102 } else {
103 for (auto* particle : particles) {
104 m_maskedParticleIndices.insert(particle->getArrayIndex());
105 }
106 m_isValid = true;
107 }
108 }
bool isValid(EForwardBackward eForwardBackward)
Check whether the given enum instance is one of the valid values.

◆ addV0()

void addV0 ( const Particle * v0,
std::vector< int > & toErase )
inline

Get selected particles associated to the V0 of mask.

Definition at line 126 of file RestOfEvent.h.

127 {
128 m_maskedV0Indices.insert(v0->getArrayIndex());
129 for (int& i : toErase) {
130 m_maskedParticleIndices.erase(i);
131 }
132 m_maskedParticleIndices.insert(v0->getArrayIndex());
133 }

◆ clearParticles()

void clearParticles ( )
inline

Clear selected particles associated to the mask.

Definition at line 145 of file RestOfEvent.h.

146 {
147 m_maskedParticleIndices.clear();
148 m_maskedV0Indices.clear();
149 m_isValid = false;
150 }

◆ getName()

std::string getName ( ) const
inline

Get mask name.

Definition at line 83 of file RestOfEvent.h.

84 {
85 return m_name;
86 }

◆ getParticles()

std::set< int > getParticles ( ) const
inline

Get selected particles associated to the mask.

Definition at line 112 of file RestOfEvent.h.

113 {
114 return m_maskedParticleIndices;
115 }

◆ getV0s()

std::set< int > getV0s ( ) const
inline

Get selected particles associated to the V0 of mask.

Definition at line 119 of file RestOfEvent.h.

120 {
121 return m_maskedV0Indices;
122 }

◆ hasV0()

bool hasV0 ( const Particle * v0) const
inline

Has selected particles associated to the mask.

Definition at line 137 of file RestOfEvent.h.

138 {
139 return m_maskedV0Indices.count(v0->getArrayIndex()) > 0;
140 }

◆ isValid()

bool isValid ( ) const
inline

Get mask validity.

Definition at line 90 of file RestOfEvent.h.

91 {
92 return m_isValid;
93 }

◆ print()

void print ( ) const
inline

Print mask and selected particles associated to the mask.

Definition at line 154 of file RestOfEvent.h.

155 {
156 B2INFO("Mask name: " + m_name + " originating from " + m_origin);
157 if (!m_isValid) {
158 B2INFO("\tNot valid!");
159 }
160 std::string printout = "\tIndices: ";
161 for (const int index : m_maskedParticleIndices) {
162 printout += std::to_string(index) + ", ";
163 }
164 B2INFO(printout);
165 }

Member Data Documentation

◆ m_isValid

bool m_isValid
private

Check if mask has elements or correctly initialized.

Definition at line 169 of file RestOfEvent.h.

◆ m_maskedParticleIndices

std::set<int> m_maskedParticleIndices
private

StoreArray indices for masked ROE particles.

Definition at line 170 of file RestOfEvent.h.

◆ m_maskedV0Indices

std::set<int> m_maskedV0Indices
private

StoreArray indices for masked V0 ROE particles.

Definition at line 171 of file RestOfEvent.h.

◆ m_name

std::string m_name
private

Mask name.

Definition at line 167 of file RestOfEvent.h.

◆ m_origin

std::string m_origin
private

Mask origin for debug.

Definition at line 168 of file RestOfEvent.h.


The documentation for this struct was generated from the following file: