Belle II Software  release-05-02-19
SoftwareTriggerResultPrinterModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2019 - 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 <framework/core/Module.h>
13 
14 #include <mdst/dataobjects/SoftwareTriggerResult.h>
15 #include <mdst/dataobjects/TRGSummary.h>
16 #include <framework/datastore/StoreObjPtr.h>
17 #include <framework/dataobjects/EventMetaData.h>
18 
19 #include <string>
20 #include <memory>
21 
22 class TFile;
23 class TTree;
24 
25 namespace Belle2 {
30  namespace SoftwareTrigger {
35  public:
38 
40  virtual ~SoftwareTriggerResultPrinterModule() = default;
41 
43  void initialize() override;
44 
46  void event() override;
47 
49  void terminate() override;
50 
51  private:
53  std::string m_param_outputFileName = "software_trigger_results.root";
54 
62  std::unique_ptr<TFile> m_debugOutputFile;
64  std::unique_ptr<TTree> m_debugTTree;
66  std::map<std::string, std::map<SoftwareTriggerCutResult, unsigned int>> m_passedEventsPerTrigger;
68  std::map<std::string, std::map<SoftwareTriggerCutResult, unsigned int>> m_passedEventsPerTriggerNonPrescaled;
70  std::map<std::string, unsigned int> m_prescales;
72  unsigned int m_numberOfEvents = 0;
73  };
74  }
76 }
Belle2::SoftwareTrigger::SoftwareTriggerResultPrinterModule::initialize
void initialize() override
Require the needed store object.
Definition: SoftwareTriggerResultPrinterModule.cc:39
Belle2::SoftwareTrigger::SoftwareTriggerResultPrinterModule::m_passedEventsPerTriggerNonPrescaled
std::map< std::string, std::map< SoftwareTriggerCutResult, unsigned int > > m_passedEventsPerTriggerNonPrescaled
Internal map of summed results.
Definition: SoftwareTriggerResultPrinterModule.h:68
Belle2::SoftwareTrigger::SoftwareTriggerResultPrinterModule
Write out the software trigger results in an easily accessible summary table.
Definition: SoftwareTriggerResultPrinterModule.h:34
Belle2::SoftwareTrigger::SoftwareTriggerResultPrinterModule::SoftwareTriggerResultPrinterModule
SoftwareTriggerResultPrinterModule()
Create a new module instance and set the parameters.
Definition: SoftwareTriggerResultPrinterModule.cc:29
Belle2::SoftwareTrigger::SoftwareTriggerResultPrinterModule::m_debugTTree
std::unique_ptr< TTree > m_debugTTree
TTree to store the debug output.
Definition: SoftwareTriggerResultPrinterModule.h:64
Belle2::SoftwareTrigger::SoftwareTriggerResultPrinterModule::m_param_outputFileName
std::string m_param_outputFileName
Output file name for the debug output.
Definition: SoftwareTriggerResultPrinterModule.h:53
Belle2::SoftwareTrigger::SoftwareTriggerResultPrinterModule::terminate
void terminate() override
Store and delete the ttree if it was created. Print out the summed results.
Definition: SoftwareTriggerResultPrinterModule.cc:45
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::SoftwareTrigger::SoftwareTriggerResultPrinterModule::m_resultStoreObjectPointer
StoreObjPtr< SoftwareTriggerResult > m_resultStoreObjectPointer
Store Object for reading the trigger decision.
Definition: SoftwareTriggerResultPrinterModule.h:56
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::SoftwareTriggerResultPrinterModule::~SoftwareTriggerResultPrinterModule
virtual ~SoftwareTriggerResultPrinterModule()=default
default virtual constructor because this is a derived class using virtual methods
Belle2::SoftwareTrigger::SoftwareTriggerResultPrinterModule::event
void event() override
Write out the cuts if wanted and sum them up.
Definition: SoftwareTriggerResultPrinterModule.cc:154
Belle2::SoftwareTrigger::SoftwareTriggerResultPrinterModule::m_passedEventsPerTrigger
std::map< std::string, std::map< SoftwareTriggerCutResult, unsigned int > > m_passedEventsPerTrigger
Internal map of summed results.
Definition: SoftwareTriggerResultPrinterModule.h:66
Belle2::SoftwareTrigger::SoftwareTriggerResultPrinterModule::m_l1Result
StoreObjPtr< TRGSummary > m_l1Result
Store Object for reading the l1 result.
Definition: SoftwareTriggerResultPrinterModule.h:58
Belle2::SoftwareTrigger::SoftwareTriggerResultPrinterModule::m_prescales
std::map< std::string, unsigned int > m_prescales
Internal map of prescales.
Definition: SoftwareTriggerResultPrinterModule.h:70
Belle2::SoftwareTrigger::SoftwareTriggerResultPrinterModule::m_debugOutputFile
std::unique_ptr< TFile > m_debugOutputFile
TFile to store the debug TTree.
Definition: SoftwareTriggerResultPrinterModule.h:62
Belle2::SoftwareTrigger::SoftwareTriggerResultPrinterModule::m_eventMetaDataPtr
StoreObjPtr< EventMetaData > m_eventMetaDataPtr
EventMetaData is used by processEvent()/processCore().
Definition: SoftwareTriggerResultPrinterModule.h:60
Belle2::SoftwareTrigger::SoftwareTriggerResultPrinterModule::m_numberOfEvents
unsigned int m_numberOfEvents
Internal counter for the number of seen events.
Definition: SoftwareTriggerResultPrinterModule.h:72