ATLAS Offline Software
TruthInfoPlots.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 namespace Trk {
9  void
11  truthType = nullptr;
12  origin = nullptr;
13  }
14 
15  void
17  truthType = Book1D("truthType", "truthType;truthType;Entries", 50, -0.5, 49.5);
18  origin = Book1D("truthOrigin", "truthOrigin;truthOrigin;Entries", 40, -0.5, 39.5);
19  }
20 
21  void
22  TruthInfoPlots::fill(const xAOD::TruthParticle &truthprt, float weight ) {
23  static const SG::ConstAccessor<int> truthTypeAcc ("truthType");
24  if (truthTypeAcc.isAvailable (truthprt)) {
25  truthType->Fill(truthTypeAcc (truthprt), weight);
26  }
27  static const SG::ConstAccessor<int> truthOriginAcc ("truthOrigin");
28  if (truthOriginAcc.isAvailable (truthprt)) {
29  origin->Fill(truthOriginAcc (truthprt), weight);
30  }
31  }
32 }
Trk::TruthInfoPlots::origin
TH1 * origin
Definition: TruthInfoPlots.h:19
TruthInfoPlots.h
SG::ConstAccessor< int >
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
PlotBase::Book1D
TH1D * Book1D(const std::string &name, const std::string &labels, int nBins, float start, float end, bool prependDir=true)
Book a TH1D histogram.
Definition: PlotBase.cxx:94
Trk::TruthInfoPlots::init
void init()
Definition: TruthInfoPlots.cxx:10
Trk::TruthInfoPlots::initializePlots
void initializePlots()
Definition: TruthInfoPlots.cxx:16
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
Trk::TruthInfoPlots::fill
void fill(const xAOD::TruthParticle &truthprt, float weight=1.0)
Definition: TruthInfoPlots.cxx:22
Trk::TruthInfoPlots::truthType
TH1 * truthType
Definition: TruthInfoPlots.h:18