ATLAS Offline Software
Loading...
Searching...
No Matches
PhysValFE.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "PhysValFE.h"
7
8PhysValFE::PhysValFE (const std::string& type, const std::string& name, const IInterface* parent ) :
9 ManagedMonitorToolBase( type, name, parent ),
10 m_useNeutralFE(false)
11{
12 declareProperty("useNeutralFE", m_useNeutralFE, "Select whether to use neutral or charged FE");
13}
14
16
38
39
41
42 std::string theName = "PFlow/FlowElement/"+m_FEContainerHandleKey.key();
43 std::vector<HistData> hists;
44 std::vector<HistData> additional_hists;
45 if (!m_useNeutralFE){
46 m_FEChargedValidationPlots.reset(new PFOChargedValidationPlots(0,theName,theName));
47 m_FEChargedValidationPlots->setDetailLevel(100);
48 m_FEChargedValidationPlots->initialize();
49 hists = m_FEChargedValidationPlots->retrieveBookedHistograms();
50 m_LeptonLinkerPlots_CFE.reset(new LeptonCFEValidationPlots(0,theName,theName));
51 m_LeptonLinkerPlots_CFE->setDetailLevel(100);
52 m_LeptonLinkerPlots_CFE->initialize();
53 m_LeptonLinkerPlots_CFE->retrieveBookedHistograms();
54 additional_hists=m_LeptonLinkerPlots_CFE->retrieveBookedHistograms();
55
56 }
57 else if (m_useNeutralFE){
58 m_FENeutralValidationPlots.reset(new PFONeutralValidationPlots(0,theName, theName));
59 m_FENeutralValidationPlots->setDetailLevel(100);
60 m_FENeutralValidationPlots->initialize();
61 hists = m_FENeutralValidationPlots->retrieveBookedHistograms();
62
63 m_LeptonLinkerPlots_NFE.reset(new LeptonNFEValidationPlots(0,theName,theName));
64 m_LeptonLinkerPlots_NFE->setDetailLevel(100);
65 m_LeptonLinkerPlots_NFE->initialize();
66 additional_hists=m_LeptonLinkerPlots_NFE->retrieveBookedHistograms();
67
68 }
69
70 hists.insert(hists.end(),additional_hists.begin(),additional_hists.end()); // append lepton-FE linker plots to collection of hists
71
72 for (auto hist : hists) {
73 ATH_MSG_DEBUG("Processing histogram named: "<<hist.first->GetName()<<" (title) "<<hist.first->GetTitle());
74 ATH_CHECK(regHist(hist.first,hist.second,all));
75 }
76
77 return StatusCode::SUCCESS;
78
79}
80
82
83 const xAOD::Vertex* theVertex = nullptr;
84
85 if (!m_useNeutralFE){
87 if(!vertexContainerReadHandle.isValid()){
88 ATH_MSG_WARNING("Invalid ReadHandle for xAOD::VertexContainer with key: " << vertexContainerReadHandle.key());
89 }
90 else {
91 //Vertex finding logic based on logic in JetRecTools/PFlowPseudoJetGetter tool
92 //Usually the 0th vertex is the primary one, but this is not always the case. So we will choose the first vertex of type PriVtx
93 for (auto vertex : *vertexContainerReadHandle) {
94 if (xAOD::VxType::PriVtx == vertex->vertexType() ) {
95 theVertex = vertex;
96 break;
97 }//If we have a vertex of type primary vertex
98 }//iterate over the vertices and check their type
99
100 if (nullptr == theVertex) ATH_MSG_WARNING("Did not find either a PriVtx or a NoVtx in this event");
101
102 }//if valid read handle
103 }
104
106 if (!eventInfoReadHandle.isValid()){
107 ATH_MSG_WARNING("Invalid ReadHandle for xAOD::EventInfo with key: " << eventInfoReadHandle.key());
108 }
109
111 if(!FEContainerReadHandle.isValid()){
112 ATH_MSG_WARNING("Invalid ReadHandle for xAOD::FlowElementContainer with key: " << FEContainerReadHandle.key());
113 return StatusCode::SUCCESS;
114 }
115
116 for (auto theFE : *FEContainerReadHandle){
117 if(theFE){
118 if (!m_useNeutralFE) m_FEChargedValidationPlots->fill(*theFE,theVertex,*eventInfoReadHandle);
119 else if (m_useNeutralFE) m_FENeutralValidationPlots->fill(*theFE,*eventInfoReadHandle);
120 }
121 else ATH_MSG_WARNING("Invalid pointer to xAOD::FlowElement");
122 }
123
124 if(!m_useNeutralFE){
126 if(!MuonContainerReadDecorHandle.isValid()){
127 ATH_MSG_WARNING("Muon readhandle is a dud");
128 }
129 else{
130 for (auto Muon: *MuonContainerReadDecorHandle) m_LeptonLinkerPlots_CFE->fill(*Muon,*eventInfoReadHandle);
131 }
132 }
133 else{
135 if(!MuonContainerReadDecorHandle.isValid()){
136 ATH_MSG_WARNING("Muon readhandle is a dud");
137 }
138 else{
139 for (auto Muon: *MuonContainerReadDecorHandle) m_LeptonLinkerPlots_NFE->fill(*Muon,*eventInfoReadHandle);
140 }
141 }
142
143 if(!m_useNeutralFE){
145 if(!ElectronContainerReadDecorHandle.isValid()){
146 ATH_MSG_WARNING("Electron readhandle is a dud");
147 }
148 else{
149 for (auto Electron: *ElectronContainerReadDecorHandle) m_LeptonLinkerPlots_CFE->fill(*Electron,*eventInfoReadHandle);
150 }
151 }
152 else{
154 if(!ElectronContainerReadDecorHandle.isValid()){
155 ATH_MSG_WARNING("Electron readhandle is a dud");
156 }
157 else{
158 for (auto Electron: *ElectronContainerReadDecorHandle) m_LeptonLinkerPlots_NFE->fill(*Electron,*eventInfoReadHandle);
159 }
160 }
161
162 if(!m_useNeutralFE){
164 if(!PhotonContainerReadDecorHandle.isValid()){
165 ATH_MSG_WARNING("Photon readhandle is a dud");
166 }
167 else{
168 for (auto Photon: *PhotonContainerReadDecorHandle) m_LeptonLinkerPlots_CFE->fill(*Photon,*eventInfoReadHandle);
169 }
170 }
171 else{
173 if(!PhotonContainerReadDecorHandle.isValid()){
174 ATH_MSG_WARNING("Photon readhandle is a dud");
175 }
176 else{
177 for (auto Photon: *PhotonContainerReadDecorHandle) m_LeptonLinkerPlots_NFE->fill(*Photon,*eventInfoReadHandle);
178 }
179 }
180
181 if(!m_useNeutralFE){
183 if(!TauJetContainerReadDecorHandle.isValid()){
184 ATH_MSG_WARNING("TauJet readhandle is a dud");
185 }
186 else{
187 for (auto TauJet: *TauJetContainerReadDecorHandle) m_LeptonLinkerPlots_CFE->fill(*TauJet,*eventInfoReadHandle);
188 }
189 }
190 else{
192 if(!TauJetContainerReadDecorHandle.isValid()){
193 ATH_MSG_WARNING("TauJet readhandle is a dud");
194 }
195 else{
196 for (auto TauJet: *TauJetContainerReadDecorHandle) m_LeptonLinkerPlots_NFE->fill(*TauJet,*eventInfoReadHandle);
197 }
198 }
199
200 return StatusCode::SUCCESS;
201
202}
203
205 return StatusCode::SUCCESS;
206}
207
208
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
@ TauJet
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
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)
SG::ReadHandleKey< xAOD::FlowElementContainer > m_FEContainerHandleKey
ReadHandle to retrieve xAOD::FlowElementContainer (charged)
Definition PhysValFE.h:46
bool m_useNeutralFE
Select whether to use neutral or charged FE.
Definition PhysValFE.h:86
virtual StatusCode fillHistograms()
An inheriting class should either override this function or fillHists().
Definition PhysValFE.cxx:81
SG::ReadDecorHandleKey< xAOD::TauJetContainer > m_tauJetChargedFEReadHandleKey
Read key for getting charged Flow Element link decorations to taus.
Definition PhysValFE.h:67
std::unique_ptr< LeptonCFEValidationPlots > m_LeptonLinkerPlots_CFE
Pointer to class that deals with histograms for lepton links.
Definition PhysValFE.h:82
std::unique_ptr< PFONeutralValidationPlots > m_FENeutralValidationPlots
Pointer to class that deals with histograms for neutral FE.
Definition PhysValFE.h:79
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_electronNeutralFEReadHandleKey
Read key for getting neutral Flow Element link decorations to electrons.
Definition PhysValFE.h:58
SG::ReadDecorHandleKey< xAOD::MuonContainer > m_muonChargedFEReadHandleKey
Read key for getting charged Flow Element link decorations to muons.
Definition PhysValFE.h:49
virtual StatusCode initialize()
Standard AlgTool Functions.
Definition PhysValFE.cxx:17
virtual StatusCode procHistograms()
An inheriting class should either override this function or finalHists().
SG::ReadDecorHandleKey< xAOD::TauJetContainer > m_tauJetNeutralFEReadHandleKey
Read key for getting neutral Flow Element link decorations to taus.
Definition PhysValFE.h:70
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_electronChargedFEReadHandleKey
Read key for getting charged Flow Element link decorations to electrons.
Definition PhysValFE.h:55
SG::ReadDecorHandleKey< xAOD::MuonContainer > m_muonNeutralFEReadHandleKey
Read key for getting neutral Flow Element link decorations to muons.
Definition PhysValFE.h:52
virtual ~PhysValFE()
Standard Destructor.
Definition PhysValFE.cxx:15
SG::ReadDecorHandleKey< xAOD::PhotonContainer > m_photonChargedFEReadHandleKey
Read key for getting charged Flow Element link decorations to photons.
Definition PhysValFE.h:61
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoReadHandleKey
ReadHandleKey for EventInfo.
Definition PhysValFE.h:73
SG::ReadDecorHandleKey< xAOD::PhotonContainer > m_photonNeutralFEReadHandleKey
Read key for getting neutral Flow Element link decorations to photons.
Definition PhysValFE.h:64
virtual StatusCode bookHistograms()
An inheriting class should either override this function or bookHists().
Definition PhysValFE.cxx:40
std::unique_ptr< LeptonNFEValidationPlots > m_LeptonLinkerPlots_NFE
Definition PhysValFE.h:83
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainerReadHandleKey
ReadHandle to retrieve xAOD::VertexContainer.
Definition PhysValFE.h:43
PhysValFE(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition PhysValFE.cxx:8
std::unique_ptr< PFOChargedValidationPlots > m_FEChargedValidationPlots
Pointer to class that deals with histograms for charged FE.
Definition PhysValFE.h:76
Handle class for reading a decoration on an object.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
Class describing an electron.
Class describing an photon.
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
@ PriVtx
Primary vertex.
Vertex_v1 Vertex
Define the latest version of the vertex class.