ATLAS Offline Software
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 
6 
8 #include <xAODJet/JetContainer.h>
9 
10 RatesEmulationExample::RatesEmulationExample( const std::string& name, ISvcLocator* pSvcLocator ) : RatesAnalysisAlg(name, pSvcLocator) {
11 }
12 
14 }
15 
17  // Read Handle Key
20  return StatusCode::SUCCESS;
21 }
22 
23 
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);
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 
52 
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 
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 
80  ATH_MSG_DEBUG("In ratesFinalize()");
81  return StatusCode::SUCCESS;
82 }
83 
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
RatesEmulationExample::initialize_extra_content
virtual StatusCode initialize_extra_content() override
Initialization of additional payload for inherited classes.
Definition: RatesEmulationExample.cxx:16
RatesEmulationExample::RatesEmulationExample
RatesEmulationExample(const std::string &name, ISvcLocator *pSvcLocator)
Definition: RatesEmulationExample.cxx:10
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
RatesEmulationExample.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
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
Jets
Definition: Jets.py:1
RatesEmulationExample::m_electron_RHKey
SG::ReadHandleKey< xAOD::ElectronContainer > m_electron_RHKey
Definition: RatesEmulationExample.h:24
RatesEmulationExample::m_lumi
Gaudi::Property< float > m_lumi
Definition: RatesEmulationExample.h:21
ElectronContainer.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
RatesEmulationExample::ratesExecute
virtual StatusCode ratesExecute() override
To be implemented by the user.
Definition: RatesEmulationExample.cxx:51
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
RatesEmulationExample::ratesInitialize
virtual StatusCode ratesInitialize() override
To be implemented by the user.
Definition: RatesEmulationExample.cxx:24
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
RatesEmulationExample::~RatesEmulationExample
virtual ~RatesEmulationExample()
Definition: RatesEmulationExample.cxx:13
RatesAnalysisAlg::setTargetLumi
void setTargetLumi(const double lumi)
Set the target instantaneous luminosity.
Definition: RatesAnalysisAlg.h:172
RatesEmulationExample::ratesFinalize
virtual StatusCode ratesFinalize() override
To be implemented by the user.
Definition: RatesEmulationExample.cxx:79
RatesEmulationExample::m_jet_RHKey
SG::ReadHandleKey< xAOD::JetContainer > m_jet_RHKey
Definition: RatesEmulationExample.h:23
JetContainer.h
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
InDetDD::electrons
@ electrons
Definition: InDetDD_Defs.h:17
RatesAnalysisAlg
virtual analysis class for performing rates studies on AOD Pure virtual base class for trigger rate s...
Definition: RatesAnalysisAlg.h:37