ATLAS Offline Software
Loading...
Searching...
No Matches
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
9
10RatesEmulationExample::RatesEmulationExample( const std::string& name, ISvcLocator* pSvcLocator ) : RatesAnalysisAlg(name, pSvcLocator) {
11}
12
15
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
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
RatesAnalysisAlg(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode setTriggerDesicison(const std::string &name, const bool triggerIsPassed=true, const bool triggerIsActive=true)
Set the pass/fail decision for an item.
void setTargetLumi(const double lumi)
Set the target instantaneous luminosity.
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.
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.
Gaudi::Property< float > m_lumi
RatesEmulationExample(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadHandleKey< xAOD::JetContainer > m_jet_RHKey
virtual StatusCode initialize_extra_content() override
Initialization of additional payload for inherited classes.
SG::ReadHandleKey< xAOD::ElectronContainer > m_electron_RHKey
virtual StatusCode ratesInitialize() override
To be implemented by the user.
virtual StatusCode ratesExecute() override
To be implemented by the user.
virtual StatusCode ratesFinalize() override
To be implemented by the user.
Definition Jets.py:1