Belle II Software  release-05-02-19
SoftwareTriggerCut.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <mdst/dbobjects/SoftwareTriggerCutBase.h>
13 #include <framework/utilities/GeneralCut.h>
14 #include <hlt/softwaretrigger/core/SoftwareTriggerVariableManager.h>
15 #include <mdst/dataobjects/SoftwareTriggerResult.h>
16 #include <stdint.h>
17 
18 namespace Belle2 {
24  namespace SoftwareTrigger {
32  class SoftwareTriggerCut : public SoftwareTriggerCutBase {
33  public:
81  static std::unique_ptr<SoftwareTriggerCut> compile(const std::string& cut_string,
82  const unsigned int prescaleFactor,
83  const bool rejectCut = false);
84 
89  std::string decompile() const
90  {
91  return m_cut->decompile();
92  }
93 
99 
105  std::pair<SoftwareTriggerCutResult, SoftwareTriggerCutResult> check(const SoftwareTriggerVariableManager::Object& prefilledObject,
106  uint32_t* counter = nullptr)
107  const;
108 
109  private:
111  std::unique_ptr<GeneralCut<SoftwareTriggerVariableManager>> m_cut = nullptr;
112 
116  SoftwareTriggerCut(std::unique_ptr<GeneralCut<SoftwareTriggerVariableManager>>&& cut,
117  unsigned int prescaleFactor,
118  const bool rejectCut) : SoftwareTriggerCutBase(prescaleFactor, rejectCut),
119  m_cut(std::move(cut))
120  {
121  }
122  };
123  }
125 }
Belle2::SoftwareTriggerCutBase::SoftwareTriggerCutBase
SoftwareTriggerCutBase(unsigned int preScaleFactor=1, const bool &isRejectCut=false)
Create a new base instance. This should rarely be called by yourself.
Definition: SoftwareTriggerCutBase.h:38
Belle2::SoftwareTrigger::SoftwareTriggerCut::checkPreScaled
SoftwareTriggerCutResult checkPreScaled(const SoftwareTriggerVariableManager::Object &prefilledObject) const
Main function of the SoftwareTriggerCut: check the cut condition.
Definition: SoftwareTriggerCut.cc:74
Belle2::SoftwareTrigger::SoftwareTriggerCut::check
std::pair< SoftwareTriggerCutResult, SoftwareTriggerCutResult > check(const SoftwareTriggerVariableManager::Object &prefilledObject, uint32_t *counter=nullptr) const
Return both the prescaled and the non-prescaled result.
Definition: SoftwareTriggerCut.cc:42
Belle2::SoftwareTrigger::SoftwareTriggerCut::decompile
std::string decompile() const
Decompile the internal General Cut back into a string.
Definition: SoftwareTriggerCut.h:97
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::SoftwareTrigger::SoftwareTriggerVariableManager::Object
SoftwareTriggerObject Object
As an object handed in for every cut to be checked, use a map of variable name -> precompiled value.
Definition: SoftwareTriggerVariableManager.h:93
Belle2::SoftwareTrigger::SoftwareTriggerCut::m_cut
std::unique_ptr< GeneralCut< SoftwareTriggerVariableManager > > m_cut
Internal representation of the cut condition as a general cut.
Definition: SoftwareTriggerCut.h:119
Belle2::SoftwareTrigger::SoftwareTriggerCut::SoftwareTriggerCut
SoftwareTriggerCut(std::unique_ptr< GeneralCut< SoftwareTriggerVariableManager >> &&cut, unsigned int prescaleFactor, const bool rejectCut)
Make constructor private.
Definition: SoftwareTriggerCut.h:124
Belle2::SoftwareTrigger::SoftwareTriggerCut::compile
static std::unique_ptr< SoftwareTriggerCut > compile(const std::string &cut_string, const unsigned int prescaleFactor, const bool rejectCut=false)
Compile a new SoftwareTriggerCut from a cut string (by using the GeneralCut::compile function) and an...
Definition: SoftwareTriggerCut.cc:31
Belle2::SoftwareTriggerCutResult
SoftwareTriggerCutResult
Enumeration with all possible results of the SoftwareTriggerCut.
Definition: SoftwareTriggerResult.h:31