Belle II Software  release-08-01-10
SoftwareTriggerCut.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 #pragma once
9 
10 #include <mdst/dbobjects/SoftwareTriggerCutBase.h>
11 #include <framework/utilities/GeneralCut.h>
12 #include <hlt/softwaretrigger/core/SoftwareTriggerVariableManager.h>
13 #include <mdst/dataobjects/SoftwareTriggerResult.h>
14 #include <stdint.h>
15 
16 namespace Belle2 {
22  namespace SoftwareTrigger {
31  public:
79  static std::unique_ptr<SoftwareTriggerCut> compile(const std::string& cut_string,
80  const unsigned int prescaleFactor,
81  const bool rejectCut = false);
82 
87  std::string decompile() const
88  {
89  return m_cut->decompile();
90  }
91 
97 
103  std::pair<SoftwareTriggerCutResult, SoftwareTriggerCutResult> check(const SoftwareTriggerVariableManager::Object& prefilledObject,
104  uint32_t* counter = nullptr)
105  const;
106 
107  private:
109  std::unique_ptr<GeneralCut<SoftwareTriggerVariableManager>> m_cut = nullptr;
110 
115  unsigned int prescaleFactor,
116  const bool rejectCut) : SoftwareTriggerCutBase(prescaleFactor, rejectCut),
117  m_cut(std::move(cut))
118  {
119  }
120  };
121  }
123 }
This class implements a common way to implement cut/selection functionality for arbitrary objects.
Definition: GeneralCut.h:71
Base class for the SoftwareTriggerCut and its DBRepresentation.
Software Trigger Cut to be used in the Software Trigger Modules.
SoftwareTriggerCutResult checkPreScaled(const SoftwareTriggerVariableManager::Object &prefilledObject) const
Main function of the SoftwareTriggerCut: check the cut condition.
std::unique_ptr< GeneralCut< SoftwareTriggerVariableManager > > m_cut
Internal representation of the cut condition as a general cut.
SoftwareTriggerCut(std::unique_ptr< GeneralCut< SoftwareTriggerVariableManager >> &&cut, unsigned int prescaleFactor, const bool rejectCut)
Make constructor private.
std::pair< SoftwareTriggerCutResult, SoftwareTriggerCutResult > check(const SoftwareTriggerVariableManager::Object &prefilledObject, uint32_t *counter=nullptr) const
Return both the prescaled and the non-prescaled result.
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...
std::string decompile() const
Decompile the internal General Cut back into a string.
SoftwareTriggerObject Object
As an object handed in for every cut to be checked, use a map of variable name -> precompiled value.
SoftwareTriggerCutResult
Enumeration with all possible results of the SoftwareTriggerCut.
Abstract base class for different kinds of events.