From 9eba21530dbeed6ea86f77077f6e814c0d1755fc Mon Sep 17 00:00:00 2001 From: Tamara Vazquez Schroeder <tvazquez@cern.ch> Date: Wed, 6 Jan 2021 12:01:20 +0100 Subject: [PATCH] creating metadata json output file --- Trigger/TrigCost/RatesAnalysis/python/Util.py | 11 +++++++++++ .../TrigCost/RatesAnalysis/src/RatesAnalysisAlg.cxx | 2 ++ 2 files changed, 13 insertions(+) diff --git a/Trigger/TrigCost/RatesAnalysis/python/Util.py b/Trigger/TrigCost/RatesAnalysis/python/Util.py index 934582fa845b..451367a7b7fe 100644 --- a/Trigger/TrigCost/RatesAnalysis/python/Util.py +++ b/Trigger/TrigCost/RatesAnalysis/python/Util.py @@ -90,6 +90,15 @@ def toJson(fileName, metadata, L1Triggers, HLTTriggers): with open(fileName, 'w') as outFile: json.dump(obj=jsonDict, fp=outFile, indent=2, sort_keys=True) + metajsonDict = {} + metajsonDict['PredictionLumi'] = metadata['targetLumi'] + metajsonDict['TargetMu'] = metadata['targetMu'] + metajsonDict['RunNumber'] = metadata['runNumber'] + metajsonDict['NEvents'] = metadata['n_evts'] + + with open('metadata.json', 'w') as outMetaFile: + json.dump(obj=metajsonDict, fp=outMetaFile, indent=2, sort_keys=True) + def getMetadata(inputFile): metatree = inputFile.Get("metadata") @@ -99,6 +108,8 @@ def getMetadata(inputFile): metatree.GetEntry(0) metadata = {} + metadata['runNumber'] = metatree.runNumber + metadata['targetMu'] = metatree.targetMu metadata['targetBunches'] = metatree.targetBunches metadata['targetLumi'] = metatree.targetLumi diff --git a/Trigger/TrigCost/RatesAnalysis/src/RatesAnalysisAlg.cxx b/Trigger/TrigCost/RatesAnalysis/src/RatesAnalysisAlg.cxx index 334acf1f1d37..4b2388c32c84 100644 --- a/Trigger/TrigCost/RatesAnalysis/src/RatesAnalysisAlg.cxx +++ b/Trigger/TrigCost/RatesAnalysis/src/RatesAnalysisAlg.cxx @@ -696,6 +696,8 @@ void RatesAnalysisAlg::writeMetadata() { return; } + m_metadataTree->Branch("runNumber", &m_enhancedBiasRatesTool->RunNumber); + m_metadataTree->Branch("targetMu", &m_targetMu); m_metadataTree->Branch("targetBunches", &m_targetBunches); m_metadataTree->Branch("targetLumi", &m_targetLumi); -- GitLab