ATLAS Offline Software
Loading...
Searching...
No Matches
HiggsTruthCategoryTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5// TruthRivetTools includes
7
8#include <mutex>
9
11: asg::AsgTool( name ),
13{
14 // cannot be set to true until the issue with the beam protons in the truth event record is fixed..
15 // see JIRA ticket: https://its.cern.ch/jira/browse/ATLASRECTS-3072?filter=-2
16 m_outHistos = false;
17}
18
19
21 ATH_MSG_INFO ("Initializing " << name() << "...");
22 // Rivet analysis :: Higgs truth event classifier class
24 // create an instance of the Rivet analysis handler
25 m_rivetAnaHandler = std::make_unique<Rivet::AnalysisHandler>();
26 // Add the Higgs truth classifier class to the handler
28 return StatusCode::SUCCESS;
29}
30
31StatusCode HiggsTruthCategoryTool :: finalize () {
32 ATH_MSG_INFO (" ====================================================== ");
33 ATH_MSG_INFO (" ---- Finalizing" << name() << "...");
34 ATH_MSG_INFO (" ====================================================== ");
35 if ( !m_outHistos ){
36 //this seems to thrown an exception
37 //higgsTemplateCrossSections->printClassificationSummary( );
38 }
39 else{
40 // TODO:: update the tool properly deal with output files/paths
41 m_rivetAnaHandler->finalize();
42 m_rivetAnaHandler->writeData("HiggsTruthCategoryTool.yoda");
43 }
44 ATH_MSG_INFO (" ====================================================== ");
45 return StatusCode::SUCCESS;
46}
47
48HTXS::HiggsClassification* HiggsTruthCategoryTool :: getHiggsTruthCategoryObject (const HepMC::GenEvent& HepMCEvent, const HTXS::HiggsProdMode prodMode) const {
49 if ( !m_isInitialized.test_and_set() ) {
50 [&]() {
51 m_higgsTemplateCrossSections->setHiggsProdMode(prodMode);
52 m_rivetAnaHandler->init(HepMCEvent);
53 }();
54 }
55 // fill histos if flag is specified
56 // if ( m_outHistos ) rivetAnaHandler->analyze(HepMCEvent);
57
58 // get the category output object containing the template cross section category,
59 // and Higgs, V-boson, jets 4-vectors
60 const Rivet::HiggsClassification htxs_cat_rivet = m_higgsTemplateCrossSections->classifyEvent(const_cast<HepMC::GenEvent&>(HepMCEvent),prodMode);
61 return HTXS::Rivet2Root(htxs_cat_rivet);
62}
#define ATH_MSG_INFO(x)
Rivet::HiggsTemplateCrossSections * m_higgsTemplateCrossSections
std::unique_ptr< Rivet::AnalysisHandler > m_rivetAnaHandler
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
HiggsTruthCategoryTool(const std::string &name)
Rivet routine for classifying MC events according to the Higgs template cross section categories.
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
HiggsProdMode
Higgs production modes, corresponding to input sample.