Belle II Software light-2406-ragdoll
RestOfEvent::Mask Struct Reference

Structure of Rest of Event mask. More...

#include <RestOfEvent.h>

Collaboration diagram for RestOfEvent::Mask:

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 68 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 76 of file RestOfEvent.h.

76 : m_name(name),
77 m_origin(origin)
78 {
79 B2DEBUG(10, "Mask " << name << " is being initialized by " << origin);
80 m_isValid = false;
81 };
std::string m_origin
Mask origin for debug.
Definition: RestOfEvent.h:170
bool m_isValid
Check if mask has elements or correctly initialized.
Definition: RestOfEvent.h:171
std::string m_name
Mask name.
Definition: RestOfEvent.h:169

Member Function Documentation

◆ addParticles()

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

Add selected particles to the mask.

Definition at line 99 of file RestOfEvent.h.

100 {
101 if (isValid()) {
102 B2INFO("Mask " + m_name + " originating from " + m_origin + " is valid, cannot write to it!");
103 return;
104 } else {
105 for (auto* particle : particles) {
106 m_maskedParticleIndices.insert(particle->getArrayIndex());
107 }
108 m_isValid = true;
109 }
110 }
bool isValid() const
Get mask validity.
Definition: RestOfEvent.h:92
std::set< int > m_maskedParticleIndices
StoreArray indices for masked ROE particles.
Definition: RestOfEvent.h:172

◆ addV0()

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

Get selected particles associated to the V0 of mask.

Definition at line 128 of file RestOfEvent.h.

129 {
130 m_maskedV0Indices.insert(v0->getArrayIndex());
131 for (int& i : toErase) {
133 }
134 m_maskedParticleIndices.insert(v0->getArrayIndex());
135 }
std::set< int > m_maskedV0Indices
StoreArray indices for masked V0 ROE particles.
Definition: RestOfEvent.h:173

◆ clearParticles()

void clearParticles ( )
inline

Clear selected particles associated to the mask.

Definition at line 147 of file RestOfEvent.h.

148 {
150 m_maskedV0Indices.clear();
151 m_isValid = false;
152 }

◆ getName()

std::string getName ( ) const
inline

Get mask name.

Definition at line 85 of file RestOfEvent.h.

86 {
87 return m_name;
88 }

◆ getParticles()

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

Get selected particles associated to the mask.

Definition at line 114 of file RestOfEvent.h.

115 {
117 }

◆ getV0s()

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

Get selected particles associated to the V0 of mask.

Definition at line 121 of file RestOfEvent.h.

122 {
123 return m_maskedV0Indices;
124 }

◆ hasV0()

bool hasV0 ( const Particle v0) const
inline

Has selected particles associated to the mask.

Definition at line 139 of file RestOfEvent.h.

140 {
141 return m_maskedV0Indices.count(v0->getArrayIndex()) > 0;
142 }

◆ isValid()

bool isValid ( ) const
inline

Get mask validity.

Definition at line 92 of file RestOfEvent.h.

93 {
94 return m_isValid;
95 }

◆ print()

void print ( ) const
inline

Print mask and selected particles associated to the mask.

Definition at line 156 of file RestOfEvent.h.

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

Member Data Documentation

◆ m_isValid

bool m_isValid
private

Check if mask has elements or correctly initialized.

Definition at line 171 of file RestOfEvent.h.

◆ m_maskedParticleIndices

std::set<int> m_maskedParticleIndices
private

StoreArray indices for masked ROE particles.

Definition at line 172 of file RestOfEvent.h.

◆ m_maskedV0Indices

std::set<int> m_maskedV0Indices
private

StoreArray indices for masked V0 ROE particles.

Definition at line 173 of file RestOfEvent.h.

◆ m_name

std::string m_name
private

Mask name.

Definition at line 169 of file RestOfEvent.h.

◆ m_origin

std::string m_origin
private

Mask origin for debug.

Definition at line 170 of file RestOfEvent.h.


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