Belle II Software development
FiltersContainer< point_t > Class Template Reference

This class contains everything needed by the VXDTF that is not going to change during a RUN, i.e. More...

#include <FiltersContainer.h>

Public Types

using setupNameToFilters_t = std::unordered_map< std::string, Belle2::VXDTFFilters< point_t > * >
 typedef for better readability. Index is name of the setup.
 

Public Member Functions

virtual ~FiltersContainer ()
 Destructor deleting all filters stored.
 
VXDTFFilters< point_t > * getFilters (const std::string &setupName)
 Gives access to the sector map and filters of a given setup.
 
const setupNameToFilters_tgetAllSetups (void)
 returns all the available setups.
 
void assignFilters (const std::string &setupName, VXDTFFilters< point_t > *filters)
 assigns filters.
 

Static Public Member Functions

static FiltersContainergetInstance ()
 one and only way to access the singleton object
 

Private Member Functions

 FiltersContainer (const FiltersContainer &filtersContainer)=delete
 Copies of this class, which is a singleton, are not allowed so the copy constructor method is deleted.
 
FiltersContaineroperator= (const FiltersContainer &)=delete
 dont allow copies
 
 FiltersContainer ()
 Singleton so use a hidden Constructor.
 

Private Attributes

setupNameToFilters_t m_allSetupsFilters
 Container of all the Filters indexed by their setupNames.
 

Detailed Description

template<class point_t>
class Belle2::FiltersContainer< point_t >

This class contains everything needed by the VXDTF that is not going to change during a RUN, i.e.

IP position, B field @ IP, static sectors, 2 space points filters, 3 space points filters, etc. etc. It is a singleton and is shared by all other processes This class owns her members and she is in charge for their deletions.

Definition at line 27 of file FiltersContainer.h.

Member Typedef Documentation

◆ setupNameToFilters_t

using setupNameToFilters_t = std::unordered_map< std::string, Belle2::VXDTFFilters<point_t>*>

typedef for better readability. Index is name of the setup.

Definition at line 31 of file FiltersContainer.h.

Constructor & Destructor Documentation

◆ FiltersContainer()

FiltersContainer ( )
inlineprivate

Singleton so use a hidden Constructor.

Definition at line 46 of file FiltersContainer.h.

47 {
48 }

◆ ~FiltersContainer()

virtual ~FiltersContainer ( )
inlinevirtual

Destructor deleting all filters stored.

Definition at line 62 of file FiltersContainer.h.

63 {
64 for (auto& filter : m_allSetupsFilters)
65 delete filter.second;
66 }
setupNameToFilters_t m_allSetupsFilters
Container of all the Filters indexed by their setupNames.
std::map< ExpRun, std::pair< double, double > > filter(const std::map< ExpRun, std::pair< double, double > > &runs, double cut, std::map< ExpRun, std::pair< double, double > > &runsRemoved)
filter events to remove runs shorter than cut, it stores removed runs in runsRemoved
Definition: Splitter.cc:38

Member Function Documentation

◆ assignFilters()

void assignFilters ( const std::string &  setupName,
VXDTFFilters< point_t > *  filters 
)
inline

assigns filters.

The ownership of filters is taken by FiltersContainer!

Definition at line 87 of file FiltersContainer.h.

89 {
90 // case there is already a filter with this name in the container, we delete that filter!
91 if (m_allSetupsFilters.count(setupName)) {
92 B2INFO("FiltersContainer: Replacing existing filter for setup name: " << setupName);
93 if (m_allSetupsFilters[ setupName ] && filters != m_allSetupsFilters[ setupName ]) delete m_allSetupsFilters[ setupName ];
94 }
95 m_allSetupsFilters[ setupName ] = filters;
96 }

◆ getAllSetups()

const setupNameToFilters_t & getAllSetups ( void  )
inline

returns all the available setups.

Definition at line 80 of file FiltersContainer.h.

81 {
82 return m_allSetupsFilters;
83 }

◆ getFilters()

VXDTFFilters< point_t > * getFilters ( const std::string &  setupName)
inline

Gives access to the sector map and filters of a given setup.

Definition at line 70 of file FiltersContainer.h.

71 {
72 auto result = m_allSetupsFilters.find(setupName);
73 if (result == m_allSetupsFilters.end())
74 return nullptr;
75 return result->second;
76 }

◆ getInstance()

static FiltersContainer & getInstance ( )
inlinestatic

one and only way to access the singleton object

the unique_ptr takes care for the deletion of the object!

Definition at line 53 of file FiltersContainer.h.

54 {
56 static std::unique_ptr<FiltersContainer> instance(new FiltersContainer());
57 return * instance;
58 }
FiltersContainer()
Singleton so use a hidden Constructor.

Member Data Documentation

◆ m_allSetupsFilters

setupNameToFilters_t m_allSetupsFilters
private

Container of all the Filters indexed by their setupNames.

Definition at line 36 of file FiltersContainer.h.


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