Skip to content
Snippets Groups Projects
Commit cc9d41e6 authored by Debottam Bakshi Gupta's avatar Debottam Bakshi Gupta
Browse files

Merge remote-tracking branch 'upstream/master' into ATR_21882_topo_excl

parents da2598bd 963789e2
No related branches found
No related tags found
6 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!36230introducing HLT_2g15_tight_dPhi15 for low mass Higgs group
Showing
with 168 additions and 104 deletions
......@@ -10,7 +10,7 @@ find_package( CLHEP )
atlas_add_library( SubDetectorEnvelopesLib
INTERFACE
PUBLIC_HEADERS SubDetectorEnvelopes
LINK_LIBRARIES GaudiKernel AtlasDetDescr )
LINK_LIBRARIES GaudiKernel AtlasDetDescr CxxUtils )
atlas_add_component( SubDetectorEnvelopes
src/*.cxx
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
......@@ -17,6 +17,8 @@
// SubDetectorEnvelopes includes
#include "SubDetectorEnvelopes/RZPair.h"
#include "CxxUtils/checker_macros.h"
class IEnvelopeDefSvc : virtual public IInterface {
/**
@class IEnvelopeDefSvc
......@@ -51,11 +53,11 @@ class IEnvelopeDefSvc : virtual public IInterface {
/** legacy methods
Any client should update to use the methods defined above!
The following lecagy methods will be phased out once all clients have migrated to the new methods above */
RZPairVector &getBeamPipeRZValues( unsigned short = 0) const { return const_cast<RZPairVector&>( getRZBoundary(AtlasDetDescr::fAtlasForward) ); }
RZPairVector &getInDetRZValues( unsigned short = 0) const { return const_cast<RZPairVector&>( getRZBoundary(AtlasDetDescr::fAtlasID) ); }
RZPairVector &getCaloRZValues( unsigned short = 0) const { return const_cast<RZPairVector&>( getRZBoundary(AtlasDetDescr::fAtlasCalo) ); }
RZPairVector &getMuonRZValues( unsigned short = 0) const { return const_cast<RZPairVector&>( getRZBoundary(AtlasDetDescr::fAtlasMS) ); }
RZPairVector &getCavernRZValues( unsigned short = 0) const { return const_cast<RZPairVector&>( getRZBoundary(AtlasDetDescr::fAtlasCavern) ); }
RZPairVector &getBeamPipeRZValues ATLAS_NOT_THREAD_SAFE ( unsigned short = 0) const { return const_cast<RZPairVector&>( getRZBoundary(AtlasDetDescr::fAtlasForward) ); }
RZPairVector &getInDetRZValues ATLAS_NOT_THREAD_SAFE ( unsigned short = 0) const { return const_cast<RZPairVector&>( getRZBoundary(AtlasDetDescr::fAtlasID) ); }
RZPairVector &getCaloRZValues ATLAS_NOT_THREAD_SAFE ( unsigned short = 0) const { return const_cast<RZPairVector&>( getRZBoundary(AtlasDetDescr::fAtlasCalo) ); }
RZPairVector &getMuonRZValues ATLAS_NOT_THREAD_SAFE ( unsigned short = 0) const { return const_cast<RZPairVector&>( getRZBoundary(AtlasDetDescr::fAtlasMS) ); }
RZPairVector &getCavernRZValues ATLAS_NOT_THREAD_SAFE ( unsigned short = 0) const { return const_cast<RZPairVector&>( getRZBoundary(AtlasDetDescr::fAtlasCavern) ); }
protected:
/** mirror the given srcRZ RZPairVector in the XY-plane to describe all corner points
......
......@@ -4,7 +4,7 @@
atlas_subdir( GoogleTestTools )
# External package dependencies:
find_package( GMock )
find_package( GTest )
# In standalone mode we just use the headers from the package. While in
# offline mode we build a proper library.
......@@ -17,13 +17,11 @@ else()
atlas_add_library( GoogleTestTools
GoogleTestTools/*.h src/*.cxx
PUBLIC_HEADERS GoogleTestTools
INCLUDE_DIRS ${GMOCK_INCLUDE_DIRS}
LINK_LIBRARIES ${GMOCK_LIBRARIES}
PRIVATE_LINK_LIBRARIES GaudiKernel )
INCLUDE_DIRS ${GTEST_INCLUDE_DIRS}
LINK_LIBRARIES ${GTEST_LIBRARIES} GaudiKernel )
endif()
# Unit tests for InitGaudiGoogleTest:
atlas_add_test( GoogleTestToolsTests
SOURCES test/gt_GoogleTestTools.cxx
INCLUDE_DIRS ${GMOCK_INCLUDE_DIRS}
LINK_LIBRARIES ${GMOCK_LIBRARIES} GaudiKernel GoogleTestTools )
LINK_LIBRARIES GoogleTestTools )
[==========] Running 1 test from 1 test case.
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from InitGaudiGoogleTestTest
[ RUN ] InitGaudiGoogleTestTest.basictest
ApplicationMgr SUCCESS
====================================================================================================================================
Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99)
running on karma on Wed Jul 4 10:48:30 2018
Welcome to ApplicationMgr (GaudiCoreSvc v34r0)
running on 36d5a1e47246 on Sat Sep 12 19:51:31 2020
====================================================================================================================================
ApplicationMgr INFO Application Manager Configured successfully
HistogramPersis...WARNING Histograms saving not required.
ApplicationMgr INFO Application Manager Initialized successfully
EventLoopMgr INFO Histograms converted successfully according to request.
ToolSvc INFO Removing all tools created by ToolSvc
ApplicationMgr INFO Application Manager Finalized successfully
ApplicationMgr INFO Application Manager Terminated successfully
[ OK ] InitGaudiGoogleTestTest.basictest (44 ms)
[----------] 1 test from InitGaudiGoogleTestTest (44 ms total)
[ OK ] InitGaudiGoogleTestTest.basictest (382 ms)
[----------] 1 test from InitGaudiGoogleTestTest (382 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (44 ms total)
[==========] 1 test from 1 test suite ran. (382 ms total)
[ PASSED ] 1 test.
Calorimeter/CaloSimEvent
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
// CaloCalibrationHit
......@@ -75,13 +75,13 @@ class CaloCalibrationHit
/** Copy constructor **/
CaloCalibrationHit(const CaloCalibrationHit &cchSource)
: m_ID (cchSource.m_ID),
m_energy0 (cchSource.m_energy0),
m_energy1 (cchSource.m_energy1),
m_energy2 (cchSource.m_energy2),
m_energy3 (cchSource.m_energy3),
m_particleID (cchSource.m_particleID)
{
m_ID = cchSource.m_ID;
m_energy0 = cchSource.m_energy0;
m_energy1 = cchSource.m_energy1;
m_energy2 = cchSource.m_energy2;
m_energy3 = cchSource.m_energy3;
m_particleID = cchSource.m_particleID;
}
/** Assignment operator **/
......
......@@ -38,7 +38,7 @@ CaloCalibrationHitContainer::operator std::string () const
int counter = 0 ;
CaloCalibrationHit * hit ;
for(it = this->begin() ; it != this->end() ; it++ ){ // Loop over Hits
for(it = this->begin() ; it != this->end() ; ++it ){ // Loop over Hits
hit = *it ;
......
......@@ -1006,7 +1006,7 @@ namespace asg
{
ASSERT_SUCCESS (th3.setProperty ("usePublic", true));
}
ASSERT_SUCCESS (th3.initialize ());
if (value == -1)
{
......@@ -1018,7 +1018,7 @@ namespace asg
}
}
INSTANTIATE_TEST_CASE_P
INSTANTIATE_TEST_SUITE_P
(MySubtoolTest1, SubtoolTest, ::testing::Values
(std::make_tuple ("regPublicHandle", "public", "ATH"),
std::make_tuple ("anaPublicHandle", "public", "ATH"),
......@@ -1037,7 +1037,7 @@ namespace asg
std::make_tuple ("regPrivateHandle", "private", "empty"),
std::make_tuple ("anaPrivateHandle", "private", "empty"),
std::make_tuple ("regPrivateHandle", "private", "none"),
std::make_tuple ("anaPrivateHandle", "private", "none")),);
std::make_tuple ("anaPrivateHandle", "private", "none")));
}
ATLAS_GOOGLE_TEST_MAIN
No preview for this file type
No preview for this file type
......@@ -24,14 +24,16 @@ from AthenaConfiguration.UnifyProperties import unifySet
class ConfigurationError(RuntimeError):
pass
_basicServicesToCreateOrder=("CoreDumpSvc/CoreDumpSvc", "GeoModelSvc/GeoModelSvc", "DetDescrCnvSvc/DetDescrCnvSvc")
_basicServicesToCreate=frozenset(('GeoModelSvc','TileInfoLoader','DetDescrCnvSvc','CoreDumpSvc','VTuneProfilerService','EvtIdModifierSvc'))
def printProperties(msg, c, nestLevel = 0):
def printProperties(msg, c, nestLevel = 0, printDefaults=False):
# Iterate in sorted order.
propnames= sorted(c._descriptors.keys())
for propname in propnames:
if not c.is_property_set(propname):
if not printDefaults and not c.is_property_set(propname):
continue
propval=getattr(c,propname)
# Ignore empty lists
......@@ -42,7 +44,10 @@ def printProperties(msg, c, nestLevel = 0):
if propname in ["DetStore","EvtStore"]:
continue
if isinstance( propval, GaudiConfig2.Configurable ):
msg.info( " "*nestLevel +" * {0}: {1}/{2}".format(propname, propval.__cpp_type__, propval.getName()))
printProperties(msg, propval, nestLevel+3)
continue
if isinstance(propval,GaudiHandles.PublicToolHandleArray):
ths = [th.getName() for th in propval]
propstr = "PublicToolHandleArray([ {0} ])".format(', '.join(ths))
......@@ -77,7 +82,7 @@ class ComponentAccumulator(object):
self._algorithms = {} #Flat algorithms list, useful for merging
self._conditionsAlgs=[] #Unordered list of conditions algorithms + their private tools
self._services=[] #List of service, not yet sure if the order matters here in the MT age
self._servicesToCreate=set(_basicServicesToCreate)
self._servicesToCreate=[]
self._privateTools=None #A placeholder to carry a private tool(s) not yet attached to its parent
self._primaryComp=None #A placeholder to designate the primary service
......@@ -141,12 +146,12 @@ class ComponentAccumulator(object):
self._msg=logging.getLogger('ComponentAccumulator')
def printCondAlgs(self, summariseProps=False, onlyComponents=[]):
def printCondAlgs(self, summariseProps=False, onlyComponents=[], printDefaults=False):
self._msg.info( "Condition Algorithms" )
for (c, flag) in filterComponents (self._conditionsAlgs, onlyComponents):
self._msg.info( " " +"\\__ "+ c.name +" (cond alg)" )
if summariseProps and flag:
printProperties(self._msg, c, 1)
printProperties(self._msg, c, 1, printDefaults)
return
......@@ -155,7 +160,7 @@ class ComponentAccumulator(object):
# in the list with a trailing `-', then only the name of the component
# will be printed, not its properties.
def printConfig(self, withDetails=False, summariseProps=False,
onlyComponents = []):
onlyComponents = [], printDefaults=False):
self._msg.info( "Event Inputs" )
self._msg.info( "Event Algorithm Sequences" )
......@@ -179,7 +184,7 @@ class ComponentAccumulator(object):
else:
self._msg.info( " "*nestLevel +"\\__ "+ c.name +" (alg)" )
if summariseProps and flag:
printProperties(self._msg, c, nestLevel)
printProperties(self._msg, c, nestLevel, printDefaults)
for n,s in enumerate(self._allSequences):
self._msg.info( "Top sequence {}".format(n) )
......@@ -195,7 +200,7 @@ class ComponentAccumulator(object):
self._msg.info( " {0},".format(t.getFullJobOptName()) )
# Not nested, for now
if summariseProps and flag:
printProperties(self._msg, t)
printProperties(self._msg, t, printDefaults)
self._msg.info( "]" )
self._msg.info( "Private Tools")
self._msg.info( "[" )
......@@ -204,12 +209,12 @@ class ComponentAccumulator(object):
self._msg.info( " {0},".format(t.getFullJobOptsName()) )
# Not nested, for now
if summariseProps and flag:
printProperties(self._msg, t)
printProperties(self._msg, t, printDefaults)
else:
if self._privateTools is not None:
self._msg.info( " {0},".format(self._privateTools.getFullJobOptName()) )
if summariseProps:
printProperties(self._msg, self._privateTools)
printProperties(self._msg, self._privateTools, printDefaults)
self._msg.info( "]" )
self._msg.info( "TheApp properties" )
for k,v in six.iteritems(self._theAppProps):
......@@ -391,9 +396,12 @@ class ComponentAccumulator(object):
#keep a ref of the de-duplicated public tool as primary component
self._primaryComp=self.__getOne( self._services, newSvc.name, "Services")
self._lastAddedComponent=newSvc.name
if create: self._servicesToCreate.add(newSvc.name)
return
if create:
sname = newSvc.getFullJobOptName()
if sname not in self._servicesToCreate:
self._servicesToCreate.append(sname)
return
def addPublicTool(self,newTool,primary=False):
if newTool.__component_type__ != "AlgTool":
......@@ -568,9 +576,7 @@ class ComponentAccumulator(object):
self.addCondAlgo(condAlg) #Profit from deduplicaton here
for svc in other._services:
self.addService(svc) #Profit from deduplicaton here
self._servicesToCreate.update(other._servicesToCreate)
self.addService(svc, create = svc.getFullJobOptName() in other._servicesToCreate) #Profit from deduplicaton here
for pt in other._publicTools:
self.addPublicTool(pt) #Profit from deduplicaton here
......@@ -663,9 +669,14 @@ class ComponentAccumulator(object):
extSvc += [
svc.getFullJobOptName(),
]
if svc.name in self._servicesToCreate:
if svc.getFullJobOptName() in self._servicesToCreate:
svcToCreate.append(svc.getFullJobOptName())
# order basic services
for bs in reversed(_basicServicesToCreateOrder):
if bs in svcToCreate:
svcToCreate.insert(0, svcToCreate.pop( svcToCreate.index(bs) ) )
extSvc.append("PyAthena::PyComponentMgr/PyComponentMgr")
appPropsToSet["ExtSvc"] = str(extSvc)
......@@ -829,6 +840,8 @@ def __indent( indent = ""):
def __setProperties( destConfigurableInstance, sourceConf2Instance, indent="" ):
_log = logging.getLogger( "__setProperties".ljust(30) )
for pname, pvalue in six.iteritems( sourceConf2Instance._properties ):
if destConfigurableInstance.__class__.__name__ == 'AlgSequence' and pname == 'Members':
continue
propType = sourceConf2Instance._descriptors[pname].cpp_type
if "PrivateToolHandleArray" in propType:
setattr( destConfigurableInstance, pname, [conf2toConfigurable( tool, __indent( indent ) ) for tool in pvalue] )
......@@ -854,7 +867,7 @@ def __setProperties( destConfigurableInstance, sourceConf2Instance, indent="" ):
pass
setattr( destConfigurableInstance, pname, pvalue )
def conf2toConfigurable( comp, indent="" ):
def conf2toConfigurable( comp, indent="", suppressDupes=False ):
"""
Method converts from Conf2 ( comp argument ) to old Configurable
If the Configurable of the same name exists, the properties merging process is invoked
......@@ -929,9 +942,11 @@ def conf2toConfigurable( comp, indent="" ):
return listOrDictHelper
def __areSettingsSame( existingConfigurableInstance, newConf2Instance, indent="" ):
_log.debug( "{}Checking if setting is the same {}".format( indent, existingConfigurableInstance.getFullName() ) )
_log.debug( "{}Checking if setting is the same {} {}".format( indent, existingConfigurableInstance.getFullName(), newConf2Instance.getFullJobOptName() ) )
alreadySetProperties = dict([ (pname, pvalue) for pname,pvalue
in six.iteritems(existingConfigurableInstance.getValuedProperties()) ])
_log.debug("Existing properties: {}".format(alreadySetProperties))
_log.debug("New properties: {}".format(newConf2Instance._properties))
for pname, pvalue in six.iteritems( newConf2Instance._properties ): # six.iteritems(comp._properties):
if __isOldConfigurable( pvalue ):
_log.warning( "{}New configuration object {} property {} has legacy configuration components assigned to it {}"
......@@ -939,10 +954,31 @@ def conf2toConfigurable( comp, indent="" ):
_log.warning( "Skipping comparison, no guarantees about configuration consistency" )
continue
propType = newConf2Instance._descriptors[pname].cpp_type
_log.debug("{}Comparing type: {}".format(indent, propType))
_log.debug("{}Comparing type: {} for: {}".format(indent, propType, pname))
if "PrivateToolHandleArray" in propType:
for oldC, newC in zip( alreadySetProperties[pname], pvalue):
__areSettingsSame( oldC, newC, __indent(indent))
toolDict = {_.getName(): _ for _ in alreadySetProperties[pname]}
_log.debug('Private tool properties? {}'.format(toolDict))
newCdict = {_.getName() : _ for _ in pvalue}
oldCset = set(toolDict); newCset = set(newCdict)
_log.debug('Private tool property names? {} {}'.format(oldCset, newCset))
for oldC in oldCset & newCset:
__areSettingsSame( toolDict[oldC], newCdict[oldC], __indent(indent))
for newC in newCset-oldCset:
# clone new config to old array
alreadySetProperties[pname].append(conf2toConfigurable(newCdict[newC]))
elif "PublicToolHandleArray" in propType:
toolSet = {_.getName() for _ in alreadySetProperties[pname]}
_log.debug('Public tool handle array properties? {} {}'.format(toolSet, pvalue))
# strings?
for newC in pvalue:
if isinstance(newC, six.string_types):
pubtoolclass, pubtoolname = newC.split('/')
if pubtoolname not in toolSet:
klass = __findConfigurableClass( pubtoolclass )
alreadySetProperties[pname].append(klass( pubtoolname ))
else:
_log.warning('Not handling actual Configurable2s for public tool merging yet')
raise Exception()
elif "PrivateToolHandle" in propType or "GaudiConfig2.Configurables" in propType or "ServiceHandle" in propType:
existingVal = getattr(existingConfigurableInstance, pname)
if isinstance( pvalue, str ):
......@@ -951,10 +987,13 @@ def conf2toConfigurable( comp, indent="" ):
_log.debug( "{}Some kind of handle and, object type {} existing {}".format( indent, type(pvalue), type(existingVal) ) )
__areSettingsSame( existingVal, pvalue, indent)
else:
pvalue=__listHelperToList(pvalue)
if isinstance(pvalue,(GaudiConfig2.semantics._ListHelper,GaudiConfig2.semantics._DictHelper)):
pvalue=pvalue.data
if pname not in alreadySetProperties:
continue
if alreadySetProperties[pname] != pvalue:
_log.info("{}Adding property: {} for {}".format(indent, pname, newConf2Instance.getName() ))
setattr(existingConfigurableInstance, pname, pvalue)
elif alreadySetProperties[pname] != pvalue:
_log.info("{}Merging property: {} for {}".format(indent, pname, newConf2Instance.getName() ))
# create surrogate
clone = newConf2Instance.getInstance("Clone")
......@@ -971,7 +1010,7 @@ def conf2toConfigurable( comp, indent="" ):
_log.debug( "{}Pre-existing configurable {} was found, checking if has the same properties".format( indent, comp.getName() ) )
__areSettingsSame( existingConfigurable, comp )
_log.debug( "{}Pre-existing configurable was found to have the same properties".format( indent, comp.name ) )
instance = existingConfigurable
instance = existingConfigurable if not suppressDupes else None
else: # create new configurable
_log.debug( "{}Creating component configurable {}".format( indent, comp.getFullJobOptName() ) )
configurableClass = __findConfigurableClass( comp.getFullJobOptName().split( "/" )[0] )
......@@ -1002,14 +1041,22 @@ def appendCAtoAthena(ca):
_log = logging.getLogger( "conf2toConfigurable".ljust(32) )
_log.info( "Merging of CA to global ..." )
from AthenaCommon.AppMgr import ServiceMgr,ToolSvc,theApp,athCondSeq,athOutSeq,athAlgSeq,topSequence
if len( ca.getPublicTools() ) != 0:
_log.info( "Merging public tools" )
for comp in ca.getPublicTools():
instance = conf2toConfigurable( comp, indent=" " )
if instance not in ToolSvc:
ToolSvc += instance
if len(ca.getServices()) != 0:
_log.info( "Merging services" )
for comp in ca.getServices():
instance = conf2toConfigurable( comp, indent=" " )
if instance not in ServiceMgr:
ServiceMgr += instance
for svcName in ca._servicesToCreate:
theApp.CreateSvc += [svcName]
if len(ca._conditionsAlgs) != 0:
_log.info( "Merging condition algorithms" )
......@@ -1018,13 +1065,6 @@ def appendCAtoAthena(ca):
if instance not in athCondSeq:
athCondSeq += instance
if len( ca.getPublicTools() ) != 0:
_log.info( "Merging public tools" )
for comp in ca.getPublicTools():
instance = conf2toConfigurable( comp, indent=" " )
if instance not in ToolSvc:
ToolSvc += instance
if len( ca.getAppProps() ) != 0:
_log.info( "Merging ApplicationMgr properties" )
for (propName, propValue) in six.iteritems(ca.getAppProps()):
......@@ -1066,8 +1106,10 @@ def appendCAtoAthena(ca):
if el.__class__.__name__ == "AthSequencer":
__mergeSequences( sequence, el, __indent( indent ) )
elif el.getGaudiType() == "Algorithm":
sequence += conf2toConfigurable( el, indent=__indent( indent ) )
_log.info( "{}Algorithm {} and added to the sequence {}".format( __indent( indent ), el.getFullJobOptName(), sequence.name() ) )
toadd = conf2toConfigurable( el, indent=__indent( indent ), suppressDupes=True)
if toadd is not None:
sequence += toadd
_log.info( "{}Algorithm {} and added to the sequence {}".format( __indent( indent ), el.getFullJobOptName(), sequence.name() ) )
preconfigured = [athCondSeq,athOutSeq,athAlgSeq,topSequence]
......
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
def JobOptsDumperCfg(flags, FileName="JobOptsConfig.txt"):
"""Return ComponentAccumulator with JobOptsDumperAlg.
This dumps the configuration to text in a file named by FileName.
"""
acc = ComponentAccumulator()
acc.addEventAlgo(CompFactory.JobOptsDumperAlg(FileName=FileName))
return acc
......@@ -77,8 +77,10 @@ def MainServicesCfg(cfgFlags):
cfg.addService(StoreGateSvc("DetectorStore"))
cfg.addService(StoreGateSvc("HistoryStore"))
cfg.addService(StoreGateSvc("ConditionStore"))
cfg.addService(CompFactory.CoreDumpSvc())
cfg.addService(CompFactory.GeoModelSvc(), create=True)
cfg.addService(CompFactory.DetDescrCnvSvc(), create=True)
cfg.addService(CompFactory.CoreDumpSvc(), create=True)
cfg.setAppProperty('InitializationLoopCheck',False)
......
......@@ -123,9 +123,9 @@ def _loadSingleFile(fname, args):
conf = [to_json, props[0], props[1]]
elif isinstance(cfg, collections.defaultdict): # old configuration
cfg.update(pickle.load(input_file))
conf.append(pickle.load(input_file))
conf.append(cfg)
for _ in range(2):
conf.append(pickle.load(input_file))
print("... Read", len(conf), "items from python pickle file: ", fname)
elif fname.endswith(".json"):
......
......@@ -6,26 +6,26 @@
#define ATHASGEXUNITTEST_MYPACKAGETOOL_H 1
#include "AsgTools/AsgTool.h"
#include "IMyPackageTool.h"
#include "AthAsgExUnittest/IMyPackageTool.h"
class MyPackageTool: public asg::AsgTool, public virtual IMyPackageTool {
public:
class MyPackageTool: public asg::AsgTool, public virtual IMyPackageTool {
public:
ASG_TOOL_CLASS( MyPackageTool, IMyPackageTool )
// Add another constructor for non-athena use cases
MyPackageTool( const std::string& name );
// Initialize is required by AsgTool base class
virtual StatusCode initialize() override;
// This tools method
virtual double useTheProperty() override;
private:
private:
double m_nProperty;
unsigned int m_enumProperty;
unsigned int m_enumProperty;
};
};
#endif //> !ATHASGEXUNITTEST_MYPACKAGETOOL_H
......@@ -3,30 +3,37 @@
# Declare the package name:
atlas_subdir( AthAsgExUnittest )
# Necessary external(s).
find_package( GTest )
find_package( GMock )
# Libraries in the package:
atlas_add_library( AthAsgExUnittestLib
MyPackage/*.h src/*.cxx
Root/*.cxx
NO_PUBLIC_HEADERS
LINK_LIBRARIES GaudiKernel AsgTools AthAnalysisBaseCompsLib )
AthAsgExUnittest/*.h Root/*.cxx
PUBLIC_HEADERS AthAsgExUnittest
LINK_LIBRARIES AsgTools )
atlas_add_component( AthAsgExUnittest
src/components/*.cxx
LINK_LIBRARIES AthAsgExUnittestLib )
src/*.h src/*.cxx src/components/*.cxx
LINK_LIBRARIES AthAnalysisBaseCompsLib AsgTools AthAsgExUnittestLib )
# Add tests:
atlas_add_test( gt_AthAsgExUnittest
SOURCES test/gt_AthAsgExUnittest.cxx
LINK_LIBRARIES GaudiKernel GoogleTestTools AthAsgExUnittestLib )
LINK_LIBRARIES GaudiKernel GoogleTestTools AsgTools AthAnalysisBaseCompsLib
AthAsgExUnittestLib )
atlas_add_test( gt_AthExUnittest
SOURCES test/gt_AthExUnittest.cxx
LINK_LIBRARIES GaudiKernel GoogleTestTools AthenaBaseComps AsgTools )
LINK_LIBRARIES GaudiKernel GoogleTestTools AthenaBaseComps
AthAsgExUnittestLib )
atlas_add_test( gt_MockxAODJet
SOURCES test/gt_MockxAODJet.cxx
LINK_LIBRARIES xAODJet GoogleTestTools )
INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS}
LINK_LIBRARIES ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} xAODJet )
atlas_add_test( gt_xAODJet
SOURCES test/gt_xAODJet.cxx
LINK_LIBRARIES xAODJet GoogleTestTools )
INCLUDE_DIRS ${GTEST_INCLUDE_DIRS}
LINK_LIBRARIES ${GTEST_LIBRARIES} xAODJet )
......@@ -4,13 +4,13 @@
//
// MyPackage includes
#include "../src/MyPackageTool.h"
#include "AthAsgExUnittest/MyPackageTool.h"
MyPackageTool::MyPackageTool( const std::string& name ) : asg::AsgTool( name ) {
//example property declarations with default values
declareProperty( "Property", m_nProperty = 3.0,
declareProperty( "Property", m_nProperty = 3.0,
"Please describe the property here" );
declareProperty( "ENumProperty", m_enumProperty = Val1,
declareProperty( "ENumProperty", m_enumProperty = Val1,
"Please define enums inside your classes, not just in namespaces" );
}
......@@ -27,4 +27,3 @@ StatusCode MyPackageTool::initialize() {
double MyPackageTool::useTheProperty() {
return m_nProperty;
}
// -*- mode: c++ -*-
//
// Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
//
#ifndef ATHASGEXUNITTEST_MYPACKAGEALG_H
......@@ -12,24 +12,24 @@
#include "AsgTools/AnaToolHandle.h" //use asg::AnaToolHandle instead of regular ToolHandles for full dual-use experience!
#endif
#include "IMyPackageTool.h"
#include "AthAsgExUnittest/IMyPackageTool.h"
class MyPackageAlg: public ::AthAnalysisAlgorithm {
public:
class MyPackageAlg: public ::AthAnalysisAlgorithm {
public:
MyPackageAlg( const std::string& name, ISvcLocator* pSvcLocator );
virtual ~MyPackageAlg();
virtual ~MyPackageAlg();
virtual StatusCode initialize() override;
virtual StatusCode execute() override;
virtual StatusCode finalize() override;
private:
private:
int m_property;
ToolHandle<IMyPackageTool> m_tool;
};
};
#endif //> !ATHASGEXUNITTEST_MYPACKAGEALG_H
//
// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
//
#include "AthAsgExUnittest/MyPackageTool.h"
#include "../MyPackageAlg.h"
DECLARE_COMPONENT( MyPackageAlg )
#include "../MyPackageTool.h"
DECLARE_COMPONENT( MyPackageTool )
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