diff --git a/Reconstruction/RecExample/RecExOnline/CMakeLists.txt b/Reconstruction/RecExample/RecExOnline/CMakeLists.txt index 453eee1c0cd76f2f7a1d94cc9100248547392057..b77e0edbf06f8d4ecaf858d8de9aab8e2a4b1c06 100644 --- a/Reconstruction/RecExample/RecExOnline/CMakeLists.txt +++ b/Reconstruction/RecExample/RecExOnline/CMakeLists.txt @@ -1,13 +1,11 @@ -################################################################################ -# Package: RecExOnline -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( RecExOnline ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) -atlas_install_runtime( test/RecExOnline_TestConfiguration.xml share/RootHis*.C share/RecExOnline_Test*.C ) +atlas_install_runtime( share/RecExOnline_Test*.C ) atlas_install_scripts( scripts/*.sh ) diff --git a/Reconstruction/RecExample/RecExOnline/python/OnlineISConfiguration.py b/Reconstruction/RecExample/RecExOnline/python/OnlineISConfiguration.py index fbda833b60f61ad6cb9b99936c99e48464327dc5..bc2856ea6311ebb98189d645f2771960ca43d2fd 100644 --- a/Reconstruction/RecExample/RecExOnline/python/OnlineISConfiguration.py +++ b/Reconstruction/RecExample/RecExOnline/python/OnlineISConfiguration.py @@ -1,10 +1,5 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -from __future__ import print_function -from future import standard_library -standard_library.install_aliases() -import subprocess - import ispy @@ -14,7 +9,7 @@ def GetAtlasReady(): r4p = ISObject(IPCPartition("ATLAS"), 'RunParams.Ready4Physics', 'RunParams') r4p.checkout() return r4p.ready4physics - except: + except Exception: print ("#### Failed to determine if we are ready for physics") raise @@ -33,15 +28,15 @@ def GetRunType(): partition = "ATLAS" except KeyError: partition = "ATLAS" - mlog.warning("TDAQ_PARTITION not defined in environment, using %s as default" % partition) + mlog.warning("TDAQ_PARTITION not defined in environment, using %s as default", partition) #now try and read the information from IS try: from ipc import IPCPartition from ispy import ISObject - ipcPart = IPCPartition(partition); + ipcPart = IPCPartition(partition) if not ipcPart.isValid(): - raise UserWarning("Partition %s invalid - cannot access run type settings" % partition); + raise UserWarning("Partition %s invalid - cannot access run type settings" % partition) runparams = ISObject(ipcPart, 'RunParams.RunParams', 'RunParams') runparams.checkout() beamEnergy = runparams.beam_energy @@ -51,7 +46,7 @@ def GetRunType(): beamEnergy = None projectTag = None - mlog.info("Setting project tag to %s" % projectTag) + mlog.info("Setting project tag to %s", projectTag) return (None, beamEnergy, projectTag) # the BeamType in the IS RunParams is not useful for auto-configuration def GetBFields(): @@ -61,16 +56,16 @@ def GetBFields(): #BFields are read from initial partition partition = 'initial' - mlog.debug("Trying to read magnetic field configuration from partition %s" % partition) + mlog.debug("Trying to read magnetic field configuration from partition %s", partition) #now try and read the information from IS try: from ipc import IPCPartition - from ispy import ISObject - ipcPart = IPCPartition(partition); + ipcPart = IPCPartition(partition) if not ipcPart.isValid(): - raise UserWarning("Partition %s invalid - cannot access magnetic field setting" % partition); + raise UserWarning("Partition %s invalid - cannot access magnetic field setting" % partition) #Get the current and valid status + # from ispy import ISObject # torCurrent = ISObject(ipcPart, 'DCS_GENERAL.MagnetToroidsCurrent.value', 'DdcFloatInfo') # solCurrent = ISObject(ipcPart, 'DCS_GENERAL.MagnetSolenoidCurrent.value', 'DdcFloatInfo') # torInvalid = ISObject(ipcPart, 'DCS_GENERAL.MagnetToroidsCurrent.invalid', 'DdcIntInfo') @@ -107,8 +102,8 @@ def GetBFields(): sys.exit(1) #print the result - mlog.info("Magnetic field in solenoid is %s" % ((solOn and "ON") or "OFF")) - mlog.info("Magnetic field in toroid is %s" % ((torOn and "ON") or "OFF")) + mlog.info("Magnetic field in solenoid is %s", ((solOn and "ON") or "OFF")) + mlog.info("Magnetic field in toroid is %s", ((torOn and "ON") or "OFF")) #finally return our values return (solCurrent, torCurrent) diff --git a/Reconstruction/RecExample/RecExOnline/python/comparison_plot.py b/Reconstruction/RecExample/RecExOnline/python/comparison_plot.py deleted file mode 100644 index 998b759b7ce1ab1651d07f91164380ce84e5446f..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExOnline/python/comparison_plot.py +++ /dev/null @@ -1,228 +0,0 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -""" -Draw comparison plots and statistical tables for each 2 histograms inside 2 data sets. -""" - -import rootpy.ROOT as ROOT -from rootpy.plotting.hist import Hist -from rootpy.plotting.style import get_style, set_style -import rootpy.plotting.root2matplotlib as rplt -import matplotlib -import matplotlib.pyplot as plt -import matplotlib.colors as colors -import matplotlib.ticker -import itertools -import numpy as np -import pandas as pd -import re -from collections import defaultdict -import HistCompare.test_statistics as TS -import copy -from UnbinnedHist import UnbinnedHist -from hash_tool import HashTool -matplotlib.rcParams["text.usetex"]=True -matplotlib.rcParams['text.latex.preamble']=['\\usepackage{booktabs}'] -def tree(): return defaultdict(tree) -#set_style('ATLAS',mpl=True) -def set_yaxis(ax, tick=None): - if tick == "%": - def to_percent(y, position): - s = format(100*y, '.1f') - if matplotlib.rcParams['text.usetex'] is True: - return s + r'$\%$' - else: - return s + '%' - formatter = matplotlib.ticker.FuncFormatter(to_percent) - ax.yaxis.set_major_formatter(formatter) -def identity(*x): - if len(x)==1: - return x[0] - return x -def formatted_plt_dict(plt_kw, length, **kwarg): - for i in range(length): - yield dict((key, val[i]) if np.iterable(val) else (key, val) for key, val in plt_kw.iteritems()) - -# keyword arguments for matplotlib.pyplot.text -TEXT_KW = { - "x": 0.94, - "y": 0.25, - "ha": "right", - "va": "center", - 'zorder': 2} - -# keyword arguments for auto_statistic_table -STATISTIC_TABLE_KW = { - "iterfunc": itertools.combinations, - "iterkey": {"r": 2}, - "row_title_func": identity, - "col_title_func": identity, - "table_fformat": ".2e", - "text_kw": TEXT_KW} - -# keyword arguments for matplotlib.pyplot.setp -AXES_KW = { - "ylim":(0,None)} - -# keyword arguments for matplotlib.pyplot.plot -PLT_KW = { - "linewidth": 2, - "color": None, - 'zorder': 1 - } - -def statistic_table_kw_func(ax): - statistic_table_kw = copy.deepcopy(STATISTIC_TABLE_KW) - statistic_table_kw["text_kw"].update({"axes": ax, "transform": ax.transAxes}) - return statistic_table_kw - -def auto_draw(hist_dict, cumulative = False, normalized = False, table = True, axes = None, frameon = True, cmap = plt.cm.brg, add_statistic_table_kw = {}, add_axes_kw = {}, add_plt_kw = {}): - """ - Draw comparison plots and statistical tables for each 2 histograms inside 2 data sets. - - Parameters - ---------- - hist_dict : pandas dataframe - Input data. *hist_dict* Should have 2 *rootpy.plotting.Hist*/*UnbinnedHist* instances - in each row. - cumulative : bool, optional - If True, then a histogram is computed where each bin gives the counts in that bin plus all bins for smaller - values. The last bin gives the total number of datapoints. If normed is also True then the histogram is - normalized such that the last bin equals 1. If cumulative evaluates to less than 0 (e.g., -1), the direction - of accumulation is reversed. In this case, if normed is also True, then the histogram is normalized such that - the first bin equals 1. - normalized : bool, optional - If False, the result will contain the number of samples in each bin. If True, the result is the value of the - probability density function at the bin, normalized such that the integral over the range is 1. - table : bool, optional - If True, places a statistical table on each axes. - axes : list of matplotlib axis, optional, default : None - if provided, plot on these axes. Note *axes* should have the same number as *hist_dict*. i.e.:: - >>> len(axes) = len(hist_dict) - frameon : bool, optional, default : True - If False, suppress drawing the figure frame - cmap : matplotlib.colors.Colormap instance or list of str, optional, default : plt.cm.brg - list of any matplotlib colors. - add_statistic_table_kw : dict, optional - Additional Keyword Arguments for ``statistic_table`` - add_axes_kw : dict, optional - Additional Keyword Arguments for ``matplotlib.pyplot.setp`` - add_plt_kw : dict, optional - dditional Keyword Arguments for ``matplotlib.pyplot.plot`` - - Returns - ------- - [ax1, ax2, ...] : list - list of matplotlib axes - """ - if axes == None: - axes = [plt.axes() for _ in hist_dict if plt.figure(frameon=frameon)] - for ax, kind in zip(axes, hist_dict): - statistic_table_kw = statistic_table_kw_func(ax) - statistic_table_kw.update(add_statistic_table_kw) - axes_kw = AXES_KW - axes_kw.update(add_axes_kw) - plt_kw = PLT_KW - plt_kw.update(add_plt_kw) - if cmap: - plt_kw["color"] = cmap(np.linspace(0, 1, len(hist_dict))) - plt_dicts = formatted_plt_dict(plt_kw, len(hist_dict)) - - for (i, h), d in zip(hist_dict[kind].iteritems(), plt_dicts): - entries = h.entries - h_ = h.clone("New1") - if normalized: - h_.Scale(1./h_.Integral()) - if cumulative: - arr = np.cumsum([bin.value for bin in h_ ]) - h_.set_content(arr) - for key, val in d.iteritems(): - setattr(h_,key,val) - rplt.hist(h_, label = "%s (%i)" % (statistic_table_kw["col_title_func"](i),entries), axes = ax) - - ######################################################################## - if np.all([type(v)==UnbinnedHist for v in hist_dict[kind].values]) and cumulative: - data_all = np.concatenate(map(UnbinnedHist.get_raw_data, hist_dict[kind].values)) - if normalized: - cdfs = [sorted(np.searchsorted(data.get_raw_data(), data_all, side='right')*1.0 / data.get_raw_data().shape[0]) for data in hist_dict[kind].values] - else: - cdfs = [sorted(np.searchsorted(data.get_raw_data(), data_all, side='right')) for data in hist_dict[kind].values] - for i, cdf, d in zip(hist_dict[kind].keys(), cdfs, plt_dicts): - plt.plot(sorted(data_all), cdf, label = "%s (%i)" % (statistic_table_kw["col_title_func"](i),entries), linestyle="--", axes = ax, **d) - ######################################################################## - - ax.legend() - if table: - df = auto_statistic_table(hist_dict[kind], ax=ax, ret_table=False, ret_text=False, **statistic_table_kw) - if HASH.objs: - textkw = statistic_table_kw["text_kw"].copy() - text = ax.text(textkw.pop("x"), textkw.pop("y"), df[0].to_latex(escape=False, sparsify=False, index_names=False).replace("\n",""), **textkw) - ax.set_xlabel(kind, fontsize=25) - - plt.setp(ax, **axes_kw) - if normalized: - ax.set_ylim(0,1) - set_yaxis(ax,tick='%') - if not cumulative: - ax.set_ylabel("Events", fontsize=25) - else: - ax.set_ylabel("Cumulative Events", fontsize=25) - return axes - -HASH = HashTool('hist_dict', ret_table=True) -@HASH -def auto_statistic_table(hist_dict, ax=None, ret_table=True, ret_text=True, **statistic_table_kw): - """Compute statistic tables for the 2 histograms in each row of *hist_dict*. - - Parameters - ---------- - hist_dict : pandas dataframe - Input data. *hist_dict* Should have 2 *rootpy.plotting.Hist*/*UnbinnedHist* instances - in each row. - ax : matplotlib axis, optional, default : None - if provided, plot on this axis - statistic_table_kw : dict, optional - Other keyword arguments - ret_table : bool, optional, default : True - If True, returns the formatted table in *list* form. - ret_text : bool, optional, default : True - If True, returns the formatted table in *latex* form. - - Returns - ------- - [text[, table]] : list - depending on *ret_table* and *ret_text*, returns a list with required inside. - """ - header = ["Type of Test", "Bin", "T","P","NDF","Description"] - df_ = pd.DataFrame() - textkw = statistic_table_kw["text_kw"].copy() - for (nA,A),(nB,B) in statistic_table_kw["iterfunc"](hist_dict.iteritems(), **statistic_table_kw["iterkey"]): - A_Arr_Binned = np.array([bin.value for bin in A.bins()]) - B_Arr_Binned = np.array([bin.value for bin in B.bins()]) - bin_str = A_Arr_Binned.shape[0] - Table=[#["$\chi^2$ Absolute Comparison", bin_str] + list(TS.chi2_2samp(A_Arr_Binned, B_Arr_Binned, normed=False, binned=True)) + ["Scipy + Modificatoin"], - ["$\chi^2$ Shape Comparison",bin_str] + list(TS.chi2_2samp(A_Arr_Binned, B_Arr_Binned, normed=True, binned=True)) + ["Scipy + Modificatoin"], - ["",bin_str, A.Chi2Test(B,"WW CHI2"), A.Chi2Test(B,"WW"),'',"ROOT"], - ["Likelihood Ratio Shape Comparison",bin_str]+list(TS.likelihoodratio_ksamp(A_Arr_Binned, B_Arr_Binned))+["Scipy + Modification"], - #["Likelihood Value Shape Comparison",bin_str]+list(TS.likelihoodvalue_ksamp(A_Arr_Binned, B_Arr_Binned))+["Scipy + Modification"], - #["BDM Shape Comparison",bin_str] + list(TS.BDM_2samp(A_Arr_Binned, B_Arr_Binned))+["Scipy + Modification"], - ["K-S Shape Comparison",bin_str] + list(TS.ks_2samp(A_Arr_Binned,B_Arr_Binned,binned=True))+ ["SciPy + Modification"], - ["",bin_str,A.KolmogorovTest(B,"M"), A.KolmogorovTest(B), '',"ROOT"], - ["A-D Shape Comparison",bin_str] + list(TS.anderson_ksamp(A_Arr_Binned, B_Arr_Binned, binned=True)) + ["Scipy + Modification"], - ["CVM Shape Comparison",bin_str] + list(TS.CVM_2samp(A_Arr_Binned, B_Arr_Binned, binned=True)) + ["Matlab"]] - - if type(A)==UnbinnedHist and type(B)==UnbinnedHist: - Table.insert(8, ["","Unbinned"] + list(TS.ks_2samp(A.get_raw_data(), B.get_raw_data(), binned=False)) + ["SciPy + Modification"]) - Table.insert(10, ["","Unbinned"] + list(TS.anderson_ksamp(A.get_raw_data(), B.get_raw_data(), binned=False)) + ["Scipy"]) - Table.insert(12, ["","Unbinned"] + list(TS.CVM_2samp(A.get_raw_data(), B.get_raw_data(), binned=False)) + ["Matlab"]) - - df=pd.DataFrame(Table, columns=header) - df["T/P"] = map(lambda tp: "/".join(["%"+statistic_table_kw["table_fformat"]]*2)%(tp[0],tp[1]), zip(df["T"],df.P)) - df_ = df[header] - text = ax.text(textkw.pop("x"), textkw.pop("y"), df_.to_latex(escape=False, sparsify=False, index_names=False).replace("\n",""), **textkw) - result = [] - if ret_text: - result.append(text) - if ret_table: - result.append(df_) - return result diff --git a/Reconstruction/RecExample/RecExOnline/python/hash_tool.py b/Reconstruction/RecExample/RecExOnline/python/hash_tool.py index fc00b999ddcbcf277405b3520b5b7932b4727783..272c5621d41f9df97d68708d4a666beeba831684 100644 --- a/Reconstruction/RecExample/RecExOnline/python/hash_tool.py +++ b/Reconstruction/RecExample/RecExOnline/python/hash_tool.py @@ -1,9 +1,7 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration import inspect import warnings -import numpy as np -import sys class HashTool: def __init__(self, *args, **parse): diff --git a/Reconstruction/RecExample/RecExOnline/python/power_of_test.py b/Reconstruction/RecExample/RecExOnline/python/power_of_test.py index d63c9bcb31d5b58b2fc4b99bc344419783bf57af..f4d83c8e9a5f81687ebe977065d1dfd282f237d8 100644 --- a/Reconstruction/RecExample/RecExOnline/python/power_of_test.py +++ b/Reconstruction/RecExample/RecExOnline/python/power_of_test.py @@ -1,9 +1,8 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from scipy.stats import rv_discrete import test_statistics as TS import numpy as np -import warnings # If True, import IPyParallel package to do the parallel computation. # And if IPyParallel is not installed, automatically turns it False. @@ -121,7 +120,7 @@ def power_of_test(data1, data2, rvs_func = 'rvs_pairs', tests = ['chi2_2samp'], [p1, p2, ...] : 1-D array The corresponding p-values for each histogram pairs. """ - if parallel == None: parallel = PARALLEL + if parallel is None: parallel = PARALLEL if parallel: try: global client @@ -131,7 +130,7 @@ def power_of_test(data1, data2, rvs_func = 'rvs_pairs', tests = ['chi2_2samp'], jobs = [] for i in range(N): rvs_key['size'] = (size//N + 1) if (i < size % N) else size//N - jobs.append(client[client.ids[i]].apply_async(power_of_test, data1, data2, rvs_func, test, rvs_key, test_key, False)) + jobs.append(client[client.ids[i]].apply_async(power_of_test, data1, data2, rvs_func, tests, rvs_key, test_key, False)) ars = client._asyncresult_from_jobs(jobs) if sync: ars.wait_interactive() diff --git a/Reconstruction/RecExample/RecExOnline/python/test_statistics.py b/Reconstruction/RecExample/RecExOnline/python/test_statistics.py index 3e956af00ed1f794665be69dddd5b0ae7cff02f6..1d949bc8f10dfbd43f03ee3924ea1866dc86ebef 100644 --- a/Reconstruction/RecExample/RecExOnline/python/test_statistics.py +++ b/Reconstruction/RecExample/RecExOnline/python/test_statistics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """ Test statistic functions. """ @@ -8,6 +8,7 @@ import numpy as np import scipy.stats import scipy.interpolate import scipy.special +import statsmodels.api as sm import warnings import distributions as distr from sympy import binomial, log @@ -94,7 +95,7 @@ def ks_2samp(data1, data2, binned=False): (0.07999999999999996, 0.41126949729859719) """ - if binned == True: + if binned is True: cdf1 = np.cumsum(data1) cdf2 = np.cumsum(data2) n1 = cdf1[-1] @@ -106,7 +107,7 @@ def ks_2samp(data1, data2, binned=False): n1 = data1.shape[0] n2 = data2.shape[0] ndf = float("nan") - if binned == False: + if binned is False: data1 = np.sort(data1) data2 = np.sort(data2) data_all = np.concatenate([data1, data2]) @@ -129,7 +130,7 @@ def ks_2samp(data1, data2, binned=False): en = np.sqrt(n1 * n2 / float(n1 + n2)) try: prob = scipy.stats.distributions.kstwobign.sf((en + 0.12 + 0.11 / en) * d) - except: + except Exception: prob = 1.0 if DEBUG: global statistic_seq @@ -169,7 +170,7 @@ def chi2_2samp(data1, data2, normed=True, binned=True): This code is modified from scipy.stats.chisquare and extended with supporting on 2 sample cases and shape comparison test. """ - if binned == True: + if binned is True: filter = ~((data1 == 0.) & (data2 == 0.)) data1 = data1[filter] data2 = data2[filter] @@ -385,7 +386,7 @@ def _anderson_ksamp_right(samples, Z, Zstar, k, n, N): A2kN = 0. lj = Z.searchsorted(Zstar[:-1], 'right') - Z.searchsorted(Zstar[:-1], 'left') Bj = lj.cumsum() - for i in arange(0, k): + for i in range(0, k): s = np.sort(samples[i]) Mij = s.searchsorted(Zstar[:-1], side='right') inner = lj / float(N) * (N * Mij - Bj * n[i])**2 / (Bj * (N - Bj)) diff --git a/Reconstruction/RecExample/RecExOnline/python/to_root.py b/Reconstruction/RecExample/RecExOnline/python/to_root.py deleted file mode 100644 index c355b1cf8d3b25c8f9e7ea5416b3280a2f7e7f9b..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExOnline/python/to_root.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -import ROOT -import numpy as np -import warnings -def fill_branch_by_arr(filename ,treename, list_of_branchname, list_of_entrylist): - of = ROOT.TFile(filename, 'update') - if of.GetListOfKeys().Contains(treename): - t = of.Get(treename) - warnings.warn('%r exsists.' % t, Warning) - else: - t = ROOT.TTree(treename, treename) - for branchname, entrylist in zip(list_of_branchname, list_of_entrylist): - t.SetEntries(entrylist.size) - address = np.zeros(1, 'float32') - br = t.Branch(branchname, address, branchname+'/F') - for en in entrylist: - address[0] = en - br.Fill() - of.Write("", 2) - of.Close() \ No newline at end of file diff --git a/Reconstruction/RecExample/RecExOnline/python/utils.py b/Reconstruction/RecExample/RecExOnline/python/utils.py index 205690c7d8d2e23e883caa0ab5ee228d6406b727..64568d05abd3cb4f6677bd1508ca156d2c36959a 100644 --- a/Reconstruction/RecExample/RecExOnline/python/utils.py +++ b/Reconstruction/RecExample/RecExOnline/python/utils.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from collections import defaultdict import numpy as np def tree(key_wrapper = None): @@ -15,10 +15,10 @@ def get_array(hist): arr.SetSize(hist.GetNbinsX() + 2) return np.fromiter(arr, np.float) -TAIL = lambda s: u' └── {} '.format(s) -BRANCH = lambda s: u' ├── {} '.format(s) -LINE = lambda s: u' │ {} '.format(s) -SPACE = lambda s: u' {} '.format(s) +TAIL = lambda s: u' └── {} '.format(s) # noqa: E731 +BRANCH = lambda s: u' ├── {} '.format(s) # noqa: E731 +LINE = lambda s: u' │ {} '.format(s) # noqa: E731 +SPACE = lambda s: u' {} '.format(s) # noqa: E731 class TreeDict(defaultdict): def __init__(self, dic = {}, key_wrapper=None): super(defaultdict,self).__init__(dic) diff --git a/Reconstruction/RecExample/RecExOnline/share/RootHis_RTT.C b/Reconstruction/RecExample/RecExOnline/share/RootHis_RTT.C deleted file mode 100644 index cd21069e99e5a329662e71f3e096652f2db4d725..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExOnline/share/RootHis_RTT.C +++ /dev/null @@ -1,26 +0,0 @@ -#include <iostream> -#include <string> -#include <fstream> - -#include "TH1F.h" -#include "TFile.h" -#include "TCanvas.h" -#include "TSystem.h" -#include "TKey.h" - -void RootHis_RTT() -{ - - TFile *file = new TFile("Monitor.root"); - -// TH1F *h1_AK4LCTTopoJetsPt= (TH1F*)gDirectory->FindObjectAny("Jets/AntiKt4LCTTopoJets/pt"); - TH1F *h1_AK4LCTTopoJetsPt= (TH1F*)gDirectory->FindObjectAny("pt"); - - TCanvas *c1 = new TCanvas("c1", "GIF Canvas", 400, 300); - h1_AK4LCTTopoJetsPt->Draw("HistE"); - c1->Print("AK4LCTTopoJetsPt.png"); - - - -} - diff --git a/Reconstruction/RecExample/RecExOnline/share/SimpleJobOptions_ForRTT.py b/Reconstruction/RecExample/RecExOnline/share/SimpleJobOptions_ForRTT.py deleted file mode 100644 index b9728ff2d1e955d32d27fd8c2f4992374d981c0e..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExOnline/share/SimpleJobOptions_ForRTT.py +++ /dev/null @@ -1 +0,0 @@ -theApp.EvtMax = 5 diff --git a/Reconstruction/RecExample/RecExOnline/test/RecExOnline_TestConfiguration.xml b/Reconstruction/RecExample/RecExOnline/test/RecExOnline_TestConfiguration.xml deleted file mode 100755 index da82fc248d93be0230de70604b8a4272066d2a33..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecExOnline/test/RecExOnline_TestConfiguration.xml +++ /dev/null @@ -1,386 +0,0 @@ -<?xml version="1.0"?> -<!-- MB: Search for RUNNUMBER to replace the run input collections and setting --> -<!-- MB: xml file validation: http://www.hep.ucl.ac.uk/atlas/AtlasTesting/DTD/onlineValidation/validator.html --> -<!-- <!DOCTYPE unifiedTestConfiguration SYSTEM "https://test-rtt.web.cern.ch/test-rtt/brinick/Results/unifiedTestConfiguration.dtd"> --> <!-- xmltest --> -<!DOCTYPE unifiedTestConfiguration SYSTEM "http://www.hep.ucl.ac.uk/atlas/AtlasTesting/DTD/unifiedTestConfiguration.dtd"> <!-- official --> -<!-- A test version --> - -<unifiedTestConfiguration> - - <atn/> - <kv/> - <rtt xmlns="http://www.hep.ucl.ac.uk/atlas/AtlasTesting/rtt"> - <rttContactPerson>Yun-Ju Lu</rttContactPerson> - <mailto>yunju@cern.ch</mailto> - <refRelease>20.1.X.Y</refRelease> - <jobList> - - <chain> - <chainName>OfflineChainJob</chainName> - <sequential> - <chainElement> - <jobTransform userJobId="RecExOnline_User_Offline_test_v1"> - <doc>Recexonline test</doc> - <jobTransformJobName>First_RecexOnline_test</jobTransformJobName> - <jobTransformCmd> - athena.py -c "inpuevtMax=850" RecExOnline/RecExOnline_User_Offline.py - </jobTransformCmd> - <group>RecExOnline_Test</group> - <queue>medium</queue> - - -<!-- - - <test> - <modulename>RttLibraryTools</modulename> - <testname>FileGrepper</testname> - - - <arg> - <fileGrepperArgs> - <fileGrepperInputFile>*v1_log</fileGrepperInputFile> - - <fileGrepperSearchPattern> - <fileGrepperPattern>Number of events processed</fileGrepperPattern> - </fileGrepperSearchPattern> - </fileGrepperArgs> - </arg> - </test> - - <test> - <modulename>RttLibraryTools</modulename> - <testname>ROOTMacroRunner</testname> - <arg> - <argname>macro</argname> - <argvalue>RootHis_RTT.C</argvalue> - </arg> - </test> - - <test> - <modulename>RttLibraryTools</modulename> - <testname>ROOTMacroRunner</testname> - <arg> - <argname>macro</argname> - <argvalue>RecExOnline_Test_Obj_His_RTT.C</argvalue> - </arg> - </test> ---> - <test position="1"> - <modulename>RttLibraryTools</modulename> - <testname>ROOTMacroRunner</testname> - <arg> - <argname>macro</argname> - <argvalue>RecExOnline_Test_Obj_His_RTT_Cpp_rename.C</argvalue> - </arg> - </test> - - <alwaysRunPostProc /> - </jobTransform> - <chainfileout>Monitor.root</chainfileout> - </chainElement> - - <chainElement> - <jobTransform userJobId="RTTAlgs"> - <doc>RTTAlgs</doc> - <jobTransformJobName>RTTAlgs</jobTransformJobName> - <jobTransformCmd> - athena.py RecExOnline/RTTAlgmain.py - </jobTransformCmd> - <group>RecExOnline_Test</group> - - <chaindataset_info> - <jobTransformData /> - <chaindatasetName>Monitor.root</chaindatasetName> - <!-- If the file on the previous line is not in the chain store, then use the following fallback file. --> - <dataset_info> - <jobTransformData /> - <datasetName>/afs/cern.ch/user/y/yunju/working/yunju/public/GM_ref_plots/Monitor.root</datasetName> - </dataset_info> - </chaindataset_info> - <testToRemove> - <jobGroupName>AthenaRecExOnline_Test</jobGroupName> - <testidentifier>FileGrepperprocessed</testidentifier> - </testToRemove> - - <alwaysRunPostProc /> - </jobTransform> - </chainElement> - - <chainElement> - <jobTransform userJobId="ohp_hispathcheck"> - <doc>ohp_hispathcheck</doc> - <jobTransformJobName>ohp_hispathcheck</jobTransformJobName> - <jobTransformCmd> - athena.py RecExOnline/Rtt_histogram.py - </jobTransformCmd> - <group>RecExOnline_Test</group> - - <testToRemove> - <jobGroupName>AthenaRecExOnline_Test</jobGroupName> - <testidentifier>FileGrepperprocessed</testidentifier> - </testToRemove> - - <alwaysRunPostProc /> - </jobTransform> - </chainElement> - - </sequential> - </chain> - - - <jobTransform userJobId="Online_reconstruction_autoconfiguration_test_v1"> - <doc>Recexonline test Online_reconstruction_autoconfiguration</doc> - <jobTransformJobName>Online_reconstruction_autoconfiguration_test_v1</jobTransformJobName> - <jobTransformCmd> - athena.py -c "REO_doAutoConfiguration=True" RecExOnline/RecExOnline_User_Offline_isOnlineTrue.py - </jobTransformCmd> - <group>RecExOnline_Test</group> - <queue>medium</queue> - <test position="1"> - <modulename>RttLibraryTools</modulename> - <testname>ROOTMacroRunner</testname> - <arg> - <argname>macro</argname> - <argvalue>RecExOnline_Test_Obj_His_RTT_Cpp_Online.C</argvalue> - </arg> - </test> - - - - - <alwaysRunPostProc /> - </jobTransform> - - <jobTransform userJobId="Online_reconstruction_autoconfiguration_False_test_v1"> - <doc>Recexonline test Online_reconstruction_autoconfiguration_False</doc> - <jobTransformJobName>Online_reconstruction_autoconfiguration_False_test_v1</jobTransformJobName> - <jobTransformCmd> - athena.py -c "REO_doAutoConfiguration=False" RecExOnline/RecExOnline_User_Offline_isOnlineTrue.py - </jobTransformCmd> - <group>RecExOnline_Test</group> - <queue>medium</queue> - <test position="1"> - <modulename>RttLibraryTools</modulename> - <testname>ROOTMacroRunner</testname> - <arg> - <argname>macro</argname> - <argvalue>RecExOnline_Test_Obj_His_RTT_Cpp_Online.C</argvalue> - </arg> - </test> - - - - - - - <alwaysRunPostProc /> - </jobTransform> - - <jobTransform userJobId="Online_reconstruction_autoconfiguration_False_cosmics_test_v1"> - <doc>Recexonline test Online_reconstruction_autoconfiguration_False_cosmics</doc> - <jobTransformJobName>Online_reconstruction_autoconfiguration_False_cosmics_test_v1</jobTransformJobName> - <jobTransformCmd> - athena.py -c "REO_doAutoConfiguration=False; beamType='cosmics'" RecExOnline/RecExOnline_User_Offline_isOnlineTrue.py - </jobTransformCmd> - <group>RecExOnline_Test</group> - <queue>medium</queue> - <test position="1"> - <modulename>RttLibraryTools</modulename> - <testname>ROOTMacroRunner</testname> - <arg> - <argname>macro</argname> - <argvalue>RecExOnline_Test_Obj_His_RTT_Cpp_Online.C</argvalue> - </arg> - </test> - - <alwaysRunPostProc /> - </jobTransform> - - <jobTransform userJobId="RTTTool_test_v1"> - <doc>RTTTool_test_v1</doc> - <jobTransformJobName>RTTTool_test_v1</jobTransformJobName> - <jobTransformCmd> - athena.py RecExOnline/SimpleJobOptions_ForRTT.py - </jobTransformCmd> - <group>RecExOnline_Test</group> - - <testToRemove> - <jobGroupName>AthenaRecExOnline_Test</jobGroupName> - <testidentifier>FileGrepperprocessed</testidentifier> - </testToRemove> - - <alwaysRunPostProc /> - </jobTransform> - - - - - </jobList> - <jobGroups> - <jobGroup name="AthenaRecExOnline_Test" parent="Athena"> - <keepFilePattern>*.root</keepFilePattern> - <keepFilePattern>*.png</keepFilePattern> - <keepFilePattern>testlog*.log</keepFilePattern> - <keepFilePattern>RTTAlg.html</keepFilePattern> - <keepFilePattern>P1MON_RTT_result_template_v1.html</keepFilePattern> - <auxFilePattern>RootHis*.C</auxFilePattern> - <auxFilePattern>RecExOnline_Test*.C</auxFilePattern> - <auxFilePattern>RecExOnline_Test_Obj_His_RTT.C</auxFilePattern> - <auxFilePattern>RecExOnline_Test_Obj_His_RTT_CINT.C</auxFilePattern> - -<!-- - <action> - <modulename>RttLibraryTools</modulename> - <testname>ROOTMacroRunner</testname> - <arg> - <argname>macro</argname> - <argvalue>RecExOnline_Test_Obj_His_RTT.C</argvalue> - </arg> - </action> - <action> - <modulename>RttLibraryTools</modulename> - <testname>ROOTMacroRunner</testname> - <arg> - <argname>macro</argname> - <argvalue>RecExOnline_Test_Obj_His_RTT_CINT.C</argvalue> - </arg> - </action> - <action> - <modulename>RttLibraryTools</modulename> - <testname>ROOTMacroRunner</testname> - <arg> - <argname>macro</argname> - <argvalue>RecExOnline_Test_Obj_His_RTT_CINT.C</argvalue> - </arg> - </action> ---> - - - <test position="2"> - - <modulename>RttLibraryTools</modulename> - <testname>FileGrepper</testname> - <testidentifier>FileGrepperprocessed</testidentifier> - - <arg> - <argname>inputFile</argname> - <argvalue>*v1_log</argvalue> <!-- put this one if you use job log --> - </arg> - <arg> - <argname>outputFile</argname> - <argvalue>testlogprocessed.log</argvalue> - </arg> - <arg> - <argname>searchList</argname> - <argvalue>Number of events processed</argvalue> <!-- put here the string you should find to mean all ok --> - </arg> - </test> - - <test position="3"> - - <modulename>RttLibraryTools</modulename> - <testname>FileGrepper</testname> - <testnegate /> - <testidentifier>FileGrepperERROR3</testidentifier> - <arg> - <argname>inputFile</argname> - <argvalue>*v1_log</argvalue> <!-- put this one if you use job log --> - </arg> - <arg> - <argname>outputFile</argname> - <argvalue>testlogError.log</argvalue> - </arg> - <arg> - <argname>searchList</argname> - <argvalue>ERROR</argvalue> <!-- put here the string you should find to mean all ok --> - - </arg> - <noalarm /> - </test> - <test position="4"> - - <modulename>RttLibraryTools</modulename> - <testname>FileGrepper</testname> - <testidentifier>FileGrepperERROR4</testidentifier> - - <arg> - <argname>inputFile</argname> - <argvalue>*v1_log</argvalue> <!-- put this one if you use job log --> - </arg> - <arg> - <argname>outputFile</argname> - <argvalue>testlogError2.log</argvalue> - </arg> - <arg> - <argname>searchList</argname> - <argvalue>ERROR</argvalue> <!-- put here the string you should find to mean all ok --> - - </arg> - <noalarm /> - </test> - - - <test position="5"> - - <modulename>RttLibraryTools</modulename> - <testname>FileGrepper</testname> - <testnegate /> - - <testidentifier>FileGrepperFATAL</testidentifier> - - <arg> - <argname>inputFile</argname> - <argvalue>*v1_log</argvalue> <!-- put this one if you use job log --> - </arg> - <arg> - <argname>outputFile</argname> - <argvalue>testlogFATAL.log</argvalue> - </arg> - <arg> - <argname>searchList</argname> - <argvalue>FATAL</argvalue> <!-- put here the string you should find to mean all ok --> - - </arg> - - </test> - - <test position="6"> - - <modulename>RttLibraryTools</modulename> - <testname>FileGrepper</testname> - <testnegate /> - <testidentifier>FileGrepperTraceback</testidentifier> - - <arg> - <argname>inputFile</argname> - <argvalue>*v1_log</argvalue> <!-- put this one if you use job log --> - </arg> - <arg> - <argname>outputFile</argname> - <argvalue>testlogTraceback.log</argvalue> - </arg> - <arg> - <argname>searchList</argname> - <argvalue>Traceback</argvalue> <!-- put here the string you should find to mean all ok --> - </arg> - <noalarm /> - </test> - - <testToRemove> - <jobGroupName>RTT:Top</jobGroupName> - <testidentifier>CheckFileRunner0</testidentifier> - </testToRemove> - <testToRemove> - <jobGroupName>RTT:Athena</jobGroupName> - <testidentifier>Athena_FileGrepper</testidentifier> - </testToRemove> - - </jobGroup> - </jobGroups> - - - - - - </rtt> -</unifiedTestConfiguration>