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