ATLAS Offline Software
Loading...
Searching...
No Matches
PhysValExample.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5*/
6
7// PhysValExample.cxx
8// Implementation file for class PhysValExample
9// Author: S.Binet<binet@cern.ch>
11
12// PhysVal includes
13#include "PhysValExample.h"
14
15// STL includes
16#include <vector>
17
18// FrameWork includes
19#include "GaudiKernel/IToolSvc.h"
28#include "xAODTracking/Vertex.h"
32
34
35namespace PhysVal {
36
38// Public methods:
40
41// Constructors
43
45 const std::string& name,
46 const IInterface* parent ) :
47 ManagedMonitorToolBase( type, name, parent ),
48 m_jetPlots(nullptr, "Summary/Jet/", "Jet"),
49 m_elecPlots(nullptr, "Summary/Electron/", "Electron"),
50 m_photonPlots(nullptr, "Summary/Photon/", "Photon"),
51 m_muonPlots(nullptr, "Summary/Muon/", "Muon"),
52 m_tauPlots(nullptr, "Summary/Tau/", "Tau"),
53 m_trkvtxPlots(nullptr, "Summary/TrackAndVertex/"),
54 m_evtPlots(nullptr, "EventInfo/"),
55 m_metPlots(nullptr, "Summary/MET/", "RefFinal"),
56 m_btagPlots(nullptr, "Summary/BTag/", "IP3D")
57 {
58
59 declareProperty( "JetContainerName", m_jetName = "AntiKt4EMTopoJets" );
60 declareProperty( "ElectronContainerName", m_elecName = "ElectronCollection" );
61 declareProperty( "PhotonContainerName", m_photonName = "PhotonCollection" );
62 declareProperty( "MuonContainerName", m_muonName = "Muons" );
63 declareProperty( "TauContainerName", m_tauName = "TauRecContainer" );
64 declareProperty( "TrackContainerName", m_trackName = "InDetTrackParticles" );
65 declareProperty( "VertexContainerName", m_vertexName = "PrimaryVertices" );
66 declareProperty( "METContainerName", m_metName = "MET_RefFinal" );
67 declareProperty( "DoExMET", m_doExMET = true );
68 declareProperty( "DoExJet", m_doExJet = true );
69 declareProperty( "DoExBtag", m_doExBtag = true );
70 }
71
72 // Destructor
76
77 // Athena algtool's Hooks
80 {
81 ATH_MSG_INFO ("Initializing " << name() << "...");
83
84 return StatusCode::SUCCESS;
85 }
86
87 StatusCode PhysValExample::book(PlotBase& plots)
88 {
89 plots.initialize();
90 std::vector<HistData> hists = plots.retrieveBookedHistograms();
91
92 for (auto& hist : hists){
93 ATH_MSG_INFO ("Initializing " << hist.first << " " << hist.first->GetName() << " " << hist.second << "...");
94 ATH_CHECK(regHist(hist.first,hist.second,all));
95 }
96 return StatusCode::SUCCESS;
97 }
98
100 ATH_MSG_INFO("Booking hists " << name() << "...");
101
102 if (m_detailLevel >= 10) {
112 }
113
114 return StatusCode::SUCCESS;
115 }
116
118 {
119 ATH_MSG_DEBUG ("Filling hists " << name() << "...");
120
121 if (m_detailLevel < 10) return StatusCode::SUCCESS;
122
123 // event Info
124 const xAOD::EventInfo* event(nullptr);
125 ATH_CHECK(evtStore()->retrieve(event, "EventInfo"));
126 m_evtPlots.fill(event);
127
128 // Jets
129 int nbtag(0);
130 if (m_doExJet){
131 m_jetPlots.initializeEvent();
132 const xAOD::JetContainer* jets(nullptr);
133 ATH_CHECK(evtStore()->retrieve(jets, m_jetName));
134 for (auto jet : *jets) {
135 m_jetPlots.fill(jet,event);
136 if (m_doExBtag){
138 if (btag && btag->IP3D_loglikelihoodratio() > 1.2) ++nbtag;
139 }
140 }
141 m_jetPlots.fill(event);
142 }
143 m_btagPlots.fill(nbtag,event);
144
145 // Electrons
146 m_elecPlots.initializeEvent();
147 const xAOD::ElectronContainer* electrons(nullptr);
148 ATH_CHECK(evtStore()->retrieve(electrons, m_elecName));
149 for (auto elec : *electrons) m_elecPlots.fill(elec,event);
150 m_elecPlots.fill(event);
151
152 // Photons
153 m_photonPlots.initializeEvent();
154 const xAOD::PhotonContainer* photons(nullptr);
155 ATH_CHECK(evtStore()->retrieve(photons, m_photonName));
156 for (auto photon : *photons) m_photonPlots.fill(photon,event);
157 m_photonPlots.fill(event);
158
159 // Muons
160 m_muonPlots.initializeEvent();
161 const xAOD::MuonContainer* muons(nullptr);
162 ATH_CHECK(evtStore()->retrieve(muons, m_muonName));
163 for (auto muon : *muons) m_muonPlots.fill(muon,event);
164 m_muonPlots.fill(event);
165
166 // Taus
167 m_tauPlots.initializeEvent();
168 const xAOD::TauJetContainer* taus(nullptr);
169 ATH_CHECK(evtStore()->retrieve(taus, m_tauName));
170 for (auto tau : *taus) m_tauPlots.fill(tau,event);
171 m_tauPlots.fill(event);
172
173 // Tracks/Vertices
174 const xAOD::TrackParticleContainer* trks(nullptr);
175 ATH_CHECK(evtStore()->retrieve(trks, m_trackName));
176
177 const xAOD::VertexContainer* vtxs(nullptr);
178 ATH_CHECK(evtStore()->retrieve(vtxs, m_vertexName));
179 for (auto vtx : *vtxs) m_trkvtxPlots.fill(vtx,event);
180
181
182 m_trkvtxPlots.fill(trks->size(), vtxs->size(), event);
183
184
185
186 if (m_doExMET){
187 const xAOD::MissingETContainer* met_container (nullptr);
188 ATH_CHECK(evtStore()->retrieve(met_container, m_metName));
189
190 const xAOD::MissingET* met = (*met_container)["FinalClus"];
191 if (!met) {
192 ATH_MSG_WARNING ("Couldn't retrieve MET Final");
193 return StatusCode::SUCCESS;
194 }
195 m_metPlots.fill(met,event);
196 }
197
198 return StatusCode::SUCCESS;
199 }
200
202 {
203 ATH_MSG_INFO ("Finalising hists " << name() << "...");
204 return StatusCode::SUCCESS;
205 }
206
207}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
static Double_t taus
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
size_type size() const noexcept
Returns the number of elements in the collection.
virtual StatusCode regHist(TH1 *h, const std::string &system, Interval_t interval, MgmtAttr_t histo_mgmt=ATTRIB_MANAGED, const std::string &chain="", const std::string &merge="")
Registers a TH1 (including TH2, TH3, and TProfile) to be included in the output stream using logical ...
ManagedMonitorToolBase(const std::string &type, const std::string &name, const IInterface *parent)
PhysVal::BTagPlots m_btagPlots
StatusCode book(PlotBase &plots)
virtual StatusCode fillHistograms()
An inheriting class should either override this function or fillHists().
PhysVal::KinematicsPlots m_elecPlots
virtual ~PhysValExample()
Destructor:
PhysValExample()
Default constructor:
PhysVal::TrkAndVtxPlots m_trkvtxPlots
PhysVal::KinematicsPlots m_jetPlots
virtual StatusCode initialize()
PhysVal::KinematicsPlots m_muonPlots
PhysVal::METPlots m_metPlots
virtual StatusCode bookHistograms()
An inheriting class should either override this function or bookHists().
PhysVal::KinematicsPlots m_photonPlots
PhysVal::EventInfoPlots m_evtPlots
PhysVal::KinematicsPlots m_tauPlots
virtual StatusCode procHistograms()
An inheriting class should either override this function or finalHists().
float IP3D_loglikelihoodratio() const
get IP3D log likelihood ratio
const BTagging * getBTagging(const SG::AuxElement &part)
Access the default xAOD::BTagging object associated to an object.
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
EventInfo_v1 EventInfo
Definition of the latest event info version.
MissingET_v1 MissingET
Version control by type defintion.
BTagging_v1 BTagging
Definition of the current "BTagging version".
Definition BTagging.h:17
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".
TauJetContainer_v3 TauJetContainer
Definition of the current "taujet container version".
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".