Skip to content
Snippets Groups Projects
Commit be046d41 authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge branch 'dev/EG4momcorr_r21tor22' into 'master'

Import ElectronPhotonFourMomentumCorrection r21.2->r22

See merge request atlas/athena!38718
parents 4bea6150 aed6204c
No related branches found
No related tags found
No related merge requests found
Showing
with 2131 additions and 1662 deletions
...@@ -20,10 +20,10 @@ atlas_add_library( ElectronPhotonFourMomentumCorrectionLib ...@@ -20,10 +20,10 @@ atlas_add_library( ElectronPhotonFourMomentumCorrectionLib
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools AsgMessagingLib xAODCaloEvent xAODEgamma LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools AsgMessagingLib xAODCaloEvent xAODEgamma
xAODEventInfo PATInterfaces EgammaAnalysisInterfacesLib PATCoreAcceptLib xAODEventInfo PATInterfaces EgammaAnalysisInterfacesLib egammaUtils PATCoreAcceptLib
xAODRootAccess xAODTracking xAODRootAccess xAODTracking
PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} AthLinks xAODMetaData egammaLayerRecalibTool PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} AthLinks xAODMetaData egammaLayerRecalibTool
egammaMVACalibAnalysisLib egammaUtils PathResolver ${extra_libs} ) egammaMVACalibAnalysisLib PathResolver ${extra_libs} )
if( NOT XAOD_STANDALONE ) if( NOT XAOD_STANDALONE )
atlas_add_component( ElectronPhotonFourMomentumCorrection atlas_add_component( ElectronPhotonFourMomentumCorrection
...@@ -65,16 +65,6 @@ if( XAOD_STANDALONE ) ...@@ -65,16 +65,6 @@ if( XAOD_STANDALONE )
xAODCaloEvent xAODCore PATInterfaces ElectronPhotonFourMomentumCorrectionLib ) xAODCaloEvent xAODCore PATInterfaces ElectronPhotonFourMomentumCorrectionLib )
endif() endif()
# Test(s) in the package:
if( XAOD_STANDALONE )
# FIX ME: these tests were temporarily disabled as they were
# failing in the nightlies.
# atlas_add_test( ut_test SCRIPT test/ut_test.py )
# atlas_add_test( ut_test_factory SCRIPT test/ut_test_factory.py )
# atlas_add_test( ut_test_resolution SCRIPT test/ut_test_resolution.py )
endif()
# Install files from the package: # Install files from the package:
atlas_install_python_modules( python/*.py ) atlas_install_python_modules( python/*.py )
atlas_install_joboptions( share/*.py ) atlas_install_joboptions( share/*.py )
// Dear Emacs, this is -*- C++ -*-
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
...@@ -57,7 +55,7 @@ namespace xAOD { ...@@ -57,7 +55,7 @@ namespace xAOD {
inline float get_eta_calo(const xAOD::CaloCluster& cluster, int author, bool do_throw=false) inline float get_eta_calo(const xAOD::CaloCluster& cluster, int author, bool do_throw=false)
{ {
double eta_calo; double eta_calo;
if(author== xAOD::EgammaParameters::AuthorFwdElectron){ if(author== xAOD::EgammaParameters::AuthorFwdElectron){
eta_calo = cluster.eta(); eta_calo = cluster.eta();
} }
else if (cluster.retrieveMoment(xAOD::CaloCluster::ETACALOFRAME, else if (cluster.retrieveMoment(xAOD::CaloCluster::ETACALOFRAME,
......
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
// Dear emacs, this is -*-c++-*-
#ifndef EGAMMAFACTORY_H #ifndef EGAMMAFACTORY_H
#define EGAMMAFACTORY_H #define EGAMMAFACTORY_H
...@@ -49,7 +49,8 @@ public: ...@@ -49,7 +49,8 @@ public:
xAOD::Photon* create_photon(float eta, float phi, float e0, float e1, float e2, float e3, float e, float rconv=0, float zconv=0); xAOD::Photon* create_photon(float eta, float phi, float e0, float e1, float e2, float e3, float e, float rconv=0, float zconv=0);
xAOD::Electron* create_electron(float eta, float phi, float e); xAOD::Electron* create_electron(float eta, float phi, float e);
xAOD::Electron* create_electron(float eta, float phi, float e0, float e1, float e2, float e3, float e); xAOD::Electron* create_electron(float eta, float phi, float e0, float e1, float e2, float e3, float e);
xAOD::EventInfo* create_eventinfo(bool simulation, int runnumber, int eventnumber=1); // TODO: fix mu
xAOD::EventInfo* create_eventinfo(bool simulation, int runnumber, int eventnumber=1, int average_interaction_per_crossing=20);
private: private:
xAOD::TStore m_store; //! xAOD::TStore m_store; //!
xAOD::CaloClusterContainer* m_clusters; //! xAOD::CaloClusterContainer* m_clusters; //!
......
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
// Dear emacs, this is -*-c++-*-
// //
// Dictionary generation for this package // Dictionary generation for this package
// //
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#define ELECTRONPHOTONFOURMOMENTUMCORRECTION_ELECTRONPHOTONFOURMOMENTUMCORRECTIONDICT_H #define ELECTRONPHOTONFOURMOMENTUMCORRECTION_ELECTRONPHOTONFOURMOMENTUMCORRECTIONDICT_H
#include "egammaUtils/eg_resolution.h"
#include "ElectronPhotonFourMomentumCorrection/egammaEnergyCorrectionTool.h" #include "ElectronPhotonFourMomentumCorrection/egammaEnergyCorrectionTool.h"
#include "ElectronPhotonFourMomentumCorrection/EgammaCalibrationAndSmearingTool.h" #include "ElectronPhotonFourMomentumCorrection/EgammaCalibrationAndSmearingTool.h"
#include "ElectronPhotonFourMomentumCorrection/EgammaFactory.h" #include "ElectronPhotonFourMomentumCorrection/EgammaFactory.h"
......
/* /*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
#ifndef ELECTRONPHOTONFOURMOMENTUMCORRECTION_GAINTOOL_H #ifndef ELECTRONPHOTONFOURMOMENTUMCORRECTION_GAINTOOL_H
#define ELECTRONPHOTONFOURMOMENTUMCORRECTION_GAINTOOL_H #define ELECTRONPHOTONFOURMOMENTUMCORRECTION_GAINTOOL_H
#include <string> #include <string>
#include <memory> #include <memory>
#include <PATCore/PATCoreEnums.h> #include <PATCore/PATCoreEnums.h>
class TFile; class TFile;
class TF1; class TF1;
namespace egGain { namespace egGain {
class GainTool { class GainTool {
public: public:
GainTool(const std::string& filenameTO, const std::string& filenameVar); GainTool(const std::string& filenameTO, const std::string& filenameVar);
void Init(const std::string& filenameTO, const std::string& filenameVar); void Init(const std::string& filenameTO, const std::string& filenameVar);
virtual ~GainTool(); virtual ~GainTool();
double CorrectionGainTool(double eta_input, double energy_input, double energy_layer2_input, double CorrectionGainTool(double eta_input, double energy_input, double energy_layer2_input,
PATCore::ParticleType::Type ptype=PATCore::ParticleType::Electron); PATCore::ParticleType::Type ptype=PATCore::ParticleType::Electron);
private: private:
static const int m_NUM_ETA_BINS=28; static const int m_NUM_ETA_BINS=28;
static const int m_NUM_ENERGY_BINS=3; static const int m_NUM_ENERGY_BINS=3;
static const int m_NUM_UNCONV_ENERGY_BINS=4; static const int m_NUM_UNCONV_ENERGY_BINS=4;
std::unique_ptr <TFile> m_TOFile; std::unique_ptr <TFile> m_TOFile;
std::unique_ptr <TFile> m_varFile; std::unique_ptr <TFile> m_varFile;
TF1* m_funcTO[m_NUM_ETA_BINS]; TF1* m_funcTO[m_NUM_ETA_BINS];
TF1* m_funcG[m_NUM_ENERGY_BINS][m_NUM_ETA_BINS]; TF1* m_funcG[m_NUM_ENERGY_BINS][m_NUM_ETA_BINS];
TF1* m_conv_funcG[m_NUM_ENERGY_BINS][m_NUM_ETA_BINS]; TF1* m_conv_funcG[m_NUM_ENERGY_BINS][m_NUM_ETA_BINS];
TF1* m_unconv_funcG[m_NUM_UNCONV_ENERGY_BINS][m_NUM_ETA_BINS]; TF1* m_unconv_funcG[m_NUM_UNCONV_ENERGY_BINS][m_NUM_ETA_BINS];
}; };
} }
#endif #endif
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
#ifndef ELECTRONPHOTONFOURMOMENTUMCORRECTION_GAINUNCERTAINTYY_H #ifndef ELECTRONPHOTONFOURMOMENTUMCORRECTION_GAINUNCERTAINTYY_H
#define ELECTRONPHOTONFOURMOMENTUMCORRECTION_GAINUNCERTAINTYY_H #define ELECTRONPHOTONFOURMOMENTUMCORRECTION_GAINUNCERTAINTYY_H
#include <AsgMessaging/AsgMessaging.h> #include <AsgMessaging/AsgMessaging.h>
#include <PATCore/PATCoreEnums.h> #include <PATCore/PATCoreEnums.h>
#include <memory> #include <memory>
#include <string> #include <string>
class TFile; class TFile;
class TH1F; class TH1;
class TH1D;
namespace egGain{
namespace egGain{
class GainUncertainty : public asg::AsgMessaging {
class GainUncertainty : public asg::AsgMessaging { public:
public:
GainUncertainty(const std::string& filename);
GainUncertainty(std::string filename); ~GainUncertainty();
void Init(std::string filename);
~GainUncertainty(); // return relative uncertainty on energy from gain uncertainty
// input etaCalo_input = eta in Calo frame
// return relative uncertainty on energy from gain uncertainty // et_input = Et in MeV
// input etaCalo_input = eta in Calo frame // ptype = particle type
// et_input = Et in MeV
// ptype = particle type double getUncertainty(double etaCalo_input, double et_input, PATCore::ParticleType::Type ptype=PATCore::ParticleType::Electron) const;
double getUncertainty(double etaCalo_input, double et_input, PATCore::ParticleType::Type ptype=PATCore::ParticleType::Electron) const; private:
private: static const int m_NUM_ETA_BINS=5;
static const int m_NUM_ETA_BINS=5; std::unique_ptr<TFile> m_gainFile;
std::unique_ptr<TFile> m_gainFile; TH1* m_alpha_specialGainRun;
TH1* m_gain_impact_Zee;
TH1F* m_alpha_specialGainRun; TH1* m_gain_Impact_elec[5];
TH1F* m_gain_impact_Zee; TH1* m_gain_Impact_conv[5];
TH1D* m_gain_Impact_elec[5]; TH1* m_gain_Impact_unco[5];
TH1D* m_gain_Impact_conv[5];
TH1D* m_gain_Impact_unco[5]; };
}; }
} #endif
#endif
// Dear Emacs, this is -*- C++ -*-
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
...@@ -10,6 +8,5 @@ ...@@ -10,6 +8,5 @@
#include "EgammaAnalysisInterfaces/IEgammaCalibrationAndSmearingTool.h" #include "EgammaAnalysisInterfaces/IEgammaCalibrationAndSmearingTool.h"
#pragma message "In the process of moving the Interface part under PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces" #pragma message "In the process of moving the Interface part under PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces"
#pragma GCC warning "TODO: Use the headers from EgammaAnalysisInterfaces"
#endif #endif
/* /*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
#ifndef LARTEMPERATURECORRECTIONTOOL_H #ifndef LARTEMPERATURECORRECTIONTOOL_H
......
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
#ifndef E1HG_SYSTEMATICS_H #ifndef E1HG_SYSTEMATICS_H
#define E1HG_SYSTEMATICS_H #define E1HG_SYSTEMATICS_H
#include "TH1.h" #include "TH1.h"
#include "TFile.h" #include "TFile.h"
#include "TArrayD.h" #include "TArrayD.h"
/** /**
@class e1hg_Systematics @class e1hg_Systematics
@brief get systematics from MG/HG layer 1 miscalibration assuming MG is correctly re-calibrated with muons @brief get systematics from MG/HG layer 1 miscalibration assuming MG is correctly re-calibrated with muons
*/ */
class e1hg_systematics { class e1hg_systematics {
public: public:
/** @brief constructor (initialization done there reading root files) */ /** @brief constructor (initialization done there reading root files) */
e1hg_systematics(); e1hg_systematics();
~e1hg_systematics(); ~e1hg_systematics();
/** /**
@brief particle_type = 0 (electrons), 1 (unconv photons), 2 (conv photons) @brief particle_type = 0 (electrons), 1 (unconv photons), 2 (conv photons)
@brief energy = energy in MeV @brief energy = energy in MeV
@brief eta @brief eta
@brief return value alpha Ebiased = E*(1 + alpha) @brief return value alpha Ebiased = E*(1 + alpha)
*/ */
double getAlpha(int particle_type, double energy, double eta, bool interpolate=false) const; double getAlpha(int particle_type, double energy, double eta, bool interpolate=false) const;
private: private:
// histograms to store parameters // histograms to store parameters
TH1D* m_helec[8]; TH1D* m_helec[8];
TH1D* m_hphot[8]; TH1D* m_hphot[8];
TH1D* m_hphot2[8]; TH1D* m_hphot2[8];
TFile* m_file0; TFile* m_file0;
const TArrayD* m_etBins; const TArrayD* m_etBins;
}; };
#endif #endif
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
// Dear emacs, this is -*-c++-*-
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// //
// REWRITE - February 2013, Karsten Koeneke // REWRITE - February 2013, Karsten Koeneke
...@@ -30,18 +29,19 @@ ...@@ -30,18 +29,19 @@
// ROOT includes // ROOT includes
#include "TRandom3.h" #include "TRandom3.h"
#include "TList.h"
#include "TFile.h"
#include "TGraphErrors.h"
#include "TH1D.h"
#include "TH2F.h"
#include "TSystem.h" #include "TSystem.h"
#include "TF1.h"
// Forward declarations // Forward declarations
class eg_resolution; class eg_resolution;
class get_MaterialResolutionEffect; class get_MaterialResolutionEffect;
class e1hg_systematics; class e1hg_systematics;
class TH1;
class TH2;
class TAxis;
class TFile;
class TList;
namespace egGain { class GainTool; // run1 tool namespace egGain { class GainTool; // run1 tool
class GainUncertainty; // run2 tool class GainUncertainty; // run2 tool
} }
...@@ -82,6 +82,8 @@ namespace egEnergyCorr { ...@@ -82,6 +82,8 @@ namespace egEnergyCorr {
// IBL+PP0 for run 2 // IBL+PP0 for run 2
MaterialIBLUp, MaterialIBLDown, MaterialPP0Up, MaterialPP0Down, MaterialIBLUp, MaterialIBLDown, MaterialPP0Up, MaterialPP0Down,
// Atlfast 2 resolution uncertainties
af2Up, af2Down,
// to help with loops // to help with loops
LastResolutionVariation LastResolutionVariation
...@@ -144,6 +146,12 @@ namespace egEnergyCorr { ...@@ -144,6 +146,12 @@ namespace egEnergyCorr {
// ... Layer scale variations : data driven, uncorrelated vs eta // ... Layer scale variations : data driven, uncorrelated vs eta
PSUp, PSDown, S12Up, S12Down, PSUp, PSDown, S12Up, S12Down,
//PS correlated contribution
PSb12Up, PSb12Down,
// topo cluster threshold
topoClusterThresUp,topoClusterThresDown,
// extra E12 for es2017 run2 // extra E12 for es2017 run2
S12ExtraLastEtaBinRun2Up, S12ExtraLastEtaBinRun2Down, S12ExtraLastEtaBinRun2Up, S12ExtraLastEtaBinRun2Down,
...@@ -162,6 +170,9 @@ namespace egEnergyCorr { ...@@ -162,6 +170,9 @@ namespace egEnergyCorr {
// PP0 // PP0
MatPP0Up, MatPP0Down, MatPP0Up, MatPP0Down,
// AF2 systematics
af2Up, af2Down,
// The following apply to photons only // The following apply to photons only
// ... Leakage // ... Leakage
...@@ -211,20 +222,33 @@ namespace egEnergyCorr { ...@@ -211,20 +222,33 @@ namespace egEnergyCorr {
es2017, // Moriond 2017 es2017, // Moriond 2017
es2017_summer, // Summer 2017 es2017_summer, // Summer 2017
es2017_summer_improved, // Recommendations for Higgs mass paper es2017_summer_improved, // Recommendations for Higgs mass paper
es2017_summer_final, // Final 20.7 recommendations
es2015_5TeV, // For 2015 low mu 5 TeV runs
es2017_R21_PRE, // Pre-recommendations for release 21 es2017_R21_PRE, // Pre-recommendations for release 21
es2017_R21_v0, // Release 21 model with layer calibration corrections from run 2, no global scale correction
es2017_R21_v1, // Release 21 model July 2018 adding forward, AFII, mc16d/reproc data, new mat syst
es2017_R21_ofc0_v1, // Release 21 model calibration extrapolated for OFC(mu=0), coveering 2015,2016,2017 and 2018 data
es2018_R21_v0,
es2018_R21_v1, // model with new E1/E2 muon calibration from full run 2 low+high mu data
UNDEFINED UNDEFINED
}; };
// Geometry dostortions // Geometry distortions
enum Geometry { enum Geometry {
ConfigA=0, // 5% ID material scaling ConfigA=0, // 5% ID material scaling
ConfigCD, // 10% services scaling ConfigCD, // 10% services scaling
ConfigEL, // +7.5%X0 in SCT/TRT endcap; 10%X0, radial, in cryostat ConfigEL, // +7.5%X0 in SCT/TRT endcap; 10%X0, radial, in cryostat
ConfigFMX, // +7.5%X0 on ID endplate; 5%X0, radial, between PS and Strips ConfigFMX, // +7.5%X0 on ID endplate; 5%X0, radial, between PS and Strips
ConfigGp // all together ConfigGp, // all together
ConfigN, // material between PS and calo in EndCap (only used for release 21)
ConfigIBL, // IBL systematics in run 2 geometry
ConfigPP0 // PP0 systematics in run 2 geometry
}; };
// Measured material categories // Measured material categories
...@@ -308,26 +332,24 @@ namespace AtlasRoot { ...@@ -308,26 +332,24 @@ namespace AtlasRoot {
egEnergyCorr::Resolution::resolutionType resType = egEnergyCorr::Resolution::SigmaEff90 ) const; egEnergyCorr::Resolution::resolutionType resType = egEnergyCorr::Resolution::SigmaEff90 ) const;
// new for mc12c model. Return relative uncertainty on the resolution // new for mc12c model. Return relative uncertainty on the resolution
double getResolutionError(double energy, double eta, double etaCalo, PATCore::ParticleType::Type ptype, egEnergyCorr::Resolution::Variation value, double getResolutionError(PATCore::ParticleDataType::DataType dataType,double energy, double eta, double etaCalo, PATCore::ParticleType::Type ptype, egEnergyCorr::Resolution::Variation value,
egEnergyCorr::Resolution::resolutionType resType = egEnergyCorr::Resolution::Gaussian) const; egEnergyCorr::Resolution::resolutionType resType = egEnergyCorr::Resolution::Gaussian) const;
std::string variationName(egEnergyCorr::Scale::Variation& var) const; std::string variationName(egEnergyCorr::Scale::Variation& var) const;
std::string variationName(egEnergyCorr::Resolution::Variation& var) const; std::string variationName(egEnergyCorr::Resolution::Variation& var) const;
static egEnergyCorr::Scale::Variation ScaleVariationFromString(std::string& var);
static egEnergyCorr::Resolution::Variation ResolutionVariationFromString(std::string& var);
// convenient method for decorrelation of statistical error // convenient method for decorrelation of statistical error
const TAxis& get_ZeeStat_eta_axis() const { return *m_zeeNom->GetXaxis(); } const TAxis& get_ZeeStat_eta_axis() const;
private: private:
// TODO: remove mutable // TODO: remove mutable
mutable egGain::GainTool* m_gain_tool; // run 1 mutable std::unique_ptr<egGain::GainTool> m_gain_tool; // run 1
egGain::GainUncertainty* m_gain_tool_run2; // based on special run for run2 std::unique_ptr<egGain::GainUncertainty> m_gain_tool_run2; // based on special run for run2
mutable eg_resolution* m_resolution_tool; mutable std::unique_ptr<eg_resolution> m_resolution_tool;
mutable get_MaterialResolutionEffect* m_getMaterialDelta; mutable std::unique_ptr<get_MaterialResolutionEffect> m_getMaterialDelta;
mutable e1hg_systematics* m_e1hg_tool; mutable std::unique_ptr<e1hg_systematics> m_e1hg_tool;
double getAlphaValue(long int runnumber, double cl_eta, double cl_etaCalo, double getAlphaValue(long int runnumber, double cl_eta, double cl_etaCalo,
double energy, double energyS2, double eraw, double energy, double energyS2, double eraw,
...@@ -356,7 +378,7 @@ namespace AtlasRoot { ...@@ -356,7 +378,7 @@ namespace AtlasRoot {
/// MC calibration corrections /// MC calibration corrections
double applyAFtoG4(double eta, PATCore::ParticleType::Type ptype) const; double applyAFtoG4(double eta, double ptGeV, PATCore::ParticleType::Type ptype) const;
double applyFStoG4(double eta) const; double applyFStoG4(double eta) const;
// functions for resolution uncertainty evaluation // functions for resolution uncertainty evaluation
...@@ -400,6 +422,8 @@ namespace AtlasRoot { ...@@ -400,6 +422,8 @@ namespace AtlasRoot {
double getAlphaMaterial( double cl_eta, egEnergyCorr::MaterialCategory imat, PATCore::ParticleType::Type ptype, double getAlphaMaterial( double cl_eta, egEnergyCorr::MaterialCategory imat, PATCore::ParticleType::Type ptype,
egEnergyCorr::Scale::Variation var = egEnergyCorr::Scale::Nominal, double varSF = 1. ) const; egEnergyCorr::Scale::Variation var = egEnergyCorr::Scale::Nominal, double varSF = 1. ) const;
double getMaterialEffect(egEnergyCorr::Geometry geo,PATCore::ParticleType::Type ptype,double cl_eta,double ET) const;
double getMaterialNonLinearity( double cl_eta, double energy, egEnergyCorr::MaterialCategory imat, PATCore::ParticleType::Type ptype, double getMaterialNonLinearity( double cl_eta, double energy, egEnergyCorr::MaterialCategory imat, PATCore::ParticleType::Type ptype,
egEnergyCorr::Scale::Variation var = egEnergyCorr::Scale::Nominal, double varSF = 1. ) const; egEnergyCorr::Scale::Variation var = egEnergyCorr::Scale::Nominal, double varSF = 1. ) const;
...@@ -427,15 +451,15 @@ namespace AtlasRoot { ...@@ -427,15 +451,15 @@ namespace AtlasRoot {
@brief Output : resolution_error = uncertainty on energy resolution in MeV from the systematics included according to bit mask @brief Output : resolution_error = uncertainty on energy resolution in MeV from the systematics included according to bit mask
@brief resolution_type 0=gaussian core, 1= sigma eff 80%, 2 = sigma eff 90% @brief resolution_type 0=gaussian core, 1= sigma eff 80%, 2 = sigma eff 90%
*/ */
void getResolution_systematics(int particle_type, double energy, double eta, double etaCalo, int syst_mask, double& resolution, double& resolution_error,double& resolution_error_up, double & resolution_error_down, int resol_type=0) const; void getResolution_systematics(int particle_type, double energy, double eta, double etaCalo, int syst_mask, double& resolution, double& resolution_error,double& resolution_error_up, double & resolution_error_down, int resol_type=0, bool fast=false) const;
// approximate pileup noise contribution to the resolution // approximate pileup noise contribution to the resolution
double pileUpTerm(double eta, int particle_type) const; double pileUpTerm(double energy, double eta, int particle_type) const;
private: private:
TFile* m_rootFile; std::unique_ptr<TFile> m_rootFile;
std::string m_rootFileName; std::string m_rootFileName;
mutable TRandom3 m_random3; mutable TRandom3 m_random3;
...@@ -443,120 +467,147 @@ namespace AtlasRoot { ...@@ -443,120 +467,147 @@ namespace AtlasRoot {
unsigned int m_begRunNumber; unsigned int m_begRunNumber;
unsigned int m_endRunNumber; unsigned int m_endRunNumber;
TH1D* m_trkSyst; std::unique_ptr<TH1> m_trkSyst;
TH1D* m_aPSNom; std::unique_ptr<TH1> m_aPSNom;
TH1D* m_daPSCor; std::unique_ptr<TH1> m_daPSCor;
TH1D* m_aS12Nom; std::unique_ptr<TH1> m_daPSb12;
TH1D* m_daS12Cor; std::unique_ptr<TH1> m_aS12Nom;
std::unique_ptr<TH1> m_daS12Cor;
TH1D* m_zeeNom;
TH1D* m_zeeNom_data2015; std::unique_ptr<TH1> m_zeeNom;
std::unique_ptr<TH1> m_zeeNom_data2015;
TH1D* m_zeeSyst; std::unique_ptr<TH1> m_zeeNom_data2016;
TH1D* m_zeePhys; std::unique_ptr<TH1> m_zeeNom_data2017;
TH1* m_uA2MeV_2015_first2weeks_correction; std::unique_ptr<TH1> m_zeeNom_data2018;
std::unique_ptr<TH1> m_zeeFwdk;
TH1D* m_resNom; std::unique_ptr<TH1> m_zeeFwdb;
TH1D* m_resSyst;
TH1D* m_peakResData; std::unique_ptr<TH1> m_zeeSyst;
TH1D* m_peakResMC; std::unique_ptr<TH1> m_zeePhys;
std::unique_ptr<TH1> m_uA2MeV_2015_first2weeks_correction;
TH1D* m_dX_ID_Nom;
std::unique_ptr<TH1> m_resNom;
TH1D* m_dX_IPPS_Nom; std::unique_ptr<TH1> m_resSyst;
TH1D* m_dX_IPPS_LAr; std::unique_ptr<TH1> m_peakResData;
std::unique_ptr<TH1> m_peakResMC;
TH1D* m_dX_IPAcc_Nom;
TH1D* m_dX_IPAcc_G4; std::unique_ptr<TH1> m_dX_ID_Nom;
TH1D* m_dX_IPAcc_LAr;
TH1D* m_dX_IPAcc_GL1; std::unique_ptr<TH1> m_dX_IPPS_Nom;
std::unique_ptr<TH1> m_dX_IPPS_LAr;
TH1D* m_dX_PSAcc_Nom;
TH1D* m_dX_PSAcc_G4; std::unique_ptr<TH1> m_dX_IPAcc_Nom;
TH1D* m_dX_PSAcc_LAr; std::unique_ptr<TH1> m_dX_IPAcc_G4;
std::unique_ptr<TH1> m_dX_IPAcc_LAr;
TAxis* m_psElectronEtaBins; std::unique_ptr<TH1> m_dX_IPAcc_GL1;
TList* m_psElectronGraphs;
TAxis* m_psUnconvertedEtaBins; std::unique_ptr<TH1> m_dX_PSAcc_Nom;
TList* m_psUnconvertedGraphs; std::unique_ptr<TH1> m_dX_PSAcc_G4;
TAxis* m_psConvertedEtaBins; std::unique_ptr<TH1> m_dX_PSAcc_LAr;
TList* m_psConvertedGraphs;
std::unique_ptr<TAxis> m_psElectronEtaBins;
TAxis* m_E4ElectronEtaBins = nullptr; std::unique_ptr<TList> m_psElectronGraphs;
TList* m_E4ElectronGraphs = nullptr; std::unique_ptr<TAxis> m_psUnconvertedEtaBins;
TAxis* m_E4UnconvertedEtaBins = nullptr; std::unique_ptr<TList> m_psUnconvertedGraphs;
TList* m_E4UnconvertedGraphs = nullptr; std::unique_ptr<TAxis> m_psConvertedEtaBins;
TAxis* m_E4ConvertedEtaBins = nullptr; std::unique_ptr<TList> m_psConvertedGraphs;
TList* m_E4ConvertedGraphs = nullptr;
std::unique_ptr<TAxis> m_E4ElectronEtaBins;
TAxis* m_s12ElectronEtaBins; std::unique_ptr<TList> m_E4ElectronGraphs;
TList* m_s12ElectronGraphs; std::unique_ptr<TAxis> m_E4UnconvertedEtaBins;
TAxis* m_s12UnconvertedEtaBins; std::unique_ptr<TList> m_E4UnconvertedGraphs;
TList* m_s12UnconvertedGraphs; std::unique_ptr<TAxis> m_E4ConvertedEtaBins;
TAxis* m_s12ConvertedEtaBins; std::unique_ptr<TList> m_E4ConvertedGraphs;
TList* m_s12ConvertedGraphs;
std::unique_ptr<TAxis> m_s12ElectronEtaBins;
TH1D* m_pedestalL0; std::unique_ptr<TList> m_s12ElectronGraphs;
TH1D* m_pedestalL1; std::unique_ptr<TAxis> m_s12UnconvertedEtaBins;
TH1D* m_pedestalL2; std::unique_ptr<TList> m_s12UnconvertedGraphs;
TH1D* m_pedestalL3; std::unique_ptr<TAxis> m_s12ConvertedEtaBins;
std::unique_ptr<TList> m_s12ConvertedGraphs;
TH1F* m_pedestals_es2017;
std::unique_ptr<TH1> m_pedestalL0;
TH2D* m_convRadius; std::unique_ptr<TH1> m_pedestalL1;
TH1D* m_convFakeRate; std::unique_ptr<TH1> m_pedestalL2;
TH1D* m_convRecoEfficiency; std::unique_ptr<TH1> m_pedestalL3;
TH1D* m_leakageConverted; std::unique_ptr<TH1> m_pedestals_es2017;
TH1D* m_leakageUnconverted;
std::unique_ptr<TH1> m_convRadius;
TH1D* m_zeeES2Profile; std::unique_ptr<TH1> m_convFakeRate;
std::unique_ptr<TH1> m_convRecoEfficiency;
TH2D* m_pp0_elec;
TH2D* m_pp0_unconv; std::unique_ptr<TH1> m_leakageConverted;
TH2D* m_pp0_conv; std::unique_ptr<TH1> m_leakageUnconverted;
TH1D* m_wstot_slope_A_data; std::unique_ptr<TH1> m_zeeES2Profile;
TH1D* m_wstot_slope_B_MC;
TH1D* m_wstot_40GeV_data; std::unique_ptr<TH2> m_pp0_elec;
TH1D* m_wstot_40GeV_MC; std::unique_ptr<TH2> m_pp0_unconv;
TH1D* m_wstot_pT_data_p0_electrons; std::unique_ptr<TH2> m_pp0_conv;
TH1D* m_wstot_pT_data_p1_electrons;
TH1D* m_wstot_pT_data_p0_unconverted_photons; std::unique_ptr<TH1> m_wstot_slope_A_data;
TH1D* m_wstot_pT_data_p1_unconverted_photons; std::unique_ptr<TH1> m_wstot_slope_B_MC;
TH1D* m_wstot_pT_data_p0_converted_photons; std::unique_ptr<TH1> m_wstot_pT_data_p0_electrons;
TH1D* m_wstot_pT_data_p1_converted_photons; std::unique_ptr<TH1> m_wstot_pT_data_p1_electrons;
TH1D* m_wstot_pT_MC_p0_electrons; std::unique_ptr<TH1> m_wstot_pT_data_p0_unconverted_photons;
TH1D* m_wstot_pT_MC_p1_electrons; std::unique_ptr<TH1> m_wstot_pT_data_p1_unconverted_photons;
TH1D* m_wstot_pT_MC_p0_unconverted_photons; std::unique_ptr<TH1> m_wstot_pT_data_p0_converted_photons;
TH1D* m_wstot_pT_MC_p1_unconverted_photons; std::unique_ptr<TH1> m_wstot_pT_data_p1_converted_photons;
TH1D* m_wstot_pT_MC_p0_converted_photons; std::unique_ptr<TH1> m_wstot_pT_MC_p0_electrons;
TH1D* m_wstot_pT_MC_p1_converted_photons; std::unique_ptr<TH1> m_wstot_pT_MC_p1_electrons;
std::unique_ptr<TH1> m_wstot_pT_MC_p0_unconverted_photons;
std::unique_ptr<TH1> m_wstot_pT_MC_p1_unconverted_photons;
std::unique_ptr<TH1> m_wstot_pT_MC_p0_converted_photons;
std::unique_ptr<TH1> m_wstot_pT_MC_p1_converted_photons;
// Geometry distortion vectors (to be ordered as in the the Geometry enum!) // Geometry distortion vectors (to be ordered as in the the Geometry enum!)
std::vector<TH1D*> m_matElectronScale; std::vector<std::unique_ptr<TH1>> m_matElectronScale;
std::vector<TH1D*> m_matUnconvertedScale; std::vector<std::unique_ptr<TH1>> m_matUnconvertedScale;
std::vector<TH1D*> m_matConvertedScale; std::vector<std::unique_ptr<TH1>> m_matConvertedScale;
std::vector<TH1F*> m_matElectronCstTerm; std::vector<std::unique_ptr<TH1>> m_matElectronCstTerm;
std::vector<TH1D*> m_matX0Additions; std::vector<std::unique_ptr<TH1>> m_matX0Additions;
// Non-linearity graphs // Non-linearity graphs
TAxis* m_matElectronEtaBins; std::unique_ptr<TAxis> m_matElectronEtaBins;
std::vector<TList*> m_matElectronGraphs; std::vector<std::unique_ptr<TList>> m_matElectronGraphs;
// 2D histograms for release 21 material systematics sensitivity parameterization
std::unique_ptr<TH2> m_electronBias_ConfigA;
std::unique_ptr<TH2> m_electronBias_ConfigEpLp;
std::unique_ptr<TH2> m_electronBias_ConfigFpMX;
std::unique_ptr<TH2> m_electronBias_ConfigN;
std::unique_ptr<TH2> m_electronBias_ConfigIBL;
std::unique_ptr<TH2> m_electronBias_ConfigPP0;
std::unique_ptr<TH2> m_unconvertedBias_ConfigA;
std::unique_ptr<TH2> m_unconvertedBias_ConfigEpLp;
std::unique_ptr<TH2> m_unconvertedBias_ConfigFpMX;
std::unique_ptr<TH2> m_unconvertedBias_ConfigN;
std::unique_ptr<TH2> m_unconvertedBias_ConfigIBL;
std::unique_ptr<TH2> m_unconvertedBias_ConfigPP0;
std::unique_ptr<TH2> m_convertedBias_ConfigA;
std::unique_ptr<TH2> m_convertedBias_ConfigEpLp;
std::unique_ptr<TH2> m_convertedBias_ConfigFpMX;
std::unique_ptr<TH2> m_convertedBias_ConfigN;
std::unique_ptr<TH2> m_convertedBias_ConfigIBL;
std::unique_ptr<TH2> m_convertedBias_ConfigPP0;
// Fastsim -> Fullsim corrections // Fastsim -> Fullsim corrections
TH1D* m_G4OverAFII_electron; std::unique_ptr<TH1> m_G4OverAFII_electron;
TH1D* m_G4OverAFII_converted; std::unique_ptr<TH1> m_G4OverAFII_converted;
TH1D* m_G4OverAFII_unconverted; std::unique_ptr<TH1> m_G4OverAFII_unconverted;
TH1D* m_G4OverFrSh; std::unique_ptr<TH2> m_G4OverAFII_electron_2D;
std::unique_ptr<TH2> m_G4OverAFII_converted_2D;
TH2F* m_G4OverAFII_resolution_electron; std::unique_ptr<TH2> m_G4OverAFII_unconverted_2D;
TH2F* m_G4OverAFII_resolution_unconverted; std::unique_ptr<TH1> m_G4OverFrSh;
TH2F* m_G4OverAFII_resolution_converted;
std::unique_ptr<TH2> m_G4OverAFII_resolution_electron;
std::unique_ptr<TH2> m_G4OverAFII_resolution_unconverted;
std::unique_ptr<TH2> m_G4OverAFII_resolution_converted;
// Main ES model switch // Main ES model switch
......
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
#ifndef get_MaterialResolutionEffect_H #ifndef get_MaterialResolutionEffect_H
#define get_MaterialResolutionEffect_H #define get_MaterialResolutionEffect_H
#include <stdlib.h>
#include <math.h>
#include <memory> #include <memory>
#include <cstdlib>
#include <cmath>
#include <array>
#include "AsgMessaging/AsgMessaging.h" #include "AsgMessaging/AsgMessaging.h"
#include "TH1.h"
#include "TH2D.h"
#include "TFile.h"
#include "TArrayD.h"
/** /**
@class get_MaterialResolutionEffect @class get_MaterialResolutionEffect
@brief get resolution systematics from material effect (mc12c setup, MVA calibration) @brief get resolution systematics from material effect (mc12c setup, MVA calibration)
...@@ -24,6 +20,12 @@ ...@@ -24,6 +20,12 @@
*/ */
class TH1;
class TH2;
class TFile;
class TArrayD;
class get_MaterialResolutionEffect : public asg::AsgMessaging { class get_MaterialResolutionEffect : public asg::AsgMessaging {
public: public:
...@@ -44,12 +46,11 @@ class get_MaterialResolutionEffect : public asg::AsgMessaging { ...@@ -44,12 +46,11 @@ class get_MaterialResolutionEffect : public asg::AsgMessaging {
private: private:
// histograms to store resolution parameters // histograms to store resolution parameters
TH1D* m_hSystPeak[4][8][3]; std::array<std::array<std::array<std::unique_ptr<TH1>, 3>, 8>,4> m_hSystPeak;
TH1D* m_hSystResol[4][8][3]; std::array<std::array<std::array<std::unique_ptr<TH1>, 3>, 8>,4> m_hSystResol;
TH2D* m_hsyst_IBL_PP0[3]; std::array<std::unique_ptr<TH2>, 3> m_hsyst_IBL_PP0;
std::unique_ptr <TFile> m_file0; std::unique_ptr <TFile> m_file0;
//const TArrayD* m_etaBins; const TArrayD* m_etBins; //A xistogram will own this
const TArrayD* m_etBins;
}; };
......
<lcgdict> <lcgdict>
<class name="CP::IEgammaCalibrationAndSmearingTool" />
<class name="CP::EgammaCalibrationAndSmearingTool" /> <class name="CP::EgammaCalibrationAndSmearingTool" />
<class name="AtlasRoot::egammaEnergyCorrectionTool" /> <class name="AtlasRoot::egammaEnergyCorrectionTool" />
...@@ -20,4 +19,5 @@ ...@@ -20,4 +19,5 @@
<class name="EgammaFactory" /> <class name="EgammaFactory" />
<class name="LArTemperatureCorrectionTool" /> <class name="LArTemperatureCorrectionTool" />
</lcgdict> </lcgdict>
SYSMACRO(EG_SCALE_ZEESYST, 1, std::vector<double>(), egEnergyCorr::Scale::ZeeSystUp, egEnergyCorr::Scale::ZeeSystDown)
SYSMACRO(EG_SCALE_LARCALIB, 0, decorrelation_bins_BE, egEnergyCorr::Scale::LArCalibUp, egEnergyCorr::Scale::LArCalibDown)
SYSMACRO(EG_SCALE_LARUNCONVCALIB, 0, decorrelation_bins_BE, egEnergyCorr::Scale::LArUnconvCalibUp, egEnergyCorr::Scale::LArUnconvCalibDown)
SYSMACRO(EG_SCALE_LARELECCALIB, 1, std::vector<double>(), egEnergyCorr::Scale::LArElecCalibUp, egEnergyCorr::Scale::LArElecCalibDown)
SYSMACRO(EG_SCALE_LARELECUNCONV, 0, decorrelation_bins_BE, egEnergyCorr::Scale::LArElecUnconvUp, egEnergyCorr::Scale::LArElecUnconvDown)
SYSMACRO(EG_SCALE_G4, 1, std::vector<double>(), egEnergyCorr::Scale::G4Up, egEnergyCorr::Scale::G4Down)
SYSMACRO(EG_SCALE_PS, 0, decorrelation_edges_MODULE, egEnergyCorr::Scale::PSUp, egEnergyCorr::Scale::PSDown)
SYSMACRO(EG_SCALE_S12, 0, decorrelation_edges_S12, egEnergyCorr::Scale::S12Up, egEnergyCorr::Scale::S12Down);
SYSMACRO(EG_SCALE_MATID, 0, decorrelation_edges_MATERIAL, egEnergyCorr::Scale::MatIDUp, egEnergyCorr::Scale::MatIDDown);
SYSMACRO(EG_SCALE_MATCRYO, 0, decorrelation_edges_TWELVE, egEnergyCorr::Scale::MatCryoUp, egEnergyCorr::Scale::MatCryoDown)
SYSMACRO(EG_SCALE_MATCALO, 0, decorrelation_edges_TWELVE, egEnergyCorr::Scale::MatCaloUp, egEnergyCorr::Scale::MatCaloDown)
SYSMACRO(EG_SCALE_L1GAIN, 1, std::vector<double>(), egEnergyCorr::Scale::L1GainUp, egEnergyCorr::Scale::L1GainDown)
SYSMACRO(EG_SCALE_L2GAIN, 1, std::vector<double>(), egEnergyCorr::Scale::L2GainUp, egEnergyCorr::Scale::L2GainDown)
SYSMACRO(EG_SCALE_PEDESTAL, 1, std::vector<double>(), egEnergyCorr::Scale::PedestalUp, egEnergyCorr::Scale::PedestalDown)
SYSMACRO(PH_SCALE_LEAKAGEUNCONV, 1, std::vector<double>(), egEnergyCorr::Scale::LeakageUnconvUp, egEnergyCorr::Scale::LeakageUnconvDown)
SYSMACRO(PH_SCALE_LEAKAGECONV, 1, std::vector<double>(), egEnergyCorr::Scale::LeakageConvUp, egEnergyCorr::Scale::LeakageConvDown)
SYSMACRO(PH_SCALE_CONVEFFICIENCY, 1, std::vector<double>(), egEnergyCorr::Scale::ConvEfficiencyUp, egEnergyCorr::Scale::ConvEfficiencyDown)
SYSMACRO(PH_SCALE_CONVFAKERATE, 1, std::vector<double>(), egEnergyCorr::Scale::ConvFakeRateUp, egEnergyCorr::Scale::ConvFakeRateDown)
SYSMACRO(PH_SCALE_CONVRADIUS, 1, std::vector<double>(), egEnergyCorr::Scale::ConvRadiusUp, egEnergyCorr::Scale::ConvRadiusDown)
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
#ifdef XAOD_STANDALONE #ifdef XAOD_STANDALONE
...@@ -116,13 +116,14 @@ EgammaFactory::~EgammaFactory() ...@@ -116,13 +116,14 @@ EgammaFactory::~EgammaFactory()
m_store.clear(); m_store.clear();
} }
xAOD::EventInfo* EgammaFactory::create_eventinfo(bool simulation, int runnumber, int eventnumber) xAOD::EventInfo* EgammaFactory::create_eventinfo(bool simulation, int runnumber, int eventnumber, int average_interaction_per_crossing)
{ {
xAOD::EventInfo* ei= new xAOD::EventInfo(); xAOD::EventInfo* ei= new xAOD::EventInfo();
ei->makePrivateStore(); ei->makePrivateStore();
ei->setRunNumber(runnumber); ei->setRunNumber(runnumber);
ei->setEventNumber(eventnumber); ei->setEventNumber(eventnumber);
ei->setEventTypeBitmask(simulation); ei->setEventTypeBitmask(simulation);
ei->setAverageInteractionsPerCrossing(average_interaction_per_crossing);
return ei; return ei;
} }
......
/* /*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
#include <ElectronPhotonFourMomentumCorrection/GainUncertainty.h> #include <ElectronPhotonFourMomentumCorrection/GainUncertainty.h>
#include "PathResolver/PathResolver.h" #include <TH1.h>
#include <TH1F.h> #include <TFile.h>
#include <TH1D.h>
#include <TFile.h>
#include <iostream> namespace egGain {
namespace egGain { //--------------------------------------
GainUncertainty::GainUncertainty(const std::string& filename) : asg::AsgMessaging("GainUncertainty") {
//--------------------------------------
ATH_MSG_INFO("opening file " << filename);
GainUncertainty::GainUncertainty(std::string filename) : asg::AsgMessaging("GainUncertainty") { m_gainFile.reset( TFile::Open( filename.c_str(), "READ" ) );
ATH_MSG_INFO("opening file " << filename); if (not (m_alpha_specialGainRun = (TH1*)(m_gainFile->Get("alpha_specialGainRun")))) ATH_MSG_FATAL("cannot open histogram1");
m_gainFile = std::make_unique<TFile>(filename.c_str()); if (not (m_gain_impact_Zee = (TH1*)(m_gainFile->Get("gain_impact_Zee")))) ATH_MSG_FATAL("cannot open histogram2");
for (int i=0;i<m_NUM_ETA_BINS;i++) {
if (not (m_alpha_specialGainRun = (TH1F*)(m_gainFile->Get("alpha_specialGainRun")))) ATH_MSG_FATAL("cannot open histogram1"); char name[60];
if (not (m_gain_impact_Zee = (TH1F*)(m_gainFile->Get("gain_impact_Zee")))) ATH_MSG_FATAL("cannot open histogram2"); sprintf(name,"gain_Impact_elec_%d",i);
for (int i=0;i<m_NUM_ETA_BINS;i++) { if (not (m_gain_Impact_elec[i] = (TH1*)(m_gainFile->Get(name)))) ATH_MSG_FATAL("cannot open histogram3");
char name[60]; sprintf(name,"gain_Impact_conv_%d",i);
sprintf(name,"gain_Impact_elec_%d",i); if (not (m_gain_Impact_conv[i] = (TH1*)(m_gainFile->Get(name)))) ATH_MSG_FATAL("cannot open histogram4");
if (not (m_gain_Impact_elec[i] = (TH1D*)(m_gainFile->Get(name)))) ATH_MSG_FATAL("cannot open histogram3"); sprintf(name,"gain_Impact_unco_%d",i);
sprintf(name,"gain_Impact_conv_%d",i); if (not (m_gain_Impact_unco[i]= (TH1*)(m_gainFile->Get(name)))) ATH_MSG_FATAL("cannot open histogram5");
if (not (m_gain_Impact_conv[i] = (TH1D*)(m_gainFile->Get(name)))) ATH_MSG_FATAL("cannot open histogram4"); }
sprintf(name,"gain_Impact_unco_%d",i);
if (not (m_gain_Impact_unco[i]= (TH1D*)(m_gainFile->Get(name)))) ATH_MSG_FATAL("cannot open histogram5"); }
}
//----------------------------------------------
}
GainUncertainty::~GainUncertainty() {
//---------------------------------------------- delete m_alpha_specialGainRun;
delete m_gain_impact_Zee;
GainUncertainty::~GainUncertainty() { for (int i=0;i<m_NUM_ETA_BINS;i++) {
delete m_alpha_specialGainRun; delete m_gain_Impact_elec[i];
delete m_gain_impact_Zee; delete m_gain_Impact_conv[i];
for (int i=0;i<m_NUM_ETA_BINS;i++) { delete m_gain_Impact_unco[i];
delete m_gain_Impact_elec[i]; }
delete m_gain_Impact_conv[i]; }
delete m_gain_Impact_unco[i];
} //----------------------------------------------
}
// returns relative uncertainty on energy
//----------------------------------------------
double GainUncertainty::getUncertainty(double etaCalo_input, double et_input, PATCore::ParticleType::Type ptype) const {
// returns relative uncertainty on energy double aeta=std::fabs(etaCalo_input);
int ibin=-1;
double GainUncertainty::getUncertainty(double etaCalo_input, double et_input, PATCore::ParticleType::Type ptype) const { if (aeta<0.8) ibin=0;
double aeta=std::fabs(etaCalo_input); else if (aeta<1.37) ibin=1;
int ibin=-1; else if (aeta<1.52) ibin=2;
if (aeta<0.8) ibin=0; else if (aeta<1.80) ibin=3;
else if (aeta<1.37) ibin=1; else if (aeta<2.50) ibin=4;
else if (aeta<1.52) ibin=2; if (ibin<0) return 0.;
else if (aeta<1.80) ibin=3;
else if (aeta<2.50) ibin=4; //Protection needed as the histograms stops at 1 TeV
if (ibin<0) return 0.; if(et_input>999999.) et_input = 999999.;
//Protection needed as the histograms stops at 1 TeV // std::cout << " --- in GainUncertainty::getUncertainty " << etaCalo_input << " " << et_input << " " << ptype << " ibin " << ibin << std::endl;
if(et_input>999999.) et_input = 999999.;
double impact=0.;
// std::cout << " --- in GainUncertainty::getUncertainty " << etaCalo_input << " " << et_input << " " << ptype << " ibin " << ibin << std::endl; if (ptype==PATCore::ParticleType::Electron) impact = m_gain_Impact_elec[ibin]->GetBinContent(m_gain_Impact_elec[ibin]->FindFixBin(0.001*et_input));
if (ptype==PATCore::ParticleType::ConvertedPhoton) impact = m_gain_Impact_conv[ibin]->GetBinContent(m_gain_Impact_conv[ibin]->FindFixBin(0.001*et_input));
double impact=0.; if (ptype==PATCore::ParticleType::UnconvertedPhoton) impact = m_gain_Impact_unco[ibin]->GetBinContent(m_gain_Impact_unco[ibin]->FindFixBin(0.001*et_input));
if (ptype==PATCore::ParticleType::Electron) impact = m_gain_Impact_elec[ibin]->GetBinContent(m_gain_Impact_elec[ibin]->FindFixBin(0.001*et_input));
if (ptype==PATCore::ParticleType::ConvertedPhoton) impact = m_gain_Impact_conv[ibin]->GetBinContent(m_gain_Impact_conv[ibin]->FindFixBin(0.001*et_input)); // std::cout << " impact " << impact << std::endl;
if (ptype==PATCore::ParticleType::UnconvertedPhoton) impact = m_gain_Impact_unco[ibin]->GetBinContent(m_gain_Impact_unco[ibin]->FindFixBin(0.001*et_input)); double_t sigmaE = m_alpha_specialGainRun->GetBinContent(m_alpha_specialGainRun->FindFixBin(aeta))
/m_gain_impact_Zee->GetBinContent(m_gain_impact_Zee->FindFixBin(aeta))
// std::cout << " impact " << impact << std::endl; *impact ;
double_t sigmaE = m_alpha_specialGainRun->GetBinContent(m_alpha_specialGainRun->FindFixBin(aeta))
/m_gain_impact_Zee->GetBinContent(m_gain_impact_Zee->FindFixBin(aeta)) // std::cout << " m_alpha_specialGainRun, m_gain_impact_Zee, impact , sigmaE " << m_alpha_specialGainRun->GetBinContent(m_alpha_specialGainRun->FindBin(aeta))
*impact ; // << " " << m_gain_impact_Zee->GetBinContent(m_gain_impact_Zee->FindBin(aeta)) << " " << impact << " " << sigmaE << std::endl;
// std::cout << " m_alpha_specialGainRun, m_gain_impact_Zee, impact , sigmaE " << m_alpha_specialGainRun->GetBinContent(m_alpha_specialGainRun->FindBin(aeta)) return sigmaE;
// << " " << m_gain_impact_Zee->GetBinContent(m_gain_impact_Zee->FindBin(aeta)) << " " << impact << " " << sigmaE << std::endl;
}
return sigmaE;
} }
}
/* /*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
#include <TParameter.h> #include <TParameter.h>
...@@ -20,9 +20,7 @@ LArTemperatureCorrectionTool::LArTemperatureCorrectionTool(const std::string& fi ...@@ -20,9 +20,7 @@ LArTemperatureCorrectionTool::LArTemperatureCorrectionTool(const std::string& fi
if (!m_file or m_file->IsZombie()) { ATH_MSG_ERROR("cannot open file"); } if (!m_file or m_file->IsZombie()) { ATH_MSG_ERROR("cannot open file"); }
m_tree = dynamic_cast<TTree*>(m_file->Get("temperature")); m_tree = dynamic_cast<TTree*>(m_file->Get("temperature"));
if ( m_tree == nullptr ) { if (!m_tree) { ATH_MSG_FATAL("cannot find tree"); }
throw std::runtime_error( "cannot find tree" );
}
Int_t t_run = 0; Int_t t_run = 0;
m_tree->SetBranchAddress("run", &t_run); m_tree->SetBranchAddress("run", &t_run);
......
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
#include "ElectronPhotonFourMomentumCorrection/e1hg_systematics.h" #include "ElectronPhotonFourMomentumCorrection/e1hg_systematics.h"
#include "PathResolver/PathResolver.h" #include "PathResolver/PathResolver.h"
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include "TAxis.h" #include "TAxis.h"
#include "Riostream.h" #include "Riostream.h"
#ifndef ROOTCORE #ifndef ROOTCORE
#include "PathResolver/PathResolver.h" #include "PathResolver/PathResolver.h"
#endif #endif
e1hg_systematics::e1hg_systematics() e1hg_systematics::e1hg_systematics()
{ {
m_file0 = TFile::Open( PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v8/e1hg_systematics_histos.root").c_str() ); m_file0 = TFile::Open( PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v8/e1hg_systematics_histos.root").c_str() );
for (Int_t ieta=0;ieta<8;ieta++) { for (Int_t ieta=0;ieta<8;ieta++) {
char name[60]; char name[60];
sprintf(name,"elec_%d",ieta); sprintf(name,"elec_%d",ieta);
m_helec[ieta] = (TH1D*) m_file0->Get(name); m_helec[ieta] = (TH1D*) m_file0->Get(name);
sprintf(name,"unconv_%d",ieta); sprintf(name,"unconv_%d",ieta);
m_hphot[ieta] = (TH1D*) m_file0->Get(name); m_hphot[ieta] = (TH1D*) m_file0->Get(name);
sprintf(name,"conv_%d",ieta); sprintf(name,"conv_%d",ieta);
m_hphot2[ieta] = (TH1D*) m_file0->Get(name); m_hphot2[ieta] = (TH1D*) m_file0->Get(name);
} }
TAxis* aa=m_helec[0]->GetXaxis(); TAxis* aa=m_helec[0]->GetXaxis();
m_etBins = aa->GetXbins(); m_etBins = aa->GetXbins();
} }
//========================================================================= //=========================================================================
e1hg_systematics::~e1hg_systematics() e1hg_systematics::~e1hg_systematics()
{ {
m_file0->Close(); m_file0->Close();
} }
//============================================================================ //============================================================================
// inputs are particle_type (0=elec, 1=reco unconv photon, 2=reco conv photon) // inputs are particle_type (0=elec, 1=reco unconv photon, 2=reco conv photon)
// energy in MeV // energy in MeV
// eta // eta
// //
// returned value is alpha = DeltaE / E // returned value is alpha = DeltaE / E
// //
double e1hg_systematics::getAlpha(int particle_type, double energy, double eta, bool interpolate) const double e1hg_systematics::getAlpha(int particle_type, double energy, double eta, bool interpolate) const
{ {
//cout << " in getDelta " << endl; //cout << " in getDelta " << endl;
if (particle_type<0 || particle_type>2) return 0.; if (particle_type<0 || particle_type>2) return 0.;
float aeta=fabs(eta); float aeta=fabs(eta);
int ieta=0; int ieta=0;
if (aeta<0.4) ieta=0; if (aeta<0.4) ieta=0;
else if (aeta<0.8) ieta=1; else if (aeta<0.8) ieta=1;
else if (aeta<1.1) ieta=2; else if (aeta<1.1) ieta=2;
else if (aeta<1.37) ieta=3; else if (aeta<1.37) ieta=3;
else if (aeta<1.52) ieta=4; else if (aeta<1.52) ieta=4;
else if (aeta<1.80) ieta=5; else if (aeta<1.80) ieta=5;
else if (aeta<2.10) ieta=6; else if (aeta<2.10) ieta=6;
else ieta=7; else ieta=7;
double energyGeV = energy*0.001; double energyGeV = energy*0.001;
double et = energyGeV/cosh(eta); double et = energyGeV/cosh(eta);
int ibinEt=m_etBins->GetSize()-2; int ibinEt=m_etBins->GetSize()-2;
for (int i=1;i<m_etBins->GetSize();i++) { for (int i=1;i<m_etBins->GetSize();i++) {
if (et<m_etBins->GetAt(i)) { if (et<m_etBins->GetAt(i)) {
ibinEt=i-1; ibinEt=i-1;
break; break;
} }
} }
// cout << " energy, et , ibinEt " << energyGeV << " " << et << " " << ibinEt << endl; // cout << " energy, et , ibinEt " << energyGeV << " " << et << " " << ibinEt << endl;
Double_t scale=0.; Double_t scale=0.;
//HACK: some ES model dependency needs to be introduced //HACK: some ES model dependency needs to be introduced
/*Default up to es2017_summer /*Default up to es2017_summer
if (aeta<1.80) scale=0.; if (aeta<1.80) scale=0.;
else if (aeta<2.3) scale = 0.050*(aeta-1.8)/0.4 /0.05; else if (aeta<2.3) scale = 0.050*(aeta-1.8)/0.4 /0.05;
else scale=0.025/0.05; else scale=0.025/0.05;
*/ */
if (aeta<1.80) scale=0.; if (aeta<1.80) scale=0.;
else if (aeta<2.3) scale = (0.050*(aeta-1.8)/0.4+0.025)/0.05; else if (aeta<2.3) scale = (0.050*(aeta-1.8)/0.4+0.025)/0.05;
else scale = 0.05/0.05; else scale = 0.05/0.05;
if( !interpolate ) { if( !interpolate ) {
if (particle_type==0) return scale*m_helec[ieta]->GetBinContent(ibinEt+1); if (particle_type==0) return scale*m_helec[ieta]->GetBinContent(ibinEt+1);
else if (particle_type==1) return scale*m_hphot[ieta]->GetBinContent(ibinEt+1); else if (particle_type==1) return scale*m_hphot[ieta]->GetBinContent(ibinEt+1);
else return scale*m_hphot2[ieta]->GetBinContent(ibinEt+1); //This is 2, since if particle_type is not 0,1,2 we have returned 0 above else return scale*m_hphot2[ieta]->GetBinContent(ibinEt+1); //This is 2, since if particle_type is not 0,1,2 we have returned 0 above
} else { } else {
if (particle_type==0) return scale*m_helec[ieta]->Interpolate(et); if (particle_type==0) return scale*m_helec[ieta]->Interpolate(et);
else if (particle_type==1) return scale*m_hphot[ieta]->Interpolate(et); else if (particle_type==1) return scale*m_hphot[ieta]->Interpolate(et);
else return scale*m_hphot2[ieta]->Interpolate(et); //This is 2, since if particle_type is not 0,1,2 we have returned 0 else return scale*m_hphot2[ieta]->Interpolate(et); //This is 2, since if particle_type is not 0,1,2 we have returned 0
} }
} }
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