From 40205328d7f444ee19a70e633572eb84d812440b Mon Sep 17 00:00:00 2001 From: Charles Leggett <charles.g.leggett@gmail.com> Date: Tue, 19 Sep 2017 07:16:08 +0000 Subject: [PATCH] AthExHive: use initializer list syntax for Properties --- .../AthExHive/src/ASCIICondDbSvc.cxx | 28 ++++++++++++------- .../AthExHive/src/ASCIICondDbSvc.h | 3 +- Control/AthenaExamples/AthExHive/src/AlgC.cxx | 10 +------ Control/AthenaExamples/AthExHive/src/AlgT.cxx | 19 ++----------- Control/AthenaExamples/AthExHive/src/AlgT.h | 10 ++++--- .../AthExHive/src/HiveAlgBase.cxx | 3 -- .../AthExHive/src/HiveAlgBase.h | 2 +- .../AthExHive/src/HiveAlgL1.cxx | 11 ++------ .../AthenaExamples/AthExHive/src/HiveAlgL1.h | 4 +-- .../AthExHive/src/HiveAlgL2.cxx | 6 ++-- .../AthenaExamples/AthExHive/src/HiveAlgL2.h | 4 ++- .../AthExHive/src/HiveAlgL3.cxx | 4 +-- .../AthenaExamples/AthExHive/src/HiveAlgM.cxx | 14 ++-------- .../AthenaExamples/AthExHive/src/HiveAlgM.h | 6 ++-- .../AthenaExamples/AthExHive/src/HiveAlgR.cxx | 9 +----- .../AthenaExamples/AthExHive/src/HiveAlgR.h | 4 +-- .../AthenaExamples/AthExHive/src/HiveAlgV.cxx | 6 +--- .../AthenaExamples/AthExHive/src/HiveAlgV.h | 3 +- .../AthenaExamples/AthExHive/src/HiveTool.cxx | 11 ++------ .../AthenaExamples/AthExHive/src/HiveTool.h | 4 +-- 20 files changed, 57 insertions(+), 104 deletions(-) diff --git a/Control/AthenaExamples/AthExHive/src/ASCIICondDbSvc.cxx b/Control/AthenaExamples/AthExHive/src/ASCIICondDbSvc.cxx index bf8497901a4..19ddb7e5a71 100644 --- a/Control/AthenaExamples/AthExHive/src/ASCIICondDbSvc.cxx +++ b/Control/AthenaExamples/AthExHive/src/ASCIICondDbSvc.cxx @@ -25,11 +25,7 @@ boost::regex ref(r_ef); ASCIICondDbSvc::ASCIICondDbSvc( const std::string& name, ISvcLocator* svcLoc ): base_class(name,svcLoc) -{ - - declareProperty("CondFile",m_file=""); - -} +{} //--------------------------------------------------------------------------- @@ -120,7 +116,7 @@ ASCIICondDbSvc::readDbFile(const std::string& fname) { } ifs.close(); } else { - error() << "unable to open file " << m_file << endmsg; + error() << "unable to open file " << (std::string) m_file << endmsg; sc = StatusCode::FAILURE; } @@ -193,8 +189,13 @@ ASCIICondDbSvc::parse(EventIDRange& t, const std::string& s) { if (m.size() != 5) { return false; } - t = EventIDRange( EventIDBase(std::stoi(m[1]),std::stoi(m[2])), - EventIDBase(std::stoi(m[3]), std::stoi(m[4]))); + EventIDBase start(std::stoi(m[1]), std::stoi(m[2])); + EventIDBase end(std::stoi(m[3]), std::stoi(m[4])); + + start.set_lumi_block(m_lbn); + end.set_lumi_block(m_lbn); + + t = EventIDRange(start, end); return true; @@ -210,9 +211,14 @@ ASCIICondDbSvc::parse(IOVEntryT<IASCIICondDbSvc::dbData_t>& ie, const std::strin if (m.size() != 6) { return false; } - ie.setRange( EventIDRange( EventIDBase(std::stoi(m[1]), std::stoi(m[2])), - EventIDBase(std::stoi(m[3]), std::stoi(m[4])) ) ); + EventIDBase start(std::stoi(m[1]), std::stoi(m[2])); + EventIDBase end(std::stoi(m[3]), std::stoi(m[4])); + + start.set_lumi_block(m_lbn); + end.set_lumi_block(m_lbn); + ie.setRange(EventIDRange(start,end)); + IASCIICondDbSvc::dbData_t *v = new IASCIICondDbSvc::dbData_t( std::stof(m[5]) ); ie.setPtr(v); @@ -237,6 +243,8 @@ ASCIICondDbSvc::getRange(const std::string& dbKey , const EventContext& ctx, } for (auto e : itr->second) { + debug() << "compare " << e.range() << " with " << ctx.eventID() + << endmsg; if (e.range().isInRange(EventIDBase(ctx.eventID()))) { rng = e.range(); val = *(e.objPtr()); diff --git a/Control/AthenaExamples/AthExHive/src/ASCIICondDbSvc.h b/Control/AthenaExamples/AthExHive/src/ASCIICondDbSvc.h index 29504c326bd..7ee98c89e73 100644 --- a/Control/AthenaExamples/AthExHive/src/ASCIICondDbSvc.h +++ b/Control/AthenaExamples/AthExHive/src/ASCIICondDbSvc.h @@ -43,7 +43,8 @@ private: StatusCode readDbFile(const std::string&); - std::string m_file; + Gaudi::Property<std::string> m_file{this, "CondFile", "", "cond db file name"}; + Gaudi::Property<unsigned int> m_lbn{this, "LBN", 1, "explicit lumi block number"}; typedef std::map<std::string, std::vector<IOVEntryT<IASCIICondDbSvc::dbData_t>>> registry_t; registry_t m_registry; diff --git a/Control/AthenaExamples/AthExHive/src/AlgC.cxx b/Control/AthenaExamples/AthExHive/src/AlgC.cxx index 5b2023ef49e..68e49dbdc22 100644 --- a/Control/AthenaExamples/AthExHive/src/AlgC.cxx +++ b/Control/AthenaExamples/AthExHive/src/AlgC.cxx @@ -17,15 +17,7 @@ AlgC::AlgC( const std::string& name, ISvcLocator* pSvcLocator ) : ::AthAlgorithm( name, pSvcLocator ) -// , -// m_rdh1("a2"), -// m_rch("X1") -{ - - // declareProperty("Key_R1",m_rdh1); - // declareProperty("Key_CH", m_rch); - -} +{} //--------------------------------------------------------------------------- diff --git a/Control/AthenaExamples/AthExHive/src/AlgT.cxx b/Control/AthenaExamples/AthExHive/src/AlgT.cxx index 39145ef8569..eecc5fc3713 100644 --- a/Control/AthenaExamples/AthExHive/src/AlgT.cxx +++ b/Control/AthenaExamples/AthExHive/src/AlgT.cxx @@ -17,23 +17,8 @@ AlgT::AlgT( const std::string& name, ISvcLocator* pSvcLocator ) : - ::AthAlgorithm( name, pSvcLocator ), - m_wrh1("t1"), m_rdh1(""), - m_evt("McEventInfo"), - m_tool1("HiveTool",this), - m_tool2("HiveTool",this), - m_tool3("HiveTool",this) -{ - - declareProperty("Key_R1",m_rdh1); - declareProperty("Key_W1",m_wrh1); - declareProperty("EvtInfo", m_evt); - - declareProperty("Tool1",m_tool1); - declareProperty("Tool2",m_tool2); - declareProperty("Tool3",m_tool3); - -} + ::AthAlgorithm( name, pSvcLocator ) +{} //--------------------------------------------------------------------------- diff --git a/Control/AthenaExamples/AthExHive/src/AlgT.h b/Control/AthenaExamples/AthExHive/src/AlgT.h index 49787b1eab3..b6250c84eac 100644 --- a/Control/AthenaExamples/AthExHive/src/AlgT.h +++ b/Control/AthenaExamples/AthExHive/src/AlgT.h @@ -32,12 +32,14 @@ public: private: - SG::WriteHandleKey<HiveDataObj> m_wrh1; - SG::ReadHandleKey<HiveDataObj> m_rdh1; - SG::ReadHandleKey<EventInfo> m_evt; + SG::ReadHandleKey<EventInfo> m_evt{this, "EvtInfo", "McEventInfo", "EventInfo name"}; + SG::ReadHandleKey<HiveDataObj> m_rdh1{this,"Key_R1","","read key"}; + SG::WriteHandleKey<HiveDataObj> m_wrh1{this,"Key_W1","t1","write key"}; - ToolHandle<IHiveTool> m_tool1, m_tool2, m_tool3; + ToolHandle<IHiveTool> m_tool1{this, "Tool1", "HiveTool", "tool 1"}; + ToolHandle<IHiveTool> m_tool2{this, "Tool2", "HiveTool", "tool 2"}; + ToolHandle<IHiveTool> m_tool3{this, "Tool3", "HiveTool", "tool 3"}; }; #endif diff --git a/Control/AthenaExamples/AthExHive/src/HiveAlgBase.cxx b/Control/AthenaExamples/AthExHive/src/HiveAlgBase.cxx index d194ea7d075..401130de96b 100644 --- a/Control/AthenaExamples/AthExHive/src/HiveAlgBase.cxx +++ b/Control/AthenaExamples/AthExHive/src/HiveAlgBase.cxx @@ -14,9 +14,6 @@ HiveAlgBase::HiveAlgBase( const std::string& name, ::AthAlgorithm( name, pSvcLocator ), m_hes("HiveExSvc",name) { - - declareProperty("Time",m_time=0); - } HiveAlgBase::~HiveAlgBase() {} diff --git a/Control/AthenaExamples/AthExHive/src/HiveAlgBase.h b/Control/AthenaExamples/AthExHive/src/HiveAlgBase.h index dd63bda34ba..4b306bac595 100644 --- a/Control/AthenaExamples/AthExHive/src/HiveAlgBase.h +++ b/Control/AthenaExamples/AthExHive/src/HiveAlgBase.h @@ -40,7 +40,7 @@ protected: private: - int m_time; + Gaudi::Property<int> m_time{this, "Time", 0, "default alg sleep time"}; }; diff --git a/Control/AthenaExamples/AthExHive/src/HiveAlgL1.cxx b/Control/AthenaExamples/AthExHive/src/HiveAlgL1.cxx index ba0165a9411..c23f6d5e34e 100644 --- a/Control/AthenaExamples/AthExHive/src/HiveAlgL1.cxx +++ b/Control/AthenaExamples/AthExHive/src/HiveAlgL1.cxx @@ -10,15 +10,8 @@ HiveAlgL1::HiveAlgL1( const std::string& name, ISvcLocator* pSvcLocator ) : - ::HiveAlgBase( name, pSvcLocator ), - m_rdh1("a2"), - m_wrh1("l1") -{ - - declareProperty("Key_R1",m_rdh1); - declareProperty("Key_W1",m_wrh1); - -} + ::HiveAlgBase( name, pSvcLocator ) +{} HiveAlgL1::~HiveAlgL1() {} diff --git a/Control/AthenaExamples/AthExHive/src/HiveAlgL1.h b/Control/AthenaExamples/AthExHive/src/HiveAlgL1.h index 0d00b95baee..d59cdf1b5d7 100644 --- a/Control/AthenaExamples/AthExHive/src/HiveAlgL1.h +++ b/Control/AthenaExamples/AthExHive/src/HiveAlgL1.h @@ -30,8 +30,8 @@ public: private: - SG::ReadHandleKey<HiveDataObj> m_rdh1; - SG::WriteHandleKey<HiveDataObj> m_wrh1; + SG::ReadHandleKey<HiveDataObj> m_rdh1{this, "Key_R1", "a2", "read key"}; + SG::WriteHandleKey<HiveDataObj> m_wrh1{this, "Key_W1", "l1", "write key"}; }; #endif diff --git a/Control/AthenaExamples/AthExHive/src/HiveAlgL2.cxx b/Control/AthenaExamples/AthExHive/src/HiveAlgL2.cxx index b790c6165cb..24241df3987 100644 --- a/Control/AthenaExamples/AthExHive/src/HiveAlgL2.cxx +++ b/Control/AthenaExamples/AthExHive/src/HiveAlgL2.cxx @@ -10,12 +10,10 @@ HiveAlgL2::HiveAlgL2( const std::string& name, ISvcLocator* pSvcLocator ) : - ::HiveAlgBase( name, pSvcLocator ), - m_rdh1("l1"), - m_udh1("l1") + ::HiveAlgBase( name, pSvcLocator ) + ,m_udh1("l1") { - declareProperty("Key_R1",m_rdh1); declareProperty("Key_U1",m_udh1); } diff --git a/Control/AthenaExamples/AthExHive/src/HiveAlgL2.h b/Control/AthenaExamples/AthExHive/src/HiveAlgL2.h index b0d51bb7088..25e0de1efb4 100644 --- a/Control/AthenaExamples/AthExHive/src/HiveAlgL2.h +++ b/Control/AthenaExamples/AthExHive/src/HiveAlgL2.h @@ -31,8 +31,10 @@ public: private: - SG::ReadHandleKey<HiveDataObj> m_rdh1; + SG::ReadHandleKey<HiveDataObj> m_rdh1{this, "Key_R1", "l1", "read key"}; + SG::UpdateHandleKey<HiveDataObj> m_udh1; + }; #endif diff --git a/Control/AthenaExamples/AthExHive/src/HiveAlgL3.cxx b/Control/AthenaExamples/AthExHive/src/HiveAlgL3.cxx index 9fce65e9a02..af5ae6d01b6 100644 --- a/Control/AthenaExamples/AthExHive/src/HiveAlgL3.cxx +++ b/Control/AthenaExamples/AthExHive/src/HiveAlgL3.cxx @@ -10,8 +10,8 @@ HiveAlgL3::HiveAlgL3( const std::string& name, ISvcLocator* pSvcLocator ) : - ::HiveAlgBase( name, pSvcLocator ), - m_udh1("l1") + ::HiveAlgBase( name, pSvcLocator ) + ,m_udh1("l1") { declareProperty("Key_U1",m_udh1); diff --git a/Control/AthenaExamples/AthExHive/src/HiveAlgM.cxx b/Control/AthenaExamples/AthExHive/src/HiveAlgM.cxx index 15efbdc8c20..8a791b21f9f 100644 --- a/Control/AthenaExamples/AthExHive/src/HiveAlgM.cxx +++ b/Control/AthenaExamples/AthExHive/src/HiveAlgM.cxx @@ -9,16 +9,8 @@ HiveAlgM::HiveAlgM( const std::string& name, ISvcLocator* pSvcLocator ) : - ::HiveAlgBase( name, pSvcLocator ), - m_rdh1("a2"), - m_rdh2("l1") -{ - - declareProperty("Key_R1",m_rdh1); - declareProperty("Key_R2",m_rdh2); - declareProperty("Offset",m_off); - -} + ::HiveAlgBase( name, pSvcLocator ) +{} HiveAlgM::~HiveAlgM() {} @@ -58,7 +50,7 @@ StatusCode HiveAlgM::execute() { ATH_MSG_INFO(" read: " << rdh2.key() << " = " << rdh2->val() ); if ( rdh2->val() != (rdh1->val() + m_off) ) { - ATH_MSG_ERROR (rdh2.key() << " != " << rdh1.key() << " + " << m_off); + ATH_MSG_ERROR (rdh2.key() << " != " << rdh1.key() << " + " << (int) m_off); } else { ATH_MSG_INFO( "loop is ok"); } diff --git a/Control/AthenaExamples/AthExHive/src/HiveAlgM.h b/Control/AthenaExamples/AthExHive/src/HiveAlgM.h index 969de54f3c5..071898f86c3 100644 --- a/Control/AthenaExamples/AthExHive/src/HiveAlgM.h +++ b/Control/AthenaExamples/AthExHive/src/HiveAlgM.h @@ -29,9 +29,9 @@ public: private: - int m_off { 1 }; - SG::ReadHandleKey<HiveDataObj> m_rdh1; - SG::ReadHandleKey<HiveDataObj> m_rdh2; + Gaudi::Property<int> m_off {this, "Offset", 1, "offset"}; + SG::ReadHandleKey<HiveDataObj> m_rdh1{this, "Key_R1", "a2", "read key 1"}; + SG::ReadHandleKey<HiveDataObj> m_rdh2{this, "Key_R2", "l1", "read key 2"}; }; #endif diff --git a/Control/AthenaExamples/AthExHive/src/HiveAlgR.cxx b/Control/AthenaExamples/AthExHive/src/HiveAlgR.cxx index eab367f6dce..e433a9bce04 100644 --- a/Control/AthenaExamples/AthExHive/src/HiveAlgR.cxx +++ b/Control/AthenaExamples/AthExHive/src/HiveAlgR.cxx @@ -19,14 +19,7 @@ DECLARE_COMPONENT(HiveAlgR) HiveAlgR::HiveAlgR( const std::string& name, ISvcLocator* pSvcLocator ) : ::AthReentrantAlgorithm( name, pSvcLocator ) - ,m_evt("McEventInfo") - ,m_wrh1("ar1") -{ - - declareProperty("Key_W1",m_wrh1); - declareProperty("EvtInfo",m_evt); - -} +{} HiveAlgR::~HiveAlgR() {} diff --git a/Control/AthenaExamples/AthExHive/src/HiveAlgR.h b/Control/AthenaExamples/AthExHive/src/HiveAlgR.h index ed8ffb87381..a7bcfbd16b6 100644 --- a/Control/AthenaExamples/AthExHive/src/HiveAlgR.h +++ b/Control/AthenaExamples/AthExHive/src/HiveAlgR.h @@ -29,9 +29,9 @@ public: private: - SG::ReadHandleKey<EventInfo> m_evt; + SG::ReadHandleKey<EventInfo> m_evt{this, "EvtInfo", "McEventInfo", "event info key"}; - SG::WriteHandleKey<HiveDataObj> m_wrh1; + SG::WriteHandleKey<HiveDataObj> m_wrh1 {this, "Key_W1", "ar1", "write handle key"}; }; #endif diff --git a/Control/AthenaExamples/AthExHive/src/HiveAlgV.cxx b/Control/AthenaExamples/AthExHive/src/HiveAlgV.cxx index 72cf1280c7e..2d7d5de5e53 100644 --- a/Control/AthenaExamples/AthExHive/src/HiveAlgV.cxx +++ b/Control/AthenaExamples/AthExHive/src/HiveAlgV.cxx @@ -11,11 +11,7 @@ HiveAlgV::HiveAlgV( const std::string& name, ISvcLocator* pSvcLocator ) : ::HiveAlgBase( name, pSvcLocator ) -{ - - declareProperty("WriteBeforeRead",m_writeFirst=true); - -} +{} HiveAlgV::~HiveAlgV() {} diff --git a/Control/AthenaExamples/AthExHive/src/HiveAlgV.h b/Control/AthenaExamples/AthExHive/src/HiveAlgV.h index 48e6fee4a4b..04068e4bb8a 100644 --- a/Control/AthenaExamples/AthExHive/src/HiveAlgV.h +++ b/Control/AthenaExamples/AthExHive/src/HiveAlgV.h @@ -30,7 +30,8 @@ public: private: - bool m_writeFirst { true }; + Gaudi::Property<bool> m_writeFirst {this, "WriteBeforeRead", true, + "do write before the read" }; SG::ReadHandleKeyArray<HiveDataObj> m_rhv { this, "Key_RV", {"a1","a2","d1","e1","c1"}, diff --git a/Control/AthenaExamples/AthExHive/src/HiveTool.cxx b/Control/AthenaExamples/AthExHive/src/HiveTool.cxx index 242a1295345..dca8aa6c211 100644 --- a/Control/AthenaExamples/AthExHive/src/HiveTool.cxx +++ b/Control/AthenaExamples/AthExHive/src/HiveTool.cxx @@ -14,15 +14,8 @@ HiveTool::HiveTool(const std::string& type, const std::string& name, const IInterface* parent) - : base_class( type, name, parent ), - m_rdh1("x1"), - m_wrh1("X1") -{ - - declareProperty("Key_R1",m_rdh1); - declareProperty("Key_W1",m_wrh1); - -} + : base_class( type, name, parent ) +{} /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ diff --git a/Control/AthenaExamples/AthExHive/src/HiveTool.h b/Control/AthenaExamples/AthExHive/src/HiveTool.h index 00b57d32c6e..ecd1baf51dd 100644 --- a/Control/AthenaExamples/AthExHive/src/HiveTool.h +++ b/Control/AthenaExamples/AthExHive/src/HiveTool.h @@ -25,8 +25,8 @@ public: private: - SG::ReadHandleKey<HiveDataObj> m_rdh1; - SG::WriteHandleKey<HiveDataObj> m_wrh1; + SG::ReadHandleKey<HiveDataObj> m_rdh1{this, "Key_R1", "x1", "tool read key"}; + SG::WriteHandleKey<HiveDataObj> m_wrh1{this, "Key_W1", "X1", "tool write key"}; }; -- GitLab