ATLAS Offline Software
QueryTag.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
11 #include "QueryTag.h"
12 
14 #include "StoreGate/ReadHandle.h"
15 
16 using namespace AthPoolEx;
17 
18 //___________________________________________________________________________
19 QueryTag::QueryTag(const std::string& type, const std::string& name, const IInterface* parent) :
20  AthAlgTool(type, name, parent), m_attrListKey() {
21  declareInterface<IAthenaSelectorTool>(this);
22 }
23 //___________________________________________________________________________
25 }
26 //___________________________________________________________________________
28  ATH_MSG_INFO("in initialize()");
29  const IService* parentSvc = dynamic_cast<const IService*>(this->parent());
30  if (parentSvc != 0) {
31  const IProperty* propertyServer = dynamic_cast<const IProperty*>(parentSvc);
32  if (propertyServer != 0) {
33  StringProperty attrKeyProperty("AttributeListKey", "");
34  StatusCode status = propertyServer->getProperty(&attrKeyProperty);
35  if (status.isSuccess()) {
36  m_attrListKey = attrKeyProperty.value();
37  }
38  }
39  }
40 
42  return StatusCode::SUCCESS;
43 }
44 //___________________________________________________________________________
46  return StatusCode::SUCCESS;
47 }
48 //__________________________________________________________________________
50  return StatusCode::SUCCESS;
51 }
52 //__________________________________________________________________________
55  if (!attrList.isValid()) {
56  ATH_MSG_ERROR("Could not retrieve AthenaAttributeList");
57  return StatusCode::FAILURE;
58  }
59 
60  try {
61  unsigned int eventNumber = (*attrList)["EventNumber"].data<unsigned int>();
62  unsigned int runNumber = (*attrList)["RunNumber"].data<unsigned int>();
63  unsigned int magicNumber = (*attrList)["MagicNumber"].data<unsigned int>();
64 
65  ATH_MSG_DEBUG("EventNumber = " << eventNumber);
66  ATH_MSG_DEBUG("RunNumber = " << runNumber);
67  ATH_MSG_DEBUG("MagicNumber = " << magicNumber);
68  if (eventNumber < 10 && magicNumber > 17) {
69  return StatusCode::RECOVERABLE;
70  }
71  } catch (...) {
72  ATH_MSG_DEBUG("Can't apply attributeList preselection");
73  return StatusCode::SUCCESS;
74  }
75  return StatusCode::SUCCESS;
76 }
77 //__________________________________________________________________________
79  return StatusCode::SUCCESS;
80 }
81 //__________________________________________________________________________
83  ATH_MSG_INFO("in finalize()");
84  return StatusCode::SUCCESS;
85 }
86 //__________________________________________________________________________
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthPoolEx::QueryTag::~QueryTag
virtual ~QueryTag()
Destructor.
Definition: QueryTag.cxx:24
AthPoolEx::QueryTag::preFinalize
virtual StatusCode preFinalize()
Called at the beginning of finalize.
Definition: QueryTag.cxx:78
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthenaAttributeList.h
AthPoolEx::QueryTag::preNext
virtual StatusCode preNext() const
Called at the beginning of next.
Definition: QueryTag.cxx:49
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
AthPoolEx::QueryTag::postInitialize
virtual StatusCode postInitialize()
Called at the end of initialize.
Definition: QueryTag.cxx:45
AthPoolEx::QueryTag::initialize
virtual StatusCode initialize()
IAthenaSelectorTool Interface method implementations:
Definition: QueryTag.cxx:27
AthPoolEx::QueryTag::postNext
virtual StatusCode postNext() const
Called at the end of next.
Definition: QueryTag.cxx:53
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::eventNumber
eventNumber
Definition: EventInfo_v1.cxx:124
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
QueryTag.h
This file contains the class definition for the QueryTag class.
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
AthPoolEx::QueryTag::QueryTag
QueryTag(const std::string &type, const std::string &name, const IInterface *parent)
Standard Service Constructor.
Definition: QueryTag.cxx:19
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AthPoolEx
Definition: PassNoneFilter.h:16
merge.status
status
Definition: merge.py:17
AthPoolEx::QueryTag::finalize
virtual StatusCode finalize()
Finalize AlgTool.
Definition: QueryTag.cxx:82
ReadHandle.h
Handle class for reading from StoreGate.
AthAlgTool
Definition: AthAlgTool.h:26
AthPoolEx::QueryTag::m_attrListKey
SG::ReadHandleKey< AthenaAttributeList > m_attrListKey
Definition: QueryTag.h:43