ATLAS Offline Software
Loading...
Searching...
No Matches
JetHistoResponseAndEff Class Reference

#include <JetHistoResponseAndEff.h>

Inheritance diagram for JetHistoResponseAndEff:
Collaboration diagram for JetHistoResponseAndEff:

Public Member Functions

 JetHistoResponseAndEff (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~JetHistoResponseAndEff ()
virtual StatusCode initialize ()
virtual StatusCode processJetContainer (const JetMonitoringAlg &parentAlg, const xAOD::JetContainer &jets, const EventContext &ctx) const
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 sysInitialize () override
 Perform system initialization for an algorithm.
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

Static Public Member Functions

static const InterfaceID & interfaceID ()

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< std::string > m_group {this,"Group", "undefined"}
Gaudi::Property< float > m_energyScale {this, "EnergyScale", 1.}
SG::ReadHandleKey< xAOD::JetContainerm_refContainerKey
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

Definition at line 19 of file JetHistoResponseAndEff.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ JetHistoResponseAndEff()

JetHistoResponseAndEff::JetHistoResponseAndEff ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 12 of file JetHistoResponseAndEff.cxx.

12 :
13 AthAlgTool( type, name, parent ),
14 m_refContainerKey("REFCONTAINER")
15{
16 declareInterface<IJetHistoFiller>(this);
17 declareProperty("RefContainerName",m_refContainerKey);
18}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
SG::ReadHandleKey< xAOD::JetContainer > m_refContainerKey

◆ ~JetHistoResponseAndEff()

virtual JetHistoResponseAndEff::~JetHistoResponseAndEff ( )
inlinevirtual

Definition at line 22 of file JetHistoResponseAndEff.h.

22{}

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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< AlgTool > >::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< AlgTool > >::evtStore ( )
inlineinherited

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

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::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

◆ initialize()

StatusCode JetHistoResponseAndEff::initialize ( )
virtual

Definition at line 21 of file JetHistoResponseAndEff.cxx.

21 {
22 ATH_CHECK( m_refContainerKey.initialize() );
23 ATH_MSG_DEBUG(" initialize "<< m_refContainerKey.key());
24 return StatusCode::SUCCESS;
25}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::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.

◆ interfaceID()

const InterfaceID & IJetHistoFiller::interfaceID ( )
inlinestaticinherited

Definition at line 28 of file IJetHistoFiller.h.

28{ return IID_IJetHistoFiller; }
static const InterfaceID IID_IJetHistoFiller("IJetHistoFiller", 1, 0)

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< AlgTool >::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< AlgTool > >::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.

◆ processJetContainer()

StatusCode JetHistoResponseAndEff::processJetContainer ( const JetMonitoringAlg & parentAlg,
const xAOD::JetContainer & jets,
const EventContext & ctx ) const
virtual

Implements IJetHistoFiller.

Definition at line 28 of file JetHistoResponseAndEff.cxx.

28 {
29 if(jets.empty()) return StatusCode::SUCCESS;
30
31 // retrieve the reference jet container (typically : truth jets)
32 SG::ReadHandle<xAOD::JetContainer> refJets(m_refContainerKey, ctx);
33 if (! refJets.isValid() ) {
34 ATH_MSG_ERROR("evtStore() does not contain jet Collection with name "<< m_refContainerKey.key());
35 return StatusCode::FAILURE;
36 }
37
38
39 // declare the variables to be monitored by the framework
40 Monitored::Scalar<float> refPt("refPt");
41 Monitored::Scalar<float> refEta("refEta");
42 Monitored::Scalar<float> relDiff("relDiff");
43 Monitored::Scalar<float> closestDr("closestDr");
44 Monitored::Scalar<bool> passDr1("passDr1");
45 Monitored::Scalar<bool> passDr2("passDr2");
46 Monitored::Scalar<bool> passDr3("passDr3");
47
48
49 std::vector<const xAOD::Jet*> listJets(jets.begin(), jets.end());
50
51 for ( const xAOD::Jet* refjet : *refJets ){
52 if (listJets.empty() ) break;
53 auto dr2 = [&] (const xAOD::Jet* j)
54 { return xAOD::P4Helpers::deltaR2(*j, *refjet); };
55 auto [dr2min, itmin] = CxxUtils::min_transformed_element (listJets, dr2);
56
57 // calculate efficiency and response from matched jet
58 const xAOD::Jet* matched = *itmin;
59
60 // Move the matched entry to the end of the vector and pop it off.
61 auto itend = listJets.end()-1;
62 if (itmin != itend) {
63 std::iter_swap (itmin, itend);
64 }
65 listJets.pop_back();
66
67 double dr = sqrt(dr2min);
68 refPt = refjet->pt() * m_energyScale;
69 closestDr = dr;
70
71 // Set flag passDrX if (reco,truth) jets are closer than deltaR=0.X
72 passDr1 = dr<0.1;
73 passDr2 = dr<0.2;
74 passDr3 = dr<0.3;
75 // using these flags, the framework will fill 3 TEfficiency to draw ( efficiency_at_drX vs pT) (see also configuration) :
76 parentAlg.fill(m_group, refPt , passDr1, passDr2, passDr3 , closestDr);
77
78 if( dr < 0.3) {
79 if (refPt > 0.) relDiff = ( matched->pt()* m_energyScale - refPt )/refPt;
80 else relDiff = -999;
81 refEta = refjet->eta();
82 parentAlg.fill(m_group, refPt , refEta, relDiff );
83 }
84
85 }
86
87 return StatusCode::SUCCESS;
88}
#define ATH_MSG_ERROR(x)
Gaudi::Property< float > m_energyScale
Gaudi::Property< std::string > m_group
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition Jet_v1.cxx:44
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable > > &&variables) const
Fills a vector of variables to a group by reference.
auto min_transformed_element(RANGE &&r, FUNC &&f)
Find the minimum transformed element in a range.
void iter_swap(typename DataModel_detail::iterator< DV > a, typename DataModel_detail::iterator< DV > b)
Specialization of iter_swap for DataVector/DataList.
double deltaR2(double rapidity1, double phi1, double rapidity2, double phi2)
from bare rapidity,phi
Jet_v1 Jet
Definition of the current "jet version".

◆ 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< AlgTool > >::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< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_energyScale

Gaudi::Property<float> JetHistoResponseAndEff::m_energyScale {this, "EnergyScale", 1.}
private

Definition at line 30 of file JetHistoResponseAndEff.h.

30{this, "EnergyScale", 1.};

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_group

Gaudi::Property<std::string> JetHistoResponseAndEff::m_group {this,"Group", "undefined"}
private

Definition at line 29 of file JetHistoResponseAndEff.h.

29{this,"Group", "undefined"};

◆ m_refContainerKey

SG::ReadHandleKey<xAOD::JetContainer> JetHistoResponseAndEff::m_refContainerKey
private

Definition at line 31 of file JetHistoResponseAndEff.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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