ATLAS Offline Software
GoodRunsListSelectorAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
9 #include "TROOT.h"
10 
11 GoodRunsListSelectorAlg::GoodRunsListSelectorAlg(const std::string& name, ISvcLocator* pSvcLocator)
12  : AthAlgorithm(name, pSvcLocator)
13  , m_GoodRunsListSelectorTool("GoodRunsListSelectorTool")
14  , m_counter(0)
15  , m_accept(0)
16 {
17  declareProperty( "GoodRunsListArray", m_grlnameVec );
18  declareProperty( "BlackRunsListArray", m_brlnameVec );
19  declareProperty( "CounterPrescale", m_prescale = 1000);
20 }
21 
22 
24 {
25 }
26 
27 
29 {
30  ATH_MSG_DEBUG ("initialize()");
31 
32  Root::TMsgLogger::SetMinLevel(static_cast<Root::TMsgLevel>(msgLevel()));
33 
35  if ( m_GoodRunsListSelectorTool.retrieve().isFailure() ) {
37  (m_GoodRunsListSelectorTool.propertyName() << ": Failed to retrieve tool "
38  << m_GoodRunsListSelectorTool.type());
39  return StatusCode::FAILURE;
40  } else {
42  (m_GoodRunsListSelectorTool.propertyName() << ": Retrieved tool "
43  << m_GoodRunsListSelectorTool.type());
44  }
45 
47  {
48  std::ostringstream tmp;
49  tmp << "Sequence" << m_GoodRunsListSelectorTool->getGRLSelectorRegistry().size();
50  m_myname = tmp.str();
51  };
52 
54  ATH_MSG_INFO ("initialize() :: Now registering this GRL Selector with unique name <" << m_myname << ">.");
55  bool regOk = m_GoodRunsListSelectorTool->registerGRLSelector(m_myname,m_grlnameVec,m_brlnameVec);
56  if (!regOk) {
57  ATH_MSG_ERROR ("initialize() :: Failure to register this GRL Selector with name <" << m_myname << ">. Return failure.");
58  return StatusCode::FAILURE;
59  }
60 
61  ATH_MSG_DEBUG ("initialize() successful");
62 
63  return StatusCode::SUCCESS;
64 }
65 
66 
69 {
70  ATH_MSG_DEBUG ("execute()");
71 
72  if (m_counter % m_prescale == 0)
73  ATH_MSG_INFO ("Now processing event : " << m_counter);
74  m_counter++ ;
75 
76  bool statusOk = m_GoodRunsListSelectorTool->passThisRunLB(m_grlnameVec,m_brlnameVec);
77  this->setFilterPassed (statusOk); // This skips the execution of following algs for this event
78  if (statusOk) ++m_accept;
79 
80  ATH_MSG_DEBUG ("execute() successful");
81 
82  return StatusCode::SUCCESS;
83 }
84 
85 
87 {
88  ATH_MSG_DEBUG ("finalize()");
89 
90  ATH_MSG_INFO ("Processed " << m_counter << " events, accepted " << m_accept << " events.");
91 
92  ATH_MSG_DEBUG ("finalize() successful");
93 
94  return StatusCode::SUCCESS;
95 }
96 
97 
GoodRunsListSelectorAlg::m_brlnameVec
std::vector< std::string > m_brlnameVec
Definition: GoodRunsListSelectorAlg.h:38
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
IGoodRunsListSelectorTool.h
GoodRunsListSelectorAlg::m_myname
std::string m_myname
Definition: GoodRunsListSelectorAlg.h:39
GoodRunsListSelectorAlg::m_grlnameVec
std::vector< std::string > m_grlnameVec
Definition: GoodRunsListSelectorAlg.h:37
GoodRunsListSelectorAlg::m_accept
unsigned int m_accept
Definition: GoodRunsListSelectorAlg.h:34
GoodRunsListSelectorAlg::initialize
StatusCode initialize()
Definition: GoodRunsListSelectorAlg.cxx:28
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
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
Root::TMsgLevel
TMsgLevel
Definition: TMsgLogger.h:42
GoodRunsListSelectorAlg::execute
StatusCode execute()
Definition: GoodRunsListSelectorAlg.cxx:68
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
AthAlgorithm
Definition: AthAlgorithm.h:47
GoodRunsListSelectorAlg.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
GoodRunsListSelectorAlg::m_prescale
unsigned int m_prescale
Definition: GoodRunsListSelectorAlg.h:35
GoodRunsListSelectorAlg::finalize
StatusCode finalize()
Definition: GoodRunsListSelectorAlg.cxx:86
GoodRunsListSelectorAlg::m_counter
unsigned int m_counter
Definition: GoodRunsListSelectorAlg.h:33
TMsgLogger.h
GoodRunsListSelectorAlg::m_GoodRunsListSelectorTool
ToolHandle< IGoodRunsListSelectorTool > m_GoodRunsListSelectorTool
Definition: GoodRunsListSelectorAlg.h:31
GoodRunsListSelectorAlg::GoodRunsListSelectorAlg
GoodRunsListSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: GoodRunsListSelectorAlg.cxx:11
Root::TMsgLogger::SetMinLevel
static void SetMinLevel(TMsgLevel minLevel)
Definition: TMsgLogger.h:96
GoodRunsListSelectorAlg::~GoodRunsListSelectorAlg
virtual ~GoodRunsListSelectorAlg()
Definition: GoodRunsListSelectorAlg.cxx:23