ATLAS Offline Software
ParticleHistograms.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 #include "ParticleHistograms.h"
5 
6 #include "GaudiKernel/ITHistSvc.h"
7 #include "AsgMessaging/Check.h"
8 #include "xAODBase/IParticle.h"
9 #include "TH1D.h"
10 
11 namespace egammaMonitoring {
12 
14 
15  const char* fN = m_name.c_str();
16 
17  histoMap["pT"] = new TH1D(Form("%s_pT",fN) , ";p_{T} [GeV];Events", 40, 0, 200);
18  histoMap["eta"] = new TH1D(Form("%s_eta",fN), ";#eta;Events" , 90, -4.5, 4.5);
19  histoMap["phi"] = new TH1D(Form("%s_phi",fN), ";#phi;Events" , 20, -TMath::Pi(), TMath::Pi());
20 
21  histoMap["eta_15GeV"] = new TH1D(Form("%s_eta_15GeV",fN), ";#eta;Events", 90, -4.5, 4.5);
22  histoMap["phi_15GeV"] = new TH1D(Form("%s_phi_15GeV",fN), ";#phi;Events", 20, -TMath::Pi(), TMath::Pi());
23 
24  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"pT", histoMap["pT"]));
25  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"eta", histoMap["eta"]));
26  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"phi", histoMap["phi"]));
27 
28  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"eta_15GeV", histoMap["eta_15GeV"]));
29  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"phi_15GeV", histoMap["phi_15GeV"]));
30 
31  if (m_hasFwd) {
32  histoMap["pT_eta4"] = new TH1D(Form("%s_pT_eta4",fN) , ";p_{T} [GeV];Events",40, 0, 200);
33  histoMap["phi_eta4"] = new TH1D(Form("%s_phi_eta4",fN), ";#phi;Events" ,20, -TMath::Pi(), TMath::Pi());
34  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"pT_eta4", histoMap["pT_eta4"]));
35  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"phi_eta4", histoMap["phi_eta4"]));
36  }
37 
38  return StatusCode::SUCCESS;
39  }
40 
43  }
44 
45  void ParticleHistograms::fill(const xAOD::IParticle& egamma, float /*mu*/) {
46 
47  double pT = egamma.pt()*1e-3;
48  if (pT > 0)
49  histoMap["pT"]->Fill(pT);
50  histoMap["eta"]->Fill(egamma.eta());
51  histoMap["phi"]->Fill(egamma.phi());
52 
53  if (pT > 15) {
54  histoMap["eta_15GeV"]->Fill(egamma.eta());
55  histoMap["phi_15GeV"]->Fill(egamma.phi());
56  }
57 
58  if (m_hasFwd && std::abs(egamma.eta()) < 4.) {
59  histoMap["pT_eta4"]->Fill(pT);
60  histoMap["phi_eta4"]->Fill(egamma.phi());
61  }
62 
63  }
64 
65 }
CalculateHighPtTerm.pT
pT
Definition: ICHEP2016/CalculateHighPtTerm.py:57
Check.h
ParticleImpl::pt
virtual double pt() const
transverse momentum
Definition: ParticleImpl.h:554
IParticle.h
TH1D
Definition: rootspy.cxx:342
egammaMonitoring::ParticleHistograms::fill
void fill(const xAOD::IParticle &egamma)
Definition: ParticleHistograms.cxx:41
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:40
egammaMonitoring::IHistograms::m_rootHistSvc
ITHistSvc * m_rootHistSvc
Definition: IHistograms.h:45
egamma
Definition: egamma.h:58
egammaMonitoring::IHistograms::m_folder
std::string m_folder
Definition: IHistograms.h:44
egammaMonitoring::ParticleHistograms::initializePlots
StatusCode initializePlots()
Definition: ParticleHistograms.cxx:13
ParticleHistograms.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ParticleImpl::phi
virtual double phi() const
phi in [-pi,pi[
Definition: ParticleImpl.h:524
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ParticleImpl::eta
virtual double eta() const
pseudo rapidity
Definition: ParticleImpl.h:514
egammaMonitoring
Definition: ClusterHistograms.h:16
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
egammaMonitoring::ParticleHistograms::m_hasFwd
bool m_hasFwd
Definition: ParticleHistograms.h:29
egammaMonitoring::IHistograms::m_name
std::string m_name
Definition: IHistograms.h:42
egammaMonitoring::IHistograms::histoMap
std::map< std::string, TH1D * > histoMap
Definition: IHistograms.h:37