ATLAS Offline Software
Loading...
Searching...
No Matches
IDPerfMonZee.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5// **********************************************************************
6// IDPerfMonZee.cxx
7// AUTHORS: Beate Heinemann, Tobias Golling, Sara Strandberg
8// **********************************************************************
9
10
11#include "TH1.h"
12#include "TH2.h"
13#include "TH1F.h"
14#include "TH2F.h"
15#include "TProfile.h"
16#include "TLorentzVector.h"
17
19
22
23#include "GaudiKernel/SystemOfUnits.h"
24#include "GaudiKernel/PhysicalConstants.h"
25
28
31
32#include <cmath>
33#include <stdexcept>
34
35namespace{
36template <class T>
37 const T *
38 getCollectionWithCheck(const ServiceHandle<StoreGateSvc> & evtStore,const std::string &contName){
39 const T * container{};
40 if (evtStore->contains<T>(contName)){
41 //retrieve
42 if(evtStore->retrieve(container,contName).isFailure()) return nullptr;
43 }
44 return container;
45 }
46}
47
48// *********************************************************************
49// Public Methods
50// *********************************************************************
51
52IDPerfMonZee::IDPerfMonZee( const std::string & type, const std::string & name, const IInterface* parent )
53 :ManagedMonitorToolBase( type, name, parent ),
54 m_triggerChainName("NoTriggerSelection")
55{
56 declareProperty("tracksName",m_tracksName);
57 declareProperty("electronsName",m_electronsName="Electrons");
58 declareProperty("photonsName",m_photonsName="Photons");
59 declareProperty("VxPrimContainerName",m_VxPrimContainerName="PrimaryVertices");
60 declareProperty("emclustersName",m_emclustersName="LArClusterEM");
61 declareProperty("metName",m_metName="MET_Reference_AntiKt4LCTopo");
62 declareProperty("METFinalName", m_metRefFinalName= "FinalClus");
63 declareProperty("eoverp_standard_min",m_eoverp_standard_min=0.5);
64 declareProperty("eoverp_standard_max",m_eoverp_standard_max=4.0);
65 declareProperty("eoverp_tight_min",m_eoverp_tight_min=0.7);
66 declareProperty("eoverp_tight_max",m_eoverp_tight_max=1.3);
67 declareProperty("CheckRate",m_checkrate=1000);
68 declareProperty("triggerChainName",m_triggerChainName);
69 declareProperty("electronIDLevel",m_electronIDLevel = "Tight");
70
71 m_region_strings.emplace_back("incl");
72 m_region_strings.emplace_back("barrel");
73 m_region_strings.emplace_back("eca");
74 m_region_strings.emplace_back("ecc");
75
76}
77
78
80
81
83{
85 if (m_tracksName.empty()) ATH_MSG_WARNING( " no track collection given" );
87 if (sc.isFailure()) ATH_MSG_WARNING( "Could not initialize ManagedMonitorToolBase" );
88 //---Electron Likelihood tool---
89 m_doIDCuts = true;
90 ATH_MSG_INFO("IDPerfMonWenu::Initialize() -- Setting up electron LH tool.");
91 m_LHTool2015 = new AsgElectronLikelihoodTool ("m_LHTool2015");
92 if((m_LHTool2015->setProperty("primaryVertexContainer",m_VxPrimContainerName)).isFailure())
93 ATH_MSG_WARNING("Failure setting primary vertex container " << m_VxPrimContainerName << "in electron likelihood tool");
94
95 //Set up electron LH level
96 std::string confDir = "ElectronPhotonSelectorTools/offline/mc15_20150712/";
97 if(m_electronIDLevel.empty()){
98 ATH_MSG_WARNING("electronIDLevel is set to empty! No electron ID cuts will be applied.");
99 m_doIDCuts = false;
100 }
101 else{
102 if((m_electronIDLevel != "Loose") && (m_electronIDLevel != "Medium") && (m_electronIDLevel != "Tight")){
103 ATH_MSG_WARNING("Unknown electronIDLevel!! (Accepted values: Loose, Medium, Tight)");
104 m_doIDCuts = false;
105 }
106 else{
107 std::string configFile = confDir+"ElectronLikelihood"+m_electronIDLevel+"OfflineConfig2015.conf";
108 ATH_MSG_INFO("Likelihood configuration file: " << configFile);
109 if((m_LHTool2015->setProperty("ConfigFile",configFile)).isFailure()) ATH_MSG_WARNING("Failure loading ConfigFile in electron likelihood tool.");
110 }
111 }
112 StatusCode lh = m_LHTool2015->initialize();
113 if(lh.isFailure()){
114 ATH_MSG_WARNING("Electron likelihood tool initialize() failed! Turning off electron LH cuts!");
115 m_doIDCuts = false;
116 }
117 return StatusCode::SUCCESS;
118}
119
121{
122 MonGroup al_Zee_mon ( this, "IDPerfMon/Zee/" + m_triggerChainName, run);
123 if( newRunFlag() ) {
124 //if user environment specified we don't want to book new histograms at every run boundary
125 //we instead want one histogram per job
126 if(m_histosBooked!=0 && AthenaMonManager::environment()==AthenaMonManager::user) return StatusCode::SUCCESS;
127 // ***********************
128 // Book event histograms
129 // ***********************
130 m_Nevents = new TH1F("Nevents", "Number of events processed", 1, -.5, 0.5);
131 RegisterHisto(al_Zee_mon,m_Nevents);
132 m_Check = new TH1F("Check","", 4, 0,4);
133 RegisterHisto(al_Zee_mon,m_Check);
134 m_Zee_invmass = new TH1F("Zee_invmass","Invariant mass of the two leading em clusters", 90, 0.,180.);
135 RegisterHisto(al_Zee_mon,m_Zee_invmass);
136 m_Zee_invmass_sel = new TH1F("Zee_invmass_sel","Invariant mass of the two leading em clusters after Zee selection", 80, 50.,130.);
138 m_Zee_trk_invmass = new TH1F("Zee_trk_invmass","Invariant mass of the two tracks", 90, 0.,180.);
140 m_Zee_trk_invmass_scaled = new TH1F("Zee_trk_invmass_scaled","Invariant mass of the two tracks scaled to per event", 90, 0.,180.);
142 m_Zee_trk_invmass_sel = new TH1F("Zee_trk_invmass_sel","Invariant mass of the two tracks after Zee selection", 90, 0.,180.);
144 m_Zee_Eopasym_perevent = new TH1F("Zee_Eopasym_perevent", "E/p difference (pos-neg)/(pos+neg) per Z event for Zee EM-clusters", 60, -1.5, 1.5);
146 m_Zee_Eopasym_perevent_central = new TH1F("Zee_Eopasym_perevent_central", "E/p difference (pos-neg)/(pos+neg) per Z event for Zee EM-clusters with E/p between 0.7 and 1.3", 60, -1.5, 1.5);
148
149 // ***********************
150 // Book cluster histograms
151 // ***********************
152
153 // first take care to clear all histogram vectors
154 m_Zee_Eop.clear();
155 m_Zee_Eopdiff.clear();
156 m_Zee_Eop_plus.clear();
157 m_Zee_Eop_minus.clear();
158 m_Zee_eta.clear();
159 m_Zee_phi.clear();
160 m_Zee_deta.clear();
161 m_Zee_deta_vs_eta.clear();
162 m_Zee_deta_vs_phi.clear();
163 m_Zee_absdeta_vs_eta.clear();
164 m_Zee_absdeta_vs_phi.clear();
165 m_Zee_dphi.clear();
166 m_Zee_dphi_vs_eta.clear();
167 m_Zee_dphi_vs_phi.clear();
168 m_Zee_absdphi_vs_eta.clear();
169 m_Zee_absdphi_vs_phi.clear();
170 m_Zee_dphi_vs_phi_2d.clear();
171 m_Zee_deta_vs_phi_2d.clear();
172 m_Zee_dphi_vs_eta_2d.clear();
173 m_Zee_deta_vs_eta_2d.clear();
186 m_Zee_meanEop_vs_p.clear();
187 m_Zee_meanEop_vs_invp.clear();
188 m_Zee_meanEop_vs_E.clear();
191 m_Zee_meanEop_vs_phi.clear();
192 m_Zee_meanEop_vs_eta.clear();
203 m_Zee_Eop_lt1_gt1.clear();
204 m_Zee_Eopdiff_vs_p.clear();
205 m_Zee_Eopdiff_vs_invp.clear();
206 m_Zee_Eopdiff_vs_E.clear();
207 m_Zee_Eopdiff_vs_phi.clear();
208 m_Zee_Eopdiff_vs_eta.clear();
209 m_Zee_Eop_lt1_vs_eta.clear();
210 m_Zee_Eop_lt1_vs_phi.clear();
211 m_Zee_Eop_gt1_vs_eta.clear();
212 m_Zee_Eop_gt1_vs_phi.clear();
215 m_Zee_Eop_05_25.clear();
216 m_Zee_Eop_15_25.clear();
218
219 for (int region=0; region!=Nregions; ++region) {
220 std::string title;
221 std::string name;
222 name = "Zee_Eop_" + m_region_strings[region];
223 title = "E/p for Zee EM-clusters in " + m_region_strings[region];
224 m_Zee_Eop.push_back(new TH1F(name.c_str(),title.c_str(), 60, 0., 10.));
225 RegisterHisto(al_Zee_mon,m_Zee_Eop[region]);
226 name = "Zee_Eopdiff_" + m_region_strings[region];
227 title = "E/p difference (pos-neg) for Zee EM-clusters in " + m_region_strings[region];
228 m_Zee_Eopdiff.push_back(new TH1F(name.c_str(),title.c_str(), 10, 0., 2.));
229 RegisterHisto(al_Zee_mon,m_Zee_Eopdiff[region],true);
230 name = "Zee_Eop_plus_" + m_region_strings[region];
231 title = "E/p for pos. charged Zee EM-clusters in " + m_region_strings[region];
232 m_Zee_Eop_plus.push_back(new TH1F(name.c_str(),title.c_str(), 10, 0., 2.));
233 RegisterHisto(al_Zee_mon,m_Zee_Eop_plus[region],true);
234 name = "Zee_Eop_minus_" + m_region_strings[region];
235 title = "E/p for neg. charged Zee EM-clusters in " + m_region_strings[region];
236 m_Zee_Eop_minus.push_back(new TH1F(name.c_str(),title.c_str(), 10, 0., 2.));
237 RegisterHisto(al_Zee_mon,m_Zee_Eop_minus[region],true);
238 if (region != incl) continue;
239 m_Zee_eta.push_back(new TH1F("Zee_eta","Eta of Zee EM-clusters", 15, -3., 3.));
240 RegisterHisto(al_Zee_mon,m_Zee_eta[region]);
241 m_Zee_phi.push_back(new TH1F("Zee_phi","Phi of Zee EM-clusters", 15, -3.15, 3.15));
242 RegisterHisto(al_Zee_mon,m_Zee_phi[region]);
243 m_Zee_deta.push_back(new TH1F("Zee_deta","deltaEta(EM-cluster,track) in Zee events", 50, -0.5, 0.5));
244 RegisterHisto(al_Zee_mon,m_Zee_deta[region]);
245 m_Zee_deta_vs_eta.push_back(new TProfile("Zee_deta_vs_eta","deltaEta(EM-cluster,track) vs. eta in Zee events", 15, -3., 3.));
246 RegisterHisto(al_Zee_mon,m_Zee_deta_vs_eta[region]);
247 m_Zee_deta_vs_phi.push_back(new TProfile("Zee_deta_vs_phi","deltaEta(EM-cluster,track) vs. phi in Zee events", 15, -3.15, 3.15));
248 RegisterHisto(al_Zee_mon,m_Zee_deta_vs_phi[region]);
249 m_Zee_absdeta_vs_eta.push_back(new TProfile("Zee_absdeta_vs_eta","Abs(deltaEta(EM-cluster,track)) vs. eta in Zee events", 15, -3., 3.));
250 RegisterHisto(al_Zee_mon,m_Zee_absdeta_vs_eta[region]);
251 m_Zee_absdeta_vs_phi.push_back(new TProfile("Zee_absdeta_vs_phi","Abs(deltaEta(EM-cluster,track)) vs. phi in Zee events", 15, -3.15, 3.15));
252 RegisterHisto(al_Zee_mon,m_Zee_absdeta_vs_phi[region]);
253 m_Zee_dphi.push_back(new TH1F("Zee_dphi","deltaPhi(EM-cluster,track) in Zee events", 50, -0.5, 0.5));
254 RegisterHisto(al_Zee_mon,m_Zee_dphi[region]);
255 m_Zee_dphi_vs_eta.push_back(new TProfile("Zee_dphi_vs_eta","deltaPhi(EM-cluster,track) vs. eta in Zee events", 15, -3., 3.));
256 RegisterHisto(al_Zee_mon,m_Zee_dphi_vs_eta[region]);
257 m_Zee_dphi_vs_phi.push_back(new TProfile("Zee_dphi_vs_phi","deltaPhi(EM-cluster,track) vs. phi in Zee events", 15, -3.15, 3.15));
258 RegisterHisto(al_Zee_mon,m_Zee_dphi_vs_phi[region]);
259 m_Zee_absdphi_vs_eta.push_back(new TProfile("Zee_absdphi_vs_eta","Abs(deltaPhi(EM-cluster,track)) vs. eta in Zee events", 15, -3., 3.));
260 RegisterHisto(al_Zee_mon,m_Zee_absdphi_vs_eta[region]);
261 m_Zee_absdphi_vs_phi.push_back(new TProfile("Zee_absdphi_vs_phi","Abs(deltaPhi(EM-cluster,track)) vs. phi in Zee events", 15, -3.15, 3.15));
262 RegisterHisto(al_Zee_mon,m_Zee_absdphi_vs_phi[region]);
263
264 m_Zee_dphi_vs_phi_2d.push_back(new TH2F("Zee_dphi_vs_phi_2d","deltaPhi(EM-cluster,track) vs. phi in Zee events", 15, -3.15, 3.15 , 64, -0.1, 0.1));
265 RegisterHisto(al_Zee_mon,m_Zee_dphi_vs_phi_2d[region]);
266 m_Zee_deta_vs_phi_2d.push_back(new TH2F("Zee_deta_vs_phi_2d","deltaPhi(EM-cluster,track) vs. phi in Zee events", 15, -3.15, 3.15 , 64, -0.1, 0.1));
267 RegisterHisto(al_Zee_mon,m_Zee_deta_vs_phi_2d[region]);
268 m_Zee_dphi_vs_eta_2d.push_back(new TH2F("Zee_dphi_vs_eta_2d","deltaPhi(EM-cluster,track) vs. eta in Zee events", 15, -3., 3. , 64, -0.1, 0.1));
269 RegisterHisto(al_Zee_mon,m_Zee_dphi_vs_eta_2d[region]);
270 m_Zee_deta_vs_eta_2d.push_back(new TH2F("Zee_deta_vs_eta_2d","deltaPhi(EM-cluster,track) vs. eta in Zee events", 15, -3., 3. , 64, -0.1, 0.1));
271 RegisterHisto(al_Zee_mon,m_Zee_deta_vs_eta_2d[region]);
272
273 m_Zee_trackmatched_eta.push_back(new TH1F("Zee_trackmatched_eta","Eta of track-matched Zee EM-clusters", 15, -3., 3.));
274 RegisterHisto(al_Zee_mon,m_Zee_trackmatched_eta[region]);
275 m_Zee_trackmatched_phi.push_back(new TH1F("Zee_trackmatched_phi","Phi of track-matched Zee EM-clusters", 15, -3.15, 3.15));
276 RegisterHisto(al_Zee_mon,m_Zee_trackmatched_phi[region]);
277 m_Zee_trackmatched_Eopmatched_eta.push_back(new TH1F("Zee_trackmatched_Eopmatched_eta","Eta of track-matched and E/p-matched Zee EM-clusters", 15, -3., 3.));
279 m_Zee_trackmatched_Eopmatched_phi.push_back(new TH1F("Zee_trackmatched_Eopmatched_phi","Phi of track-matched and E/p-matched Zee EM-clusters", 15, -3.15, 3.15));
281 m_Zee_trackmatched_tightEopmatched_eta.push_back(new TH1F("Zee_trackmatched_tightEopmatched_eta","Eta of track-matched and tight E/p-matched Zee EM-clusters", 15, -3., 3.));
283 m_Zee_trackmatched_tightEopmatched_phi.push_back(new TH1F("Zee_trackmatched_tightEopmatched_phi","Phi of track-matched and tight E/p-matched Zee EM-clusters", 15, -3.15, 3.15));
285
286 m_Zee_trackmatch_eff_vs_eta.push_back(new TH1F("Zee_trackmatch_eff_vs_eta","Track-match efficiency for Zee EM-clusters vs. eta", 15, -3., 3.));
287 RegisterHisto(al_Zee_mon,m_Zee_trackmatch_eff_vs_eta[region],1);
288 m_Zee_trackmatch_eff_vs_phi.push_back(new TH1F("Zee_trackmatch_eff_vs_phi","Track-match efficiency for Zee EM-clusters vs. phi", 15, -3.15, 3.15));
289 RegisterHisto(al_Zee_mon,m_Zee_trackmatch_eff_vs_phi[region],1);
290 m_Zee_Eopmatch_eff_vs_eta.push_back(new TH1F("Zee_Eopmatch_eff_vs_eta","E/p-match efficiency for Zee EM-clusters vs. eta", 15, -3., 3.));
291 RegisterHisto(al_Zee_mon,m_Zee_Eopmatch_eff_vs_eta[region],1);
292 m_Zee_Eopmatch_eff_vs_phi.push_back(new TH1F("Zee_Eopmatch_eff_vs_phi","E/p-match efficiency for Zee EM-clusters vs. phi", 15, -3.15, 3.15));
293 RegisterHisto(al_Zee_mon,m_Zee_Eopmatch_eff_vs_phi[region],1);
294 m_Zee_tightEopmatch_eff_vs_eta.push_back(new TH1F("Zee_tightEopmatch_eff_vs_eta","Tight E/p-match efficiency for Zee EM-clusters vs. eta", 15, -3., 3.));
295 RegisterHisto(al_Zee_mon,m_Zee_tightEopmatch_eff_vs_eta[region],1);
296 m_Zee_tightEopmatch_eff_vs_phi.push_back(new TH1F("Zee_tightEopmatch_eff_vs_phi","Tight E/p-match efficiency for Zee EM-clusters vs. phi", 15, -3.15, 3.15));
297 RegisterHisto(al_Zee_mon,m_Zee_tightEopmatch_eff_vs_phi[region],1);
298
299 m_Zee_meanEop_vs_p.push_back(new TProfile("Zee_meanEop_vs_p", "Mean E/p vs p for Zee EM-clusters", 15, 0., 300.));
300 RegisterHisto(al_Zee_mon,m_Zee_meanEop_vs_p[region]);
301 m_Zee_meanEop_vs_invp.push_back(new TProfile("Zee_meanEop_vs_invp", "Mean E/p vs 1/p for Zee EM-clusters", 15, 0., 0.05));
302 RegisterHisto(al_Zee_mon,m_Zee_meanEop_vs_invp[region]);
303 m_Zee_meanEop_vs_E.push_back(new TProfile("Zee_meanEop_vs_E", "Mean E/p vs E for Zee EM-clusters", 15, 0., 300.));
304 RegisterHisto(al_Zee_mon,m_Zee_meanEop_vs_E[region]);
305 m_Zee_meanEop_vs_chargedp.push_back(new TProfile("Zee_meanEop_vs_chargedp", "Mean E/p vs charge*p for Zee EM-clusters", 30, -300., 300.));
306 RegisterHisto(al_Zee_mon,m_Zee_meanEop_vs_chargedp[region]);
307 m_Zee_meanEop_vs_chargedE.push_back(new TProfile("Zee_meanEop_vs_chargedE", "Mean E/p vs charge*E for Zee EM-clusters", 30, -300., 300.));
308 RegisterHisto(al_Zee_mon,m_Zee_meanEop_vs_chargedE[region]);
309 m_Zee_meanEop_vs_phi.push_back(new TProfile("Zee_meanEop_vs_phi", "Mean E/p vs phi for Zee EM-clusters", 15, -3.15, 3.15));
310 RegisterHisto(al_Zee_mon,m_Zee_meanEop_vs_phi[region]);
311 m_Zee_meanEop_vs_eta.push_back(new TProfile("Zee_meanEop_vs_eta", "Mean E/p vs eta for Zee EM-clusters", 15, -3., 3.));
312 RegisterHisto(al_Zee_mon,m_Zee_meanEop_vs_eta[region]);
313
314 m_Zee_meanEop_vs_p_plus.push_back(new TProfile("Zee_meanEop_vs_p_plus", "Mean E/p vs p for pos. charged Zee EM-clusters", 15, 0., 300.));
315 RegisterHisto(al_Zee_mon,m_Zee_meanEop_vs_p_plus[region]);
316 m_Zee_meanEop_vs_invp_plus.push_back(new TProfile("Zee_meanEop_vs_invp_plus", "Mean E/p vs 1/p for pos. charged Zee EM-clusters", 15, 0., 0.05));
317 RegisterHisto(al_Zee_mon,m_Zee_meanEop_vs_invp_plus[region]);
318 m_Zee_meanEop_vs_E_plus.push_back(new TProfile("Zee_meanEop_vs_E_plus", "Mean E/p vs E for pos. charged Zee EM-clusters", 15, 0., 300.));
319 RegisterHisto(al_Zee_mon,m_Zee_meanEop_vs_E_plus[region]);
320 m_Zee_meanEop_vs_phi_plus.push_back(new TProfile("Zee_meanEop_vs_phi_plus", "Mean E/p vs phi for pos. charged Zee EM-clusters", 15, -3.15, 3.15));
321 RegisterHisto(al_Zee_mon,m_Zee_meanEop_vs_phi_plus[region]);
322 m_Zee_meanEop_vs_eta_plus.push_back(new TProfile("Zee_meanEop_vs_eta_plus", "Mean E/p vs eta for pos. charged Zee EM-clusters", 15, -3., 3.));
323 RegisterHisto(al_Zee_mon,m_Zee_meanEop_vs_eta_plus[region]);
324
325 m_Zee_meanEop_vs_p_minus.push_back(new TProfile("Zee_meanEop_vs_p_minus", "Mean E/p vs p for neg. charged Zee EM-clusters", 15, 0., 300.));
326 RegisterHisto(al_Zee_mon,m_Zee_meanEop_vs_p_minus[region]);
327 m_Zee_meanEop_vs_invp_minus.push_back(new TProfile("Zee_meanEop_vs_invp_minus", "Mean E/p vs 1/p for neg. charged Zee EM-clusters", 15, 0., 0.05));
328 RegisterHisto(al_Zee_mon,m_Zee_meanEop_vs_invp_minus[region]);
329 m_Zee_meanEop_vs_E_minus.push_back(new TProfile("Zee_meanEop_vs_E_minus", "Mean E/p vs E for neg. charged Zee EM-clusters", 15, 0., 300.));
330 RegisterHisto(al_Zee_mon,m_Zee_meanEop_vs_E_minus[region]);
331 m_Zee_meanEop_vs_phi_minus.push_back(new TProfile("Zee_meanEop_vs_phi_minus", "Mean E/p vs phi for neg. charged Zee EM-clusters", 15, -3.15, 3.15));
332 RegisterHisto(al_Zee_mon,m_Zee_meanEop_vs_phi_minus[region]);
333 m_Zee_meanEop_vs_eta_minus.push_back(new TProfile("Zee_meanEop_vs_eta_minus", "Mean E/p vs eta for neg. charged Zee EM-clusters", 15, -3., 3.));
334 RegisterHisto(al_Zee_mon,m_Zee_meanEop_vs_eta_minus[region]);
335
336 m_Zee_Eop_lt1_gt1.push_back(new TH1F("Zee_Eop_lt1_gt1", "E/p below/above 1 for Zee EM-clusters", 2, 0.5, 1.5));
337 RegisterHisto(al_Zee_mon,m_Zee_Eop_lt1_gt1[region]);
338
339 m_Zee_Eopdiff_vs_p.push_back(new TProfile("Zee_Eopdiff_vs_p", "E/p difference (pos-neg) vs p for Zee EM-clusters", 15, 0., 300.));
340 RegisterHisto(al_Zee_mon,m_Zee_Eopdiff_vs_p[region]);
341 m_Zee_Eopdiff_vs_invp.push_back(new TProfile("Zee_Eopdiff_vs_invp", "E/p difference (pos-neg) vs 1/p for Zee EM-clusters", 15, 0., 0.05));
342 RegisterHisto(al_Zee_mon,m_Zee_Eopdiff_vs_invp[region]);
343 m_Zee_Eopdiff_vs_E.push_back(new TProfile("Zee_Eopdiff_vs_E", "E/p difference (pos-neg) vs E for Zee EM-clusters", 15, 0., 300.));
344 RegisterHisto(al_Zee_mon,m_Zee_Eopdiff_vs_E[region]);
345 m_Zee_Eopdiff_vs_phi.push_back(new TProfile("Zee_Eopdiff_vs_phi", "E/p difference (pos-neg) vs phi for Zee EM-clusters", 15, -3.15, 3.15));
346 RegisterHisto(al_Zee_mon,m_Zee_Eopdiff_vs_phi[region]);
347 m_Zee_Eopdiff_vs_eta.push_back(new TProfile("Zee_Eopdiff_vs_eta", "E/p difference (pos-neg) vs eta for Zee EM-clusters", 15, -3., 3.));
348 RegisterHisto(al_Zee_mon,m_Zee_Eopdiff_vs_eta[region]);
349
350 m_Zee_Eop_lt1_vs_eta.push_back(new TH1F("Zee_Eop_lt1_vs_eta","Eta of Zee EM-clusters with E/p < 1 (not incl. small E/p)", 15, -3., 3.));
351 RegisterHisto(al_Zee_mon,m_Zee_Eop_lt1_vs_eta[region]);
352 m_Zee_Eop_lt1_vs_phi.push_back(new TH1F("Zee_Eop_lt1_vs_phi","Phi of Zee EM-clusters with E/p < 1 (not incl. small E/p)", 15, -3.15, 3.15));
353 RegisterHisto(al_Zee_mon,m_Zee_Eop_lt1_vs_phi[region]);
354 m_Zee_Eop_gt1_vs_eta.push_back(new TH1F("Zee_Eop_gt1_vs_eta","Eta of Zee EM-clusters with E/p < 1 (not incl. small E/p)", 15, -3., 3.));
355 RegisterHisto(al_Zee_mon,m_Zee_Eop_gt1_vs_eta[region]);
356 m_Zee_Eop_gt1_vs_phi.push_back(new TH1F("Zee_Eop_gt1_vs_phi","Phi of Zee EM-clusters with E/p < 1 (not incl. small E/p)", 15, -3.15, 3.15));
357 RegisterHisto(al_Zee_mon,m_Zee_Eop_gt1_vs_phi[region]);
358 m_Zee_frac_Eop_lt1_vs_eta.push_back(new TH1F("Zee_frac_Eop_lt1_vs_eta","Fraction of Zee EM-clusters with E/p < 1 (not incl. small E/p) vs Eta", 15, -3., 3.));
359 RegisterHisto(al_Zee_mon,m_Zee_frac_Eop_lt1_vs_eta[region],1);
360 m_Zee_frac_Eop_lt1_vs_phi.push_back(new TH1F("Zee_frac_Eop_lt1_vs_phi","Fraction of Zee EM-clusters with E/p < 1 (not incl. small E/p) vs Phi", 15, -3.15, 3.15));
361 RegisterHisto(al_Zee_mon,m_Zee_frac_Eop_lt1_vs_phi[region],1);
362
363 m_Zee_Eop_05_25.push_back(new TH1F("Zee_Eop_05_25","Number of Zee events with 0.5 < E/p 2.5", 1, 0., 1.));
364 RegisterHisto(al_Zee_mon,m_Zee_Eop_05_25[region]);
365 m_Zee_Eop_15_25.push_back(new TH1F("Zee_Eop_15_25","Number of Zee events with 1.5 < E/p 2.5", 1, 0., 1.));
366 RegisterHisto(al_Zee_mon,m_Zee_Eop_15_25[region]);
367 m_Zee_frac_Eop_05_25_15_25.push_back(new TH1F("Zee_frac_Eop_05_25_15_25","Fraction of Zee EM-clusters with 1.5 < E/p < 2.5 and 0.5 < E/p < 2.5", 1, 0., 1.));
368 RegisterHisto(al_Zee_mon,m_Zee_frac_Eop_05_25_15_25[region],1);
369 }
370
372 }
373 return StatusCode::SUCCESS;
374}
375
376void IDPerfMonZee::RegisterHisto(MonGroup& mon, TH1* histo, bool doSumw2) {
377 if (doSumw2) histo->Sumw2();
378 if (mon.regHist(histo).isFailure() ) {
379 ATH_MSG_DEBUG( "Cannot book TH1 Histogram:" );
380 }
381}
382
383void IDPerfMonZee::RegisterHisto(MonGroup& mon, TProfile* histo) {
384 if (mon.regHist(histo).isFailure() ) {
385 ATH_MSG_DEBUG( "Cannot book TProfile Histogram:" );
386 }
387}
388
389void IDPerfMonZee::RegisterHisto(MonGroup& mon, TH2* histo, bool doSumw2) {
390 if (doSumw2) histo->Sumw2();
391 if (mon.regHist(histo).isFailure() ) {
392 ATH_MSG_DEBUG( "Cannot book TH2 Histogram:" );
393 }
394}
395
396StatusCode IDPerfMonZee::fillHistograms(const EventContext& /*ctx*/)
397{
398 ATH_MSG_VERBOSE("In fillHistograms()");
399 int nevents = (int) m_Nevents->GetEntries();
400 const bool firstEvent{nevents == 1};
401 // get electron container from storegate
402 auto formErrorMessage = [] (const std::string & contName)->std::string {
403 return std::string(std::string("No Collection with name ") + contName + std::string(" found in StoreGate"));
404 };
405 // get electron container from storegate
407
408 if (not electrons){
409 const std::string & errMsg=formErrorMessage(m_electronsName);
410 if (firstEvent) ATH_MSG_WARNING( errMsg );
411 else ATH_MSG_DEBUG(errMsg);
412 return StatusCode::RECOVERABLE;
413 }
414 ATH_MSG_VERBOSE("This event contains " << electrons->size() << " electrons.");
415
416 // get photon container from storegate
417 const xAOD::PhotonContainer* photons = getCollectionWithCheck<xAOD::PhotonContainer>(evtStore(),m_photonsName);
418 if (not photons){
419 const std::string & errMsg = formErrorMessage(m_photonsName);
420 if (firstEvent) ATH_MSG_WARNING( errMsg );
421 else ATH_MSG_DEBUG(errMsg);
422 return StatusCode::RECOVERABLE;
423 }
424
425 // get emcluster container from storegate
426 const xAOD::CaloClusterContainer* emclusters = getCollectionWithCheck<xAOD::CaloClusterContainer>(evtStore(),m_emclustersName);
427 if (not emclusters){
428 const std::string & errMsg = formErrorMessage(m_emclustersName);
429 if (firstEvent) ATH_MSG_WARNING( errMsg );
430 else ATH_MSG_DEBUG(errMsg);
431 return StatusCode::RECOVERABLE;
432 }
433
434 // get track container from storegate
435 const xAOD::TrackParticleContainer* tracks = getCollectionWithCheck<xAOD::TrackParticleContainer>(evtStore(),m_tracksName);
436 if (not tracks){
437 const std::string & errMsg = formErrorMessage(m_tracksName);
438 if (firstEvent) ATH_MSG_WARNING( errMsg );
439 else ATH_MSG_DEBUG(errMsg);
440 return StatusCode::RECOVERABLE;
441 }
442
443 // get met container from storegate
444 const xAOD::MissingETContainer* final_met = getCollectionWithCheck<xAOD::MissingETContainer>(evtStore(),m_metName);
445 if (not final_met){
446 const std::string & errMsg = formErrorMessage(m_metName);
447 if (firstEvent) ATH_MSG_WARNING( errMsg );
448 else ATH_MSG_DEBUG(errMsg);
449 return StatusCode::RECOVERABLE;
450 }
451 const xAOD::MissingET *met{};
452 met = (*final_met)[m_metRefFinalName];
453 if (met) {
454 ATH_MSG_DEBUG( "MET = " << met->met() );
455 }
456 m_Nevents->Fill(0.);
457
458 // *******************
459 // Look at EM clusters
460 // *******************
461
462 const xAOD::CaloCluster* LeadingEMcluster = getLeadingEMcluster(photons, electrons);
463 const xAOD::CaloCluster* SecondLeadingEMcluster = getLeadingEMcluster(photons, electrons, LeadingEMcluster);
464
465 if((LeadingEMcluster) and (SecondLeadingEMcluster))
466 ATH_MSG_DEBUG("Event has a leading and second leading EM cluster!");
467
468 if (LeadingEMcluster and SecondLeadingEMcluster) {
469 int leading_eta_region = etaRegion(LeadingEMcluster->etaBE(2));
470 int second_leading_eta_region = etaRegion(SecondLeadingEMcluster->etaBE(2));
471 double leading_dPhi = electronTrackMatchEta(tracks,LeadingEMcluster);
472 double leading_dEta = electronTrackMatchPhi(tracks,LeadingEMcluster);
473 double second_leading_dPhi = electronTrackMatchEta(tracks,SecondLeadingEMcluster);
474 double second_leading_dEta = electronTrackMatchPhi(tracks,SecondLeadingEMcluster);
475 const xAOD::TrackParticle* track_leading_emcluster = electronTrackMatch(tracks,LeadingEMcluster);
476 const xAOD::TrackParticle* track_second_leading_emcluster = electronTrackMatch(tracks,SecondLeadingEMcluster);
477
478 if( track_leading_emcluster and track_second_leading_emcluster) ATH_MSG_DEBUG("Event has a tracks matched to both clusters!");
479 //
480 // *********************
481 // Fill event histograms
482 // *********************
483 // get cluster, track invariant masses and fill pre-selection histograms
484 double cluster_invmass = InvMass(LeadingEMcluster,SecondLeadingEMcluster);
485 ATH_MSG_DEBUG("Cluster invariant mass: " << cluster_invmass);
486 if (cluster_invmass > 0.) m_Zee_invmass->Fill(cluster_invmass);
487 double track_invmass = 0.;
488 if (track_leading_emcluster and track_second_leading_emcluster) {
489 track_invmass = InvMass(track_leading_emcluster,track_second_leading_emcluster);
490 ATH_MSG_DEBUG("Track invariant mass: " << track_invmass);
491 if (track_invmass > 0.) m_Zee_trk_invmass->Fill(track_invmass);
492 }
493 // does the event pass the Zee selection?
494 int selected = isZee(LeadingEMcluster,SecondLeadingEMcluster,tracks);
495 ATH_MSG_DEBUG("Event passed " << 3-selected << "/3 Zee cuts");
496
497 // fill histograms only with selected events
498 if(selected == 0){
499 ATH_MSG_DEBUG("Event passed selection -- filling histograms");
500 if (cluster_invmass > 0.) m_Zee_invmass_sel->Fill(cluster_invmass);
501 if (track_invmass > 0.) m_Zee_trk_invmass_sel->Fill(track_invmass);
502 // fill e/p histos from SELECTED Zee events
503 if (track_leading_emcluster && track_second_leading_emcluster) {
504 double eoverp_pos = -99.;
505 double eoverp_neg = -99.;
506 double track_leading_emcluster_p = track_leading_emcluster->pt()*cosh(track_leading_emcluster->eta());
507 double track_second_leading_emcluster_p = track_second_leading_emcluster->pt()*std::cosh(track_second_leading_emcluster->eta());
508
509 if (track_leading_emcluster->charge() == 1. && track_second_leading_emcluster->charge() == -1.) {
510 eoverp_pos = LeadingEMcluster->e()/track_leading_emcluster_p;
511 eoverp_neg = SecondLeadingEMcluster->e()/track_second_leading_emcluster_p;
512 } else if (track_leading_emcluster->charge() == -1. && track_second_leading_emcluster->charge() == 1.) {
513 eoverp_neg = LeadingEMcluster->e()/track_leading_emcluster_p;
514 eoverp_pos = SecondLeadingEMcluster->e()/track_second_leading_emcluster_p;
515 }
516 double eoverpasym = -99.;
517 if (eoverp_pos+eoverp_neg != 0.) {
518 eoverpasym = (eoverp_pos-eoverp_neg) / (eoverp_pos+eoverp_neg);
519 m_Zee_Eopasym_perevent->Fill(eoverpasym);
520 if ( (eoverp_pos > m_eoverp_tight_min) && (eoverp_pos < m_eoverp_tight_max) && (eoverp_neg > m_eoverp_tight_min) && (eoverp_neg < m_eoverp_tight_max) ) {
521 m_Zee_Eopasym_perevent_central->Fill(eoverpasym);
522 }
523 }
524 }
525 }
526 // ***********************
527 // Fill cluster histograms
528 // ***********************
529 if (selected == 0) {
530 // ************************
531 // Fill for leading cluster
532 // ************************
533 FillHistosPerCluster(LeadingEMcluster, track_leading_emcluster, leading_eta_region, leading_dEta, leading_dPhi);
534 FillHistosPerCluster(LeadingEMcluster, track_leading_emcluster, incl, leading_dEta, leading_dPhi);
535 // *******************************
536 // Fill for second leading cluster
537 // *******************************
538 FillHistosPerCluster(SecondLeadingEMcluster, track_second_leading_emcluster, second_leading_eta_region, second_leading_dEta, second_leading_dPhi);
539 FillHistosPerCluster(SecondLeadingEMcluster, track_second_leading_emcluster, incl, second_leading_dEta, second_leading_dPhi);
540 }
541 }
542 return StatusCode::SUCCESS;
543}
544
545void IDPerfMonZee::makeEffHisto(TH1F* h_num, TH1F* h_denom, TH1F* h_eff) {
546 h_eff->Divide(h_num,h_denom,1.,1.,"B");
547}
548
550{
551 if( endOfRunFlag() ) {
552 // PostProcess Zee histograms
553 for (int region=0; region!=1; ++region) {
560 // these were commented out
561 m_Zee_Eopdiff[region]->Add(m_Zee_Eop_plus[region],m_Zee_Eop_minus[region],1.,-1);
562 m_Zee_Eopdiff_vs_p[region]->Add(m_Zee_meanEop_vs_p_plus[region],m_Zee_meanEop_vs_p_minus[region],1.,-1);
564 m_Zee_Eopdiff_vs_E[region]->Add(m_Zee_meanEop_vs_E_plus[region],m_Zee_meanEop_vs_E_minus[region],1.,-1);
567
571 }
572
573 }
574 return StatusCode::SUCCESS;
575}
576
577
579 const xAOD::CaloCluster* leading_emcluster{};
580 float max_pt = 0.;
581 for (const auto cl: *clusters) {
582 if (cl == omitCluster) continue;
583 double deltaR = std::sqrt(std::pow(std::abs(cl->phi() - omitCluster->phi()),2) + std::pow(std::abs(cl->eta() - omitCluster->eta()),2));
584 if(deltaR < 0.005) continue;
585 if (cl->pt()/Gaudi::Units::GeV < 10.) continue;
586 if (cl->pt() > max_pt) {
587 leading_emcluster = cl;
588 max_pt = cl->pt();
589 }
590 }
591 return leading_emcluster;
592}
593
594const xAOD::CaloCluster* IDPerfMonZee::getLeadingEMcluster(const xAOD::PhotonContainer* /*photons*/, const xAOD::ElectronContainer* electrons, const xAOD::CaloCluster* omitCluster) const {
595 const xAOD::CaloCluster* leading_emcluster{};
596 bool LHSel;
597 float max_pt = 0.;
598 for (const auto em: *electrons) {
599 ATH_MSG_DEBUG("Checking likelihood");
600 // check ID
601 if(m_doIDCuts){
602 LHSel = false;
603 LHSel = (bool) m_LHTool2015->accept(em);
604 if(!LHSel) continue;
605 ATH_MSG_DEBUG("Electron passes " << m_electronIDLevel << " likelihood selection");
606 }
607 const xAOD::CaloCluster* cl = em->caloCluster();
608 if (cl == omitCluster) continue;
609 double deltaR = !omitCluster ? 1.0 : std::sqrt(std::pow(std::abs(cl->phi() - omitCluster->phi()),2) + std::pow(std::abs(cl->eta() - omitCluster->eta()),2));
610 if(deltaR < 0.005) continue;
611 if (cl->pt()/Gaudi::Units::GeV < 20.) continue;
612 if (cl->pt() > max_pt) {
613 leading_emcluster = cl;
614 max_pt = cl->pt();
615 }
616 }
617 ATH_MSG_DEBUG("leading_emcluster: " << leading_emcluster);
618 return leading_emcluster;
619}
620
621
622const xAOD::TrackParticle* IDPerfMonZee::electronTrackMatch(const xAOD::TrackParticleContainer* tracks, const xAOD::CaloCluster* cluster, double dEta, double dPhi) const {
623 const xAOD::TrackParticle* matched_track{};
624 double min_dR = 1.0e+20;
625 for (const auto track: *tracks){
626 double deta = cluster->etaBE(2)-track->eta();
627 double dphi = cluster->phi()-track->phi();
628 double dr = std::sqrt(deta*deta + dphi*dphi);
629 if (dr < min_dR && std::abs(deta) < dEta && std::abs(dphi) < dPhi) {
630 min_dR = dr;
631 matched_track = track;
632 }
633 }
634 return matched_track;
635}
636
637double IDPerfMonZee::electronTrackMatchEta(const xAOD::TrackParticleContainer* tracks, const xAOD::CaloCluster* cluster, double dEta) const {
638 const xAOD::TrackParticle* matched_track{};
639 double min_dEta = 1.0e+20;
640 for (const auto track : *tracks){
641 double deta = std::abs(cluster->etaBE(2)-track->eta());
642 if (deta < min_dEta && deta < dEta) {
643 min_dEta = deta;
644 matched_track = track;
645 }
646 }
647 double dPhi = 1.0e+20;
648 if (matched_track != nullptr) dPhi = signedDeltaPhi(cluster->phi(),matched_track->phi());
649 return dPhi;
650}
651
652double IDPerfMonZee::electronTrackMatchPhi(const xAOD::TrackParticleContainer* tracks, const xAOD::CaloCluster* cluster, double dPhi) const {
653 const xAOD::TrackParticle* matched_track{};
654 double min_dPhi = 1.0e+20;
655 for (const auto track : *tracks){
656 double dphi = std::abs(signedDeltaPhi(cluster->phi(),track->phi()));
657 if (dphi < min_dPhi && dphi < dPhi) {
658 min_dPhi = dphi;
659 matched_track = track;
660 }
661 }
662 double dEta = 1.0e+20;
663 if (matched_track ) dEta = cluster->etaBE(2)-matched_track->eta();
664 return dEta;
665}
666
667double IDPerfMonZee::InvMass(const xAOD::CaloCluster* EM1, const xAOD::CaloCluster* EM2) const {
668 if (EM1 == nullptr || EM2 == nullptr) return -99.;
669 double invmass = 0.;
670 if (EM1->pt() != 0 && EM2->pt() != 0.) {
671 TLorentzVector particle1;
672 TLorentzVector particle2;
673 particle1.SetPtEtaPhiE(EM1->pt()/Gaudi::Units::GeV,EM1->eta(),EM1->phi(),EM1->e()/Gaudi::Units::GeV);
674 particle2.SetPtEtaPhiE(EM2->pt()/Gaudi::Units::GeV,EM2->eta(),EM2->phi(),EM2->e()/Gaudi::Units::GeV);
675 invmass = (particle1+particle2).Mag();
676 }
677 return invmass;
678}
679
680double IDPerfMonZee::InvMass(const xAOD::TrackParticle* trk1, const xAOD::TrackParticle* trk2) const {
681 if (trk1 == nullptr || trk2 == nullptr) return -99.;
682 double invmass = 0.;
683 if (trk1->pt() != 0 && trk2->pt() != 0.) {
684 TLorentzVector particle1;
685 TLorentzVector particle2;
686 particle1.SetPtEtaPhiE(trk1->pt()/Gaudi::Units::GeV,trk1->eta(),trk1->phi(),trk1->e()/Gaudi::Units::GeV);
687 particle2.SetPtEtaPhiE(trk2->pt()/Gaudi::Units::GeV,trk2->eta(),trk2->phi(),trk2->e()/Gaudi::Units::GeV);
688 invmass = (particle1+particle2).Mag();
689 }
690 return invmass;
691}
692
694 if (EM == nullptr || met == nullptr) return -99.;
695 double transmass = 0.;
696 float dphi = signedDeltaPhi(EM->phi(),met->phi());
697 transmass = std::sqrt(2.*EM->et()*met->met()*(1.-std::cos(dphi)));
698 return transmass;
699}
700
701double IDPerfMonZee::deltaR(const xAOD::CaloCluster* cluster, const xAOD::TrackParticle* track) const {
702 double dr =-999.;
703 if (cluster == nullptr || track == nullptr) return dr;
704 double deta = cluster->etaBE(2)-track->eta();
705 double dphi = cluster->phi()-track->phi();
706 dr = std::sqrt(deta*deta + dphi*dphi);
707 return dr;
708}
709
711 int selected = 3;
712 //are the two electrons oppositely charged?
713 const xAOD::TrackParticle* track_leading_emcluster = electronTrackMatch(tracks,em1);
714 const xAOD::TrackParticle* track_second_leading_emcluster = electronTrackMatch(tracks,em2);
715 if(!track_leading_emcluster || !track_second_leading_emcluster){
716 ATH_MSG_DEBUG("Don't have 2 matched tracks! Skipping charge check...");
717 --selected;
718 }
719 else if(track_leading_emcluster->charge() != track_second_leading_emcluster->charge())
720 --selected;
721 double invmass = InvMass(em1,em2); // given in GeV
722 if (em1->pt()/Gaudi::Units::GeV > 20. &&
723 em2->pt()/Gaudi::Units::GeV > 20.) --selected;
724 if (invmass > 70. &&
725 invmass < 110.) --selected;
726 return selected;
727}
728
729double IDPerfMonZee::signedDeltaPhi(double phi1, double phi2) const {
730 double phia=phi1;
731 if(phi1>Gaudi::Units::pi) phia=phi1-2.*Gaudi::Units::pi;
732 double phib=phi2;
733 if(phi2>Gaudi::Units::pi) phib=phi2-2.*Gaudi::Units::pi;
734 double dphi=phia-phib;
735 if(dphi>Gaudi::Units::pi) dphi-=2.*Gaudi::Units::pi;
736 if(dphi<-Gaudi::Units::pi) dphi+=2.*Gaudi::Units::pi;
737 return dphi;
738}
739
741 int region = -99;
742 if (std::abs(eta) <= 1.) region = barrel;
743 else if (eta > 1.) region = eca; // eca
744 else if (eta < -1.) region = ecc; // ecc
745 return region;
746
747}
748
749void IDPerfMonZee::FillHistosPerCluster(const xAOD::CaloCluster* cluster, const xAOD::TrackParticle* track, int region, float dEta, float dPhi) {
750 if (cluster == nullptr) return;
751 if (region<0){
752 throw(std::out_of_range("Region index has negative value in IDPerfMonZee::FillHistosPerCluster"));
753 }
754 // THERE IS A CLUSTER
755 if (region == incl) { // inclusive only
756 m_Zee_eta[region]->Fill(cluster->etaBE(2));
757 m_Zee_phi[region]->Fill(cluster->phi());
758 // match in eta and phi separately and make dEta and dPhi plots
759 if (dEta < 1.0e+20) {
760 m_Zee_deta[region]->Fill(dEta);
761 if (std::abs(dEta) < 0.05) { // calculate mean only for those in matching window
762 m_Zee_deta_vs_eta[region]->Fill(cluster->etaBE(2),dEta);
763 m_Zee_deta_vs_phi[region]->Fill(cluster->phi(),dEta);
764 m_Zee_deta_vs_eta_2d[region]->Fill(cluster->etaBE(2),dEta);
765 m_Zee_deta_vs_phi_2d[region]->Fill(cluster->phi(),dEta);
766 m_Zee_absdeta_vs_eta[region]->Fill(cluster->etaBE(2),std::abs(dEta));
767 m_Zee_absdeta_vs_phi[region]->Fill(cluster->phi(),std::abs(dEta));
768 }
769 }
770 if (dPhi < 1.0e+20) {
771 m_Zee_dphi[region]->Fill(dPhi);
772 if (std::abs(dPhi) < 0.1) { // calculate mean only for those in matching window
773 m_Zee_dphi_vs_eta[region]->Fill(cluster->etaBE(2),dPhi);
774 m_Zee_dphi_vs_phi[region]->Fill(cluster->phi(),dPhi);
775 m_Zee_dphi_vs_eta_2d[region]->Fill(cluster->etaBE(2),dPhi);
776 m_Zee_dphi_vs_phi_2d[region]->Fill(cluster->phi(),dPhi);
777 m_Zee_absdphi_vs_eta[region]->Fill(cluster->etaBE(2),std::abs(dPhi));
778 m_Zee_absdphi_vs_phi[region]->Fill(cluster->phi(),std::abs(dPhi));
779 }
780 }
781
782 } // end inclusive only
783 if (not track) return;
784 // TRACK-MATCHED
785 float eoverp = 0.;
786 float track_p = track->pt()*std::cosh(track->eta());
787 if (track_p != 0.) eoverp = cluster->e()/track_p;
788 m_Zee_Eop[region]->Fill(eoverp);
789 if (track->charge() == 1.) {
790 m_Zee_Eop_plus[region]->Fill(eoverp);
791 }
792 else if (track->charge() == -1.) {
793 m_Zee_Eop_minus[region]->Fill(eoverp);
794 }
795 if (region == incl) { // inclusive only
796 auto safeInverseMom = [](float p){
797 if (p == 0.) return 10e10; //arbitrary very large number
798 return 1./(p/Gaudi::Units::GeV);
799 };
800 m_Zee_trackmatched_eta[region]->Fill(cluster->etaBE(2));
801 m_Zee_trackmatched_phi[region]->Fill(cluster->phi());
802 if (eoverp > m_eoverp_tight_min && eoverp < m_eoverp_tight_max) {
803 m_Zee_meanEop_vs_p[region]->Fill(track_p/Gaudi::Units::GeV,eoverp);
804 m_Zee_meanEop_vs_invp[region]->Fill(safeInverseMom(track_p),eoverp);
805 m_Zee_meanEop_vs_E[region]->Fill(cluster->e()/Gaudi::Units::GeV,eoverp);
806 m_Zee_meanEop_vs_chargedp[region]->Fill(double(track->charge())*track_p/Gaudi::Units::GeV,eoverp);
807 m_Zee_meanEop_vs_chargedE[region]->Fill(double(track->charge())*cluster->e()/Gaudi::Units::GeV,eoverp);
808 m_Zee_meanEop_vs_phi[region]->Fill(track->phi(),eoverp);
809 m_Zee_meanEop_vs_eta[region]->Fill(track->eta(),eoverp);
810 }
811 if (track->charge() == 1.) {
812 if (eoverp > m_eoverp_tight_min && eoverp < m_eoverp_tight_max) {
813 m_Zee_meanEop_vs_p_plus[region]->Fill(track_p/Gaudi::Units::GeV,eoverp);
814 m_Zee_meanEop_vs_invp_plus[region]->Fill(safeInverseMom(track_p),eoverp);
815 m_Zee_meanEop_vs_E_plus[region]->Fill(cluster->e()/Gaudi::Units::GeV,eoverp);
816 m_Zee_meanEop_vs_phi_plus[region]->Fill(track->phi(),eoverp);
817 m_Zee_meanEop_vs_eta_plus[region]->Fill(track->eta(),eoverp);
818 }
819 }else if (track->charge() == -1.) {
820 if (eoverp > m_eoverp_tight_min && eoverp < m_eoverp_tight_max) {
821 m_Zee_meanEop_vs_p_minus[region]->Fill(track_p/Gaudi::Units::GeV,eoverp);
822 m_Zee_meanEop_vs_invp_minus[region]->Fill(safeInverseMom(track_p),eoverp);
823 m_Zee_meanEop_vs_E_minus[region]->Fill(cluster->e()/Gaudi::Units::GeV,eoverp);
824 m_Zee_meanEop_vs_phi_minus[region]->Fill(track->phi(),eoverp);
825 m_Zee_meanEop_vs_eta_minus[region]->Fill(track->eta(),eoverp);
826 }
827 }
828 if (eoverp < m_eoverp_standard_max && eoverp > m_eoverp_standard_min) {
829 m_Zee_trackmatched_Eopmatched_eta[region]->Fill(cluster->etaBE(2));
830 m_Zee_trackmatched_Eopmatched_phi[region]->Fill(cluster->phi());
831 }
832 if (eoverp < m_eoverp_tight_max && eoverp > m_eoverp_tight_min) {
833 m_Zee_trackmatched_tightEopmatched_eta[region]->Fill(cluster->etaBE(2));
834 m_Zee_trackmatched_tightEopmatched_phi[region]->Fill(cluster->phi());
835 }
836 if (eoverp > m_eoverp_tight_min && eoverp < 1.) {
837 m_Zee_Eop_lt1_vs_eta[region]->Fill(cluster->etaBE(2));
838 m_Zee_Eop_lt1_vs_phi[region]->Fill(cluster->phi());
839 m_Zee_Eop_lt1_gt1[region]->Fill(0.75);
840 }
841 else if (eoverp > 1. && eoverp < m_eoverp_tight_max) {
842 m_Zee_Eop_gt1_vs_eta[region]->Fill(cluster->etaBE(2));
843 m_Zee_Eop_gt1_vs_phi[region]->Fill(cluster->phi());
844 m_Zee_Eop_lt1_gt1[region]->Fill(1.25);
845 }
846 if (eoverp > 0.5 && eoverp < 2.5) m_Zee_Eop_05_25[region]->Fill(0.5);
847 if (eoverp > 1.5 && eoverp < 2.5) m_Zee_Eop_15_25[region]->Fill(0.5);
848 } // end inclusive only
849
850}
Scalar eta() const
pseudorapidity method
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
#define ATH_MSG_INFO(x,...)
static Double_t sc
Electron selector tool to select objects in Athena using an underlying pure ROOT tool.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
static Environment_t environment()
Returns the running environment of the monitoring application to help ManagedMonitorToolBase objects ...
std::vector< TH2F * > m_Zee_dphi_vs_eta_2d
double electronTrackMatchPhi(const xAOD::TrackParticleContainer *tracks, const xAOD::CaloCluster *cluster, double dPhi=0.1) const
double deltaR(const xAOD::CaloCluster *cluster, const xAOD::TrackParticle *track) const
double InvMass(const xAOD::CaloCluster *EM1, const xAOD::CaloCluster *EM2) const
const xAOD::CaloCluster * getLeadingEMcluster(const xAOD::CaloClusterContainer *clusters, const xAOD::CaloCluster *omitCluster=0) const
std::vector< TProfile * > m_Zee_meanEop_vs_invp_minus
std::vector< TProfile * > m_Zee_deta_vs_eta
std::vector< TProfile * > m_Zee_absdphi_vs_eta
std::vector< TProfile * > m_Zee_meanEop_vs_phi_plus
double signedDeltaPhi(double phi1, double phi2) const
double TransMass(const xAOD::CaloCluster *EM, const xAOD::MissingET *met) const
std::vector< TProfile * > m_Zee_Eopdiff_vs_p
std::vector< TH1F * > m_Zee_trackmatched_tightEopmatched_phi
double m_eoverp_tight_min
std::vector< TProfile * > m_Zee_meanEop_vs_eta
std::vector< TProfile * > m_Zee_meanEop_vs_p_minus
double electronTrackMatchEta(const xAOD::TrackParticleContainer *tracks, const xAOD::CaloCluster *cluster, double dEta=0.05) const
std::vector< TH1F * > m_Zee_Eopmatch_eff_vs_eta
std::vector< std::string > m_region_strings
std::vector< TProfile * > m_Zee_meanEop_vs_phi
std::vector< TProfile * > m_Zee_dphi_vs_eta
std::vector< TH1F * > m_Zee_frac_Eop_lt1_vs_phi
virtual StatusCode bookHistograms()
An inheriting class should either override this function or bookHists().
AsgElectronLikelihoodTool * m_LHTool2015
std::vector< TH1F * > m_Zee_frac_Eop_lt1_vs_eta
std::vector< TProfile * > m_Zee_meanEop_vs_p
void makeEffHisto(TH1F *h_num, TH1F *h_denom, TH1F *h_eff)
std::vector< TProfile * > m_Zee_meanEop_vs_chargedp
TH1F * m_Zee_trk_invmass_scaled
std::vector< TProfile * > m_Zee_Eopdiff_vs_E
std::vector< TH1F * > m_Zee_Eop_gt1_vs_eta
std::vector< TH1F * > m_Zee_trackmatch_eff_vs_phi
std::vector< TH2F * > m_Zee_deta_vs_eta_2d
std::vector< TProfile * > m_Zee_Eopdiff_vs_phi
std::vector< TH2F * > m_Zee_dphi_vs_phi_2d
std::string m_VxPrimContainerName
std::string m_triggerChainName
TH1F * m_Zee_trk_invmass_sel
std::vector< TH1F * > m_Zee_tightEopmatch_eff_vs_phi
std::vector< TProfile * > m_Zee_meanEop_vs_eta_plus
std::vector< TH1F * > m_Zee_Eopdiff
std::vector< TH1F * > m_Zee_trackmatched_Eopmatched_phi
void FillHistosPerCluster(const xAOD::CaloCluster *cluster, const xAOD::TrackParticle *track, int region, float dEta, float dPhi)
std::string m_metRefFinalName
std::vector< TProfile * > m_Zee_meanEop_vs_phi_minus
std::vector< TH1F * > m_Zee_trackmatched_Eopmatched_eta
std::vector< TH1F * > m_Zee_Eop
std::vector< TH1F * > m_Zee_trackmatched_eta
std::string m_tracksName
std::string m_metName
std::vector< TProfile * > m_Zee_deta_vs_phi
TH1F * m_Zee_Eopasym_perevent_central
std::vector< TH1F * > m_Zee_Eop_lt1_gt1
TH1F * m_Zee_Eopasym_perevent
const xAOD::TrackParticle * electronTrackMatch(const xAOD::TrackParticleContainer *tracks, const xAOD::CaloCluster *cluster, double dEta=0.05, double dPhi=0.1) const
std::vector< TProfile * > m_Zee_absdeta_vs_eta
std::vector< TH1F * > m_Zee_trackmatched_tightEopmatched_eta
std::vector< TH1F * > m_Zee_eta
std::vector< TProfile * > m_Zee_absdphi_vs_phi
TH1F * m_Nevents
std::vector< TH2F * > m_Zee_deta_vs_phi_2d
std::vector< TProfile * > m_Zee_meanEop_vs_p_plus
std::vector< TH1F * > m_Zee_Eop_lt1_vs_phi
std::vector< TProfile * > m_Zee_meanEop_vs_invp
std::vector< TH1F * > m_Zee_Eop_minus
std::vector< TH1F * > m_Zee_trackmatch_eff_vs_eta
std::vector< TProfile * > m_Zee_meanEop_vs_E_minus
std::string m_emclustersName
double m_eoverp_tight_max
std::vector< TProfile * > m_Zee_meanEop_vs_invp_plus
std::vector< TProfile * > m_Zee_dphi_vs_phi
virtual StatusCode initialize()
double m_eoverp_standard_max
std::string m_photonsName
std::vector< TH1F * > m_Zee_Eop_15_25
IDPerfMonZee(const std::string &type, const std::string &name, const IInterface *parent)
std::vector< TH1F * > m_Zee_Eop_plus
std::vector< TProfile * > m_Zee_meanEop_vs_E
std::vector< TH1F * > m_Zee_Eopmatch_eff_vs_phi
std::vector< TProfile * > m_Zee_meanEop_vs_eta_minus
std::vector< TH1F * > m_Zee_phi
std::string m_electronsName
std::vector< TProfile * > m_Zee_Eopdiff_vs_eta
std::vector< TProfile * > m_Zee_meanEop_vs_E_plus
std::vector< TH1F * > m_Zee_dphi
int isZee(const xAOD::CaloCluster *em1, const xAOD::CaloCluster *em2, const xAOD::TrackParticleContainer *tracks=0) const
TH1F * m_Zee_invmass_sel
std::vector< TH1F * > m_Zee_Eop_lt1_vs_eta
std::vector< TProfile * > m_Zee_absdeta_vs_phi
std::vector< TH1F * > m_Zee_tightEopmatch_eff_vs_eta
std::vector< TH1F * > m_Zee_Eop_05_25
std::vector< TH1F * > m_Zee_Eop_gt1_vs_phi
std::vector< TH1F * > m_Zee_frac_Eop_05_25_15_25
std::string m_electronIDLevel
TH1F * m_Zee_trk_invmass
virtual ~IDPerfMonZee()
double m_eoverp_standard_min
virtual StatusCode procHistograms()
An inheriting class should either override this function or finalHists().
TH1F * m_Zee_invmass
virtual StatusCode fillHistograms(const EventContext &ctx)
An inheriting class should either override this function or fillHists().
std::vector< TH1F * > m_Zee_trackmatched_phi
std::vector< TProfile * > m_Zee_Eopdiff_vs_invp
int etaRegion(double eta)
std::vector< TProfile * > m_Zee_meanEop_vs_chargedE
std::vector< TH1F * > m_Zee_deta
void RegisterHisto(MonGroup &mon, TH1 *histo, bool doSumw2=false)
A container of information describing a monitoring object.
ManagedMonitorToolBase(const std::string &type, const std::string &name, const IInterface *parent)
static const T * getContainer(CONTAINERS eContainer)
virtual double pt() const
The transverse momentum ( ) of the particle (negative for negative-energy clusters).
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double e() const
The total energy of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .).
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
float charge() const
Returns the charge.
virtual double e() const override final
The total energy of the particle.
const SG::AuxVectorData * container() const
Return the container holding this element.
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
MissingET_v1 MissingET
Version control by type defintion.
Definition MissingET.h:15
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
MissingETContainer_v1 MissingETContainer
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.