From c5234c6044ee632b336f44ca35304de38d72d32c Mon Sep 17 00:00:00 2001 From: Sebastien Ponce <sebastien.ponce@cern.ch> Date: Mon, 2 Dec 2024 09:12:50 +0100 Subject: [PATCH] Dropped unused parts of GaudiAlg --- DAQ/DAQSys/python/DAQSys/DecoderClass.py | 552 ------ GaudiAlg/CMakeLists.txt | 14 +- GaudiAlg/dict/dictionary.h | 9 - GaudiAlg/dict/selection.xml | 4 - GaudiAlg/include/GaudiAlg/EventCounter.h | 51 - GaudiAlg/include/GaudiPython/AlgDecorators.h | 122 -- GaudiAlg/include/GaudiPython/HistoDecorator.h | 417 ----- GaudiAlg/include/GaudiPython/PyAlg.h | 76 - GaudiAlg/include/GaudiPython/TupleDecorator.h | 359 ---- GaudiAlg/python/GaudiAlg/Algs.py | 1631 ----------------- GaudiAlg/python/GaudiAlg/HistoUtils.py | 1070 ----------- GaudiAlg/python/GaudiAlg/TupleUtils.py | 233 --- GaudiAlg/python/GaudiAlg/__init__.py | 0 GaudiAlg/src/components/GaudiAlg_entries.cpp | 2 - GaudiAlg/src/examples/MyGaudiAlgorithm.cpp | 166 -- GaudiAlg/src/lib/AlgDecorators.cpp | 168 -- GaudiAlg/src/lib/EventCounter.cpp | 42 - GaudiAlg/src/lib/HistoDecorator.cpp | 640 ------- GaudiAlg/src/lib/TupleDecorator.cpp | 499 ----- .../qmtest/gaudialg.qms/algsequencer.qmt | 16 - .../gaudialg.qms/algsequencer_pyopts.qmt | 17 - .../tests/qmtest/gaudialg.qms/algtools.qmt | 17 - .../qmtest/gaudialg.qms/gaudipython_mix.qmt | 16 - .../qmtest/gaudialg.qms/histo.qms/ex.qmt | 16 - .../qmtest/gaudialg.qms/histo.qms/ex1.qmt | 16 - .../qmtest/gaudialg.qms/histo.qms/ex2.qmt | 25 - .../qmtest/gaudialg.qms/histo_ascii_dump.qmt | 15 - .../qmtest/gaudialg.qms/histoutilsex.qmt | 16 - .../gaudialg.qms/python.qms/aida2rootex.qmt | 23 - .../gaudialg.qms/python.qms/bug_38882.qmt | 21 - .../gaudialg.qms/python.qms/counter.qmt | 21 - .../gaudialg.qms/python.qms/evtcolread.qmt | 19 - .../gaudialg.qms/python.qms/evtcolwrite.qmt | 19 - .../qmtest/gaudialg.qms/timing_histos.qmt | 44 - .../qmtest/gaudialg.qms/tuple.qms/ex1.qmt | 19 - .../qmtest/gaudialg.qms/tuple.qms/ex2.qmt | 16 - .../qmtest/gaudialg.qms/tuple.qms/ex_py.qmt | 16 - .../tests/qmtest/options/AlgSequencer.opts | 55 - GaudiAlg/tests/qmtest/options/AlgSequencer.py | 63 - GaudiAlg/tests/qmtest/options/AlgTools.py | 76 - .../tests/qmtest/options/TimingHistograms.py | 34 - GaudiAlg/tests/qmtest/refs/AlgSequencer.ref | 281 --- .../tests/qmtest/refs/AlgSequencer_pyopts.ref | 258 --- GaudiAlg/tests/qmtest/refs/AlgTools.ref | 357 ---- GaudiAlg/tests/qmtest/refs/Mix.ref | 171 -- .../tests/qmtest/refs/TimingHistograms.ref | 263 --- GaudiAlg/tests/qmtest/scripts/Aida2RootEx.py | 206 --- GaudiAlg/tests/qmtest/scripts/Counter.py | 133 -- GaudiAlg/tests/qmtest/scripts/EvtColWrite.py | 151 -- GaudiAlg/tests/qmtest/scripts/HistoEx.py | 110 -- GaudiAlg/tests/qmtest/scripts/HistoEx1.py | 114 -- GaudiAlg/tests/qmtest/scripts/HistoEx2.py | 108 -- GaudiAlg/tests/qmtest/scripts/Mix.py | 112 -- GaudiAlg/tests/qmtest/scripts/TupleEx.py | 130 -- GaudiAlg/tests/qmtest/scripts/TupleEx1.py | 213 --- GaudiAlg/tests/qmtest/scripts/TupleEx2.py | 159 -- GaudiAlg/tests/qmtest/scripts/bug_38882.py | 74 - GaudiConf/python/GaudiConf/IOHelper.py | 55 +- GaudiConf/python/GaudiConf/Manipulations.py | 211 --- GaudiConf/tests/options/test-manipulations.py | 99 - .../qmtest/gaudiconf.qms/manipulations.qmt | 26 - Phys/LoKiCore/CMakeLists.txt | 1 - Phys/LoKiCore/src/Components/CounterAlg.cpp | 260 --- PyConf/options/example.py | 81 - PyConf/python/PyConf/__init__.py | 4 +- PyConf/python/PyConf/importers.py | 4 +- PyConf/python/PyConf/tests/test_algorithm.py | 37 +- PyConf/tests/qmtest/test_diffopts_pkl.qmt | 29 - PyConf/tests/qmtest/test_example.qmt | 44 - PyConf/tests/qmtest/test_example_pkl.qmt | 24 - 70 files changed, 60 insertions(+), 10290 deletions(-) delete mode 100644 DAQ/DAQSys/python/DAQSys/DecoderClass.py delete mode 100644 GaudiAlg/include/GaudiAlg/EventCounter.h delete mode 100644 GaudiAlg/include/GaudiPython/AlgDecorators.h delete mode 100644 GaudiAlg/include/GaudiPython/HistoDecorator.h delete mode 100644 GaudiAlg/include/GaudiPython/PyAlg.h delete mode 100644 GaudiAlg/include/GaudiPython/TupleDecorator.h delete mode 100644 GaudiAlg/python/GaudiAlg/Algs.py delete mode 100644 GaudiAlg/python/GaudiAlg/HistoUtils.py delete mode 100644 GaudiAlg/python/GaudiAlg/TupleUtils.py delete mode 100644 GaudiAlg/python/GaudiAlg/__init__.py delete mode 100644 GaudiAlg/src/examples/MyGaudiAlgorithm.cpp delete mode 100644 GaudiAlg/src/lib/AlgDecorators.cpp delete mode 100644 GaudiAlg/src/lib/EventCounter.cpp delete mode 100644 GaudiAlg/src/lib/HistoDecorator.cpp delete mode 100644 GaudiAlg/src/lib/TupleDecorator.cpp delete mode 100644 GaudiAlg/tests/qmtest/gaudialg.qms/algsequencer.qmt delete mode 100644 GaudiAlg/tests/qmtest/gaudialg.qms/algsequencer_pyopts.qmt delete mode 100644 GaudiAlg/tests/qmtest/gaudialg.qms/algtools.qmt delete mode 100644 GaudiAlg/tests/qmtest/gaudialg.qms/gaudipython_mix.qmt delete mode 100644 GaudiAlg/tests/qmtest/gaudialg.qms/histo.qms/ex.qmt delete mode 100644 GaudiAlg/tests/qmtest/gaudialg.qms/histo.qms/ex1.qmt delete mode 100644 GaudiAlg/tests/qmtest/gaudialg.qms/histo.qms/ex2.qmt delete mode 100644 GaudiAlg/tests/qmtest/gaudialg.qms/histo_ascii_dump.qmt delete mode 100644 GaudiAlg/tests/qmtest/gaudialg.qms/histoutilsex.qmt delete mode 100644 GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/aida2rootex.qmt delete mode 100644 GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/bug_38882.qmt delete mode 100644 GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/counter.qmt delete mode 100644 GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/evtcolread.qmt delete mode 100644 GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/evtcolwrite.qmt delete mode 100644 GaudiAlg/tests/qmtest/gaudialg.qms/timing_histos.qmt delete mode 100644 GaudiAlg/tests/qmtest/gaudialg.qms/tuple.qms/ex1.qmt delete mode 100644 GaudiAlg/tests/qmtest/gaudialg.qms/tuple.qms/ex2.qmt delete mode 100644 GaudiAlg/tests/qmtest/gaudialg.qms/tuple.qms/ex_py.qmt delete mode 100644 GaudiAlg/tests/qmtest/options/AlgSequencer.opts delete mode 100644 GaudiAlg/tests/qmtest/options/AlgSequencer.py delete mode 100644 GaudiAlg/tests/qmtest/options/AlgTools.py delete mode 100644 GaudiAlg/tests/qmtest/options/TimingHistograms.py delete mode 100644 GaudiAlg/tests/qmtest/refs/AlgSequencer.ref delete mode 100644 GaudiAlg/tests/qmtest/refs/AlgSequencer_pyopts.ref delete mode 100644 GaudiAlg/tests/qmtest/refs/AlgTools.ref delete mode 100644 GaudiAlg/tests/qmtest/refs/Mix.ref delete mode 100644 GaudiAlg/tests/qmtest/refs/TimingHistograms.ref delete mode 100755 GaudiAlg/tests/qmtest/scripts/Aida2RootEx.py delete mode 100755 GaudiAlg/tests/qmtest/scripts/Counter.py delete mode 100755 GaudiAlg/tests/qmtest/scripts/EvtColWrite.py delete mode 100755 GaudiAlg/tests/qmtest/scripts/HistoEx.py delete mode 100755 GaudiAlg/tests/qmtest/scripts/HistoEx1.py delete mode 100755 GaudiAlg/tests/qmtest/scripts/HistoEx2.py delete mode 100755 GaudiAlg/tests/qmtest/scripts/Mix.py delete mode 100755 GaudiAlg/tests/qmtest/scripts/TupleEx.py delete mode 100755 GaudiAlg/tests/qmtest/scripts/TupleEx1.py delete mode 100755 GaudiAlg/tests/qmtest/scripts/TupleEx2.py delete mode 100755 GaudiAlg/tests/qmtest/scripts/bug_38882.py delete mode 100644 GaudiConf/python/GaudiConf/Manipulations.py delete mode 100644 GaudiConf/tests/options/test-manipulations.py delete mode 100755 GaudiConf/tests/qmtest/gaudiconf.qms/manipulations.qmt delete mode 100644 Phys/LoKiCore/src/Components/CounterAlg.cpp delete mode 100644 PyConf/options/example.py delete mode 100644 PyConf/tests/qmtest/test_diffopts_pkl.qmt delete mode 100644 PyConf/tests/qmtest/test_example.qmt delete mode 100644 PyConf/tests/qmtest/test_example_pkl.qmt diff --git a/DAQ/DAQSys/python/DAQSys/DecoderClass.py b/DAQ/DAQSys/python/DAQSys/DecoderClass.py deleted file mode 100644 index 14f365dd9a6..00000000000 --- a/DAQ/DAQSys/python/DAQSys/DecoderClass.py +++ /dev/null @@ -1,552 +0,0 @@ -############################################################################### -# (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration # -# # -# This software is distributed under the terms of the GNU General Public # -# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -############################################################################### -""" -Module to hold the configurabloid python class for decoder-like objects. -class: Decoder -and also simple manipulators of the database it creates: -validate(db), decodersForBank(db,bank,ignoreActive=False), decoderToLocation(db,location,ignoreActive=False) -""" -from builtins import object -from GaudiConf.Manipulations import configurableInstanceFromString, addPrivateToolFromString -from GaudiKernel.DataHandle import DataHandle - - -class Decoder(object): - """ - A sort of configurabloid which adds itself to a database of possible decoders to configure. - - Gets around the annoying problem that all decoders seem to be written completely differently from each other - - Members: - FullName="" #the full Gaudi name of the low-level configurable - Active=False # Flags this as an alg to be configured, which somehow writes something on the TES - Banks={} # list of banks I decode - Inputs={} # list of input locations or {Property : value dict} - Outputs={} # list of output locations or {Property: value} dict - Properties={} # {Property: value dict of misc properties - PrivateTools=[] #related private tools, must also be in the DB at configuration time - PublicTools=[] #related public tools, must also be in the DB at configuration time - Required=[] list of possible decoders which must be run before me, should also be defined in the DB - - Private member: - __db__ reference to the databse in which I am stored. Can be overwritten if required, or used to validate the database. Used to find the public/private tools. - __used__: someone has actually used this tool - """ - FullName = "" #the full Gaudi name of the low-level configurable - Active = False # Flags this as an alg to be configured, which somehow writes something on the TES - Banks = {} # list of banks I decode - Inputs = {} # list of input locations or {Property : value dict} - Outputs = {} # list of output locations or {Property: value} dict - Properties = {} # {Property: value dict of misc properties - PrivateTools = [ - ] #related private toolsmust also be in the DB at configuration time - PublicTools = [ - ] #related public tools, must also be in the DB at configuration time - Required = [ - ] #related public tools, must also be in the DB at configuration time - - def __init__(self, - fullname, - active, - banks=[], - inputs={}, - outputs={}, - properties={}, - privateTools=[], - publicTools=[], - required=[], - conf=None): - """ - Create a decoder configurabloid. Options: - fullname: The full Gaudi name for this algorithm, Type/InstanceName - active: flag in the DB to prompt auto configuration - banks: list of banks this decoder can work on - Inputs: dictionary of property->location - Outputs: dictionary of property->location - Properties: {Attribute: value} - PrivateTools: list of possible decoder private tools, which should also be defined in the DB - PublicTools: list of possible decoder public tools, which should also be defined in the DB - Required: list of possible decoders which must be run before me, should also be defined in the DB - conf: a database of decoders, a dictionary to add myself to, keyed by my name, it's where I expect to find my tools - - PrivateTools and PublicTools are configured at the same time as this decoder, providing that they exist in the DB. - Required partners are not configured automatically, but must be declared active and configured separately. - """ - #ensure I actually construct the members!! - self.FullName = "" #the full Gaudi name of the low-level configurable - self.Active = False # Flags this as an alg to be configured, which somehow writes something on the TES - self.Banks = {} # list of banks I decode - self.Inputs = {} # list of input locations or {Property : value dict} - self.Outputs = {} # list of output locations or {Property: value} dict - self.Properties = {} # {Property: value dict of misc properties - self.PrivateTools = [ - ] #related private toolsmust also be in the DB at configuration time - self.PublicTools = [ - ] #related public tools, must also be in the DB at configuration time - self.Required = [ - ] #required other algorithms, must also be in the DB at configuration time - #deepcopy things that were sent in... - self.FullName = fullname[:] - self.Active = active - self.__used__ = False - self.Banks = banks[:] - tipi = type(inputs) - self.Inputs = tipi(inputs) - tipo = type(outputs) - self.Outputs = tipo(outputs) - self.Properties = dict(properties) - self.PrivateTools = privateTools[:] - self.PublicTools = publicTools[:] - self.Required = required - if conf is not None: - conf[self.FullName] = self - self.__db__ = conf - - def listRequired(self): - """ - Return a unique ordered list of the requirements, i.e entries added to 'Required', from lowest to highest level - """ - retlist = [] - for alg in self.PrivateTools + self.PublicTools: - if alg not in self.__db__: - continue - res = self.__db__[alg].listRequired() - res.reverse() - retlist += res - for alg in self.Required: - if alg not in self.__db__: - continue - retlist += [alg] - res = self.__db__[alg].listRequired() - res.reverse() - retlist += res - retlist.reverse() - unique = [] - for alg in retlist: - if alg not in unique: - unique.append(alg) - return unique - - def allDaughters(self): - """ - Return a unique ordered list of all the daugter tools and required algorithms, from lowest to highest level - """ - retlist = [] - for alg in self.PrivateTools + self.PublicTools: - if alg not in self.__db__: - continue - retlist += [alg] - res = self.__db__[alg].allDaughters() - res.reverse() - retlist += res - for alg in self.Required: - if alg not in self.__db__: - continue - retlist += [alg] - res = self.__db__[alg].allDaughters() - res.reverse() - retlist += res - retlist.reverse() - unique = [] - for alg in retlist: - if alg not in unique: - unique.append(alg) - return unique - - def activate(self): - self.Active = True - - def deactivate(self): - self.Active = False - - def wasUsed(self): - """ - setup was called on this decoder already somewhere... - """ - return (self.__used__ == True) - - def clone(self, newname): - """return another copy of this guy with a new name - deep copy dictionaries, but not the DB!!""" - ip = self.Inputs - op = self.Outputs - pr = self.Properties - #construct new dictionaries to avoid having the same objects - tipi = type(ip) - ip = tipi(ip) - tipo = type(op) - op = tipo(op) - tipp = type(pr) - pr = tipp(pr) - return Decoder(newname, self.Active, self.Banks[:], ip, op, pr, - self.PrivateTools[:], self.PublicTools[:], - self.Required[:], self.__db__) - - def __setprop__(self, top, prop, val): - """ - Handle tool handles? not 100% sure... - """ - if "." in prop: - anattr = prop.split('.')[0] - newprop = prop.replace(anattr + '.', '') - self.__propagate__(getattr(top, anattr), newprop, val) - else: - if hasattr(top, "setProp"): - top.setProp(prop, val) - else: - setattr(top, prop, val) - - def __getprop__(self, top, prop): - """ - Handle tool handles? not 100% sure... - """ - if "." in prop: - anattr = prop.split('.')[0] - newprop = prop.replace(anattr + '.', '') - return self.__getprop__(getattr(top, anattr), newprop) - else: - if hasattr(top, "getProp"): - return top.getProp(prop) - else: - return getattr(top, prop) - - def overrideInputs(self, input): - """ - Set a List of input locations to search, set to all daughters - """ - if not self.isInputSettable(): - raise AttributeError("My input is not settable " + self.FullName) - #if type(self.Inputs) is list and len(self.Inputs): - # if type(input) is list: - # self.Inputs=input - # if type(input) is str: - # self.Inputs=[input] - if type(self.Inputs) is dict and len(self.Inputs): - for k, ip in self.Inputs.items(): - ensuretype = list - if ip is None: - #determine default type, first get my configurable - thedecoder = configurableInstanceFromString(self.FullName) - ensuretype = type(self.__getprop__(thedecoder, k)) - else: - ensuretype = type(ip) - if type(input) == ensuretype: - self.Inputs[k] = input - elif type(input) is list and len( - input) > 0 and ensuretype is str: - raise TypeError( - self.FullName + - " cannot set property of type list to this string, " + - self.FullName + " " + input.__str__()) - elif ensuretype is list and type(input) is str: - self.Inputs[k] = [input] - elif ensuretype is DataHandle: - path = input if type(input) is str else ':'.join(input) - self.Inputs[k] = DataHandle(path) - else: - raise TypeError( - self.FullName + " cannot convert input from type " + - str(type(input)) + " to " + str(ensuretype)) - #then cascade downwards - for tool in self.PublicTools + self.PrivateTools: - if tool in self.__db__: - if self.__db__[tool].isInputSettable(): - self.__db__[tool].overrideInputs(input) - - def overrideOutputs(self, output): - """ - Set a list or dict of OutputLocations, set to all daughters - """ - #print "GAAAAAAAHHHHHHHHH!!!!!!", output, self.FullName - if not self.isOutputSettable(): - raise AttributeError("My output is not settable " + self.FullName) - if type(self.Outputs) is list and len(self.Outputs): - raise TypeError(self.FullName + ": outputs must be a dict, not " + - str(type(self.Outputs))) - if type(self.Outputs) is dict and len(self.Outputs): - #print "recognized I can set the output" - for k, op in self.Outputs.items(): - #get this entry in any supplied dictionary - setoutput = output - if type(setoutput) is dict: - if k in setoutput: - setoutput = setoutput[k] - else: - continue - #determine the type I need to set - ensuretype = list - if op is None: - #determine default type, first get my configurable - thedecoder = configurableInstanceFromString(self.FullName) - prop = self.__getprop__(thedecoder, k) - if isinstance(prop, DataHandle): - # special case for datahandles - ensuretype = str - else: - ensuretype = type(prop) - else: - ensuretype = type(op) - #set this type - #print "Type converted" - if type(setoutput) == ensuretype: - self.Outputs[k] = setoutput - elif type(setoutput) is list and ( - len(setoutput) > 1 - or len(setoutput) == 0) and ensuretype is str: - raise TypeError( - "Cannot set property of type list to this string, " + - self.FullName + " " + setoutput.__str__()) - elif type(setoutput) is list and len( - setoutput) == 1 and ensuretype is str: - self.Outputs[k] = setoutput[0] - elif ensuretype is list and type(setoutput) is str: - self.Outputs[k] = [setoutput] - else: - raise TypeError( - self.FullName + ": Cannot convert from type " + - str(type(setoutput)) + " to " + str(ensuretype)) - #then cascade downwards - for tool in self.PublicTools + self.PrivateTools: - if tool in self.__db__: - if self.__db__[tool].isOutputSettable(): - self.__db__[tool].overrideOutputs(output) - - def listOutputs(self): - """ - Cascade down the database and find all output locations - """ - outputs = [] - #maybe I'm just a list - if type(self.Outputs) is list: - outputs = outputs + self.Outputs - #or I'm a dict - elif type(self.Outputs) is dict: - for key in self.Outputs: - #do I have to be found from the configurable? - if self.Outputs[key] is None: - #OK, find me then - ops = self.__getprop__( - configurableInstanceFromString(self.FullName), key) - else: - #no? well add me to the list - ops = self.Outputs[key] - - #only add if not already in the list - if ops is not None and type(ops) is str: - ops = [ops] - elif isinstance(ops, DataHandle): - ops = ops.Path.split(":") - for op in ops: - if op not in outputs: - outputs.append(op) - #cascade down the tools - for tool in self.PrivateTools + self.PublicTools: - if tool in self.__db__: - thieroutputs = self.__db__[tool].listOutputs() - outputs = outputs + [ - val for val in thieroutputs if val not in outputs - ] - return outputs - - def listInputs(self): - """ - Cascade down the database and find all input locations - """ - inputs = [] - #maybe I'm just a list - if type(self.Inputs) is list: - inputs = inputs + self.Inputs - #or I'm a dict - elif type(self.Inputs) is dict: - for key in self.Inputs: - #do I have to be found from the configurable? - if self.Inputs[key] is None: - #OK, find me then - ips = self.__getprop__( - configurableInstanceFromString(self.FullName), key) - else: - #no? well add me to the list - ips = self.Inputs[key] - - #only add if not already in the list - if type(ips) is str: - ips = [ips] - elif isinstance(ips, DataHandle): - ips = ips.Path.split(":") - for ip in ips: - if ip not in inputs: - inputs.append(ip) - #cascade down the tools - for tool in self.PrivateTools + self.PublicTools: - if tool in self.__db__: - thierinputs = self.__db__[tool].listInputs() - inputs = inputs + [ - val for val in thierinputs if val not in inputs - ] - return inputs - - def isInputSettable(self): - """ - Cascade down the database and work out if you can set my inputs - """ - if (type(self.Inputs) is dict and len(self.Inputs)): - return True - for tool in self.PrivateTools + self.PublicTools: - if tool in self.__db__: - if self.__db__[tool].isInputSettable(): - return True - return False - - def isOutputSettable(self): - """ - Cascade down the database and work out if you can set my outputs - """ - if (type(self.Outputs) is dict and len(self.Outputs)): - return True - if self.__db__ is None: - return False - for tool in self.PrivateTools + self.PublicTools: - if tool in self.__db__: - if self.__db__[tool].isOutputSettable(): - return True - return False - - def setup(self, cascade=True, configured=None, onlyInputs=False): - """ - Return the configured configurable of this algorithm or public tool. Options: - cascade: whether to follow down and configure the private tools of this alg also. - configured: internal use only for configuring private tools - """ - thedecoder = configured - if thedecoder is None: - thedecoder = configurableInstanceFromString(self.FullName) - #configure me - if type(self.Inputs) is dict: - for prop in self.Inputs: - if self.Inputs[prop] is not None: - self.__setprop__(thedecoder, prop, self.Inputs[prop]) - if not onlyInputs: - for prop in self.Properties: - if self.Properties[prop] is not None: - self.__setprop__(thedecoder, prop, self.Properties[prop]) - if type(self.Outputs) is dict: - for prop in self.Outputs: - if self.Outputs[prop] is not None: - self.__setprop__(thedecoder, prop, self.Outputs[prop]) - if not cascade or self.__db__ is None: - self.__used__ = True - return thedecoder - #configure public tools - for atool in self.PublicTools: - if atool in self.__db__: - self.__db__[atool].setup(True, onlyInputs=onlyInputs) - else: - raise KeyError( - "Error: " + atool + - " not found in DB, set cascade=False, remove this from the list, or re-validate the db" - ) - #configure private tools - for atool in self.PrivateTools: - if atool in self.__db__: - thetool = addPrivateToolFromString(thedecoder, atool) - self.__db__[atool].setup(True, thetool, onlyInputs=onlyInputs) - else: - raise KeyError( - "Error: " + atool + - " not found in DB, set cascade=False, remove this from the list, or re-validate the db" - ) - self.__used__ = True - return thedecoder - - -# =============== Database tools ======================= - - -def validate(db): - for k, v in db.items(): - if k != v.FullName: - raise KeyError( - "A decoder has had its name changed, but wasn't updated in the DB..." - + k + " -> " + v.FullName) - if v.__db__ != db: - raise AttributeError( - "A decoder in this database thinks it is not in this database... try again! " - + k) - for tool in v.PublicTools + v.PrivateTools: - if tool not in db: - raise KeyError( - "A decoder is asking for a tool which hasn't been put in this database... try again! " - + v.FullName + "-> " + tool) - for alg in v.Required: - if alg not in db: - raise KeyError( - "A decoder requires another decoder which is hasn't been put in this database... try again! " - + v.FullName + "-> " + alg) - if v.Active and not db[alg].Active: - raise ValueError( - "An active decoder requires another which isn't set as active! " - + v.FullName + "-> " + alg) - return True - - -def decodersForBank(db, bank, ignoreActive=False, addRequired=False): - """ - Obtain a list of decoders for a given bank - options: - - ignoreActive: Whether to ignore active flags, by default False, only consider 'active' algs - addRequired: Whether to follow down to any required algs which might decode other banks, - by default False, don't return required algs - - """ - retlist = [] - for k, v in db.items(): - if not ignoreActive and not v.Active: - continue - if bank in v.Banks: - if addRequired: - for l in v.listRequired(): - if l not in retlist: - retlist.append(l) - retlist.append(v) - return retlist - - -def decoderToLocation(db, location, ignoreActive=False): - """ - Obtain the decoder whose output is going *to* the location specified - """ - retlist = [] - for k, v in db.items(): - if not ignoreActive and not v.Active: - continue - if location in v.listOutputs(): - retlist.append(v) - if len(retlist) > 1: - raise ValueError("More than one active decoder for this location " + - [d.FullName for d in retlist].__str__()) - if not len(retlist): - return None - return retlist[0] - - -def usedDecoders(db, bank=None): - """ - Obtain any used decoders irrespective of whether they were 'active' - A "used" decoder is any decoder which was previously "setup()" by someone - """ - retlist = [] - for k, v in db.items(): - if not v.wasUsed(): - continue - if bank is None or bank in v.Banks: - retlist.append(v) - return retlist diff --git a/GaudiAlg/CMakeLists.txt b/GaudiAlg/CMakeLists.txt index 4225574b16c..df6d60d9334 100644 --- a/GaudiAlg/CMakeLists.txt +++ b/GaudiAlg/CMakeLists.txt @@ -17,8 +17,7 @@ endif() # Build the library gaudi_add_library(GaudiAlgLib - SOURCES src/lib/EventCounter.cpp - src/lib/FixTESPath.cpp + SOURCES src/lib/FixTESPath.cpp src/lib/GaudiAlgorithm.cpp src/lib/GaudiCommon.icpp src/lib/GaudiHistoID.cpp @@ -28,7 +27,6 @@ gaudi_add_library(GaudiAlgLib src/lib/Prescaler.cpp src/lib/Tuple.cpp src/lib/TupleObj.cpp - src/lib/AlgDecorators.cpp LINK PUBLIC Gaudi::GaudiUtilsLib @@ -44,13 +42,8 @@ if(GAUDI_USE_AIDA) src/lib/GaudiHistoTool.cpp src/lib/GetAlgs.cpp src/lib/GaudiTupleAlg.cpp - src/lib/GaudiTupleTool.cpp - src/lib/HistoDecorator.cpp) + src/lib/GaudiTupleTool.cpp) target_link_libraries(GaudiAlgLib PUBLIC AIDA::aida) - if(GAUDI_USE_CLHEP) - target_sources(GaudiAlgLib PRIVATE src/lib/TupleDecorator.cpp) - target_link_libraries(GaudiAlgLib PUBLIC CLHEP::CLHEP) - endif() endif() # For backward compatibility add_library(Gaudi::GaudiAlgLib ALIAS GaudiAlgLib) @@ -87,15 +80,12 @@ if(GAUDI_USE_CLHEP) target_compile_definitions(GaudiAlgDict PRIVATE CLHEP_FOUND) endif() -gaudi_install(PYTHON) - if(BUILD_TESTING) # Ignore examples if not building tests # see https://gitlab.cern.ch/atlas/atlasexternals/-/merge_requests/664#note_3395313 gaudi_add_module(GaudiAlgExamples SOURCES src/examples/GaudiCommonTests.cpp - src/examples/MyGaudiAlgorithm.cpp src/examples/MyGaudiTool.cpp src/examples/SelCreate.cpp src/examples/SelFilter.cpp diff --git a/GaudiAlg/dict/dictionary.h b/GaudiAlg/dict/dictionary.h index 7bbb8ec555d..36b40fc0600 100644 --- a/GaudiAlg/dict/dictionary.h +++ b/GaudiAlg/dict/dictionary.h @@ -18,15 +18,6 @@ # include <Python.h> #endif // not __APPLE__ -#include <GaudiPython/AlgDecorators.h> -#include <GaudiPython/PyAlg.h> -#ifdef AIDA_FOUND -# include <GaudiPython/HistoDecorator.h> -# ifdef CLHEP_FOUND -# include <GaudiPython/TupleDecorator.h> -# endif // CLHEP_FOUND -#endif // AIDA_FOUND - #ifdef AIDA_FOUND # include <GaudiAlg/GaudiHistoAlg.h> # include <GaudiAlg/GaudiTupleAlg.h> diff --git a/GaudiAlg/dict/selection.xml b/GaudiAlg/dict/selection.xml index 81ced72deec..f8cede792d4 100644 --- a/GaudiAlg/dict/selection.xml +++ b/GaudiAlg/dict/selection.xml @@ -10,9 +10,6 @@ --> <lcgdict> <class name = "GaudiAlgorithm"/> - <class name = "GaudiPython::PyAlg<GaudiAlgorithm>"/> - <class name = "GaudiPython::PyAlg<GaudiHistoAlg>"/> - <class name = "GaudiPython::PyAlg<GaudiTupleAlg>"/> <class name = "IErrorTool"/> <class name = "IGenericTool"/> <class name = "IHistoTool"/> @@ -24,6 +21,5 @@ <class pattern = "GaudiAlg::Print*"/> <class pattern = "GaudiCommon<*>"/> <class pattern = "GaudiHistos<*>"/> - <class pattern = "GaudiPython::*Decorator*"/> <class pattern = "GaudiTuples<*>"/> </lcgdict> diff --git a/GaudiAlg/include/GaudiAlg/EventCounter.h b/GaudiAlg/include/GaudiAlg/EventCounter.h deleted file mode 100644 index c2e148c4207..00000000000 --- a/GaudiAlg/include/GaudiAlg/EventCounter.h +++ /dev/null @@ -1,51 +0,0 @@ -/***********************************************************************************\ -* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations * -* * -* This software is distributed under the terms of the Apache version 2 licence, * -* copied verbatim in the file "LICENSE". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\***********************************************************************************/ -#include "GaudiKernel/Algorithm.h" -#include <Gaudi/Property.h> - -class GAUDI_API EventCounter : public Algorithm { -public: - /** - ** Constructor(s) - **/ - EventCounter( const std::string& name, ISvcLocator* pSvcLocator ); - - /***************************** - ** Public Function Members ** - *****************************/ - - StatusCode initialize() override; - StatusCode execute() override; - StatusCode finalize() override; - -private: - /************************** - ** Private Data Members ** - **************************/ - - /** - ** The frequency with which the number of events - ** should be reported. The default is 1, corresponding - ** to every event. - **/ - Gaudi::CheckedProperty<int> m_frequency{this, "Frequency", 1}; - - /** - ** The number of events skipped since the last time - ** the count was reported. - **/ - int m_skip = 0; - - /** - ** The total events seen. - **/ - int m_total = 0; -}; diff --git a/GaudiAlg/include/GaudiPython/AlgDecorators.h b/GaudiAlg/include/GaudiPython/AlgDecorators.h deleted file mode 100644 index 7a796bfab04..00000000000 --- a/GaudiAlg/include/GaudiPython/AlgDecorators.h +++ /dev/null @@ -1,122 +0,0 @@ -/***********************************************************************************\ -* (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations * -* * -* This software is distributed under the terms of the Apache version 2 licence, * -* copied verbatim in the file "LICENSE". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\***********************************************************************************/ -#pragma once - -#include <GaudiAlg/GaudiAlgorithm.h> -#include <string> - -class IInterface; -class IProperty; -class IAlgTool; -class IAlgorithm; -class GaudiAlgorithm; -class GaudiTool; -class DataObject; - -// ============================================================================ -/** @file - * - * Collection of "decorators" for python algorithms - * - * @author Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr - * @date 2005-08-03 - */ -// ============================================================================ -namespace GaudiPython { - // ========================================================================== - /** simple class that allows to "decorate" the python - * algorithm with 'basic' functionality from class GaudiAlgorithm - * @author Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr - * @date 2007-08-03 - */ - class GAUDI_API AlgDecorator { - public: - // ======================================================================== - /// the actual type of vector of counters - typedef std::vector<Gaudi::Accumulators::PrintableCounter*> Counters; - typedef std::vector<IAlgTool*> Tools; - typedef std::vector<IService*> Services; - // ======================================================================== - // the general functional methods - // ======================================================================== - public: - /** get the tool from GaudiAlgorithm - * @param alg GaudiAlgorithm - * @param type tool type - * @param name tool name - * @param parent tool parent - * @param create flag to create - * @return the tool - */ - static IAlgTool* tool_( const GaudiAlgorithm* alg, const std::string& type, const std::string& name, - const IInterface* parent = 0, const bool create = true ); - /** get the tool from GaudiAlgorithm - * @param alg GaudiAlgorithm - * @param typeAndName tool type/name - * @param parent tool parent - * @param create flag to create - * @return the tool - */ - static IAlgTool* tool_( const GaudiAlgorithm* alg, const std::string& typeAndName, const IInterface* parent = 0, - const bool create = true ); - /** get the service from GaudiAlgorithm - * @param alg GaudiAlgorithm - * @param name service name - * @param create flag to create - * @return the tool - */ - static IInterface* svc_( const GaudiAlgorithm* alg, const std::string& name, const bool create = false ); - // ======================================================================== - // get the data from TES - // ======================================================================== - public: - /** get the data from TES - * @param alg GaudiAlgorithm - * @param location data location in TES - * @param useRoonInTes flag to respect RootInTes - * @return the data - */ - static DataObject* get_( const GaudiAlgorithm* alg, const std::string& location, const bool useRootInTes ); - // ======================================================================== - public: - // ======================================================================== - /** get the data from TES - * @param alg GaudiAlgorithm - * @param location data location in TES - * @param useRoonInTes flag to respect RootInTes - * @return the data - */ - static bool exist( const GaudiAlgorithm* alg, const std::string& location, const bool useRootInTes ); - // ======================================================================== - public: // inspection: get all counters: - // ======================================================================== - static size_t _counters_a_( const GaudiAlgorithm* alg, std::vector<std::string>& names, Counters& out ); - static size_t _counters_t_( const GaudiTool* alg, std::vector<std::string>& names, Counters& out ); - static size_t _counters_a_( const IAlgorithm* alg, std::vector<std::string>& names, Counters& out ); - static size_t _counters_t_( const IAlgTool* alg, std::vector<std::string>& names, Counters& out ); - // ======================================================================== - public: // inspection: get the counter - // ======================================================================== - static StatEntity* _counter_a_( const GaudiAlgorithm* alg, const std::string& name ); - static StatEntity* _counter_t_( const GaudiTool* alg, const std::string& name ); - static StatEntity* _counter_a_( const IAlgorithm* alg, const std::string& name ); - static StatEntity* _counter_t_( const IAlgTool* alg, const std::string& name ); - // ======================================================================== - public: // inspection: get all tools - // ======================================================================== - static size_t _tools_a_( const GaudiAlgorithm*, Tools& tools ); - static size_t _tools_t_( const GaudiTool*, Tools& tools ); - static size_t _tools_a_( const IAlgorithm*, Tools& tools ); - static size_t _tools_t_( const IAlgTool*, Tools& tools ); - // ======================================================================== - }; - // ========================================================================== -} // namespace GaudiPython diff --git a/GaudiAlg/include/GaudiPython/HistoDecorator.h b/GaudiAlg/include/GaudiPython/HistoDecorator.h deleted file mode 100644 index f4658d2f3a9..00000000000 --- a/GaudiAlg/include/GaudiPython/HistoDecorator.h +++ /dev/null @@ -1,417 +0,0 @@ -/***********************************************************************************\ -* (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations * -* * -* This software is distributed under the terms of the Apache version 2 licence, * -* copied verbatim in the file "LICENSE". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\***********************************************************************************/ -#pragma once - -#include <GaudiAlg/GaudiHistoAlg.h> -#include <GaudiPython/Vector.h> - -struct GaudiHistoTool; - -namespace GaudiPython { - /** @class HistoDecorator GaudiPython/HistoDecorator.h - * Simple decorator class to allow to reuse the functionality of - * GaudiHistos<TYPE> class in pythin - * @author Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr - * @date 2005-08-04 - */ - class GAUDI_API HistoDecorator { - public: - // ======================================================================== - typedef std::vector<GaudiAlg::ID> IDs; - typedef std::vector<AIDA::IHistogram1D*> Histos1D; - typedef std::vector<AIDA::IHistogram2D*> Histos2D; - typedef std::vector<AIDA::IHistogram3D*> Histos3D; - typedef std::vector<AIDA::IProfile1D*> Profiles1D; - typedef std::vector<AIDA::IProfile2D*> Profiles2D; - // ======================================================================== - public: - // ======================================================================== - /** "plot"(book&fill) a sequence of data from the vector (implicit loop) - * (Expected to be more efficient) - * @param algo the algorihtm - * @param data data - * @param title histogram title - * @param low low edge - * @param high high edge - * @param bins number of bins - */ - static AIDA::IHistogram1D* plot1D( const GaudiHistoAlg& algo, const double data, const std::string& title, - const double low, const double high, const unsigned long bins = 100 ); - // ======================================================================== - /** "plot"(book&fill) a sequence of data from the vector (implicit loop) - * (Expected to be more efficient) - * @param algo the algorihtm - * @param data data - * @param ID histogram ID - * @param title histogram title - * @param low low edge - * @param high high edge - * @param bins number of bins - */ - static AIDA::IHistogram1D* plot1D( const GaudiHistoAlg& algo, const double data, const GaudiAlg::HistoID& ID, - const std::string& title, const double low, const double high, - const unsigned long bins = 100 ); - // ======================================================================== - /** "plot"(book&fill) a sequence of data from the vector (implicit loop) - * (Expected to be more efficient) - * @param algo the algorihtm - * @param data data - * @param ID histogram ID - * @param title histogram title - * @param low low edge - * @param high high edge - * @param bins number of bins - */ - static AIDA::IHistogram1D* plot1D( const GaudiHistoAlg& algo, const double data, const long ID, - const std::string& title, const double low, const double high, - const unsigned long bins = 100 ); - // ======================================================================== - /** "plot"(book&fill) a sequence of data from the vector (implicit loop) - * (Expected to be more efficient) - * @param algo the algorihtm - * @param data data - * @param ID histogram ID - * @param title histogram title - * @param low low edge - * @param high high edge - * @param bins number of bins - */ - static AIDA::IHistogram1D* plot1D( const GaudiHistoAlg& algo, const double data, const std::string& ID, - const std::string& title, const double low, const double high, - const unsigned long bins = 100 ); - // ======================================================================== - /** "plot"(book&fill) a sequence of data from the vector (implicit loop) - * (Expected to be more efficient) - * @param algo the algorihtm - * @param data vector of data - * @param title histogram title - * @param low low edge - * @param high high edge - * @param bins number of bins - */ - static AIDA::IHistogram1D* plot1D( const GaudiHistoAlg& algo, const GaudiPython::Vector& data, - const std::string& title, const double low, const double high, - const unsigned long bins = 100 ); - // ======================================================================== - /** "plot"(book&fill) a sequence of data from the vector (implicit loop) - * (Expected to be more efficient) - * @param algo the algorihtm - * @param data vector of data - * @param ID histogram ID - * @param title histogram title - * @param low low edge - * @param high high edge - * @param bins number of bins - */ - static AIDA::IHistogram1D* plot1D( const GaudiHistoAlg& algo, const GaudiPython::Vector& data, - const GaudiAlg::HistoID& ID, const std::string& title, const double low, - const double high, const unsigned long bins = 100 ); - // ======================================================================== - /** "plot"(book&fill) a sequence of data from the vector (implicit loop) - * (Expected to be more efficient) - * @param algo the algorihtm - * @param data vector of data - * @param ID histogram ID - * @param title histogram title - * @param low low edge - * @param high high edge - * @param bins number of bins - */ - static AIDA::IHistogram1D* plot1D( const GaudiHistoAlg& algo, const GaudiPython::Vector& data, const long ID, - const std::string& title, const double low, const double high, - const unsigned long bins = 100 ); - // ======================================================================== - /** "plot"(book&fill) a sequence of data from the vector (implicit loop) - * (Expected to be more efficient) - * @param algo the algorihtm - * @param data vector of data - * @param ID histogram ID - * @param title histogram title - * @param low low edge - * @param high high edge - * @param bins number of bins - */ - static AIDA::IHistogram1D* plot1D( const GaudiHistoAlg& algo, const GaudiPython::Vector& data, - const std::string& ID, const std::string& title, const double low, - const double high, const unsigned long bins = 100 ); - // ======================================================================== - /** fill the 2D histogram (book on demand) - * @param valueX x value to be filled - * @param valueY y value to be filled - * @param title histogram title (must be unique within the algorithm) - * @param lowX low x limit for histogram - * @param highX high x limit for histogram - * @param lowY low y limit for histogram - * @param highY high y limit for histogram - * @param binsX number of bins in x - * @param binsY number of bins in y - * @param weight weight - * @return pointer to AIDA 2D histogram - */ - static AIDA::IHistogram2D* plot2D( const GaudiHistoAlg& algo, const double valueX, const double valueY, - const std::string& title, const double lowX, const double highX, - const double lowY, const double highY, const unsigned long binsX = 50, - const unsigned long binsY = 50, const double weight = 1.0 ); - // ======================================================================== - /** fill the 2D histogram with forced ID assignment (book on demand) - * @param valueX x value to be filled - * @param valueY y value to be filled - * @param ID Histogram ID to use - * @param title histogram title (must be unique within the algorithm) - * @param lowX low x limit for histogram - * @param highX high x limit for histogram - * @param lowY low y limit for histogram - * @param highY high y limit for histogram - * @param binsX number of bins in x - * @param binsY number of bins in y - * @param weight weight - * @return pointer to AIDA 2D histogram - */ - static AIDA::IHistogram2D* plot2D( const GaudiHistoAlg& algo, const double valueX, const double valueY, - const GaudiAlg::HistoID& ID, const std::string& title, const double lowX, - const double highX, const double lowY, const double highY, - const unsigned long binsX = 50, const unsigned long binsY = 50, - const double weight = 1.0 ); - // ======================================================================== - /** fill the 2D histogram with forced ID assignment (book on demand) - * @param valueX x value to be filled - * @param valueY y value to be filled - * @param ID Histogram ID to use - * @param title histogram title (must be unique within the algorithm) - * @param lowX low x limit for histogram - * @param highX high x limit for histogram - * @param lowY low y limit for histogram - * @param highY high y limit for histogram - * @param binsX number of bins in x - * @param binsY number of bins in y - * @param weight weight - * @return pointer to AIDA 2D histogram - */ - static AIDA::IHistogram2D* plot2D( const GaudiHistoAlg& algo, const double valueX, const double valueY, - const long ID, const std::string& title, const double lowX, const double highX, - const double lowY, const double highY, const unsigned long binsX = 50, - const unsigned long binsY = 50, const double weight = 1.0 ); - // ======================================================================== - /** fill the 2D histogram with forced ID assignment (book on demand) - * @param valueX x value to be filled - * @param valueY y value to be filled - * @param ID Histogram ID to use - * @param title histogram title (must be unique within the algorithm) - * @param lowX low x limit for histogram - * @param highX high x limit for histogram - * @param lowY low y limit for histogram - * @param highY high y limit for histogram - * @param binsX number of bins in x - * @param binsY number of bins in y - * @param weight weight - * @return pointer to AIDA 2D histogram - */ - static AIDA::IHistogram2D* plot2D( const GaudiHistoAlg& algo, const double valueX, const double valueY, - const std::string& ID, const std::string& title, const double lowX, - const double highX, const double lowY, const double highY, - const unsigned long binsX = 50, const unsigned long binsY = 50, - const double weight = 1.0 ); - // ======================================================================== - /** fill the 3D histogram (book on demand) - * @param valueX x value to be filled - * @param valueY y value to be filled - * @param valueZ z value to be filled - * @param title histogram title (must be unique within the algorithm) - * @param lowX low x limit for histogram - * @param highX high x limit for histogram - * @param lowY low y limit for histogram - * @param highY high y limit for histogram - * @param lowZ low z limit for histogram - * @param highZ high z limit for histogram - * @param binsX number of bins in x - * @param binsY number of bins in y - * @param binsZ number of bins in z - * @param weight weight - * @return pointer to AIDA 3D histogram - */ - static AIDA::IHistogram3D* plot3D( const GaudiHistoAlg& algo, const double valueX, const double valueY, - const double valueZ, const std::string& title, const double lowX, - const double highX, const double lowY, const double highY, const double lowZ, - const double highZ, const unsigned long binsX = 10, - const unsigned long binsY = 10, const unsigned long binsZ = 10, - const double weight = 1.0 ); - // ======================================================================== - /** fill the 3D histogram (book on demand) - * @param valueX x value to be filled - * @param valueY y value to be filled - * @param valueZ z value to be filled - * @param ID Histogram ID to use - * @param title histogram title (must be unique within the algorithm) - * @param lowX low x limit for histogram - * @param highX high x limit for histogram - * @param lowY low y limit for histogram - * @param highY high y limit for histogram - * @param lowZ low z limit for histogram - * @param highZ high z limit for histogram - * @param binsX number of bins in x - * @param binsY number of bins in y - * @param binsZ number of bins in z - * @param weight weight - * @return pointer to AIDA 3D histogram - */ - static AIDA::IHistogram3D* plot3D( const GaudiHistoAlg& algo, const double valueX, const double valueY, - const double valueZ, const GaudiAlg::HistoID& ID, const std::string& title, - const double lowX, const double highX, const double lowY, const double highY, - const double lowZ, const double highZ, const unsigned long binsX = 10, - const unsigned long binsY = 10, const unsigned long binsZ = 10, - const double weight = 1.0 ); - // ======================================================================== - /** fill the 3D histogram (book on demand) - * @param valueX x value to be filled - * @param valueY y value to be filled - * @param valueZ z value to be filled - * @param ID Histogram ID to use - * @param title histogram title (must be unique within the algorithm) - * @param lowX low x limit for histogram - * @param highX high x limit for histogram - * @param lowY low y limit for histogram - * @param highY high y limit for histogram - * @param lowZ low z limit for histogram - * @param highZ high z limit for histogram - * @param binsX number of bins in x - * @param binsY number of bins in y - * @param binsZ number of bins in z - * @param weight weight - * @return pointer to AIDA 3D histogram - */ - static AIDA::IHistogram3D* plot3D( const GaudiHistoAlg& algo, const double valueX, const double valueY, - const double valueZ, const long ID, const std::string& title, const double lowX, - const double highX, const double lowY, const double highY, const double lowZ, - const double highZ, const unsigned long binsX = 10, - const unsigned long binsY = 10, const unsigned long binsZ = 10, - const double weight = 1.0 ); - // ======================================================================== - /** fill the 3D histogram (book on demand) - * @param valueX x value to be filled - * @param valueY y value to be filled - * @param valueZ z value to be filled - * @param ID Histogram ID to use - * @param title histogram title (must be unique within the algorithm) - * @param lowX low x limit for histogram - * @param highX high x limit for histogram - * @param lowY low y limit for histogram - * @param highY high y limit for histogram - * @param lowZ low z limit for histogram - * @param highZ high z limit for histogram - * @param binsX number of bins in x - * @param binsY number of bins in y - * @param binsZ number of bins in z - * @param weight weight - * @return pointer to AIDA 3D histogram - */ - static AIDA::IHistogram3D* plot3D( const GaudiHistoAlg& algo, const double valueX, const double valueY, - const double valueZ, const std::string& ID, const std::string& title, - const double lowX, const double highX, const double lowY, const double highY, - const double lowZ, const double highZ, const unsigned long binsX = 10, - const unsigned long binsY = 10, const unsigned long binsZ = 10, - const double weight = 1.0 ); - // ======================================================================== - // 1D-profiles: by title - // ======================================================================== - static AIDA::IProfile1D* profile1D( const GaudiHistoAlg& algo, const double valueX, const double valueY, - const std::string& title, const double lowX, const double highX, - const unsigned long binsX = 100, const std::string& opt = "", - const double lowY = -std::numeric_limits<double>::max(), - const double highY = std::numeric_limits<double>::max(), - const double weight = 1.0 ); - // ======================================================================== - // 1D-profiles: by generic ID - // ======================================================================== - static AIDA::IProfile1D* - profile1D( const GaudiHistoAlg& algo, const double valueX, const double valueY, const GaudiAlg::HistoID& ID, - const std::string& title, const double lowX, const double highX, const unsigned long binsX = 100, - const std::string& opt = "", const double lowY = -std::numeric_limits<double>::max(), - const double highY = std::numeric_limits<double>::max(), const double weight = 1.0 ); - // ======================================================================== - // 1D-profiles: by numeric ID - // ======================================================================== - static AIDA::IProfile1D* profile1D( const GaudiHistoAlg& algo, const double valueX, const double valueY, - const long ID, const std::string& title, const double lowX, const double highX, - const unsigned long binsX = 100, const std::string& opt = "", - const double lowY = -std::numeric_limits<double>::max(), - const double highY = std::numeric_limits<double>::max(), - const double weight = 1.0 ); - // ======================================================================== - // 1D-profiles: by string ID - // ======================================================================== - static AIDA::IProfile1D* - profile1D( const GaudiHistoAlg& algo, const double valueX, const double valueY, const std::string& ID, - const std::string& title, const double lowX, const double highX, const unsigned long binsX = 100, - const std::string& opt = "", const double lowY = -std::numeric_limits<double>::max(), - const double highY = std::numeric_limits<double>::max(), const double weight = 1.0 ); - // ======================================================================== - // 2D-profiles: by title - // ======================================================================== - static AIDA::IProfile2D* profile2D( const GaudiHistoAlg& algo, const double valueX, const double valueY, - const double valueZ, const std::string& title, const double lowX, - const double highX, const double lowY, const double highY, - const unsigned long binsX = 50, const unsigned long binsY = 50, - const double weight = 1.0 ); - // ======================================================================== - // 2D-profiles: by generic ID - // ======================================================================== - static AIDA::IProfile2D* profile2D( const GaudiHistoAlg& algo, const double valueX, const double valueY, - const double valueZ, const GaudiAlg::HistoID& ID, const std::string& title, - const double lowX, const double highX, const double lowY, const double highY, - const unsigned long binsX = 50, const unsigned long binsY = 50, - const double weight = 1.0 ); - // ======================================================================== - // 2D-profiles: by numeric ID - // ======================================================================== - static AIDA::IProfile2D* profile2D( const GaudiHistoAlg& algo, const double valueX, const double valueY, - const double valueZ, const long ID, const std::string& title, const double lowX, - const double highX, const double lowY, const double highY, - const unsigned long binsX = 50, const unsigned long binsY = 50, - const double weight = 1.0 ); - // ======================================================================== - // 2D-profiles: by string ID - // ======================================================================== - static AIDA::IProfile2D* profile2D( const GaudiHistoAlg& algo, const double valueX, const double valueY, - const double valueZ, const std::string& ID, const std::string& title, - const double lowX, const double highX, const double lowY, const double highY, - const unsigned long binsX = 50, const unsigned long binsY = 50, - const double weight = 1.0 ); - // ======================================================================== - public: - // ======================================================================== - static size_t _histos_a_( const GaudiHistoAlg* cmp, IDs& ids, Histos1D& histos ); - static size_t _histos_t_( const GaudiHistoTool* cmp, IDs& ids, Histos1D& histos ); - static size_t _histos_a_( const IAlgorithm* cmp, IDs& ids, Histos1D& histos ); - static size_t _histos_t_( const IAlgTool* cmp, IDs& ids, Histos1D& histos ); - // ======================================================================== - static size_t _histos_a_( const GaudiHistoAlg* cmp, IDs& ids, Histos2D& histos ); - static size_t _histos_t_( const GaudiHistoTool* cmp, IDs& ids, Histos2D& histos ); - static size_t _histos_a_( const IAlgorithm* cmp, IDs& ids, Histos2D& histos ); - static size_t _histos_t_( const IAlgTool* cmp, IDs& ids, Histos2D& histos ); - // ======================================================================== - static size_t _histos_a_( const GaudiHistoAlg* cmp, IDs& ids, Histos3D& histos ); - static size_t _histos_t_( const GaudiHistoTool* cmp, IDs& ids, Histos3D& histos ); - static size_t _histos_a_( const IAlgorithm* cmp, IDs& ids, Histos3D& histos ); - static size_t _histos_t_( const IAlgTool* cmp, IDs& ids, Histos3D& histos ); - // ======================================================================== - static size_t _histos_a_( const GaudiHistoAlg* cmp, IDs& ids, Profiles1D& histos ); - static size_t _histos_t_( const GaudiHistoTool* cmp, IDs& ids, Profiles1D& histos ); - static size_t _histos_a_( const IAlgorithm* cmp, IDs& ids, Profiles1D& histos ); - static size_t _histos_t_( const IAlgTool* cmp, IDs& ids, Profiles1D& histos ); - // ======================================================================== - static size_t _histos_a_( const GaudiHistoAlg* cmp, IDs& ids, Profiles2D& histos ); - static size_t _histos_t_( const GaudiHistoTool* cmp, IDs& ids, Profiles2D& histos ); - static size_t _histos_a_( const IAlgorithm* cmp, IDs& ids, Profiles2D& histos ); - static size_t _histos_t_( const IAlgTool* cmp, IDs& ids, Profiles2D& histos ); - // ======================================================================== - }; - // ========================================================================== -} // namespace GaudiPython diff --git a/GaudiAlg/include/GaudiPython/PyAlg.h b/GaudiAlg/include/GaudiPython/PyAlg.h deleted file mode 100644 index 86f41c52cb5..00000000000 --- a/GaudiAlg/include/GaudiPython/PyAlg.h +++ /dev/null @@ -1,76 +0,0 @@ -/***********************************************************************************\ -* (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations * -* * -* This software is distributed under the terms of the Apache version 2 licence, * -* copied verbatim in the file "LICENSE". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\***********************************************************************************/ -#pragma once - -#include <GaudiPython/Algorithm.h> -#include <Python.h> - -namespace GaudiPython { - // ========================================================================== - /** @class PyAlg - * general class to embed the existing algorithm/base class - * into the python - * @author Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr - * @date 2005-08-03 - */ - template <class ALGORITHM> - class GAUDI_API PyAlg : public ALGORITHM { - // ======================================================================== - public: - // ======================================================================== - /** constructor from Python object and the name - * @param self python object - * @param name name of algorithm instance - */ - PyAlg( PyObject* self, const std::string& name ) : ALGORITHM( name, Gaudi::svcLocator() ), m_self( self ) { - // the printout of actual type for embedded algorithm has no sense - this->setProperty( "TypePrint", false ); - // The owner of the Algorithm is Python (as creator) therefore - // it should not be deleted by Gaudi (added an extra addRef()). - this->addRef(); - this->addRef(); - this->setType( System::typeinfoName( typeid( PyAlg ) ) ); - } - /// get the object - PyObject* _obj() const { return m_self; } // get the object - // ======================================================================== - public: - // ======================================================================== - StatusCode initialize() override { return GaudiPython::call_python_method( m_self, "initialize" ); } - StatusCode start() override { return GaudiPython::call_python_method( m_self, "start" ); } - StatusCode execute() override { return GaudiPython::call_python_method( m_self, "execute" ); } - StatusCode stop() override { return GaudiPython::call_python_method( m_self, "stop" ); } - StatusCode finalize() override { return GaudiPython::call_python_method( m_self, "finalize" ); } - // ======================================================================== - virtual IAlgorithm* ialgorithm() { return this; } - virtual IProperty* iproperty() { return this; } - // ======================================================================== - // preserve the existing methods - virtual StatusCode initialize_() { return ALGORITHM::initialize(); } - virtual StatusCode finalize_() { return ALGORITHM::finalize(); } - // ======================================================================== - private: - // ======================================================================== - /// the default constructor is disabled - PyAlg() = delete; - /// the copy constructor is disabled - PyAlg( const PyAlg& ) = delete; - /// the assignment operator is disabled - PyAlg& operator=( const PyAlg& ) = delete; - // ======================================================================== - private: - // ======================================================================== - /// "shadow" python class - PyObject* m_self; // "shadow" python class - // ======================================================================== - }; - // ========================================================================== -} // namespace GaudiPython diff --git a/GaudiAlg/include/GaudiPython/TupleDecorator.h b/GaudiAlg/include/GaudiPython/TupleDecorator.h deleted file mode 100644 index aebe63911b1..00000000000 --- a/GaudiAlg/include/GaudiPython/TupleDecorator.h +++ /dev/null @@ -1,359 +0,0 @@ -/***********************************************************************************\ -* (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations * -* * -* This software is distributed under the terms of the Apache version 2 licence, * -* copied verbatim in the file "LICENSE". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\***********************************************************************************/ -#pragma once - -#include <GaudiAlg/GaudiTupleAlg.h> -#include <GaudiAlg/ITupleTool.h> -#include <GaudiAlg/Tuple.h> -#include <GaudiAlg/TupleID.h> -#include <GaudiAlg/TupleObj.h> -#include <GaudiAlg/Tuples.h> -#include <GaudiKernel/GenericMatrixTypes.h> -#include <GaudiKernel/GenericVectorTypes.h> -#include <GaudiKernel/Point3DTypes.h> -#include <GaudiKernel/Point4DTypes.h> -#include <GaudiKernel/SymmetricMatrixTypes.h> -#include <GaudiKernel/Time.h> -#include <GaudiKernel/Vector3DTypes.h> -#include <GaudiKernel/Vector4DTypes.h> -#include <GaudiPython/Vector.h> - -namespace CLHEP { - class HepGenMatrix; - class HepVector; -} // namespace CLHEP - -namespace GaudiPython { - // ========================================================================== - /** @class TupleDecorator TupleDecorator.h GaudiPython/TupleDecorator.h - * Simple class which performs the decoration of the standard N-Tuple - * @see Tuples::Tuple - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2005-08-04 - */ - class GAUDI_API TupleDecorator { - public: - // ======================================================================== - /// accessors to internal - static INTuple* nTuple( const Tuples::Tuple& tuple ); - // ======================================================================== - /// accessors to internal - static NTuple::Tuple* ntuple( const Tuples::Tuple& tuple ); - // ======================================================================== - /// status of the tuple - static bool valid( const Tuples::Tuple& tuple ); - // ======================================================================== - /// commit the row - static StatusCode write( const Tuples::Tuple& tuple ); - // ======================================================================== - public: // primitives - // ======================================================================== - /// more or less simple columns: long - static StatusCode column( const Tuples::Tuple& tuple, const std::string& name, const int value ); - // ======================================================================== - /// more or less simple columns: long - static StatusCode column( const Tuples::Tuple& tuple, const std::string& name, const int value, const int minv, - const int maxv ); - // ======================================================================== - /// more or less simple columns: double - static StatusCode column( const Tuples::Tuple& tuple, const std::string& name, const double value ); - // ======================================================================== - /// more or less simple columns: bool - static StatusCode column( const Tuples::Tuple& tuple, const std::string& name, const bool value ); - // ======================================================================== - /// more or less simple columns: long long - static StatusCode column_ll( const Tuples::Tuple& tuple, const std::string& name, const long long value ); - // ======================================================================== - /// more or less simple columns: unsigned long long - static StatusCode column_ull( const Tuples::Tuple& tuple, const std::string& name, const unsigned long long value ); - // ======================================================================== - public: // event tag collections - // ======================================================================== - /// more or less simple columns: IOpaqueAddress - static StatusCode column( const Tuples::Tuple& tuple, const std::string& name, IOpaqueAddress* value ); - // ======================================================================== - /// more or less simple columns: IOpaqueAddress - static StatusCode column( const Tuples::Tuple& tuple, IOpaqueAddress* value ); - // ======================================================================== - public: // 4D kinematics - // ======================================================================== - /// Advanced columns: LorentzVector - static StatusCode column( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::LorentzVector& value ); - // ======================================================================== - public: // 3D geometry - // ======================================================================== - /// Advanced columns: 3D-vector - static StatusCode column( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::XYZVector& value ); - // ======================================================================== - /// Advanced columns: 3D-points - static StatusCode column( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::XYZPoint& value ); - // ======================================================================== - public: // floating size arrays - // ======================================================================== - /// Advanced columns: floating-size arrays - static StatusCode farray( const Tuples::Tuple& tuple, const std::string& name, const std::vector<double>& data, - const std::string& length, const size_t maxv ); - // ======================================================================== - public: // floating-size matrices - // ======================================================================== - /// Advanced columns: floating-size matrices - static StatusCode fmatrix( const Tuples::Tuple& tuple, const std::string& name, const GaudiPython::Matrix& data, - const Tuples::TupleObj::MIndex cols, // fixed !!! - const std::string& length, const size_t maxv ); - // ======================================================================== - /// Advanced columns: floating-size matrices - static StatusCode fmatrix( const Tuples::Tuple& tuple, const std::string& name, - const GaudiUtils::VectorMap<int, double>& info, const std::string& length, - const size_t maxv ); - // ======================================================================== - public: // fixed size arrays - // ======================================================================== - /// Advanced columns: fixed size arrays - static StatusCode array( const Tuples::Tuple& tuple, const std::string& name, const std::vector<double>& data ); - // ======================================================================== - /// Advanced columns: fixed size arrays - static StatusCode array( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Vector1& data ); - // ======================================================================== - /// Advanced columns: fixed size arrays - static StatusCode array( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Vector2& data ); - // ======================================================================== - /// Advanced columns: fixed size arrays - static StatusCode array( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Vector3& data ); - // ======================================================================== - /// Advanced columns: fixed size arrays - static StatusCode array( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Vector4& data ); - // ======================================================================== - /// Advanced columns: fixed size arrays - static StatusCode array( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Vector5& data ); - // ======================================================================== - public: // fixed size matrices - // ======================================================================== - /// Advanced columns: fixed size arrays - static StatusCode array( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Vector6& data ); - // ======================================================================== - /// Advanced columns: fixed size arrays - static StatusCode array( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Vector7& data ); - // ======================================================================== - /// Advanced columns: fixed size arrays - static StatusCode array( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Vector8& data ); - // ======================================================================== - /// Advanced columns: fixed size arrays - static StatusCode array( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Vector9& data ); - // ======================================================================== - /// Advanced columns: fixed size matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const GaudiPython::Matrix& data, - const Tuples::TupleObj::MIndex cols ); // fixed !!! - // ======================================================================== - /// Advanced columns: fixed size matrices: square matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Matrix2x2& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: square matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Matrix3x3& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: square matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Matrix4x4& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: square matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Matrix5x5& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: square matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Matrix6x6& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: square matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Matrix7x7& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: square matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Matrix8x8& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: square matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Matrix9x9& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: square matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Matrix1x1& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: non-square matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Matrix1x3& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: non-square matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Matrix1x5& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: non-square matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Matrix1x6& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: non-square matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Matrix4x3& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: non-square matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Matrix3x4& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: non-square matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Matrix3x5& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: non-square matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Matrix3x6& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: non-square matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Matrix2x3& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: non-square matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Matrix3x2& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: symmetric matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::SymMatrix1x1& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: symmetric matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::SymMatrix2x2& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: symmetric matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::SymMatrix3x3& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: symmetric matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::SymMatrix4x4& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: symmetric matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::SymMatrix5x5& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: symmetric matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::SymMatrix6x6& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: symmetric matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::SymMatrix7x7& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: symmetric matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::SymMatrix8x8& value ); - // ======================================================================== - /// Advanced columns: fixed size matrices: symmetric matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::SymMatrix9x9& value ); - // ======================================================================== - public: // some auxillary objects - // ======================================================================== - /// advanced column: time - static StatusCode column( const Tuples::Tuple& tuple, const std::string& name, const Gaudi::Time& value ); - /// advanced column: time - static StatusCode column( const Tuples::Tuple& tuple, const Gaudi::Time& value ); - // ======================================================================== - public: // CLHEP: should we keep it ? - // ======================================================================== - /// Advanced columns: fixed size arrays - static StatusCode array( const Tuples::Tuple& tuple, const std::string& name, const CLHEP::HepVector& data ); - /// Advanced columns: floating-size arrays - static StatusCode farray( const Tuples::Tuple& tuple, const std::string& name, const CLHEP::HepVector& data, - const std::string& length, const size_t maxv ); - /// Advanced columns: fixed size matrices - static StatusCode matrix( const Tuples::Tuple& tuple, const std::string& name, const CLHEP::HepGenMatrix& data ); - /// Advanced columns: floating-size matrices - static StatusCode fmatrix( const Tuples::Tuple& tuple, const std::string& name, const CLHEP::HepGenMatrix& data, - const Tuples::TupleObj::MIndex cols, // fixed !!! - const std::string& length, const size_t maxv ); - // ======================================================================== - }; - // ========================================================================== - /** @class TupleAlgDecorator TupleDecorator.h GaudiPython/TupleDecorator.h - * Simple class to perform the "decoration" of Tuples in Python/ROOT - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2005-08-17 - */ - class GAUDI_API TupleAlgDecorator { - public: - // ======================================================================== - /// get n-tuple (book-on-demand) - static Tuples::Tuple nTuple( const GaudiTupleAlg& algo, const std::string& title, - const CLID& clid = CLID_ColumnWiseTuple ); - // ======================================================================== - /// get n-tuple (book-on-demand) - static Tuples::Tuple nTuple( const GaudiTupleAlg& algo, const GaudiAlg::TupleID& ID, const std::string& title, - const CLID& clid = CLID_ColumnWiseTuple ); - // ======================================================================== - /// get n-tuple (book-on-demand) - static Tuples::Tuple nTuple( const GaudiTupleAlg& algo, const int ID, const std::string& title, - const CLID& clid = CLID_ColumnWiseTuple ); - // ======================================================================== - /// get n-tuple (book-on-demand) - static Tuples::Tuple nTuple( const GaudiTupleAlg& algo, const std::string& ID, const std::string& title, - const CLID& clid = CLID_ColumnWiseTuple ); - // ======================================================================== - /// get n-tuple (book-on-demand) - static Tuples::Tuple evtCol( const GaudiTupleAlg& algo, const std::string& title, - const CLID& clid = CLID_ColumnWiseTuple ); - // ======================================================================== - /// get n-tuple (book-on-demand) - static Tuples::Tuple evtCol( const GaudiTupleAlg& algo, const GaudiAlg::TupleID& ID, const std::string& title, - const CLID& clid = CLID_ColumnWiseTuple ); - // ======================================================================== - /// get n-tuple (book-on-demand) - static Tuples::Tuple evtCol( const GaudiTupleAlg& algo, const int ID, const std::string& title, - const CLID& clid = CLID_ColumnWiseTuple ); - // ======================================================================== - /// get n-tuple (book-on-demand) - static Tuples::Tuple evtCol( const GaudiTupleAlg& algo, const std::string& ID, const std::string& title, - const CLID& clid = CLID_ColumnWiseTuple ); - // ======================================================================== - }; - // ========================================================================== - /** @class TupleToolDecorator TupleDecorator.h GaudiPython/TupleDecorator.h - * Simple class to perform the "decoration" of Tuples in Python/ROOT - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2005-08-17 - */ - class GAUDI_API TupleToolDecorator { - public: - // ======================================================================== - /// get n-tuple (book-on-demand) - static Tuples::Tuple nTuple( const ITupleTool& tool, const std::string& title, - const CLID& clid = CLID_ColumnWiseTuple ) { - return tool.nTuple( title, clid ); - } - // ======================================================================== - /// get n-tuple (book-on-demand) - static Tuples::Tuple nTuple( const ITupleTool& tool, const GaudiAlg::TupleID& ID, const std::string& title, - const CLID& clid = CLID_ColumnWiseTuple ) { - return tool.nTuple( ID, title, clid ); - } - // ======================================================================== - /// get n-tuple (book-on-demand) - static Tuples::Tuple nTuple( const ITupleTool& tool, const int ID, const std::string& title, - const CLID& clid = CLID_ColumnWiseTuple ) { - return tool.nTuple( ID, title, clid ); - } - // ======================================================================== - /// get n-tuple (book-on-demand) - static Tuples::Tuple nTuple( const ITupleTool& tool, const std::string& ID, const std::string& title, - const CLID& clid = CLID_ColumnWiseTuple ) { - return tool.nTuple( ID, title, clid ); - } - // ======================================================================== - /// get n-tuple (book-on-demand) - static Tuples::Tuple evtCol( const ITupleTool& tool, const std::string& title, - const CLID& clid = CLID_ColumnWiseTuple ) { - return tool.evtCol( title, clid ); - } - // ======================================================================== - /// get n-tuple (book-on-demand) - static Tuples::Tuple evtCol( const ITupleTool& tool, const GaudiAlg::TupleID& ID, const std::string& title, - const CLID& clid = CLID_ColumnWiseTuple ) { - return tool.nTuple( ID, title, clid ); - } - // ======================================================================== - /// get n-tuple (book-on-demand) - static Tuples::Tuple evtCol( const ITupleTool& tool, const int ID, const std::string& title, - const CLID& clid = CLID_ColumnWiseTuple ) { - return tool.nTuple( ID, title, clid ); - } - // ======================================================================== - /// get n-tuple (book-on-demand) - static Tuples::Tuple evtCol( const ITupleTool& tool, const std::string& ID, const std::string& title, - const CLID& clid = CLID_ColumnWiseTuple ) { - return tool.nTuple( ID, title, clid ); - } - // ======================================================================== - }; - // ========================================================================== -} // namespace GaudiPython diff --git a/GaudiAlg/python/GaudiAlg/Algs.py b/GaudiAlg/python/GaudiAlg/Algs.py deleted file mode 100644 index ed36782a7b2..00000000000 --- a/GaudiAlg/python/GaudiAlg/Algs.py +++ /dev/null @@ -1,1631 +0,0 @@ -#!/usr/bin/env python3 -##################################################################################### -# (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations # -# # -# This software is distributed under the terms of the Apache version 2 licence, # -# copied verbatim in the file "LICENSE". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -##################################################################################### -# ============================================================================= -# @file -# -# Helper module, which effectively 'imports' few useful C++ algorithmic -# base classes into Python -# -# -# The major imported classes are : -# -# - GaudiAlgo - analogue for GaudiAlgorithm C++ class from GaudiAlg package -# - HistoAlgo - analogue for GaudiHistoAlg C++ class from GaudiAlg package -# - TupleAlgo - analogue for GaudiTupleAlg C++ class from GaudiAlg package -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 -# ============================================================================= -""" -******************************************************************************* -* * 'Physisics do not like it, * -* * physisics do not need it, * -* * physisics do not use it' * -* * **************************** -* * -* Helper module, which effectively 'imports' few useful C++ algorithmic * -* base classes into Python * -* * -******************************************************************************* -* The major imported classes are : * -* * -* (1) GaudiAlgo - analogue for GaudiAlgorithm C++ class from GaudiAlg package * -* (2) HistoAlgo - analogue for GaudiHistoAlg C++ class from GaudiAlg package * -* (3) TupleAlgo - analogue for GaudiTupleAlg C++ class from GaudiAlg package * -******************************************************************************* -""" - -# ============================================================================= -__author__ = "Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr" -# ============================================================================= -# list of "public" symbols -# ============================================================================= -__all__ = ( - "GaudiAlgo", # base class for algorithms - "HistoAlgo", # base class for histo-related algorithms - "TupleAlgo", # base class for tuple-related algorithms - "Tuple", # N-Tuple - "HistoID", # ID for N-tuples - "TupleID", # ID for Histograms - "aida2root", # AIDA -> ROOT converter - "SUCCESS", # status code -) -# ============================================================================= -# import core of Gaudi -import GaudiPython.Bindings # The basic module - -iAlgorithm = GaudiPython.Bindings.iAlgorithm # Algorithm interface -iAlgTool = GaudiPython.Bindings.iAlgTool # Tool interface - -from GaudiAlg.HistoUtils import aida2root # AIDA -> ROOT converter -from GaudiPython.Bindings import SUCCESS # status code -from GaudiPython.Bindings import AppMgr # Application Manager -from GaudiPython.Bindings import InterfaceCast # "queryInterface" -from GaudiPython.Bindings import iDataSvc # Data Service -from GaudiPython.Bindings import iHistogramSvc # Histogram Service -from GaudiPython.Bindings import iNTupleSvc # N-Tuple service -from GaudiPython.Bindings import gbl as cpp # global C++ namespace - -from GaudiKernel import ROOT6WorkAroundEnabled - -# ============================================================================= -# std C++ namespace -std = cpp.std # std C++ namespace - -# "typedef" for GaudiPython::Vector -Vector = std.vector("double") -# "typedef" for GaudiPython::Matrix -Matrix = std.vector("std::vector<double>") - -# histogram and N-Tuple universal identifier -HID = cpp.GaudiAlg.ID -HistoID = HID -TID = HID -TupleID = TID - -# get the decorator: -AlgDecorator = cpp.GaudiPython.AlgDecorator -HistoDecorator = cpp.GaudiPython.HistoDecorator -TupleAlgDecorator = cpp.GaudiPython.TupleAlgDecorator -TupleDecorator = cpp.GaudiPython.TupleDecorator - -# ============================================================================= -# Useful method to locate the tool a certain -# -# Usage: -# -# @code -# -# # locate public tool -# t1 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator') -# # locate private tool -# t2 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator',parent=self) -# # locate public tool with defined name -# t3 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator/MyExt1') -# # locate private tool with defined name -# t4 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator/MyExt2',parent=self) -# # locate public tool with defined name -# t5 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator','MyExt3') -# # locate private tool with defined name -# t6 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator','MyExt4',parent=self) -# -# @endcode -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 - - -def _tool_(self, interface, typename, name=None, parent=None, create=True): - """ - Useful method to locate the tool a certain - - Usage: - - # locate public tool - t1 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator') - # locate private tool - t2 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator',parent=self) - # locate public tool with defined name - t3 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator/MyExt1') - # locate private tool with defined name - t4 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator/MyExt2',parent=self) - # locate public tool with defined name - t5 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator','MyExt3') - # locate private tool with defined name - t6 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator','MyExt4',parent=self) - - """ - if not interface: - interface = cpp.IAlgTool - if not parent: - parent = self - if name: - typename += "/" + name - _tool = AlgDecorator.tool_(self, typename, parent, create) - if not _tool: - return None - _tool = InterfaceCast(interface)(_tool) - if not _tool: - self.Warning("Invalid cast to interface %s" % interface) - return None - return _tool - - -# ============================================================================= -# Useful method to locate a service: -# -# Usage: -# -# @code -# -# ntsvc = self.svc( INTupleSvc , 'NTUpleSvc' ) -# -# @endcode -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 - - -def _service_(self, interface, name, create=True): - """ - Useful method to locate a service: - - Usage: - - ntsvc = self.svc( INTupleSvc , 'NTUpleSvc' ) - - """ - if not interface: - interface = cpp.IInterface - _svc = AlgDecorator.svc_(self, name, create) - if not _svc: - return None - _svc = InterfaceCast(interface)(_svc) - if not _svc: - self.Warning("Invalid cast to interface %s" % interface) - return None - return _svc - - -# ============================================================================= -# The constructor from unique algorithm instance name, -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 - - -def _init_(self, name, **args): - """ - The constructor from unique algorithm instance name & parameters - """ - self._Base.__init__(self, self, name) - appMgr = AppMgr() - algMgr = appMgr._algmgr - status = algMgr.addAlgorithm(self) - if status.isFailure(): - raise RuntimeError('Unable to add Algorithm "' + name + '"') - self._ialg = iAlgorithm(name, self) - for key in args: - setattr(self, key, args[key]) - # take some care about the ownership of the algorithms - if "GaudiPythonAlgos" not in appMgr.__dict__: - appMgr.__dict__["GaudiPythonAlgos"] = [] - appMgr.__dict__["GaudiPythonAlgos"].append(self) - - -# ============================================================================= -# The default initialization (initialization of base C++ class + data -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 - - -def _initialize_(self): - """ - The default initialization (initialization of base C++ class + data) - """ - status = self._Base.initialize_(self) - if status.isFailure(): - return status - - # set the basic services - _e = self._Base.evtSvc(self) - _s = InterfaceCast(cpp.IService)(_e) - self._evtSvc_ = iDataSvc(_s.name(), _e) - - _d = self._Base.detSvc(self) - _s = InterfaceCast(cpp.IService)(_d) - self._detSvc_ = iDataSvc(_s.name(), _d) - - return status - - -# ============================================================================= -# The default initialization (initialization of base C++ class + data members) -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 - - -def _initialize_histo_(self): - """ - The default initialization (initialization of base C++ class + data members) - """ - status = _initialize_(self) - if status.isFailure(): - return status - - # set the basic services - _h = self._Base.histoSvc(self) - _s = InterfaceCast(cpp.IService)(_h) - self._histoSvc_ = iHistogramSvc(_s.name(), _h) - - return status - - -# ============================================================================= -# The default initialization (initialization of base C++ class + data members) -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 - - -def _initialize_tuple_(self): - """ - The default initialization (initialization of base C++ class + data members) - """ - status = _initialize_histo_(self) - if status.isFailure(): - return status - - # set the basic services - if self.produceNTuples(): - _n = self._Base.ntupleSvc(self) - _s = InterfaceCast(cpp.IService)(_n) - self._ntupleSvc_ = iNTupleSvc(_s.name(), _n) - - if self.produceEvtCols(): - _n = self._Base.evtColSvc(self) - _s = InterfaceCast(cpp.IService)(_n) - self._evtcolSvc_ = iNTupleSvc(_s.name(), _n) - - return status - - -# ============================================================================= -# Trivial helper function to access Event Data and Event Data Service -# -# Usage: -# -# @code -# -# # get event data service -# svc = self.evtSvc() -# -# # get the data -# hits = self.evtSvc('MC/Calo/Hits') -# -# @endcode -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 - - -def _evtSvc(self, location=None): - """ - Trivial helper function to access Event Data and Event Data Service - - Usage: - - # get event data service - svc = self.evtSvc() - - # get the data - hits = self.evtSvc('MC/Calo/Hits') - """ - if not location: - return self._evtSvc_ - return self._evtSvc_[location] - - -# ============================================================================= -# Trivial helper function to access Detector Data and Detector Data Service -# -# Usage: -# -# @code -# -# # get detector data service -# svc = self.detSvc() -# -# # get the data -# lhcb = self.detSvc('/dd/Structure/LHCb') -# -# @endcode -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 - - -def _detSvc(self, location=None): - """ - Trivial helper function to access Detector Data and Event Data Service - - Usage: - # get detector data service - svc = self.detSvc() - - # get the data - lhcb = self.detSvc('/dd/Structure/LHCb') - """ - if location is None: - return self._detSvc_ - return self._detSvc_[location] - - -# ============================================================================= -# Trivial helper function to access Histogram Data and Histogram Data Service -# -# Usage: -# -# @code -# -# # get histogram data service -# svc = self.histoSvc() -# -# # get the data -# histo = self.histoSvc('/stat/Calo/1') -# -# @endcode -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 - - -def _histoSvc(self, address=None): - """ - Trivial helper function to access Histogram Data and Histogram Data Service - - Usage: - - # get histogram data service - svc = self.histoSvc() - - # get the data - histo = self.histoSvc('/stat/Calo/1') - """ - if not address: - return self._histoSvc_ - return self._histoSvc_[address] - - -# ============================================================================= -# Trivial function to access the data in TES - - -def _get(self, location): - """ - Trivial function to access the data in TES using the data service - """ - return self._evtSvc_[location] - - -# ============================================================================= -# Trivial function to access the data in TDS - - -def _getDet(self, location): - """ - Trivial function to access the data in TDS using data service - """ - return self._detSvc_[location] - - -# ============================================================================= -# get the data from TES using GaudiCommon methods, respecting RootInTES - - -def _get_(self, location, rootInTES=True): - """ - Get the object from Transient Event Store using GaudiCommon machinery, - respecting RootInTES behaviour - """ - return AlgDecorator.get_(self, location, rootInTES) - - -# ============================================================================= -# check the data from TES using GaudiCommon methods, respecting RootInTES - - -def _exist_(self, location, rootInTES=True): - """ - Check the object in Transient Event Store using GaudiCommon machinery, - respecting RootInTES behaviour - """ - return AlgDecorator.exist_(self, location, rootInTES) - - -# ============================================================================= -# Trivial helper function to access NTuple Service - - -def _ntupleSvc(self): - """ - Trivial function to access N-Tuple Service - """ - return self._ntupleSvc_ - - -# ============================================================================= -# Trivial helper function to access Event Collection Service - - -def _evtcolSvc(self): - """ - Trivial function to access Event Collection Service - """ - return self._evtcolSvc_ - - -# ============================================================================= -# The default finalization (finalization of base C++ class) -def _finalize_(self): - """ - The default finalization : finalize the base C++ class - """ - status = self._Base.finalize_(self) - return status - - -# ============================================================================= -# Dummy method returning success - - -def _success_(self): - return SUCCESS - - -# ============================================================================= -# check the existence of the property with the given name -def _hasProperty_(self, pname): - """ - The trivial function which checks the existence of the property with given name - """ - return cpp.Gaudi.Utils.hasProperty(self, pname) - - -# ============================================================================= -# get the value of the given property - - -def _getProperty_(self, pname): - """ - Get the property by name - """ - if not self.hasProperty(pname): - raise AttributeError("property %s does not exist" % pname) - return self._ialg.__getattr__(pname) - - -# ============================================================================= -# set the value for the given property - - -def _setProperty_(self, pname, pvalue): - """ - Set the property from the value - """ - if not self.hasProperty(pname): - raise AttributeError("property %s does not exist" % pname) - return self._ialg.__setattr__(pname, pvalue) - - -# ============================================================================= -# get the attribute or property - - -def _get_attr_(self, pname): - """ - Get the attribute (or property) - - if the attribute name corresponds to the property name, property value is returned - """ - if self.hasProperty(pname): - return self._ialg.__getattr__(pname) - else: - # Since self does not inherit from iAlgorithm (see !1116, 4f05f03678), - # delegate attribute lookup to self._ialg. - try: - return getattr(self._ialg, pname) - except AttributeError: - pass - raise AttributeError("attribute/property %s does not exist" % pname) - - -# ============================================================================= -# set the attribute or property - - -def _set_attr_(self, pname, pvalue): - """ - Set the attribute (or property) : - - if the attribute name corresponds to the property name, the property is updated - """ - if not self.hasProperty(pname): - self.__dict__[pname] = pvalue - else: - self._ialg.__setattr__(pname, pvalue) - - -_GaudiAlgorithm = cpp.GaudiPython.PyAlg("GaudiAlgorithm") -_GaudiHistoAlg = cpp.GaudiPython.PyAlg("GaudiHistoAlg") -_GaudiTupleAlg = cpp.GaudiPython.PyAlg("GaudiTupleAlg") - -# ============================================================================= -# @class GaudiAlgo -# the base class for all algorithm -# Python-image of C++ clkass GaudiAlgorithm -# -# Usage: -# -# @code -# -# from GauidAlg.Algs import GaudiAlgo, SUCCESS -# -# class MyClass(GaudiAlgo) : -# """ -# My specific Algorithm, derived from GaudiAlgo base class -# """ -# def __init__( self , name , **args ) : -# """ -# Constructor from algorithm instance name & parameters' -# """ -# #invoke the constructor of base class -# GaudiAlgo.__init__(self , name , **args ) -# -# def initialize ( self ) : -# 'Algorithm initialization' -# # initialize the base class -# status = GaudiAlgo.initialize( self ) -# if status.isFailure() : return status -# -# # locate the services and tools -# -# # locate some tool: -# extrapolator = self.tool(ITrExtrapolator,'TrExtrapolator') -# -# # locate the service -# rndmSvc = self.svc(IRndmGenSvc, 'RndmGenSvc') -# -# return SUCCESS -# -# -# def execute ( self ) : -# 'Major method (from IAlgorithm interface)' -# -# # get some data from Transient Event Store -# tracks = self.get('/Event/Rec/Tracks') -# -# # use counters -# c1 = self.counter('#Tracks') -# c2 = self.counter('No Tracks') -# if tracks.empty : -# c2+=1 -# c1 += tracks->size() -# -# if 1000 < tracks.size() : -# return self.Error('The event is *VERY* busy') -# -# return SUCCESS -# -# @endcode -# -# @see GaudiAlgorithm -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 - - -class GaudiAlgo(_GaudiAlgorithm): - """ - ******************************************************************************* - * * 'Physisics do not like it, * - * * physisics do not need it, * - * * physisics do not use it' * - * * **************************** - * Usage: * - * * - * from GaudiAlg.Algs import GaudiAlgo, SUCCESS * - * * - * class MyClass(GaudiAlgo) : * - * ' My specific Algorithm, derived from GaudiAlgo base class ' * - * def __init__( self , name , **args ) : * - * 'Constructor from algorithm instance name & parameters' * - * #invoke the constructor of base class * - * GaudiAlgo.__init__(self , name , **args ) * - * * - * def initialize ( self ) : * - * 'Algorithm initialization' * - * # initialize the base class * - * status = GaudiAlgo.initialize( self ) * - * if status.isFailure() : return status * - * * - * # locate the services and tools * - * * - * # locate some tool: * - * extrapolator = self.tool(ITrExtrapolator,'TrExtrapolator') * - * * - * # locate the service * - * rndmSvc = self.svc(IRndmGenSvc, 'RndmGenSvc') * - * * - * return SUCCESS * - * * - * * - * def execute ( self ) : * - * 'Major method (from IAlgorithm interface)' * - * * - * # get some data from Transient Event Store * - * tracks = self.get('/Event/Rec/Tracks') * - * * - * # use counters * - * c1 = self.counter('#Tracks') * - * c2 = self.counter('No Tracks') * - * if tracks.empty : * - * c2+=1 * - * c1 += tracks->size() * - * * - * if 1000 < tracks.size() : * - * return self.Error('The event is *VERY* busy') * - * * - * return SUCCESS * - * * - ******************************************************************************* - """ - - pass - - -# ============================================================================= -# @class HistoAlgo -# The base class for easy histogramming -# -# Usage: -# -# -# @code -# -# from GaudiAlg.Algs import HistoAlgo, SUCCESS -# -# class MyClass(HistoAlgo) : -# ' My specific Algorithm, derived from GaudiAlgo base class ' -# def __init__( self , name , **args ) : -# 'Constructor from algorithm instance name & parameters' -# #invoke the constructor of base class -# HistoAlgo.__init__(self , name , **args ) -# -# def execute ( self ) : -# 'Major method (from IAlgorithm interface)' -# -# # get some data from Transient Event Store -# tracks = self.get('/Event/Rec/Tracks') -# -# self.plot1D ( tracks->size() , '#tracks' , 0 , 100 ) -# -# return SUCCESS -# -# @endcode -# -# Alternatively the histogram could be booked in advance: -# -# @code -# -# class MyClass(HistoAlgo) : -# ' My specific Algorithm, derived from GaudiAlgo base class ' -# def __init__( self , name ) : -# 'Constructor from algorithm instance name' -# #invoke the constructor of base class -# HistoAlgo.__init__(self , name ) -# -# def initialize ( self ) : -# 'Algorithm initialization' -# # initialize the base class -# status = HistoAlgo.initialize( self ) -# if status.isFailure() : return status -# -# # book the histogram -# self.h1 = selff.book1D ( '#tracks' , 0 , 100 ) -# -# return SUCCESS -# -# -# def execute ( self ) : -# 'Major method (from IAlgorithm interface)' -# -# # get some data from Transient Event Store -# tracks = self.get('/Event/Rec/Tracks') -# -# # fill the histogram -# self.h1.fill ( tracks->size() ) -# -# return SUCCESS -# @endcode -# -# @see GaudiHistoAlg -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 - - -class HistoAlgo(_GaudiHistoAlg): - """ - ******************************************************************************* - * * 'Physisics do not like it, * - * * physisics do not need it, * - * * physisics do not use it' * - * * **************************** - * Usage: * - * * - * from GaudiAlg.Algs import HistoAlgo, SUCCESS * - * * - * class MyClass(HistoAlgo) : * - * ' My specific Algorithm, derived from GaudiAlgo base class ' * - * def __init__( self , name , **args ) : * - * 'Constructor from algorithm instance name' * - * #invoke the constructor of base class * - * HistoAlgo.__init__(self , name , **args ) * - * * - * def execute ( self ) : * - * 'Major method (from IAlgorithm interface)' * - * * - * # get some data from Transient Event Store * - * tracks = self.get('/Event/Rec/Tracks') * - * * - * self.plot1D ( tracks->size() , '#tracks' , 0 , 100 ) * - * * - * return SUCCESS * - * * - * Alternatively the histogram could be booked in advance: * - * * - * class MyClass(HistoAlgo) : * - * ' My specific Algorithm, derived from GaudiAlgo base class ' * - * def __init__( self , name ) : * - * 'Constructor from algorithm instance name' * - * #invoke the constructor of base class * - * HistoAlgo.__init__(self , name ) * - * * - * def initialize ( self ) : * - * 'Algorithm initialization' * - * # initialize the base class * - * status = HistoAlgo.initialize( self ) * - * if status.isFailure() : return status * - * * - * # book the histogram * - * self.h1 = selff.book1D ( '#tracks' , 0 , 100 ) * - * * - * return SUCCESS * - * * - * * - * def execute ( self ) : * - * 'Major method (from IAlgorithm interface)' * - * * - * # get some data from Transient Event Store * - * tracks = self.get('/Event/Rec/Tracks') * - * * - * # fill the histogram * - * self.h1.fill ( tracks->size() ) * - * * - * return SUCCESS * - * * - ******************************************************************************* - """ - - pass - - -# ============================================================================= -# @class TupleAlgo -# The base class for easy manupulations with N-Tuples -# -# Usage: -# -# @code -# -# from GaudiAlg.Algs import TupleAlgo, SUCCESS -# -# class MyClass(TupleAlgo) : -# ' My specific Algorithm, derived from TupleAlgo base class ' -# def __init__( self , name , **args ) : -# 'Constructor from algorithm instance name& parameters' -# #invoke the constructor of base class -# TupleAlgo.__init__(self , name , **args ) -# -# def execute ( self ) : -# 'Major method (from IAlgorithm interface)' -# -# # get some data from Transient Event Store -# tracks = self.get('/Event/Rec/Tracks') -# -# tup = self.nTuple('My N-Tuple') -# -# for track in tracks : -# -# pt = track.pt () -# p = track.p () -# chi2 = track.chi2 () -# -# #fill N-tuple: -# tup.column ( 'pt' , pt ) -# tup.column ( 'p' , p ) -# tup.column ( 'chi2' , chi2 ) -# #commit the row -# tup.write () -# -# return SUCCESS -# -# @endcode -# -# @see GaudiTupleAlg -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 - - -class TupleAlgo(_GaudiTupleAlg): - """ - ******************************************************************************* - * * 'Physisics do not like it, * - * * physisics do not need it, * - * * physisics do not use it' * - * * **************************** - * Usage: * - * * - * from GaudiAlg.Algs import TupleAlgo, SUCCESS * - * * - * class MyClass(TupleAlgo) : * - * ' My specific Algorithm, derived from TupleAlgo base class ' * - * def __init__( self , name , **args ) : * - * 'Constructor from algorithm instance name & parameters' * - * #invoke the constructor of base class * - * TupleAlgo.__init__(self , name , **args ) * - * * - * def execute ( self ) : * - * 'Major method (from IAlgorithm interface)' * - * * - * # get some data from Transient Event Store * - * tracks = self.get('/Event/Rec/Tracks') * - * * - * tup = self.nTuple('My N-Tuple') * - * * - * for track in tracks : * - * * - * pt = track.pt () * - * p = track.p () * - * chi2 = track.chi2 () * - * * - * #fill N-tuple: * - * tup.column ( 'pt' , pt ) * - * tup.column ( 'p' , p ) * - * tup.column ( 'chi2' , chi2 ) * - * #commit the row * - * tup.write () * - * * - * return SUCCESS * - * * - ******************************************************************************* - """ - - pass - - -class objectmethod(object): - def __init__(self, m): - self.method = m - - def __call__(self, *args): - print(args) - return self.method(*args) - - -GaudiAlgo._Base = _GaudiAlgorithm -HistoAlgo._Base = _GaudiHistoAlg -TupleAlgo._Base = _GaudiTupleAlg - -# initialize is 'unique' method : -GaudiAlgo.initialize = _initialize_ -HistoAlgo.initialize = _initialize_histo_ -TupleAlgo.initialize = _initialize_tuple_ - - -def _start_(self): - """ - The stub 'start' method needed by the internal implementation of PyAlg<>. - """ - # return self._Base.start_(self) - return SUCCESS - - -GaudiAlgo.start = _start_ -HistoAlgo.start = _start_ -TupleAlgo.start = _start_ - - -def _execute_(self): - """ - The fictive 'execute' method, which MUST be overwitten by user - """ - raise RuntimeError( - "Execute method is not implemented for %s" % self.name()) - - -GaudiAlgo.execute = _execute_ -HistoAlgo.execute = _execute_ -TupleAlgo.execute = _execute_ - - -def _stop_(self): - """ - The stub 'stop' method needed by the internal implementation of PyAlg<>. - """ - # return self._Base.stop_(self) - return SUCCESS - - -GaudiAlgo.stop = _stop_ -HistoAlgo.stop = _stop_ -TupleAlgo.stop = _stop_ - -# ============================================================================= - - -def _plot1D_(s, *a): - """ - The basic method to fill (book-on-demand) 1D-histogram - - The histogram will be created/booked dautomatically according to the - specifications: - - - literal or numerical ID (optional) - - title - - low edge - - high edge - - number of bins (default is 100) - - The reference to the histogram is returned and could be used for later manipulations - - """ - return HistoDecorator.plot1D(s, *a) - - -# ============================================================================= - - -def _plot2D_(s, *a): - """ - The basic method to fill (book-on-demand) 2D-histogram - - The histogram will be created/booked dautomatically according to the - specifications: - - - literal or numerical ID (optional) - - title - - low X-edge - - high X-edge - - low Y-edge - - high Y-edge - - number of X-bins (default is 50) - - number of Y-bins (default is 50) - - The reference to the histogram is returned and could be used for later manipulations - - """ - return HistoDecorator.plot2D(s, *a) - - -# ============================================================================= - - -def _plot3D_(s, *a): - """ - The basic method to fill (book-on-demand) 3D-histogram - - The histogram will be created/booked dautomatically according to the - specifications: - - - literal or numerical ID (optional) - - title - - low X-edge - - high X-edge - - low Y-edge - - high Y-edge - - low Z-edge - - high Z-edge - - number of X-bins (default is 10) - - number of Y-bins (default is 10) - - number of Y-bins (default is 10) - - The reference to the histogram is returned and could be used for later manipulations - - """ - return HistoDecorator.plot3D(s, *a) - - -# ============================================================================= - - -def _profile1D_(s, *a): - """ - The basic method to fill (book-on-demand) 1D profile histogram - - The profile histogram will be created/booked dautomatically - according to the specifications: - - - literal or numerical ID (optional) - - title - - low X-edge - - high X-edge - - number of X-bins (default is 100) - - The reference to the histogram is returned and could be used for later manipulations - - """ - return HistoDecorator.profile1D(s, *a) - - -# ============================================================================= - - -def _profile2D_(s, *a): - """ - The basic method to fill (book-on-demand) 2D profile histiogram - - The profile histogram will be created/booked automatically - according to the specifications: - - - literal or numerical ID (optional) - - title - - low X-edge - - high X-edge - - low Y-edge - - high Y-edge - - number of X-bins (default is 50) - - number of Y-bins (default is 50) - - The reference to the histogram is returned and could be used for later manipulations - - """ - return HistoDecorator.profile2D(s, *a) - - -# ============================================================================= - -_plot1D_.__doc__ += "\n" + HistoDecorator.plot1D.__doc__ -_plot2D_.__doc__ += "\n" + HistoDecorator.plot2D.__doc__ -_plot3D_.__doc__ += "\n" + HistoDecorator.plot3D.__doc__ -_profile1D_.__doc__ += "\n" + HistoDecorator.profile1D.__doc__ -_profile2D_.__doc__ += "\n" + HistoDecorator.profile2D.__doc__ - - -def _decorate_plots_(klasses): - t = type(klasses) - if not issubclass(t, list) and not issubclass(t, tuple): - klasses = [klasses] - for klass in klasses: - klass.plot = _plot1D_ - klass.plot1D = _plot1D_ - klass.plot2D = _plot2D_ - klass.plot3D = _plot3D_ - klass.profile1D = _profile1D_ - klass.profile2D = _profile2D_ - - -_decorate_plots_(HistoAlgo) -_decorate_plots_(TupleAlgo) - - -# ============================================================================= -def _nTuple_(s, *a): - """ - Retrieve (book-on-demand) N-Tuple object - """ - return TupleAlgDecorator.nTuple(s, *a) - - -# ============================================================================= - - -def _evtCol_(s, *a): - """ - Retrieve (book-on-demand) N-Tuple object for Event Tag Collections - """ - return TupleAlgDecorator.evtCol(s, *a) - - -_nTuple_.__doc__ += "\n" + TupleAlgDecorator.nTuple.__doc__ -_evtCol_.__doc__ += "\n" + TupleAlgDecorator.evtCol.__doc__ - - -def _decorate_tuples_(klasses): - t = type(klasses) - if not issubclass(t, list) and not issubclass(t, tuple): - klasses = [klasses] - for klass in klasses: - klass.nTuple = _nTuple_ - klass.evtCol = _evtCol_ - klass.ntupleSvc = _ntupleSvc - klass.tupleSvc = _ntupleSvc - klass.ntupSvc = _ntupleSvc - klass.tupSvc = _ntupleSvc - klass.evtColSvc = _evtcolSvc - klass.evtcolSvc = _evtcolSvc - - -# ========================================================== -_decorate_tuples_(TupleAlgo) - -# "decorate N-Tuple object -Tuple = cpp.Tuples.Tuple -_Dec = TupleDecorator - - -class TupleDecColumnDispatcher(object): - """Helper decorator class to workaround ROOT-6697""" - - def __init__(self, func): - self.func = func - self.__doc__ = func.__doc__ - dispatcher = func.disp if hasattr(func, "disp") else func.__overload__ - - mapping = {int: "int", bool: "bool", float: "double"} - for k in mapping: - signature = ( - "const Tuples::Tuple& tuple, const string& name, const %s value" - % (mapping[k])) - mapping[k] = dispatcher(signature) - self.mapping = mapping - - def __call__(self, *a): - """ - Explicitly call the explicit signature for the case with 3 arguments and - the last one is 'int', 'bool' or 'float', for the other cases fall back - on the default dispatcher. - """ - if len(a) == 3: - t = type(a[-1]) - try: - return self.mapping[t](*a) - except KeyError: - pass - return self.func(*a) - - -if ROOT6WorkAroundEnabled("ROOT-6697") and (hasattr( - _Dec.column, "disp") or hasattr(_Dec.column, "__overload__")): - _Dec.column = TupleDecColumnDispatcher(_Dec.column) - - -def _t_nTuple_(s, *a): - """ - Access to underlying INTuple object - """ - return _Dec.nTuple(s, *a) - - -def _t_ntuple_(s, *a): - """ - Access to underlying NTuple::Tuple object - """ - return _Dec.ntuple(s, *a) - - -def _t_valid_(s, *a): - """ - Valid NTuple::Tuple object? - """ - return _Dec.valid(s, *a) - - -def _t_write_(s, *a): - """ - Commit the row/record to n-tuple - """ - return _Dec.write(s, *a) - - -def _t_column_(s, *a): - """ - Fill the certain column to n-tuple - """ - return _Dec.column(s, *a) - - -def _t_column_ll_(s, *a): - """ - Fill the 'long long' column - """ - return _Dec.column_ll(s, *a) - - -def _t_column_ull_(s, *a): - """ - Fill the 'unsigned long long' column - """ - return _Dec.column_ull(s, *a) - - -def _t_array_(s, *a): - """ - Fill the fixed-size array column - """ - return _Dec.array(s, *a) - - -def _t_matrix_(s, *a): - """ - Fill the fixed-size matrix column - """ - return _Dec.matrix(s, *a) - - -def _t_farray_(s, *a): - """ - Fill the floating-size array column - """ - return _Dec.farray(s, *a) - - -def _t_fmatrix_(s, *a): - """ - Fill the floating-size matrix column - """ - return _Dec.fmatrix(s, *a) - - -_t_nTuple_.__doc__ += "\n" + _Dec.nTuple.__doc__ -_t_ntuple_.__doc__ += "\n" + _Dec.ntuple.__doc__ -_t_valid_.__doc__ += "\n" + _Dec.valid.__doc__ -_t_write_.__doc__ += "\n" + _Dec.write.__doc__ -_t_column_.__doc__ += "\n" + _Dec.column.__doc__ -_t_column_ll_.__doc__ += "\n" + _Dec.column_ll.__doc__ -_t_column_ull_.__doc__ += "\n" + _Dec.column_ull.__doc__ -_t_array_.__doc__ += "\n" + _Dec.array.__doc__ -_t_matrix_.__doc__ += "\n" + _Dec.matrix.__doc__ -_t_farray_.__doc__ += "\n" + _Dec.farray.__doc__ -_t_fmatrix_.__doc__ += "\n" + _Dec.fmatrix.__doc__ - -Tuple.nTuple = _t_nTuple_ -Tuple.ntuple = _t_ntuple_ -Tuple.valid = _t_valid_ -Tuple.write = _t_write_ -Tuple.column = _t_column_ -Tuple.column_ll = _t_column_ll_ -Tuple.column_ull = _t_column_ull_ -Tuple.array = _t_array_ -Tuple.matrix = _t_matrix_ -Tuple.farray = _t_farray_ -Tuple.fmatrix = _t_fmatrix_ - -_alg_map_ = { - "__init__": _init_, # constructor - "tool": _tool_, # service locator - "svc": _service_, # tool locator - "evtSvc": _evtSvc, # event data service - "eventSvc": _evtSvc, # event data service - "detSvc": _detSvc, # detector data service - "histoSvc": _histoSvc, # histogram data service - "histSvc": _histoSvc, # histogram data service - "get": _get, # access to event data - "get_": _get_, # access to event data - "exist_": _exist_, # check the event data - "getDet": _getDet, # access to detector data - "finalize": _finalize_, # algorithm finalization - # - "hasProperty": - _hasProperty_, # check the existence of property with given name - "getProperty": _getProperty_, # get the property value with given name - "setProperty": _setProperty_, # set the property with given name - "__setattr__": _set_attr_, # set the attribute/property with given name - "__getattr__": _get_attr_, # set the attribute/property with given name -} - - -# decorate the classes with the useful methods -def _decorate_algs_(klasses): - t = type(klasses) - if not issubclass(t, list) and not issubclass(t, tuple): - klasses = [klasses] - for _alg in klasses: - for key in _alg_map_: - setattr(_alg, key, _alg_map_[key]) - - -# = -_decorate_algs_(GaudiAlgo) -_decorate_algs_(HistoAlgo) -_decorate_algs_(TupleAlgo) - -# ============================================================================= -# Helper function to fill histogram/ntuple using 'map'-operation -# ============================================================================= - - -def mapvct(func, sequence, ovct=None): - """Helper function to fill histogram/ntuple using 'map'-operation""" - if not ovct: - vct = GaudiPython.Vector - else: - vct = ovct - if hasattr(sequence, "size"): - vct.reserve(vct.size() + sequence.size()) - elif hasattr(sequence, "__len__"): - vct.reserve(vct.size() + len(sequence)) - for object in sequence: - vct.push_back(func(object)) - if not ovct: - return vct - - -# ============================================================================= - - -# ============================================================================= -# get the list of tools -# ============================================================================= -def _get_all_tools_(self, method): - """ - Get all tools - """ - _tools = std.vector("IAlgTool*")() - _func = getattr(AlgDecorator, method) - _num = _func(self, _tools) - if _tools.size() != _num: - raise RuntimeError("Unable to extract Tools") - _res = [] - for _tool in _tools: - _res += [iAlgTool(_tool.name(), _tool)] - return _res - - -# ============================================================================= - - -def _Tools_a_(self): - """ - Retrieve the list of tools, - aquired by component through GaudiCommon<TYPE> base: - - >>> alg = ... ## get the algorithm - >>> tools = alg.Tools() ## get the tools - >>> for tool in tools : - ... print(tool) - - """ - _cmp = getattr(self, "_ialg") - if not _cmp: - self.retrieveInterface() - _cmp = getattr(self, "_ialg") - return _get_all_tools_(_cmp, "_tools_a_") - - -# ============================================================================= - - -def _Tools_t_(self): - """ - Retrieve the list of tools, - aquired by component through GaudiCommon<TYPE> base: - - >>> tool = ... ## get the tool - >>> tools = tool.Tools() ## get the tools - >>> for t in tools : - ... print(t) - - """ - _cmp = getattr(self, "_itool") - if not _cmp: - self.retrieveInterface() - _cmp = getattr(self, "_itool") - return _get_all_tools_(_cmp, "_tools_t_") - - -# ============================================================================= -# get the counter -# ============================================================================= - - -def _get_counter_(self, method, name): - """ - get the counter - """ - _func = getattr(AlgDecorator, method) - return _func(self, name) - - -# ============================================================================== - - -def _Counter_a_(self, name): - """ - Retrieve the counter managed GaudiCommon<TYPE> base by name: - - >>> alg = ... ## get the algorithm - >>> cnt = alg.Counter('#accept') ## get the counter - >>> print(cnt) - - """ - _cmp = getattr(self, "_ialg") - if not _cmp: - self.retrieveInterface() - _cmp = getattr(self, "_ialg") - return _get_counter_(_cmp, "_counter_a_", name) - - -# ============================================================================== - - -def _Counter_t_(self, name): - """ - Retrieve the counter managed GaudiCommon<TYPE> base by name: - - >>> tool = ... ## get the tool - >>> cnt = tool.Counter('#accept') ## get the counter - >>> print(cnt) - - """ - _cmp = getattr(self, "_itool") - if not _cmp: - self.retrieveInterface() - _cmp = getattr(self, "_itool") - return _get_counter_(_cmp, "_counter_t_", name) - - -# ============================================================================= -# get all histos -# ============================================================================= -cpp.GaudiAlg.ID.__repr__ = cpp.GaudiAlg.ID.idAsString -cpp.GaudiAlg.ID.__str__ = cpp.GaudiAlg.ID.idAsString -cpp.StatEntity.__repr__ = cpp.StatEntity.toString -cpp.StatEntity.__str__ = cpp.StatEntity.toString - -# ============================================================================= - - -def _get_all_histos_(component, method, name): - """ - Get All histogram form the component - """ - _res = {} - for _his in ( - std.vector("AIDA::IProfile2D*"), - std.vector("AIDA::IProfile1D*"), - std.vector("AIDA::IHistogram3D*"), - std.vector("AIDA::IHistogram2D*"), - std.vector("AIDA::IHistogram1D*"), - ): - _his = _his() - _ids = std.vector("GaudiAlg::ID")() - _fun = getattr(HistoDecorator, method) - _num = _fun(component, _ids, _his) - if _ids.size() != _num or _his.size() != _num: - raise RuntimeError("Unable to extract Histos!") - for _i in range(0, _num): - _id = _ids[_i] - if _id.numeric(): - _id = _id.numericID() - elif _id.literal(): - _id = _id.literalID() - else: - _id = _id.idAsString() - _res[_id] = _his[_i] - - if not name: - return _res # return the dictionary - - id = cpp.GaudiAlg.ID(name) - for i in (name, id.literalID(), id.numericID(), id.idAsString(), id): - h = _res.get(i, None) - if not not h: - return h # return the histogram - - return None - - -# ============================================================================= - - -def _Histos_a_(self, name=None): - """ - Retrieve all histograms & profiles, booked through GauydiHistos<TYPE> base: - - >>> alg = ... ## get the algorithm - >>> histos = alg.Histos() ## get all histograms & profiles - >>> for key in histos : - ... print(key, histos[key]) - - Retrive the histogram with the certain ID : - - >>> alg = ... ## get the algorithm - >>> histo = alg.Histos('some histo ID') ## get the histo by ID - >>> print(histo) - - """ - _cmp = getattr(self, "_ialg") - if not _cmp: - self.retrieveInterface() - _cmp = getattr(self, "_ialg") - return _get_all_histos_(_cmp, "_histos_a_", name) - - -# ============================================================================= - - -def _Histos_t_(self, name=None): - """ - Retrieve all histograms & profiles, booked through GauydiHistos<TYPE> base: - - >>> tool = ... ## get the tool - >>> histos = tool.Histos() ## get all histograms & profiles - >>> for key in histos : - ... print(key, histos[key]) - - Retrive the historgam with certain ID : - - >>> tool = ... ## get the tool - >>> histo = tool.Histos('some histo ID') ## get the histo by ID - >>> print(histo) - - """ - _cmp = getattr(self, "_itool") - if not _cmp: - self.retrieveInterface() - _cmp = getattr(self, "_itool") - return _get_all_histos_(_cmp, "_histos_t_", name) - - -# ============================================================================= - -_Tools_a_.__doc__ += "\n" + AlgDecorator._tools_a_.__doc__ -_Tools_t_.__doc__ += "\n" + AlgDecorator._tools_t_.__doc__ -_Counter_a_.__doc__ += "\n" + AlgDecorator._counter_a_.__doc__ -_Counter_t_.__doc__ += "\n" + AlgDecorator._counter_t_.__doc__ -_Histos_a_.__doc__ += "\n" + HistoDecorator._histos_a_.__doc__ -_Histos_t_.__doc__ += "\n" + HistoDecorator._histos_t_.__doc__ - -iAlgorithm.Tools = _Tools_a_ -iAlgTool.Tools = _Tools_t_ -iAlgorithm.Counter = _Counter_a_ -iAlgTool.Counter = _Counter_t_ -iAlgorithm.Histos = _Histos_a_ -iAlgTool.Histos = _Histos_t_ - -# finally add some decoration for histograms -import GaudiPython.HistoUtils - -# ============================================================================= -# pseudo help -# ============================================================================= - - -def _help_(): - print(__doc__, __author__) - print("\t\t\tDoc-string for class GaudiAlgo \n", GaudiAlgo.__doc__) - print("\t\t\tDoc-string for class HistoAlgo \n", HistoAlgo.__doc__) - print("\t\t\tDoc-string for class TupleAlgo \n", TupleAlgo.__doc__) - - -# ============================================================================= -# pseudo-test suite -# ============================================================================= -if __name__ == "__main__": - _help_() - -# ============================================================================= -# The END -# ============================================================================= diff --git a/GaudiAlg/python/GaudiAlg/HistoUtils.py b/GaudiAlg/python/GaudiAlg/HistoUtils.py deleted file mode 100644 index 8982128f3bd..00000000000 --- a/GaudiAlg/python/GaudiAlg/HistoUtils.py +++ /dev/null @@ -1,1070 +0,0 @@ -#!/usr/bin/env python3 -##################################################################################### -# (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations # -# # -# This software is distributed under the terms of the Apache version 2 licence, # -# copied verbatim in the file "LICENSE". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -##################################################################################### -# ============================================================================= -# This module contains set of simple and useful utilities for booking and -# manipulations with Gaudi-AIDA histograms, inspired by Thomas' request -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2007-08-03 -# ============================================================================= -""" -This module contains set of simple and useful utilities for booking and -manipulations with Gaudi-AIDA histograms, inspired by Thomas' request - -The module contains following public symbols: - - - book for booking of various 1D,2D&3D-histograms - - bookProf for booking of various 1D&2D-profiles - - getAsAIDA for retrieval of histograms/profiles from HTS in AIDA format - - getAsROOT for retrieval of histograms/profiles from HTS in ROOT format - - fill for smart filling of 1D-histogram (AIDA or ROOT) - - aida2root for conversion of AIDA histogram to ROOT - - HistoStats for many statistical information - - HistoFile class for storing histograms to a file - - histoDump for dumping of the histogram in text format (a'la HBOOK) - - dumpHisto for dumping of the histogram in text format (a'la HBOOK) - -""" - -# ============================================================================= -__author__ = "Vanya BELYAEV ibelyaev@physics.syr.edu" -# ============================================================================= -__all__ = ( - "book", # book AIDA histogram using Histogram Service - "bookProf", # book AIDA profile histogram using Histogram Service - "getAsAIDA", # get the histogram form Histogram Service as AIDA histogram - "getAsROOT", # get the histogram form Histogram Service as AIDA histogram - "fill", # "power-fill" method for filling of histograms - "aida2root", # AIDA -> ROOT converter - "HistoStats", # statistical information for 1D-histograms - "HistoFile", # class for storing histograms to a file - "histoDump", # dump histogramintext format a'la HBOOK - "dumpHisto", # dump histogramintext format a'la HBOOK -) -# ============================================================================= -# import core of Gaudi -import ROOT -from GaudiPython.Bindings import AppMgr -from GaudiPython.Bindings import gbl as cpp -from GaudiPython.Bindings import iHistogramSvc - -HID = cpp.GaudiAlg.ID - -## global flag -useROOT = False - -# ============================================================================= -# Helper private auxiliary function to get Application Manager - - -def _getAppMgr(**kwargs): - """ - Helper private auxiliary function to get Application Manager - """ - gaudi = kwargs.get("gaudi", None) - if not gaudi: - gaudi = AppMgr() - if not gaudi: - raise RuntimeError("Unable to get valid ApplicationMgr") - - state = gaudi._isvc.FSMState() - if state < cpp.Gaudi.StateMachine.CONFIGURED: - gaudi.config() - state = gaudi._isvc.FSMState() - if state < cpp.Gaudi.StateMachine.INITIALIZED: - gaudi.initialize() - - return gaudi # RETURN - - -# ============================================================================= -# Helper private auxiliary function to get iHistogramSvs - - -def _getHistoSvc(**kwargs): - """ - Helper private auxiliary function to get iHistogramSvs - """ - svc = kwargs.get("service", None) - if not svc: - svc = kwargs.get("svc", None) - else: - return svc # RETURN - gaudi = _getAppMgr(**kwargs) - return gaudi.histsvc() # RETURN - - -# ============================================================================= -# Helper private auxiliary function to get iDataSvs - - -def _getEvtSvc(**kwargs): - """ - Helper private auxiliary function to get iDataSvs - """ - svc = kwargs.get("service", None) - if not svc: - svc = kwargs.get("svc", None) - else: - return svc # RETURN - gaudi = _getAppMgr(**kwargs) - return gaudi.evtsvc() # RETURN - - -# ============================================================================= -# The trivial function to book the various 1D,2D&3D-histograms - - -def book(*args, **kwargs): - """ - The trivial function to book the various 1D,2D&3D-histograms - - (1) book the trivial 1D histogram with full path - - >>> h1D = book ( 'path/to/my/histo' , ## path in Histogram Transient Store - 'cosine of decay angle ' , ## histogram title - 100 , ## number of bins - -1 , ## low edge - 100 ) ## high edge - - (2) book the trivial 1D histogram with directory path and string ID : - - >>> h1D = book ( 'path/to/directory' , ## the path to directory in HTS - 'H1' , ## string histogram identifier - 'cosine of decay angle ' , ## histogram title - 100 , ## number of bins - -1 , ## low edge - 100 ) ## high edge - - (3) book the trivial 1D histogram with directory path and integer ID : - - >>> h1D = book ( 'path/to/directory' , ## the path to directory in HTS - 124 , ## integer histogram identifier - 'cosine of decay angle ' , ## histogram title - 100 , ## number of bins - -1 , ## low edge - 100 ) ## high edge - - (4) book the trivial 2D histogram with full path - - >>> h1D = book ( 'path/to/my/histo' , ## path in Histogram Transient Store - 'm12**2 versus m13**2' , ## histogram title - 50 , ## number of X-bins - 1.0 , ## low X-edge - 4.0 , ## high X-edge - 50 , ## number of Y-bins - 1 , ## low Y-edge - 2 ) ## high Y-edge - - (5) book the trivial 2D histogram with directory path and literal ID - - >>> h1D = book ( 'path/to/directory' , ## path in Histogram Transient Store - 'Dalitz1' , ## literal histogram identifier - 'm12**2 versus m13**2' , ## histogram title - 50 , ## number of X-bins - 1.0 , ## low X-edge - 4.0 , ## high X-edge - 50 , ## number of Y-bins - 1 , ## low Y-edge - 2 ) ## high Y-edge - - (6) book the trivial 2D histogram with directory path and integer ID - - >>> h1D = book ( 'path/to/directory' , ## path in Histogram Transient Store - 854 , ## integer histogram identifier - 'm12**2 versus m13**2' , ## histogram title - 50 , ## number of X-bins - 1.0 , ## low X-edge - 4.0 , ## high X-edge - 50 , ## number of Y-bins - 1.0 , ## low Y-edge - 4.0 ) ## high Y-edge - - (7) book the trivial 3D histogram with full path - - >>> h1D = book ( 'path/to/my/histo' , ## path in Histogram Transient Store - 'x vs y vs z ' , ## histogram title - 10 , ## number of X-bins - -1.0 , ## low X-edge - 1.0 , ## high X-edge - 10 , ## number of Y-bins - -1.0 , ## low Y-edge - 1.0 , ## high Y-edge - 10 , ## number of Z-bins - -1.0 , ## low Z-edge - 1.0 ) ## high Z-edge - - (8) book the trivial 3D histogram with directory path and literal ID - - >>> h1D = book ( 'path/to/directory' , ## path in Histogram Transient Store - 'xyz' , ## literal histogram identifier - 'x vs y vs z' , ## histogram title - 10 , ## number of X-bins - -1.0 , ## low X-edge - 1.0 , ## high X-edge - 10 , ## number of Y-bins - -1.0 , ## low Y-edge - 1.0 , ## high Y-edge - 10 , ## number of Z-bins - -1.0 , ## low Z-edge - 1.0 ) ## high Z-edge - - (9) book the trivial 3D histogram with directory path and integer ID - - >>> h1D = book ( 'path/to/directory' , ## path in Histogram Transient Store - 888 , ## integer histogram identifier - 'x vs y vs z' , ## histogram title - 10 , ## number of X-bins - -1.0 , ## low X-edge - 1.0 , ## high X-edge - 10 , ## number of Y-bins - -1.0 , ## low Y-edge - 1.0 , ## high Y-edge - 10 , ## number of Z-bins - -1.0 , ## low Z-edge - 1.0 ) ## high Z-edge - - Many other booking methods are available, - e.g. for the histograms with non-equidistant bins, see IHistogamSvc::book - - """ - if useROOT or kwargs.get("useROOT", - False) or not kwargs.get("useAIDA", True): - from ROOT import TH1D - - a0 = args[0] - a1 = args[1] - a2 = args[2] - if not isinstance(a1, str): - a1 = "h" + str(a1) - if isinstance(a2, str): - return TH1D(a0 + a1, a2, *args[3:]) - else: - return TH1D(a0, a1, *args[2:]) - - svc = _getHistoSvc(**kwargs) - if not svc: - raise RuntimeError("Unable to get valid HistogramService ") - # book the histogram using the service - return svc.book(*args) # RETURN - - -book.__doc__ += ( - "\n\n" + "\thelp(iHistogramSvc.book) : \n\n" + iHistogramSvc.book.__doc__) -book.__doc__ += ("\n\n" + "\thelp(IHistogramSvc::book) : \n\n" + - cpp.IHistogramSvc.book.__doc__) - -# ============================================================================= -# The trivial function to book 1D&2D profile histograms: - - -def bookProf(*args, **kwargs): - """ - - The trivial function to book 1D&2D profile histograms: - - (1) book 1D-profile histogram with full path in Histogram Transient Store: - >>> histo = bookProf ( 'path/to/my/profile' , ## path in Histogram Transient Store - 'Energy Correction' , ## the histogram title - 100 , ## number of X-bins - 0.0 , ## low X-edge - 100 ) ## high X-edge - - (2) book 1D-profile histogram with directory path and literal ID - >>> histo = bookProf ( 'path/to/my/profile' , ## path in Histogram Transient Store - 'Calibration' , ## the histogram literal identifier - 'Energy Correction' , ## the histogram title - 100 , ## number of X-bins - 0.0 , ## low X-edge - 100 ) ## high X-edge - - (3) book 1D-profile histogram with directory path and integer ID - >>> histo = bookProf ( 'path/to/my/profile' , ## path in Histogram Transient Store - 418 , ## the histogram integer identifier - 'Energy Correction' , ## the histogram title - 100 , ## number of X-bins - 0.0 , ## low X-edge - 100 ) ## high X-edge - - (4) book 2D-profile histogram with full path in Histogram Transient Store: - >>> histo = bookProf ( 'path/to/my/profile' , ## path in Histogram Transient Store - 'Energy Correction' , ## the histogram title - 50 , ## number of X-bins - 0.0 , ## low X-edge - 100 , ## high X-edge - 50 , ## number of Y-bins - 0.0 , ## low Y-edge - 100 ) ## high Y-edge - - (5) book 2D-profile histogram with directory path and literal ID - >>> histo = bookProf ( 'path/to/my/profile' , ## path in Histogram Transient Store - 'Calibration' , ## the histogram literal identifier - 'Energy Correction' , ## the histogram title - 50 , ## number of X-bins - 0.0 , ## low X-edge - 100 , ## high X-edge - 50 , ## number of Y-bins - 0.0 , ## low Y-edge - 100 ) ## high Y-edge - - (6) book 2D-profile histogram with directory path and integer ID - >>> histo = bookProf ( 'path/to/my/profile' , ## path in Histogram Transient Store - 418 , ## the histogram integer identifier - 'Energy Correction' , ## the histogram title - 50 , ## number of X-bins - 0.0 , ## low X-edge - 100 , ## high X-edge - 50 , ## number of Y-bins - 0.0 , ## low Y-edge - 100 ) ## high Y-edge - - Many other booking methods are available, - e.g. for the histograms with non-equidistant bins, see IHistogamSvc::book - - """ - svc = _getHistoSvc(**kwargs) - if not svc: - raise RuntimeError("Unable to get valid HistogramService ") - # book the histogram using the service - return svc.bookProf(*args) # RETURN - - -bookProf.__doc__ += ("\n\n" + "\thelp(iHistogramSvc.bookProf) : \n\n" + - iHistogramSvc.bookProf.__doc__) -bookProf.__doc__ += ("\n\n" + "\thelp(IHistogramSvc::bookProf) : \n\n" + - cpp.IHistogramSvc.bookProf.__doc__) - -# ============================================================================= -# The most trivial function to retrieve the histogram from Histogram Transient Store - - -def getAsAIDA(path, **kwargs): - """ - - The most trivial function to retrieve the histogram from Histogram Transient Store - The histogram is returned by reference to its AIDA-representation (if possible) - - >>> h = getAsAIDA ( 'some/path/to/my/histogram' ) - - """ - svc = _getHistoSvc(**kwargs) - if not svc: - raise RuntimeError("Unable to get valid HistogramService ") - # return the histogram - return svc.getAsAIDA(path) # RETURN - - -getAsAIDA.__doc__ += ("\n\n" + "\thelp(iHistogramSvc.getAsAIDA) : \n\n" + - iHistogramSvc.getAsAIDA.__doc__) -getAsAIDA.__doc__ += ("\n\n" + "\thelp(iHistogramSvc.retrieve) : \n\n" + - iHistogramSvc.retrieve.__doc__) - -# ============================================================================= -# The most trivial function to retrieve the histogram from Histogram Transient Store - - -def getAsROOT(path, **kwargs): - """ - - The most trivial function to retrieve the histogram from Histogram Transient Store - The histogram is returned by reference to its underlying native ROOT-representation (if possible) - - >>> h = getAsROOT ( 'some/path/to/my/histogram' ) - - """ - svc = _getHistoSvc(**kwargs) - if not svc: - raise RuntimeError("Unable to get valid HistogramService ") - # return the histogram - return svc.getAsROOT(path) # RETURN - - -getAsROOT.__doc__ += ("\n\n" + "\thelp(iHistogramSvc.getAsROOT) : \n\n" + - iHistogramSvc.getAsROOT.__doc__) - - -# ============================================================================= -# The function which allows 'the smart fill' of 1D-histogram -def fill( - histo, # histogram - data, # input data - fun=lambda x: x, # function to be used - cut=lambda x: True, # cut to be applied - **kwargs): # optional extra arguments - """ - - The function which allows 'the smart fill' of 1D-histogram - - >>> histo = ... - - The most trivial case, fill with the value - >>> fill ( histo , 1.0 ) - - Fill from any iterable object (sequence) - >>> fill ( histo , [1,,2,3,4,5,10] ) - - Fill from iterable object and apply the function: - >>> fill ( histo , [1,2,3,4,5] , math.sin ) - - Use lambda form: - >>> fill ( histo , [1,2,3,4,5] , lambda x : x*x ) - - The same - >>> fill ( histo , [1,2,3,4,5] , fun = lambda x : x*x ) - - Use internal attributes: - >>> tracks = evtSvc['Rec/Track/Best'] ## iterable container of tracks - >>> fill ( histo , tracks , lambda t : t.pt() ) - - Apply the predicate: fill only even numbers: - >>> fill ( histo , [1,2,3,4,5,6,7] , lambda x : x , lambda y : y%2 ) - - The same (omit the trivial function) : - >>> fill ( histo , [1,2,3,4,5,6,7] , cut = lambda y : y%2 ) - - Apply the predicate: fill only pt for positively charged tracks: - >>> tracks = evtSvc['Rec/Track/Best'] - >>> fill ( histo , tracks , lambda t : t.pt() , lambda t : 0<t.charge() ) - - The same: - >>> fill ( histo , tracks , - fun = lambda t : t.pt() , - cut = lambda t : 0<t.charge() ) - - Ordinary functions are also fine: - >>> def myfun ( track ) : return sin( track.pt() + track.p() ) - >>> def mycut ( track ) : return track.p() > 100 * GeV - >>> fill ( histo , tracks , myfun , mycut ) - - The 'data' could be the address in TES, in this case the object - is retrieved from TES and the method is applied to the objects, - retrieved from TES: - >>> fill ( histo , ## the reference to the histogram - 'Rec/Track/Best' , ## the location of objects in TES - lambda t : t.pt() ) ## function to be used for histogram fill - >>> fill ( histo , ## the reference to the histogram - 'Rec/Track/Best' , ## the address of objects in TES - lambda t : t.pt() , ## the function to be used for histogram fill - lambda t : t.charge()>0 ) ## the criteria to select tracks - - The arguments 'fun' and 'cut' could be strings, in this case - they are evaluated by python before usage. - This option could be often very useful. - - """ - - # if value is a string, try to get the objects from TES - if isinstance(data, str): - svc = _getEvtSvc(**kwargs) - data = svc[data] - return fill(histo, data, fun, cut, **kwargs) - - # if the function is a string: evaluate it! - if isinstance(fun, str): - fun = eval(fun, globals()) - - # if the criterion is a string: evaluate it! - if isinstance(cut, str): - cut = eval(cut, globals()) - - if not hasattr(data, "__iter__"): - data = [data] - - if not hasattr(histo, "fill") and hasattr(histo, "Fill"): - setattr(histo, "fill", getattr(histo, "Fill")) - - for item in data: - if not cut(item): - continue # CONTINUE - histo.fill(fun(item)) - - return histo # RETURN - - -# ============================================================================= -# AIDA -> ROOT converter -aida2root = cpp.Gaudi.Utils.Aida2ROOT.aida2root - -# ============================================================================= -# Convert AIDA to ROOT - - -def _to_root_(self): - """ - Convert AIDA to ROOT - - >>> aida = ... ## get AIDA histogram - >>> root = aida.toROOT() ## convert it to ROOT - - """ - return aida2root(self) - - -_to_root_.__doc__ += aida2root.__doc__ - -for t in ( - cpp.AIDA.IHistogram3D, - cpp.AIDA.IHistogram2D, - cpp.AIDA.IHistogram1D, - cpp.AIDA.IProfile2D, - cpp.AIDA.IProfile1D, -): - if not hasattr(t, "Fill") and hasattr(t, "fill"): - setattr(t, "Fill", getattr(t, "fill")) - for attr in ("toROOT", "toRoot", "asROOT", "asRoot", "AsROOT", "AsRoot"): - if not hasattr(t, attr): - setattr(t, attr, _to_root_) - -cpp.AIDA.IHistogram3D.__repr__ = lambda s: cpp.GaudiAlg.Print3D.toString( - s, HID(s.title()) -) -cpp.AIDA.IHistogram3D.__str__ = cpp.AIDA.IHistogram3D.__repr__ - -HistoStats = cpp.Gaudi.Utils.HistoStats - -# ============================================================================= -# Evaluate 'bin-by-bin' momentum of certain order around the value - - -def _moment_(self, order, value=0): - """ - Evaluate 'bin-by-bin' momentum of order 'order' around the value 'value' - for 1D histogram - - >>> h1 = ... - >>> print(h1.moment ( 5 )) - - """ - return HistoStats.moment(self, order, value) - - -# ============================================================================= -# Evaluate error in 'bin-by-bin' momentum of certain order around the value - - -def _momentErr_(self, order): - """ - Evaluate error for 'bin-by-bin' momentum of order 'order' around the value 'value' - for 1D histogram - - >>> h1 = ... - >>> print(h1.momentErr ( 5 )) - - """ - return HistoStats.momentErr(self, order) - - -# ============================================================================= -# Evaluate 'bin-by-bin' central momentum (around mean value) - - -def _centralMoment_(self, order): - """ - Evaluate 'bin-by-bin' central momentum (around mean value) - for 1D histogram - - >>> h1 = ... - >>> print(h1.centralMoment ( 5 )) - - """ - return HistoStats.centralMoment(self, order) - - -# ============================================================================= -# Evaluate error in 'bin-by-bin' momentum of certain order around the value - - -def _centralMomentErr_(self, order): - """ - Evaluate error for 'bin-by-bin' central momentum (around mean value) - for 1D histogram - - >>> h1 = ... - >>> print(h1.centralMomentErr ( 5 )) - - """ - return HistoStats.centralMomentErr(self, order) - - -# ============================================================================= -# Evaluate 'bin-by-bin' skewness for 1D histogram - - -def _skewness_(self): - """ - Evaluate 'bin-by-bin' skewness for 1D AIDA histogram - - >>> h1 = ... - >>> print(h1.skewness()) - - """ - return HistoStats.skewness(self) - - -# ============================================================================= -# Evaluate error for 'bin-by-bin' skewness for 1D histogram - - -def _skewnessErr_(self): - """ - Evaluate error for 'bin-by-bin' skewness - - >>> h1 = ... - >>> print(h1.skewnessErr()) - - """ - return HistoStats.skewnessErr(self) - - -# ============================================================================= -# Evaluate 'bin-by-bin' kurtosis for 1D histogram - - -def _kurtosis_(self): - """ - Evaluate 'bin-by-bin' kurtosis - - >>> h1 = ... - >>> print(h1.kurtosis ()) - - """ - return HistoStats.kurtosis(self) - - -# ============================================================================= -# Evaluate error for 'bin-by-bin' kurtosis for 1D histogram - - -def _kurtosisErr_(self): - """ - Evaluate error for 'bin-by-bin' kurtotis for 1D AIDA histogram - - >>> h1 = ... - >>> print(h1.kurtotisErr()) - - """ - return HistoStats.kurtosisErr(self) - - -# ============================================================================= - - -def _nEff_(self): - """ - Number of equivalent entries - """ - return HistoStats.nEff(self) - - -# ============================================================================= - - -def _mean_(self): - """ - Evaluate the MEAN value - """ - return HistoStats.mean(self) - - -# ============================================================================= - - -def _meanErr_(self): - """ - Evaluate the error for MEAN estimate - """ - return HistoStats.meanErr(self) - - -# ============================================================================= - - -def _rms_(self): - """ - Evaluate the RMS for AIDA histogram - """ - return HistoStats.rms(self) - - -# ============================================================================= - - -def _rmsErr_(self): - """ - Evaluate the error for RMS estimate - """ - return HistoStats.rmsErr(self) - - -# ============================================================================= - - -def _sumBinHeightErr_(self): - """ - Get an error in the sum bin height ('in-range integral') - """ - return HistoStats.sumBinHeightErr(self) - - -# ============================================================================= - - -def _sumAllBinHeightErr_(self): - """Get an error in the sum bin height ('in-range integral')""" - return HistoStats.sumAllBinHeightErr(self) - - -# ============================================================================= - - -def _overflowEntriesFrac_(self): - """ - The fraction of overflow entries (useful for shape comparison) - """ - return HistoStats.overflowEntriesFrac(self) - - -# ============================================================================= - - -def _overflowEntriesFracErr_(self): - """ - The error for fraction of overflow entries (useful for shape comparison) - """ - return HistoStats.overflowEntriesFracErr(self) - - -# ============================================================================= - - -def _underflowEntriesFrac_(self): - """ - The fraction of underflow entries (useful for shape comparison) - """ - return HistoStats.underflowEntriesFrac(self) - - -# ============================================================================= - - -def _underflowEntriesFracErr_(self): - """ - The error for fraction of underflow entries (useful for shape comparison) - """ - return HistoStats.underflowEntriesFracErr(self) - - -# ============================================================================= - - -def _overflowIntegralFrac_(self): - """ - The fraction of overflow integral (useful for shape comparison) - """ - return HistoStats.overflowIntegralFrac(self) - - -# ============================================================================= - - -def _overflowIntegralFracErr_(self): - """ - The error for fraction of overflow integral (useful for shape comparison) - """ - return HistoStats.overflowIntegralFracErr(self) - - -# ============================================================================= - - -def _underflowIntegralFrac_(self): - """ - The fraction of underflow integral (useful for shape comparison) - """ - return HistoStats.underflowIntegralFrac(self) - - -# ============================================================================= - - -def _underflowIntegralFracErr_(self): - """ - The error for fraction of underflow integral (useful for shape comparison) - """ - return HistoStats.underflowIntegralFracErr(self) - - -# ============================================================================= -# get number of entries in histogram up to the certain bin (not-included) -# get number of entries in histogram form the certain -# minimal bin up to the certain maximal bin (not-included) - - -def _nEntries_(self, i1, i2=-10000000): - """ - Get number of entries in histogram up to the certain bin (not-included) - - attention: underflow bin is included! - - >>> h1 - >>> print(h1.nEntries ( 10 )) - - Get number of entries in histogram form the certain - minimal bin up to the certain maximal bin (not-included) - - >>> h1 - >>> print(h1.nEntries ( 10 , 15 )) - - """ - if i2 < i1 or i2 < 0: - return HistoStats.nEntries(self, i1) - return HistoStats.nEntries(self, i1, i2) - - -# ============================================================================= - - -def _nEntriesFrac_(self, i1, i2=-10000000): - """ - Get the fraction of entries in histogram up to the certain bin (not-included) - - attention: underflow bin is included! - - >>> h1 - >>> print(h1.nEntriesFrac ( 10 )) - - Get the fraction of entries in histogram form the certain - minimal bin up to the certain maximal bin (not-included) - - >>> h1 - >>> print(h1.nEntriesFrac ( 10 , 15 )) - - """ - if i2 < i1 or i2 < 0: - return HistoStats.nEntriesFrac(self, i1) - return HistoStats.nEntriesFrac(self, i1, i2) - - -# ============================================================================= - - -def _nEntriesFracErr_(self, i1, i2=-10000000): - """ - Get error for fraction of entries in histogram up to the certain bin (not-included) - - attention: underflow bin is included! - - >>> h1 - >>> print(h1.nEntriesFracErr( 10 )) - - Get error fraction of entries in histogram form the certain - minimal bin up to the certain maximal bin (not-included) - - >>> h1 - >>> print(h1.nEntriesFracErr ( 10 , 15 )) - - """ - if i2 < i1 or i2 < 0: - return HistoStats.nEntriesFracErr(self, i1) - return HistoStats.nEntriesFracErr(self, i1, i2) - - -# ============================================================================= -i1DH = cpp.AIDA.IHistogram1D - -if not hasattr(i1DH, "moment"): - i1DH.moment = _moment_ -if not hasattr(i1DH, "momentErr"): - i1DH.momentErr = _momentErr_ -if not hasattr(i1DH, "centralMoment"): - i1DH.centralMoment = _centralMoment_ -if not hasattr(i1DH, "momentMomentErr"): - i1DH.centralMomentErr = _centralMomentErr_ -if not hasattr(i1DH, "nEff"): - i1DH.nEff = _nEff_ -if not hasattr(i1DH, "mean"): - i1DH.mean = _mean_ -if not hasattr(i1DH, "meanErr"): - i1DH.meanErr = _meanErr_ -if not hasattr(i1DH, "rms"): - i1DH.rms = _rms_ -if not hasattr(i1DH, "rmsErr"): - i1DH.rmsErr = _rmsErr_ -if not hasattr(i1DH, "skewness"): - i1DH.skewness = _skewness_ -if not hasattr(i1DH, "skewnessErr"): - i1DH.skewnessErr = _skewnessErr_ -if not hasattr(i1DH, "kurtosis"): - i1DH.kurtosis = _kurtosis_ -if not hasattr(i1DH, "kurtosisErr"): - i1DH.kurtosisErr = _kurtosisErr_ - -if not hasattr(i1DH, "overflowEntriesFrac"): - i1DH.overflowEntriesFrac = _overflowEntriesFrac_ -if not hasattr(i1DH, "overflowEntriesFracErr"): - i1DH.overflowEntriesFracErr = _overflowEntriesFracErr_ -if not hasattr(i1DH, "underflowEntriesFrac"): - i1DH.underflowEntriesFrac = _underflowEntriesFrac_ -if not hasattr(i1DH, "underflowEntriesFracErr"): - i1DH.underflowEntriesFracErr = _underflowEntriesFracErr_ - -if not hasattr(i1DH, "overflowIntegralFrac"): - i1DH.overflowIntegralFrac = _overflowIntegralFrac_ -if not hasattr(i1DH, "overflowIntegralFracErr"): - i1DH.overflowIntegralFracErr = _overflowIntegralFracErr_ -if not hasattr(i1DH, "underflowIntegralFrac"): - i1DH.underflowIntegralFrac = _underflowIntegralFrac_ -if not hasattr(i1DH, "underflowIntegralFracErr"): - i1DH.underflowIntegralFracErr = _underflowIntegralFracErr_ - -if not hasattr(i1DH, "nEntries"): - i1DH.nEntries = _nEntries_ -if not hasattr(i1DH, "nEntriesFrac"): - i1DH.nEntriesFrac = _nEntriesFrac_ -if not hasattr(i1DH, "nEntriesFracErr"): - i1DH.nEntriesFracErr = _nEntriesFracErr_ - -# ============================================================================ - - -def _path_(self): - """ - Get the path in THS for the given AIDA object: - - >>> aida = - >>> print(aida.path()) - - """ - return cpp.Gaudi.Utils.Histos.path(self) - - -iBH = cpp.AIDA.IBaseHistogram -if not hasattr(iBH, "path"): - iBH.path = _path_ -if not hasattr(iBH, "TESpath"): - iBH.TESpath = _path_ -if not hasattr(iBH, "location"): - iBH.location = _path_ - - -# ============================================================================= -def __dumpHisto__(histo, *args): - """ - - Dump the histogram/profile in text format (a'la HBOOK) - - >>> histo - >>> print(dumpHisto ( histo )) - - >>> print(histo.dump()) - >>> print(histo.dump( 20 , 20 )) - >>> print(histo.dump( 20 , 20 , True )) - - Uses: - - """ - return cpp.Gaudi.Utils.Histos.histoDump(histo, *args) - - -__dumpHisto__.__doc__ = "\n" + cpp.Gaudi.Utils.Histos.histoDump.__doc__ - -# ============================================================================= -# the actual function for text dump of the histogram -histoDump = __dumpHisto__ -dumpHisto = __dumpHisto__ - -for t in ( - cpp.AIDA.IHistogram1D, - cpp.AIDA.IProfile1D, - ROOT.TH1D, - ROOT.TH1F, - ROOT.TH1, - ROOT.TProfile, -): - for method in ("dump", "dumpHisto", "dumpAsText"): - if not hasattr(t, method): - setattr(t, method, __dumpHisto__) - -# ============================================================================== - - -class HistoFile: - """ - Class to write histograms to a ROOT file. - hFile = HistoFile("myFile.root") - myHisto = ... - hFile.save(myHisto) - myHisto0 = ... - myHisto1 = ... - myHisto2 = ... - hFile.save(myHisto0, myHisto1, myHisto2) - histoList = [h0, h1, h2, h3] - hFile.save(histoList) - ... - hWriter.close() - """ - - __author__ = "Juan Palacios juan.palacios@nikhef.nl" - - def __init__(self, fileName): - self.file = ROOT.TFile(fileName, "RECREATE") - from GaudiPython import gbl - - self.aida2root = gbl.Gaudi.Utils.Aida2ROOT.aida2root - self.aidaTypes = [ - gbl.AIDA.IHistogram1D, - gbl.AIDA.IHistogram2D, - gbl.AIDA.IHistogram3D, - gbl.AIDA.IProfile1D, - gbl.AIDA.IProfile2D, - gbl.AIDA.IHistogram, - ] - - def __convertibleType(self, histo): - histoType = type(histo) - for t in self.aidaTypes: - if histoType == t: - return True - return False - - def save(self, *args): - """ - This function stores histograms on the file for future saving. - It takes an arbitrary number of AIDA or ROOT histograms or - a list of them. - """ - if args: - if isinstance(args[0], list): - histoList = args[0] - else: - histoList = args - for h in histoList: - if self.__convertibleType(h): - h = self.aida2root(h) - h.Write() - - def close(self): - self.file.Write() - self.file.Close() - - -# ============================================================================= -if "__main__" == __name__: - import sys - - print(__doc__) - for o in __all__: - print(o) - print(sys.modules[__name__].__dict__[o].__doc__) - -# ============================================================================= -# The END -# ============================================================================= diff --git a/GaudiAlg/python/GaudiAlg/TupleUtils.py b/GaudiAlg/python/GaudiAlg/TupleUtils.py deleted file mode 100644 index 49e4e510719..00000000000 --- a/GaudiAlg/python/GaudiAlg/TupleUtils.py +++ /dev/null @@ -1,233 +0,0 @@ -#!/usr/bin/env python3 -##################################################################################### -# (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations # -# # -# This software is distributed under the terms of the Apache version 2 licence, # -# copied verbatim in the file "LICENSE". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -##################################################################################### -# ============================================================================= -# This module contains set of simple and useful utilities to booking and -# manipulation with N-Tuples (in the spirit of GaudiTuples<TYPE>) -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2007-08-04 -# ============================================================================= -""" -This module contains set of simple and useful utilities to booking and -manipulation with N-Tuples (in the spirit of GaudiTuples<TYPE>) - -""" - -# ============================================================================= -__author__ = "Vanya BELYAEV ibelyaev@physics.syr.edu" -# ============================================================================= -__all__ = ( - "nTuple", # function to book/retrieve N-tuple - "getNTuple", # ditto - "getNtuple", # ditto - "getntuple", # ditto - "gettuple", # ditto - "activeTuples", # get the list of all active n-tuples - "releaseTuples", # release all actibe N-tuples -) -# ============================================================================= - -from GaudiPython.Bindings import AppMgr -from GaudiPython.Bindings import gbl as cpp -from GaudiPython.Bindings import iAlgTool - -_Tool = cpp.ITupleTool -_Deco = cpp.GaudiPython.TupleToolDecorator - -# the list of aquired tools (to be released) -_TOOLS_ = [] - -# ============================================================================= -# Helper private auxillary utility to get Tool Service - - -def _getToolSvc(**kwargs): - """Helper private auxillary utility to get Tool Service""" - svc = kwargs.get("toolSvc", None) - if not svc: - svc = kwargs.get("toolsvc", None) - if not svc: - svc = kwargs.get("service", None) - if not svc: - svc = kwargs.get("svc", None) - else: - return svc # RETURN - gaudi = kwargs.get("gaudi", None) - if not gaudi: - gaudi = AppMgr() - return gaudi.toolsvc() # RETURN - - -# ============================================================================= -# Retrive N-Tuple ( book on demand ) -def _nTuple_(s, *args): - """Retrive N-tuple ( book on demand )""" - return _Deco.nTuple(s, *args) - - -# ============================================================================= -_nTuple_.__doc__ += "\n" + _Deco.nTuple.__doc__ -_Tool.nTuple = _nTuple_ -_Tool.ntuple = _nTuple_ - - -# ============================================================================= -# Retrieve (book-on-demand) 'Smart'-N-tuple object. -def nTuple(dirpath, ID, ID2=None, topdir=None, LUN="FILE1"): - """ - Retrieve 'Smart'-N-tuple object. - N-tuple is booked on-demand. - - Atetntion !! - The logical unit LUN must be configured by N-Tuple Service - - Retrieve (book-n-demand) N-Tuple using - the directory name and the title: - >>> t = nTuple ( 'the/path/to/directory' , ## the path to the directory - 'N-tuple title' , ## the title for N-Tuple - LUN = 'FILE1' ) ## logical file unit - - Retrieve (book-n-demand) N-Tuple using - the directory name, literal ID and the title: - >>> t = nTuple ( 'the/path/to/directory' , ## the path to the directory - 'Tuple1' , ## the literal ID for N-Tuple - 'N-tuple title' , ## the title for N-Tuple - LUN = 'FILE1' ) ## logical file unit - - Retrieve (book-n-demand) N-Tuple using - the directory name, numerical ID and the title: - >>> t = nTuple ( 'the/path/to/directory' , ## the path to the directory - 124 , ## the numerical ID for N-Tuple - 'N-tuple title' , ## the title for N-Tuple - LUN = 'FILE1' ) ## logical file unit - - - """ - toolSvc = _getToolSvc() - - # construct the name of the intermediate TupleTool - name = "Tuple" + LUN + "/" - if topdir: - name += topdir - name += dirpath - name += "_%s" % ID - if ID2: - name += "_%s" % ID2 - name = name.replace(".", "_") - name = name.replace("/", "_") - name = name.replace("\\", "_") - name = name.replace(" ", "_") - - # define tool properties - t0 = iAlgTool("ToolSvc." + name) - t0.OutputLevel = 1 - t0.NTupleLUN = LUN - t0.NTupleDir = dirpath - t0.PropertiesPrint = False - t0.OutputLevel = 4 - if topdir: - t0.NTupleTopDir = topdir - - # get the tool from Tool service - tool = toolSvc.create("TupleTool", name, interface=_Tool) - - # check the properties and redefine them if needed - t1 = iAlgTool(tool.name(), tool) - if t1.NTupleLUN != LUN: - t1.NTupleLUN = LUN - if t1.NTupleDir != dirpath: - t1.NTupleDir = dirpath - if topdir and (t1.NTupleTopDir != topdir): - t1.NTupleTopDir = topdir - - _TOOLS_.append(tool) - if not ID2: - return tool.nTuple(ID) # RETURN - - return tool.nTuple(ID, ID2) # RETURN - - -nTuple.__doc__ += "\n\t help(ITupleTool.nTuple) : \n" + _Tool.nTuple.__doc__ - -ntuple = nTuple -getNTuple = nTuple -getNtuple = nTuple -getntuple = nTuple -getTuple = nTuple -gettuple = nTuple - -# ============================================================================= -# Return the list of active tools - - -def activeTuples(): - """ - Return the list of active tools - """ - return _TOOLS_ - - -# ============================================================================= -# Release the active tool/tuples - - -def releaseTuples(): - """ - Release the active tool/tuples - The method needs to be invoked explicitely at the end of the job - """ - if not _TOOLS_: - return - from GaudiPython.Bindings import _gaudi - - if not _gaudi: - return - - toolSvc = _getToolSvc() - if toolSvc.isValid(): - while _TOOLS_: - t = _TOOLS_.pop() - if not t: - continue - while 1 < t.refCount(): - toolSvc._its.releaseTool(t) - - -# ============================================================================= - - -def _TupleUtils_AtExit_(): - """ - AtExit function for GaudiAlg.TupleUtils module - """ - if activeTuples(): - print("WARNING: the list of local TupleTools is not empty!") - print( - "WARNING: please use GaudiAlg.TupleUtils.releaseTuples() at the end" - ) - - -import atexit - -atexit.register(_TupleUtils_AtExit_) - -# ============================================================================= -if "__main__" == __name__: - import sys - - print(__doc__, __all__) - for o in __all__: - print("\n\n\t", o, "\n") - print(sys.modules[__name__].__dict__[o].__doc__) - -# ============================================================================= -# The end -# ============================================================================= diff --git a/GaudiAlg/python/GaudiAlg/__init__.py b/GaudiAlg/python/GaudiAlg/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/GaudiAlg/src/components/GaudiAlg_entries.cpp b/GaudiAlg/src/components/GaudiAlg_entries.cpp index 9a2e6dd76ae..00e27a02381 100644 --- a/GaudiAlg/src/components/GaudiAlg_entries.cpp +++ b/GaudiAlg/src/components/GaudiAlg_entries.cpp @@ -8,11 +8,9 @@ * granted to it by virtue of its status as an Intergovernmental Organization * * or submit itself to any jurisdiction. * \***********************************************************************************/ -#include <GaudiAlg/EventCounter.h> #include <GaudiAlg/GaudiSequencer.h> #include <GaudiAlg/Prescaler.h> -DECLARE_COMPONENT( EventCounter ) DECLARE_COMPONENT( Prescaler ) DECLARE_COMPONENT( GaudiSequencer ) diff --git a/GaudiAlg/src/examples/MyGaudiAlgorithm.cpp b/GaudiAlg/src/examples/MyGaudiAlgorithm.cpp deleted file mode 100644 index 8a24f81b209..00000000000 --- a/GaudiAlg/src/examples/MyGaudiAlgorithm.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/***********************************************************************************\ -* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations * -* * -* This software is distributed under the terms of the Apache version 2 licence, * -* copied verbatim in the file "LICENSE". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\***********************************************************************************/ -#include "IMyTool.h" - -#include "GaudiAlg/GaudiAlgorithm.h" -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/ToolHandle.h" - -/// Trivial Algorithm for tutorial purposes -class MyGaudiAlgorithm : public GaudiAlgorithm { -public: - /// Constructor of this form must be provided - MyGaudiAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ); - - /// Three mandatory member functions of any algorithm - StatusCode initialize() override; - StatusCode execute() override; - StatusCode finalize() override; - - bool isClonable() const override { return true; } - -private: - Gaudi::Property<std::string> m_privateToolType{this, "ToolWithName", "MyTool", - "Type of the tool to use (internal name is ToolWithName)"}; - - IMyTool* m_privateTool = nullptr; - IMyTool* m_publicTool = nullptr; - IMyTool* m_privateGTool = nullptr; - IMyTool* m_publicGTool = nullptr; - - IMyTool* m_privateToolWithName = nullptr; - - IMyOtherTool* m_privateOtherInterface = nullptr; - - ToolHandle<IMyTool> m_legacyToolHandle{"MyTool/LegacyToolHandle", this}; - - ToolHandle<IMyTool> m_myPrivToolHandle{this, "PrivToolHandle", "MyTool/PrivToolHandle"}; - PublicToolHandle<IMyTool> m_myPubToolHandle{this, "PubToolHandle", "MyTool/PubToolHandle"}; - - PublicToolHandle<IAlgTool> m_myGenericToolHandle{this, "GenericToolHandle", "MyTool/GenericToolHandle"}; - - ToolHandle<IAlgTool> m_myUnusedToolHandle{this, "UnusedToolHandle", "TestToolFailing/UnusedToolHandle"}; - - ToolHandle<IMyTool> m_undefinedToolHandle{this}; - ToolHandle<IMyTool> m_invalidToolHandle{this, "InvalidToolHandle", "TestToolFailing"}; - - ToolHandle<IWrongTool> m_wrongIfaceTool{this, "WrongIfaceTool", "MyTool/WrongIfaceTool"}; - - PublicToolHandle<const IMyTool> m_myConstToolHandle{"MyTool/ConstGenericToolHandle"}; - - PublicToolHandle<const IMyTool> m_myCopiedConstToolHandle; - PublicToolHandle<const IMyTool> m_myCopiedConstToolHandle2; - PublicToolHandle<IMyTool> m_myCopiedToolHandle; - - PublicToolHandleArray<IMyTool> m_tha{this, - "MyPublicToolHandleArrayProperty", - {"MyTool/AnotherConstGenericToolHandle", "MyTool/AnotherInstanceOfMyTool"}}; - - DataObjectReadHandle<DataObject> m_tracks{this, "tracks", "/Event/Rec/Tracks", "the tracks"}; - DataObjectReadHandle<DataObject> m_hits{this, "hits", "/Event/Rec/Hits", "the hits"}; - DataObjectReadHandle<DataObject> m_raw{this, "raw", "/Rec/RAW", "the raw stuff"}; - - DataObjectWriteHandle<DataObject> m_selectedTracks{this, "trackSelection", "/Event/MyAnalysis/Tracks", - "the selected tracks"}; -}; - -// Static Factory declaration -DECLARE_COMPONENT( MyGaudiAlgorithm ) - -MyGaudiAlgorithm::MyGaudiAlgorithm( const std::string& name, ISvcLocator* ploc ) : GaudiAlgorithm( name, ploc ) { - // Keep at least one old-style ToolHandle property to test compilation - declareProperty( "LegacyToolHandle", m_legacyToolHandle ); - declareProperty( "UndefinedToolHandle", m_undefinedToolHandle ); - - m_myCopiedConstToolHandle = m_myPubToolHandle; - m_myCopiedToolHandle = m_myPubToolHandle; - m_myCopiedConstToolHandle2 = m_myConstToolHandle; -} - -StatusCode MyGaudiAlgorithm::initialize() { - return GaudiAlgorithm::initialize().andThen( [&] { - info() << "initializing...." << endmsg; - - m_publicTool = tool<IMyTool>( "MyTool" ); - m_privateTool = tool<IMyTool>( "MyTool", this ); - m_publicGTool = tool<IMyTool>( "MyGaudiTool" ); - m_privateGTool = tool<IMyTool>( "MyGaudiTool", this ); - m_privateToolWithName = tool<IMyTool>( m_privateToolType, "ToolWithName", this ); - m_privateOtherInterface = tool<IMyOtherTool>( "MyGaudiTool", this ); - - // disable ToolHandle - m_myUnusedToolHandle.disable(); - - info() << m_tracks.objKey() << endmsg; - info() << m_hits.objKey() << endmsg; - info() << m_raw.objKey() << endmsg; - - info() << m_selectedTracks.objKey() << endmsg; - - // m_wrongIfaceTool is being retrieved via the wrong interface. - // we expect the retrieve() to throw an exception. - try { - if ( m_wrongIfaceTool.retrieve().isFailure() ) { - error() << "unable to retrieve " << m_wrongIfaceTool.typeAndName() << " (unexpected)" << endmsg; - m_wrongIfaceTool.disable(); - } - } catch ( GaudiException& ex ) { - info() << "unable to retrieve " << m_wrongIfaceTool.typeAndName() << " (expected) with exception: " << ex.what() - << endmsg; - m_wrongIfaceTool.disable(); - } - - info() << "....initialization done" << endmsg; - return StatusCode::SUCCESS; - } ); -} - -StatusCode MyGaudiAlgorithm::execute() { - info() << "executing...." << endmsg; - - info() << "tools created with tool<T>..." << endmsg; - - m_publicTool->doIt(); - m_privateTool->doIt(); - m_publicGTool->doIt(); - m_privateGTool->doIt(); - m_privateToolWithName->doIt(); - m_privateOtherInterface->doItAgain(); - - info() << "tools created via ToolHandle<T>...." << endmsg; - - m_myPrivToolHandle->doIt(); - m_myPubToolHandle->doIt(); - m_myConstToolHandle->doIt(); - - info() << "tools copied assigned via ToolHandle<T>...." << endmsg; - - m_myCopiedConstToolHandle->doIt(); - m_myCopiedToolHandle->doIt(); - m_myCopiedConstToolHandle2->doIt(); - - info() << "tools copied constructed via ToolHandle<T>...." << endmsg; - - // copy construct some handles - ToolHandle<const IMyTool> h1( m_myPubToolHandle ); - ToolHandle<IMyTool> h2( m_myPrivToolHandle ); - ToolHandle<const IMyTool> h3( m_myConstToolHandle ); - h1->doIt(); - h2->doIt(); - h3->doIt(); - - return StatusCode::SUCCESS; -} - -StatusCode MyGaudiAlgorithm::finalize() { - info() << "finalizing...." << endmsg; - return GaudiAlgorithm::finalize(); -} diff --git a/GaudiAlg/src/lib/AlgDecorators.cpp b/GaudiAlg/src/lib/AlgDecorators.cpp deleted file mode 100644 index 06c7d38ca0d..00000000000 --- a/GaudiAlg/src/lib/AlgDecorators.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/***********************************************************************************\ -* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations * -* * -* This software is distributed under the terms of the Apache version 2 licence, * -* copied verbatim in the file "LICENSE". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\***********************************************************************************/ -// ============================================================================ -// Include files -// ============================================================================ -// GaudiKernel -// ============================================================================ -#include "GaudiKernel/DataObject.h" -#include "GaudiKernel/IAlgTool.h" -#include "GaudiKernel/IAlgorithm.h" -#include "GaudiKernel/IInterface.h" -#include "GaudiKernel/IProperty.h" -#include "GaudiKernel/SmartIF.h" -// ============================================================================ -// GaudiAlg -// ============================================================================ -#include "GaudiAlg/GaudiAlgorithm.h" -#include "GaudiAlg/GaudiTool.h" -// ============================================================================ -// GaudiPython -// ============================================================================ -#include "GaudiPython/AlgDecorators.h" -// ============================================================================ -// Disable warnings on gcc -// ============================================================================ -#if defined( __GNUC__ ) -# pragma GCC diagnostic push ignored "-Wdeprecated-declarations" -#endif -// ============================================================================ -/** @file - * Implementation file for "Decorators" - * @author Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr - * @date 2005-08-03 - */ -// ============================================================================ -/* get the tool from GaudiAlgorithm - * @param alg GaudiAlgorithm - * @param type tool type - * @param name tool name - * @param parent tool parent - * @param create flag to create - * @return the tool - */ -// ============================================================================ -IAlgTool* GaudiPython::AlgDecorator::tool_( const GaudiAlgorithm* alg, const std::string& type, const std::string& name, - const IInterface* parent, const bool create ) { - return alg ? alg->tool<IAlgTool>( type, name, parent, create ) : nullptr; -} -// ============================================================================ -/* get the tool from GaudiAlgorithm - * @param alg GaudiAlgorithm - * @param typeAndName tool type/name - * @param parent tool parent - * @param create flag to create - * @return the tool - */ -// ============================================================================ -IAlgTool* GaudiPython::AlgDecorator::tool_( const GaudiAlgorithm* alg, const std::string& typeAndName, - const IInterface* parent, const bool create ) { - return alg ? alg->tool<IAlgTool>( typeAndName, parent, create ) : nullptr; -} -// ============================================================================ -/* get the service from GaudiAlgorithm - * @param alg GaudiAlgorithm - * @param name service name - * @param create flag to create - * @return the tool - */ -// ============================================================================ -IInterface* GaudiPython::AlgDecorator::svc_( const GaudiAlgorithm* alg, const std::string& name, const bool create ) { - return alg ? alg->svc<IInterface>( name, create ) : nullptr; -} -// ============================================================================ -// get the counter by name -// ============================================================================ -StatEntity* GaudiPython::AlgDecorator::_counter_a_( const GaudiAlgorithm* cmp, const std::string& name ) { - return cmp ? &( cmp->counter( name ) ) : nullptr; // RETURN -} -// ============================================================================ -// get the counter by name -// ============================================================================ -StatEntity* GaudiPython::AlgDecorator::_counter_t_( const GaudiTool* cmp, const std::string& name ) { - return cmp ? &( cmp->counter( name ) ) : nullptr; // RETURN -} -// ============================================================================ -// get the counter by name -// ============================================================================ -StatEntity* GaudiPython::AlgDecorator::_counter_a_( const IAlgorithm* cmp, const std::string& name ) { - return cmp ? _counter_a_( dynamic_cast<const GaudiAlgorithm*>( cmp ), name ) : nullptr; -} -// ============================================================================ -// get the counter by name -// ============================================================================ -StatEntity* GaudiPython::AlgDecorator::_counter_t_( const IAlgTool* cmp, const std::string& name ) { - return cmp ? _counter_t_( dynamic_cast<const GaudiTool*>( cmp ), name ) : nullptr; -} -// ============================================================================ -// get all tools -// ============================================================================ -size_t GaudiPython::AlgDecorator::_tools_a_( const GaudiAlgorithm* cmp, GaudiPython::AlgDecorator::Tools& tools ) { - tools.clear(); - if ( cmp ) tools = cmp->tools(); - return tools.size(); // RETURN -} -// ============================================================================ -// get all tools -// ============================================================================ -size_t GaudiPython::AlgDecorator::_tools_t_( const GaudiTool* cmp, GaudiPython::AlgDecorator::Tools& tools ) { - tools.clear(); - if ( cmp ) tools = cmp->tools(); - return tools.size(); // RETURN -} -// ============================================================================ -// get all tools -// ============================================================================ -size_t GaudiPython::AlgDecorator::_tools_a_( const IAlgorithm* cmp, GaudiPython::AlgDecorator::Tools& tools ) { - tools.clear(); - return cmp ? _tools_a_( dynamic_cast<const GaudiAlgorithm*>( cmp ), tools ) : 0; -} -// ============================================================================ -// get all tools -// ============================================================================ -size_t GaudiPython::AlgDecorator::_tools_t_( const IAlgTool* cmp, GaudiPython::AlgDecorator::Tools& tools ) { - tools.clear(); - return cmp ? _tools_t_( dynamic_cast<const GaudiTool*>( cmp ), tools ) : 0; -} -// ============================================================================ -/* check the data in Transient Event Store - * @param alg GaudiAlgorithm - * @param location data location in TES - * @param useRoonInTes flag to respect RootInTes - * @return the data - */ -// ============================================================================ -bool GaudiPython::AlgDecorator::exist( const GaudiAlgorithm* alg, const std::string& location, - const bool useRootInTes ) { - return alg ? alg->exist<DataObject>( alg->evtSvc(), location, useRootInTes ) : false; -} -// ============================================================================ -/* get the data from Transient Event Store - * @param alg GaudiAlgorithm - * @param location data location in TES - * @param useRoonInTes flag to respect RootInTes - * @return the data - */ -// ============================================================================ -DataObject* GaudiPython::AlgDecorator::get_( const GaudiAlgorithm* alg, const std::string& location, - const bool useRootInTes ) { - return alg ? alg->get<DataObject>( alg->evtSvc(), location, useRootInTes ) : nullptr; -} -// ============================================================================ -// Re-enable warnings on gcc -// ============================================================================ -#if defined( __GNUC__ ) -# pragma GCC diagnostic pop -#endif - -// ============================================================================ -// The END -// ============================================================================ diff --git a/GaudiAlg/src/lib/EventCounter.cpp b/GaudiAlg/src/lib/EventCounter.cpp deleted file mode 100644 index fd75a4d6ae1..00000000000 --- a/GaudiAlg/src/lib/EventCounter.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/***********************************************************************************\ -* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations * -* * -* This software is distributed under the terms of the Apache version 2 licence, * -* copied verbatim in the file "LICENSE". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\***********************************************************************************/ -#include "GaudiAlg/EventCounter.h" -#include "GaudiKernel/MsgStream.h" - -/** - ** Constructor(s) - **/ -EventCounter::EventCounter( const std::string& name, ISvcLocator* pSvcLocator ) : Algorithm( name, pSvcLocator ) { - m_frequency.verifier().setBounds( 0, 1000 ); -} - -StatusCode EventCounter::initialize() { - info() << name() << ":EventCounter::initialize - Frequency: " << m_frequency << endmsg; - return StatusCode::SUCCESS; -} - -StatusCode EventCounter::execute() { - m_total++; - int freq = m_frequency; - if ( freq > 0 ) { - ++m_skip; - if ( m_skip >= freq ) { - info() << name() << ":EventCounter::execute - seen events: " << m_total << endmsg; - m_skip = 0; - } - } - return StatusCode::SUCCESS; -} - -StatusCode EventCounter::finalize() { - info() << name() << ":EventCounter::finalize - total events: " << m_total << endmsg; - return StatusCode::SUCCESS; -} diff --git a/GaudiAlg/src/lib/HistoDecorator.cpp b/GaudiAlg/src/lib/HistoDecorator.cpp deleted file mode 100644 index 7d9bdaba3b2..00000000000 --- a/GaudiAlg/src/lib/HistoDecorator.cpp +++ /dev/null @@ -1,640 +0,0 @@ -/***********************************************************************************\ -* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations * -* * -* This software is distributed under the terms of the Apache version 2 licence, * -* copied verbatim in the file "LICENSE". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\***********************************************************************************/ -// ============================================================================ -// Include files -// ============================================================================ -// GaudiAlg -// ============================================================================ -#include "GaudiAlg/GaudiHistoAlg.h" -#include "GaudiAlg/GaudiHistoTool.h" -// ============================================================================ -// GaudiPython -// ============================================================================ -#include "GaudiPython/HistoDecorator.h" -#include "GaudiPython/Vector.h" -// ============================================================================ -/** @file - * Implementation file for class GaudiPython::HistoDecorator - * @date 2005-08-04 - * @author Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr - */ -// ============================================================================ -/* "plot"(book&fill) a sequence of data from the vector (implicit loop) - * (Expected to be more efficient) - * @param algo the algorithm - * @param data data - * @param title histogram title - * @param low low edge - * @param high high edge - * @param bins number of bins - */ -// ============================================================================ -AIDA::IHistogram1D* GaudiPython::HistoDecorator::plot1D( const GaudiHistoAlg& algo, const double data, - const std::string& title, const double low, const double high, - const unsigned long bins ) { - return algo.plot1D( data, title, low, high, bins ); -} -// ============================================================================ -/* "plot"(book&fill) a sequence of data from the vector (implicit loop) - * (Expected to be more efficient) - * @param algo the algorithm - * @param data data - * @param ID histogram ID - * @param title histogram title - * @param low low edge - * @param high high edge - * @param bins number of bins - */ -// ============================================================================ -AIDA::IHistogram1D* GaudiPython::HistoDecorator::plot1D( const GaudiHistoAlg& algo, const double data, - const GaudiAlg::HistoID& ID, const std::string& title, - const double low, const double high, - const unsigned long bins ) { - return algo.plot1D( data, ID, title, low, high, bins ); -} -// ============================================================================ -/* "plot"(book&fill) a sequence of data from the vector (implicit loop) - * (Expected to be more efficient) - * @param algo the algorithm - * @param data data - * @param ID histogram ID - * @param title histogram title - * @param low low edge - * @param high high edge - * @param bins number of bins - */ -// ============================================================================ -AIDA::IHistogram1D* GaudiPython::HistoDecorator::plot1D( const GaudiHistoAlg& algo, const double data, const long ID, - const std::string& title, const double low, const double high, - const unsigned long bins ) { - return algo.plot1D( data, ID, title, low, high, bins ); -} -// ============================================================================ -/* "plot"(book&fill) a sequence of data from the vector (implicit loop) - * (Expected to be more efficient) - * @param algo the algorithm - * @param data data - * @param ID histogram ID - * @param title histogram title - * @param low low edge - * @param high high edge - * @param bins number of bins - */ -// ============================================================================ -AIDA::IHistogram1D* GaudiPython::HistoDecorator::plot1D( const GaudiHistoAlg& algo, const double data, - const std::string& ID, const std::string& title, - const double low, const double high, - const unsigned long bins ) { - return algo.plot1D( data, ID, title, low, high, bins ); -} -// ============================================================================ -/* "plot"(book&fill) a sequence of data from the vector (implicit loop) - * (Expected to be more efficient) - * @param algo the algorithm - * @param data vector of data - * @param title histogram title - * @param low low edge - * @param high high edge - * @param bins number of bins - */ -// ============================================================================ -AIDA::IHistogram1D* GaudiPython::HistoDecorator::plot1D( const GaudiHistoAlg& algo, const GaudiPython::Vector& data, - const std::string& title, const double low, const double high, - const unsigned long bins ) { - return algo.plot( GaudiPython::_identity(), data.begin(), data.end(), title, low, high, bins ); -} -// ============================================================================ -/* "plot"(book&fill) a sequence of data from the vector (implicit loop) - * (Expected to be more efficient) - * @param algo the algorithm - * @param data vector of data - * @param ID histogram ID - * @param title histogram title - * @param low low edge - * @param high high edge - * @param bins number of bins - */ -// ============================================================================ -AIDA::IHistogram1D* GaudiPython::HistoDecorator::plot1D( const GaudiHistoAlg& algo, const GaudiPython::Vector& data, - const GaudiAlg::HistoID& ID, const std::string& title, - const double low, const double high, - const unsigned long bins ) { - return algo.plot( GaudiPython::_identity(), data.begin(), data.end(), ID, title, low, high, bins ); -} -// ============================================================================ -/* "plot"(book&fill) a sequence of data from the vector (implicit loop) - * (Expected to be more efficient) - * @param algo the algorithm - * @param data vector of data - * @param ID histogram ID - * @param title histogram title - * @param low low edge - * @param high high edge - * @param bins number of bins - */ -// ============================================================================ -AIDA::IHistogram1D* GaudiPython::HistoDecorator::plot1D( const GaudiHistoAlg& algo, const GaudiPython::Vector& data, - const long ID, const std::string& title, const double low, - const double high, const unsigned long bins ) { - return algo.plot( GaudiPython::_identity(), data.begin(), data.end(), ID, title, low, high, bins ); -} -// ============================================================================ -/* "plot"(book&fill) a sequence of data from the vector (implicit loop) - * (Expected to be more efficient) - * @param algo the algorithm - * @param data vector of data - * @param ID histogram ID - * @param title histogram title - * @param low low edge - * @param high high edge - * @param bins number of bins - */ -// ============================================================================ -AIDA::IHistogram1D* GaudiPython::HistoDecorator::plot1D( const GaudiHistoAlg& algo, const GaudiPython::Vector& data, - const std::string& ID, const std::string& title, - const double low, const double high, - const unsigned long bins ) { - return algo.plot( GaudiPython::_identity(), data.begin(), data.end(), ID, title, low, high, bins ); -} -// ============================================================================ -/* fill the 2D histogram (book on demand) - * @param valueX x value to be filled - * @param valueY y value to be filled - * @param title histogram title (must be unique within the algorithm) - * @param lowX low x limit for histogram - * @param highX high x limit for histogram - * @param lowY low y limit for histogram - * @param highY high y limit for histogram - * @param binsX number of bins in x - * @param binsY number of bins in y - * @param weight weight - * @return pointer to AIDA 2D histogram - */ -// ============================================================================ -AIDA::IHistogram2D* GaudiPython::HistoDecorator::plot2D( const GaudiHistoAlg& algo, const double valueX, - const double valueY, const std::string& title, - const double lowX, const double highX, const double lowY, - const double highY, const unsigned long binsX, - const unsigned long binsY, const double weight ) { - return algo.plot2D( valueX, valueY, title, lowX, highX, lowY, highY, binsX, binsY, weight ); -} -// ============================================================================ -/** fill the 2D histogram (book on demand) - * @param valueX x value to be filled - * @param valueY y value to be filled - * @param ID Histogram ID to use - * @param title histogram title (must be unique within the algorithm) - * @param lowX low x limit for histogram - * @param highX high x limit for histogram - * @param lowY low y limit for histogram - * @param highY high y limit for histogram - * @param binsX number of bins in x - * @param binsY number of bins in y - * @param weight weight - * @return pointer to AIDA 2D histogram - */ -// ============================================================================ -AIDA::IHistogram2D* GaudiPython::HistoDecorator::plot2D( const GaudiHistoAlg& algo, const double valueX, - const double valueY, const GaudiAlg::HistoID& ID, - const std::string& title, const double lowX, - const double highX, const double lowY, const double highY, - const unsigned long binsX, const unsigned long binsY, - const double weight ) { - return algo.plot2D( valueX, valueY, ID, title, lowX, highX, lowY, highY, binsX, binsY, weight ); -} -// ============================================================================ -/* fill the 2D histogram (book on demand) - * @param valueX x value to be filled - * @param valueY y value to be filled - * @param ID Histogram ID to use - * @param title histogram title (must be unique within the algorithm) - * @param lowX low x limit for histogram - * @param highX high x limit for histogram - * @param lowY low y limit for histogram - * @param highY high y limit for histogram - * @param binsX number of bins in x - * @param binsY number of bins in y - * @param weight weight - * @return pointer to AIDA 2D histogram - */ -// ============================================================================ -AIDA::IHistogram2D* GaudiPython::HistoDecorator::plot2D( const GaudiHistoAlg& algo, const double valueX, - const double valueY, const long ID, const std::string& title, - const double lowX, const double highX, const double lowY, - const double highY, const unsigned long binsX, - const unsigned long binsY, const double weight ) { - return algo.plot2D( valueX, valueY, ID, title, lowX, highX, lowY, highY, binsX, binsY, weight ); -} -// ============================================================================ -/* fill the 2D histogram (book on demand) - * @param valueX x value to be filled - * @param valueY y value to be filled - * @param ID Histogram ID to use - * @param title histogram title (must be unique within the algorithm) - * @param lowX low x limit for histogram - * @param highX high x limit for histogram - * @param lowY low y limit for histogram - * @param highY high y limit for histogram - * @param binsX number of bins in x - * @param binsY number of bins in y - * @param weight weight - * @return pointer to AIDA 2D histogram - */ -// ============================================================================ -AIDA::IHistogram2D* GaudiPython::HistoDecorator::plot2D( const GaudiHistoAlg& algo, const double valueX, - const double valueY, const std::string& ID, - const std::string& title, const double lowX, - const double highX, const double lowY, const double highY, - const unsigned long binsX, const unsigned long binsY, - const double weight ) { - return algo.plot2D( valueX, valueY, ID, title, lowX, highX, lowY, highY, binsX, binsY, weight ); -} -// ============================================================================ -/* fill the 3D histogram (book on demand) - * @param valueX x value to be filled - * @param valueY y value to be filled - * @param valueZ z value to be filled - * @param title histogram title (must be unique within the algorithm) - * @param lowX low x limit for histogram - * @param highX high x limit for histogram - * @param lowY low y limit for histogram - * @param highY high y limit for histogram - * @param lowZ low z limit for histogram - * @param highZ high z limit for histogram - * @param binsX number of bins in x - * @param binsY number of bins in y - * @param binsZ number of bins in z - * @param weight weight - * @return pointer to AIDA 3D histogram - */ -// ============================================================================ -AIDA::IHistogram3D* GaudiPython::HistoDecorator::plot3D( - const GaudiHistoAlg& algo, const double valueX, const double valueY, const double valueZ, const std::string& title, - const double lowX, const double highX, const double lowY, const double highY, const double lowZ, const double highZ, - const unsigned long binsX, const unsigned long binsY, const unsigned long binsZ, const double weight ) { - return algo.plot3D( valueX, valueY, valueZ, title, lowX, highX, lowY, highY, lowZ, highZ, binsX, binsY, binsZ, - weight ); -} -// ============================================================================ -/* fill the 3D histogram (book on demand) - * @param valueX x value to be filled - * @param valueY y value to be filled - * @param valueZ z value to be filled - * @param title histogram title (must be unique within the algorithm) - * @param lowX low x limit for histogram - * @param highX high x limit for histogram - * @param lowY low y limit for histogram - * @param highY high y limit for histogram - * @param lowZ low z limit for histogram - * @param highZ high z limit for histogram - * @param binsX number of bins in x - * @param binsY number of bins in y - * @param binsZ number of bins in z - * @param weight weight - * @return pointer to AIDA 3D histogram - */ -// ============================================================================ -AIDA::IHistogram3D* GaudiPython::HistoDecorator::plot3D( const GaudiHistoAlg& algo, const double valueX, - const double valueY, const double valueZ, - const GaudiAlg::HistoID& ID, const std::string& title, - const double lowX, const double highX, const double lowY, - const double highY, const double lowZ, const double highZ, - const unsigned long binsX, const unsigned long binsY, - const unsigned long binsZ, const double weight ) { - return algo.plot3D( valueX, valueY, valueZ, ID, title, lowX, highX, lowY, highY, lowZ, highZ, binsX, binsY, binsZ, - weight ); -} -// ============================================================================ -/* fill the 3D histogram (book on demand) - * @param valueX x value to be filled - * @param valueY y value to be filled - * @param valueZ z value to be filled - * @param title histogram title (must be unique within the algorithm) - * @param lowX low x limit for histogram - * @param highX high x limit for histogram - * @param lowY low y limit for histogram - * @param highY high y limit for histogram - * @param lowZ low z limit for histogram - * @param highZ high z limit for histogram - * @param binsX number of bins in x - * @param binsY number of bins in y - * @param binsZ number of bins in z - * @param weight weight - * @return pointer to AIDA 3D histogram - */ -// ============================================================================ -AIDA::IHistogram3D* GaudiPython::HistoDecorator::plot3D( const GaudiHistoAlg& algo, const double valueX, - const double valueY, const double valueZ, const long ID, - const std::string& title, const double lowX, - const double highX, const double lowY, const double highY, - const double lowZ, const double highZ, - const unsigned long binsX, const unsigned long binsY, - const unsigned long binsZ, const double weight ) { - return algo.plot3D( valueX, valueY, valueZ, ID, title, lowX, highX, lowY, highY, lowZ, highZ, binsX, binsY, binsZ, - weight ); -} -// ============================================================================ -/* fill the 3D histogram (book on demand) - * @param valueX x value to be filled - * @param valueY y value to be filled - * @param valueZ z value to be filled - * @param title histogram title (must be unique within the algorithm) - * @param lowX low x limit for histogram - * @param highX high x limit for histogram - * @param lowY low y limit for histogram - * @param highY high y limit for histogram - * @param lowZ low z limit for histogram - * @param highZ high z limit for histogram - * @param binsX number of bins in x - * @param binsY number of bins in y - * @param binsZ number of bins in z - * @param weight weight - * @return pointer to AIDA 3D histogram - */ -// ============================================================================ -AIDA::IHistogram3D* GaudiPython::HistoDecorator::plot3D( const GaudiHistoAlg& algo, const double valueX, - const double valueY, const double valueZ, - const std::string& ID, const std::string& title, - const double lowX, const double highX, const double lowY, - const double highY, const double lowZ, const double highZ, - const unsigned long binsX, const unsigned long binsY, - const unsigned long binsZ, const double weight ) { - return algo.plot3D( valueX, valueY, valueZ, ID, title, lowX, highX, lowY, highY, lowZ, highZ, binsX, binsY, binsZ, - weight ); -} -// ======================================================================== -// 1D-profiles: by title -// ======================================================================== -AIDA::IProfile1D* GaudiPython::HistoDecorator::profile1D( const GaudiHistoAlg& algo, const double valueX, - const double valueY, const std::string& title, - const double lowX, const double highX, - const unsigned long binsX, const std::string& opt, - const double lowY, const double highY, const double weight ) { - return algo.profile1D( valueX, valueY, title, lowX, highX, binsX, opt, lowY, highY, weight ); -} -// ======================================================================== -// 1D-profiles: by generic ID -// ======================================================================== -AIDA::IProfile1D* GaudiPython::HistoDecorator::profile1D( const GaudiHistoAlg& algo, const double valueX, - const double valueY, const GaudiAlg::HistoID& ID, - const std::string& title, const double lowX, - const double highX, const unsigned long binsX, - const std::string& opt, const double lowY, const double highY, - const double weight ) { - return algo.profile1D( valueX, valueY, ID, title, lowX, highX, binsX, opt, lowY, highY, weight ); -} -// ======================================================================== -// 1D-profiles: by numeric ID -// ======================================================================== -AIDA::IProfile1D* GaudiPython::HistoDecorator::profile1D( const GaudiHistoAlg& algo, const double valueX, - const double valueY, const long ID, const std::string& title, - const double lowX, const double highX, - const unsigned long binsX, const std::string& opt, - const double lowY, const double highY, const double weight ) { - return algo.profile1D( valueX, valueY, ID, title, lowX, highX, binsX, opt, lowY, highY, weight ); -} -// ======================================================================== -// 1D-profiles: by string ID -// ======================================================================== -AIDA::IProfile1D* GaudiPython::HistoDecorator::profile1D( const GaudiHistoAlg& algo, const double valueX, - const double valueY, const std::string& ID, - const std::string& title, const double lowX, - const double highX, const unsigned long binsX, - const std::string& opt, const double lowY, const double highY, - const double weight ) { - return algo.profile1D( valueX, valueY, ID, title, lowX, highX, binsX, opt, lowY, highY, weight ); -} -// ======================================================================== -// 2D-profiles: by title -// ======================================================================== -AIDA::IProfile2D* GaudiPython::HistoDecorator::profile2D( const GaudiHistoAlg& algo, const double valueX, - const double valueY, const double valueZ, - const std::string& title, const double lowX, - const double highX, const double lowY, const double highY, - const unsigned long binsX, const unsigned long binsY, - const double weight ) { - return algo.profile2D( valueX, valueY, valueZ, title, lowX, highX, lowY, highY, binsX, binsY, weight ); -} -// ======================================================================== -// 2D-profiles: by generic ID -// ======================================================================== -AIDA::IProfile2D* GaudiPython::HistoDecorator::profile2D( const GaudiHistoAlg& algo, const double valueX, - const double valueY, const double valueZ, - const GaudiAlg::HistoID& ID, const std::string& title, - const double lowX, const double highX, const double lowY, - const double highY, const unsigned long binsX, - const unsigned long binsY, const double weight ) { - return algo.profile2D( valueX, valueY, valueZ, ID, title, lowX, highX, lowY, highY, binsX, binsY, weight ); -} -// ======================================================================== -// 2D-profiles: by numeric ID -// ======================================================================== -AIDA::IProfile2D* GaudiPython::HistoDecorator::profile2D( const GaudiHistoAlg& algo, const double valueX, - const double valueY, const double valueZ, const long ID, - const std::string& title, const double lowX, - const double highX, const double lowY, const double highY, - const unsigned long binsX, const unsigned long binsY, - const double weight ) { - return algo.profile2D( valueX, valueY, valueZ, ID, title, lowX, highX, lowY, highY, binsX, binsY, weight ); -} -// ======================================================================== -// 2D-profiles: by string ID -// ======================================================================== -AIDA::IProfile2D* GaudiPython::HistoDecorator::profile2D( const GaudiHistoAlg& algo, const double valueX, - const double valueY, const double valueZ, - const std::string& ID, const std::string& title, - const double lowX, const double highX, const double lowY, - const double highY, const unsigned long binsX, - const unsigned long binsY, const double weight ) { - return algo.profile2D( valueX, valueY, valueZ, ID, title, lowX, highX, lowY, highY, binsX, binsY, weight ); -} -// ============================================================================ -// get all histograms -// ============================================================================ -namespace { - /// collect the histograms - // ========================================================================= - template <typename Container, typename HISTO> - size_t fromMap( const Container& a, std::vector<GaudiAlg::ID>& b, std::vector<HISTO>& c ) { - b.clear(); - c.clear(); - for ( const auto& i : a ) { - if ( !i.second ) { continue; } - b.push_back( i.first ); - c.push_back( i.second ); - } - return b.size(); - } - // ========================================================================== -} // namespace -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_a_( const GaudiHistoAlg* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Histos1D& histos ) { - histos.clear(); - ids.clear(); - return cmp ? fromMap( cmp->histo1DMapID(), ids, histos ) : 0; - // ========================================================================== -} -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_t_( const GaudiHistoTool* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Histos1D& histos ) { - histos.clear(); - ids.clear(); - return cmp ? fromMap( cmp->histo1DMapID(), ids, histos ) : 0; - // ========================================================================== -} -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_a_( const IAlgorithm* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Histos1D& histos ) { - ids.clear(); - histos.clear(); - return cmp ? _histos_a_( dynamic_cast<const GaudiHistoAlg*>( cmp ), ids, histos ) : 0; -} -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_t_( const IAlgTool* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Histos1D& histos ) { - ids.clear(); - histos.clear(); - return cmp ? _histos_t_( dynamic_cast<const GaudiHistoTool*>( cmp ), ids, histos ) : 0; -} -// ============================================================================ -// 2D-histograms -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_a_( const GaudiHistoAlg* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Histos2D& histos ) { - histos.clear(); - ids.clear(); - return cmp ? fromMap( cmp->histo2DMapID(), ids, histos ) : 0; - // ========================================================================== -} -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_t_( const GaudiHistoTool* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Histos2D& histos ) { - histos.clear(); - ids.clear(); - return cmp ? fromMap( cmp->histo2DMapID(), ids, histos ) : 0; - // ========================================================================== -} -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_a_( const IAlgorithm* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Histos2D& histos ) { - ids.clear(); - histos.clear(); - return cmp ? _histos_a_( dynamic_cast<const GaudiHistoAlg*>( cmp ), ids, histos ) : 0; -} -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_t_( const IAlgTool* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Histos2D& histos ) { - ids.clear(); - histos.clear(); - return cmp ? _histos_t_( dynamic_cast<const GaudiHistoTool*>( cmp ), ids, histos ) : 0; -} -// ============================================================================ -// 3D-histograms -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_a_( const GaudiHistoAlg* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Histos3D& histos ) { - histos.clear(); - ids.clear(); - return cmp ? fromMap( cmp->histo3DMapID(), ids, histos ) : 0; - // ========================================================================== -} -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_t_( const GaudiHistoTool* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Histos3D& histos ) { - histos.clear(); - ids.clear(); - return cmp ? fromMap( cmp->histo3DMapID(), ids, histos ) : 0; - // ========================================================================== -} -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_a_( const IAlgorithm* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Histos3D& histos ) { - ids.clear(); - histos.clear(); - return cmp ? _histos_a_( dynamic_cast<const GaudiHistoAlg*>( cmp ), ids, histos ) : 0; -} -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_t_( const IAlgTool* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Histos3D& histos ) { - ids.clear(); - histos.clear(); - return cmp ? _histos_t_( dynamic_cast<const GaudiHistoTool*>( cmp ), ids, histos ) : 0; -} -// ============================================================================ -// 1D-profiles -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_a_( const GaudiHistoAlg* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Profiles1D& histos ) { - histos.clear(); - ids.clear(); - return cmp ? fromMap( cmp->profile1DMapID(), ids, histos ) : 0; - // ========================================================================== -} -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_t_( const GaudiHistoTool* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Profiles1D& histos ) { - histos.clear(); - ids.clear(); - return cmp ? fromMap( cmp->profile1DMapID(), ids, histos ) : 0; - // ========================================================================== -} -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_a_( const IAlgorithm* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Profiles1D& histos ) { - ids.clear(); - histos.clear(); - return cmp ? _histos_a_( dynamic_cast<const GaudiHistoAlg*>( cmp ), ids, histos ) : 0; -} -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_t_( const IAlgTool* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Profiles1D& histos ) { - ids.clear(); - histos.clear(); - return cmp ? _histos_t_( dynamic_cast<const GaudiHistoTool*>( cmp ), ids, histos ) : 0; -} -// ============================================================================ -// 2D-profiles -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_a_( const GaudiHistoAlg* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Profiles2D& histos ) { - histos.clear(); - ids.clear(); - return cmp ? fromMap( cmp->profile2DMapID(), ids, histos ) : 0; - // ========================================================================== -} -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_t_( const GaudiHistoTool* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Profiles2D& histos ) { - histos.clear(); - ids.clear(); - return cmp ? fromMap( cmp->profile2DMapID(), ids, histos ) : 0; - // ========================================================================== -} -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_a_( const IAlgorithm* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Profiles2D& histos ) { - ids.clear(); - histos.clear(); - return cmp ? _histos_a_( dynamic_cast<const GaudiHistoAlg*>( cmp ), ids, histos ) : 0; -} -// ============================================================================ -size_t GaudiPython::HistoDecorator::_histos_t_( const IAlgTool* cmp, GaudiPython::HistoDecorator::IDs& ids, - GaudiPython::HistoDecorator::Profiles2D& histos ) { - ids.clear(); - histos.clear(); - return cmp ? _histos_t_( dynamic_cast<const GaudiHistoTool*>( cmp ), ids, histos ) : 0; -} -// ============================================================================ - -// ============================================================================ -// The END -// ============================================================================ diff --git a/GaudiAlg/src/lib/TupleDecorator.cpp b/GaudiAlg/src/lib/TupleDecorator.cpp deleted file mode 100644 index 3bc1b14fc8c..00000000000 --- a/GaudiAlg/src/lib/TupleDecorator.cpp +++ /dev/null @@ -1,499 +0,0 @@ -/***********************************************************************************\ -* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations * -* * -* This software is distributed under the terms of the Apache version 2 licence, * -* copied verbatim in the file "LICENSE". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\***********************************************************************************/ -// ============================================================================ -// Include files -// ============================================================================ -// CLHEP -// ============================================================================/ -#include "CLHEP/Matrix/GenMatrix.h" -#include "CLHEP/Matrix/Matrix.h" -#include "CLHEP/Matrix/Vector.h" -// Handle CLHEP 2.0.x move to CLHEP namespace -namespace CLHEP {} -using namespace CLHEP; -// CLHEP is just #()$)*#)*@#)$@ Not even the git master (as of Aug 2015) has HepVector::begin and HepVector::end -// defined!!! -// fortunately, ADL comes to the rescue... -namespace CLHEP { - class HepVector; - double* begin( CLHEP::HepVector& v ) { return &v[0]; } - const double* begin( const CLHEP::HepVector& v ) { return &v[0]; } -} // namespace CLHEP - -// ============================================================================/ -// GaudiAlg -// ============================================================================ -#include "GaudiAlg/Tuple.h" -#include "GaudiAlg/TupleObj.h" -// ============================================================================ -// GaudiPython -// ============================================================================ -#include "GaudiPython/TupleDecorator.h" -#include "GaudiPython/Vector.h" -// =========================================================================== -/** @file - * Implementation file for class GaudiPython::TupleDecorator - * @author Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr - * @date 2005-08-04 - */ -// ============================================================================ -namespace { - // ========================================================================== - template <class TYPE> - inline StatusCode _fill( const Tuples::Tuple& tuple, const std::string& name, const TYPE& value ) { - return tuple.valid() ? tuple->column( name, value ) : StatusCode::FAILURE; - } - // ========================================================================== -} // namespace -// ============================================================================ -INTuple* GaudiPython::TupleDecorator::nTuple( const Tuples::Tuple& tuple ) { - if ( !tuple.valid() ) { return 0; } - return tuple->tuple(); -} -// ============================================================================ -NTuple::Tuple* GaudiPython::TupleDecorator::ntuple( const Tuples::Tuple& tuple ) { - if ( !tuple.valid() ) { return 0; } - return tuple->tuple(); -} -// ============================================================================ -bool GaudiPython::TupleDecorator::valid( const Tuples::Tuple& tuple ) { return tuple.valid(); } -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::write( const Tuples::Tuple& tuple ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->write(); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::column( const Tuples::Tuple& tuple, const std::string& name, const int value ) { - return _fill( tuple, name, value ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::column( const Tuples::Tuple& tuple, const std::string& name, const int value, - const int minv, const int maxv ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->column( name, value, minv, maxv ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::column( const Tuples::Tuple& tuple, const std::string& name, - const double value ) { - return _fill( tuple, name, value ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::column_ll( const Tuples::Tuple& tuple, const std::string& name, - const long long value ) { - return _fill( tuple, name, value ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::column_ull( const Tuples::Tuple& tuple, const std::string& name, - const unsigned long long value ) { - return _fill( tuple, name, value ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::column( const Tuples::Tuple& tuple, const std::string& name, - const bool value ) { - return _fill( tuple, name, value ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::column( const Tuples::Tuple& tuple, const std::string& name, - IOpaqueAddress* value ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->column( name, value ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::column( const Tuples::Tuple& tuple, IOpaqueAddress* value ) { - return column( tuple, "Address", value ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::column( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::LorentzVector& value ) { - return _fill( tuple, name, value ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::column( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::XYZVector& value ) { - return _fill( tuple, name, value ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::column( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::XYZPoint& value ) { - return _fill( tuple, name, value ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::farray( const Tuples::Tuple& tuple, const std::string& name, - const std::vector<double>& data, const std::string& length, - const size_t maxv ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->farray( name, data.begin(), data.end(), length, maxv ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::fmatrix( const Tuples::Tuple& tuple, const std::string& name, - const GaudiPython::Matrix& data, - const Tuples::TupleObj::MIndex cols, // fixed !!! - const std::string& length, const size_t maxv ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - if ( !data.empty() && cols != data.front().size() ) { - return tuple->Error( "GP:fmatrix(1): mismatch in matrix dimensions!" ); - } - return tuple->fmatrix( name, data, data.size(), cols, length, maxv ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::fmatrix( const Tuples::Tuple& tuple, const std::string& name, - const GaudiUtils::VectorMap<int, double>& info, - const std::string& length, const size_t maxv ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->fmatrix( name, info, length, maxv ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::array( const Tuples::Tuple& tuple, const std::string& name, - const std::vector<double>& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->array( name, data.begin(), data.end() ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::array( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Vector1& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->array( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::array( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Vector2& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->array( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::array( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Vector3& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->array( name, data.begin(), data.begin() + 3 ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::array( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Vector4& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - // return tuple->array( name , data ) ; - return tuple->array( name, data.begin(), data.begin() + 4 ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::array( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Vector5& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->array( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::array( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Vector6& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->array( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::array( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Vector7& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->array( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::array( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Vector8& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->array( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::array( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Vector9& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->array( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const GaudiPython::Matrix& data, - const Tuples::TupleObj::MIndex cols ) // fixed !!! -{ - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - if ( data.empty() ) { return tuple->Warning( "GP:matrix(1): empty fixed matrix, skip matrix " ); } - if ( cols != data.front().size() ) { return tuple->Error( "GP:matrix(1): mismatch in fixed matrix dimensions!" ); } - return tuple->matrix( name, data, data.size(), cols ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Matrix1x1& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Matrix2x2& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Matrix3x3& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Matrix4x4& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Matrix5x5& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Matrix6x6& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Matrix7x7& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Matrix8x8& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Matrix9x9& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Matrix1x3& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Matrix1x5& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Matrix1x6& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Matrix4x3& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Matrix3x4& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Matrix3x5& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Matrix3x6& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Matrix2x3& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Matrix3x2& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::SymMatrix1x1& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::SymMatrix2x2& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::SymMatrix3x3& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::SymMatrix4x4& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::SymMatrix5x5& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::SymMatrix6x6& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::SymMatrix7x7& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::SymMatrix8x8& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::SymMatrix9x9& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->matrix( name, data ); -} -// ============================================================================ -// advanced column: time -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::column( const Tuples::Tuple& tuple, const Gaudi::Time& value ) { - return column( tuple, "", value ); -} -// ============================================================================ -// advanced column: time -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::column( const Tuples::Tuple& tuple, const std::string& name, - const Gaudi::Time& value ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - StatusCode sc = StatusCode::SUCCESS; - // - sc = tuple->column( name + "year", value.year( true ), 1970, 2070 ); - if ( sc.isFailure() ) { return sc; } - sc = tuple->column( name + "month", value.month( true ) + 1, 1, 16 ); - if ( sc.isFailure() ) { return sc; } - sc = tuple->column( name + "day", value.day( true ), 0, 32 ); - if ( sc.isFailure() ) { return sc; } - sc = tuple->column( name + "hour", value.hour( true ), 0, 25 ); - if ( sc.isFailure() ) { return sc; } - sc = tuple->column( name + "minute", value.minute( true ), 0, 61 ); - if ( sc.isFailure() ) { return sc; } - sc = tuple->column( name + "second", value.second( true ), 0, 61 ); - if ( sc.isFailure() ) { return sc; } - sc = tuple->column( name + "nsecond", value.nsecond() ); - // - return sc; -} -// ============================================================================ - -// ============================================================================ -// Legacy: -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::array( const Tuples::Tuple& tuple, const std::string& name, - const CLHEP::HepVector& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - return tuple->array( name, data, data.num_row() ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::farray( const Tuples::Tuple& tuple, const std::string& name, - const CLHEP::HepVector& data, const std::string& length, - const size_t maxv ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - // use the trick! - const double* begin = &( data[0] ); - const double* end = begin + data.num_row(); - return tuple->farray( name, begin, end, length, maxv ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::matrix( const Tuples::Tuple& tuple, const std::string& name, - const CLHEP::HepGenMatrix& data ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - if ( 1 > data.num_col() ) { return tuple->Error( "GP:matrix(2): illegal fixed matrix num_col" ); } - if ( 1 > data.num_row() ) { return tuple->Error( "GP:matrix(2): illegal fixed matrix num_row" ); } - return tuple->matrix( name, data, data.num_row(), data.num_col() ); -} -// ============================================================================ -StatusCode GaudiPython::TupleDecorator::fmatrix( const Tuples::Tuple& tuple, const std::string& name, - const CLHEP::HepGenMatrix& data, - const Tuples::TupleObj::MIndex cols, // fixed !!! - const std::string& length, const size_t maxv ) { - if ( !tuple.valid() ) { return StatusCode::FAILURE; } - if ( cols != data.num_col() ) { return tuple->Error( "GP:fmatrix(2): mismatch in matrix dimensions!" ); } - return tuple->fmatrix( name, data, data.num_row(), cols, length, maxv ); -} -// ============================================================================ - -// ============================================================================ -// Tuple-Alg-decorator -// ============================================================================ -Tuples::Tuple GaudiPython::TupleAlgDecorator::nTuple( const GaudiTupleAlg& algo, const std::string& title, - const CLID& clid ) { - return algo.nTuple( title, clid ); -} -// ============================================================================ -Tuples::Tuple GaudiPython::TupleAlgDecorator::nTuple( const GaudiTupleAlg& algo, const GaudiAlg::TupleID& ID, - const std::string& title, const CLID& clid ) { - return algo.nTuple( ID, title, clid ); -} -// ============================================================================ -Tuples::Tuple GaudiPython::TupleAlgDecorator::nTuple( const GaudiTupleAlg& algo, const int ID, const std::string& title, - const CLID& clid ) { - return algo.nTuple( ID, title, clid ); -} -// ============================================================================ -Tuples::Tuple GaudiPython::TupleAlgDecorator::nTuple( const GaudiTupleAlg& algo, const std::string& ID, - const std::string& title, const CLID& clid ) { - return algo.nTuple( ID, title, clid ); -} -// ============================================================================ -Tuples::Tuple GaudiPython::TupleAlgDecorator::evtCol( const GaudiTupleAlg& algo, const std::string& title, - const CLID& clid ) { - return algo.evtCol( title, clid ); -} -// ============================================================================ -Tuples::Tuple GaudiPython::TupleAlgDecorator::evtCol( const GaudiTupleAlg& algo, const GaudiAlg::TupleID& ID, - const std::string& title, const CLID& clid ) { - return algo.evtCol( ID, title, clid ); -} -// ============================================================================ -Tuples::Tuple GaudiPython::TupleAlgDecorator::evtCol( const GaudiTupleAlg& algo, const int ID, const std::string& title, - const CLID& clid ) { - return algo.evtCol( ID, title, clid ); -} -// ============================================================================ -Tuples::Tuple GaudiPython::TupleAlgDecorator::evtCol( const GaudiTupleAlg& algo, const std::string& ID, - const std::string& title, const CLID& clid ) { - return algo.evtCol( ID, title, clid ); -} -// ============================================================================ -// The END -// ============================================================================ diff --git a/GaudiAlg/tests/qmtest/gaudialg.qms/algsequencer.qmt b/GaudiAlg/tests/qmtest/gaudialg.qms/algsequencer.qmt deleted file mode 100644 index 81315e6e32c..00000000000 --- a/GaudiAlg/tests/qmtest/gaudialg.qms/algsequencer.qmt +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations - - This software is distributed under the terms of the Apache version 2 licence, - copied verbatim in the file "LICENSE". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> -<argument name="args"><set><text>options/AlgSequencer.opts</text></set></argument> -<argument name="use_temp_dir"><enumeral>true</enumeral></argument> -<argument name="reference"><text>refs/AlgSequencer.ref</text></argument> -</extension> diff --git a/GaudiAlg/tests/qmtest/gaudialg.qms/algsequencer_pyopts.qmt b/GaudiAlg/tests/qmtest/gaudialg.qms/algsequencer_pyopts.qmt deleted file mode 100644 index 0247e9e2880..00000000000 --- a/GaudiAlg/tests/qmtest/gaudialg.qms/algsequencer_pyopts.qmt +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations - - This software is distributed under the terms of the Apache version 2 licence, - copied verbatim in the file "LICENSE". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> - <argument name="program"><text>gaudirun.py</text></argument> - <argument name="args"><set><text>options/AlgSequencer.py</text></set></argument> - <argument name="use_temp_dir"><enumeral>true</enumeral></argument> - <argument name="reference"><text>refs/AlgSequencer_pyopts.ref</text></argument> -</extension> diff --git a/GaudiAlg/tests/qmtest/gaudialg.qms/algtools.qmt b/GaudiAlg/tests/qmtest/gaudialg.qms/algtools.qmt deleted file mode 100644 index e2171a87b6e..00000000000 --- a/GaudiAlg/tests/qmtest/gaudialg.qms/algtools.qmt +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations - - This software is distributed under the terms of the Apache version 2 licence, - copied verbatim in the file "LICENSE". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> - <argument name="program"><text>gaudirun.py</text></argument> - <argument name="args"><set><text>options/AlgTools.py</text></set></argument> - <argument name="use_temp_dir"><enumeral>true</enumeral></argument> - <argument name="reference"><text>refs/AlgTools.ref</text></argument> -</extension> diff --git a/GaudiAlg/tests/qmtest/gaudialg.qms/gaudipython_mix.qmt b/GaudiAlg/tests/qmtest/gaudialg.qms/gaudipython_mix.qmt deleted file mode 100644 index e45aa762314..00000000000 --- a/GaudiAlg/tests/qmtest/gaudialg.qms/gaudipython_mix.qmt +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations - - This software is distributed under the terms of the Apache version 2 licence, - copied verbatim in the file "LICENSE". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> - <argument name="program"><text>scripts/Mix.py</text></argument> - <argument name="use_temp_dir"><enumeral>true</enumeral></argument> - <argument name="reference"><text>refs/Mix.ref</text></argument> -</extension> diff --git a/GaudiAlg/tests/qmtest/gaudialg.qms/histo.qms/ex.qmt b/GaudiAlg/tests/qmtest/gaudialg.qms/histo.qms/ex.qmt deleted file mode 100644 index 88d4a6278dc..00000000000 --- a/GaudiAlg/tests/qmtest/gaudialg.qms/histo.qms/ex.qmt +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations - - This software is distributed under the terms of the Apache version 2 licence, - copied verbatim in the file "LICENSE". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> - <argument name="program"><text>scripts/HistoEx.py</text></argument> - <argument name="use_temp_dir"><enumeral>true</enumeral></argument> - <argument name="reference"><text>refs/HistoEx.pyref</text></argument> -</extension> diff --git a/GaudiAlg/tests/qmtest/gaudialg.qms/histo.qms/ex1.qmt b/GaudiAlg/tests/qmtest/gaudialg.qms/histo.qms/ex1.qmt deleted file mode 100644 index 20ed058faee..00000000000 --- a/GaudiAlg/tests/qmtest/gaudialg.qms/histo.qms/ex1.qmt +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations - - This software is distributed under the terms of the Apache version 2 licence, - copied verbatim in the file "LICENSE". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> - <argument name="program"><text>scripts/HistoEx1.py</text></argument> - <argument name="use_temp_dir"><enumeral>true</enumeral></argument> - <argument name="reference"><text>refs/HistoEx1.pyref</text></argument> -</extension> diff --git a/GaudiAlg/tests/qmtest/gaudialg.qms/histo.qms/ex2.qmt b/GaudiAlg/tests/qmtest/gaudialg.qms/histo.qms/ex2.qmt deleted file mode 100644 index 717b6930daa..00000000000 --- a/GaudiAlg/tests/qmtest/gaudialg.qms/histo.qms/ex2.qmt +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations - - This software is distributed under the terms of the Apache version 2 licence, - copied verbatim in the file "LICENSE". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> - <argument name="program"><text>scripts/HistoEx2.py</text></argument> - <argument name="use_temp_dir"><enumeral>true</enumeral></argument> - <argument name="validator"><text> -from GaudiConf.QMTest.LHCbExclusions import preprocessor -preprocessor = preprocessor + \ - RegexpReplacer(when = "AIDA", - orig = r"ROOT\.AIDA::IProfile1D", - repl = r"cppyy.gbl.AIDA.IProfile1D") - -validateWithReference(preproc = preprocessor) - </text></argument> - <argument name="reference"><text>refs/HistoEx2.pyref</text></argument> -</extension> diff --git a/GaudiAlg/tests/qmtest/gaudialg.qms/histo_ascii_dump.qmt b/GaudiAlg/tests/qmtest/gaudialg.qms/histo_ascii_dump.qmt deleted file mode 100644 index 6c59bd48cf2..00000000000 --- a/GaudiAlg/tests/qmtest/gaudialg.qms/histo_ascii_dump.qmt +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations - - This software is distributed under the terms of the Apache version 2 licence, - copied verbatim in the file "LICENSE". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> - <argument name="program"><text>scripts/HistoDumpEx.py</text></argument> - <argument name="use_temp_dir"><enumeral>true</enumeral></argument> -</extension> diff --git a/GaudiAlg/tests/qmtest/gaudialg.qms/histoutilsex.qmt b/GaudiAlg/tests/qmtest/gaudialg.qms/histoutilsex.qmt deleted file mode 100644 index 2532644dc9f..00000000000 --- a/GaudiAlg/tests/qmtest/gaudialg.qms/histoutilsex.qmt +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations - - This software is distributed under the terms of the Apache version 2 licence, - copied verbatim in the file "LICENSE". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> - <argument name="program"><text>scripts/HistoUtilsEx.py</text></argument> - <argument name="reference"><text>refs/HistoUtilsEx.ref</text></argument> - <argument name="use_temp_dir"><enumeral>true</enumeral></argument> -</extension> diff --git a/GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/aida2rootex.qmt b/GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/aida2rootex.qmt deleted file mode 100644 index 0bcd07211f9..00000000000 --- a/GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/aida2rootex.qmt +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations - - This software is distributed under the terms of the Apache version 2 licence, - copied verbatim in the file "LICENSE". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> - <argument name="program"><text>scripts/Aida2RootEx.py</text></argument> - <argument name="args"><set><text>-b</text></set></argument> - <argument name="use_temp_dir"><enumeral>true</enumeral></argument> - <argument name="reference"><text>refs/Aida2RootEx.ref</text></argument> - <argument name="validator"><text> -preprocessor = (normalizeExamples + - LineSkipper(regexps = [r'INFO png file .* has been created'])) - -validateWithReference(preproc = preprocessor) - </text></argument> -</extension> diff --git a/GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/bug_38882.qmt b/GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/bug_38882.qmt deleted file mode 100644 index eecb94ab36c..00000000000 --- a/GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/bug_38882.qmt +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" ?> -<!-- - (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations - - This software is distributed under the terms of the Apache version 2 licence, - copied verbatim in the file "LICENSE". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<extension class="GaudiTest.GaudiExeTest" kind="test"> -<argument name="program"><text>scripts/bug_38882.py</text></argument> -<argument name="validator"><text> -expected = "=== bug_38882_test_alg Execute ===" -if not expected in stdout: - causes.append("missing signature") - result["GaudiTest.expected_line"] = result.Quote(expected) -</text></argument> -</extension> diff --git a/GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/counter.qmt b/GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/counter.qmt deleted file mode 100644 index a2e7ca7562e..00000000000 --- a/GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/counter.qmt +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations - - This software is distributed under the terms of the Apache version 2 licence, - copied verbatim in the file "LICENSE". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> - <argument name="program"><text>scripts/Counter.py</text></argument> - <argument name="use_temp_dir"><enumeral>true</enumeral></argument> - <argument name="reference"><text>refs/Counter.ref</text></argument> - <argument name="environment"><set> - <text>STDOPTS=$ENV_PROJECT_SOURCE_DIR/GaudiExamples/options</text> - <text>JOBOPTSEARCHPATH=$ENV_PROJECT_SOURCE_DIR/GaudiExamples/tests/qmtest:$ENV_PROJECT_SOURCE_DIR/GaudiExamples/options:$ENV_PROJECT_SOURCE_DIR/Gaudi/tests/pyjobopts:$ENV_PROJECT_SOURCE_DIR/Gaudi/tests</text> - <text>PYTHONPATH=$ENV_PROJECT_SOURCE_DIR/GaudiExamples/tests/qmtest:$ENV_PROJECT_SOURCE_DIR/Gaudi/tests/python:$PYTHONPATH</text> - </set></argument> -</extension> diff --git a/GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/evtcolread.qmt b/GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/evtcolread.qmt deleted file mode 100644 index f3f11502f26..00000000000 --- a/GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/evtcolread.qmt +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations - - This software is distributed under the terms of the Apache version 2 licence, - copied verbatim in the file "LICENSE". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> - <argument name="program"><text>scripts/EvtColRead.py</text></argument> - <argument name="use_temp_dir"><enumeral>true</enumeral></argument> - <argument name="reference"><text>refs/EvtColRead.pyref</text></argument> - <argument name="prerequisites"><set> - <tuple><text>gaudialg.python.evtcolwrite</text><enumeral>PASS</enumeral></tuple> - </set></argument> -</extension> diff --git a/GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/evtcolwrite.qmt b/GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/evtcolwrite.qmt deleted file mode 100644 index 91c37c3fd0e..00000000000 --- a/GaudiAlg/tests/qmtest/gaudialg.qms/python.qms/evtcolwrite.qmt +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations - - This software is distributed under the terms of the Apache version 2 licence, - copied verbatim in the file "LICENSE". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> - <argument name="program"><text>scripts/EvtColWrite.py</text></argument> - <argument name="use_temp_dir"><enumeral>true</enumeral></argument> - <argument name="reference"><text>refs/EvtColWrite.pyref</text></argument> - <argument name="prerequisites"><set> - <tuple><text>gaudialg.evtcolsex.prepare</text><enumeral>PASS</enumeral></tuple> - </set></argument> -</extension> diff --git a/GaudiAlg/tests/qmtest/gaudialg.qms/timing_histos.qmt b/GaudiAlg/tests/qmtest/gaudialg.qms/timing_histos.qmt deleted file mode 100644 index daf7003b633..00000000000 --- a/GaudiAlg/tests/qmtest/gaudialg.qms/timing_histos.qmt +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations - - This software is distributed under the terms of the Apache version 2 licence, - copied verbatim in the file "LICENSE". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> -<argument name="program"><text>gaudirun.py</text></argument> -<argument name="args"><set><text>options/TimingHistograms.py</text></set></argument> -<argument name="use_temp_dir"><enumeral>true</enumeral></argument> -<argument name="reference"><text>refs/TimingHistograms.ref</text></argument> -<argument name="validator"><text> -# Default validation. -validateWithReference() - -# Check the content of the ROOT file. -import os -from subprocess import Popen, PIPE - -testscript = os.path.join(os.environ['ENV_PROJECT_SOURCE_DIR'], 'GaudiAlg', 'tests', 'qmtest', 'scripts', 'test_timing_histo_file.py') -if not os.path.exists(testscript): - testscript = os.path.join(os.environ['ENV_PROJECT_SOURCE_DIR'], 'Gaudi', 'GaudiAlg', 'tests', 'qmtest', 'scripts', 'test_timing_histo_file.py') - -test = Popen(['python3', testscript], stdout=PIPE, stderr=PIPE) -out, err = test.communicate() - -result['root_file_check.returncode'] = str(test.returncode) -if test.returncode: - causes.append('root file content') - -if out: - result['root_file_check.stdout'] = result.Quote(out.decode('utf-8')) - -if err: - causes.append('standard error') - result['root_file_check.stderr'] = result.Quote(err.decode('utf-8')) - -</text></argument> -</extension> diff --git a/GaudiAlg/tests/qmtest/gaudialg.qms/tuple.qms/ex1.qmt b/GaudiAlg/tests/qmtest/gaudialg.qms/tuple.qms/ex1.qmt deleted file mode 100644 index a68ed5181b6..00000000000 --- a/GaudiAlg/tests/qmtest/gaudialg.qms/tuple.qms/ex1.qmt +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations - - This software is distributed under the terms of the Apache version 2 licence, - copied verbatim in the file "LICENSE". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> - <argument name="program"><text>scripts/TupleEx1.py</text></argument> - <argument name="use_temp_dir"><enumeral>true</enumeral></argument> - <argument name="reference"><text>refs/TupleEx1.pyref</text></argument> - <argument name="unsupported_platforms"><set> - <text>.*clang*</text> - </set></argument> -</extension> diff --git a/GaudiAlg/tests/qmtest/gaudialg.qms/tuple.qms/ex2.qmt b/GaudiAlg/tests/qmtest/gaudialg.qms/tuple.qms/ex2.qmt deleted file mode 100644 index 0c6196b80c1..00000000000 --- a/GaudiAlg/tests/qmtest/gaudialg.qms/tuple.qms/ex2.qmt +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations - - This software is distributed under the terms of the Apache version 2 licence, - copied verbatim in the file "LICENSE". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> - <argument name="program"><text>scripts/TupleEx2.py</text></argument> - <argument name="use_temp_dir"><enumeral>true</enumeral></argument> - <argument name="reference"><text>refs/TupleEx2.pyref</text></argument> -</extension> diff --git a/GaudiAlg/tests/qmtest/gaudialg.qms/tuple.qms/ex_py.qmt b/GaudiAlg/tests/qmtest/gaudialg.qms/tuple.qms/ex_py.qmt deleted file mode 100644 index f8ccbaaa90d..00000000000 --- a/GaudiAlg/tests/qmtest/gaudialg.qms/tuple.qms/ex_py.qmt +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations - - This software is distributed under the terms of the Apache version 2 licence, - copied verbatim in the file "LICENSE". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> - <argument name="program"><text>scripts/TupleEx.py</text></argument> - <argument name="use_temp_dir"><enumeral>true</enumeral></argument> - <argument name="reference"><text>refs/TupleEx.pyref</text></argument> -</extension> diff --git a/GaudiAlg/tests/qmtest/options/AlgSequencer.opts b/GaudiAlg/tests/qmtest/options/AlgSequencer.opts deleted file mode 100644 index 62505c6a30b..00000000000 --- a/GaudiAlg/tests/qmtest/options/AlgSequencer.opts +++ /dev/null @@ -1,55 +0,0 @@ -//############################################################## -// Job options file -//============================================================== -#include "Common.opts" - -//-------------------------------------------------------------- -// Private Application Configuration options -//-------------------------------------------------------------- -ApplicationMgr.TopAlg = { "ParentAlg" }; - -// Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -MessageSvc.OutputLevel = 3; - -//-------------------------------------------------------------- -// Event related parameters -//-------------------------------------------------------------- -ApplicationMgr.EvtMax = 10; // events to be processed (default is 10) -ApplicationMgr.EvtSel = "NONE"; // do not use any event input - - -//----------------------------------------------------------------- -// Testing scheduling stops in Event loop processing -//----------------------------------------------------------------- -ApplicationMgr.TopAlg += { "StopperAlg" }; -StopperAlg.StopCount = 20; - -//-------------------------------------------------------------- -// Testing Sequencers -//-------------------------------------------------------------- -ApplicationMgr.TopAlg += { "Gaudi::Sequencer/TopSequence" }; -TopSequence.Members = {"Gaudi::Sequencer/Sequence1", "Gaudi::Sequencer/Sequence2"}; -TopSequence.ShortCircuit = false; -Sequence1.Members = {"Prescaler/Prescaler1", "HelloWorld", "EventCounter/Counter1"}; -Sequence2.Members = {"Prescaler/Prescaler2", "HelloWorld", "EventCounter/Counter2"}; - -HelloWorld.OutputLevel = 2; -Prescaler1.PercentPass = 50.; -Prescaler2.PercentPass = 10.; -Prescaler1.OutputLevel = 4; -Prescaler2.OutputLevel = 4; - -//----------------------------------------------------------------- -// Testing the new GaudiSequencer -//----------------------------------------------------------------- -ApplicationMgr.TopAlg += { "GaudiSequencer/ANDSequence" , "GaudiSequencer/ORSequence" }; -ANDSequence.Members = { "HelloWorld/AND", "EventCounter/ANDCounter"}; -ORSequence.Members = { "HelloWorld/OR", "EventCounter/ORCounter"}; -ORSequence.ModeOR = 1; -ORSequence.MeasureTime = 1; -ANDSequence.MeasureTime = 1; - - -ApplicationMgr.ExtSvc = { "ToolSvc", "AuditorSvc"} ; -ApplicationMgr.AuditAlgorithms = True ; -AuditorSvc.Auditors += {"TimingAuditor/TIMER"} ; diff --git a/GaudiAlg/tests/qmtest/options/AlgSequencer.py b/GaudiAlg/tests/qmtest/options/AlgSequencer.py deleted file mode 100644 index be556daa69a..00000000000 --- a/GaudiAlg/tests/qmtest/options/AlgSequencer.py +++ /dev/null @@ -1,63 +0,0 @@ -##################################################################################### -# (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations # -# # -# This software is distributed under the terms of the Apache version 2 licence, # -# copied verbatim in the file "LICENSE". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -##################################################################################### -############################################################### -# Job options file -# ============================================================== - -from Configurables import ( - GaudiExamplesCommonConf, - HelloWorld, - ParentAlg, - Prescaler, - StopperAlg, - TimingAuditor, -) -from Gaudi.Configuration import * - -GaudiExamplesCommonConf() - -# -------------------------------------------------------------- -# Testing Sequencers -# -------------------------------------------------------------- -p1 = Prescaler("Prescaler1", PercentPass=50.0, OutputLevel=WARNING) -p2 = Prescaler("Prescaler2", PercentPass=10.0, OutputLevel=WARNING) -h = HelloWorld(OutputLevel=DEBUG) -c1 = EventCounter("Counter1") -c2 = EventCounter("Counter2") -s1 = Gaudi__Sequencer("Sequence1", Members=[p1, h, c1]) -s2 = Gaudi__Sequencer("Sequence2", Members=[p2, h, c2]) -top = Gaudi__Sequencer("TopSequence", Members=[s1, s2], ShortCircuit=False) - -# ----------------------------------------------------------------- -# Testing the new GaudiSequencer -# ----------------------------------------------------------------- -sand = GaudiSequencer( - "ANDSequence", - Members=[HelloWorld("AND"), EventCounter("ANDCounter")], - MeasureTime=1, -) -sor = GaudiSequencer( - "ORSequence", - Members=[HelloWorld("OR"), EventCounter("ORCounter")], - MeasureTime=1, - ModeOR=1, -) - -# ----------------------------------------------------------------- -ApplicationMgr( - TopAlg=[ParentAlg(), StopperAlg(StopCount=20), top, sand, sor], - EvtMax=10, # events to be processed (default is 10) - EvtSel="NONE", # do not use any event input - ExtSvc=["ToolSvc", "AuditorSvc"], - AuditAlgorithms=True, -) - -AuditorSvc().Auditors += [TimingAuditor("TIMER")] diff --git a/GaudiAlg/tests/qmtest/options/AlgTools.py b/GaudiAlg/tests/qmtest/options/AlgTools.py deleted file mode 100644 index 468a661af27..00000000000 --- a/GaudiAlg/tests/qmtest/options/AlgTools.py +++ /dev/null @@ -1,76 +0,0 @@ -##################################################################################### -# (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations # -# # -# This software is distributed under the terms of the Apache version 2 licence, # -# copied verbatim in the file "LICENSE". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -##################################################################################### -############################################################### -# Job options file -# ============================================================== -from Configurables import GaudiExamplesCommonConf, MyGaudiAlgorithm, MyGaudiTool -from Gaudi.Configuration import * - -GaudiExamplesCommonConf() - -myalg = MyGaudiAlgorithm("MyAlg") - -myalg.addTool( - MyGaudiTool(Int=101, Double=101.1e10, String="hundred one", Bool=False)) - -gtool = MyGaudiTool( - "MyGaudiTool", - Int=201, - Double=201.1e10, - String="two hundred and one", - Bool=True, - OutputLevel=INFO, -) - -tool_conf1 = MyGaudiTool( - "MyTool_conf1", - Int=1, - Double=2, - String="three", - Bool=True, - OutputLevel=INFO) - -tool_conf2 = MyGaudiTool( - "MyTool_conf2", - Int=10, - Double=20, - String="xyz", - Bool=False, - OutputLevel=INFO) - -myToolWithName = myalg.addTool(tool_conf2, "ToolWithName") - -myalg.ToolWithName.String = "xyz" - -assert myToolWithName.String == "xyz" -assert myalg.ToolWithName == myToolWithName - -myToolWithName.String = "abc" - -myalg.PrivToolHandle.String = "Is a private tool" - -pubtool = MyGaudiTool("TestPubToolHandle", String="Is a public tool") -myalg.PubToolHandle = pubtool - -# disable a ToolHandle -myalg.InvalidToolHandle = "" - -ApplicationMgr( - EvtMax=10, EvtSel="NONE", HistogramPersistency="NONE", TopAlg=[myalg]) -# -------------------------------------------------------------- -# Test circular tool dependencies (by Chris Jones) -# -------------------------------------------------------------- -from Configurables import TestTool, TestToolAlg - -tA = TestTool("ToolA", Tools=["TestTool/ToolB"], OutputLevel=DEBUG) -tB = TestTool("ToolB", Tools=["TestTool/ToolA"], OutputLevel=DEBUG) -testalg = TestToolAlg(Tools=["TestTool/ToolA"]) -ApplicationMgr().TopAlg += [testalg] diff --git a/GaudiAlg/tests/qmtest/options/TimingHistograms.py b/GaudiAlg/tests/qmtest/options/TimingHistograms.py deleted file mode 100644 index 87ae175e086..00000000000 --- a/GaudiAlg/tests/qmtest/options/TimingHistograms.py +++ /dev/null @@ -1,34 +0,0 @@ -##################################################################################### -# (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations # -# # -# This software is distributed under the terms of the Apache version 2 licence, # -# copied verbatim in the file "LICENSE". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -##################################################################################### -############################################################### -# Job options file -# ============================================================== -from pathlib import Path - -from Gaudi.Configuration import * - -# Reuse AlgSequencer.py options -importOptions(Path(__file__).parent / "AlgSequencer.py") - -# -------------------------------------------------------------- -# Enable Timing Histograms -# -------------------------------------------------------------- -from Configurables import SequencerTimerTool, TimingAuditor - -TIMER = TimingAuditor("TIMER") -TIMER.addTool(SequencerTimerTool, name="TIMER") -TIMER.TIMER.HistoProduce = True - -# -------------------------------------------------------------- -# Enable histograms output -# -------------------------------------------------------------- -RootHistSvc().OutputFile = "timing_histos.root" -ApplicationMgr(HistogramPersistency="ROOT") diff --git a/GaudiAlg/tests/qmtest/refs/AlgSequencer.ref b/GaudiAlg/tests/qmtest/refs/AlgSequencer.ref deleted file mode 100644 index 267b8e35aa3..00000000000 --- a/GaudiAlg/tests/qmtest/refs/AlgSequencer.ref +++ /dev/null @@ -1,281 +0,0 @@ -JobOptionsSvc INFO # =======> /afs/cern.ch/work/m/marcocle/workspace/Gaudi/GaudiExamples/options/Services.opts -JobOptionsSvc INFO # (12,1): AuditorSvc.Auditors = ["ChronoAuditor"] -JobOptionsSvc INFO # =======> /afs/cern.ch/work/m/marcocle/workspace/Gaudi/GaudiExamples/options/Common.opts -JobOptionsSvc INFO # (9,1): ApplicationMgr.StatusCodeCheck = 1 -JobOptionsSvc INFO # =======> /afs/cern.ch/work/m/marcocle/workspace/Gaudi/GaudiExamples/options/AlgSequencer.opts -JobOptionsSvc INFO # (9,1): ApplicationMgr.TopAlg = ["ParentAlg"] -JobOptionsSvc INFO # (12,1): MessageSvc.OutputLevel = 3 -JobOptionsSvc INFO # (17,1): ApplicationMgr.EvtMax = 10 -JobOptionsSvc INFO # (18,1): ApplicationMgr.EvtSel = "NONE" -JobOptionsSvc INFO # (24,1): ApplicationMgr.TopAlg += ["StopperAlg"] -JobOptionsSvc INFO # (25,1): StopperAlg.StopCount = 20 -JobOptionsSvc INFO # (30,1): ApplicationMgr.TopAlg += ["Gaudi::Sequencer/TopSequence"] -JobOptionsSvc INFO # (31,1): TopSequence.Members = ["Gaudi::Sequencer/Sequence1", "Gaudi::Sequencer/Sequence2"] -JobOptionsSvc INFO # (32,1): TopSequence.StopOverride = 1 -JobOptionsSvc INFO # (33,1): Sequence1.Members = ["Prescaler/Prescaler1", "HelloWorld", "EventCounter/Counter1"] -JobOptionsSvc INFO # (34,1): Sequence2.Members = ["Prescaler/Prescaler2", "HelloWorld", "EventCounter/Counter2"] -JobOptionsSvc INFO # (36,1): HelloWorld.OutputLevel = 2 -JobOptionsSvc INFO # (37,1): Prescaler1.PercentPass = 50. -JobOptionsSvc INFO # (38,1): Prescaler2.PercentPass = 10. -JobOptionsSvc INFO # (39,1): Prescaler1.OutputLevel = 4 -JobOptionsSvc INFO # (40,1): Prescaler2.OutputLevel = 4 -JobOptionsSvc INFO # (45,1): ApplicationMgr.TopAlg += ["GaudiSequencer/ANDSequence", "GaudiSequencer/ORSequence"] -JobOptionsSvc INFO # (46,1): ANDSequence.Members = ["HelloWorld/AND", "EventCounter/ANDCounter"] -JobOptionsSvc INFO # (47,1): ORSequence.Members = ["HelloWorld/OR", "EventCounter/ORCounter"] -JobOptionsSvc INFO # (48,1): ORSequence.ModeOR = 1 -JobOptionsSvc INFO # (49,1): ORSequence.MeasureTime = 1 -JobOptionsSvc INFO # (50,1): ANDSequence.MeasureTime = 1 -JobOptionsSvc INFO # (53,1): ApplicationMgr.ExtSvc = ["ToolSvc", "AuditorSvc"] -JobOptionsSvc INFO # (54,1): ApplicationMgr.AuditAlgorithms = 1 -JobOptionsSvc INFO # (55,1): AuditorSvc.Auditors += ["TimingAuditor/TIMER"] -JobOptionsSvc INFO Job options successfully read in from /afs/cern.ch/work/m/marcocle/workspace/Gaudi/GaudiExamples/options/AlgSequencer.opts -ApplicationMgr SUCCESS -==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v4r0) - running on pclhcb117 on Thu Feb 11 14:52:56 2016 -==================================================================================================================================== -ApplicationMgr INFO Application Manager Configured successfully -StatusCodeSvc INFO initialize -RndmGenSvc.Engine INFO Generator engine type:CLHEP::RanluxEngine -RndmGenSvc.Engine INFO Current Seed:1234567 Luxury:3 -RndmGenSvc INFO Using Random engine:HepRndm::Engine<CLHEP::RanluxEngine> -TIMER.TIMER INFO This machine has a speed about 3.82 times the speed of a 2.8 GHz Xeon. -ParentAlg INFO creating sub-algorithms.... -SubAlg1 INFO initializing.... -SubAlg2 INFO initializing.... -TopSequence INFO Member list: Gaudi::Sequencer/Sequence1, Gaudi::Sequencer/Sequence2 -Sequence1 INFO Member list: Prescaler/Prescaler1, HelloWorld, EventCounter/Counter1 -HelloWorld DEBUG Property update for OutputLevel : new value = 2 -HelloWorld INFO initializing.... -HelloWorld DEBUG input handles: 0 -HelloWorld DEBUG output handles: 0 -HelloWorld DEBUG Data Deps for HelloWorld -Counter1 INFO Counter1:EventCounter::initialize - Frequency: 'Frequency':1 -Sequence2 INFO Member list: Prescaler/Prescaler2, HelloWorld, EventCounter/Counter2 -Counter2 INFO Counter2:EventCounter::initialize - Frequency: 'Frequency':1 -ANDSequence INFO Member list: HelloWorld/AND, EventCounter/ANDCounter -ToolSvc.Sequenc... INFO This machine has a speed about 4.15 times the speed of a 2.8 GHz Xeon. -AND INFO initializing.... -ANDCounter INFO ANDCounter:EventCounter::initialize - Frequency: 'Frequency':1 -ORSequence INFO OR Member list: HelloWorld/OR, EventCounter/ORCounter -OR INFO initializing.... -ORCounter INFO ORCounter:EventCounter::initialize - Frequency: 'Frequency':1 -EventLoopMgr WARNING Unable to locate service "EventSelector" -EventLoopMgr WARNING No events will be processed from external input. -HistogramPersis...WARNING Histograms saving not required. -ApplicationMgr INFO Application Manager Initialized successfully -ApplicationMgr INFO Application Manager Started successfully -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 1 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -HelloWorld INFO executing.... -Counter1 INFO Counter1:EventCounter::execute - seen events: 1 -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 2 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 3 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -HelloWorld INFO executing.... -Counter1 INFO Counter1:EventCounter::execute - seen events: 2 -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 4 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 5 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -HelloWorld INFO executing.... -Counter1 INFO Counter1:EventCounter::execute - seen events: 3 -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 6 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 7 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -HelloWorld INFO executing.... -Counter1 INFO Counter1:EventCounter::execute - seen events: 4 -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 8 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 9 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -HelloWorld INFO executing.... -Counter1 INFO Counter1:EventCounter::execute - seen events: 5 -Counter2 INFO Counter2:EventCounter::execute - seen events: 1 -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 10 -OR INFO executing.... -ApplicationMgr INFO Application Manager Stopped successfully -ParentAlg INFO finalizing.... -SubAlg1 INFO finalizing.... -SubAlg2 INFO finalizing.... -HelloWorld INFO finalizing.... -Counter1 INFO Counter1:EventCounter::finalize - total events: 5 -Counter2 INFO Counter2:EventCounter::finalize - total events: 1 -AND INFO finalizing.... -ANDCounter INFO ANDCounter:EventCounter::finalize - total events: 10 -OR INFO finalizing.... -ORCounter INFO ORCounter:EventCounter::finalize - total events: 0 -EventLoopMgr INFO Histograms converted successfully according to request. -ToolSvc INFO Removing all tools created by ToolSvc -ToolSvc.Sequenc... INFO -------------------------------------------------------------------------------------------------- -ToolSvc.Sequenc... INFO This machine has a speed about 4.15 times the speed of a 2.8 GHz Xeon. -ToolSvc.Sequenc... INFO Algorithm (millisec) | <user> | <clock> | min max sigma | entries | total (s) | -ToolSvc.Sequenc... INFO -------------------------------------------------------------------------------------------------- -ToolSvc.Sequenc... INFO ANDSequence | 0.000 | 0.025 | 0.025 0.0 0.00 | 10 | 0.000 | -ToolSvc.Sequenc... INFO AND | 0.000 | 0.010 | 0.010 0.0 0.00 | 10 | 0.000 | -ToolSvc.Sequenc... INFO ANDCounter | 0.000 | 0.014 | 0.013 0.0 0.00 | 10 | 0.000 | -ToolSvc.Sequenc... INFO ORSequence | 0.100 | 0.012 | 0.011 0.0 0.00 | 10 | 0.000 | -ToolSvc.Sequenc... INFO OR | 0.100 | 0.011 | 0.010 0.0 0.00 | 10 | 0.000 | -ToolSvc.Sequenc... INFO ORCounter | 0.000 | 0.000 | 0.000 0.0 0.00 | 0 | 0.000 | -ToolSvc.Sequenc... INFO -------------------------------------------------------------------------------------------------- -TIMER.TIMER INFO -------------------------------------------------------------------------------------------------- -TIMER.TIMER INFO This machine has a speed about 3.82 times the speed of a 2.8 GHz Xeon. -TIMER.TIMER INFO Algorithm (millisec) | <user> | <clock> | min max sigma | entries | total (s) | -TIMER.TIMER INFO -------------------------------------------------------------------------------------------------- -TIMER.TIMER INFO EVENT LOOP | 0.199 | 0.123 | 0.097 0.2 0.02 | 10 | 0.001 | -TIMER.TIMER INFO ParentAlg | 0.000 | 0.022 | 0.021 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO SubAlg1 | 0.000 | 0.000 | 0.000 0.0 0.00 | 0 | 0.000 | -TIMER.TIMER INFO SubAlg2 | 0.000 | 0.000 | 0.000 0.0 0.00 | 0 | 0.000 | -TIMER.TIMER INFO StopperAlg | 0.000 | 0.002 | 0.002 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO TopSequence | 0.099 | 0.029 | 0.011 0.1 0.02 | 10 | 0.000 | -TIMER.TIMER INFO Sequence1 | 0.099 | 0.018 | 0.004 0.0 0.01 | 10 | 0.000 | -TIMER.TIMER INFO Prescaler1 | 0.000 | 0.001 | 0.001 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO HelloWorld | 0.000 | 0.008 | 0.008 0.0 0.00 | 5 | 0.000 | -TIMER.TIMER INFO Counter1 | 0.199 | 0.013 | 0.010 0.0 0.00 | 5 | 0.000 | -TIMER.TIMER INFO Sequence2 | 0.000 | 0.006 | 0.004 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO Prescaler2 | 0.000 | 0.001 | 0.001 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO Counter2 | 0.000 | 0.009 | 0.009 0.0 0.00 | 1 | 0.000 | -TIMER.TIMER INFO ANDSequence | 0.000 | 0.029 | 0.027 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO AND | 0.000 | 0.008 | 0.008 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO ANDCounter | 0.000 | 0.011 | 0.010 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO ORSequence | 0.100 | 0.014 | 0.013 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO OR | 0.100 | 0.008 | 0.008 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO ORCounter | 0.000 | 0.000 | 0.000 0.0 0.00 | 0 | 0.000 | -TIMER.TIMER INFO -------------------------------------------------------------------------------------------------- -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) -*****Chrono***** INFO **************************************************************************************************** -Counter2:Start INFO Time User : Tot= 0 [us] #= 1 -AND:Start INFO Time User : Tot= 0 [us] #= 1 -HelloWorld:Stop INFO Time User : Tot= 0 [us] #= 1 -OR:Start INFO Time User : Tot= 0 [us] #= 1 -StopperAlg:Stop INFO Time User : Tot= 0 [us] #= 1 -Sequence2:Stop INFO Time User : Tot= 0 [us] #= 1 -Counter1:Start INFO Time User : Tot= 0 [us] #= 1 -Prescaler1:Stop INFO Time User : Tot= 0 [us] #= 1 -Prescaler1:Start INFO Time User : Tot= 0 [us] #= 1 -ParentAlg:Stop INFO Time User : Tot= 0 [us] #= 1 -HelloWorld:Start INFO Time User : Tot= 0 [us] #= 1 -ORSequence:Stop INFO Time User : Tot= 0 [us] #= 1 -OR:Stop INFO Time User : Tot= 0 [us] #= 1 -ORCounter:Start INFO Time User : Tot= 0 [us] #= 1 -ORCounter:Stop INFO Time User : Tot= 0 [us] #= 1 -ORSequence:Start INFO Time User : Tot= 0 [us] #= 1 -ParentAlg:Start INFO Time User : Tot= 0 [us] #= 1 -Prescaler2:Start INFO Time User : Tot= 0 [us] #= 1 -Prescaler2:Stop INFO Time User : Tot= 0 [us] #= 1 -Sequence1:Stop INFO Time User : Tot= 0 [us] #= 1 -StopperAlg:Start INFO Time User : Tot= 0 [us] #= 1 -SubAlg1:Start INFO Time User : Tot= 0 [us] #= 1 -SubAlg1:Stop INFO Time User : Tot= 0 [us] #= 1 -SubAlg2:Start INFO Time User : Tot= 0 [us] #= 1 -SubAlg2:Stop INFO Time User : Tot= 0 [us] #= 1 -TopSequence:Stop INFO Time User : Tot= 0 [us] #= 1 -ANDSequence:Stop INFO Time User : Tot= 0 [us] #= 1 -AND:Stop INFO Time User : Tot= 0 [us] #= 1 -Counter2:Stop INFO Time User : Tot= 0 [us] #= 1 -ANDCounter:Start INFO Time User : Tot= 0 [us] #= 1 -ANDSequence:Start INFO Time User : Tot= 0 [us] #= 1 -ANDCounter:Stop INFO Time User : Tot= 0 [us] #= 1 -Counter1:Stop INFO Time User : Tot= 0 [us] #= 1 -TopSequence:Fin... INFO Time User : Tot= 0 [us] #= 1 -Prescaler2:Fina... INFO Time User : Tot= 0 [us] #= 1 -Sequence1:Finalize INFO Time User : Tot= 0 [us] #= 1 -Sequence2:Finalize INFO Time User : Tot= 0 [us] #= 1 -StopperAlg:Fina... INFO Time User : Tot= 0 [us] #= 1 -StopperAlg:Init... INFO Time User : Tot= 0 [us] #= 1 -Sequence2:Start INFO Time User : Tot= 0 [us] #= 1 -Sequence1:Start INFO Time User : Tot= 0 [us] #= 1 -ORSequence:Fina... INFO Time User : Tot= 0 [us] #= 1 -Counter2:Execute INFO Time User : Tot= 0 [us] #= 1 -Prescaler2:Init... INFO Time User : Tot= 0 [us] #= 1 -OR:Finalize INFO Time User : Tot= 0 [us] #= 1 -AND:Finalize INFO Time User : Tot= 0 [us] #= 1 -HelloWorld:Fina... INFO Time User : Tot= 0 [us] #= 1 -Counter2:Finalize INFO Time User : Tot= 0 [us] #= 1 -ORCounter:Finalize INFO Time User : Tot= 0 [us] #= 1 -ParentAlg:Finalize INFO Time User : Tot= 0 [us] #= 1 -SubAlg2:Finalize INFO Time User : Tot= 0 [us] #= 1 -SubAlg2:Initialize INFO Time User : Tot= 0 [us] #= 1 -Counter1:Finalize INFO Time User : Tot= 0 [us] #= 1 -Counter2:Initia... INFO Time User : Tot= 0 [us] #= 1 -ORCounter:Initi... INFO Time User : Tot= 0 [us] #= 1 -SubAlg1:Finalize INFO Time User : Tot= 0 [us] #= 1 -ANDCounter:Init... INFO Time User : Tot= 0 [us] #= 1 -SubAlg1:Initialize INFO Time User : Tot= 0 [us] #= 1 -Counter1:Initia... INFO Time User : Tot= 0 [us] #= 1 -ANDCounter:Fina... INFO Time User : Tot= 0 [us] #= 1 -TopSequence:Start INFO Time User : Tot= 0 [us] #= 1 -Prescaler1:Fina... INFO Time User : Tot= 0 [us] #= 1 -Prescaler1:Init... INFO Time User : Tot= 0 [us] #= 1 -OR:Initialize INFO Time User : Tot= 0 [us] #= 1 -HelloWorld:Init... INFO Time User : Tot= 0 [us] #= 1 -ANDSequence:Fin... INFO Time User : Tot= 0 [us] #= 1 -AND:Initialize INFO Time User : Tot= 0 [us] #= 1 -ParentAlg:Initi... INFO Time User : Tot= 0 [us] #= 1 -Sequence2:Initi... INFO Time User : Tot= 0 [us] #= 1 -ORSequence:Init... INFO Time User : Tot= 0 [us] #= 1 -HelloWorld:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 5 -Prescaler2:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -Prescaler1:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -StopperAlg:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -Sequence2:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -AND:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -ANDCounter:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -ParentAlg:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -ANDSequence:Exe... INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -Counter1:Execute INFO Time User : Tot=0.999 [ms] Ave/Min/Max= 0.2(+- 0.4)/ 0/0.999 [ms] #= 5 -Sequence1:Execute INFO Time User : Tot=0.999 [ms] Ave/Min/Max=0.0999(+- 0.3)/ 0/0.999 [ms] #= 10 -TopSequence:Exe... INFO Time User : Tot=0.999 [ms] Ave/Min/Max=0.0999(+- 0.3)/ 0/0.999 [ms] #= 10 -Sequence1:Initi... INFO Time User : Tot= 1 [ms] #= 1 -TopSequence:Ini... INFO Time User : Tot= 1 [ms] #= 1 -OR:Execute INFO Time User : Tot= 1 [ms] Ave/Min/Max= 0.1(+- 0.3)/ 0/ 1 [ms] #= 10 -ORSequence:Execute INFO Time User : Tot= 1 [ms] Ave/Min/Max= 0.1(+- 0.3)/ 0/ 1 [ms] #= 10 -ANDSequence:Ini... INFO Time User : Tot= 241 [ms] #= 1 -ChronoStatSvc INFO Time User : Tot=0.531 [s] #= 1 -*****Chrono***** INFO **************************************************************************************************** -ChronoStatSvc.f... INFO Service finalized successfully -ApplicationMgr INFO Application Manager Finalized successfully -ApplicationMgr INFO Application Manager Terminated successfully diff --git a/GaudiAlg/tests/qmtest/refs/AlgSequencer_pyopts.ref b/GaudiAlg/tests/qmtest/refs/AlgSequencer_pyopts.ref deleted file mode 100644 index acd78f7805d..00000000000 --- a/GaudiAlg/tests/qmtest/refs/AlgSequencer_pyopts.ref +++ /dev/null @@ -1,258 +0,0 @@ -# setting LC_ALL to "C" -# --> Including file '/bld2/leggett/work/BeginRun/gaudi_g/Gaudi/GaudiExamples/options/AlgSequencer.py' -# <-- End of file '/bld2/leggett/work/BeginRun/gaudi_g/Gaudi/GaudiExamples/options/AlgSequencer.py' -# applying configuration of GaudiExamplesCommonConf -# /***** User GaudiExamplesCommonConf/GaudiExamplesCommonConf **************************************** -# |-OutputLevel = 3 -# |-DummyEvents = -1 -# \----- (End of User GaudiExamplesCommonConf/GaudiExamplesCommonConf) ------------------------------- -ApplicationMgr SUCCESS -==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v30r0) - running on zeus on Mon Dec 18 16:00:47 2017 -==================================================================================================================================== -ApplicationMgr INFO Application Manager Configured successfully -StatusCodeSvc INFO initialize -RndmGenSvc.Engine INFO Generator engine type:CLHEP::RanluxEngine -RndmGenSvc.Engine INFO Current Seed:1234567 Luxury:3 -RndmGenSvc INFO Using Random engine:HepRndm::Engine<CLHEP::RanluxEngine> -TIMER.TIMER INFO This machine has a speed about 2.63 times the speed of a 2.8 GHz Xeon. -ParentAlg INFO creating sub-algorithms.... -SubAlg1 INFO initializing.... -SubAlg2 INFO initializing.... -TopSequence INFO Member list: Gaudi::Sequencer/Sequence1, Gaudi::Sequencer/Sequence2 -Sequence1 INFO Member list: Prescaler/Prescaler1, HelloWorld, EventCounter/Counter1 -HelloWorld DEBUG Property update for OutputLevel : new value = 2 -HelloWorld INFO initializing.... -HelloWorld DEBUG input handles: 0 -HelloWorld DEBUG output handles: 0 -HelloWorld DEBUG Data Deps for HelloWorld -Counter1 INFO Counter1:EventCounter::initialize - Frequency: 'Frequency':1 -Sequence2 INFO Member list: Prescaler/Prescaler2, HelloWorld, EventCounter/Counter2 -Counter2 INFO Counter2:EventCounter::initialize - Frequency: 'Frequency':1 -ANDSequence INFO Member list: HelloWorld/AND, EventCounter/ANDCounter -ToolSvc.Sequenc... INFO This machine has a speed about 3.45 times the speed of a 2.8 GHz Xeon. -AND INFO initializing.... -ANDCounter INFO ANDCounter:EventCounter::initialize - Frequency: 'Frequency':1 -ORSequence INFO OR Member list: HelloWorld/OR, EventCounter/ORCounter -OR INFO initializing.... -ORCounter INFO ORCounter:EventCounter::initialize - Frequency: 'Frequency':1 -EventLoopMgr WARNING Unable to locate service "EventSelector" -EventLoopMgr WARNING No events will be processed from external input. -HistogramPersis...WARNING Histograms saving not required. -ApplicationMgr INFO Application Manager Initialized successfully -ApplicationMgr INFO Application Manager Started successfully -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 1 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -HelloWorld INFO executing.... -Counter1 INFO Counter1:EventCounter::execute - seen events: 1 -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 2 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 3 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -HelloWorld INFO executing.... -Counter1 INFO Counter1:EventCounter::execute - seen events: 2 -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 4 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 5 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -HelloWorld INFO executing.... -Counter1 INFO Counter1:EventCounter::execute - seen events: 3 -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 6 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 7 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -HelloWorld INFO executing.... -Counter1 INFO Counter1:EventCounter::execute - seen events: 4 -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 8 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 9 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -HelloWorld INFO executing.... -Counter1 INFO Counter1:EventCounter::execute - seen events: 5 -Counter2 INFO Counter2:EventCounter::execute - seen events: 1 -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 10 -OR INFO executing.... -ApplicationMgr INFO Application Manager Stopped successfully -ParentAlg INFO finalizing.... -SubAlg1 INFO finalizing.... -SubAlg2 INFO finalizing.... -HelloWorld INFO finalizing.... -Counter1 INFO Counter1:EventCounter::finalize - total events: 5 -Counter2 INFO Counter2:EventCounter::finalize - total events: 1 -AND INFO finalizing.... -ANDCounter INFO ANDCounter:EventCounter::finalize - total events: 10 -OR INFO finalizing.... -ORCounter INFO ORCounter:EventCounter::finalize - total events: 0 -EventLoopMgr INFO Histograms converted successfully according to request. -ToolSvc INFO Removing all tools created by ToolSvc -ToolSvc.Sequenc... INFO -------------------------------------------------------------------------------------------------- -ToolSvc.Sequenc... INFO This machine has a speed about 3.45 times the speed of a 2.8 GHz Xeon. -ToolSvc.Sequenc... INFO Algorithm (millisec) | <user> | <clock> | min max sigma | entries | total (s) | -ToolSvc.Sequenc... INFO -------------------------------------------------------------------------------------------------- -ToolSvc.Sequenc... INFO ANDSequence | 0.000 | 0.013 | 0.011 0.0 0.00 | 10 | 0.000 | -ToolSvc.Sequenc... INFO AND | 0.000 | 0.006 | 0.005 0.0 0.00 | 10 | 0.000 | -ToolSvc.Sequenc... INFO ANDCounter | 0.000 | 0.006 | 0.004 0.0 0.00 | 10 | 0.000 | -ToolSvc.Sequenc... INFO ORSequence | 0.000 | 0.006 | 0.006 0.0 0.00 | 10 | 0.000 | -ToolSvc.Sequenc... INFO OR | 0.000 | 0.005 | 0.005 0.0 0.00 | 10 | 0.000 | -ToolSvc.Sequenc... INFO ORCounter | 0.000 | 0.000 | 0.000 0.0 0.00 | 0 | 0.000 | -ToolSvc.Sequenc... INFO -------------------------------------------------------------------------------------------------- -TIMER.TIMER INFO -------------------------------------------------------------------------------------------------- -TIMER.TIMER INFO This machine has a speed about 2.63 times the speed of a 2.8 GHz Xeon. -TIMER.TIMER INFO Algorithm (millisec) | <user> | <clock> | min max sigma | entries | total (s) | -TIMER.TIMER INFO -------------------------------------------------------------------------------------------------- -TIMER.TIMER INFO EVENT LOOP | 0.000 | 0.072 | 0.049 0.2 0.04 | 10 | 0.001 | -TIMER.TIMER INFO ParentAlg | 0.000 | 0.008 | 0.007 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO SubAlg1 | 0.000 | 0.000 | 0.000 0.0 0.00 | 0 | 0.000 | -TIMER.TIMER INFO SubAlg2 | 0.000 | 0.000 | 0.000 0.0 0.00 | 0 | 0.000 | -TIMER.TIMER INFO StopperAlg | 0.000 | 0.001 | 0.001 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO TopSequence | 0.000 | 0.019 | 0.012 0.0 0.01 | 10 | 0.000 | -TIMER.TIMER INFO Sequence1 | 0.000 | 0.009 | 0.004 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO Prescaler1 | 0.000 | 0.001 | 0.001 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO HelloWorld | 0.000 | 0.004 | 0.004 0.0 0.00 | 5 | 0.000 | -TIMER.TIMER INFO Counter1 | 0.000 | 0.003 | 0.003 0.0 0.00 | 5 | 0.000 | -TIMER.TIMER INFO Sequence2 | 0.000 | 0.005 | 0.004 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO Prescaler2 | 0.000 | 0.001 | 0.001 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO Counter2 | 0.000 | 0.006 | 0.006 0.0 0.00 | 1 | 0.000 | -TIMER.TIMER INFO ANDSequence | 0.000 | 0.015 | 0.012 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO AND | 0.000 | 0.005 | 0.004 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO ANDCounter | 0.000 | 0.005 | 0.003 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO ORSequence | 0.000 | 0.007 | 0.007 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO OR | 0.000 | 0.004 | 0.004 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO ORCounter | 0.000 | 0.000 | 0.000 0.0 0.00 | 0 | 0.000 | -TIMER.TIMER INFO -------------------------------------------------------------------------------------------------- -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) -*****Chrono***** INFO **************************************************************************************************** -ORSequence:Start INFO Time User : Tot= 0 [us] #= 1 -Prescaler2:Start INFO Time User : Tot= 0 [us] #= 1 -Counter1:Stop INFO Time User : Tot= 0 [us] #= 1 -Counter1:Start INFO Time User : Tot= 0 [us] #= 1 -Prescaler1:Stop INFO Time User : Tot= 0 [us] #= 1 -Counter2:Stop INFO Time User : Tot= 0 [us] #= 1 -Sequence2:Finalize INFO Time User : Tot= 0 [us] #= 1 -Sequence2:Stop INFO Time User : Tot= 0 [us] #= 1 -ParentAlg:Stop INFO Time User : Tot= 0 [us] #= 1 -ANDCounter:Stop INFO Time User : Tot= 0 [us] #= 1 -ORCounter:Start INFO Time User : Tot= 0 [us] #= 1 -OR:Stop INFO Time User : Tot= 0 [us] #= 1 -SubAlg2:Start INFO Time User : Tot= 0 [us] #= 1 -SubAlg2:Stop INFO Time User : Tot= 0 [us] #= 1 -AND:Stop INFO Time User : Tot= 0 [us] #= 1 -AND:Start INFO Time User : Tot= 0 [us] #= 1 -TopSequence:Stop INFO Time User : Tot= 0 [us] #= 1 -ORCounter:Stop INFO Time User : Tot= 0 [us] #= 1 -OR:Start INFO Time User : Tot= 0 [us] #= 1 -ParentAlg:Start INFO Time User : Tot= 0 [us] #= 1 -Prescaler1:Start INFO Time User : Tot= 0 [us] #= 1 -ORSequence:Stop INFO Time User : Tot= 0 [us] #= 1 -Prescaler2:Fina... INFO Time User : Tot= 0 [us] #= 1 -Prescaler2:Stop INFO Time User : Tot= 0 [us] #= 1 -Sequence1:Finalize INFO Time User : Tot= 0 [us] #= 1 -Sequence1:Stop INFO Time User : Tot= 0 [us] #= 1 -StopperAlg:Fina... INFO Time User : Tot= 0 [us] #= 1 -StopperAlg:Init... INFO Time User : Tot= 0 [us] #= 1 -StopperAlg:Start INFO Time User : Tot= 0 [us] #= 1 -StopperAlg:Stop INFO Time User : Tot= 0 [us] #= 1 -SubAlg1:Start INFO Time User : Tot= 0 [us] #= 1 -SubAlg1:Stop INFO Time User : Tot= 0 [us] #= 1 -TopSequence:Fin... INFO Time User : Tot= 0 [us] #= 1 -ANDSequence:Start INFO Time User : Tot= 0 [us] #= 1 -Counter2:Start INFO Time User : Tot= 0 [us] #= 1 -ANDSequence:Stop INFO Time User : Tot= 0 [us] #= 1 -ANDCounter:Start INFO Time User : Tot= 0 [us] #= 1 -HelloWorld:Start INFO Time User : Tot= 0 [us] #= 1 -HelloWorld:Stop INFO Time User : Tot= 0 [us] #= 1 -ORCounter:Finalize INFO Time User : Tot= 0 [us] #= 1 -ORSequence:Fina... INFO Time User : Tot= 0 [us] #= 1 -ParentAlg:Finalize INFO Time User : Tot= 0 [us] #= 1 -SubAlg2:Finalize INFO Time User : Tot= 0 [us] #= 1 -ANDCounter:Fina... INFO Time User : Tot= 0 [us] #= 1 -Sequence2:Start INFO Time User : Tot= 0 [us] #= 1 -Counter1:Finalize INFO Time User : Tot= 0 [us] #= 1 -Prescaler2:Init... INFO Time User : Tot= 0 [us] #= 1 -OR:Finalize INFO Time User : Tot= 0 [us] #= 1 -Counter2:Execute INFO Time User : Tot= 0 [us] #= 1 -Counter2:Finalize INFO Time User : Tot= 0 [us] #= 1 -AND:Finalize INFO Time User : Tot= 0 [us] #= 1 -HelloWorld:Fina... INFO Time User : Tot= 0 [us] #= 1 -SubAlg1:Finalize INFO Time User : Tot= 0 [us] #= 1 -SubAlg2:Initialize INFO Time User : Tot= 0 [us] #= 1 -ORCounter:Initi... INFO Time User : Tot= 0 [us] #= 1 -SubAlg1:Initialize INFO Time User : Tot= 0 [us] #= 1 -Counter2:Initia... INFO Time User : Tot= 0 [us] #= 1 -OR:Initialize INFO Time User : Tot= 0 [us] #= 1 -ANDSequence:Fin... INFO Time User : Tot= 0 [us] #= 1 -AND:Initialize INFO Time User : Tot= 0 [us] #= 1 -ANDCounter:Init... INFO Time User : Tot= 0 [us] #= 1 -Sequence1:Start INFO Time User : Tot= 0 [us] #= 1 -HelloWorld:Init... INFO Time User : Tot= 0 [us] #= 1 -Prescaler1:Init... INFO Time User : Tot= 0 [us] #= 1 -TopSequence:Start INFO Time User : Tot= 0 [us] #= 1 -Prescaler1:Fina... INFO Time User : Tot= 0 [us] #= 1 -Counter1:Initia... INFO Time User : Tot= 0 [us] #= 1 -ParentAlg:Initi... INFO Time User : Tot= 0 [us] #= 1 -ORSequence:Init... INFO Time User : Tot= 0 [us] #= 1 -Sequence2:Initi... INFO Time User : Tot= 0 [us] #= 1 -Sequence1:Initi... INFO Time User : Tot= 0 [us] #= 1 -TopSequence:Ini... INFO Time User : Tot= 0 [us] #= 1 -Counter1:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 5 -HelloWorld:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 5 -StopperAlg:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -Prescaler1:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -Prescaler2:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -ANDCounter:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -OR:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -AND:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -Sequence2:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -ORSequence:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -ParentAlg:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -Sequence1:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -ANDSequence:Exe... INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -TopSequence:Exe... INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -ANDSequence:Ini... INFO Time User : Tot= 290 [ms] #= 1 -ChronoStatSvc INFO Time User : Tot= 340 [ms] #= 1 -*****Chrono***** INFO **************************************************************************************************** -ChronoStatSvc.f... INFO Service finalized successfully -ApplicationMgr INFO Application Manager Finalized successfully -ApplicationMgr INFO Application Manager Terminated successfully diff --git a/GaudiAlg/tests/qmtest/refs/AlgTools.ref b/GaudiAlg/tests/qmtest/refs/AlgTools.ref deleted file mode 100644 index 0576b3f9b05..00000000000 --- a/GaudiAlg/tests/qmtest/refs/AlgTools.ref +++ /dev/null @@ -1,357 +0,0 @@ -# setting LC_ALL to "C" -# --> Including file '/home/marcocle/stacks/master/Gaudi/GaudiAlg/tests/qmtest/options/AlgTools.py' -# <-- End of file '/home/marcocle/stacks/master/Gaudi/GaudiAlg/tests/qmtest/options/AlgTools.py' -# applying configuration of GaudiExamplesCommonConf -# /***** User GaudiExamplesCommonConf/GaudiExamplesCommonConf **************************************** -# |-OutputLevel = 3 -# |-DummyEvents = -1 -# \----- (End of User GaudiExamplesCommonConf/GaudiExamplesCommonConf) ------------------------------- -ApplicationMgr SUCCESS -==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v36r12) - running on lbbuildinter01.cern.ch on Thu Apr 20 15:55:27 2023 -==================================================================================================================================== -ApplicationMgr INFO Application Manager Configured successfully -MyAlg INFO initializing.... -ToolSvc.MyTool INFO intialize() has been called -ToolSvc.MyTool INFO Int = 100 -ToolSvc.MyTool INFO Double = 100 -ToolSvc.MyTool INFO String = hundred -ToolSvc.MyTool INFO Bool = 1 -MyAlg.MyTool INFO intialize() has been called -MyAlg.MyTool INFO Int = 100 -MyAlg.MyTool INFO Double = 100 -MyAlg.MyTool INFO String = hundred -MyAlg.MyTool INFO Bool = 1 -ToolSvc.MyGaudi... INFO intialize() has been called -ToolSvc.MyGaudi... INFO Int = 201 -ToolSvc.MyGaudi... INFO Double = 2.011e+12 -ToolSvc.MyGaudi... INFO String = two hundred and one -ToolSvc.MyGaudi... INFO Bool = 1 -MyAlg.MyGaudiTool INFO intialize() has been called -MyAlg.MyGaudiTool INFO Int = 101 -MyAlg.MyGaudiTool INFO Double = 1.011e+12 -MyAlg.MyGaudiTool INFO String = hundred one -MyAlg.MyGaudiTool INFO Bool = 0 -MyAlg.ToolWithName INFO intialize() has been called -MyAlg.ToolWithName INFO Int = 10 -MyAlg.ToolWithName INFO Double = 20 -MyAlg.ToolWithName INFO String = abc -MyAlg.ToolWithName INFO Bool = 0 -MyAlg INFO /Event/Rec/Tracks -MyAlg INFO /Event/Rec/Hits -MyAlg INFO /Rec/RAW -MyAlg INFO /Event/MyAnalysis/Tracks -MyAlg.WrongIfac... INFO intialize() has been called -MyAlg.WrongIfac... INFO Int = 100 -MyAlg.WrongIfac... INFO Double = 100 -MyAlg.WrongIfac... INFO String = hundred -MyAlg.WrongIfac... INFO Bool = 1 -MyAlg INFO unable to retrieve MyTool/WrongIfaceTool (expected) with exception: unable to dcast AlgTool MyTool/WrongIfaceTool to interface IWrongTool -MyAlg INFO ....initialization done -ToolSvc.Another... INFO intialize() has been called -ToolSvc.Another... INFO Int = 100 -ToolSvc.Another... INFO Double = 100 -ToolSvc.Another... INFO String = hundred -ToolSvc.Another... INFO Bool = 1 -ToolSvc.Another... INFO intialize() has been called -ToolSvc.Another... INFO Int = 100 -ToolSvc.Another... INFO Double = 100 -ToolSvc.Another... INFO String = hundred -ToolSvc.Another... INFO Bool = 1 -MyAlg.PrivToolH... INFO intialize() has been called -MyAlg.PrivToolH... INFO Int = 100 -MyAlg.PrivToolH... INFO Double = 100 -MyAlg.PrivToolH... INFO String = Is a private tool -MyAlg.PrivToolH... INFO Bool = 1 -ToolSvc.TestPub... INFO intialize() has been called -ToolSvc.TestPub... INFO Int = 100 -ToolSvc.TestPub... INFO Double = 100 -ToolSvc.TestPub... INFO String = Is a public tool -ToolSvc.TestPub... INFO Bool = 1 -ToolSvc.Generic... INFO intialize() has been called -ToolSvc.Generic... INFO Int = 100 -ToolSvc.Generic... INFO Double = 100 -ToolSvc.Generic... INFO String = hundred -ToolSvc.Generic... INFO Bool = 1 -MyAlg.LegacyToo... INFO intialize() has been called -MyAlg.LegacyToo... INFO Int = 100 -MyAlg.LegacyToo... INFO Double = 100 -MyAlg.LegacyToo... INFO String = hundred -MyAlg.LegacyToo... INFO Bool = 1 -ToolSvc.ToolA DEBUG Property update for OutputLevel : new value = 2 -ToolSvc.ToolA DEBUG Initialize -ToolSvc.ToolA DEBUG Loading tool ToolB of type TestTool -ToolSvc.ToolB DEBUG Property update for OutputLevel : new value = 2 -ToolSvc.ToolB DEBUG Initialize -ToolSvc.ToolB DEBUG Loading tool ToolA of type TestTool -EventLoopMgr WARNING Unable to locate service "EventSelector" -EventLoopMgr WARNING No events will be processed from external input. -ApplicationMgr INFO Application Manager Initialized successfully -ApplicationMgr INFO Application Manager Started successfully -MyAlg INFO executing.... -MyAlg INFO tools created with tool<T>... -ToolSvc.MyTool INFO doIt() has been called -MyAlg.MyTool INFO doIt() has been called -ToolSvc.MyGaudi... INFO doIt() has been called -ToolSvc.MyGaudi... INFO MyGaudiTool:: public tool called by [MyAlg] -MyAlg.MyGaudiTool INFO doIt() has been called -MyAlg.ToolWithName INFO doIt() has been called -MyAlg.MyGaudiTool INFO doItAgain() has been called -MyAlg INFO tools created via ToolHandle<T>.... -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.TestPub... INFO doIt() has been called -ToolSvc.TestPub... INFO MyGaudiTool:: public tool called by [MyAlg] -ToolSvc.ConstGe... INFO intialize() has been called -ToolSvc.ConstGe... INFO Int = 100 -ToolSvc.ConstGe... INFO Double = 100 -ToolSvc.ConstGe... INFO String = hundred -ToolSvc.ConstGe... INFO Bool = 1 -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied assigned via ToolHandle<T>.... -ToolSvc.PubTool... INFO intialize() has been called -ToolSvc.PubTool... INFO Int = 100 -ToolSvc.PubTool... INFO Double = 100 -ToolSvc.PubTool... INFO String = hundred -ToolSvc.PubTool... INFO Bool = 1 -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied constructed via ToolHandle<T>.... -ToolSvc.TestPub... INFO doIt() has been called -ToolSvc.TestPub... INFO MyGaudiTool:: public tool called by [MyAlg] -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO executing.... -MyAlg INFO tools created with tool<T>... -ToolSvc.MyTool INFO doIt() has been called -MyAlg.MyTool INFO doIt() has been called -ToolSvc.MyGaudi... INFO doIt() has been called -ToolSvc.MyGaudi... INFO MyGaudiTool:: public tool called by [MyAlg] -MyAlg.MyGaudiTool INFO doIt() has been called -MyAlg.ToolWithName INFO doIt() has been called -MyAlg.MyGaudiTool INFO doItAgain() has been called -MyAlg INFO tools created via ToolHandle<T>.... -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.TestPub... INFO doIt() has been called -ToolSvc.TestPub... INFO MyGaudiTool:: public tool called by [MyAlg] -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied assigned via ToolHandle<T>.... -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied constructed via ToolHandle<T>.... -ToolSvc.TestPub... INFO doIt() has been called -ToolSvc.TestPub... INFO MyGaudiTool:: public tool called by [MyAlg] -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO executing.... -MyAlg INFO tools created with tool<T>... -ToolSvc.MyTool INFO doIt() has been called -MyAlg.MyTool INFO doIt() has been called -ToolSvc.MyGaudi... INFO doIt() has been called -ToolSvc.MyGaudi... INFO MyGaudiTool:: public tool called by [MyAlg] -MyAlg.MyGaudiTool INFO doIt() has been called -MyAlg.ToolWithName INFO doIt() has been called -MyAlg.MyGaudiTool INFO doItAgain() has been called -MyAlg INFO tools created via ToolHandle<T>.... -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.TestPub... INFO doIt() has been called -ToolSvc.TestPub... INFO MyGaudiTool:: public tool called by [MyAlg] -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied assigned via ToolHandle<T>.... -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied constructed via ToolHandle<T>.... -ToolSvc.TestPub... INFO doIt() has been called -ToolSvc.TestPub... INFO MyGaudiTool:: public tool called by [MyAlg] -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO executing.... -MyAlg INFO tools created with tool<T>... -ToolSvc.MyTool INFO doIt() has been called -MyAlg.MyTool INFO doIt() has been called -ToolSvc.MyGaudi... INFO doIt() has been called -ToolSvc.MyGaudi... INFO MyGaudiTool:: public tool called by [MyAlg] -MyAlg.MyGaudiTool INFO doIt() has been called -MyAlg.ToolWithName INFO doIt() has been called -MyAlg.MyGaudiTool INFO doItAgain() has been called -MyAlg INFO tools created via ToolHandle<T>.... -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.TestPub... INFO doIt() has been called -ToolSvc.TestPub... INFO MyGaudiTool:: public tool called by [MyAlg] -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied assigned via ToolHandle<T>.... -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied constructed via ToolHandle<T>.... -ToolSvc.TestPub... INFO doIt() has been called -ToolSvc.TestPub... INFO MyGaudiTool:: public tool called by [MyAlg] -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO executing.... -MyAlg INFO tools created with tool<T>... -ToolSvc.MyTool INFO doIt() has been called -MyAlg.MyTool INFO doIt() has been called -ToolSvc.MyGaudi... INFO doIt() has been called -ToolSvc.MyGaudi... INFO MyGaudiTool:: public tool called by [MyAlg] -MyAlg.MyGaudiTool INFO doIt() has been called -MyAlg.ToolWithName INFO doIt() has been called -MyAlg.MyGaudiTool INFO doItAgain() has been called -MyAlg INFO tools created via ToolHandle<T>.... -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.TestPub... INFO doIt() has been called -ToolSvc.TestPub... INFO MyGaudiTool:: public tool called by [MyAlg] -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied assigned via ToolHandle<T>.... -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied constructed via ToolHandle<T>.... -ToolSvc.TestPub... INFO doIt() has been called -ToolSvc.TestPub... INFO MyGaudiTool:: The INFO message is suppressed : 'public tool called by [MyAlg]' -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO executing.... -MyAlg INFO tools created with tool<T>... -ToolSvc.MyTool INFO doIt() has been called -MyAlg.MyTool INFO doIt() has been called -ToolSvc.MyGaudi... INFO doIt() has been called -ToolSvc.MyGaudi... INFO MyGaudiTool:: public tool called by [MyAlg] -MyAlg.MyGaudiTool INFO doIt() has been called -MyAlg.ToolWithName INFO doIt() has been called -MyAlg.MyGaudiTool INFO doItAgain() has been called -MyAlg INFO tools created via ToolHandle<T>.... -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.TestPub... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied assigned via ToolHandle<T>.... -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied constructed via ToolHandle<T>.... -ToolSvc.TestPub... INFO doIt() has been called -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO executing.... -MyAlg INFO tools created with tool<T>... -ToolSvc.MyTool INFO doIt() has been called -MyAlg.MyTool INFO doIt() has been called -ToolSvc.MyGaudi... INFO doIt() has been called -ToolSvc.MyGaudi... INFO MyGaudiTool:: public tool called by [MyAlg] -MyAlg.MyGaudiTool INFO doIt() has been called -MyAlg.ToolWithName INFO doIt() has been called -MyAlg.MyGaudiTool INFO doItAgain() has been called -MyAlg INFO tools created via ToolHandle<T>.... -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.TestPub... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied assigned via ToolHandle<T>.... -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied constructed via ToolHandle<T>.... -ToolSvc.TestPub... INFO doIt() has been called -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO executing.... -MyAlg INFO tools created with tool<T>... -ToolSvc.MyTool INFO doIt() has been called -MyAlg.MyTool INFO doIt() has been called -ToolSvc.MyGaudi... INFO doIt() has been called -ToolSvc.MyGaudi... INFO MyGaudiTool:: public tool called by [MyAlg] -MyAlg.MyGaudiTool INFO doIt() has been called -MyAlg.ToolWithName INFO doIt() has been called -MyAlg.MyGaudiTool INFO doItAgain() has been called -MyAlg INFO tools created via ToolHandle<T>.... -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.TestPub... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied assigned via ToolHandle<T>.... -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied constructed via ToolHandle<T>.... -ToolSvc.TestPub... INFO doIt() has been called -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO executing.... -MyAlg INFO tools created with tool<T>... -ToolSvc.MyTool INFO doIt() has been called -MyAlg.MyTool INFO doIt() has been called -ToolSvc.MyGaudi... INFO doIt() has been called -ToolSvc.MyGaudi... INFO MyGaudiTool:: public tool called by [MyAlg] -MyAlg.MyGaudiTool INFO doIt() has been called -MyAlg.ToolWithName INFO doIt() has been called -MyAlg.MyGaudiTool INFO doItAgain() has been called -MyAlg INFO tools created via ToolHandle<T>.... -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.TestPub... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied assigned via ToolHandle<T>.... -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied constructed via ToolHandle<T>.... -ToolSvc.TestPub... INFO doIt() has been called -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO executing.... -MyAlg INFO tools created with tool<T>... -ToolSvc.MyTool INFO doIt() has been called -MyAlg.MyTool INFO doIt() has been called -ToolSvc.MyGaudi... INFO doIt() has been called -ToolSvc.MyGaudi... INFO MyGaudiTool:: The INFO message is suppressed : 'public tool called by [MyAlg]' -MyAlg.MyGaudiTool INFO doIt() has been called -MyAlg.ToolWithName INFO doIt() has been called -MyAlg.MyGaudiTool INFO doItAgain() has been called -MyAlg INFO tools created via ToolHandle<T>.... -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.TestPub... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied assigned via ToolHandle<T>.... -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.PubTool... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -MyAlg INFO tools copied constructed via ToolHandle<T>.... -ToolSvc.TestPub... INFO doIt() has been called -MyAlg.PrivToolH... INFO doIt() has been called -ToolSvc.ConstGe... INFO doIt() has been called -ApplicationMgr INFO Application Manager Stopped successfully -MyAlg INFO finalizing.... -EventLoopMgr INFO Histograms converted successfully according to request. -ToolSvc INFO Removing all tools created by ToolSvc -MyAlg.ToolWithName INFO finalize() has been called -MyAlg.MyGaudiTool INFO finalize() has been called -ToolSvc.MyGaudi... INFO finalize() has been called -MyAlg.MyTool INFO finalize() has been called -ToolSvc.MyTool INFO finalize() has been called -ToolSvc.ToolB DEBUG Finalize -MyAlg.LegacyToo... INFO finalize() has been called -ToolSvc.Generic... INFO finalize() has been called -ToolSvc.Another... INFO finalize() has been called -ToolSvc.Another... INFO finalize() has been called -MyAlg.WrongIfac... INFO finalize() has been called -ToolSvc.PubTool... INFO finalize() has been called -ToolSvc.ToolA DEBUG Finalize -ToolSvc.TestPub... INFO finalize() has been called -MyAlg.PrivToolH... INFO finalize() has been called -ToolSvc.ConstGe... INFO finalize() has been called -MyAlg.ToolWithName INFO destructor has been called -MyAlg.MyGaudiTool INFO destructor has been called -ToolSvc.MyGaudi... INFO destructor has been called -MyAlg.MyTool INFO destructor has been called -ToolSvc.MyTool INFO destructor has been called -MyAlg.LegacyToo... INFO destructor has been called -ToolSvc.Generic... INFO destructor has been called -ToolSvc.Another... INFO destructor has been called -ToolSvc.Another... INFO destructor has been called -MyAlg.WrongIfac... INFO destructor has been called -ToolSvc.PubTool... INFO destructor has been called -ToolSvc.TestPub... INFO destructor has been called -MyAlg.PrivToolH... INFO destructor has been called -ToolSvc.ConstGe... INFO destructor has been called -ApplicationMgr INFO Application Manager Finalized successfully -ApplicationMgr INFO Application Manager Terminated successfully diff --git a/GaudiAlg/tests/qmtest/refs/Mix.ref b/GaudiAlg/tests/qmtest/refs/Mix.ref deleted file mode 100644 index a6eda6cc2dc..00000000000 --- a/GaudiAlg/tests/qmtest/refs/Mix.ref +++ /dev/null @@ -1,171 +0,0 @@ -# setting LC_ALL to "C" -************************************************************************************************************************ - -Simple example to illustrate the problem for task #13911 -https://savannah.cern.ch/task/?13911 - - Author : Vanya BELYAEV Ivan.Belyaev@itep.ru - Date : 2010-04-24 -************************************************************************************************************************ -ApplicationMgr SUCCESS -==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v30r0) - running on zeus on Mon Dec 18 14:44:15 2017 -==================================================================================================================================== -ApplicationMgr INFO Application Manager Configured successfully -StatusCodeSvc INFO initialize -DetectorDataSvc INFO Detector description not requested to be loaded -HelloWorld INFO initializing.... -MySequencer INFO Member list: HelloWorld/Hello1, HelloWorld/Hello2, HelloWorld/Hello3, GaudiPython::PyAlg<GaudiAlgorithm>/Simple2 -RndmGenSvc.Engine INFO Generator engine type:CLHEP::RanluxEngine -RndmGenSvc.Engine INFO Current Seed:1234567 Luxury:3 -RndmGenSvc INFO Using Random engine:HepRndm::Engine<CLHEP::RanluxEngine> -ToolSvc.Sequenc... INFO This machine has a speed about 2.17 times the speed of a 2.8 GHz Xeon. -Hello1 INFO initializing.... -Hello2 INFO initializing.... -Hello3 INFO initializing.... -EventLoopMgr WARNING Unable to locate service "EventSelector" -EventLoopMgr WARNING No events will be processed from external input. -HistogramPersis...WARNING Histograms saving not required. -ApplicationMgr INFO Application Manager Initialized successfully -ApplicationMgr INFO Application Manager Started successfully -I am SimpleAlgo.execute! Simple1 -HelloWorld INFO executing.... -Hello1 INFO executing.... -Hello2 INFO executing.... -Hello3 INFO executing.... -I am SimpleAlgo.execute! Simple2 -I am SimpleAlgo.execute! Simple1 -HelloWorld INFO executing.... -Hello1 INFO executing.... -Hello2 INFO executing.... -Hello3 INFO executing.... -I am SimpleAlgo.execute! Simple2 -I am SimpleAlgo.execute! Simple1 -HelloWorld INFO executing.... -Hello1 INFO executing.... -Hello2 INFO executing.... -Hello3 INFO executing.... -I am SimpleAlgo.execute! Simple2 -I am SimpleAlgo.execute! Simple1 -HelloWorld INFO executing.... -Hello1 INFO executing.... -Hello2 INFO executing.... -Hello3 INFO executing.... -I am SimpleAlgo.execute! Simple2 -Hello4 INFO initializing.... -MySequencer INFO Member list: HelloWorld/Hello1, HelloWorld/Hello2, HelloWorld/Hello3, GaudiPython::PyAlg<GaudiAlgorithm>/Simple2, HelloWorld/Hello4 -I am SimpleAlgo.execute! Simple1 -HelloWorld INFO executing.... -Hello1 INFO executing.... -Hello2 INFO executing.... -Hello3 INFO executing.... -I am SimpleAlgo.execute! Simple2 -Hello4 INFO executing.... -I am SimpleAlgo.execute! Simple1 -HelloWorld INFO executing.... -Hello1 INFO executing.... -Hello2 INFO executing.... -Hello3 INFO executing.... -I am SimpleAlgo.execute! Simple2 -Hello4 INFO executing.... -I am SimpleAlgo.execute! Simple1 -HelloWorld INFO executing.... -Hello1 INFO executing.... -Hello2 INFO executing.... -Hello3 INFO executing.... -I am SimpleAlgo.execute! Simple2 -Hello4 INFO executing.... -I am SimpleAlgo.execute! Simple1 -HelloWorld INFO executing.... -Hello1 INFO executing.... -Hello2 INFO executing.... -Hello3 INFO executing.... -I am SimpleAlgo.execute! Simple2 -Hello4 INFO executing.... -I am SimpleAlgo.execute! Simple1 -HelloWorld INFO executing.... -Hello1 INFO executing.... -Hello2 INFO executing.... -Hello3 INFO executing.... -I am SimpleAlgo.execute! Simple2 -Hello4 INFO executing.... -I am SimpleAlgo.execute! Simple1 -HelloWorld INFO executing.... -Hello1 INFO executing.... -Hello2 INFO executing.... -Hello3 INFO executing.... -I am SimpleAlgo.execute! Simple2 -Hello4 INFO executing.... -I am SimpleAlgo.execute! Simple1 -HelloWorld INFO executing.... -Hello1 INFO executing.... -Hello2 INFO executing.... -Hello3 INFO executing.... -I am SimpleAlgo.execute! Simple2 -Hello4 INFO executing.... -I am SimpleAlgo.execute! Simple1 -HelloWorld INFO executing.... -Hello1 INFO executing.... -Hello2 INFO executing.... -Hello3 INFO executing.... -I am SimpleAlgo.execute! Simple2 -Hello4 INFO executing.... -MySequencer INFO Member list: HelloWorld/Hello1, HelloWorld/Hello2, HelloWorld/Hello3, GaudiPython::PyAlg<GaudiAlgorithm>/Simple2, HelloWorld/Hello4, GaudiPython::PyAlg<GaudiAlgorithm>/Simple3 -I am SimpleAlgo.execute! Simple1 -HelloWorld INFO executing.... -Hello1 INFO executing.... -Hello2 INFO executing.... -Hello3 INFO executing.... -I am SimpleAlgo.execute! Simple2 -Hello4 INFO executing.... -I am SimpleAlgo.execute! Simple3 -I am SimpleAlgo.execute! Simple1 -HelloWorld INFO executing.... -Hello1 INFO executing.... -Hello2 INFO executing.... -Hello3 INFO executing.... -I am SimpleAlgo.execute! Simple2 -Hello4 INFO executing.... -I am SimpleAlgo.execute! Simple3 -I am SimpleAlgo.execute! Simple1 -HelloWorld INFO executing.... -Hello1 INFO executing.... -Hello2 INFO executing.... -Hello3 INFO executing.... -I am SimpleAlgo.execute! Simple2 -Hello4 INFO executing.... -I am SimpleAlgo.execute! Simple3 -ApplicationMgr INFO Application Manager Stopped successfully -HelloWorld INFO finalizing.... -Hello1 INFO finalizing.... -Hello2 INFO finalizing.... -Hello3 INFO finalizing.... -Hello4 INFO finalizing.... -EventLoopMgr INFO Histograms converted successfully according to request. -ToolSvc INFO Removing all tools created by ToolSvc -ToolSvc.Sequenc... INFO -------------------------------------------------------------------------------------------------- -ToolSvc.Sequenc... INFO This machine has a speed about 2.17 times the speed of a 2.8 GHz Xeon. -ToolSvc.Sequenc... INFO Algorithm (millisec) | <user> | <clock> | min max sigma | entries | total (s) | -ToolSvc.Sequenc... INFO -------------------------------------------------------------------------------------------------- -ToolSvc.Sequenc... INFO MySequencer | 0.000 | 0.109 | 0.098 0.1 0.02 | 4 | 0.000 | -ToolSvc.Sequenc... INFO Hello1 | 0.000 | 0.027 | 0.024 0.0 0.01 | 4 | 0.000 | -ToolSvc.Sequenc... INFO Hello2 | 0.000 | 0.023 | 0.022 0.0 0.00 | 4 | 0.000 | -ToolSvc.Sequenc... INFO Hello3 | 0.000 | 0.026 | 0.022 0.0 0.01 | 4 | 0.000 | -ToolSvc.Sequenc... INFO Simple2 | 0.000 | 0.026 | 0.023 0.0 0.01 | 4 | 0.000 | -ToolSvc.Sequenc... INFO MySequencer | 1.250 | 0.129 | 0.117 0.1 0.01 | 8 | 0.001 | -ToolSvc.Sequenc... INFO Hello1 | 0.000 | 0.024 | 0.022 0.0 0.00 | 8 | 0.000 | -ToolSvc.Sequenc... INFO Hello2 | 0.000 | 0.022 | 0.020 0.0 0.00 | 8 | 0.000 | -ToolSvc.Sequenc... INFO Hello3 | 0.000 | 0.022 | 0.020 0.0 0.00 | 8 | 0.000 | -ToolSvc.Sequenc... INFO Simple2 | 1.250 | 0.022 | 0.021 0.0 0.00 | 8 | 0.000 | -ToolSvc.Sequenc... INFO Hello4 | 0.000 | 0.029 | 0.026 0.0 0.00 | 8 | 0.000 | -ToolSvc.Sequenc... INFO MySequencer | 0.000 | 0.157 | 0.148 0.2 0.02 | 3 | 0.000 | -ToolSvc.Sequenc... INFO Hello1 | 0.000 | 0.028 | 0.025 0.0 0.01 | 3 | 0.000 | -ToolSvc.Sequenc... INFO Hello2 | 0.000 | 0.025 | 0.022 0.0 0.00 | 3 | 0.000 | -ToolSvc.Sequenc... INFO Hello3 | 0.000 | 0.023 | 0.021 0.0 0.00 | 3 | 0.000 | -ToolSvc.Sequenc... INFO Simple2 | 0.000 | 0.023 | 0.022 0.0 0.00 | 3 | 0.000 | -ToolSvc.Sequenc... INFO Hello4 | 0.000 | 0.028 | 0.027 0.0 0.00 | 3 | 0.000 | -ToolSvc.Sequenc... INFO Simple3 | 0.000 | 0.021 | 0.021 0.0 0.00 | 3 | 0.000 | -ToolSvc.Sequenc... INFO -------------------------------------------------------------------------------------------------- -ApplicationMgr INFO Application Manager Finalized successfully -ApplicationMgr INFO Application Manager Terminated successfully diff --git a/GaudiAlg/tests/qmtest/refs/TimingHistograms.ref b/GaudiAlg/tests/qmtest/refs/TimingHistograms.ref deleted file mode 100644 index 97d904f086c..00000000000 --- a/GaudiAlg/tests/qmtest/refs/TimingHistograms.ref +++ /dev/null @@ -1,263 +0,0 @@ -# setting LC_ALL to "C" -# --> Including file '/bld2/leggett/work/BeginRun/gaudi_g/Gaudi/GaudiExamples/options/TimingHistograms.py' -# --> Including file '/bld2/leggett/work/BeginRun/gaudi_g/Gaudi/GaudiExamples/options/AlgSequencer.py' -# <-- End of file '/bld2/leggett/work/BeginRun/gaudi_g/Gaudi/GaudiExamples/options/AlgSequencer.py' -# <-- End of file '/bld2/leggett/work/BeginRun/gaudi_g/Gaudi/GaudiExamples/options/TimingHistograms.py' -# applying configuration of GaudiExamplesCommonConf -# /***** User GaudiExamplesCommonConf/GaudiExamplesCommonConf **************************************** -# |-OutputLevel = 3 -# |-DummyEvents = -1 -# \----- (End of User GaudiExamplesCommonConf/GaudiExamplesCommonConf) ------------------------------- -ApplicationMgr SUCCESS -==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v30r0) - running on zeus on Mon Dec 18 15:50:47 2017 -==================================================================================================================================== -ApplicationMgr INFO Application Manager Configured successfully -StatusCodeSvc INFO initialize -RootHistSvc INFO Writing ROOT histograms to: timing_histos.root -HistogramPersis... INFO Added successfully Conversion service:RootHistSvc -RndmGenSvc.Engine INFO Generator engine type:CLHEP::RanluxEngine -RndmGenSvc.Engine INFO Current Seed:1234567 Luxury:3 -RndmGenSvc INFO Using Random engine:HepRndm::Engine<CLHEP::RanluxEngine> -TIMER.TIMER INFO This machine has a speed about 3.03 times the speed of a 2.8 GHz Xeon. -ParentAlg INFO creating sub-algorithms.... -SubAlg1 INFO initializing.... -SubAlg2 INFO initializing.... -TopSequence INFO Member list: Gaudi::Sequencer/Sequence1, Gaudi::Sequencer/Sequence2 -Sequence1 INFO Member list: Prescaler/Prescaler1, HelloWorld, EventCounter/Counter1 -HelloWorld DEBUG Property update for OutputLevel : new value = 2 -HelloWorld INFO initializing.... -HelloWorld DEBUG input handles: 0 -HelloWorld DEBUG output handles: 0 -HelloWorld DEBUG Data Deps for HelloWorld -Counter1 INFO Counter1:EventCounter::initialize - Frequency: 'Frequency':1 -Sequence2 INFO Member list: Prescaler/Prescaler2, HelloWorld, EventCounter/Counter2 -Counter2 INFO Counter2:EventCounter::initialize - Frequency: 'Frequency':1 -ANDSequence INFO Member list: HelloWorld/AND, EventCounter/ANDCounter -ToolSvc.Sequenc... INFO This machine has a speed about 3.70 times the speed of a 2.8 GHz Xeon. -AND INFO initializing.... -ANDCounter INFO ANDCounter:EventCounter::initialize - Frequency: 'Frequency':1 -ORSequence INFO OR Member list: HelloWorld/OR, EventCounter/ORCounter -OR INFO initializing.... -ORCounter INFO ORCounter:EventCounter::initialize - Frequency: 'Frequency':1 -EventLoopMgr WARNING Unable to locate service "EventSelector" -EventLoopMgr WARNING No events will be processed from external input. -ApplicationMgr INFO Application Manager Initialized successfully -ApplicationMgr INFO Application Manager Started successfully -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 1 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -HelloWorld INFO executing.... -Counter1 INFO Counter1:EventCounter::execute - seen events: 1 -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 2 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 3 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -HelloWorld INFO executing.... -Counter1 INFO Counter1:EventCounter::execute - seen events: 2 -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 4 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 5 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -HelloWorld INFO executing.... -Counter1 INFO Counter1:EventCounter::execute - seen events: 3 -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 6 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 7 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -HelloWorld INFO executing.... -Counter1 INFO Counter1:EventCounter::execute - seen events: 4 -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 8 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 9 -OR INFO executing.... -ParentAlg INFO executing.... -SubAlg1 INFO executing.... -SubAlg2 INFO executing.... -HelloWorld INFO executing.... -Counter1 INFO Counter1:EventCounter::execute - seen events: 5 -Counter2 INFO Counter2:EventCounter::execute - seen events: 1 -AND INFO executing.... -ANDCounter INFO ANDCounter:EventCounter::execute - seen events: 10 -OR INFO executing.... -ApplicationMgr INFO Application Manager Stopped successfully -TIMER.TIMER INFO Saving Timing histograms -ParentAlg INFO finalizing.... -SubAlg1 INFO finalizing.... -SubAlg2 INFO finalizing.... -HelloWorld INFO finalizing.... -Counter1 INFO Counter1:EventCounter::finalize - total events: 5 -Counter2 INFO Counter2:EventCounter::finalize - total events: 1 -AND INFO finalizing.... -ANDCounter INFO ANDCounter:EventCounter::finalize - total events: 10 -OR INFO finalizing.... -ORCounter INFO ORCounter:EventCounter::finalize - total events: 0 -EventLoopMgr INFO Histograms converted successfully according to request. -ToolSvc INFO Removing all tools created by ToolSvc -ToolSvc.Sequenc... INFO -------------------------------------------------------------------------------------------------- -ToolSvc.Sequenc... INFO This machine has a speed about 3.70 times the speed of a 2.8 GHz Xeon. -ToolSvc.Sequenc... INFO Algorithm (millisec) | <user> | <clock> | min max sigma | entries | total (s) | -ToolSvc.Sequenc... INFO -------------------------------------------------------------------------------------------------- -ToolSvc.Sequenc... INFO ANDSequence | 0.000 | 0.011 | 0.010 0.0 0.00 | 10 | 0.000 | -ToolSvc.Sequenc... INFO AND | 0.000 | 0.005 | 0.005 0.0 0.00 | 10 | 0.000 | -ToolSvc.Sequenc... INFO ANDCounter | 0.000 | 0.004 | 0.004 0.0 0.00 | 10 | 0.000 | -ToolSvc.Sequenc... INFO ORSequence | 0.000 | 0.006 | 0.006 0.0 0.00 | 10 | 0.000 | -ToolSvc.Sequenc... INFO OR | 0.000 | 0.005 | 0.005 0.0 0.00 | 10 | 0.000 | -ToolSvc.Sequenc... INFO ORCounter | 0.000 | 0.000 | 0.000 0.0 0.00 | 0 | 0.000 | -ToolSvc.Sequenc... INFO -------------------------------------------------------------------------------------------------- -TIMER.TIMER INFO -------------------------------------------------------------------------------------------------- -TIMER.TIMER INFO This machine has a speed about 3.03 times the speed of a 2.8 GHz Xeon. -TIMER.TIMER INFO Algorithm (millisec) | <user> | <clock> | min max sigma | entries | total (s) | -TIMER.TIMER INFO -------------------------------------------------------------------------------------------------- -TIMER.TIMER INFO EVENT LOOP | 0.000 | 0.069 | 0.049 0.2 0.03 | 10 | 0.001 | -TIMER.TIMER INFO ParentAlg | 0.000 | 0.008 | 0.007 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO SubAlg1 | 0.000 | 0.000 | 0.000 0.0 0.00 | 0 | 0.000 | -TIMER.TIMER INFO SubAlg2 | 0.000 | 0.000 | 0.000 0.0 0.00 | 0 | 0.000 | -TIMER.TIMER INFO StopperAlg | 0.000 | 0.001 | 0.001 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO TopSequence | 0.000 | 0.018 | 0.011 0.0 0.01 | 10 | 0.000 | -TIMER.TIMER INFO Sequence1 | 0.000 | 0.009 | 0.004 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO Prescaler1 | 0.000 | 0.001 | 0.001 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO HelloWorld | 0.000 | 0.004 | 0.004 0.0 0.00 | 5 | 0.000 | -TIMER.TIMER INFO Counter1 | 0.000 | 0.003 | 0.002 0.0 0.00 | 5 | 0.000 | -TIMER.TIMER INFO Sequence2 | 0.000 | 0.004 | 0.004 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO Prescaler2 | 0.000 | 0.001 | 0.001 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO Counter2 | 0.000 | 0.006 | 0.006 0.0 0.00 | 1 | 0.000 | -TIMER.TIMER INFO ANDSequence | 0.000 | 0.013 | 0.012 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO AND | 0.000 | 0.004 | 0.004 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO ANDCounter | 0.000 | 0.003 | 0.003 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO ORSequence | 0.000 | 0.007 | 0.007 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO OR | 0.000 | 0.004 | 0.004 0.0 0.00 | 10 | 0.000 | -TIMER.TIMER INFO ORCounter | 0.000 | 0.000 | 0.000 0.0 0.00 | 0 | 0.000 | -TIMER.TIMER INFO -------------------------------------------------------------------------------------------------- -TIMER.TIMER SUCCESS Booked 3 Histogram(s) : 1D=3 -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) -*****Chrono***** INFO **************************************************************************************************** -OR:Start INFO Time User : Tot= 0 [us] #= 1 -Prescaler1:Stop INFO Time User : Tot= 0 [us] #= 1 -Counter1:Stop INFO Time User : Tot= 0 [us] #= 1 -Counter2:Start INFO Time User : Tot= 0 [us] #= 1 -Counter2:Stop INFO Time User : Tot= 0 [us] #= 1 -ParentAlg:Stop INFO Time User : Tot= 0 [us] #= 1 -Sequence2:Finalize INFO Time User : Tot= 0 [us] #= 1 -ANDSequence:Stop INFO Time User : Tot= 0 [us] #= 1 -ANDSequence:Start INFO Time User : Tot= 0 [us] #= 1 -HelloWorld:Start INFO Time User : Tot= 0 [us] #= 1 -StopperAlg:Start INFO Time User : Tot= 0 [us] #= 1 -StopperAlg:Stop INFO Time User : Tot= 0 [us] #= 1 -ORCounter:Stop INFO Time User : Tot= 0 [us] #= 1 -SubAlg2:Start INFO Time User : Tot= 0 [us] #= 1 -AND:Stop INFO Time User : Tot= 0 [us] #= 1 -ORSequence:Start INFO Time User : Tot= 0 [us] #= 1 -ParentAlg:Start INFO Time User : Tot= 0 [us] #= 1 -ORSequence:Fina... INFO Time User : Tot= 0 [us] #= 1 -ORCounter:Start INFO Time User : Tot= 0 [us] #= 1 -Prescaler1:Start INFO Time User : Tot= 0 [us] #= 1 -OR:Stop INFO Time User : Tot= 0 [us] #= 1 -Sequence1:Finalize INFO Time User : Tot= 0 [us] #= 1 -Prescaler2:Fina... INFO Time User : Tot= 0 [us] #= 1 -Prescaler2:Start INFO Time User : Tot= 0 [us] #= 1 -Prescaler2:Stop INFO Time User : Tot= 0 [us] #= 1 -ORSequence:Stop INFO Time User : Tot= 0 [us] #= 1 -Sequence1:Stop INFO Time User : Tot= 0 [us] #= 1 -Sequence2:Stop INFO Time User : Tot= 0 [us] #= 1 -StopperAlg:Fina... INFO Time User : Tot= 0 [us] #= 1 -StopperAlg:Init... INFO Time User : Tot= 0 [us] #= 1 -SubAlg1:Start INFO Time User : Tot= 0 [us] #= 1 -SubAlg1:Stop INFO Time User : Tot= 0 [us] #= 1 -SubAlg2:Stop INFO Time User : Tot= 0 [us] #= 1 -TopSequence:Fin... INFO Time User : Tot= 0 [us] #= 1 -TopSequence:Stop INFO Time User : Tot= 0 [us] #= 1 -AND:Start INFO Time User : Tot= 0 [us] #= 1 -ANDCounter:Start INFO Time User : Tot= 0 [us] #= 1 -HelloWorld:Stop INFO Time User : Tot= 0 [us] #= 1 -ANDCounter:Stop INFO Time User : Tot= 0 [us] #= 1 -Counter1:Start INFO Time User : Tot= 0 [us] #= 1 -ORCounter:Finalize INFO Time User : Tot= 0 [us] #= 1 -ANDCounter:Fina... INFO Time User : Tot= 0 [us] #= 1 -SubAlg2:Finalize INFO Time User : Tot= 0 [us] #= 1 -ParentAlg:Finalize INFO Time User : Tot= 0 [us] #= 1 -AND:Finalize INFO Time User : Tot= 0 [us] #= 1 -Sequence2:Start INFO Time User : Tot= 0 [us] #= 1 -Counter1:Finalize INFO Time User : Tot= 0 [us] #= 1 -Prescaler2:Init... INFO Time User : Tot= 0 [us] #= 1 -Counter2:Execute INFO Time User : Tot= 0 [us] #= 1 -Sequence1:Start INFO Time User : Tot= 0 [us] #= 1 -OR:Finalize INFO Time User : Tot= 0 [us] #= 1 -HelloWorld:Fina... INFO Time User : Tot= 0 [us] #= 1 -ANDCounter:Init... INFO Time User : Tot= 0 [us] #= 1 -Counter2:Finalize INFO Time User : Tot= 0 [us] #= 1 -SubAlg2:Initialize INFO Time User : Tot= 0 [us] #= 1 -ORCounter:Initi... INFO Time User : Tot= 0 [us] #= 1 -ANDSequence:Fin... INFO Time User : Tot= 0 [us] #= 1 -SubAlg1:Initialize INFO Time User : Tot= 0 [us] #= 1 -Counter2:Initia... INFO Time User : Tot= 0 [us] #= 1 -AND:Initialize INFO Time User : Tot= 0 [us] #= 1 -OR:Initialize INFO Time User : Tot= 0 [us] #= 1 -TopSequence:Start INFO Time User : Tot= 0 [us] #= 1 -Counter1:Initia... INFO Time User : Tot= 0 [us] #= 1 -SubAlg1:Finalize INFO Time User : Tot= 0 [us] #= 1 -Prescaler1:Init... INFO Time User : Tot= 0 [us] #= 1 -Prescaler1:Fina... INFO Time User : Tot= 0 [us] #= 1 -HelloWorld:Init... INFO Time User : Tot= 0 [us] #= 1 -ParentAlg:Initi... INFO Time User : Tot= 0 [us] #= 1 -ORSequence:Init... INFO Time User : Tot= 0 [us] #= 1 -Sequence2:Initi... INFO Time User : Tot= 0 [us] #= 1 -Sequence1:Initi... INFO Time User : Tot= 0 [us] #= 1 -TopSequence:Ini... INFO Time User : Tot= 0 [us] #= 1 -Counter1:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 5 -HelloWorld:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 5 -StopperAlg:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -Prescaler2:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -Prescaler1:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -ANDCounter:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -OR:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -AND:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -Sequence2:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -ORSequence:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -ParentAlg:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -Sequence1:Execute INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -ANDSequence:Exe... INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -TopSequence:Exe... INFO Time User : Tot= 0 [us] Ave/Min/Max= 0(+- 0)/ 0/ 0 [us] #= 10 -ANDSequence:Ini... INFO Time User : Tot= 270 [ms] #= 1 -ChronoStatSvc INFO Time User : Tot= 340 [ms] #= 1 -*****Chrono***** INFO **************************************************************************************************** -ChronoStatSvc.f... INFO Service finalized successfully -ApplicationMgr INFO Application Manager Finalized successfully -ApplicationMgr INFO Application Manager Terminated successfully diff --git a/GaudiAlg/tests/qmtest/scripts/Aida2RootEx.py b/GaudiAlg/tests/qmtest/scripts/Aida2RootEx.py deleted file mode 100755 index 4a60ad9cae0..00000000000 --- a/GaudiAlg/tests/qmtest/scripts/Aida2RootEx.py +++ /dev/null @@ -1,206 +0,0 @@ -#!/usr/bin/env python3 -##################################################################################### -# (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations # -# # -# This software is distributed under the terms of the Apache version 2 licence, # -# copied verbatim in the file "LICENSE". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -##################################################################################### -# ============================================================================= -# @file -# Simple algorithm to illustrate the usage of aida2root converter -# @see Gaudi::Aida2ROOT -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2007-01-24 -# ============================================================================= -" Simple example to illustrate the usage of aida2root converter " - -# ============================================================================= -__author__ = "Vanya BELYAEV ibelyaev@phys.syr.edu" -# ============================================================================= -import os -import sys - -import ROOT - -if "-b" in sys.argv: - # Force batch mode - ROOT.gROOT.SetBatch(True) - -from GaudiAlg.Algs import SUCCESS, HistoAlgo, aida2root - -# list of booked histograms -paths = ( - "HistoEx/ 1D histo ", - "HistoEx/ 2D histo ", - "HistoEx/ 3D histo ", - "HistoEx1/ 1D histo ", - "HistoEx1/ 2D histo ", - "HistoEx1/ 3D histo ", - "HistoEx2/ x vs y ", - "HistoEx2/ x vs y+3x ", - "HistoEx2/ x vs y-3x ", - "HistoEx2/ x vs y (profile)", - "HistoEx2/ x vs y+3x (profile)", - "HistoEx2/ x vs y-3x (profile)", -) - -# ============================================================================= -# @class Aida2RootEx1 -# Simple algorithm which used aida2root utility -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2007-01-24 - - -class Aida2RootEx1(HistoAlgo): - # Standard Constructor - def __init__(self, name="Aida2RootEx1"): - """Standard Constructor""" - HistoAlgo.__init__(self, name) - - # the main execution method - def execute(self): - "The main execution method" - - # list of booked histograms - for path in paths: - self.Print("AIDA object: '%s'" % path) - # get AIDA pointer - aida = self.histoSvc(path) - if not aida: - return self.Error("Invalid AIDA at '%s'" % path) - # explicitly convert to ROOT - root = aida2root(aida) - if not root: - return self.Error("Invalid conversion to ROOT '%s'" % path) - # use the native ROOT printout - root.Print() - - return SUCCESS - - -# ============================================================================= - -# ============================================================================= -# @class Aida2RootEx2 -# Simple algorithm which uses aida2root utility -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2007-01-24 - - -class Aida2RootEx2(HistoAlgo): - # Standard Constructor - def __init__(self, name="Aida2RootEx2"): - """Standard Constructor""" - HistoAlgo.__init__(self, name) - - # the main execution method - def execute(self): - "The main execution method" - - # get the service itself - s = self.histoSvc() - - for path in paths: - self.Print("AIDA object: '%s'" % path) - root = s.getAsROOT(path) - if not root: - return self.Error("Invalid conversion to ROOT '%s'" % path) - # use the native ROOT printout - root.Print() - - return SUCCESS - - -# ============================================================================= - - -# ============================================================================= -# The main configuration method -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2007-01-24 -def configure(gaudi=None): - """the main configuration method""" - - if not gaudi: - from GaudiPython.Bindings import AppMgr - - gaudi = AppMgr() - - # reuse the previous example - import HistoEx2 - - HistoEx2.configure(gaudi) - - hsvc = gaudi.service("HistogramPersistencySvc") - hsvc.OutputFile = "aida2rootex.root" - - # create the algorithms - alg1 = Aida2RootEx1() - alg2 = Aida2RootEx2() - # append them to the list of Top-Level algorithms - gaudi.addAlgorithm(alg1) - gaudi.addAlgorithm(alg2) - - return SUCCESS - - -# ============================================================================= -# The third way to convert AIDA histograms into ROOT -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2007-01-24 -def useScript(histos): - "the third way to convert AIDA histograms into ROOT" - - from GaudiPython.Bindings import AppMgr - - g = AppMgr() - - hsvc = g.histsvc() - - i = 0 - for histo in histos: - root = hsvc.getAsROOT(histo) - if not root: - print("ERROR in access the histogram '%s' " % histo) - continue - canvas = ROOT.TCanvas("canvas_%d" % i, histo, 250, 250) - root.Draw() - name = histo.replace("/", "_") - name = name.replace("\\", "_") - name = name.replace('"', "_") - name = name.replace("'", "_") - name = name.replace("'", "_") - name = name.replace(" ", "_") - name = name.replace(os.sep, "_") + ".png" - if os.path.exists(name): - # strictly speaking, it is not needed, but avoids a message on the stderr - os.remove(name) - canvas.Print(name) - print("The file name is '%s'" % name) - i += 1 - - -# ============================================================================= - -# ============================================================================= -# The actual job execution -# ============================================================================= -if "__main__" == __name__: - print(__doc__, __author__) - - from GaudiPython.Bindings import AppMgr - - gaudi = AppMgr() - configure(gaudi) - gaudi.run(5) - - # use the scripts - useScript(paths) - -# ============================================================================= -# The END -# ============================================================================= diff --git a/GaudiAlg/tests/qmtest/scripts/Counter.py b/GaudiAlg/tests/qmtest/scripts/Counter.py deleted file mode 100755 index 11910499951..00000000000 --- a/GaudiAlg/tests/qmtest/scripts/Counter.py +++ /dev/null @@ -1,133 +0,0 @@ -#!/usr/bin/env python3 -##################################################################################### -# (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations # -# # -# This software is distributed under the terms of the Apache version 2 licence, # -# copied verbatim in the file "LICENSE". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -##################################################################################### -# ============================================================================= -""" -******************************************************************************* -* * -* Simple example which illustrates the usage of the useful base class * -* GaudiAlgo (python version of C++ GaudiAlgorithm) for "easy" manipulations * -* with 'counters' * -* * -* The example is equivalent to C++ example 'CounterEx', see * -* GaudiExamples/src/CounterEx/*.cpp and * -* GaudiExamples/options/CounterEx.opts * -* * -******************************************************************************* -""" - -# ============================================================================= -__author__ = "Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr" -# ============================================================================= - -from GaudiAlg.Algs import GaudiAlgo - -import GaudiPython - -Rndm = GaudiPython.gbl.Rndm -Numbers = Rndm.Numbers -SUCCESS = GaudiPython.SUCCESS - -Numbers.__call__ = Numbers.shoot - -# ============================================================================= -# Simple algorithm which manipulates with counters -# ============================================================================= - - -class Counter(GaudiAlgo): - """Simple algorithm which manipulates with counters""" - - def __init__(self, name="Counter"): - """Constructor""" - GaudiAlgo.__init__(self, name) - - def execute(self): - """The major method 'execute', it is invoked for each event""" - - executed = self.counter("executed") - executed += 1.0 - - gauss = Numbers(self.randSvc(), Rndm.Gauss(0.0, 1.0)) - poisson = Numbers(self.randSvc(), Rndm.Poisson(5.0)) - - # 'accuulate gauss' - value = gauss.shoot() - - g1 = self.counter("gauss") - g2 = self.counter("g2") - - g1 += value - g2 += value * value - - if 0 < value: - gp = self.counter("Gpos") - gp += 1.0 - else: - gn = self.counter("Gneg") - gn += 1.0 - - stat1 = self.counter("NG") - stat2 = self.counter("G") - for i in range(0, int(poisson())): - stat1 += 1.0 - stat2 += gauss() - - stat3 = self.counter("eff") - stat3 += value > 0 - - # print statistics every 1000 events - executed = self.counter("executed") - prnt = int(executed.flag()) - if 0 == prnt % 1000: - print(" Event number %s " % prnt, flush=True) - bc = self.counter("eff") - line = "(%.12g += %.12g)%s" % (bc.eff() * 100, bc.effErr() * 100, - "%") - print( - ' Efficiency (binomial counter "eff"): %s' % line, flush=True) - - return SUCCESS - - -# ============================================================================= -# job configuration -# ============================================================================= -def configure(gaudi=None): - """Configuration of the job""" - - if not gaudi: - gaudi = GaudiPython.AppMgr() - - gaudi.JobOptionsType = "NONE" - gaudi.EvtSel = "NONE" - - gaudi.config() - - alg = Counter() - gaudi.setAlgorithms([alg]) - gaudi.ExtSvc += ["Gaudi::Monitoring::MessageSvcSink"] - - return SUCCESS - - -# ============================================================================= -# The actual job excution -# ============================================================================= -if "__main__" == __name__: - print(__doc__ + __author__) - gaudi = GaudiPython.AppMgr() - configure(gaudi) - gaudi.run(5400) - -# ============================================================================= -# The END -# ============================================================================= diff --git a/GaudiAlg/tests/qmtest/scripts/EvtColWrite.py b/GaudiAlg/tests/qmtest/scripts/EvtColWrite.py deleted file mode 100755 index 235bc6f4c86..00000000000 --- a/GaudiAlg/tests/qmtest/scripts/EvtColWrite.py +++ /dev/null @@ -1,151 +0,0 @@ -#!/usr/bin/env python3 -##################################################################################### -# (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations # -# # -# This software is distributed under the terms of the Apache version 2 licence, # -# copied verbatim in the file "LICENSE". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -##################################################################################### -# ============================================================================= -""" -******************************************************************************* -* * -* Simple example which illustrate the usage of useful * -* algorithm base class for writing of EventTag Collections * -* * -******************************************************************************* -""" -# ============================================================================= -__author__ = "Vanya BELYAEV ibelyaev@physics.syr.edu" -# ============================================================================= - -import GaudiPython - -Rndm = GaudiPython.gbl.Rndm -Numbers = Rndm.Numbers -SUCCESS = GaudiPython.SUCCESS - -from GaudiAlg.Algs import TupleAlgo - -# ============================================================================= -# Simple algorithm which book&fill 3 histograms -# ============================================================================= - - -class EvtColEx(TupleAlgo): - """Simple algorithm which implicitely book&Fill Event Tag collection""" - - def __init__(self, name="EvtColEx"): - """Constructor""" - TupleAlgo.__init__(self, name) - self.s_nEvt = 0 - self.s_nRun = 0 - - def execute(self): - """The major method 'execute', it is invoked for each event""" - - self.s_nEvt += 1 - if 1 == self.s_nEvt % 50: - self.s_nRun += 1 - - rSvc = self.randSvc() - - gauss = Numbers(rSvc, Rndm.Gauss(0.0, 1.0)) - flat = Numbers(rSvc, Rndm.Flat(-10, 10)) - expo = Numbers(rSvc, Rndm.Exponential(1.0)) - poisson = Numbers(rSvc, Rndm.Poisson(2.0)) - binom = Numbers(rSvc, Rndm.Binomial(8, 0.25)) - - address = self.get("/Event") - address = address.registry().address() - - # get the event tag collection itself - tup = self.evtCol("COL1", "My trivial N-tuple") - - tup.column("Address", address) - - tup.column("evtNum", self.s_nEvt) - tup.column("runNum", self.s_nRun) - - tup.column("gauss", gauss()) - tup.column("flat", flat()) - tup.column("expo", expo()) - tup.column("poisson", int(poisson())) - tup.column("binom", int(binom())) - tup.column("flag", 0 > gauss()) - - return SUCCESS - - -def _evtcolsvc_(self, name="EvtTupleSvc"): - svc = GaudiPython.Helper.service(self._svcloc, name, False) - return GaudiPython.iNTupleSvc(name, svc) - - -GaudiPython.AppMgr.evtcolsvc = _evtcolsvc_ - -# ============================================================================= -# job configuration -# ============================================================================= - - -def configure(gaudi=None): - """Configuration of the job""" - - if not gaudi: - gaudi = GaudiPython.AppMgr() - - gaudi.HistogramPersistency = "ROOT" - gaudi.DLLs += ["GaudiAlg", "RootHistCnv"] - gaudi.ExtSvc += ["RndmGenSvc", "NTupleSvc", "TagCollectionSvc/EvtTupleSvc"] - - alg = EvtColEx("Fill") - gaudi.setAlgorithms([alg]) - - alg.EvtColLUN = "EVTTAGS" - alg.EvtColsProduce = True - alg.EvtColsPrint = True - alg.NTupleProduce = False - alg.HistoProduce = False - - gaudi.OutStream = ["EvtCollectionStream/TagsWriter"] - tagsWriter = gaudi.algorithm("TagsWriter") - tagsWriter.ItemList = ["/NTUPLES/EVTTAGS/Fill/COL1"] - tagsWriter.EvtDataSvc = "EvtTupleSvc" - - evtColSvc = gaudi.evtcolsvc() - evtColSvc.defineOutput({ - "EVTTAGS": "PFN:EvtTags1.root" - }, - typ="Gaudi::RootCnvSvc") - evtColSvc.OutputLevel = 2 - - evtSel = gaudi.evtSel() - evtSel.PrintFreq = 1000 - evtSel.open(["EvtColsEx.dst"]) - - return SUCCESS - - -# ============================================================================= -# The actual job excution -# ============================================================================= -if "__main__" == __name__: - print(__doc__) - # configuration (options) - from Configurables import ApplicationMgr, FileCatalog, GaudiPersistency - - GaudiPersistency() - ApplicationMgr().ExtSvc.append( - FileCatalog(Catalogs=["xmlcatalog_file:EvtColsEx.xml"])) - # execution - gaudi = GaudiPython.AppMgr() - configure(gaudi) - gaudi.run(10000) - gaudi.exit() -# ============================================================================= -# The END -# ============================================================================= diff --git a/GaudiAlg/tests/qmtest/scripts/HistoEx.py b/GaudiAlg/tests/qmtest/scripts/HistoEx.py deleted file mode 100755 index 7d4c7a3059f..00000000000 --- a/GaudiAlg/tests/qmtest/scripts/HistoEx.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python3 -##################################################################################### -# (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations # -# # -# This software is distributed under the terms of the Apache version 2 licence, # -# copied verbatim in the file "LICENSE". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -##################################################################################### -# ============================================================================= -""" -******************************************************************************* -* * -* Simple example which illustrate the usage of useful algorithm base class * -* HistoAlgo (python version of C++ GaudiHistoAlg) for "easy" histogramming. * -* * -******************************************************************************* -""" -# ============================================================================= -__author__ = "Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr" -# ============================================================================= - -from GaudiAlg.Algs import SUCCESS, HistoAlgo - -# ============================================================================= -# Simple algorithm which book&fill 3 histograms -# ============================================================================= - - -class HistoEx(HistoAlgo): - """Simple algorithm which implicitely book&fill three histograms""" - - def __init__(self, name): - """Constructor""" - HistoAlgo.__init__(self, name) - - def execute(self): - """The major method 'execute', it is invoked for each event""" - for i in range(0, 10): - self.plot1D(i, " 1D histo ", 0, 20, 20) - for j in range(0, 10): - self.plot2D(i, j, " 2D histo ", 0, 20, 0, 20, 20, 20) - for k in range(0, 10): - self.plot3D(i, j, k, " 3D histo ", 0, 20, 0, 20, 0, 20, 20, - 20, 20) - - return SUCCESS - - -# ============================================================================= -# job configuration -# ============================================================================= -def configure(gaudi=None): - """Configuration of the job""" - - if not gaudi: - from GaudiPython.Bindings import AppMgr - - gaudi = AppMgr() - - gaudi.JobOptionsType = "NONE" - gaudi.EvtSel = "NONE" - gaudi.HistogramPersistency = "ROOT" - - gaudi.config() - - gaudi.DLLs = [ - "GaudiAlg", - "RootHistCnv", - ] - - alg = HistoEx("HistoEx") - gaudi.setAlgorithms([alg]) - alg.HistoPrint = True - - hsvc = gaudi.service("HistogramPersistencySvc") - hsvc.OutputFile = "histoex.root" - - # This does not harm and tests bug #50389 - _ = gaudi.algorithm("HistoEx") - - return SUCCESS - - -# ============================================================================= -# The actual job excution -# ============================================================================= -if "__main__" == __name__: - print(__doc__ + __author__) - - from GaudiPython.Bindings import AppMgr - - gaudi = AppMgr() - configure(gaudi) - gaudi.run(20) - - import GaudiPython.HistoUtils # noqa: F401 (adds dump method) - - alg = gaudi.algorithm("HistoEx") - histos = alg.Histos() - for key in sorted(histos): - histo = histos[key] - if hasattr(histo, "dump"): - print(histo.dump(80, 20, True)) - -# ============================================================================= -# The END -# ============================================================================= diff --git a/GaudiAlg/tests/qmtest/scripts/HistoEx1.py b/GaudiAlg/tests/qmtest/scripts/HistoEx1.py deleted file mode 100755 index d87e8c3a76b..00000000000 --- a/GaudiAlg/tests/qmtest/scripts/HistoEx1.py +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env python3 -##################################################################################### -# (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations # -# # -# This software is distributed under the terms of the Apache version 2 licence, # -# copied verbatim in the file "LICENSE". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -##################################################################################### -# ============================================================================= -""" -******************************************************************************* -* * -* Simple example which illustrate the usage of useful algorithm base class * -* HistoAlgo (python version of C++ GaudiHistoAlg) for "easy" histogramming. * -* It is an extension of HistoEx module, it provides similar algorithm, but * -* with explicit histogram manipulation trhrough explicit book and fill * -* * -******************************************************************************* -""" -# ============================================================================= -__author__ = "Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr" -# ============================================================================= - -from GaudiAlg.Algs import SUCCESS, HistoAlgo - -# ============================================================================= -# Simple algorithm which book&fill 3 histograms -# ============================================================================= - - -class HistoEx1(HistoAlgo): - """Simple algorithm which explicitely book&fill three histograms""" - - def __init__(self, name): - """Constructor""" - HistoAlgo.__init__(self, name) - - def initialize(self): - """Initialization, initialize the base class and book histograms""" - status = HistoAlgo.initialize(self) - if status.isFailure(): - return status - - self.h1 = self.book1D(" 1D histo ", 0, 20, 20) - self.h2 = self.book2D(" 2D histo ", 0, 20, 20, 0, 20, 20) - self.h3 = self.book3D(" 3D histo ", 0, 20, 20, 0, 20, 20, 0, 20, 20) - - return SUCCESS - - def execute(self): - """The major method 'execute', it is invoked for each event""" - - for i in range(0, 10): - self.h1.fill(i, 0.166) - for j in range(0, 10): - self.h2.fill(i, j) - for k in range(0, 10): - self.h3.fill(i, j, k) - - return SUCCESS - - -# ============================================================================= -# job configuration -# ============================================================================= -def configure(gaudi=None): - """Configuration of the job""" - - import HistoEx - - if not gaudi: - from GaudiPython.Bindings import AppMgr - - gaudi = AppMgr() - - HistoEx.configure(gaudi) - - hsvc = gaudi.service("HistogramPersistencySvc") - hsvc.OutputFile = "histoex1.root" - - alg = HistoEx1("HistoEx1") - gaudi.addAlgorithm(alg) - - alg.HistoPrint = True - - return SUCCESS - - -# ============================================================================= -# The actual job excution -# ============================================================================= -if "__main__" == __name__: - print(__doc__ + __author__) - - from GaudiPython.Bindings import AppMgr - - gaudi = AppMgr() - - configure(gaudi) - - gaudi.run(20) - import GaudiPython.HistoUtils # noqa: F401 (adds dump method) - - alg = gaudi.algorithm("HistoEx1") - histos = alg.Histos() - for key in sorted(histos): - histo = histos[key] - if hasattr(histo, "dump"): - print(histo.dump(80, 20, True)) - -# ============================================================================= diff --git a/GaudiAlg/tests/qmtest/scripts/HistoEx2.py b/GaudiAlg/tests/qmtest/scripts/HistoEx2.py deleted file mode 100755 index f8653df177d..00000000000 --- a/GaudiAlg/tests/qmtest/scripts/HistoEx2.py +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env python3 -##################################################################################### -# (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations # -# # -# This software is distributed under the terms of the Apache version 2 licence, # -# copied verbatim in the file "LICENSE". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -##################################################################################### -# ============================================================================= -""" -******************************************************************************* -* * -* Simple example which illustrate the usage of useful algorithm base class * -* HistoAlgo (python version of C++ GaudiHistoAlg) for 'easy' histogramming. * -* * -* This example illustrates the usage of 1D and 2D profile histograms * -* * -******************************************************************************* -""" -# ============================================================================= -__author__ = "Vanya BELYAEV ibelyaev@physics.syr.edu" -# ============================================================================= - -from GaudiAlg.Algs import SUCCESS, HistoAlgo -from GaudiPython.Bindings import gbl as cpp - -Rndm = cpp.Rndm - -# ============================================================================= -# Simple algorithm which book&fill two profile histograms -# ============================================================================= - - -class HistoEx2(HistoAlgo): - """Simple algorithm which explicitly book&fill profile histograms""" - - def __init__(self, name="HistoEx2"): - """Constructor""" - HistoAlgo.__init__(self, name) - - def execute(self): - """The major method 'execute', it is invoked for each event""" - gauss = Rndm.Numbers(self.randSvc(), Rndm.Gauss(0, 1)) - - for i in range(0, 1000): - x = gauss() - y = gauss() - self.plot2D(x, y, " x vs y ", -2, 2, -4, 4) - self.plot2D(x, y + 3 * x, " x vs y+3x ", -2, 2, -4, 4) - self.plot2D(x, y - 3 * x, " x vs y-3x ", -2, 2, -4, 4) - self.profile1D(x, y, " x vs y (profile)", -2, 2) - self.profile1D(x, y + 3 * x, " x vs y+3x (profile)", -2, 2) - self.profile1D(x, y - 3 * x, " x vs y-3x (profile)", -2, 2) - return SUCCESS - - -# ============================================================================= -# job configuration -# ============================================================================= -def configure(gaudi=None): - """Configuration of the job""" - - import HistoEx1 - - if not gaudi: - from GaudiPython.Bindings import AppMgr - - gaudi = AppMgr() - - HistoEx1.configure(gaudi) - - hsvc = gaudi.service("HistogramPersistencySvc") - hsvc.OutputFile = "histoex2.root" - - alg = HistoEx2("HistoEx2") - gaudi.addAlgorithm(alg) - - alg.HistoPrint = True - - return SUCCESS - - -# ============================================================================= -# The actual job execution -# ============================================================================= -if "__main__" == __name__: - print(__doc__ + __author__) - - import GaudiPython.HistoUtils # noqa: F401 (adds dump method) - from GaudiPython.Bindings import AppMgr - - gaudi = AppMgr() - configure(gaudi) - - gaudi.run(20) - - # Skip the next part when running within QMTest - for alg in ("HistoEx", "HistoEx1", "HistoEx2"): - alg = gaudi.algorithm(alg) - histos = alg.Histos() - for key in sorted(histos): - histo = histos[key] - print(" Alg='%s', ID='%s' , Histo=%s " % (alg.name(), key, histo)) - if hasattr(histo, "dump"): - print(histo.dump(60, 20, True)) diff --git a/GaudiAlg/tests/qmtest/scripts/Mix.py b/GaudiAlg/tests/qmtest/scripts/Mix.py deleted file mode 100755 index b1728299cd4..00000000000 --- a/GaudiAlg/tests/qmtest/scripts/Mix.py +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/env python3 -##################################################################################### -# (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations # -# # -# This software is distributed under the terms of the Apache version 2 licence, # -# copied verbatim in the file "LICENSE". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -##################################################################################### -# ============================================================================= -# @file Mix.py -# Simple example to illustrate the problem for task #13911 -# @author Vanya BELYAEV Ivan.Belyaev@itep.ru -# @date 2010-04-24 -# ============================================================================= -""" -Simple example to illustrate the problem for task #13911 -https://savannah.cern.ch/task/?13911 -""" -# ============================================================================= -__author__ = "Vanya BELYAEV Ivan.Belyaev@itep.ru" -__date__ = "2010-04-24" -# ============================================================================= -import sys - -from Configurables import AuditorSvc, GaudiSequencer, HelloWorld -from Gaudi.Configuration import ApplicationMgr -from GaudiAlg.Algs import SUCCESS, GaudiAlgo -from GaudiPython.Bindings import AppMgr - -# ============================================================================= -# @class SimpleAlgo -# very simple (empty) python algorith -# @author Vanya BELYAEV Ivan.Belyaev@itep.ru -# @date 2010-04-24 - - -class SimpleAlgo(GaudiAlgo): - def execute(self): - print("I am SimpleAlgo.execute! ", self.name()) - sys.stdout.flush() - - return SUCCESS - - -# ============================================================================= -# configure the application : - - -def configure(): - AuditorSvc(Auditors=["ChronoAuditor"]) - - ApplicationMgr( - TopAlg=[ - HelloWorld(), - GaudiSequencer( - "MySequencer", - MeasureTime=True, - Members=[HelloWorld("Hello1"), - HelloWorld("Hello2")], - ), - ], - # do not use any event input - EvtSel="NONE", - ) - - gaudi = AppMgr() - - # create two "identical" algorithms: - - myAlg1 = SimpleAlgo("Simple1") - myAlg2 = SimpleAlgo("Simple2") - - # Adding something into TopAlg-sequence is OK: - gaudi.setAlgorithms([myAlg1] + gaudi.TopAlg) - - # Extending of "other"-sequences causes failures: - seq = gaudi.algorithm("MySequencer") - - seq.Members += ["HelloWorld/Hello3"] # it is ok - seq.Members += [myAlg2.name()] # it fails - - -if "__main__" == __name__: - # make printout of the own documentations - print("*" * 120) - print(__doc__) - print(" Author : %s " % __author__) - print(" Date : %s " % __date__) - print("*" * 120) - sys.stdout.flush() - - configure() - - gaudi = AppMgr() - - gaudi.run(4) - - # add 'late' algorithms - - myAlg3 = SimpleAlgo("Simple3") - - seq = gaudi.algorithm("MySequencer") - seq.Members += ["HelloWorld/Hello4"] - - gaudi.run(8) - - seq.Members += [myAlg3.name()] - - gaudi.run(3) diff --git a/GaudiAlg/tests/qmtest/scripts/TupleEx.py b/GaudiAlg/tests/qmtest/scripts/TupleEx.py deleted file mode 100755 index c1b644104fe..00000000000 --- a/GaudiAlg/tests/qmtest/scripts/TupleEx.py +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env python3 -##################################################################################### -# (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations # -# # -# This software is distributed under the terms of the Apache version 2 licence, # -# copied verbatim in the file "LICENSE". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -##################################################################################### -# ============================================================================= -# @file -# -# Simple example which illustrate the usage of useful -# algorithm base class for N-Tuple manipulations -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 -# ============================================================================= -""" -******************************************************************************* -* * -* Simple example which illustrate the usage of useful * -* algorithm base class for N-Tuple manipulations * -* * -******************************************************************************* -""" - -# ============================================================================= -__author__ = "Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr" -# ============================================================================= - -import math - -from GaudiPython.Bindings import gbl as cpp - -Rndm = cpp.Rndm - -from GaudiAlg.Algs import SUCCESS, TupleAlgo - -# ============================================================================= -# @class TupleEx -# Simple algorithm which books&fills three histograms -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 - - -class TupleEx(TupleAlgo): - """ - Simple algorithm which implicitely book&fill N-Tuples - """ - - # standard constructor - - def __init__(self, name="TupleEx", **args): - """Constructor""" - TupleAlgo.__init__(self, name, **args) - - # the main execution method - def execute(self): - """ - The major method 'execute', it is invoked for each event - """ - - gauss = Rndm.Numbers(self.randSvc(), Rndm.Gauss(0.0, 1.0)) - - tup = self.nTuple("My trivial N-tuple") - for i in range(0, 100): - tup.column("a", math.sin(i)) - tup.column("b", math.cos(i)) - tup.column("c", math.tan(i)) - tup.column("g", gauss()) - tup.write() - - return SUCCESS - - -# ============================================================================= -# job configuration -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 -def configure(gaudi=None): - """Configuration of the job""" - - if not gaudi: - from GaudiPython.Bindings import AppMgr - - gaudi = AppMgr() - - gaudi.JobOptionsType = "NONE" - gaudi.EvtSel = "NONE" - gaudi.HistogramPersistency = "ROOT" - - gaudi.ExtSvc += ["NTupleSvc"] - - ntSvc = gaudi.service("NTupleSvc") - ntSvc.Output = ["MYLUN DATAFILE='TupleEx_py.root' OPT='NEW' TYP='ROOT'"] - - gaudi.config() - - gaudi.DLLs = [ - "GaudiAlg", - "RootHistCnv", - ] - - alg = TupleEx( - # configure the property - NTupleLUN="MYLUN") - - gaudi.setAlgorithms([alg]) - - return SUCCESS - - -# ============================================================================= -# The actual job excution -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 -if "__main__" == __name__: - print(__doc__) - from GaudiPython.Bindings import AppMgr - - gaudi = AppMgr() - configure(gaudi) - gaudi.run(20) - -# ============================================================================= -# The END -# ============================================================================= diff --git a/GaudiAlg/tests/qmtest/scripts/TupleEx1.py b/GaudiAlg/tests/qmtest/scripts/TupleEx1.py deleted file mode 100755 index b571ba648a7..00000000000 --- a/GaudiAlg/tests/qmtest/scripts/TupleEx1.py +++ /dev/null @@ -1,213 +0,0 @@ -#!/usr/bin/env python3 -##################################################################################### -# (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations # -# # -# This software is distributed under the terms of the Apache version 2 licence, # -# copied verbatim in the file "LICENSE". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -##################################################################################### -# ============================================================================= -# @file -# -# Simple example which illustrate the usage of useful -# algorithm base class for N-Tuple manipulations -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 -# ============================================================================= -""" -******************************************************************************* -* * -* Simple example which illustrate the usage of useful * -* algorithm base class for N-Tuple manipulations * -* * -******************************************************************************* -""" -# ============================================================================= -__author__ = "Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr" -# ============================================================================= - -import GaudiPython - -SUCCESS = GaudiPython.SUCCESS - -# random numbewrs -Rndm = GaudiPython.gbl.Rndm -Numbers = Rndm.Numbers - -from GaudiAlg.Algs import TupleAlgo - -# ============================================================================= -# Primitive function which transform arbitrary sequence into -# GaudiPython.Vector ( std::vector<double> ) -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 - - -def vct(sequence): - """ - Primitive function which transform arbitrary sequence into - GaudiPython.Vector ( std::vector<double> ) - """ - result = GaudiPython.gbl.GaudiPython.Vector() - if hasattr(sequence, "__len__"): - result.reserve(len(sequence)) - elif hasattr(sequence, "size"): - result.reserve(sequence.size()) - - for item in sequence: - result.push_back(item) - return result - - -# ============================================================================= -# @class TupleEx1 -# Simple algorithm which book&fill 3 histograms -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 - - -class TupleEx1(TupleAlgo): - """ - Simple algorithm which implicitely book&fill N-Tuples - """ - - # the main executiomethod - - def execute(self): - """ - The major method 'execute', it is invoked for each event - """ - - rSvc = self.randSvc() - gauss = Numbers(rSvc, Rndm.Gauss(0.0, 1.0)) - flat = Numbers(rSvc, Rndm.Flat(-10, 10)) - expo = Numbers(rSvc, Rndm.Exponential(1.0)) - breit = Numbers(rSvc, Rndm.BreitWigner(0.0, 1.0)) - poisson = Numbers(rSvc, Rndm.Poisson(2.0)) - binom = Numbers(rSvc, Rndm.Binomial(8, 0.25)) - - # ===================================================================== - # primitive row-wise n-tuple - # ===================================================================== - tuple1 = self.nTuple(1, "Trivial Row-Wise Tuple", 42) - - # fill N-Tuple with double/float numbers: - tuple1.column("gauss", gauss()) - tuple1.column("flat", flat()) - tuple1.column("expo", expo()) - tuple1.column("breit", breit()) - - # fill N-Tuple with integer numbers: - tuple1.column("poiss1", int(poisson())) - tuple1.column("binom1", int(binom())) - - # fill N-Tuple with long long numbers: - tuple1.column_ll("poiss2", int(poisson())) - tuple1.column_ll("binom2", int(binom())) - - # fill N-Tuple with unsigned long long numbers: - tuple1.column_ull("poiss3", int(poisson())) - tuple1.column_ull("binom3", int(binom())) - - # fill N-Tuple with "reduced" integer numbers: - tuple1.column("poiss4", int(poisson()), 0, 14) - tuple1.column("binom4", int(binom()), 0, 14) - - # fill N-Tuple with "boolean" numbers: - tuple1.column("poisb", poisson() > 1.0) - - # commit the row - tuple1.write() - - # ===================================================================== - # the same n-tuple but column-wise - # ===================================================================== - tuple2 = self.nTuple(2, "Trivial Column-Wise Tuple") - - # fill N-Tuple with double/float numbers: - tuple2.column("gauss", gauss()) - tuple2.column("flat", flat()) - tuple2.column("expo", expo()) - tuple2.column("breit", breit()) - - # fill N-Tuple with integer numbers: - tuple2.column("poiss", int(poisson())) - tuple2.column("binom", int(binom())) - # fill N-Tuple with "reduced" integer numbers: - tuple2.column("poiss", int(poisson()), 0, 14) - tuple2.column("binom", int(binom()), 0, 14) - - # fill N-Tuple with "boolean" numbers: - tuple2.column("poisb", poisson() > 1.0) - - # commit the row - tuple2.write() - - # ===================================================================== - # book and fill Column-wise NTuple with "fixed"-size arrays/vectors - # ===================================================================== - tuple3 = self.nTuple(3, "Fixed-size arrays/vectors") - - tuple3.array("arflat", vct([flat() for i in range(0, 50)])) - tuple3.array("arexpo", vct([expo() for i in range(0, 62)])) - tuple3.array("argau", vct([gauss() for i in range(0, 42)])) - t = tuple([gauss() for i in range(0, 42)]) - tuple3.array("argau2", vct(t)) - - tuple3.write() - - return SUCCESS - - -# ============================================================================= -# job configuration -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 -def configure(gaudi=None): - """Configuration of the job""" - - if not gaudi: - gaudi = GaudiPython.AppMgr() - - gaudi.JobOptionsType = "NONE" - gaudi.EvtSel = "NONE" - gaudi.HistogramPersistency = "ROOT" - - gaudi.ExtSvc += ["NTupleSvc"] - - ntSvc = gaudi.service("NTupleSvc") - ntSvc.Output = ["MYLUN DATAFILE='TupleEx1.root' OPT='NEW' TYP='ROOT'"] - - gaudi.config() - - gaudi.DLLs = [ - "GaudiAlg", - "RootHistCnv", - ] - - alg = TupleEx1("TupleEx1") - gaudi.setAlgorithms([alg]) - - # configure the properties - alg.NTupleLUN = "MYLUN" - - return SUCCESS - - -# ============================================================================= -# The actual job excution -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 -if "__main__" == __name__: - print(__doc__) - gaudi = GaudiPython.AppMgr() - configure(gaudi) - gaudi.run(20) - -# ============================================================================= -# The END -# ============================================================================= diff --git a/GaudiAlg/tests/qmtest/scripts/TupleEx2.py b/GaudiAlg/tests/qmtest/scripts/TupleEx2.py deleted file mode 100755 index 4fe3903db8a..00000000000 --- a/GaudiAlg/tests/qmtest/scripts/TupleEx2.py +++ /dev/null @@ -1,159 +0,0 @@ -#!/usr/bin/env python3 -##################################################################################### -# (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations # -# # -# This software is distributed under the terms of the Apache version 2 licence, # -# copied verbatim in the file "LICENSE". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -##################################################################################### -# ============================================================================= -# @file -# -# Simple example which illustrate the usage of useful -# algorithm base class for N-Tuple manipulations -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 -# ============================================================================= -""" -******************************************************************************* -* * -* Simple example which illustrate the usage of useful * -* algorithm base class for N-Tuple manipulations * -* * -******************************************************************************* -""" -# ============================================================================= -__author__ = "Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr" -# ============================================================================= - -import GaudiPython - -Rndm = GaudiPython.gbl.Rndm -Math = GaudiPython.gbl.ROOT.Math -SUCCESS = GaudiPython.SUCCESS - -from GaudiAlg.Algs import TupleAlgo - -# ============================================================================= -# @class TupleEx2 -# Simple algorithm for advanced N-Tuple columns -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 - - -class TupleEx2(TupleAlgo): - """ - Simple algorithm for advanced N-Tuple columns - """ - - # standard constructor - def __init__(self, name="TupleEx2"): - """Constructor""" - TupleAlgo.__init__(self, name) - - # the main execution method - def execute(self): - """The major method 'execute', it is invoked for each event""" - - gauss = Rndm.Numbers(self.randSvc(), Rndm.Gauss(0.0, 1.0)) - - # N-tuple with 4D-vectors - tup = self.nTuple("Vectors-4D", "N-tuple with 4D-vectors") - for i in range(0, 100): - lv1 = Math.PxPyPzEVector() - - lv1.SetPx(gauss()) - lv1.SetPy(gauss()) - lv1.SetPz(gauss()) - lv1.SetE(gauss()) - - tup.column("lv1", lv1) - - tup.write() - - # N-tuple with 3D-vectors - tup = self.nTuple("Vectors-3D", "N-tuple with 3D-vectors") - for i in range(0, 100): - v1 = Math.XYZVector() - v1.SetX(gauss()) - v1.SetY(gauss()) - v1.SetZ(gauss()) - - tup.column("v1", v1) - - tup.write() - - # N-tuple with 3D-points - tup = self.nTuple("Points-3D", "N-tuple with 3D-points") - for i in range(0, 100): - p1 = Math.XYZPoint() - p1.SetX(gauss()) - p1.SetY(gauss()) - p1.SetZ(gauss()) - - tup.column("p1", p1) - - tup.write() - - return SUCCESS - - -# ============================================================================= -# job configuration -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 - - -def configure(gaudi=None): - """ - Configuration of the job - """ - - if not gaudi: - gaudi = GaudiPython.AppMgr() - - gaudi.JobOptionsType = "NONE" - gaudi.EvtSel = "NONE" - gaudi.HistogramPersistency = "ROOT" - - gaudi.ExtSvc += ["NTupleSvc"] - - ntSvc = gaudi.service("NTupleSvc") - ntSvc.Output = ["MYLUN DATAFILE='TupleEx2.root' OPT='NEW' TYP='ROOT'"] - - gaudi.config() - - gaudi.DLLs = [ - "GaudiAlg", - "RootHistCnv", - ] - - alg = TupleEx2() - gaudi.setAlgorithms([alg]) - - # configure the properties - alg.NTupleLUN = "MYLUN" - - return SUCCESS - - -# ============================================================================= -# The actual job execution -# -# @author Vanya BELYAEV ibelyaev@physics.syr.edu -# @date 2006-11-26 -if "__main__" == __name__: - print(__doc__) - gaudi = GaudiPython.AppMgr() - configure(gaudi) - gaudi.run(20) - -# ============================================================================= -# The END -# ============================================================================= diff --git a/GaudiAlg/tests/qmtest/scripts/bug_38882.py b/GaudiAlg/tests/qmtest/scripts/bug_38882.py deleted file mode 100755 index 4bda3ee2bad..00000000000 --- a/GaudiAlg/tests/qmtest/scripts/bug_38882.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python3 -##################################################################################### -# (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations # -# # -# This software is distributed under the terms of the Apache version 2 licence, # -# copied verbatim in the file "LICENSE". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -##################################################################################### -# ============================================================================= - -# ============================================================================= - -__author__ = "Marco Clemencic" -# ============================================================================= - -from GaudiAlg.Algs import GaudiAlgo - -import GaudiPython - -SUCCESS = GaudiPython.SUCCESS - -# ============================================================================= -# Simple algorithm which book&fill 3 histograms -# ============================================================================= - - -class TestAlg(GaudiAlgo): - """Simple algorithm that prints a message during execute""" - - def __init__(self, name): - """Constructor""" - GaudiAlgo.__init__(self, name) - - def execute(self): - """The main method 'execute', it is invoked for each event""" - print("=== %s Execute ===" % self.name()) - return SUCCESS - - -# ============================================================================= -# job configuration -# ============================================================================= - - -def configure(gaudi=None): - """Configuration of the job""" - - if not gaudi: - gaudi = GaudiPython.AppMgr() - - gaudi.JobOptionsType = "NONE" - gaudi.EvtSel = "NONE" - gaudi.HistogramPersistency = "NONE" - - gaudi.config() - - gaudi.initialize() - - alg = TestAlg("bug_38882_test_alg") - gaudi.setAlgorithms([alg]) - - return SUCCESS - - -# ============================================================================= -# The actual job excution -# ============================================================================= -if "__main__" == __name__: - gaudi = GaudiPython.AppMgr() - configure(gaudi) - gaudi.run(1) diff --git a/GaudiConf/python/GaudiConf/IOHelper.py b/GaudiConf/python/GaudiConf/IOHelper.py index 6ab4e79e352..a00e2d7b285 100644 --- a/GaudiConf/python/GaudiConf/IOHelper.py +++ b/GaudiConf/python/GaudiConf/IOHelper.py @@ -19,9 +19,60 @@ from __future__ import print_function from builtins import object __author__ = "Marco Cattaneo <Marco.Cattaneo@cern.ch>" -#from Gaudi.Configuration import * +import Gaudi.Configuration as GaudiConfigurables +import Configurables -from GaudiConf.Manipulations import fullNameConfigurables, nameFromConfigurable, configurableInstanceFromString, removeConfigurables + +def fullNameConfigurables(): + """ + Simple function to find all defined configurables + and make a dictionary of {fullName : conf} + """ + return dict((c.getFullName(), c) + for c in GaudiConfigurables.allConfigurables.values()) + + +def nameFromConfigurable(conf): + """ + Safe function to get the full name of a configurable + """ + if type(conf) is str: + return conf + elif hasattr(conf, "getFullName"): + return conf.getFullName() + return None + + +def configurableInstanceFromString(config): + '''Get a configurable instance given a type/name the string. + + If the configurable was not instantiated yet, instantiate it.''' + + if '/' in config: + typename, name = config.split('/', 1) + else: + typename = name = config + # Configurables typenames use '__' as namespace separator + typename = typename.replace('::', '__') + + try: + return (GaudiConfigurables.allConfigurables.get(name) + or getattr(Configurables, typename)(name)) + except TypeError: + # this can happen during build + if Configurables.ignoreMissingConfigurables: + return None + raise + + +def removeConfigurables(conf_list): + '''Helper: get rid of all configurables from a list''' + from Gaudi.Configuration import allConfigurables + conftodel = [ + k for k in allConfigurables if allConfigurables[k] in conf_list + ] + for k in conftodel: + del allConfigurables[k] def _configurable_name(c): diff --git a/GaudiConf/python/GaudiConf/Manipulations.py b/GaudiConf/python/GaudiConf/Manipulations.py deleted file mode 100644 index 5604eb6225b..00000000000 --- a/GaudiConf/python/GaudiConf/Manipulations.py +++ /dev/null @@ -1,211 +0,0 @@ -############################################################################### -# (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration # -# # -# This software is distributed under the terms of the GNU General Public # -# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -############################################################################### -# -*- coding: utf-8 -*- -""" -Simple python functions for setting common options to all configurables. -Uses elements from HLTConf and GaudiConf - -Usage, something like: - -forAllConf(ApplicationMgr().TopAlg,{'OutputLevel':3}) -or -forAllConf(fullNameConfigurables().keys(),{'OutputLevel':3}) - -or same with postConfForAll... - -""" -# Copied from GaudiConf, IOHelper. Manipulators of configurables. -import Gaudi.Configuration as GaudiConfigurables -import Configurables -from GaudiKernel.Configurable import Configurable, ConfigurableGeneric - - -def fullNameConfigurables(): - """ - Simple function to find all defined configurables - and make a dictionary of {fullName : conf} - """ - return dict((c.getFullName(), c) - for c in GaudiConfigurables.allConfigurables.values()) - - -def nameFromConfigurable(conf): - """ - Safe function to get the full name of a configurable - """ - if type(conf) is str: - return conf - elif hasattr(conf, "getFullName"): - return conf.getFullName() - return None - - -def configurableClassFromString(config): - '''Get a configurable class given only the string''' - config = config.split('/')[0] - config = config.replace('::', '__') - - try: - return getattr(Configurables, config) - except AttributeError: - return None - - -def addPrivateToolFromString(amother, atool): - ''' - Add a private tool correctly and return it, given a tool as "Type/InstanceName" - If it already exists and is of the correct type, great. - ''' - if type(amother) is str: - amother = configurableInstanceFromString(amother) - toolClass = configurableClassFromString(atool) - toolName = atool.split("/")[-1] - if hasattr(amother, toolName): - if getattr(amother, toolName).getType() == toolClass.getType(): - return getattr(amother, toolName) - raise TypeError( - "This configurable already has a private tool with that name, but of a different type! " - + amother.getFullName() + " Expected: " + toolClass.getType() + - " got " + getattr(amother, toolName).getType()) - amother.addTool(toolClass, name=toolName) - return getattr(amother, toolName) - - -def configurableInstanceFromString(config): - '''Get a configurable instance given a type/name the string. - - If the configurable was not instantiated yet, instantiate it.''' - - if '/' in config: - typename, name = config.split('/', 1) - else: - typename = name = config - # Configurables typenames use '__' as namespace separator - typename = typename.replace('::', '__') - - try: - return (GaudiConfigurables.allConfigurables.get(name) - or getattr(Configurables, typename)(name)) - except TypeError: - # this can happen during build - if Configurables.ignoreMissingConfigurables: - return None - raise - - -def removeConfigurables(conf_list): - '''Helper: get rid of all configurables from a list''' - from Gaudi.Configuration import allConfigurables - conftodel = [ - k for k in allConfigurables if allConfigurables[k] in conf_list - ] - for k in conftodel: - del allConfigurables[k] - - -def recurseConfigurables(func, - head=None, - descend_properties=[], - descend_tools=False): - """Recursively visit configurables and call a function for each. - - Note that the function is called before recursing over properties - or tools, so if it modifies them (e.g. adds tools), this will be - reflected in the recursion. - The behaviour of the removed forAllConf / postConfForAll can be - achieved with: - - func = partial(setPropertiesAndAddTools, properties=..., tools_per_type=..., force=...) - descend_properties = ['Members', 'Filter0', 'Filter1', 'TopAlg'] - appendPostConfigAction(partial(recurseConfigurables, func, descend_properties=descend_properties, descend_tools=...)) - - Args: - func: A function taking a single argument to be called for each - visited configurable. - head: A configurable or a list of configurables from which to - start recursing. If None is given (default), all instantiated - configurables plus ApplicationMgr().TopAlg will be used. - descend_properties: List of properties to recurse over. - descend_tools: Whether to recurse over tools or not. - - Returns: - A set of all configurables that were visited. - """ - - if head is None: - from Gaudi.Configuration import ApplicationMgr - head = [ApplicationMgr()] + ApplicationMgr().TopAlg - head += list(GaudiConfigurables.allConfigurables.values()) - - visited = set() - __recurseConfigurables(func, head, descend_properties, descend_tools, - visited) - return visited - - -def __recurseConfigurables(func, head, properties, tools, visited): - if isinstance(head, list): - for i in head: - __recurseConfigurables(func, i, properties, tools, visited) - return - - if isinstance(head, str): - try: - head = configurableInstanceFromString(head) - except (AttributeError, TypeError): - return # I cannot find the configurable, skip it - - if isinstance(head, Configurable) and head not in visited: - visited.add(head) - func(head) - if tools: - for tool in head.getTools(): - __recurseConfigurables(func, tool, properties, tools, visited) - if properties is not None: - prop_values = [getattr(head, p, None) for p in properties] - else: - prop_values = list(head.getProperties().values()) - for value in prop_values: - if isinstance(value, (list, str, Configurable)): - __recurseConfigurables(func, value, properties, tools, visited) - - -def setPropertiesAndAddTools(configurable, - properties, - tools_per_type={}, - force=False): - """Set properties of, and add private tools to a configurable. - - Note that properties of ConfigurableGeneric instances are only set - if they have been previously set and force=True. (The reason is that - ConfigurableGeneric-s do not know what properties are valid). - - Args: - configurable: The configurable to modify. - properties: A dictionary of property names and values. If a - property does not exist for the given configurable, it is - ignored. - tools_per_type: A dictionary of the form {"configurable type": - ["tooltype/toolname", ...]}. For example: - {"CaloSinglePhotonAlg": ["CaloECorrection/ECorrection"]} - """ - is_generic = isinstance(configurable, ConfigurableGeneric) - for name, value in properties.items(): - if force or (not configurable.isPropertySet(name)): - if is_generic and not hasattr(configurable, name): - continue # skip unset properties of ConfigurableGeneric-s - try: - configurable.setProp(name, value) - except AttributeError: - pass - tools = tools_per_type.get(configurable.getType(), []) - for spec in tools: - tool = addPrivateToolFromString(configurable, spec) diff --git a/GaudiConf/tests/options/test-manipulations.py b/GaudiConf/tests/options/test-manipulations.py deleted file mode 100644 index afab963c8a9..00000000000 --- a/GaudiConf/tests/options/test-manipulations.py +++ /dev/null @@ -1,99 +0,0 @@ -from __future__ import print_function -############################################################################### -# (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration # -# # -# This software is distributed under the terms of the GNU General Public # -# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -############################################################################### -from functools import partial - -#test the import -from GaudiConf.Manipulations import * - -#create some algs from Gaudi, ready to have their properties set -from Configurables import InputCopyStream, EventCounter -ics = InputCopyStream(name="I_Created_This") -ec = EventCounter(name="I_Also_Created_This") - -if nameFromConfigurable(ics) != "InputCopyStream/I_Created_This": - raise ValueError("Name found is not correct", nameFromConfigurable(ics)) - -if configurableInstanceFromString(nameFromConfigurable(ics)) != ics: - raise ValueError("the configurable instance wasn't the same as I created") - -ops = "OutputStream/You_Created_This" - -if nameFromConfigurable(configurableInstanceFromString(ops)) != ops: - raise ValueError("I wasn't able to create the configurable requested") - -if (ops not in fullNameConfigurables()) or ( - nameFromConfigurable(ics) not in fullNameConfigurables()) or ( - nameFromConfigurable(ec) not in fullNameConfigurables()): - raise ValueError("I couldn't find the configurables we just created, " + - fullNameConfigurables().__str__()) - -ics.OutputLevel = 2 - -recurseConfigurables( - partial( - setPropertiesAndAddTools, - properties={ - 'OutputLevel': 3, - "OutputFile": 'ASpamName' - }), list(fullNameConfigurables().values())) - -if not ec.isPropertySet("OutputLevel"): - raise AttributeError( - "I didn't set the OutputLevel of the EventCounter you made") -if ics.getProp("OutputLevel") != 2: - raise AttributeError( - "I set the output level of ics when it was already set elsewhere") -for conf in [configurableInstanceFromString(ops), ics]: - if (not conf.isPropertySet("OutputFile") - ) or conf.getProp("OutputFile") != 'ASpamName': - raise "I didn't correctly set the property of output file for " - -fdict = {'OutputLevel': 7, "OutputFile": 'AnotherSpamName'} - -recurseConfigurables( - partial(setPropertiesAndAddTools, properties=fdict, force=True), - list(fullNameConfigurables().values())) - -for conf in [configurableInstanceFromString(ops), ics, ec]: - for key in fdict: - if hasattr(conf, - key) or (hasattr(conf, "properties") - and key in conf.properties()) or (hasattr( - conf, "__slots__") and key in conf.__slots__): - if (not conf.isPropertySet(key) - ) or conf.getProp(key) != fdict[key]: - raise "I didn't correctly set the property of" - -#check that I follow down sequencers! -gs = configurableInstanceFromString("GaudiSequencer/testSeq") -gs.Members = [ - "EventCounter/NewCounter", "InputCopyStream/newStream", - "OutputStream/spamStream" -] - -recurseConfigurables( - partial(setPropertiesAndAddTools, properties=fdict, force=True), - list(fullNameConfigurables().values()), - descend_properties=['Members']) - -for conf in gs.Members: - conf = configurableInstanceFromString(conf) - for key in fdict: - if hasattr(conf, - key) or (hasattr(conf, "properties") - and key in conf.properties()) or (hasattr( - conf, "__slots__") and key in conf.__slots__): - if (not conf.isPropertySet(key) - ) or conf.getProp(key) != fdict[key]: - raise "I didn't correctly set the property of" - -print("PASS") diff --git a/GaudiConf/tests/qmtest/gaudiconf.qms/manipulations.qmt b/GaudiConf/tests/qmtest/gaudiconf.qms/manipulations.qmt deleted file mode 100755 index f7cb8811119..00000000000 --- a/GaudiConf/tests/qmtest/gaudiconf.qms/manipulations.qmt +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration - - This software is distributed under the terms of the GNU General Public - Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<!-- -####################################################### -# SUMMARY OF THIS TEST -# ................... -# Author: rlambert -# Purpose: check the GaudiConf.Manipulations module -# Prerequisites: none -# Common failure modes, severities and cures: -# . MAJOR: any failure of this test indicates a major problem with the manipulations module -####################################################### ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> - <argument name="program"><text>python</text></argument> - <argument name="args"><set><text>../options/test-manipulations.py</text></set></argument> -</extension> diff --git a/Phys/LoKiCore/CMakeLists.txt b/Phys/LoKiCore/CMakeLists.txt index 30592d51b59..cd8ff6d76f3 100644 --- a/Phys/LoKiCore/CMakeLists.txt +++ b/Phys/LoKiCore/CMakeLists.txt @@ -98,7 +98,6 @@ gaudi_add_library(LoKiCoreLib gaudi_add_module(LoKiCore SOURCES src/Components/CoreFactory.cpp - src/Components/CounterAlg.cpp src/Components/DecayNode.cpp src/Components/LoKiPIDTest.cpp src/Components/LoKiSvc.cpp diff --git a/Phys/LoKiCore/src/Components/CounterAlg.cpp b/Phys/LoKiCore/src/Components/CounterAlg.cpp deleted file mode 100644 index 841d19260e5..00000000000 --- a/Phys/LoKiCore/src/Components/CounterAlg.cpp +++ /dev/null @@ -1,260 +0,0 @@ -/*****************************************************************************\ -* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration * -* * -* This software is distributed under the terms of the GNU General Public * -* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -// ============================================================================ -// Include files -// ============================================================================ -#include <numeric> -// ============================================================================ -// GaudiAlg -// ============================================================================ -#include "GaudiAlg/GaudiAlgorithm.h" -// ============================================================================ -// LHCbKernel -// ============================================================================ -#include "Kernel/Counters.h" -// ============================================================================ -// LoKi -// ============================================================================ -#include "LoKi/Functor.h" -#include "LoKi/ICoreFactory.h" -// ============================================================================ -/** @file - * - * This file is a part of LoKi project - - * "C++ ToolKit for Smart and Friendly Physics Analysis" - * - * The package has been designed with the kind help from - * Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, - * contributions and advices from G.Raven, J.van Tilburg, - * A.Golutvin, P.Koppenburg have been used in the design. - */ -// ============================================================================ -namespace LoKi { - // ========================================================================== - /** @class CounterAlg - * Simple algorithm to dealwith counters. - * It has two modes: - * - * - "simple" mode, when certain counters are evaluated and are - * kept locally - * - * - "store-in-TES", when the values are also stored in TES in form of - * Gaudi::Numbers object at specified location - * the default location is "Counters/<ALGNAME>" - * - * @code - * - * myCnt.Variables = { - * 'nSpd' : "CONTAINS('Raw/Spd/Digits')" , - * 'nVelo' : "TrSOURCE('Rec/Track/Best', TrVELO) >> TrSIZE " , - * 'hasTrueMCDecay' : "MCSOURCE('MC/Particles','[B_s0 -> J/psi(1S) phi(1020)]CC') >> MCSIZE" , - * 'GEC-loose' : "ACCEPT('Hlt::GEC/AcceptGESLoose')" - * } - * - * ## use non-standard location: - * myCnt.Location = "/Event/MyCounters" - * - * @endcode - * - * @author Vanya BELYAEV Ivan.BElyaev@cern.ch - * @date 2011-02-12 - */ - class CounterAlg : public GaudiAlgorithm { - public: - // ======================================================================== - /// the main method: execute - StatusCode execute() override; - /// proper initialization - StatusCode initialize() override; - /// proper finalization - StatusCode finalize() override; - // ======================================================================== - protected: - // ======================================================================== - /** helper class to keep the N-tuple items - * @author Vanya BELYAEV Ivan.Belyaev@itep.ru - * @date 2010-02-16 - */ - class Item final { - public: - // ==================================================================== - // the default constructor - Item() = default; - // ==================================================================== - /// the variable name - std::string m_name; - /// the functor itself - LoKi::Assignable_t<LoKi::BasicFunctors<void>::Function> m_fun = LoKi::BasicFunctors<void>::Constant( -1.e+10 ); - /// helper counter - StatEntity* m_cnt = nullptr; - // ==================================================================== - }; - - public: - /** standard constructor - * @see GaudiAlgorithm - * @see Algorithm - * @see AlgFactory - * @see IAlgFactory - * @param name the algorithm instance name - * @param pSvc pointer to Service Locator - */ - CounterAlg( const std::string& name, // the algorithm instance name - ISvcLocator* pSvc ) // pointer to the service locator - : GaudiAlgorithm( name, pSvc ) { - // - // - // - } - // ======================================================================== - protected: - // ======================================================================== - /// update variables - StatusCode updateItems(); // update variables - // ======================================================================== - /// the preambulo - std::string preambulo() const { - const auto& lines = m_preambulo.value(); - return std::accumulate( lines.begin(), lines.end(), std::string{}, []( std::string r, const std::string& line ) { - return r.empty() ? line : r + '\n' + line; - } ); - } - // ======================================================================== - private: - // ======================================================================== - /// map pf variables - Gaudi::Property<std::map<std::string, std::string>> m_map // map pf variables - {this, - "Variables", - {}, - [this]( auto& ) { - if ( Gaudi::StateMachine::INITIALIZED > FSMState() ) return; - Warning( "Reintialization of Variables" ).ignore(); - StatusCode sc = updateItems(); - Assert( sc.isSuccess(), "Unable to set 'Variables'", sc ); - }, - "The map { 'name' : 'functor'} of variables: void -> double "}; - /// the preambulo - Gaudi::Property<std::vector<std::string>> m_preambulo // the preambulo - {this, - "Preambulo", - {}, - [this]( auto& ) { - if ( Gaudi::StateMachine::INITIALIZED > FSMState() ) { return; } - Warning( "Reintialization of Preambulo" ).ignore(); - StatusCode sc = updateItems(); - Assert( sc.isSuccess(), "Unable to set 'Preambulo'", sc ); - }, - "The preambulo lines to be used for the temporary python script"}; - /// factory for functor decoding - Gaudi::Property<std::string> m_factory // factory for functor decoding - {this, "Factory", "LoKi::Hybrid::CoreFactory/CoreFactory:PUBLIC", - [this]( auto& ) { - if ( Gaudi::StateMachine::INITIALIZED > FSMState() ) return; - Warning( "Reintialization of HltFactory" ).ignore(); - StatusCode sc = updateItems(); - Assert( sc.isSuccess(), "Unable to set 'Variables'", sc ); - }, - "The type/name of LoKiBender \"hybrid\" factory: void->double"}; - /// TES-location of counters - Gaudi::Property<std::string> m_location // TES-location of counters - {this, "Location", "Counters/" + name(), "TES-location of counters"}; - /// decoded vector of functors/items - std::vector<Item> m_items; - // ======================================================================== - }; - // ========================================================================== -} // end of namespace LoKi -// ============================================================================ -// update variables -// ============================================================================ -StatusCode LoKi::CounterAlg::updateItems() // update variables -{ - try { - // get the factory - auto* factory = tool<LoKi::Hybrid::ICoreFactory>( m_factory, this ); - // - m_items.clear(); - m_items.reserve( m_map.size() ); - std::transform( m_map.begin(), m_map.end(), std::back_inserter( m_items ), [&]( const auto& ivar ) { - Item item; - StatusCode sc = factory->get( ivar.second, item.m_fun, preambulo() ); - if ( sc.isFailure() ) { throw Error( "Unable to decode " + ivar.first + " : " + ivar.second, sc ); } - // - item.m_name = ivar.first; - item.m_cnt = &counter( ivar.first ); - // - // - debug() << "The decoded variable name is '" << item.m_name << "'\t, the functor : '" << item.m_fun << "'" - << endmsg; - return item; - } ); - // - return release( factory ); // we do not need the factory anymore - } catch ( const StatusCode& sc ) { return sc; } - // -} -// ============================================================================ -// standard initialization -// ============================================================================ -StatusCode LoKi::CounterAlg::initialize() { - StatusCode sc = GaudiAlgorithm::initialize(); - if ( sc.isFailure() ) { return sc; } - svc<ILoKiSvc>( "LoKiSvc", true ); - // - // decode variables: - // - if ( !m_map.empty() ) { - sc = updateItems(); - if ( sc.isFailure() ) { return Error( "Unable to decode Variables", sc ); } - } - // - return StatusCode::SUCCESS; -} -// ============================================================================ -// standard finalization -// ============================================================================ -StatusCode LoKi::CounterAlg::finalize() { - m_items.clear(); - return GaudiAlgorithm::finalize(); -} -// ============================================================================ -// the main method: execute -// ============================================================================ -StatusCode LoKi::CounterAlg::execute() { - setFilterPassed( true ); - // - Gaudi::Numbers* numbers = nullptr; - // - // get(create) counters in TES (if needed) - if ( !m_location.empty() ) { numbers = getOrCreate<Gaudi::Numbers, Gaudi::Numbers>( evtSvc(), m_location.value() ); } - // - for ( auto item = m_items.cbegin(); m_items.cend() != item; ++item ) { - // evaluate the variable - const double value = ( item->m_fun )(); - // update TES object - if ( numbers ) { numbers->counters().update( item->m_name, value ); } - // update local counters - item->m_cnt->add( value ); - } - // - return StatusCode::SUCCESS; -} -// ============================================================================ - -// ============================================================================ -/// the factory (needed for instantiation) -DECLARE_COMPONENT( LoKi::CounterAlg ) -// ============================================================================ - -// ============================================================================ -// The END -// ============================================================================ diff --git a/PyConf/options/example.py b/PyConf/options/example.py deleted file mode 100644 index 8eafc595a9d..00000000000 --- a/PyConf/options/example.py +++ /dev/null @@ -1,81 +0,0 @@ -############################################################################### -# (c) Copyright 2019 CERN for the benefit of the LHCb Collaboration # -# # -# This software is distributed under the terms of the GNU General Public # -# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -############################################################################### -"""An example application configured using PyConf components. - -This illustrates: - -* The usage of @configurable and bind to override default keyword argument - values within a call stack -* How to define control flow using CompositeNode -""" -from __future__ import print_function -from PyConf import configurable -from PyConf.application import ApplicationOptions, configure, configure_input -from PyConf.control_flow import CompositeNode -from PyConf.Algorithms import ( - Gaudi__Examples__IntDataProducer as IntDataProducer, - Gaudi__Examples__IntIntToFloatFloatData as IntIntToFloatFloatData, - CounterAlg, -) -from Gaudi.Configuration import DEBUG - - -@configurable -def int_maker(value=1): - # The IntDataProducer isn't actually configurable, but we accept an - # argument in this method to illustrate @configurable and bind - print('Got value {}'.format(value)) - return IntDataProducer().OutputLocation - - -def make_first_float(): - int1 = int_maker() - with IntDataProducer.bind( - OutputLevel=DEBUG): # change some property of IntDataProducer - int2 = int_maker() - return IntIntToFloatFloatData( - InputLocation1=int1, InputLocation2=int2).OutputLocation1 - - -def make_second_float(): - int1 = int_maker() - int2 = int_maker() - return IntIntToFloatFloatData( - InputLocation1=int1, InputLocation2=int2).OutputLocation2 - - -# Bind to the @configurable int_maker to override the default value when it's -# called -with int_maker.bind(value=123): - float1 = make_first_float() -# We're out of the scope of the `bind`, so expect to see the default value here -float2 = make_second_float() - -# Note that we don't we to explicitly 'schedule' IntDataProducer here; the fact -# that we've instantiated it and used it as a data dependency of float1 and -# float2 is enough for the framework to know IntDataProducer needs to be run -line1 = CompositeNode( - "line1", children=[float1, float2, CounterAlg()], force_order=True) - -# Define the application environment and run it -options = ApplicationOptions(_enabled=False) -options.n_threads = 4 -options.n_event_slots = 5 -options.evt_max = 50 -options.monitoring_file = "monitoring.json" -# Although we have no input data, must specify input-like metadata -options.input_type = "NONE" -options.dddb_tag = "upgrade/master" -options.conddb_tag = "upgrade/master" -options.simulation = True - -config = configure_input(options) -config.update(configure(options, line1)) diff --git a/PyConf/python/PyConf/__init__.py b/PyConf/python/PyConf/__init__.py index dc447a537bc..e1cff536b7b 100644 --- a/PyConf/python/PyConf/__init__.py +++ b/PyConf/python/PyConf/__init__.py @@ -20,8 +20,8 @@ PyConf is broadly split in two parts: To use algorithms and tools, don't import them from `Configurables` but instead from `PyConf.Algorithms` and `PyConf.Tools`:: - >>> from PyConf.Algorithms import MyGaudiAlgorithm - >>> from PyConf.Tools import MyTool + > from PyConf.Algorithms import MyGaudiAlgorithm + > from PyConf.Tools import MyTool Any single `Algorithm` or `Tool` is immutable after instantiation, and hence the data flow that produces its inputs is known once the `Algorithm` or `Tool` diff --git a/PyConf/python/PyConf/importers.py b/PyConf/python/PyConf/importers.py index 5dab0c15b1e..05fbaf3deaf 100644 --- a/PyConf/python/PyConf/importers.py +++ b/PyConf/python/PyConf/importers.py @@ -51,8 +51,8 @@ def _create_importer(wrapper, type_predicate): algorithm or tool that you can import from Configurables, you can also import from this module. - >>> from PyConf.Algorithms import MyGaudiAlgorithm - >>> from PyConf.Tools import Gaudi__Examples__FloatTool + > from PyConf.Algorithms import MyGaudiAlgorithm + > from PyConf.Tools import Gaudi__Examples__FloatTool Importing tools as algorithms or vice versa will fail. diff --git a/PyConf/python/PyConf/tests/test_algorithm.py b/PyConf/python/PyConf/tests/test_algorithm.py index b98f86c6e33..6ae58715919 100644 --- a/PyConf/python/PyConf/tests/test_algorithm.py +++ b/PyConf/python/PyConf/tests/test_algorithm.py @@ -27,15 +27,12 @@ from PyConf.Algorithms import ( Gaudi__Examples__IntVectorsToIntVector as IntVectorsToIntVector, Gaudi__Examples__SDataProducer as SDataProducer, Gaudi__Examples__SRangesToIntVector as SRangesToIntVector, - MyGaudiAlgorithm, Gaudi__Examples__CountSelectedTracks as CountSelectedTracks, Gaudi__Examples__SelectTracks as SelectTracks, Gaudi__Hive__FetchDataFromFile as FetchDataFromFile, ) from PyConf.Tools import ( - Gaudi__Examples__FloatTool as FloatTool, - MyTool, -) + Gaudi__Examples__FloatTool as FloatTool, ) from PyConf import components from PyConf.mock import MockDataHandle, mock_is_datahandle @@ -178,38 +175,6 @@ def test_tool_compat(): assert alg1.tools == alg2.tools -def test_list_of_tools_compat(): - float_producer = IntToFloatData(InputLocation=IntDataProducer()) - # MyGaudiAlgorithm expects DataObject handles but we don't have a - # dummy producer for these, so "erase" the type to avoid the check. - data = IntDataProducer().OutputLocation.untyped() - alg = MyGaudiAlgorithm( - raw=data, - tracks=data, - hits=data, - MyPublicToolHandleArrayProperty=[ - FloatTool(public=True, Input=float_producer), - FloatTool(public=True, Input=float_producer) - ]) - assert len(alg.tools["MyPublicToolHandleArrayProperty"]) == 2 - - -def test_public_tool_init(): - """Public tool properties are configurable only with public tools.""" - public_tool = MyTool(public=True) - # Tools are private by default - private_tool = MyTool() - - # MyGaudiAlgorithm expects DataObject handles but we don't have a - # dummy producer for these, so "erase" the type to avoid the check. - data = IntDataProducer().OutputLocation.untyped() - producer_kwargs = dict(raw=data, tracks=data, hits=data) - - MyGaudiAlgorithm(PubToolHandle=public_tool, **producer_kwargs) - with pytest.raises(ConfigurationError): - MyGaudiAlgorithm(PubToolHandle=private_tool, **producer_kwargs) - - def test_datahandle_type_check(): # Passing the same type is fine int_data = IntDataProducer().OutputLocation diff --git a/PyConf/tests/qmtest/test_diffopts_pkl.qmt b/PyConf/tests/qmtest/test_diffopts_pkl.qmt deleted file mode 100644 index f13e22f1109..00000000000 --- a/PyConf/tests/qmtest/test_diffopts_pkl.qmt +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration - - This software is distributed under the terms of the GNU General Public - Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> -<argument name="prerequisites"><set> - <tuple><text>test_example</text><enumeral>PASS</enumeral></tuple> - <tuple><text>test_example_pkl</text><enumeral>PASS</enumeral></tuple> -</set></argument> -<argument name="program"><text>diffopts.py</text></argument> -<argument name="args"><set> - <text>--exclude=HltANNSvc,^Repositories$</text> <!-- FIXME lhcb-metainfo stuff depends on workdir --> - <text>../test_example_pkl/example.opts.pkl</text> - <text>../test_example/example.opts.py</text> -</set></argument> -<argument name="use_temp_dir"><enumeral>per-test</enumeral></argument> -<argument name="exit_code"><integer>0</integer></argument> -<argument name="validator"><text> -if stdout: - causes.append('non-empty stdout') -</text></argument> -</extension> diff --git a/PyConf/tests/qmtest/test_example.qmt b/PyConf/tests/qmtest/test_example.qmt deleted file mode 100644 index 778bfec0058..00000000000 --- a/PyConf/tests/qmtest/test_example.qmt +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration - - This software is distributed under the terms of the GNU General Public - Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<!-- -Run the example options and ensure they produce no warnings or errors. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> -<argument name="program"><text>gaudirun.py</text></argument> -<argument name="args"><set> - <text>../../options/example.py</text> - <text>--output=example.opts.py</text> - <text>--all-opts</text> -</set></argument> -<argument name="use_temp_dir"><enumeral>per-test</enumeral></argument> -<argument name="validator"><text> -countErrorLines({"FATAL": 0, "ERROR": 0, "WARNING": 0}) - -# The second instance of IntDataProducer should be in DEBUG -if "+ OUTPUT '/Event/Gaudi__Examples__IntDataProducer_645a4107/OutputLocation" in stdout: - causes.append("Incorrect configuration of first IntDataProducer") -if "+ OUTPUT '/Event/Gaudi__Examples__IntDataProducer_20b0013b/OutputLocation'" not in stdout: - causes.append("Incorrect configuration of second IntDataProducer") - -# Shouldn't have more than 2 IntDataProducers -if stdout.count('| "Gaudi__Examples__IntDataProducer') != 2: - causes.append("Deduplication of IntDataProducer failed") - -# Should see correct order of values (first overridden, then default) -if "Got value 123\nGot value 1\n" not in stdout: - causes.append("Bind override of int_maker failed") - -# monitoring.json is produced -if not os.path.isfile("monitoring.json"): - causes.append("monitoring.json was not produced") -</text></argument> -</extension> diff --git a/PyConf/tests/qmtest/test_example_pkl.qmt b/PyConf/tests/qmtest/test_example_pkl.qmt deleted file mode 100644 index 072cd9b0e62..00000000000 --- a/PyConf/tests/qmtest/test_example_pkl.qmt +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> -<!-- - (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration - - This software is distributed under the terms of the GNU General Public - Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". - - In applying this licence, CERN does not waive the privileges and immunities - granted to it by virtue of its status as an Intergovernmental Organization - or submit itself to any jurisdiction. ---> -<!-- -Run the example options and ensure they produce no warnings or errors. ---> -<extension class="GaudiTest.GaudiExeTest" kind="test"> -<argument name="program"><text>gaudirun.py</text></argument> -<argument name="args"><set> - <text>../../options/example.py</text> - <text>-n</text> - <text>--output=example.opts.pkl</text> - <text>--all-opts</text> -</set></argument> -<argument name="use_temp_dir"><enumeral>per-test</enumeral></argument> -</extension> -- GitLab