ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigCost
RatesAnalysis
src
RatesEmulationExample.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
#include "
RatesEmulationExample.h
"
6
7
#include <
xAODEgamma/ElectronContainer.h
>
8
#include <
xAODJet/JetContainer.h
>
9
10
RatesEmulationExample::RatesEmulationExample
(
const
std::string& name, ISvcLocator* pSvcLocator ) :
RatesAnalysisAlg
(name, pSvcLocator) {
11
}
12
13
RatesEmulationExample::~RatesEmulationExample
() {
14
}
15
16
StatusCode
RatesEmulationExample::initialize_extra_content
() {
17
// Read Handle Key
18
ATH_CHECK
(
m_electron_RHKey
.initialize());
19
ATH_CHECK
(
m_jet_RHKey
.initialize());
20
return
StatusCode::SUCCESS;
21
}
22
23
24
StatusCode
RatesEmulationExample::ratesInitialize
() {
25
ATH_MSG_DEBUG
(
"In ratesInitialize()"
);
26
27
// Here we assume a full-ring, other functions are available to change this assumption.
28
// @see setTargetLumiMu(const double lumi, const double mu);
29
// @see setTargetLumiBunches(const double lumi, const int32_t bunches);
30
// @see setTargetMuBunches(const double mu, const int32_t bunches);
31
setTargetLumi
(
m_lumi
);
32
33
// Define triggers to emulate
34
// TDT can be used instead by ATH_CHECK(addAllExisting());
35
36
// name, prescale, expressPrescale, seedName, seedPrescale, groups
37
ATH_CHECK
(
newTrigger
(
"OFF_e10"
, 1, -1,
""
, 1, std::set<std::string>{
"RATE_SingleElectron"
}));
38
ATH_CHECK
(
newTrigger
(
"OFF_j40c_AntiKt4EMTopo"
, 1, -1,
""
, 1, std::set<std::string>{
"RATE_SingleJet"
}));
39
40
// name, thresholdMin, thresholdMax, bins (optional)
41
ATH_CHECK
(
newScanTrigger
(
"OFF_eX"
, 20, 40));
42
43
// name, thresholdMin, thresholdMax
44
ATH_CHECK
(
newScanTrigger
(
"OFF_jXa_AntiKt4EMTopo"
, 5, 4000, 799));
45
ATH_CHECK
(
newScanTrigger
(
"OFF_jXc_AntiKt4EMTopo"
, 5, 4000, 799));
46
ATH_CHECK
(
newScanTrigger
(
"OFF_3jXc_AntiKt4EMTopo"
, 5, 1000, 499));
47
48
return
StatusCode::SUCCESS;
49
}
50
51
StatusCode
RatesEmulationExample::ratesExecute
() {
52
53
SG::ReadHandle<xAOD::ElectronContainer>
electrons(
m_electron_RHKey
);
54
ATH_CHECK
( electrons.isValid() );
55
std::set<double> electronpTs;
56
for
(
const
auto
e : *electrons) electronpTs.insert(e->pt()/1000.);
57
if
(electronpTs.size() >= 1 && *electronpTs.rbegin() >= 10.)
ATH_CHECK
(
setTriggerDesicison
(
"OFF_e10"
,
true
));
58
if
(electronpTs.size() >= 1)
ATH_CHECK
(
setTriggerDesicison
(
"OFF_eX"
, *electronpTs.rbegin() ));
59
60
61
SG::ReadHandle<xAOD::JetContainer>
Jets
(
m_jet_RHKey
);
62
ATH_CHECK
(
Jets
.isValid() );
63
64
std::set<double> jetpTs;
65
for
(
const
auto
j : *
Jets
) jetpTs.insert(j->pt()/1000.);
66
if
(jetpTs.size() >= 1)
ATH_CHECK
(
setTriggerDesicison
(
"OFF_jXa_AntiKt4EMTopo"
, *jetpTs.rbegin() ));
67
68
std::set<double> jetcpTs;
69
for
(
const
auto
jc : *
Jets
) {
70
if
(std::abs(jc->eta()) < 2.4) jetcpTs.insert(jc->pt()/1000.);
71
}
72
if
(jetcpTs.size() >= 1 && *jetcpTs.rbegin() >= 40.)
ATH_CHECK
(
setTriggerDesicison
(
"OFF_j40c_AntiKt4EMTopo"
,
true
));
73
if
(jetcpTs.size() >= 1)
ATH_CHECK
(
setTriggerDesicison
(
"OFF_jXc_AntiKt4EMTopo"
, *jetcpTs.rbegin() ));
74
if
(jetcpTs.size() >= 3)
ATH_CHECK
(
setTriggerDesicison
(
"OFF_3jXc_AntiKt4EMTopo"
, *jetcpTs.rbegin()+2 ));
75
76
return
StatusCode::SUCCESS;
77
}
78
79
StatusCode
RatesEmulationExample::ratesFinalize
() {
80
ATH_MSG_DEBUG
(
"In ratesFinalize()"
);
81
return
StatusCode::SUCCESS;
82
}
83
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ElectronContainer.h
JetContainer.h
RatesEmulationExample.h
RatesAnalysisAlg::RatesAnalysisAlg
RatesAnalysisAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
RatesAnalysisAlg.cxx:22
RatesAnalysisAlg::setTriggerDesicison
StatusCode setTriggerDesicison(const std::string &name, const bool triggerIsPassed=true, const bool triggerIsActive=true)
Set the pass/fail decision for an item.
Definition
RatesAnalysisAlg.cxx:346
RatesAnalysisAlg::setTargetLumi
void setTargetLumi(const double lumi)
Set the target instantaneous luminosity.
Definition
RatesAnalysisAlg.h:173
RatesAnalysisAlg::newTrigger
StatusCode newTrigger(const std::string &name, const double prescale=1., const double expressPrescale=-1., const std::string &seedName="", const double seedPrecale=1., const std::string &groups="", const Method_t method=kMANUAL, const ExtrapStrat_t extrapolation=kLINEAR)
Version of newTrigger which accepts a set of group names rather than a comma separated string.
Definition
RatesAnalysisAlg.cxx:89
RatesAnalysisAlg::newScanTrigger
StatusCode newScanTrigger(const std::string &name, const double thresholdMin, const double thresholdMax, const uint32_t thresholdBins=100, const RatesScanTrigger::TriggerBehaviour_t behaviour=RatesScanTrigger::TriggerBehaviour_t::kTriggerBelowThreshold, const double prescale=1., const std::string &seedName="", const double seedPrecale=1., const Method_t method=kMANUAL, const ExtrapStrat_t extrapolation=kLINEAR)
Register a new threshold scan trigger which plots rate as a function of some dependent variable.
Definition
RatesAnalysisAlg.cxx:40
RatesEmulationExample::m_lumi
Gaudi::Property< float > m_lumi
Definition
RatesEmulationExample.h:21
RatesEmulationExample::RatesEmulationExample
RatesEmulationExample(const std::string &name, ISvcLocator *pSvcLocator)
Definition
RatesEmulationExample.cxx:10
RatesEmulationExample::m_jet_RHKey
SG::ReadHandleKey< xAOD::JetContainer > m_jet_RHKey
Definition
RatesEmulationExample.h:23
RatesEmulationExample::initialize_extra_content
virtual StatusCode initialize_extra_content() override
Initialization of additional payload for inherited classes.
Definition
RatesEmulationExample.cxx:16
RatesEmulationExample::m_electron_RHKey
SG::ReadHandleKey< xAOD::ElectronContainer > m_electron_RHKey
Definition
RatesEmulationExample.h:24
RatesEmulationExample::ratesInitialize
virtual StatusCode ratesInitialize() override
To be implemented by the user.
Definition
RatesEmulationExample.cxx:24
RatesEmulationExample::ratesExecute
virtual StatusCode ratesExecute() override
To be implemented by the user.
Definition
RatesEmulationExample.cxx:51
RatesEmulationExample::~RatesEmulationExample
virtual ~RatesEmulationExample()
Definition
RatesEmulationExample.cxx:13
RatesEmulationExample::ratesFinalize
virtual StatusCode ratesFinalize() override
To be implemented by the user.
Definition
RatesEmulationExample.cxx:79
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
Jets
Definition
Jets.py:1
Generated on
for ATLAS Offline Software by
1.17.0