Belle II Software prerelease-11-00-00a
PrefilterCalculator Class Reference

Implementation of a calculator used in the SoftwareTriggerModule to fill a SoftwareTriggerObject for doing HLT prefilter cuts. More...

#include <PrefilterCalculator.h>

Inheritance diagram for PrefilterCalculator:
Collaboration diagram for PrefilterCalculator:

Public Member Functions

 PrefilterCalculator ()
 Set the default names for the store object particle lists.
 
void requireStoreArrays () override
 Require the particle list. We do not need more here.
 
void doCalculation (SoftwareTriggerObject &calculationResult) override
 Actually write out the variables into the map.
 
void writeDebugOutput (const std::unique_ptr< TTree > &debugOutputTTree)
 Function to write out debug output into the given TTree.
 
void addDebugOutput (const StoreObjPtr< SoftwareTriggerVariables > &storeObject, const std::string &prefix)
 Function to write out debug output into the given StoreObject.
 
const SoftwareTriggerObject & fillInCalculations ()
 Main function of this class: calculate the needed variables using the overwritten doCalculation function and write out the values into the results object (with their names).
 

Private Attributes

HLTPrefilter::EventsOfDoomBusterState m_eodbPrefilter
 Helper instance for EventsOfDoom prefilter.
 
HLTPrefilter::TimingCutState m_timingPrefilter
 Helper instance for timing based prefilter.
 
SoftwareTriggerObject m_calculationResult
 Internal storage of the result of the calculation.
 
bool m_debugPrepared = false
 Flag to not add the branches twice to the TTree.
 

Detailed Description

Implementation of a calculator used in the SoftwareTriggerModule to fill a SoftwareTriggerObject for doing HLT prefilter cuts.

This calculator exports variables needed for the trigger HLT prefilter part of the path ( = filtering out injection background events)

This class implements the two main functions requireStoreArrays and doCalculation of the SoftwareTriggerCalculation class.

Definition at line 25 of file PrefilterCalculator.h.

Constructor & Destructor Documentation

◆ PrefilterCalculator()

Set the default names for the store object particle lists.

Definition at line 18 of file PrefilterCalculator.cc.

19{
20}

Member Function Documentation

◆ addDebugOutput()

void addDebugOutput ( const StoreObjPtr< SoftwareTriggerVariables > & storeObject,
const std::string & prefix )
inherited

Function to write out debug output into the given StoreObject.

Needs an already prefilled calculationResult for this (probably using the fillInCalculations function). All added variables are prefixed with the given prefix string.

Definition at line 34 of file SoftwareTriggerCalculation.cc.

35 {
36 for (const auto& identifierWithValue : m_calculationResult) {
37 const std::string& identifier = identifierWithValue.first;
38 const double value = identifierWithValue.second;
39
40 storeObject->append(prefix + "_" + identifier, value);
41 }
42 }

◆ doCalculation()

void doCalculation ( SoftwareTriggerObject & calculationResult)
overridevirtual

Actually write out the variables into the map.

< Events with high SVD-CDC occupancy

< Events in the injection strip

Implements SoftwareTriggerCalculation.

Definition at line 22 of file PrefilterCalculator.cc.

23{
24 //..Filters lines for HLTPrefilter decision
25 calculationResult["EventsOfDoom"] = 0;
26 calculationResult["InjectionStrip"] = 0;
27
28 // EventsOfDoomBuster mode decision
29 if (m_eodbPrefilter.computeDecision()) {
30 calculationResult["EventsOfDoom"] = 1;
31 }
32 // Injection time mode decision
33 if (m_timingPrefilter.computeDecision()) {
34 calculationResult["InjectionStrip"] = 1;
35 }
36
37}
HLTPrefilter::EventsOfDoomBusterState m_eodbPrefilter
Helper instance for EventsOfDoom prefilter.
HLTPrefilter::TimingCutState m_timingPrefilter
Helper instance for timing based prefilter.

◆ fillInCalculations()

const SoftwareTriggerObject & fillInCalculations ( )
inherited

Main function of this class: calculate the needed variables using the overwritten doCalculation function and write out the values into the results object (with their names).

Please make sure to override (or clear) the variables! Otherwise it can happen that their old values are still in the object.

What variables exactly are added to the result depends on the implementation details of the class.

Definition at line 44 of file SoftwareTriggerCalculation.cc.

45 {
46 const unsigned int sizeBeforeCheck = m_calculationResult.size();
47 doCalculation(m_calculationResult);
48
49 if (m_calculationResult.size() != sizeBeforeCheck and sizeBeforeCheck > 0) {
50 B2WARNING("Calculator added more variables (" << m_calculationResult.size() <<
51 ") than there were before (" << sizeBeforeCheck << "). Probably something strange is going on!");
52 }
53
54 return m_calculationResult;
55 }

◆ requireStoreArrays()

void requireStoreArrays ( )
overridevirtual

Require the particle list. We do not need more here.

Implements SoftwareTriggerCalculation.

Definition at line 14 of file PrefilterCalculator.cc.

15{
16}

◆ writeDebugOutput()

void writeDebugOutput ( const std::unique_ptr< TTree > & debugOutputTTree)
inherited

Function to write out debug output into the given TTree.

Needs an already prefilled calculationResult for this (probably using the fillInCalculations function).

Definition at line 19 of file SoftwareTriggerCalculation.cc.

20 {
21 if (not m_debugPrepared) {
22 for (auto& identifierWithValue : m_calculationResult) {
23 const std::string& identifier = identifierWithValue.first;
24 double& value = identifierWithValue.second;
25
26 debugOutputTTree->Branch(identifier.c_str(), &value);
27 }
28 m_debugPrepared = true;
29 }
30
31 debugOutputTTree->Fill();
32 }

Member Data Documentation

◆ m_calculationResult

SoftwareTriggerObject m_calculationResult
privateinherited

Internal storage of the result of the calculation.

Definition at line 74 of file SoftwareTriggerCalculation.h.

◆ m_debugPrepared

bool m_debugPrepared = false
privateinherited

Flag to not add the branches twice to the TTree.

Definition at line 76 of file SoftwareTriggerCalculation.h.

◆ m_eodbPrefilter

HLTPrefilter::EventsOfDoomBusterState m_eodbPrefilter
private

Helper instance for EventsOfDoom prefilter.

Definition at line 38 of file PrefilterCalculator.h.

◆ m_timingPrefilter

HLTPrefilter::TimingCutState m_timingPrefilter
private

Helper instance for timing based prefilter.

Definition at line 40 of file PrefilterCalculator.h.


The documentation for this class was generated from the following files: