Belle II Software  release-05-02-19
SoftwareTriggerCalculation.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 <hlt/softwaretrigger/core/SoftwareTriggerObject.h>
13 #include <hlt/softwaretrigger/dataobjects/SoftwareTriggerVariables.h>
14 #include <framework/datastore/StoreObjPtr.h>
15 #include <TTree.h>
16 
17 namespace Belle2 {
22  namespace SoftwareTrigger {
31  class SoftwareTriggerCalculation {
32  public:
38  virtual void requireStoreArrays() = 0;
39 
45  void writeDebugOutput(const std::unique_ptr<TTree>& debugOutputTTree);
46 
53  void addDebugOutput(const StoreObjPtr<SoftwareTriggerVariables>& storeObject, const std::string& prefix);
54 
66  const SoftwareTriggerObject& fillInCalculations();
67 
69  virtual void doCalculation(SoftwareTriggerObject& m_calculationResult) = 0;
70 
72  virtual ~SoftwareTriggerCalculation() = default;
73 
74  private:
76  SoftwareTriggerObject m_calculationResult;
78  bool m_debugPrepared = false;
79  };
80  }
82 }
Belle2::SoftwareTrigger::SoftwareTriggerCalculation::addDebugOutput
void addDebugOutput(const StoreObjPtr< SoftwareTriggerVariables > &storeObject, const std::string &prefix)
Function to write out debug output into the given StoreObject.
Definition: SoftwareTriggerCalculation.cc:44
Belle2::SoftwareTrigger::SoftwareTriggerCalculation::~SoftwareTriggerCalculation
virtual ~SoftwareTriggerCalculation()=default
Default but virtual desctructor.
Belle2::SoftwareTrigger::SoftwareTriggerCalculation::m_debugPrepared
bool m_debugPrepared
Flag to not add the branches twice to the TTree.
Definition: SoftwareTriggerCalculation.h:86
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::StoreObjPtr
Type-safe access to single objects in the data store.
Definition: ParticleList.h:33
Belle2::SoftwareTrigger::SoftwareTriggerCalculation::doCalculation
virtual void doCalculation(SoftwareTriggerObject &m_calculationResult)=0
Override this function to implement your calculation.
Belle2::SoftwareTrigger::SoftwareTriggerCalculation::m_calculationResult
SoftwareTriggerObject m_calculationResult
Internal storage of the result of the calculation.
Definition: SoftwareTriggerCalculation.h:84
Belle2::SoftwareTrigger::SoftwareTriggerCalculation::requireStoreArrays
virtual void requireStoreArrays()=0
Function to be called in the initialize phase of the module, in which all later needed StoreArrays ca...
Belle2::SoftwareTrigger::SoftwareTriggerCalculation::fillInCalculations
const SoftwareTriggerObject & fillInCalculations()
Main function of this class: calculate the needed variables using the overwritten doCalculation funct...
Definition: SoftwareTriggerCalculation.cc:54
Belle2::SoftwareTrigger::SoftwareTriggerCalculation::writeDebugOutput
void writeDebugOutput(const std::unique_ptr< TTree > &debugOutputTTree)
Function to write out debug output into the given TTree.
Definition: SoftwareTriggerCalculation.cc:29