ATLAS Offline Software
Loading...
Searching...
No Matches
NObjectMassSelectorAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8
9namespace CP {
10
11 NObjectMassSelectorAlg::NObjectMassSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator)
12 : EL::AnaAlgorithm(name, pSvcLocator)
13 {}
14
28
30 for (const auto &sys : m_systematicsList.systematicsVector()) {
31 // retrieve the EventInfo
32 const xAOD::EventInfo *evtInfo = nullptr;
33 ANA_CHECK(m_eventInfoHandle.retrieve(evtInfo, sys));
34
35 // default-decorate EventInfo
36 m_decoration.setBool(*evtInfo, 0, sys);
37
38 // check the preselection
39 if (m_preselection && !m_preselection.getBool(*evtInfo, sys))
40 continue;
41
42 // retrieve the object container
43 const xAOD::IParticleContainer *objects = nullptr;
44 ANA_CHECK(m_objectsHandle.retrieve(objects, sys));
45
46 // apply and calculate the decision
47 int count = 0;
48 for (const xAOD::IParticle *obj : *objects){
49 if (!m_objectSelection || m_objectSelection.getBool(*obj, sys)){
50 if (obj->m() > m_minmass){
51 count++;
52 }
53 }
54 }
55
56 bool decision = SignEnum::checkValue(m_count.value(), m_signEnum, count);
57 m_decoration.setBool(*evtInfo, decision, sys);
58 }
59 return StatusCode::SUCCESS;
60 }
61} // namespace CP
#define ANA_CHECK(EXP)
check whether the given expression was successful
Gaudi::Property< int > m_count
the count of events desired
CP::SysReadSelectionHandle m_preselection
the preselection
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the event info handle
CP::SysWriteSelectionHandle m_decoration
the output selection decoration
Gaudi::Property< float > m_minmass
the pT threshold on which to select
CP::SysReadHandle< xAOD::IParticleContainer > m_objectsHandle
the object input handle
virtual StatusCode execute() override
NObjectMassSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator)
the standard constructor
Gaudi::Property< std::string > m_sign
the sign against which to compare pT (GT, LT, etc)
CP::SysListHandle m_systematicsList
the systematics list
SignEnum::ComparisonOperator m_signEnum
the operator version of the comparison (>, <, etc)
CP::SysReadSelectionHandle m_objectSelection
the object selection handle
virtual StatusCode initialize() override
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
Class providing the definition of the 4-vector interface.
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
Select isolated Photons, Electrons and Muons.
This module defines the arguments passed from the BATCH driver to the BATCH worker.
bool checkValue(T reference, ComparisonOperator sign, T test)
the comparison test given the specified sign and two test values
Definition SignEnums.h:37
static const std::map< std::string, ComparisonOperator > stringToOperator
the map between user inputs and comparison operators
Definition SignEnums.h:27
EventInfo_v1 EventInfo
Definition of the latest event info version.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.