ATLAS Offline Software
RecoElectronHistograms.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "AsgMessaging/Check.h"
7 #include "GaudiKernel/ITHistSvc.h"
8 
9 #include "TH2D.h"
10 #include "TH3D.h"
11 
12 using namespace egammaMonitoring;
13 
15 
17 
18  const char* fN = m_name.c_str();
19 
20  if (!m_isData) {
21  histoMap["truthType"] = new TH1D(Form("%s_truthType",fN), ";truth type; Events", 41,-1,40);
22  histoMap["truthOrigin"] = new TH1D(Form("%s_truthOrigin",fN), ";truth origin; Events",51,-1,50);
23  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"truthType", histoMap["truthType"]));
24  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"truthOrigin", histoMap["truthOrigin"]));
25  }
26 
27  histo2DMap["eta_nTracks"] = new TH2D(Form("%s_eta_nTracks",fN),
28  ";#eta;n_{trk}; Events", 90, -4.5, 4.5, 10, 0,10);
29  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"eta_nTracks", histo2DMap["eta_nTracks"]));
30 
31  histo3DMap["eteta_eop"] = new TH3D(Form("%s_eteta_eop",fN),
32  ";E_{T} [GeV];#eta;E/p; Events", 20, 0, 200, 25, 0, 2.5, 250, 0.5,3.);
33  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"eteta_eop", histo3DMap["eteta_eop"]));
34 
35  return StatusCode::SUCCESS;
36 
37 }
38 
40 
42 
43  if (!m_isData) {
44  static const SG::AuxElement::ConstAccessor<int> accType("truthType");
45  static const SG::AuxElement::ConstAccessor<int> accOrigin("truthOrigin");
46  if (accOrigin.isAvailable(elrec))
47  histoMap["truthOrigin"]->Fill(accOrigin(elrec));
48  else
49  histoMap["truthOrigin"]->Fill(-1);
50  if (accType.isAvailable(elrec))
51  histoMap["truthType"]->Fill(accType(elrec));
52  else
53  histoMap["truthType"]->Fill(-1);
54  }
55 
56  histo2DMap["eta_nTracks"]->Fill(elrec.eta(),elrec.nTrackParticles());
57  if (elrec.nTrackParticles())
58  histo3DMap["eteta_eop"]->Fill(elrec.pt()*1e-3,std::abs(elrec.eta()),elrec.pt()/elrec.trackParticle()->pt());
59 
60 }
61 
xAOD::TrackParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: TrackParticle_v1.cxx:73
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
egammaMonitoring::RecoElectronHistograms::initializePlots
StatusCode initializePlots()
Definition: RecoElectronHistograms.cxx:14
egammaMonitoring::RecoElectronHistograms::histo2DMap
std::map< std::string, TH2D * > histo2DMap
Definition: RecoElectronHistograms.h:21
Check.h
egammaMonitoring::RecoElectronHistograms::histo3DMap
std::map< std::string, TH3D * > histo3DMap
Definition: RecoElectronHistograms.h:22
xAOD::Electron_v1::trackParticle
const xAOD::TrackParticle * trackParticle(size_t index=0) const
Pointer to the xAOD::TrackParticle/s that match the electron candidate.
Definition: Electron_v1.cxx:55
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
egammaMonitoring::ParticleHistograms::fill
void fill(const xAOD::IParticle &egamma)
Definition: ParticleHistograms.cxx:41
RecoElectronHistograms.h
xAOD::Electron_v1::nTrackParticles
size_t nTrackParticles() const
Return the number xAOD::TrackParticles that match the electron candidate.
Definition: Electron_v1.cxx:44
egammaMonitoring::RecoElectronHistograms::fill
void fill(const xAOD::Electron &elrec)
Definition: RecoElectronHistograms.cxx:39
egammaMonitoring::IHistograms::m_folder
std::string m_folder
Definition: IHistograms.h:47
egammaMonitoring::IHistograms::m_rootHistSvc
SmartIF< ITHistSvc > m_rootHistSvc
Definition: IHistograms.h:48
egammaMonitoring::ParticleHistograms::initializePlots
StatusCode initializePlots()
Definition: ParticleHistograms.cxx:13
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
egammaMonitoring::RecoElectronHistograms::m_isData
bool m_isData
Definition: RecoElectronHistograms.h:32
egammaMonitoring
Definition: ClusterHistograms.h:19
xAOD::Electron_v1
Definition: Electron_v1.h:34
xAOD::Egamma_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: Egamma_v1.cxx:65
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
xAOD::Egamma_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: Egamma_v1.cxx:70
egammaMonitoring::IHistograms::m_name
std::string m_name
Definition: IHistograms.h:45
egammaMonitoring::IHistograms::histoMap
std::map< std::string, TH1D * > histoMap
Definition: IHistograms.h:40