Belle II Software development
FilterValueDataSet< SecIDSetType > Class Template Reference

contains the relevant information needed for filling a TTree containing train-data for the secMap. More...

#include <FilterValueDataSet.h>

Public Member Functions

 FilterValueDataSet (std::vector< std::string > filterNames)
 constructor, expects to get a vector of names for filters.
 
void setValueOfFilter (std::string filterName, double value)
 for given filterName a value is set.
 
double * getValuePtr (std::string filterName)
 returns pointer to value of given filterName, nullptr if filterName has not been found.
 
void reset ()
 resets all values stored to std::numeric_limits< double>::max().
 
bool isValid ()
 checks if any value is still not set and returns false if that is the case.
 

Public Attributes

unsigned expNo
 number of the experiment this dataset is taken from.
 
unsigned runNo
 number of the run this dataset is taken from.
 
unsigned evtNo
 number of the event this dataset is taken from.
 
unsigned trackNo
 number of the reference track this dataset is taken from (its ID in the datastore).
 
int pdg
 Pdg given by reference track.
 
SecIDSetType secIDs
 contains the secIDs.
 

Protected Attributes

std::map< std::string, double > m_values
 map containing a value for each key==name of filter.
 

Detailed Description

template<class SecIDSetType>
class Belle2::FilterValueDataSet< SecIDSetType >

contains the relevant information needed for filling a TTree containing train-data for the secMap.

Definition at line 119 of file FilterValueDataSet.h.

Constructor & Destructor Documentation

◆ FilterValueDataSet()

FilterValueDataSet ( std::vector< std::string >  filterNames)
inlineexplicit

constructor, expects to get a vector of names for filters.

Definition at line 148 of file FilterValueDataSet.h.

148 :
149 expNo(std::numeric_limits<unsigned>::max()),
150 runNo(std::numeric_limits<unsigned>::max()),
151 evtNo(std::numeric_limits<unsigned>::max()),
152 trackNo(std::numeric_limits<unsigned>::max()),
153 pdg(std::numeric_limits<int>::max())
154 {
155 for (auto name : filterNames) {
156 m_values.insert({name, std::numeric_limits<double>::max()});
157 B2DEBUG(26, "FilterValueDataSet::constructor: filterName " << name << " has been added.");
158 }
159 B2DEBUG(25, "FilterValueDataSet::constructor: " << m_values.size() << " filters have been added.");
160 }
std::map< std::string, double > m_values
map containing a value for each key==name of filter.
unsigned runNo
number of the run this dataset is taken from.
int pdg
Pdg given by reference track.
unsigned trackNo
number of the reference track this dataset is taken from (its ID in the datastore).
unsigned evtNo
number of the event this dataset is taken from.
unsigned expNo
number of the experiment this dataset is taken from.

Member Function Documentation

◆ getValuePtr()

double * getValuePtr ( std::string  filterName)
inline

returns pointer to value of given filterName, nullptr if filterName has not been found.

Definition at line 176 of file FilterValueDataSet.h.

177 {
178 double* valuePtr = nullptr;
179 auto it = m_values.find(filterName);
180 if (it != m_values.end()) {
181 valuePtr = &it->second;
182 } else { B2WARNING("filter could not be found, returning nullptr instead!"); }
183 return valuePtr;
184 }

◆ isValid()

bool isValid ( )
inline

checks if any value is still not set and returns false if that is the case.

(only completely set values in the dataSet are valid).

Definition at line 202 of file FilterValueDataSet.h.

203 {
204 if (expNo == std::numeric_limits<unsigned>::max()) return false;
205 if (runNo == std::numeric_limits<unsigned>::max()) return false;
206 if (evtNo == std::numeric_limits<unsigned>::max()) return false;
207 if (trackNo == std::numeric_limits<unsigned>::max()) return false;
208 if (pdg == std::numeric_limits<int>::max()) return false;
209 for (auto& entry : m_values) {
210 if (entry.second == std::numeric_limits<double>::max()) return false;
211 }
212 return secIDs.isValid();
213 }
SecIDSetType secIDs
contains the secIDs.

◆ reset()

void reset ( )
inline

resets all values stored to std::numeric_limits< double>::max().

and all FilterIDs to std::numeric_limits< unsigned>::max()

Definition at line 187 of file FilterValueDataSet.h.

188 {
189 expNo = std::numeric_limits<unsigned>::max();
190 runNo = std::numeric_limits<unsigned>::max();
191 evtNo = std::numeric_limits<unsigned>::max();
192 trackNo = std::numeric_limits<unsigned>::max();
193 pdg = std::numeric_limits<int>::max();
194 secIDs.reset();
195 for (auto& entry : m_values) {
196 entry.second = std::numeric_limits<double>::max();
197 }
198 }

◆ setValueOfFilter()

void setValueOfFilter ( std::string  filterName,
double  value 
)
inline

for given filterName a value is set.

if filterName does not exist, an error is produced and nothing gets stored.

Definition at line 163 of file FilterValueDataSet.h.

164 {
165 auto it = m_values.find(filterName);
166 if (it == m_values.end()) {
167 B2ERROR("FilterValueDataSet::setValueOfFilter: filterName " << filterName
168 << "is not known, value " << value
169 << " will NOT be added!");
170 return;
171 }
172 it->second = value;
173 }

Member Data Documentation

◆ evtNo

unsigned evtNo

number of the event this dataset is taken from.

Definition at line 133 of file FilterValueDataSet.h.

◆ expNo

unsigned expNo

number of the experiment this dataset is taken from.

Definition at line 127 of file FilterValueDataSet.h.

◆ m_values

std::map<std::string, double> m_values
protected

map containing a value for each key==name of filter.

Definition at line 122 of file FilterValueDataSet.h.

◆ pdg

int pdg

Pdg given by reference track.

Definition at line 139 of file FilterValueDataSet.h.

◆ runNo

unsigned runNo

number of the run this dataset is taken from.

Definition at line 130 of file FilterValueDataSet.h.

◆ secIDs

SecIDSetType secIDs

contains the secIDs.

Definition at line 142 of file FilterValueDataSet.h.

◆ trackNo

unsigned trackNo

number of the reference track this dataset is taken from (its ID in the datastore).

Definition at line 136 of file FilterValueDataSet.h.


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