Skip to content
Snippets Groups Projects
Commit 727772fa authored by Christos Anastopoulos's avatar Christos Anastopoulos Committed by Adam Edward Barton
Browse files

eg_resolution try to simplify a bit the selection of files

eg_resolution try to simplify a bit the selection of files
parent 4a51c451
No related branches found
No related tags found
29 merge requests!78241Draft: FPGATrackSim: GenScan code refactor,!78236Draft: Switching Streams https://its.cern.ch/jira/browse/ATR-27417,!78056AFP monitoring: new synchronization and cleaning,!78041AFP monitoring: new synchronization and cleaning,!77990Updating TRT chip masks for L1TRT trigger simulation - ATR-28372,!77733Draft: add new HLT NN JVT, augmented with additional tracking information,!77731Draft: Updates to ZDC reconstruction,!77728Draft: updates to ZDC reconstruction,!77522Draft: sTGC Pad Trigger Emulator,!76725ZdcNtuple: Fix cppcheck warning.,!76611L1CaloFEXByteStream: Fix out-of-bounds array accesses.,!76475Punchthrough AF3 implementation in FastG4,!76474Punchthrough AF3 implementation in FastG4,!76343Draft: MooTrackBuilder: Recalibrate NSW hits in refine method,!75729New implementation of ZDC nonlinear FADC correction.,!75703Draft: Update to HI han config for HLT jets,!75184Draft: Update file heavyions_run.config,!74430Draft: Fixing upper bound for Delayed Jet Triggers,!73963Changing the path of the histograms to "Expert" area,!73875updating ID ART reference plots,!73874AtlasCLHEP_RandomGenerators: Fix cppcheck warnings.,!73449Add muon detectors to DarkJetPEBTLA partial event building,!73343Draft: [TrigEgamma] Add photon ringer chains on bootstrap mechanism,!72336Fixed TRT calibration crash,!72176Draft: Improving L1TopoOnline chain that now gets no-empty plots. Activating it by default,!72012Draft: Separate JiveXMLConfig.py into Config files,!71876Fix MET trigger name in MissingETMonitoring,!71820Draft: Adding new TLA End-Of-Fill (EOF) chains and removing obsolete DIPZ chains,!71620eg_resolution try to simplify a bit the selection of files
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include "egammaUtils/eg_resolution.h"
......@@ -9,7 +9,10 @@
#include "xAODEgamma/Photon.h"
#include <cassert>
#include <stdexcept>
#include <map>
#include <string>
namespace{
template<typename T>
std::unique_ptr<T>
get_object(TFile& file, const std::string& name)
......@@ -21,69 +24,58 @@ get_object(TFile& file, const std::string& name)
obj->SetDirectory(nullptr);
return std::unique_ptr<T>(obj);
}
}
eg_resolution::eg_resolution(const std::string& configuration)
{
static const std::map<std::string, std::array<std::string, 4>> fileMap = {
{"run1",
{"ElectronPhotonFourMomentumCorrection/v5/"
"resolutionFit_electron_run1.root",
"ElectronPhotonFourMomentumCorrection/v5/"
"resolutionFit_recoUnconv_run1.root",
"ElectronPhotonFourMomentumCorrection/v5/"
"resolutionFit_recoConv_run1.root",
"ElectronPhotonFourMomentumCorrection/v5/"
"resolutionFit_trueUnconv_run1.root"}},
{"run2_pre",
{"ElectronPhotonFourMomentumCorrection/v5/"
"resolutionFit_electron_run2_pre.root",
"ElectronPhotonFourMomentumCorrection/v5/"
"resolutionFit_recoUnconv_run2_pre.root",
"ElectronPhotonFourMomentumCorrection/v5/"
"resolutionFit_recoConv_run2_pre.root",
"ElectronPhotonFourMomentumCorrection/v5/"
"resolutionFit_trueUnconv_run2_pre.root"}},
{"run2_R21_v1",
{"ElectronPhotonFourMomentumCorrection/v20/"
"resolutionFit_electron_run2_release21_es2017_R21_v1.root",
"ElectronPhotonFourMomentumCorrection/v20/"
"resolutionFit_recoUnconv_run2_release21_es2017_R21_v1.root",
"ElectronPhotonFourMomentumCorrection/v20/"
"resolutionFit_recoConv_run2_release21_es2017_R21_v1.root",
"ElectronPhotonFourMomentumCorrection/v20/"
"resolutionFit_trueUnconvertedPhoton_run2_release21_es2017_R21_v1.root"}}};
std::unique_ptr<TFile> file0;
std::unique_ptr<TFile> file1;
std::unique_ptr<TFile> file2;
std::unique_ptr<TFile> file3;
if (configuration == "run1") {
file0 = std::make_unique<TFile>(
PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v5/"
"resolutionFit_electron_run1.root")
.c_str());
file1 = std::make_unique<TFile>(
PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v5/"
"resolutionFit_recoUnconv_run1.root")
.c_str());
file2 = std::make_unique<TFile>(
PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v5/"
"resolutionFit_recoConv_run1.root")
.c_str());
file3 = std::make_unique<TFile>(
PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v5/"
"resolutionFit_trueUnconv_run1.root")
.c_str());
} else if (configuration == "run2_pre") {
file0 = std::make_unique<TFile>(
PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v5/"
"resolutionFit_electron_run2_pre.root")
.c_str());
file1 = std::make_unique<TFile>(
PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v5/"
"resolutionFit_recoUnconv_run2_pre.root")
.c_str());
file2 = std::make_unique<TFile>(
PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v5/"
"resolutionFit_recoConv_run2_pre.root")
.c_str());
file3 = std::make_unique<TFile>(
PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v5/"
"resolutionFit_trueUnconv_run2_pre.root")
.c_str());
} else if (configuration == "run2_R21_v1") {
file0 = std::make_unique<TFile>(
PathResolverFindCalibFile(
"ElectronPhotonFourMomentumCorrection/v20/"
"resolutionFit_electron_run2_release21_es2017_R21_v1.root")
.c_str());
file1 = std::make_unique<TFile>(
PathResolverFindCalibFile(
"ElectronPhotonFourMomentumCorrection/v20/"
"resolutionFit_recoUnconv_run2_release21_es2017_R21_v1.root")
.c_str());
file2 = std::make_unique<TFile>(
PathResolverFindCalibFile(
"ElectronPhotonFourMomentumCorrection/v20/"
"resolutionFit_recoConv_run2_release21_es2017_R21_v1.root")
.c_str());
file3 = std::make_unique<TFile>(
PathResolverFindCalibFile(
"ElectronPhotonFourMomentumCorrection/v20/"
"resolutionFit_trueUnconvertedPhoton_run2_release21_es2017_R21_v1.root")
.c_str());
auto config = fileMap.find(configuration);
if (config != fileMap.end()) {
const std::array<std::string, 4>& files = config->second;
file0 =
std::make_unique<TFile>(PathResolverFindCalibFile(files[0]).c_str());
file1 =
std::make_unique<TFile>(PathResolverFindCalibFile(files[1]).c_str());
file2 =
std::make_unique<TFile>(PathResolverFindCalibFile(files[2]).c_str());
file3 =
std::make_unique<TFile>(PathResolverFindCalibFile(files[3]).c_str());
}
if (!file0 or !file1 or !file2 or !file3) {
throw std::runtime_error("cannot find input file for resolutions");
}
......
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