ATLAS Offline Software
Loading...
Searching...
No Matches
Analysis::CalibrationDataInterfaceTester Class Reference

Minimal test of the CalibrationDataInterfaceTool functionality. More...

#include <CalibrationDataInterfaceTester.h>

Inheritance diagram for Analysis::CalibrationDataInterfaceTester:
Collaboration diagram for Analysis::CalibrationDataInterfaceTester:

Public Member Functions

 CalibrationDataInterfaceTester (const std::string &name, ISvcLocator *pSvcLocator)
 Standard Athena-Algorithm Constructor.
virtual ~CalibrationDataInterfaceTester ()=default
 Default Destructor.
StatusCode initialize () override
 standard Athena-Algorithm method
StatusCode execute () override
 standard Athena-Algorithm method
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

Gaudi::Property m_jetCollection
 jet collection name
Gaudi::Property m_tagger
 tagger name
Gaudi::Property m_operatingPoint
 tagger operating point
std::string m_calibrationUncertainty
 calibration uncertainty result
CalibrationDataInterfaceTool::Uncertainty m_uncertaintyType
ToolHandle< ICalibrationDataInterfaceToolm_calibrationInterface {this, "ICalibrationDataInterfaceTool", "", "CalibrationDataInterface Tool"}
 pointer to the CalibrationDataInterfaceTool
SG::ReadHandleKey< JetCollectionm_JetCollectionKey {this, "JetCollectionKey", "", "read jet collection"}
 I/O handlers.
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Minimal test of the CalibrationDataInterfaceTool functionality.

Author
Frank Filthaut F.Fil.nosp@m.thau.nosp@m.t@sci.nosp@m.ence.nosp@m..ru.n.nosp@m.l

Definition at line 31 of file CalibrationDataInterfaceTester.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ CalibrationDataInterfaceTester()

Analysis::CalibrationDataInterfaceTester::CalibrationDataInterfaceTester ( const std::string & name,
ISvcLocator * pSvcLocator )

Standard Athena-Algorithm Constructor.

Definition at line 24 of file CalibrationDataInterfaceTester.cxx.

25 : AthAlgorithm(name, pSvcLocator)
26{
27 // template for property declaration
28 declareProperty("JetCollection", m_jetCollection, "name of the jet collection to be used");
29 declareProperty("Tagger", m_tagger, "name of the tagging algorithm to be used");
30 declareProperty("OperatingPoint", m_operatingPoint, "name of the tagging algorithm operating point to be used");
31 declareProperty("CalibrationUncertainty", m_calibrationUncertainty, "calibration uncertainty result");
32 declareProperty("CalibrationInterface", m_calibrationInterface, "interface tool instance name");
33}
std::string m_calibrationUncertainty
calibration uncertainty result
ToolHandle< ICalibrationDataInterfaceTool > m_calibrationInterface
pointer to the CalibrationDataInterfaceTool
Gaudi::Property m_operatingPoint
tagger operating point
AthAlgorithm()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ ~CalibrationDataInterfaceTester()

virtual Analysis::CalibrationDataInterfaceTester::~CalibrationDataInterfaceTester ( )
virtualdefault

Default Destructor.

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode Analysis::CalibrationDataInterfaceTester::execute ( )
override

standard Athena-Algorithm method

Definition at line 68 of file CalibrationDataInterfaceTester.cxx.

