ATLAS Offline Software
RatesEmulationExample.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
8 
9 RatesEmulationExample::RatesEmulationExample( const std::string& name, ISvcLocator* pSvcLocator ) : RatesAnalysisAlg(name, pSvcLocator) {
10 }
11 
13 }
14 
16  ATH_MSG_DEBUG("In ratesInitialize()");
17 
18  // Here we assume a full-ring, other functions are available to change this assumption.
19  // @see setTargetLumiMu(const double lumi, const double mu);
20  // @see setTargetLumiBunches(const double lumi, const int32_t bunches);
21  // @see setTargetMuBunches(const double mu, const int32_t bunches);
23 
24  // Define triggers to emulate
25  // TDT can be used instead by ATH_CHECK(addAllExisting());
26 
27  // name, prescale, expressPrescale, seedName, seedPrescale, groups
28  std::set<std::string> triggerGroup {"RATE_SingleElectron"};
29  ATH_CHECK(newTrigger("OFF_E10", 1, -1, "", 1, triggerGroup));
30 
31  // name, thresholdMin, thresholdMax
32  ATH_CHECK(newScanTrigger("OFF_Ex", 20, 40));
33 
34  return StatusCode::SUCCESS;
35 }
36 
38 
39  // Set decisions for kManual triggers
40  const xAOD::ElectronContainer* electrons {nullptr};
41  ATH_CHECK( evtStore()->retrieve(electrons, "Electrons") );
42  std::set<double> electronpTs;
43  for (const auto& e : *electrons) electronpTs.insert(e->pt()/1000.);
44  if (electronpTs.size() >= 1 && *electronpTs.rbegin() >= 10.) ATH_CHECK(setTriggerDesicison("OFF_E10", true ));
45  if (electronpTs.size() >= 1) ATH_CHECK(setTriggerDesicison("OFF_Ex", *electronpTs.rbegin() ));
46 
47  return StatusCode::SUCCESS;
48 }
49 
51  ATH_MSG_DEBUG("In ratesFinalize()");
52  return StatusCode::SUCCESS;
53 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
RatesEmulationExample::RatesEmulationExample
RatesEmulationExample(const std::string &name, ISvcLocator *pSvcLocator)
Definition: RatesEmulationExample.cxx:9
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:88
RatesEmulationExample.h
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:39
RatesEmulationExample::m_lumi
Gaudi::Property< float > m_lumi
Definition: RatesEmulationExample.h:21
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
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:37
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
RatesEmulationExample::ratesInitialize
virtual StatusCode ratesInitialize() override
To be implemented by the user.
Definition: RatesEmulationExample.cxx:15
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
RatesEmulationExample::~RatesEmulationExample
virtual ~RatesEmulationExample()
Definition: RatesEmulationExample.cxx:12
RatesAnalysisAlg::setTargetLumi
void setTargetLumi(const double lumi)
Set the target instantaneous luminosity.
Definition: RatesAnalysisAlg.h:174
RatesEmulationExample::ratesFinalize
virtual StatusCode ratesFinalize() override
To be implemented by the user.
Definition: RatesEmulationExample.cxx:50
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
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:342
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