Commit f89466f9 authored by Christos Anastopoulos's avatar Christos Anastopoulos Committed by Walter Lampl
Browse files

egammaUtils: atlas_depends_on_subdirs, and small tidy up

parent 83904e48
......@@ -50,7 +50,6 @@ EMFourMomBuilder::initialize()
ATH_MSG_DEBUG(" Initializing EMFourMomBuilder");
m_eg_resol = std::make_unique<eg_resolution>(m_ResolutionConfiguration);
m_eg_resol->msg().setLevel(this->msg().level());
return StatusCode::SUCCESS;
}
......
......@@ -5,18 +5,6 @@
# Declare the package name:
atlas_subdir( egammaUtils )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
Control/AthToolSupport/AsgTools
Event/xAOD/xAODCaloEvent
Event/xAOD/xAODTracking
Event/xAOD/xAODEgamma
DetectorDescription/GeoPrimitives
PRIVATE
Event/FourMomUtils
PhysicsAnalysis/AnalysisCommon/AnalysisUtils
Tools/PathResolver)
# External dependencies:
find_package( ROOT COMPONENTS Tree Core Hist)
......@@ -26,8 +14,8 @@ atlas_add_library( egammaUtils
PUBLIC_HEADERS egammaUtils
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
PRIVATE_INCLUDE_DIRS
LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODCaloEvent xAODTracking xAODEgamma GeoPrimitives
PRIVATE_LINK_LIBRARIES FourMomUtils PathResolver AnalysisUtilsLib)
LINK_LIBRARIES ${ROOT_LIBRARIES} xAODCaloEvent xAODTracking xAODEgamma GeoPrimitives
PRIVATE_LINK_LIBRARIES FourMomUtils PathResolver AnalysisUtilsLib)
atlas_add_dictionary( egammaUtilsDict
egammaUtils/egammaUtilsDict.h
......
......@@ -18,14 +18,11 @@ T* get_object(TFile& file, const std::string& name){
}
eg_resolution::eg_resolution(const std::string& configuration)
: asg::AsgMessaging("eg_resolution"),
m_file0(),
m_file1(),
m_file2(),
m_file3()
: m_file0()
, m_file1()
, m_file2()
, m_file3()
{
ATH_MSG_INFO("Initialize eg_resolution");
if (configuration == "run1") {
m_file0 = std::make_unique<TFile> (PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v5/resolutionFit_electron_run1.root").c_str() );
m_file1 = std::make_unique<TFile> (PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v5/resolutionFit_recoUnconv_run1.root").c_str() );
......@@ -40,10 +37,8 @@ eg_resolution::eg_resolution(const std::string& configuration)
}
if (!m_file0 or !m_file1 or !m_file2 or !m_file3) {
ATH_MSG_ERROR("cannot find input file for resolutions");
throw std::runtime_error("cannot find input file for resolutions");
}
m_hSampling[0][0] = get_object<TH1>(*m_file0, "hsamplingG");
m_hSampling[0][1] = get_object<TH1>(*m_file0, "hsampling80");
m_hSampling[0][2] = get_object<TH1>(*m_file0, "hsampling90");
......@@ -87,12 +82,10 @@ eg_resolution::eg_resolution(const std::string& configuration)
m_etaBins = aa->GetXbins();
}
//=========================================================================
eg_resolution::~eg_resolution(){
}
eg_resolution::~eg_resolution(){}
/*
* inputs are
* inputs are
* particle_type (0=elec, 1=reco unconv photon, 2=reco conv photon, 3=true unconv photon)
* energy in MeV
* eta
......@@ -103,12 +96,10 @@ double eg_resolution::getResolution(int particle_type, double energy, double eta
{
if (particle_type<0 || particle_type>3) {
ATH_MSG_ERROR("particle type must be 0, 1, 2 or 3");
throw std::runtime_error("particle type must be 1, 2 or 3");
}
if (resolution_type<0 || resolution_type>2) {
ATH_MSG_ERROR("resolution type must be 0, 1, 2");
throw std::runtime_error("resolution type must be 0, 1, 2");
}
......@@ -122,7 +113,6 @@ double eg_resolution::getResolution(int particle_type, double energy, double eta
}
if (ibinEta<0 || ibinEta>= m_etaBins->GetSize()) {
ATH_MSG_ERROR("eta outside range");
throw std::runtime_error("eta outside range");
}
......@@ -154,7 +144,6 @@ double eg_resolution::getResolution(const xAOD::Egamma& particle, int resolution
}
assert (particle_type != 1);
// TODO: check definitions
const double eta = particle.caloCluster()->eta();
const double energy = particle.e();
return getResolution(particle_type, energy, eta, resolution_type);
......
/*
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 EG_RESOLUTION_H
#define EG_RESOLUTION_H
#include <stdlib.h>
#include <math.h>
#include "AsgTools/AsgMessaging.h"
#include <cstdlib>
#include <cmath>
#include "xAODEgamma/Egamma.h"
#include "TH1.h"
#include "TFile.h"
......@@ -26,7 +23,7 @@
*/
class eg_resolution : public asg::AsgMessaging{
class eg_resolution {
public:
/** @brief constructor (initialization done there reading root files with resolution fit parameters */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment