ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Generators
TruthRivetTools
Root
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
6
#include "
TruthRivetTools/HiggsTruthCategoryTool.h
"
7
8
#include <mutex>
9
10
HiggsTruthCategoryTool::HiggsTruthCategoryTool
(
const
std::string& name)
11
:
asg
::
AsgTool
( name ),
12
m_higgsTemplateCrossSections
( nullptr )
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
20
StatusCode
HiggsTruthCategoryTool::initialize
() {
21
ATH_MSG_INFO
(
"Initializing "
<< name() <<
"..."
);
22
// Rivet analysis :: Higgs truth event classifier class
23
m_higgsTemplateCrossSections
=
new
Rivet::HiggsTemplateCrossSections
();
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
27
m_rivetAnaHandler
->addAnalysis(
m_higgsTemplateCrossSections
);
28
return
StatusCode::SUCCESS;
29
}
30
31
StatusCode 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
48
HTXS::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
}
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
HiggsTruthCategoryTool.h
HiggsTruthCategoryTool::m_outHistos
bool m_outHistos
Definition
HiggsTruthCategoryTool.h:57
HiggsTruthCategoryTool::m_higgsTemplateCrossSections
Rivet::HiggsTemplateCrossSections * m_higgsTemplateCrossSections
Definition
HiggsTruthCategoryTool.h:51
HiggsTruthCategoryTool::m_rivetAnaHandler
std::unique_ptr< Rivet::AnalysisHandler > m_rivetAnaHandler
Definition
HiggsTruthCategoryTool.h:50
HiggsTruthCategoryTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition
HiggsTruthCategoryTool.cxx:20
HiggsTruthCategoryTool::HiggsTruthCategoryTool
HiggsTruthCategoryTool(const std::string &name)
Definition
HiggsTruthCategoryTool.cxx:10
Rivet::HiggsTemplateCrossSections
Rivet routine for classifying MC events according to the Higgs template cross section categories.
Definition
HiggsTemplateCrossSections.h:35
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition
AsgTool.cxx:58
HTXS::HiggsProdMode
HiggsProdMode
Higgs production modes, corresponding to input sample.
Definition
HiggsTemplateCrossSectionsDefs.h:27
HepMC::GenEvent
HepMC3::GenEvent GenEvent
Definition
GenEvent.h:39
asg
Definition
DataHandleTestTool.h:28
Generated on
for ATLAS Offline Software by
1.17.0