Skip to content
Snippets Groups Projects
Commit f3fdb3cd authored by Luzhan Yue's avatar Luzhan Yue Committed by Walter Lampl
Browse files

added yoda to root converter for Pythia ART tests

parent b68eee3d
6 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!42080added yoda to root converter for Pythia ART tests
from array import array
import ROOT as rt
import yoda
fName = 'MyOutput.yoda.gz'
yodaAOs = yoda.read(fName)
rtFile = rt.TFile(fName[:fName.find('.yoda')] + '.root', 'recreate')
for name_slashes in yodaAOs:
name = name_slashes.replace("/", "_")
yodaAO = yodaAOs[name_slashes]
rtAO = None
if 'Histo1D' in str(yodaAO):
rtAO = rt.TH1D(name, '', yodaAO.numBins(), array('d', yodaAO.xEdges()))
rtAO.Sumw2()
rtErrs = rtAO.GetSumw2()
for i in range(rtAO.GetNbinsX()):
rtAO.SetBinContent(i + 1, yodaAO.bin(i).sumW())
rtErrs.AddAt(yodaAO.bin(i).sumW2(), i+1)
elif 'Scatter2D' in str(yodaAO):
rtAO = rt.TGraphAsymmErrors(yodaAO.numPoints())
rtAO.SetName(name)
for i in range(yodaAO.numPoints()):
x = yodaAO.point(i).x(); y = yodaAO.point(i).y()
xLo, xHi = yodaAO.point(i).xErrs()
yLo, yHi = yodaAO.point(i).yErrs()
rtAO.SetPoint(i, x, y)
rtAO.SetPointError(i, xLo, xHi, yLo, yHi)
else:
continue
rtAO.Write(name)
rtFile.Close()
......@@ -16,17 +16,19 @@ Gen_tf.py --ecmEnergy=13000. --maxEvents=10000 --firstEvent=-1 --randomSeed=1234
echo "art-result:$? Gen_tf"
python /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Pythia8i/rootconvert.py MyOutput.yoda.gz
python rootconvert.py MyOutput.yoda.gz
dcubeName = "Pythia8i"
echo "art-result: $? convert"
dcubeName="Pythia8i"
dcubeXml="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Pythia8i/test_01_Z_tautau/config_Ztt.xml"
dcubeRef="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Pythia8i/test_01_Z_tautau/MyOutput.root"
#dcubeName="Pythia8i"
#dcubeXml="/afs/cern.ch/user/l/lyue//Qualification_task_ART/Pythia_8/DcubeReference/test_01_Z_tautau/config_Ztt.xml"
#dcubeRef="/afs/cern.ch/user/l/lyue//Qualification_task_ART/Pythia_8/DcubeReference/test_01_Z_tautau/MyOutput.root"
#dcubeXml="/afs/cern.ch/user/l/lyue/Qualification_task_ART/Pythia_8/DcubeReference/test_01_Z_tautau/config_Ztt.xml"
#dcubeRef="/afs/cern.ch/user/l/lyue/Qualification_task_ART/Pythia_8/result_grid/testscripts/test_01_Z_tautau/MyOutput.root"
bash /cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube $dcubeName MyOutput.root $dcubeXml $dcubeRef
#yodadiff -o yodadiff MyOutput.yoda.gz ~/Qualification_task_ART/Pythia_8/result/Pythia_8/test_01_Z_tautau/MyOutput.yoda.gz # use this for histogram comparison if one only care if they are exactly the same
#yodadiff -o yodadiff MyOutput.yoda.gz ~/Qualification_task_ART/Pythia_8/result/Pythia_8/test_00_Zprime_1000_tt/MyOutput.yoda.gz # use this for histogram comparison if one only care if they are exactly the same
echo "art-result: $? Dcube"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment