 |
Belle II Software
release-05-02-19
|
11 #include <hlt/softwaretrigger/modules/basics/SoftwareTriggerResultPrinterModule.h>
12 #include <hlt/softwaretrigger/core/FinalTriggerDecisionCalculator.h>
13 #include <mdst/dbobjects/DBRepresentationOfSoftwareTriggerCut.h>
14 #include <framework/database/DBObjPtr.h>
19 #include <boost/algorithm/string/replace.hpp>
24 using namespace SoftwareTrigger;
32 setDescription(
"Write out the software trigger results in an easily accessible summary table to disk.");
34 addParam(
"outputFileName", m_param_outputFileName,
"File path and name of the ROOT "
35 "file, in which the results of the calculation are stored. Please note that already present files will be overridden. ",
36 m_param_outputFileName);
49 if (not debugOutputFile) {
50 B2FATAL(
"Could not open debug output file. Aborting.");
52 auto debugTTree = std::make_unique<TTree>(
"software_trigger_results",
"software_trigger_results");
54 B2FATAL(
"Could not create debug output tree. Aborting.");
61 debugTTree->Branch(
"cut", &cut);
62 debugTTree->Branch(
"prescaled", &prescaled);
63 debugTTree->Branch(
"accept_or_reject", &accepted);
70 unsigned int counter = 0;
72 std::string cutName = cutResult.first;
73 boost::replace_all(cutName,
"&",
"_");
74 debugTTree->Branch(cutName.c_str(), &value.at(counter));
102 const auto& cutName = cutResult.first;
104 value[counter] = NAN;
120 const auto& cutName = cutResult.first;
122 value[counter] = NAN;
138 const auto& cutName = cutResult.first;
140 value[counter] = NAN;
142 value[counter] =
static_cast<double>(
m_prescales[cutName]);
148 debugOutputFile->cd();
149 debugOutputFile->Write();
151 debugOutputFile.reset();
162 if (cutName.find(
"total_result") == std::string::npos) {
167 m_prescales[cutName] = downloadedCut->getPreScaleFactor();
188 B2WARNING(
"Uncaught exception encountered: Trying to access StoreObjPtr object 'TRGSummary' (durability: event), which was not created in exp/run/evt: "
void initialize() override
Require the needed store object.
std::map< std::string, std::map< SoftwareTriggerCutResult, unsigned int > > m_passedEventsPerTriggerNonPrescaled
Internal map of summed results.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Write out the software trigger results in an easily accessible summary table.
static bool getFinalTriggerDecision(const SoftwareTriggerResult &result, bool forgetTotalResult=false)
Calculate the final cut decision using all "total_results" of all sub triggers in the software trigge...
@ c_accept
Accept this event.
Class for accessing objects in the database.
std::string m_param_outputFileName
Output file name for the debug output.
void terminate() override
Store and delete the ttree if it was created. Print out the summed results.
StoreObjPtr< SoftwareTriggerResult > m_resultStoreObjectPointer
Store Object for reading the trigger decision.
Abstract base class for different kinds of events.
Class to store variables with their name which were sent to the logging service.
@ c_reject
Reject this event.
void event() override
Write out the cuts if wanted and sum them up.
std::map< std::string, std::map< SoftwareTriggerCutResult, unsigned int > > m_passedEventsPerTrigger
Internal map of summed results.
StoreObjPtr< TRGSummary > m_l1Result
Store Object for reading the l1 result.
std::map< std::string, unsigned int > m_prescales
Internal map of prescales.
StoreObjPtr< EventMetaData > m_eventMetaDataPtr
EventMetaData is used by processEvent()/processCore().
unsigned int m_numberOfEvents
Internal counter for the number of seen events.
SoftwareTriggerCutResult
Enumeration with all possible results of the SoftwareTriggerCut.