ATLAS Offline Software
Reconstruction
egamma
egammaValidation
src
ClusterHistograms.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 "
ClusterHistograms.h
"
6
#include "GaudiKernel/ITHistSvc.h"
7
#include "
AthenaBaseComps/AthCheckMacros.h
"
8
#include "
xAODEgamma/EgammaxAODHelpers.h
"
9
#include "
xAODTruth/TruthParticle.h
"
10
#include "
xAODTruth/xAODTruthHelpers.h
"
11
#include "
xAODCaloEvent/CaloCluster.h
"
12
#include "
CaloEvent/CaloClusterCellLink.h
"
13
#include "
CaloEvent/CaloCell.h
"
14
15
#include "TH2D.h"
16
#include "TProfile.h"
17
18
using namespace
egammaMonitoring
;
19
20
StatusCode
ClusterHistograms::initializePlots
() {
21
22
const
char
* fN =
m_name
.c_str();
23
24
for
(
int
is = 0; is < 4; is++) {
25
TString pNm = Form(
"number_cells_vs_eta_in_layer_%i_profile"
,is);
26
TString pN = Form(
"%s_number_cells_vs_eta_in_layer_%i_profile"
,fN,is);
27
profileMap
[pNm.Data()] =
new
TProfile
(pN.Data(),
"Number of cells;truth #eta"
, 90,-4.5,4.5, 0, 100);
28
pN = Form(
"%s%s"
,
m_folder
.c_str(),pNm.Data());
29
ATH_CHECK
(
m_rootHistSvc
->regHist(pN.Data(),
profileMap
[pNm.Data()]));
30
31
pNm = Form(
"number_cells_vs_e_in_layer_%i_profile"
,is);
32
pN = Form(
"%s_number_cells_vs_e_in_layer_%i_profile"
,fN,is);
33
profileMap
[pNm.Data()] =
new
TProfile
(pN.Data(),
"Number of cells;truth E [GeV]"
, 60, 0, 300, 0, 100);
34
pN = Form(
"%s%s"
,
m_folder
.c_str(),pNm.Data());
35
ATH_CHECK
(
m_rootHistSvc
->regHist(pN.Data(),
profileMap
[pNm.Data()]));
36
}
37
38
for
(
int
is = 0; is < 24; is++) {
39
TString pNm = Form(
"number_cells_vs_eta_in_sampling_%i_profile"
,is);
40
TString pN = Form(
"%s_number_cells_vs_eta_in_sampling_%i_profile"
,fN,is);
41
profileMap
[pNm.Data()] =
new
TProfile
(pN.Data(),
"Number of cells;truth #eta"
, 90,-4.5,4.5, 0,100);
42
pN = Form(
"%s%s"
,
m_folder
.c_str(),pNm.Data());
43
ATH_CHECK
(
m_rootHistSvc
->regHist(pN.Data(),
profileMap
[pNm.Data()]));
44
}
45
46
profileMap
[
"Eraw_Etruth_vs_Etruth_profile"
] =
new
TProfile
(Form(
"%s_Eraw_Etruth_vs_Etruth_profile"
,fN),
";E^{truth};E^{raw}/E^{truth}"
, 100, 0., 200., 0.5, 1.5);
47
profileMap
[
"Eraw_Etruth_vs_eta_profile"
] =
new
TProfile
(Form(
"%s_Eraw_Etruth_vs_eta_profile"
,fN),
";truth #eta;E^{raw}/E^{truth}"
, 90, -4.5, 4.5, 0.5, 1.5);
48
49
profileMap
[
"number_topocluster_vs_e_profile"
] =
new
TProfile
(Form(
"%s_number_topocluster_vs_e_profile"
,fN),
"Number of topocluster;truth E [GeV]"
, 60, 0, 300, -0.5, 14.5);
50
profileMap
[
"number_topocluster_vs_eta_profile"
] =
new
TProfile
(Form(
"%s_number_topocluster_vs_eta_profile"
,fN),
"Number of topocluster;truth #eta"
, 90,-4.5,4.5, -0.5, 14.5);
51
52
// do not undertstand this histo...
53
profileMap
[
"number_cell_in_layer"
] =
new
TProfile
(Form(
"%s_number_cell_in_layer"
,fN),
";Number of cells;Layer"
, 100, 0, 200,0, 4);
54
histo2DMap
[
"mu_energy_resolution_2D"
] =
new
TH2D(Form(
"%s_mu_energy_resolution_2D"
,fN),
";<#mu>; Energy Resolution"
, 5, 0, 80, 20, -1, 1);
55
56
ATH_CHECK
(
m_rootHistSvc
->regHist(
m_folder
+
"Eraw_Etruth_vs_Etruth_profile"
,
profileMap
[
"Eraw_Etruth_vs_Etruth_profile"
]));
57
ATH_CHECK
(
m_rootHistSvc
->regHist(
m_folder
+
"Eraw_Etruth_vs_eta_profile"
,
profileMap
[
"Eraw_Etruth_vs_eta_profile"
]));
58
59
ATH_CHECK
(
m_rootHistSvc
->regHist(
m_folder
+
"number_topocluster_vs_e_profile"
,
profileMap
[
"number_topocluster_vs_e_profile"
]));
60
ATH_CHECK
(
m_rootHistSvc
->regHist(
m_folder
+
"number_topocluster_vs_eta_profile"
,
profileMap
[
"number_topocluster_vs_eta_profile"
]));
61
62
ATH_CHECK
(
m_rootHistSvc
->regHist(
m_folder
+
"number_cell_in_layer"
,
profileMap
[
"number_cell_in_layer"
]));
63
ATH_CHECK
(
m_rootHistSvc
->regHist(
m_folder
+
"mu_energy_resolution_2D"
,
histo2DMap
[
"mu_energy_resolution_2D"
]));
64
65
return
StatusCode::SUCCESS;
66
67
}
// initializePlots
68
69
void
ClusterHistograms::fill
(
const
xAOD::Egamma
&
egamma
) {
70
fill
(
egamma
,0.);
71
}
72
73
void
ClusterHistograms::fill
(
const
xAOD::Egamma
&
egamma
,
float
mu
= 0) {
74
75
const
xAOD::CaloCluster
*cluster =
egamma
.caloCluster();
76
77
const
xAOD::TruthParticle
*truth_egamma =
xAOD::TruthHelpers::getTruthParticle
(
egamma
);
78
79
if
( !truth_egamma )
return
;
80
81
const
auto
Ereco = cluster->
rawE
();
82
const
auto
Etruth = truth_egamma->
e
();
83
const
auto
Eres = (Ereco - Etruth)/Etruth;
84
85
profileMap
[
"Eraw_Etruth_vs_Etruth_profile"
]->Fill(Etruth/1000,Ereco/Etruth);
86
profileMap
[
"Eraw_Etruth_vs_eta_profile"
]->Fill(truth_egamma->
eta
(),Ereco/Etruth);
87
histo2DMap
[
"mu_energy_resolution_2D"
]->Fill(
mu
,Eres);
88
89
const
CaloClusterCellLink
* cellLinks = cluster->
getCellLinks
();
90
91
if
( !cellLinks )
return
;
92
93
std::map<int, int > cells_per_layer;
94
std::map<int, int > cells_per_sam;
95
96
for
(
const
CaloCell
*
cell
: *cellLinks) {
97
if
(
cell
) {
98
int
layer
=
cell
->caloDDE()->getLayer();
99
cells_per_layer[
layer
]++;
100
int
sam =
cell
->caloDDE()->getSampling();
101
cells_per_sam[sam]++;
102
}
103
}
104
105
auto
associatedTopoCluster =
xAOD::EgammaHelpers::getAssociatedTopoClusters
(cluster);
106
profileMap
[
"number_topocluster_vs_e_profile"
]->Fill(Etruth/1000, associatedTopoCluster.size());
107
profileMap
[
"number_topocluster_vs_eta_profile"
]->Fill(truth_egamma->
eta
(), associatedTopoCluster.size());
108
109
for
(
auto
const
&
x
: cells_per_layer) {
110
profileMap
[
"number_cell_in_layer"
]->Fill(
x
.second,
x
.first);
111
profileMap
[
"number_cells_vs_e_in_layer_"
+
std::to_string
(
x
.first)+
"_profile"
]->Fill(Etruth/1000,
x
.second);
112
profileMap
[
"number_cells_vs_eta_in_layer_"
+
std::to_string
(
x
.first)+
"_profile"
]->Fill(truth_egamma->
eta
(),
x
.second);
113
}
114
for
(
auto
const
&
x
: cells_per_sam) {
115
profileMap
[Form(
"number_cells_vs_eta_in_sampling_%i_profile"
,
x
.first)]->Fill(truth_egamma->
eta
(),
x
.second);
116
}
117
118
}
xAOD::CaloCluster_v1::rawE
flt_t rawE() const
xAOD::EgammaHelpers::getAssociatedTopoClusters
std::vector< const xAOD::CaloCluster * > getAssociatedTopoClusters(const xAOD::CaloCluster *cluster)
Return a vector of all the topo clusters associated with the egamma cluster.
Definition:
EgammaxAODHelpers.cxx:65
ReadCellNoiseFromCool.cell
cell
Definition:
ReadCellNoiseFromCool.py:53
AthCheckMacros.h
CaloCell.h
xAOD::Egamma_v1
Definition:
Egamma_v1.h:56
xAODTruthHelpers.h
x
#define x
egammaMonitoring::ClusterHistograms::m_folder
std::string m_folder
Definition:
ClusterHistograms.h:45
ClusterHistograms.h
egamma
Definition:
egamma.h:58
CaloClusterCellLink
Bookkeeping of cells that make up a cluster Simplified replacement for CaloCellLink,...
Definition:
CaloClusterCellLink.h:24
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition:
CaloCluster_v1.h:59
EgammaxAODHelpers.h
xAOD::TruthParticle_v1::e
virtual double e() const override final
The total energy of the particle.
CaloCluster.h
python.TrigEgammaMonitorHelper.TProfile
def TProfile(*args, **kwargs)
Definition:
TrigEgammaMonitorHelper.py:81
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
egammaMonitoring::ClusterHistograms::fill
void fill(const xAOD::Egamma &egamma)
Definition:
ClusterHistograms.cxx:69
TRT::Hit::layer
@ layer
Definition:
HitInfo.h:79
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition:
TruthParticle_v1.h:37
egammaMonitoring::ClusterHistograms::histo2DMap
std::map< std::string, TH2D * > histo2DMap
Definition:
ClusterHistograms.h:35
ATH_CHECK
#define ATH_CHECK
Definition:
AthCheckMacros.h:40
xAOD::CaloCluster_v1::getCellLinks
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
Definition:
CaloCluster_v1.cxx:905
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition:
GeometryDefs.h:34
xAOD::TruthHelpers::getTruthParticle
const xAOD::TruthParticle * getTruthParticle(const xAOD::IParticle &p)
Return the truthParticle associated to the given IParticle (if any)
Definition:
xAODTruthHelpers.cxx:25
egammaMonitoring
Definition:
ClusterHistograms.h:19
egammaMonitoring::ClusterHistograms::initializePlots
StatusCode initializePlots()
Definition:
ClusterHistograms.cxx:20
xAOD::TruthParticle_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition:
TruthParticle_v1.cxx:174
egammaMonitoring::ClusterHistograms::m_name
std::string m_name
Definition:
ClusterHistograms.h:43
egammaMonitoring::ClusterHistograms::profileMap
std::map< std::string, TProfile * > profileMap
Definition:
ClusterHistograms.h:36
CaloCell
Data object for each calorimeter readout cell.
Definition:
CaloCell.h:57
CaloClusterCellLink.h
egammaMonitoring::ClusterHistograms::m_rootHistSvc
SmartIF< ITHistSvc > m_rootHistSvc
Definition:
ClusterHistograms.h:46
TruthParticle.h
CaloNoise_fillDB.mu
mu
Definition:
CaloNoise_fillDB.py:53
Generated on Thu Nov 7 2024 21:11:58 for ATLAS Offline Software by
1.8.18