ATLAS Offline Software
RecoPhotonHistograms.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "RecoPhotonHistograms.h"
6 
7 #include "AsgMessaging/Check.h"
8 #include "GaudiKernel/ITHistSvc.h"
10 #include "xAODTruth/TruthVertex.h"
12 
13 #include "TH1D.h"
14 
15 using namespace egammaMonitoring;
16 
18 
20 
21  const char* fN = m_name.c_str();
22 
23  histoMap["convRadius"] = new TH1D(Form("%s_convRadius",fN), ";Conversion Radius [mm]; Events", 14, m_cR_bins);
24  histoMap["truthType"] = new TH1D(Form("%s_truthType",fN), ";truth type; Events", 41,-1,40);
25  histoMap["truthOrigin"] = new TH1D(Form("%s_truthOrigin",fN), ";truth origin; Events",51,-1,50);
26 
27  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"convRadius", histoMap["convRadius"]));
28  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"truthType", histoMap["truthType"]));
29  ATH_CHECK(m_rootHistSvc->regHist(m_folder+"truthOrigin", histoMap["truthOrigin"]));
30 
31  return StatusCode::SUCCESS;
32 }
33 
35 
37 
38  static const SG::AuxElement::ConstAccessor<int> accType("truthType");
39  static const SG::AuxElement::ConstAccessor<int> accOrigin("truthOrigin");
40  if (accOrigin.isAvailable(phrec))
41  histoMap["truthOrigin"]->Fill(accOrigin(phrec));
42  else
43  histoMap["truthOrigin"]->Fill(-1);
44  if (accType.isAvailable(phrec))
45  histoMap["truthType"]->Fill(accType(phrec));
46  else
47  histoMap["truthType"]->Fill(-1);
48 
49  double trueR(-999);
51  if (tmp) {
52  if (tmp->pdgId() == 22 && tmp->hasDecayVtx()) {
53 
54  float x = tmp->decayVtx()->x();
55  float y = tmp->decayVtx()->y();
56  trueR = std::sqrt( x*x + y*y );
57 
58  }
59  }
60  histoMap["convRadius"]->Fill(trueR);
61 
62 
63 } // fill
egammaMonitoring::RecoPhotonHistograms::m_cR_bins
float m_cR_bins[15]
Definition: RecoPhotonHistograms.h:26
Check.h
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
egammaMonitoring::ParticleHistograms::fill
void fill(const xAOD::IParticle &egamma)
Definition: ParticleHistograms.cxx:41
xAODTruthHelpers.h
x
#define x
egammaMonitoring::IHistograms::m_rootHistSvc
ITHistSvc * m_rootHistSvc
Definition: IHistograms.h:45
egammaMonitoring::IHistograms::m_folder
std::string m_folder
Definition: IHistograms.h:44
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
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:41
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
TruthVertex.h
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:16
egammaMonitoring::RecoPhotonHistograms::initializePlots
StatusCode initializePlots()
Definition: RecoPhotonHistograms.cxx:17
egammaMonitoring::RecoPhotonHistograms::fill
void fill(const xAOD::Photon &phrec)
Definition: RecoPhotonHistograms.cxx:34
y
#define y
xAOD::Photon_v1
Definition: Photon_v1.h:37
RecoPhotonHistograms.h
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
TruthParticle.h
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