Skip to content
Snippets Groups Projects
Commit 43eb7a19 authored by Atlas-Software Librarian's avatar Atlas-Software Librarian Committed by Graeme Stewart
Browse files

'CMakeLists.txt' (MultiInputExample-00-01-06)

	* Tagging MultiInputExample-00-01-06.
	* AthenaBaseComps migration.
parent 4f3085d6
No related branches found
No related tags found
No related merge requests found
################################################################################
# Package: MultiInputExample
################################################################################
# Declare the package name:
atlas_subdir( MultiInputExample )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
Control/AthenaBaseComps
GaudiKernel
PRIVATE
Control/PileUpTools
Control/StoreGate
Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleData
Event/EventInfo )
# Component(s) in the package:
atlas_add_component( MultiInputExample
src/*.cxx
src/components/*.cxx
LINK_LIBRARIES AthenaBaseComps GaudiKernel PileUpToolsLib StoreGateLib SGtests AthenaPoolExampleData EventInfo )
# Install files from the package:
atlas_install_headers( MultiInputExample )
atlas_install_joboptions( share/MultiInputInit.py )
......@@ -2,27 +2,26 @@
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "GaudiKernel/Algorithm.h"
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ServiceHandle.h"
// Data members classes
#include <list>
class StoreGateSvc;
class PileUpMergeSvc;
/////////////////////////////////////////////////////////////////////////////
class MyAlg:public Algorithm {
class MyAlg
: public AthAlgorithm
{
public:
MyAlg (const std::string& name, ISvcLocator* pSvcLocator);
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
//ServiceHandle<StoreGateSvc> p_overStore;
PileUpMergeSvc *m_mergeSvc; // Pile up service
MyAlg (const std::string& name, ISvcLocator* pSvcLocator);
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
private:
ServiceHandle<PileUpMergeSvc> m_mergeSvc; // Pile up service
};
......@@ -2,27 +2,26 @@
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "GaudiKernel/Algorithm.h"
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ServiceHandle.h"
// Data members classes
#include <list>
class StoreGateSvc;
class PileUpMergeSvc;
/////////////////////////////////////////////////////////////////////////////
class MyMultiInputAlg:public Algorithm {
class MyMultiInputAlg
: public AthAlgorithm
{
public:
MyMultiInputAlg (const std::string& name, ISvcLocator* pSvcLocator);
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
//ServiceHandle<StoreGateSvc> p_overStore;
PileUpMergeSvc *m_mergeSvc; // Pile up service
MyMultiInputAlg (const std::string& name, ISvcLocator* pSvcLocator);
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
private:
ServiceHandle<PileUpMergeSvc> m_mergeSvc; // Pile up service
};
......@@ -4,7 +4,8 @@ package MultiInputExample
author ATLAS Workbook
use AtlasPolicy AtlasPolicy-*
use GaudiInterface GaudiInterface-* External
use GaudiInterface GaudiInterface-* External
use AthenaBaseComps AthenaBaseComps-* Control
private
use StoreGate StoreGate-* Control
......
......@@ -19,8 +19,8 @@
/////////////////////////////////////////////////////////////////////////////
MyAlg::MyAlg(const std::string& name, ISvcLocator* pSvcLocator) :
Algorithm(name, pSvcLocator),
m_mergeSvc(0)
AthAlgorithm(name, pSvcLocator),
m_mergeSvc("PileUpMergeSvc", name)
{
// Part 2: Properties go here
......@@ -30,54 +30,26 @@ MyAlg::MyAlg(const std::string& name, ISvcLocator* pSvcLocator) :
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
StatusCode MyAlg::initialize(){
// Get the messaging service, print where you are
MsgStream log(msgSvc(), name());
log << MSG::INFO << "initialize()" << endreq;
/*
// set up the SG service:
if ( !(p_overStore.retrieve()).isSuccess() ) {
log << MSG::ERROR
<< "Could not locate default store"
<< endreq;
return StatusCode::FAILURE;
}
*/
//locate the PileUpMergeSvc and initialize our local ptr
const bool CREATEIF(true);
if (!(service("PileUpMergeSvc", m_mergeSvc, CREATEIF)).isSuccess() ||
0 == m_mergeSvc) {
log << MSG::ERROR << "Could not find PileUpMergeSvc" << endreq;
return StatusCode::FAILURE;
}
StatusCode MyAlg::initialize()
{
ATH_CHECK( m_mergeSvc.retrieve() );
return StatusCode::SUCCESS;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
StatusCode MyAlg::execute() {
MsgStream log(msgSvc(), name());
log << MSG::INFO << "execute()" << endreq;
StatusCode MyAlg::execute()
{
ATH_MSG_INFO( "execute()" );
//Put all available ExampleClass with key "MyData" in alist
typedef PileUpMergeSvc::TimedList<ExampleClass>::type ExampleClassList;
ExampleClassList alist;
if (!(m_mergeSvc->retrieveSubEvtsData("MyData", alist).isSuccess()) && alist.size()==0) {
log << MSG::ERROR << "Could not fill ExampleClassList" << endreq;
return StatusCode::FAILURE;
} else {
log << MSG::INFO << alist.size()
<< " ExampleClassList with key " << "MyData"
<< " found" << endreq;
}
ATH_CHECK( m_mergeSvc->retrieveSubEvtsData("MyData", alist) );
ATH_MSG_INFO( alist.size()
<< " ExampleClassList with key " << "MyData"
<< " found" );
//Now alist.begin() is the first input "SimpleRootFile1.root"
//Now alist.end() is the second (in this example only) input "SimpleRootFile2.root"
......@@ -88,10 +60,9 @@ StatusCode MyAlg::execute() {
while (icls != endcls) {
//Get a pointer to access
const ExampleClass* pcls(icls->second);
log<<MSG::INFO<<"MyData in Input File #"<<k<<" contains getRun()="<<pcls->getRun()<<" getEvent()="
<<pcls->getEvent()<<" getText()="
<<pcls->getText()<<" "
<<endreq;
ATH_MSG_INFO("MyData in Input File #"<<k<<" contains getRun()="<<pcls->getRun()<<" getEvent()="
<<pcls->getEvent()<<" getText()="
<<pcls->getText()<<" " );
++icls;++k;
}
......@@ -100,14 +71,10 @@ StatusCode MyAlg::execute() {
typedef PileUpMergeSvc::TimedList<ExampleHitContainer>::type ExampleHitContainerList;
ExampleHitContainerList blist;
if (!(m_mergeSvc->retrieveSubEvtsData("MyHits", blist).isSuccess()) && blist.size()==0) {
log << MSG::ERROR << "Could not fill ExampleHitContainerList" << endreq;
return StatusCode::FAILURE;
} else {
log << MSG::INFO << blist.size()
<< " ExampleHitContainerList with key " << "MyHits"
<< " found" << endreq;
}
ATH_CHECK( m_mergeSvc->retrieveSubEvtsData("MyHits", blist) );
ATH_MSG_INFO( blist.size()
<< " ExampleHitContainerList with key " << "MyHits"
<< " found" );
//Now blist.begin() is the first input "SimpleRootFile1.root"
//Now blist.end() is the second (in this example only) input "SimpleRootFile2.root"
......@@ -118,10 +85,10 @@ StatusCode MyAlg::execute() {
while (ihit != endhit) {
//Get a pointer to access
const ExampleHitContainer* cont(ihit->second);
log<<MSG::INFO<<"MyHits in Input File #"<<k<<" contains:"<<endreq;
ATH_MSG_INFO("MyHits in Input File #"<<k<<" contains:" );
for (ExampleHitContainer::const_iterator obj = cont->begin(); obj != cont->end(); obj++) {
log << MSG::INFO << "Hit x = " << (*obj)->getX() << " y = " << (*obj)->getY() << " z = " << (*obj)->getZ() << " detector = " << (*obj)->getDetector() << endreq;
ATH_MSG_INFO( "Hit x = " << (*obj)->getX() << " y = " << (*obj)->getY() << " z = " << (*obj)->getZ() << " detector = " << (*obj)->getDetector() );
}
++ihit;++k;
......@@ -213,12 +180,9 @@ StatusCode MyAlg::execute() {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
StatusCode MyAlg::finalize() {
// Part 1: Get the messaging service, print where you are
MsgStream log(msgSvc(), name());
log << MSG::INFO << "finalize()" << endreq;
return StatusCode::SUCCESS;
StatusCode MyAlg::finalize()
{
ATH_MSG_INFO( "finalize()" );
return StatusCode::SUCCESS;
}
......@@ -19,65 +19,31 @@
/////////////////////////////////////////////////////////////////////////////
MyMultiInputAlg::MyMultiInputAlg(const std::string& name, ISvcLocator* pSvcLocator) :
Algorithm(name, pSvcLocator),
m_mergeSvc(0)
AthAlgorithm(name, pSvcLocator),
m_mergeSvc("PileUpMergeSvc", name)
{
// Part 2: Properties go here
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
StatusCode MyMultiInputAlg::initialize(){
// Get the messaging service, print where you are
MsgStream log(msgSvc(), name());
log << MSG::INFO << "initialize()" << endreq;
/*
// set up the SG service:
if ( !(p_overStore.retrieve()).isSuccess() ) {
log << MSG::ERROR
<< "Could not locate default store"
<< endreq;
return StatusCode::FAILURE;
}
*/
//locate the PileUpMergeSvc and initialize our local ptr
const bool CREATEIF(true);
if (!(service("PileUpMergeSvc", m_mergeSvc, CREATEIF)).isSuccess() ||
0 == m_mergeSvc) {
log << MSG::ERROR << "Could not find PileUpMergeSvc" << endreq;
return StatusCode::FAILURE;
}
StatusCode MyMultiInputAlg::initialize()
{
ATH_CHECK( m_mergeSvc.retrieve() );
return StatusCode::SUCCESS;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
StatusCode MyMultiInputAlg::execute() {
MsgStream log(msgSvc(), name());
log << MSG::INFO << "execute()" << endreq;
StatusCode MyMultiInputAlg::execute()
{
//Put all available ExampleClass with key "MyData" in alist
typedef PileUpMergeSvc::TimedList<ExampleClass>::type ExampleClassList;
ExampleClassList alist;
if (!(m_mergeSvc->retrieveSubEvtsData("MyData", alist).isSuccess()) && alist.size()==0) {
log << MSG::ERROR << "Could not fill ExampleClassList" << endreq;
return StatusCode::FAILURE;
} else {
log << MSG::INFO << alist.size()
<< " ExampleClassList with key " << "MyData"
<< " found" << endreq;
}
ATH_CHECK( m_mergeSvc->retrieveSubEvtsData("MyData", alist) );
ATH_MSG_INFO( alist.size()
<< " ExampleClassList with key " << "MyData"
<< " found" );
//Now alist.begin() is the first input "SimpleRootFile1.root"
//Now alist.end() is the second (in this example only) input "SimpleRootFile2.root"
......@@ -88,10 +54,9 @@ StatusCode MyMultiInputAlg::execute() {
while (icls != endcls) {
//Get a pointer to access
const ExampleClass* pcls(icls->second);
log<<MSG::INFO<<"MyData in Input File #"<<k<<" contains getRun()="<<pcls->getRun()<<" getEvent()="
<<pcls->getEvent()<<" getText()="
<<pcls->getText()<<" "
<<endreq;
ATH_MSG_INFO("MyData in Input File #"<<k<<" contains getRun()="<<pcls->getRun()<<" getEvent()="
<<pcls->getEvent()<<" getText()="
<<pcls->getText()<<" " );
++icls;++k;
}
......@@ -100,14 +65,10 @@ StatusCode MyMultiInputAlg::execute() {
typedef PileUpMergeSvc::TimedList<ExampleHitContainer>::type ExampleHitContainerList;
ExampleHitContainerList blist;
if (!(m_mergeSvc->retrieveSubEvtsData("MyHits", blist).isSuccess()) && blist.size()==0) {
log << MSG::ERROR << "Could not fill ExampleHitContainerList" << endreq;
return StatusCode::FAILURE;
} else {
log << MSG::INFO << blist.size()
<< " ExampleHitContainerList with key " << "MyHits"
<< " found" << endreq;
}
ATH_CHECK( m_mergeSvc->retrieveSubEvtsData("MyHits", blist).isSuccess() );
ATH_MSG_INFO( blist.size()
<< " ExampleHitContainerList with key " << "MyHits"
<< " found" );
//Now blist.begin() is the first input "SimpleRootFile1.root"
//Now blist.end() is the second (in this example only) input "SimpleRootFile2.root"
......@@ -118,10 +79,10 @@ StatusCode MyMultiInputAlg::execute() {
while (ihit != endhit) {
//Get a pointer to access
const ExampleHitContainer* cont(ihit->second);
log<<MSG::INFO<<"MyHits in Input File #"<<k<<" contains:"<<endreq;
ATH_MSG_INFO("MyHits in Input File #"<<k<<" contains:" );
for (ExampleHitContainer::const_iterator obj = cont->begin(); obj != cont->end(); obj++) {
log << MSG::INFO << "Hit x = " << (*obj)->getX() << " y = " << (*obj)->getY() << " z = " << (*obj)->getZ() << " detector = " << (*obj)->getDetector() << endreq;
ATH_MSG_INFO( "Hit x = " << (*obj)->getX() << " y = " << (*obj)->getY() << " z = " << (*obj)->getZ() << " detector = " << (*obj)->getDetector() );
}
++ihit;++k;
......@@ -213,12 +174,8 @@ StatusCode MyMultiInputAlg::execute() {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
StatusCode MyMultiInputAlg::finalize() {
// Part 1: Get the messaging service, print where you are
MsgStream log(msgSvc(), name());
log << MSG::INFO << "finalize()" << endreq;
return StatusCode::SUCCESS;
StatusCode MyMultiInputAlg::finalize()
{
ATH_MSG_INFO( "finalize()" );
return StatusCode::SUCCESS;
}
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