ATLAS Offline Software
Loading...
Searching...
No Matches
IPhotonObservableTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef EGAMMAANALYSISINTERFACES__IPHOTONOBSERVABLETOOL__
6#define EGAMMAANALYSISINTERFACES__IPHOTONOBSERVABLETOOL__
7
8#include <stdexcept>
9#include <string>
10#include <type_traits>
12#include "xAODEgamma/Photon.h"
13
14class IPhotonObservableTool : public virtual IObservableTool {
16
17 public:
18 virtual ~IPhotonObservableTool() = default;
19
20 virtual double evaluate(const xAOD::Photon* photon) const = 0;
21
22 double evaluate(const xAOD::IParticle* particle) const override final {
23 if (const auto* photon = dynamic_cast<const xAOD::Photon*>(particle)) {
24 return evaluate(photon);
25 } else {
26 throw std::invalid_argument("Wrong particle type, input=" + std::to_string(particle->type()));
27 }
28 }
29};
30
31#endif
#define ASG_TOOL_INTERFACE(CLASSNAME)
Interface for tools that want to calculate a quantity from an xAOD::IParticle.
double evaluate(const xAOD::IParticle *particle) const override final
returns: the value that was calculated from the xAOD::IParticle
virtual ~IPhotonObservableTool()=default
virtual double evaluate(const xAOD::Photon *photon) const =0
Class providing the definition of the 4-vector interface.
Photon_v1 Photon
Definition of the current "egamma version".