Skip to content
Snippets Groups Projects
Verified Commit 48c08500 authored by Tadej Novak's avatar Tadej Novak
Browse files

Add CP::EventStatusSelectionAlg

parent c2189b67
No related branches found
No related tags found
4 merge requests!76035Updated rel21 number,!63304adding missing electron iso WPs (Tight_VarRad, Loose_VarRad, TightTrackOnly_VarRad),!61521fix maxPVrefit,!60724Add CP::EventStatusSelectionAlg
Showing with 126 additions and 6 deletions
/* /*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
*/ */
/// @author Nils Krumnack /// @author Nils Krumnack
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <AsgAnalysisAlgorithms/AsgViewFromSelectionAlg.h> #include <AsgAnalysisAlgorithms/AsgViewFromSelectionAlg.h>
#include <AsgAnalysisAlgorithms/AsgxAODNTupleMakerAlg.h> #include <AsgAnalysisAlgorithms/AsgxAODNTupleMakerAlg.h>
#include <AsgAnalysisAlgorithms/EventFlagSelectionAlg.h> #include <AsgAnalysisAlgorithms/EventFlagSelectionAlg.h>
#include <AsgAnalysisAlgorithms/EventStatusSelectionAlg.h>
#include <AsgAnalysisAlgorithms/EventSelectionByObjectFlagAlg.h> #include <AsgAnalysisAlgorithms/EventSelectionByObjectFlagAlg.h>
#include <AsgAnalysisAlgorithms/IsolationCloseByCorrectionAlg.h> #include <AsgAnalysisAlgorithms/IsolationCloseByCorrectionAlg.h>
#include <AsgAnalysisAlgorithms/KinematicHistAlg.h> #include <AsgAnalysisAlgorithms/KinematicHistAlg.h>
......
/*
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
*/
/// @author Tadej Novak
#ifndef ASG_ANALYSIS_ALGORITHMS__EVENT_STATUS_SELECTION_ALG_H
#define ASG_ANALYSIS_ALGORITHMS__EVENT_STATUS_SELECTION_ALG_H
#include <AnaAlgorithm/AnaAlgorithm.h>
#include <AnaAlgorithm/FilterReporterParams.h>
namespace CP
{
/// \brief an algorithm for selecting events based on their error status
class EventStatusSelectionAlg final : public EL::AnaAlgorithm
{
public:
EventStatusSelectionAlg(const std::string &name,
ISvcLocator *svcLoc = nullptr);
virtual StatusCode initialize() final;
virtual StatusCode execute() final;
virtual StatusCode finalize() final;
private:
/// \brief the filter reporter parameters
EL::FilterReporterParams m_filterParams {this, "event error state selection"};
};
}
#endif
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<class name="CP::AsgViewFromSelectionAlg" /> <class name="CP::AsgViewFromSelectionAlg" />
<class name="CP::AsgxAODNTupleMakerAlg" /> <class name="CP::AsgxAODNTupleMakerAlg" />
<class name="CP::EventFlagSelectionAlg" /> <class name="CP::EventFlagSelectionAlg" />
<class name="CP::EventStatusSelectionAlg" />
<class name="CP::EventSelectionByObjectFlagAlg" /> <class name="CP::EventSelectionByObjectFlagAlg" />
<class name="CP::IsolationCloseByCorrectionAlg" /> <class name="CP::IsolationCloseByCorrectionAlg" />
<class name="CP::KinematicHistAlg" /> <class name="CP::KinematicHistAlg" />
......
/*
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
*/
/// @author Tadej Novak
#include "AnaAlgorithm/FilterReporter.h"
#include <AsgAnalysisAlgorithms/EventStatusSelectionAlg.h>
#include <xAODEventInfo/EventInfo.h>
CP::EventStatusSelectionAlg::EventStatusSelectionAlg(const std::string &name,
ISvcLocator *svcLoc)
: EL::AnaAlgorithm(name, svcLoc)
{
}
StatusCode CP::EventStatusSelectionAlg::initialize()
{
ANA_CHECK(m_filterParams.initialize());
return StatusCode::SUCCESS;
}
StatusCode CP::EventStatusSelectionAlg::execute()
{
EL::FilterReporter filter (m_filterParams, false);
const xAOD::EventInfo *eventInfo = 0;
ANA_CHECK(evtStore()->retrieve(eventInfo, "EventInfo"));
// Reject bad events due to problems in Tile calorimeter
if (eventInfo->errorState(xAOD::EventInfo::Tile) == xAOD::EventInfo::Error)
{
ATH_MSG_VERBOSE("Rejecting event due to problems in Tile calorimeter");
filter.setPassed(false);
return StatusCode::SUCCESS;
}
// Reject bad events due to problems in LAr calorimeter
if (eventInfo->errorState(xAOD::EventInfo::LAr) == xAOD::EventInfo::Error)
{
ATH_MSG_VERBOSE("Rejecting event due to problems in LAr calorimeter");
filter.setPassed(false);
return StatusCode::SUCCESS;
}
// Reject bad events due to problems in SCT
if (eventInfo->errorState(xAOD::EventInfo::SCT) == xAOD::EventInfo::Error)
{
ATH_MSG_VERBOSE("Rejecting event due to problems in SCT");
filter.setPassed(false);
return StatusCode::SUCCESS;
}
// Reject incomplete events
if (eventInfo->isEventFlagBitSet(xAOD::EventInfo::Core, 18))
{
ATH_MSG_VERBOSE("Rejecting incomplete events");
filter.setPassed(false);
return StatusCode::SUCCESS;
}
ATH_MSG_VERBOSE("Event passed all status checks.");
filter.setPassed(true);
return StatusCode::SUCCESS;
}
StatusCode CP::EventStatusSelectionAlg::finalize()
{
ANA_CHECK (m_filterParams.finalize());
return StatusCode::SUCCESS;
}
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
# AnaAlgorithm import(s): # AnaAlgorithm import(s):
from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock
...@@ -33,7 +33,12 @@ class EventCleaningBlock (ConfigBlock): ...@@ -33,7 +33,12 @@ class EventCleaningBlock (ConfigBlock):
# Set up the event cleaning selection: # Set up the event cleaning selection:
if self.runEventCleaning: if self.runEventCleaning:
alg = config.createAlgorithm( 'CP::EventFlagSelectionAlg', 'EventFlagSelectorAlg' ) if config.dataType() == 'data':
alg = config.createAlgorithm( 'CP::EventStatusSelectionAlg', 'EventStatusSelectionAlg' )
alg.FilterKey = 'EventErrorState'
alg.FilterDescription = 'selecting events without any error state set'
alg = config.createAlgorithm( 'CP::EventFlagSelectionAlg', 'EventFlagSelectionAlg' )
alg.FilterKey = 'JetCleaning' alg.FilterKey = 'JetCleaning'
alg.FilterDescription = 'selecting events passing DFCommonJets_eventClean_LooseBad' alg.FilterDescription = 'selecting events passing DFCommonJets_eventClean_LooseBad'
alg.selectionFlags = ['DFCommonJets_eventClean_LooseBad,as_char'] alg.selectionFlags = ['DFCommonJets_eventClean_LooseBad,as_char']
......
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
# #
# @author Tadej Novak # @author Tadej Novak
...@@ -47,7 +47,12 @@ def makeEventSelectionAnalysisSequence( dataType, ...@@ -47,7 +47,12 @@ def makeEventSelectionAnalysisSequence( dataType,
# Set up the event cleaning selection: # Set up the event cleaning selection:
if runEventCleaning: if runEventCleaning:
alg = createAlgorithm( 'CP::EventFlagSelectionAlg', 'EventFlagSelectorAlg' ) if dataType == 'data':
alg = createAlgorithm( 'CP::EventStatusSelectionAlg', 'EventStatusSelectionAlg' )
seq.append( alg, inputPropName = None )
alg = createAlgorithm( 'CP::EventFlagSelectionAlg', 'EventFlagSelectionAlg' )
alg.selectionFlags = ['DFCommonJets_eventClean_LooseBad,as_char'] alg.selectionFlags = ['DFCommonJets_eventClean_LooseBad,as_char']
seq.append( alg, inputPropName = None ) seq.append( alg, inputPropName = None )
......
/* /*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
*/ */
/// @author Nils Krumnack /// @author Nils Krumnack
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <AsgAnalysisAlgorithms/AsgViewFromSelectionAlg.h> #include <AsgAnalysisAlgorithms/AsgViewFromSelectionAlg.h>
#include <AsgAnalysisAlgorithms/AsgxAODNTupleMakerAlg.h> #include <AsgAnalysisAlgorithms/AsgxAODNTupleMakerAlg.h>
#include <AsgAnalysisAlgorithms/EventFlagSelectionAlg.h> #include <AsgAnalysisAlgorithms/EventFlagSelectionAlg.h>
#include <AsgAnalysisAlgorithms/EventStatusSelectionAlg.h>
#include <AsgAnalysisAlgorithms/EventSelectionByObjectFlagAlg.h> #include <AsgAnalysisAlgorithms/EventSelectionByObjectFlagAlg.h>
#include <AsgAnalysisAlgorithms/IsolationCloseByCorrectionAlg.h> #include <AsgAnalysisAlgorithms/IsolationCloseByCorrectionAlg.h>
#include <AsgAnalysisAlgorithms/KinematicHistAlg.h> #include <AsgAnalysisAlgorithms/KinematicHistAlg.h>
...@@ -49,6 +50,7 @@ DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, AsgUnionSelectionAlg) ...@@ -49,6 +50,7 @@ DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, AsgUnionSelectionAlg)
DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, AsgViewFromSelectionAlg) DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, AsgViewFromSelectionAlg)
DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, AsgxAODNTupleMakerAlg) DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, AsgxAODNTupleMakerAlg)
DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, EventFlagSelectionAlg) DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, EventFlagSelectionAlg)
DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, EventStatusSelectionAlg)
DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, EventSelectionByObjectFlagAlg) DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, EventSelectionByObjectFlagAlg)
DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, IsolationCloseByCorrectionAlg) DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, IsolationCloseByCorrectionAlg)
DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, KinematicHistAlg) DECLARE_NAMESPACE_ALGORITHM_FACTORY (CP, KinematicHistAlg)
...@@ -77,6 +79,7 @@ DECLARE_FACTORY_ENTRIES(AsgAnalysisAlgorithms) { ...@@ -77,6 +79,7 @@ DECLARE_FACTORY_ENTRIES(AsgAnalysisAlgorithms) {
DECLARE_NAMESPACE_ALGORITHM (CP, AsgViewFromSelectionAlg) DECLARE_NAMESPACE_ALGORITHM (CP, AsgViewFromSelectionAlg)
DECLARE_NAMESPACE_ALGORITHM (CP, AsgxAODNTupleMakerAlg) DECLARE_NAMESPACE_ALGORITHM (CP, AsgxAODNTupleMakerAlg)
DECLARE_NAMESPACE_ALGORITHM (CP, EventFlagSelectionAlg) DECLARE_NAMESPACE_ALGORITHM (CP, EventFlagSelectionAlg)
DECLARE_NAMESPACE_ALGORITHM (CP, EventStatusSelectionAlg)
DECLARE_NAMESPACE_ALGORITHM (CP, EventSelectionByObjectFlagAlg) DECLARE_NAMESPACE_ALGORITHM (CP, EventSelectionByObjectFlagAlg)
DECLARE_NAMESPACE_ALGORITHM (CP, IsolationCloseByCorrectionAlg) DECLARE_NAMESPACE_ALGORITHM (CP, IsolationCloseByCorrectionAlg)
DECLARE_NAMESPACE_ALGORITHM (CP, KinematicHistAlg) DECLARE_NAMESPACE_ALGORITHM (CP, KinematicHistAlg)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment