Skip to content
Snippets Groups Projects
Commit 029f694f authored by James Catmore's avatar James Catmore Committed by Graeme Stewart
Browse files

Adding prescale tool (DerivationFrameworkTools-00-00-22)

	* Adding prescale tool
	* Tagging as DerivationFrameworkTools-00-00-22

2015-05-26 James Catmore <james.catmore@cern.ch>

	* Fixing bug in trigger selector tool
	* Tagging as DerivationFrameworkTools-00-00-21

2015-05-17 James Catmore <james.catmore@cern.ch>

	* Adding first version of trigger selector tool (backup for weird
	trigger names with dots and dashes)
	* No tag yet
parent 9df8839c
No related branches found
No related tags found
No related merge requests found
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// PrescaleTool.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef DERIVATIONFRAMEWORK_PRESCALETOOL_H
#define DERIVATIONFRAMEWORK_PRESCALETOOL_H
#include <string>
#include "AthenaBaseComps/AthAlgTool.h"
#include "DerivationFrameworkInterfaces/ISkimmingTool.h"
namespace DerivationFramework {
class PrescaleTool : public AthAlgTool, public ISkimmingTool {
public:
PrescaleTool(const std::string& t, const std::string& n, const IInterface* p);
StatusCode initialize();
StatusCode finalize();
virtual bool eventPassesFilter() const;
private:
mutable int m_prescale, m_eventCounter;
};
}
#endif // DERIVATIONFRAMEWORK_PRESCALETOOL_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// TriggerSkimmingTool.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef DERIVATIONFRAMEWORK_TRIGGERSKIMMINGTOOL_H
#define DERIVATIONFRAMEWORK_TRIGGERSKIMMINGTOOL_H
#include <string>
#include "AthenaBaseComps/AthAlgTool.h"
#include "TrigDecisionTool/TrigDecisionTool.h"
#include "DerivationFrameworkInterfaces/ISkimmingTool.h"
namespace ExpressionParsing {
class ExpressionParser;
}
namespace DerivationFramework {
class TriggerSkimmingTool : public AthAlgTool, public ISkimmingTool {
public:
TriggerSkimmingTool(const std::string& t, const std::string& n, const IInterface* p);
StatusCode initialize();
StatusCode finalize();
virtual bool eventPassesFilter() const;
private:
std::vector<std::string> m_triggerListAND;
std::vector<std::string> m_triggerListOR;
ToolHandle<Trig::TrigDecisionTool> m_trigDec;
};
}
#endif // DERIVATIONFRAMEWORK_TRIGGERSKIMMINGTOOL_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/////////////////////////////////////////////////////////////////
// PrescaleTool.cxx, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
// Author: Thomas Gillam (thomas.gillam@cern.ch)
// Based on the Integrated Simulation Framework
//
// Use of ExpressionParsing to analyse a more complex string
#include "DerivationFrameworkTools/PrescaleTool.h"
namespace DerivationFramework {
PrescaleTool::PrescaleTool(const std::string& t,
const std::string& n,
const IInterface* p) :
AthAlgTool(t,n,p),
m_prescale(1)
{
declareInterface<DerivationFramework::ISkimmingTool>(this);
declareProperty("Prescale", m_prescale);
}
StatusCode PrescaleTool::initialize()
{
if (m_prescale < 1) {
ATH_MSG_FATAL("Prescale of less than 1 makes no sense");
return StatusCode::FAILURE;
}
m_eventCounter = 0;
return StatusCode::SUCCESS;
}
StatusCode PrescaleTool::finalize()
{
return StatusCode::SUCCESS;
}
bool PrescaleTool::eventPassesFilter() const
{
bool accept(false);
if (m_eventCounter % m_prescale == 0) accept = true;
++m_eventCounter;
return accept;
}
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/////////////////////////////////////////////////////////////////
// TriggerSkimmingTool.cxx, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
// Author: James Catmore (james.catmore@cern.ch)
//
// Direct skimming via TrigDecisionTool
// Only intended for cases where the triggers in question cannot be
// handled by ExpressionEvaluation (dashes, dots)
#include "DerivationFrameworkTools/TriggerSkimmingTool.h"
#include <vector>
#include <string>
namespace DerivationFramework {
TriggerSkimmingTool::TriggerSkimmingTool(const std::string& t,
const std::string& n,
const IInterface* p) :
AthAlgTool(t,n,p),
m_trigDec( "Trig::TrigDecisionTool/TrigDecisionTool" )
{
declareInterface<DerivationFramework::ISkimmingTool>(this);
declareProperty( "TrigDecisionTool", m_trigDec );
declareProperty("TriggerListAND", m_triggerListAND);
declareProperty("TriggerListOR", m_triggerListOR);
}
StatusCode TriggerSkimmingTool::initialize()
{
return StatusCode::SUCCESS;
}
StatusCode TriggerSkimmingTool::finalize()
{
return StatusCode::SUCCESS;
}
bool TriggerSkimmingTool::eventPassesFilter() const
{
std::vector<std::string>::const_iterator strItr;
unsigned int cntrAND(0), cntrOR(0);
for (strItr=m_triggerListAND.begin(); strItr!=m_triggerListAND.end(); ++strItr) {
if (m_trigDec->isPassed(*strItr)) ++cntrAND;
}
for (strItr=m_triggerListOR.begin(); strItr!=m_triggerListOR.end(); ++strItr) {
if (m_trigDec->isPassed(*strItr)) ++cntrOR;
}
bool passAND(false);
bool passOR(false);
if (cntrAND==m_triggerListAND.size() && m_triggerListAND.size() > 0) passAND=true;
if (cntrOR > 0 && m_triggerListOR.size() > 0) passOR=true;
bool pass(false);
pass = passAND || passOR;
if (m_triggerListAND.size()==0) pass = passOR;
if (m_triggerListOR.size()==0) pass = passAND;
return pass;
}
}
......@@ -6,6 +6,8 @@
#include "DerivationFrameworkTools/AsgSelectionToolWrapper.h"
#include "DerivationFrameworkTools/FilterCombinationAND.h"
#include "DerivationFrameworkTools/FilterCombinationOR.h"
#include "DerivationFrameworkTools/TriggerSkimmingTool.h"
#include "DerivationFrameworkTools/PrescaleTool.h"
using namespace DerivationFramework;
......@@ -16,6 +18,8 @@ DECLARE_TOOL_FACTORY( DeltaRTool )
DECLARE_TOOL_FACTORY( AsgSelectionToolWrapper )
DECLARE_TOOL_FACTORY( FilterCombinationAND )
DECLARE_TOOL_FACTORY( FilterCombinationOR )
DECLARE_TOOL_FACTORY( TriggerSkimmingTool )
DECLARE_TOOL_FACTORY( PrescaleTool )
DECLARE_FACTORY_ENTRIES( DerivationFrameworkTools ) {
DECLARE_TOOL( xAODStringSkimmingTool )
......@@ -25,5 +29,7 @@ DECLARE_FACTORY_ENTRIES( DerivationFrameworkTools ) {
DECLARE_TOOL( AsgSelectionToolWrapper )
DECLARE_TOOL( FilterCombinationAND )
DECLARE_TOOL( FilterCombinationOR )
DECLARE_TOOL( TriggerSkimmingTool )
DECLARE_TOOL( PrescaleTool )
}
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