Belle II Software development
ObserverInfo.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <TObject.h>
12
13#include <tracking/dataobjects/SpacePointInfo.h>
14#include <tracking/dataobjects/FilterInfo.h>
15
16namespace Belle2 {
24 class ObserverInfo : public TObject {
25 public:
30
32 void clear()
33 {
34 m_filterInfos.clear();
35 m_hits.clear();
36 m_mainMCParticleID = -666;
37 m_mainPurity = 0;
38 };
39
43 FilterInfo getFilterInfo(std::string const& key)
44 {
45 for (int i = 0; i < (int) m_filterInfos.size(); i++)
46 if (m_filterInfos.at(i).getName() == key) return m_filterInfos.at(i);
47 //if nothing was found return an empty object
48 return FilterInfo();
49 };
50
54 std::string getFilterName(int i)
55 {
56 return (0 <= i && i < (int)m_filterInfos.size()) ? m_filterInfos[i].getName() : std::string("");
57 }
58
62 double getFilterResult(std::string const& key)
63 {
64 return getFilterInfo(key).getResult();
65 }
66
70 bool getFilterAccepted(std::string const& key)
71 {
72 return getFilterInfo(key).getWasAccepted();
73 }
74
78 double getFilterUsed(std::string const& key)
79 {
80 return getFilterInfo(key).getWasUsed();
81 }
82
86 void addFilterInfo(FilterInfo info) { m_filterInfos.push_back(info); };
87
89 std::vector<SpacePointInfo> getHits() { return m_hits; };
90
95 {
96 if (i < 0 || i > (int)m_hits.size()) return SpacePointInfo(); // return a dummy object
97 else return m_hits[i];
98 };
99
103 void setHits(const std::vector<SpacePointInfo>& newHits) { m_hits = newHits; };
104
107
112
114 double getMainPurity() { return m_mainPurity; };
115
119 void setMainPurity(double val) { m_mainPurity = val; };
120 private:
122 std::vector<FilterInfo> m_filterInfos;
123
125 std::vector<SpacePointInfo> m_hits;
126
129
132
135 };
136
138}// end namespace Belle2
helper class to store the information for a Filter
Definition: FilterInfo.h:20
bool getWasAccepted()
returns if the event was accepted
Definition: FilterInfo.h:48
bool getWasUsed()
returns if filter was evaluated
Definition: FilterInfo.h:50
double getResult()
returns the result of the filtervariable attached to this filter
Definition: FilterInfo.h:46
Helper class that stores the information an Observer stores: i.e.
Definition: ObserverInfo.h:24
ObserverInfo()
constructor
Definition: ObserverInfo.cc:12
void setMainPurity(double val)
sets the purity
Definition: ObserverInfo.h:119
std::vector< SpacePointInfo > m_hits
stores the hits used in the filter, should have the order as used in the filter from outer to inner!
Definition: ObserverInfo.h:125
~ObserverInfo()
destructor
Definition: ObserverInfo.cc:20
ClassDef(ObserverInfo, 1)
Needed to make the ROOT object storable.
double getFilterUsed(std::string const &key)
returns if the filter was used
Definition: ObserverInfo.h:78
int getMainMCParticleID()
return the MCParticle ID of the related MCParticle
Definition: ObserverInfo.h:106
int m_mainMCParticleID
dominating mcParticleID.
Definition: ObserverInfo.h:128
std::string getFilterName(int i)
function to access the filter infos directly, as inderect access seems not to work within the Draw of...
Definition: ObserverInfo.h:54
void setHits(const std::vector< SpacePointInfo > &newHits)
sets the hits the filter has been evaluated with
Definition: ObserverInfo.h:103
bool getFilterAccepted(std::string const &key)
returns if the filter was accepted
Definition: ObserverInfo.h:70
double getFilterResult(std::string const &key)
returns the requested filter result
Definition: ObserverInfo.h:62
SpacePointInfo getHit(int i)
Returns the i-th hit.
Definition: ObserverInfo.h:94
void clear()
resets all member variables
Definition: ObserverInfo.h:32
double m_mainPurity
purity for the dominating particleID.
Definition: ObserverInfo.h:131
void addFilterInfo(FilterInfo info)
add a new filter info:
Definition: ObserverInfo.h:86
void setMainMCParticleID(int id)
set the MCParticle id
Definition: ObserverInfo.h:111
double getMainPurity()
returns the purity
Definition: ObserverInfo.h:114
std::vector< FilterInfo > m_filterInfos
stores the information for each Filter
Definition: ObserverInfo.h:122
std::vector< SpacePointInfo > getHits()
returns the vector of spacepoints which have been used to evaluate the filters
Definition: ObserverInfo.h:89
FilterInfo getFilterInfo(std::string const &key)
returns the filter info with the requested key
Definition: ObserverInfo.h:43
helper class to store the SpacePoint information as coding convention prohibits to use the SpacePoint...
Abstract base class for different kinds of events.