ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetMonitoring
Root
EfficiencyResponseHistos.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
JetMonitoring/EfficiencyResponseHistos.h
"
6
7
#include "
JetMonitoring/ToolHandleHistoHelper.h
"
8
#include "
FourMomUtils/xAODP4Helpers.h
"
9
#include "
AthenaKernel/Units.h
"
10
11
#include "TH1.h"
12
#include "TH2.h"
13
#include "TProfile.h"
14
#include <cmath>
15
16
17
using
Athena::Units::GeV;
18
19
20
EfficiencyResponseHistos::EfficiencyResponseHistos
(
const
std::string &t) :
JetHistoBase
(t)
21
,
m_histoDef
(this)
22
{
23
declareProperty
(
"HistoDef"
,
m_histoDef
,
"The list of HistoDefinitionTool defining the histos to be used in this tool"
);
24
declareProperty
(
"RefContainer"
,
m_refContainerName
);
25
}
26
27
28
29
StatusCode
EfficiencyResponseHistos::initialize
() {
30
CHECK
(
m_histoDef
.retrieve() );
31
return
StatusCode::SUCCESS;
32
}
33
34
int
EfficiencyResponseHistos::buildHistos
(){
35
ATH_MSG_INFO
(
" buildHistos num of histos : "
<<
m_histoDef
.size() );
36
37
ToolHandleHistoHelper::HistoRetriever
hbuilder(
m_histoDef
);
38
39
// Histos are defined in jobOptions !
40
// For each histo, ask hbuilder if a corresponding definition exists in the jobOption list.
41
// -> if so a valid histo is returned (and booked)
42
// -> else NULL is returned
43
m_eff1
=
bookHisto
( hbuilder.
build
<TProfile>(
"erhEfficiencyR1"
) );
44
m_eff2
=
bookHisto
( hbuilder.
build
<TProfile>(
"erhEfficiencyR2"
) );
45
m_eff3
=
bookHisto
( hbuilder.
build
<TProfile>(
"erhEfficiencyR3"
) );
46
47
m_etres
=
bookHisto
( hbuilder.
build
<TH1F>(
"erhResponse"
) );
48
m_etres_eta
=
bookHisto
( hbuilder.
build
<TProfile>(
"erhResponseVsEta"
) );
49
m_etres_pt
=
bookHisto
( hbuilder.
build
<TProfile>(
"erhResponseVsPt"
) );
50
51
m_etres_noShift
=
bookHisto
( hbuilder.
build
<TH1F>(
"erhResponse_noShift"
) );
52
m_etres_noShift_eta
=
bookHisto
( hbuilder.
build
<TProfile>(
"erhResponseVsEta_noShift"
) );
53
m_etres_noShift_pt
=
bookHisto
( hbuilder.
build
<TProfile>(
"erhResponseVsPt_noShift"
) );
54
55
m_deltaRclosest
=
bookHisto
( hbuilder.
build
<TH1F>(
"erhDeltaR"
) );
56
57
58
return
0;
59
}
60
61
62
int
EfficiencyResponseHistos::fillHistosFromContainer
(
const
xAOD::JetContainer
&cont,
float
weight){
63
64
const
xAOD::JetContainer
* refContainer =
nullptr
;
65
CHECK
(
evtStore
()->retrieve( refContainer,
m_refContainerName
), 1 );
67
std::list<const xAOD::Jet*> listJets(cont.
begin
(), cont.
end
());
68
69
for
(
const
xAOD::Jet
* refjet : *refContainer ){
70
double
dr2min = 500000;
71
72
if
(listJets.empty() )
break
;
73
// find the min match
74
std::list<const xAOD::Jet*>::iterator it=listJets.begin();
75
std::list<const xAOD::Jet*>::iterator itmin=listJets.end();
76
for
( ; it != listJets.end(); ++it) {
77
double
dr2 =
xAOD::P4Helpers::deltaR2
(*(*it),*refjet,
false
);
78
if
(dr2 < dr2min) { dr2min = dr2; itmin = it ;}
79
}
80
if
(itmin == listJets.end())
break
;
81
const
xAOD::Jet
* matched = *itmin;
82
//cppcheck-suppress eraseIteratorOutOfBoundsCond
83
listJets.erase(itmin);
84
85
double
dr = std::sqrt(dr2min);
86
double
refPt = refjet->pt() /
GeV
;
87
88
m_eff1
->Fill(refPt, dr<0.1 ? weight : 0 );
// 0 weight if not matching close enough
89
m_eff2
->Fill(refPt, dr<0.2 ? weight : 0 );
// 0 weight if not matching close enough
90
m_eff3
->Fill(refPt, dr<0.3 ? weight : 0 );
// 0 weight if not matching close enough
91
92
m_deltaRclosest
->Fill( dr, weight );
93
94
if
( dr < 0.3) {
95
double
relDiff = -999;
96
double
response
= -999;
97
if
(refPt > 0.){
98
relDiff = ( matched->
pt
() /
GeV
- refPt )/refPt;
99
response
= (matched->
pt
() /
GeV
)/refPt;
100
}
101
m_etres
->Fill( relDiff, weight );
102
m_etres_eta
->Fill( refjet->eta(), relDiff, weight);
103
m_etres_pt
->Fill( refPt, relDiff, weight);
104
105
m_etres_noShift
->Fill(
response
, weight );
106
m_etres_noShift_eta
->Fill( refjet->eta(),
response
, weight);
107
m_etres_noShift_pt
->Fill( refPt,
response
, weight);
108
}
109
110
}
111
112
113
return
0;
114
}
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
EfficiencyResponseHistos.h
response
MDT_Response response
Definition
MDT_ResponseTest.cxx:28
GeV
#define GeV
Definition
PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
ToolHandleHistoHelper.h
Units.h
Wrapper to avoid constant divisions when using units.
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
EfficiencyResponseHistos::m_etres_noShift_pt
TProfile * m_etres_noShift_pt
Definition
EfficiencyResponseHistos.h:47
EfficiencyResponseHistos::m_histoDef
ToolHandleArray< HistoDefinitionTool > m_histoDef
Definition
EfficiencyResponseHistos.h:33
EfficiencyResponseHistos::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition
EfficiencyResponseHistos.cxx:29
EfficiencyResponseHistos::m_eff3
TProfile * m_eff3
Definition
EfficiencyResponseHistos.h:39
EfficiencyResponseHistos::m_refContainerName
std::string m_refContainerName
Definition
EfficiencyResponseHistos.h:34
EfficiencyResponseHistos::m_eff2
TProfile * m_eff2
Definition
EfficiencyResponseHistos.h:38
EfficiencyResponseHistos::EfficiencyResponseHistos
EfficiencyResponseHistos(const std::string &t)
Definition
EfficiencyResponseHistos.cxx:20
EfficiencyResponseHistos::m_eff1
TProfile * m_eff1
Definition
EfficiencyResponseHistos.h:37
EfficiencyResponseHistos::m_etres_noShift_eta
TProfile * m_etres_noShift_eta
Definition
EfficiencyResponseHistos.h:46
EfficiencyResponseHistos::m_etres_pt
TProfile * m_etres_pt
Definition
EfficiencyResponseHistos.h:43
EfficiencyResponseHistos::buildHistos
virtual int buildHistos()
Definition
EfficiencyResponseHistos.cxx:34
EfficiencyResponseHistos::m_etres
TH1F * m_etres
Definition
EfficiencyResponseHistos.h:41
EfficiencyResponseHistos::m_etres_eta
TProfile * m_etres_eta
Definition
EfficiencyResponseHistos.h:42
EfficiencyResponseHistos::fillHistosFromContainer
virtual int fillHistosFromContainer(const xAOD::JetContainer &cont, float weight)
Definition
EfficiencyResponseHistos.cxx:62
EfficiencyResponseHistos::m_etres_noShift
TH1F * m_etres_noShift
Definition
EfficiencyResponseHistos.h:45
EfficiencyResponseHistos::m_deltaRclosest
TH1F * m_deltaRclosest
Definition
EfficiencyResponseHistos.h:49
HistoGroupBase::bookHisto
T * bookHisto(T *h, Interval_t ityp=useToolInterval)
register the histo h in this group (if h!=NULL). The histo name is changed if m_prefixedHistoName==tr...
Definition
HistoGroupBase.h:69
JetHistoBase::JetHistoBase
JetHistoBase(const std::string &t)
Definition
JetHistoBase.cxx:10
xAOD::Jet_v1::pt
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition
Jet_v1.cxx:44
xAOD::P4Helpers::deltaR2
double deltaR2(double rapidity1, double phi1, double rapidity2, double phi2)
from bare rapidity,phi
Definition
xAODP4Helpers.h:111
xAOD::Jet
Jet_v1 Jet
Definition of the current "jet version".
Definition
Event/xAOD/xAODJet/xAODJet/Jet.h:17
xAOD::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition
JetContainer.h:17
ToolHandleHistoHelper::HistoRetriever
Definition
ToolHandleHistoHelper.h:26
ToolHandleHistoHelper::HistoRetriever::build
T * build(const std::string &n)
Definition
ToolHandleHistoHelper.h:44
xAODP4Helpers.h
Generated on
for ATLAS Offline Software by
1.17.0