69{
70 // Code entered here will be executed once per event
71
72 // retrieve the desired jet collection
73 EventContext& ctx = Gaudi::Hive::currentContext();
74 SG::ReadHandle<JetCollection> jets(m_JetCollectionKey, ctx);
75 ATH_CHECK(jets.isValid());
76
77 int njtag = (*jets).size();
78 ATH_MSG_INFO("JetCollection " << m_jetCollection
79 << " found with " << njtag << " jets.");
80
81 for (auto jetItr : jets) {
82 // --- get btagging weight for the tagger under consideration
83 double weight = (*jetItr)->getFlavourTagWeight(m_tagger);
84
85 // --- get the true label of the jet from MC Truth:
86 const Analysis::TruthInfo* mcinfo = (*jetItr)->tagInfo<Analysis::TruthInfo>("TruthInfo");
87 if (! mcinfo) {
88 ATH_MSG_DEBUG("could not find TruthInfo for matching jet");
89 continue;
90 }
91 string label = mcinfo->jetTruthLabel();
92
93 std::pair<double, double> sfResult =
95 std::pair<double, double> effResult =
97
98 ATH_MSG_DEBUG("Jet with " << m_tagger << " weight: " << weight);
99 ATH_MSG_DEBUG(" label: " << label);
100 ATH_MSG_DEBUG(" SF (unc.): " << sfResult.first
101 << "(" << sfResult.second << ")");
102 ATH_MSG_DEBUG(" eff (unc.): " << effResult.first << "(" << effResult.second << ")");
103
104 }
105
106 return StatusCode::SUCCESS;
107}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
SG::ReadHandleKey< JetCollection > m_JetCollectionKey
I/O handlers.
CalibrationDataInterfaceTool::Uncertainty m_uncertaintyType
const std::string & jetTruthLabel() const
return the truth label
Definition TruthInfo.h:79
std::string label(const std::string &format, int i)
Definition label.h:19

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ initialize()

StatusCode Analysis::CalibrationDataInterfaceTester::initialize ( )
override

standard Athena-Algorithm method

Definition at line 37 of file CalibrationDataInterfaceTester.cxx.

38{
39
40
41 ATH_CHECK(m_JetCollectionKey.initialize());
42
44 if (sc.isFailure()) {
45 ATH_MSG_ERROR("initialize() in " << name() << ": unable to retrieve "
46 << "calibration interface tool!");
47 return sc;
48 }
49
50 std::transform(m_calibrationUncertainty.begin(), m_calibrationUncertainty.end(),
52 if (m_calibrationUncertainty.find("total") != string::npos) {
53 m_uncertaintyType = CalibrationDataInterfaceTool::Total;
54 } else if (m_calibrationUncertainty.find("syst") != string::npos) {
55 m_uncertaintyType = CalibrationDataInterfaceTool::Systematic;
56 } else if (m_calibrationUncertainty.find("stat") != string::npos) {
57 m_uncertaintyType = CalibrationDataInterfaceTool::Statistical;
58 } else {
59 m_uncertaintyType = CalibrationDataInterfaceTool::None;
60 }
61
62 ATH_MSG_INFO("initialize() successful in " << name());
63 return StatusCode::SUCCESS;
64}
#define ATH_MSG_ERROR(x)
void tolower(std::string &s)
static Double_t sc
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
#define ATH_MSG_WARNING(x)
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_calibrationInterface

ToolHandle<ICalibrationDataInterfaceTool> Analysis::CalibrationDataInterfaceTester::m_calibrationInterface {this, "ICalibrationDataInterfaceTool", "", "CalibrationDataInterface Tool"}
private

pointer to the CalibrationDataInterfaceTool

Definition at line 61 of file CalibrationDataInterfaceTester.h.

61{this, "ICalibrationDataInterfaceTool", "", "CalibrationDataInterface Tool"};

◆ m_calibrationUncertainty

std::string Analysis::CalibrationDataInterfaceTester::m_calibrationUncertainty
private

calibration uncertainty result

Definition at line 57 of file CalibrationDataInterfaceTester.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_jetCollection

Gaudi::Property Analysis::CalibrationDataInterfaceTester::m_jetCollection
private

jet collection name

Definition at line 48 of file CalibrationDataInterfaceTester.h.

◆ m_JetCollectionKey

SG::ReadHandleKey<JetCollection> Analysis::CalibrationDataInterfaceTester::m_JetCollectionKey {this, "JetCollectionKey", "", "read jet collection"}
private

I/O handlers.

Definition at line 64 of file CalibrationDataInterfaceTester.h.

64{this, "JetCollectionKey", "", "read jet collection"};

◆ m_operatingPoint

Gaudi::Property Analysis::CalibrationDataInterfaceTester::m_operatingPoint
private

tagger operating point

Definition at line 54 of file CalibrationDataInterfaceTester.h.

◆ m_tagger

Gaudi::Property Analysis::CalibrationDataInterfaceTester::m_tagger
private

tagger name

Definition at line 51 of file CalibrationDataInterfaceTester.h.

◆ m_uncertaintyType

CalibrationDataInterfaceTool::Uncertainty Analysis::CalibrationDataInterfaceTester::m_uncertaintyType
private

Definition at line 58 of file CalibrationDataInterfaceTester.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: