Belle II Software development
VectorOfObservers< FilterType > Class Template Reference

WARNING TODO: More...

Inheritance diagram for VectorOfObservers< FilterType >:
VoidObserver

Public Types

typedef std::function< void(const FilterType &, typename FilterType::variableType, const typename FilterType::argumentType &, const typename FilterType::argumentType &)> observerFunction
 a typedef to make the stuff more readable
 
using CStyleFunctionPointer = void(*)(const typename FilterType::argumentType &, const typename FilterType::argumentType &, const FilterType &, typename FilterType::variableType)
 a typedef to make the c-style pointer more readable (can not be done with classic typedef)
 

Static Public Member Functions

template<typename range , typename ... otherTypes>
static void notify (const FilterType &filterType, typename FilterType::variableType filterResult, const range &, const typename FilterType::argumentType &outerHit, const typename FilterType::argumentType &innerHit, otherTypes ...)
 iterate over all stored Observers and execute their notify-function
 
template<typename ObserverType >
static void addObserver (observerFunction newObserver)
 collects observers to be executed during notify (can not be used so far, but is long-term goal)
 
template<typename ... types>
static void notify (const types &...)
 static method used by the observed object to notify the observer.
 
template<typename ... types>
static bool initialize (const types &...)
 static method used by the observed object to initialize the observer it is called once usually from the user.
 
template<typename ... types>
static void prepare (const types &...)
 static method used by the observed object to prepare the observer it is called by the boolean filter operator.
 
template<typename ... types>
static void collect (const types &...)
 static method used by the observed object to prepare the observer it is called by the boolean filter operator.
 
template<typename ... types>
static void terminate (const types &...)
 static method used by the observed object to terminate the observer.
 

Static Public Attributes

static std::vector< observerFunctionsm_collectedObservers = {}
 collects observers with std::function to be executed during notify (variant A)
 
static std::vector< CStyleFunctionPointersm_collectedObserversCSTYLE = {}
 collects observers with c-style function pointers to be executed during notify (variant B)
 

Detailed Description

template<class FilterType>
class VXDTFObserversTest::VectorOfObservers< FilterType >

WARNING TODO:

  • BasicRootObserver (same as BasicInfoObserver but with storing info to container instead of printing it to screen (not working here, since trackNodes are needed for this (secMapID, secIDs)
  • MCInfoObserver and subparts (mcParticleID, pT, isPrimary, purity level, pdgCode)
  • MCRootObserver like BasicRootObserver but for MCInfoObserver instead of BasicInfoObserver
  • How to get secID and secMapID? -> trackNode
  • How to get mcParticleID, pT, isPrimary, pdgCode? -> trackNode->SpacePoint->relation< MCParticle >
  • How to get purity? -> advanced version of question before
  • How to get the stuff into root-files? -> Observers store into static containers which are frequently emptied into another container which finally will be written to a root file this observer does simply collect other observers which are to be executed during the call of the corresponding notify function(s)

Definition at line 691 of file observers.cc.

Member Typedef Documentation

◆ CStyleFunctionPointer

using CStyleFunctionPointer = void(*)(const typename FilterType::argumentType&, const typename FilterType::argumentType&, const FilterType&, typename FilterType::variableType)

a typedef to make the c-style pointer more readable (can not be done with classic typedef)

Definition at line 699 of file observers.cc.

◆ observerFunction

typedef std::function< void (const FilterType&, typename FilterType::variableType, const typename FilterType::argumentType&, const typename FilterType::argumentType&)> observerFunction

a typedef to make the stuff more readable

Definition at line 696 of file observers.cc.

Member Function Documentation

◆ addObserver()

static void addObserver ( observerFunction  newObserver)
inlinestatic

collects observers to be executed during notify (can not be used so far, but is long-term goal)

Definition at line 729 of file observers.cc.

730 {
731 VectorOfObservers<FilterType>::sm_collectedObservers.push_back(std::bind(&newObserver, std::placeholders::_1, std::placeholders::_2,
732 FilterType(), std::placeholders::_3));
733 }
static std::vector< observerFunction > sm_collectedObservers
collects observers with std::function to be executed during notify (variant A)
Definition: observers.cc:738

◆ collect()

static void collect ( const types &  ...)
inlinestaticinherited

static method used by the observed object to prepare the observer it is called by the boolean filter operator.

Definition at line 55 of file VoidObserver.h.

55{};

◆ initialize()

static bool initialize ( const types &  ...)
inlinestaticinherited

static method used by the observed object to initialize the observer it is called once usually from the user.

Definition at line 43 of file VoidObserver.h.

43{ return true; };

◆ notify() [1/2]

static void notify ( const FilterType &  filterType,
typename FilterType::variableType  filterResult,
const range &  ,
const typename FilterType::argumentType &  outerHit,
const typename FilterType::argumentType &  innerHit,
otherTypes ...   
)
inlinestatic

iterate over all stored Observers and execute their notify-function

the idea of the following three lines have to work in the end (I basically want to loop over all attached observers and execute their notify function):

or

Definition at line 704 of file observers.cc.

710 {
711 B2INFO(" Filter " << filterType.name() << " with Mag of outer-/innerHit " << outerHit.getPosition().Mag() << "/" <<
712 innerHit.getPosition().Mag() << " got result of " << filterResult << " and Observer-Vector sm_collectedObservers got " <<
713 VectorOfObservers<FilterType>::sm_collectedObservers.size() << " observers collected");
714 B2INFO(" Filter " << filterType.name() << " with Mag of outer-/innerHit " << outerHit.getPosition().Mag() << "/" <<
715 innerHit.getPosition().Mag() << " got result of " << filterResult << " and Observer-Vector sm_collectedObserversCSTYLE got " <<
716 VectorOfObservers<FilterType>::sm_collectedObserversCSTYLE.size() << " observers collected");
717
719 // for(auto& anObserver : CollectedObservers<FilterType>::collectedObservers) {
720 // anObserver(outerHit, innerHit, filterResult);
721 // }
723 }
DataType Mag() const
The magnitude (rho in spherical coordinate system).
Definition: B2Vector3.h:159
static std::vector< CStyleFunctionPointer > sm_collectedObserversCSTYLE
collects observers with c-style function pointers to be executed during notify (variant B)
Definition: observers.cc:740
B2Vector3D outerHit(0, 0, 0)
testing out of range behavior

◆ notify() [2/2]

static void notify ( const types &  ...)
inlinestaticinherited

static method used by the observed object to notify the observer.

it is called at each accept.

Definition at line 37 of file VoidObserver.h.

37{};

◆ prepare()

static void prepare ( const types &  ...)
inlinestaticinherited

static method used by the observed object to prepare the observer it is called by the boolean filter operator.

Definition at line 49 of file VoidObserver.h.

49{};

◆ terminate()

static void terminate ( const types &  ...)
inlinestaticinherited

static method used by the observed object to terminate the observer.

Definition at line 67 of file VoidObserver.h.

67{};

Member Data Documentation

◆ sm_collectedObservers

std::vector< typename VectorOfObservers< FilterType >::observerFunction > sm_collectedObservers = {}
static

collects observers with std::function to be executed during notify (variant A)

initialize static member of variant A

Definition at line 738 of file observers.cc.

◆ sm_collectedObserversCSTYLE

std::vector< typename VectorOfObservers< FilterType >::CStyleFunctionPointer > sm_collectedObserversCSTYLE = {}
static

collects observers with c-style function pointers to be executed during notify (variant B)

initialize static member of variant B

Definition at line 740 of file observers.cc.


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