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_mainPurity = 0;
37 m_mainMCParticleID = -666;
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
ObserverInfo()
constructor
void setMainPurity(double val)
sets the purity
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!
~ObserverInfo()
destructor
ClassDef(ObserverInfo, 2)
Needed to make the ROOT object storable.
double getFilterUsed(std::string const &key)
returns if the filter was used
int getMainMCParticleID()
return the MCParticle ID of the related MCParticle
int m_mainMCParticleID
dominating mcParticleID.
std::string getFilterName(int i)
function to access the filter infos directly, as indirect access seems not to work within the Draw of...
void setHits(const std::vector< SpacePointInfo > &newHits)
sets the hits the filter has been evaluated with
bool getFilterAccepted(std::string const &key)
returns if the filter was accepted
double getFilterResult(std::string const &key)
returns the requested filter result
SpacePointInfo getHit(int i)
Returns the i-th hit.
void clear()
resets all member variables
double m_mainPurity
purity for the dominating particleID.
void addFilterInfo(FilterInfo info)
add a new filter info:
void setMainMCParticleID(int id)
set the MCParticle id
double getMainPurity()
returns the purity
std::vector< FilterInfo > m_filterInfos
stores the information for each Filter
std::vector< SpacePointInfo > getHits()
returns the vector of spacepoints which have been used to evaluate the filters
FilterInfo getFilterInfo(std::string const &key)
returns the filter info with the requested key
helper class to store the SpacePoint information as coding convention prohibits to use the SpacePoint...
Abstract base class for different kinds of events.