Belle II Software  release-05-01-25
ObserverInfo.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Thomas Lueck *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <TObject.h>
14 
15 #include <tracking/dataobjects/SpacePointInfo.h>
16 #include <tracking/dataobjects/FilterInfo.h>
17 
18 namespace Belle2 {
26  class ObserverInfo : public TObject {
27  public:
29  ObserverInfo();
31  ~ObserverInfo();
32 
34  void clear()
35  {
36  m_filterInfos.clear();
37  m_hits.clear();
38  m_mainMCParticleID = -666;
39  m_mainPurity = 0;
40  };
41 
45  FilterInfo getFilterInfo(std::string const& key)
46  {
47  for (int i = 0; i < (int) m_filterInfos.size(); i++)
48  if (m_filterInfos.at(i).getName() == key) return m_filterInfos.at(i);
49  //if nothing was found return an empty object
50  return FilterInfo();
51  };
52 
56  std::string getFilterName(int i)
57  {
58  return (0 <= i && i < (int)m_filterInfos.size()) ? m_filterInfos[i].getName() : std::string("");
59  }
60 
64  double getFilterResult(std::string const& key)
65  {
66  return getFilterInfo(key).getResult();
67  }
68 
72  bool getFilterAccepted(std::string const& key)
73  {
74  return getFilterInfo(key).getWasAccepted();
75  }
76 
80  double getFilterUsed(std::string const& key)
81  {
82  return getFilterInfo(key).getWasUsed();
83  }
84 
88  void addFilterInfo(FilterInfo info) { m_filterInfos.push_back(info); };
89 
91  std::vector<SpacePointInfo> getHits() { return m_hits; };
92 
97  {
98  if (i < 0 || i > (int)m_hits.size()) return SpacePointInfo(); // return a dummy object
99  else return m_hits[i];
100  };
101 
105  void setHits(std::vector<SpacePointInfo>& newHits) { m_hits = newHits; };
106 
108  int getMainMCParticleID() {return m_mainMCParticleID;};
109 
113  void setMainMCParticleID(int id) { m_mainMCParticleID = id; };
114 
116  double getMainPurity() { return m_mainPurity; };
117 
121  void setMainPurity(double val) { m_mainPurity = val; };
122  private:
124  std::vector<FilterInfo> m_filterInfos;
125 
127  std::vector<SpacePointInfo> m_hits;
128 
130  int m_mainMCParticleID;
131 
133  double m_mainPurity;
134 
137  };
138 
140 }// end namespace Belle2
Belle2::ObserverInfo::setMainMCParticleID
void setMainMCParticleID(int id)
set the MCParticle id
Definition: ObserverInfo.h:121
Belle2::FilterInfo::getResult
double getResult()
returns the result of the filtervariable attached to this filter
Definition: FilterInfo.h:56
Belle2::ObserverInfo::m_mainPurity
double m_mainPurity
purity for the dominating particleID.
Definition: ObserverInfo.h:141
Belle2::FilterInfo::getWasUsed
bool getWasUsed()
returns if filter was evaluated
Definition: FilterInfo.h:60
Belle2::ObserverInfo::addFilterInfo
void addFilterInfo(FilterInfo info)
add a new filter info:
Definition: ObserverInfo.h:96
Belle2::ObserverInfo::setHits
void setHits(std::vector< SpacePointInfo > &newHits)
sets the hits the filter has been evaluated with
Definition: ObserverInfo.h:113
Belle2::FilterInfo
helper class to store the information for a Filter
Definition: FilterInfo.h:30
Belle2::ObserverInfo::getFilterResult
double getFilterResult(std::string const &key)
returns the requested filter result
Definition: ObserverInfo.h:72
Belle2::ObserverInfo::ClassDef
ClassDef(ObserverInfo, 1)
Needed to make the ROOT object storable.
Belle2::ObserverInfo::m_hits
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:135
Belle2::ObserverInfo::getFilterAccepted
bool getFilterAccepted(std::string const &key)
returns if the filter was accepted
Definition: ObserverInfo.h:80
Belle2::ObserverInfo::setMainPurity
void setMainPurity(double val)
sets the purity
Definition: ObserverInfo.h:129
Belle2::ObserverInfo::m_mainMCParticleID
int m_mainMCParticleID
dominating mcParticleID.
Definition: ObserverInfo.h:138
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ObserverInfo::getHits
std::vector< SpacePointInfo > getHits()
returns the vector of spacepoints which have been used to evaluate the filters
Definition: ObserverInfo.h:99
Belle2::ObserverInfo::ObserverInfo
ObserverInfo()
constructor
Definition: ObserverInfo.cc:5
Belle2::ObserverInfo::getFilterInfo
FilterInfo getFilterInfo(std::string const &key)
returns the filter info with the requested key
Definition: ObserverInfo.h:53
Belle2::ObserverInfo::~ObserverInfo
~ObserverInfo()
destructor
Definition: ObserverInfo.cc:13
Belle2::ObserverInfo::getFilterUsed
double getFilterUsed(std::string const &key)
returns if the filter was used
Definition: ObserverInfo.h:88
Belle2::ObserverInfo::clear
void clear()
resets all member variables
Definition: ObserverInfo.h:42
Belle2::SpacePointInfo
helper class to store the SpacePoint information as coding convention prohibits to use the SpacePoint...
Definition: SpacePointInfo.h:32
Belle2::ObserverInfo::getHit
SpacePointInfo getHit(int i)
Returns the i-th hit.
Definition: ObserverInfo.h:104
Belle2::ObserverInfo
Helper class that stores the information an Observer stores: i.e.
Definition: ObserverInfo.h:34
Belle2::ObserverInfo::m_filterInfos
std::vector< FilterInfo > m_filterInfos
stores the information for each Filter
Definition: ObserverInfo.h:129
Belle2::ObserverInfo::getMainMCParticleID
int getMainMCParticleID()
return the MCParticle ID of the related MCParticle
Definition: ObserverInfo.h:116
Belle2::ObserverInfo::getFilterName
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:64
Belle2::FilterInfo::getWasAccepted
bool getWasAccepted()
returns if the event was accepted
Definition: FilterInfo.h:58
Belle2::ObserverInfo::getMainPurity
double getMainPurity()
returns the purity
Definition: ObserverInfo.h:124