ATLAS Offline Software
ShowerShapesHistograms.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include "AsgMessaging/Check.h"
8 #include "GaudiKernel/ITHistSvc.h"
11 
12 #include "TH1D.h"
13 #include "TH2D.h"
14 
15 using namespace egammaMonitoring;
16 
18 
19  const char* fN = m_name.c_str();
20 
21  histoMap["hadleak"] = new TH1D(Form("%s_hadleak",fN), ";E_{hadleak}; Events" , 100, -0.07, 0.13 );
22  histoMap["rhad"] = new TH1D(Form("%s_rhad",fN) , ";R_{had}; Events" , 100, -0.07, 0.13 );
23  histoMap["reta"] = new TH1D(Form("%s_reta",fN) , ";R_{#eta}; Events" , 355, 0. , 1.1005);
24  histoMap["rphi"] = new TH1D(Form("%s_rphi",fN) , ";R_{#phi}; Events" , 355, 0. , 1.1005);
25  histoMap["weta2"] = new TH1D(Form("%s_weta2",fN) , ";W_{#etas2}; Events" , 100, 0. , 0.03 );
26  histoMap["eratio"] = new TH1D(Form("%s_eratio",fN) , ";E_{ratio}; Events" , 101, 0. , 1.01 );
27  histoMap["deltae"] = new TH1D(Form("%s_deltae",fN) , ";#DeltaE [MeV]; Events" , 100, 0. , 500. );
28  histoMap["f1"] = new TH1D(Form("%s_f1",fN) , ";f_{1}; Events" , 100, 0. , 1.0 );
29  histoMap["fside"] = new TH1D(Form("%s_fside",fN) , ";f_{side}; Events" , 100, 0. , 2.0 );
30  histoMap["wtots1"] = new TH1D(Form("%s_wtots1",fN) , ";w_{s, tot}; Events" , 100, 0. , 10. );
31  histoMap["ws3"] = new TH1D(Form("%s_ws3",fN) , ";w_{s, 3}; Events" , 100, 0. , 1. );
32 
33  histoMap["lateral"] = new TH1D(Form("%s_lateral",fN), ";Lateral of seed; Events" , 50, 0. , 1. );
34  histoMap["second_R"] = new TH1D(Form("%s_second_R",fN), ";Second R; Events" , 150, 0. , 15000. );
35  histoMap["EMFrac"] = new TH1D(Form("%s_EMFrac",fN), ";EMFrac; Events" , 51, 0. , 1.02 );
36  histo2DMap["lateral_second_R_2D"] = new TH2D(Form("%s_lateral_second_R_2D",fN), ";Lateral of seed; Second R", 50, 0, 1, 150,0.,15000.);
37 
38  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"lateral", histoMap["lateral"]));
39  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"second_R", histoMap["second_R"]));
40  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"EMFrac", histoMap["EMFrac"]));
41  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"lateral_second_R_2D", histo2DMap["lateral_second_R_2D"]));
42 
43  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"rhad", histoMap["rhad"]));
44  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"hadleak", histoMap["hadleak"]));
45  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"reta", histoMap["reta"]));
46  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"rphi", histoMap["rphi"]));
47  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"weta2", histoMap["weta2"]));
48  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"eratio", histoMap["eratio"]));
49  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"deltae", histoMap["deltae"]));
50  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"f1", histoMap["f1"]));
51  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"fside", histoMap["fside"]));
52  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"wtots1", histoMap["wtots1"]));
53  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"ws3", histoMap["ws3"]));
54 
55  return StatusCode::SUCCESS;
56 
57 } // initializePlots
58 
60 
62 
63  const xAOD::CaloCluster *topoClus(nullptr);
64  if (isFwd)
65  topoClus = egamma.caloCluster();
66  else
67  topoClus =
69 
70  double lateral(0.);
71  double emfrac(0.);
72  double second_r(0.);
73  bool hasBoth = true;
74  if (topoClus->retrieveMoment(xAOD::CaloCluster::ENG_FRAC_EM ,emfrac))
75  histoMap["EMFrac"]->Fill(emfrac);
76 
77  if (topoClus->retrieveMoment(xAOD::CaloCluster::LATERAL,lateral))
78  histoMap["lateral"]->Fill(lateral);
79  else
80  hasBoth = false;
81 
82  if (topoClus->retrieveMoment(xAOD::CaloCluster::SECOND_R,second_r))
83  histoMap["second_R"]->Fill(second_r);
84  else
85  hasBoth = false;
86 
87  if (hasBoth)
88  histo2DMap["lateral_second_R_2D"]->Fill(lateral,second_r);
89 
90  // maybe L2, L3 shapes (e.g. Reta, Rphi, weta2) could be computed for electron in innerwheel,
91  // but certainly not L1
92  if (!isFwd) {
93 
94  float eta2 = std::abs(egamma.caloCluster()->etaBE(2));
95  float rhad = -999;
96  float Reta = -999;
97  float Rphi = -999;
98  float shweta2 = -999;
99  float Eratio = -999;
100  float DeltaE = -999;
101  float frac_f1 = -999;
102  float shfside = -999;
103  float shwtots1 = -999;
104  float shws3 = -999;
105 
106  if (egamma.showerShapeValue(rhad, xAOD::EgammaParameters::Rhad)) {
107  histoMap["rhad"]->Fill(rhad);
108  float rhad1 = -999;
109  if (egamma.showerShapeValue(rhad1, xAOD::EgammaParameters::Rhad1)) {
110  float hadrleak = (eta2 >= 0.8 && eta2 < 1.37) ? rhad : rhad1;
111  histoMap["hadleak"]->Fill(hadrleak);
112  }
113  }
114  if (egamma.showerShapeValue(Reta, xAOD::EgammaParameters::Reta))
115  histoMap["reta"]->Fill(Reta);
116  if (egamma.showerShapeValue(Rphi, xAOD::EgammaParameters::Rphi))
117  histoMap["rphi"]->Fill(Rphi);
118  if (egamma.showerShapeValue(shweta2, xAOD::EgammaParameters::weta2))
119  histoMap["weta2"]->Fill(shweta2);
120  if (egamma.showerShapeValue(frac_f1, xAOD::EgammaParameters::f1))
121  histoMap["f1"]->Fill(frac_f1);
122  // Only fill S1 variables if there some energy in S1 (to avoid under/overflows
123  if (frac_f1 != 0) {
124  if (egamma.showerShapeValue(Eratio, xAOD::EgammaParameters::Eratio))
125  histoMap["eratio"]->Fill(Eratio);
126  if (egamma.showerShapeValue(DeltaE, xAOD::EgammaParameters::DeltaE))
127  histoMap["deltae"]->Fill(DeltaE);
128  if (egamma.showerShapeValue(shfside, xAOD::EgammaParameters::fracs1))
129  histoMap["fside"]->Fill(shfside);
130  if (egamma.showerShapeValue(shwtots1, xAOD::EgammaParameters::wtots1))
131  histoMap["wtots1"]->Fill(shwtots1);
132  if (egamma.showerShapeValue(shws3, xAOD::EgammaParameters::weta1))
133  histoMap["ws3"]->Fill(shws3);
134  }
135  }
136 }
xAOD::CaloCluster_v1::SECOND_R
@ SECOND_R
Second Moment in .
Definition: CaloCluster_v1.h:123
Check.h
egammaMonitoring::ShowerShapesHistograms::m_folder
std::string m_folder
Definition: ShowerShapesHistograms.h:39
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
egammaMonitoring::ShowerShapesHistograms::fill
void fill(const xAOD::Egamma &egamma)
Definition: ShowerShapesHistograms.cxx:59
ParticleGun_SamplingFraction.eta2
eta2
Definition: ParticleGun_SamplingFraction.py:96
xAOD::EgammaParameters::Reta
@ Reta
e237/e277
Definition: EgammaEnums.h:154
ShowerShapesHistograms.h
xAOD::Egamma_v1
Definition: Egamma_v1.h:56
xAOD::EgammaParameters::Rphi
@ Rphi
e233/e237
Definition: EgammaEnums.h:156
xAOD::EgammaParameters::wtots1
@ wtots1
shower width is determined in a window detaxdphi = 0,0625 ×~0,2, corresponding typically to 20 strips...
Definition: EgammaEnums.h:140
egamma
Definition: egamma.h:58
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
EgammaxAODHelpers.h
xAOD::EgammaParameters::f1
@ f1
E1/E = fraction of energy reconstructed in the first sampling, where E1 is energy in all strips belon...
Definition: EgammaEnums.h:52
CaloCluster.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::CaloCluster_v1::retrieveMoment
bool retrieveMoment(MomentType type, double &value) const
Retrieve individual moment.
Definition: CaloCluster_v1.cxx:738
egammaMonitoring::ShowerShapesHistograms::histoMap
std::map< std::string, TH1D * > histoMap
Definition: ShowerShapesHistograms.h:30
egammaMonitoring::ShowerShapesHistograms::histo2DMap
std::map< std::string, TH2D * > histo2DMap
Definition: ShowerShapesHistograms.h:31
xAOD::EgammaHelpers::isFwdElectron
bool isFwdElectron(const xAOD::Egamma *eg)
is the object a Fwd electron
Definition: EgammaxAODHelpers.cxx:17
xAOD::EgammaParameters::Rhad1
@ Rhad1
ethad1/et
Definition: EgammaEnums.h:162
xAOD::CaloCluster_v1::ENG_FRAC_EM
@ ENG_FRAC_EM
Energy fraction in EM calorimeters.
Definition: CaloCluster_v1.h:139
egammaMonitoring
Definition: ClusterHistograms.h:16
egammaMonitoring::ShowerShapesHistograms::m_rootHistSvc
ITHistSvc * m_rootHistSvc
Definition: ShowerShapesHistograms.h:40
egammaMonitoring::ShowerShapesHistograms::m_name
std::string m_name
Definition: ShowerShapesHistograms.h:37
xAOD::CaloCluster_v1::LATERAL
@ LATERAL
Normalized lateral moment.
Definition: CaloCluster_v1.h:137
xAOD::EgammaParameters::weta1
@ weta1
shower width using +/-3 strips around the one with the maximal energy deposit: w3 strips = sqrt{sum(E...
Definition: EgammaEnums.h:97
xAOD::EgammaParameters::Eratio
@ Eratio
(emaxs1-e2tsts1)/(emaxs1+e2tsts1)
Definition: EgammaEnums.h:158
xAOD::EgammaParameters::Rhad
@ Rhad
ethad/et
Definition: EgammaEnums.h:160
xAOD::EgammaParameters::DeltaE
@ DeltaE
e2tsts1-emins1
Definition: EgammaEnums.h:164
xAOD::EgammaParameters::fracs1
@ fracs1
shower shape in the shower core : [E(+/-3)-E(+/-1)]/E(+/-1), where E(+/-n) is the energy in ± n strip...
Definition: EgammaEnums.h:111
egammaMonitoring::ShowerShapesHistograms::initializePlots
StatusCode initializePlots()
Definition: ShowerShapesHistograms.cxx:17
xAOD::EgammaParameters::weta2
@ weta2
the lateral width is calculated with a window of 3x5 cells using the energy weighted sum over all cel...
Definition: EgammaEnums.h:103