ATLAS Offline Software
Loading...
Searching...
No Matches
photonMonTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
6//
7// 2014-05-21 Author: Remi Lafaye (Annecy)
8// 2015-02-15 Author: Bertrand LAFORGE (LPNHE Paris)
9//
10// NAME: photonMonTool.cxx
11// PACKAGE: offline/Reconstruction/egamma/egammaPerformance
12// PURPOSE: Shifter should look for the following defects:
13// taken from https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/EgammaShifts
14//
15// in energies (Et plots for electrons and photons)
16// ===========
17// LOWSTAT : For short runs and not enough statistics when not being able
18// to judge the result using the egamma stream. Needs to be commented.
19//
20// ENERGY_(BARREL,ENDCAP,CRACK,FORWARD) : This defect is a significant energy
21// mis-calibration is observed for a certain part of the detector. This flag
22// is then intolerable for that detector region.
23//
24// LARNOISE_(BARREL,ENDCAP,FORWARD) : If some part of the detector is miscalibrated
25// causing an energy shift of at least 5% this intolerable defect should be set.
26//
27// in eta,phi (eta,phi 2D plots for electrons and photons)
28// ==========
29// ETAPHI_SPIKES/LOWOCCUPANCY : Non standard distribution (eta phi plane) of egamma
30// objects. Region with unusual density of electrons / photons. This could be produced
31// by a problem in the LAR calorimeter. If there is a spike in the distribution set
32// EGAMMA_ETAPHI_SPIKES as defect. Examples of runs with this problem can be found in
33// Click for image. (hot spot) and Click for image. (FEB with 100% rejection during part
34// of the run). If a HV trip could not be recovered during the run, there will be a region
35// in the eta phi plane with low occupancy. Then set the defect EGAMMA_LOWOCCUPANCY.
36//
37// in eta and phi (eta,phi 1D plots for electrons)
38// ==============
39// BEAMSPOT : When the beamspot is shifted with respect to the nominal position the
40// azimuthal distribution (phi) of tracks is different than normal. When the new
41// constants for the beam spot get uploaded and reprocessed this defect vanishes.
42// This is an intolerable defect so only use it after checking the bulk reconstruction,
43// in some cases express reconstruction can have this problem but usually is solved at
44// the bulk. Example of the run with a failure in the determination of the beam spot can
45// be found in Click for image..
46//
47// BAD_BLAYER : To be used when the distributions (eta, phi) for medium and tight electrons
48// have marked excess or defect of entries due to a problem with the b-layer. If this happens
49// the loose distributions will look fine. To distinguish between this and TRT problem more
50// details on the run and investigation will be needed. If you have to use this defect you
51// should document it in the EgammaShiftsBadRuns page. Example of the result of a b-layer
52// module with low efficiency can be found in Click for image..
53//
54// BAD_TRT : To be used when the distributions (eta, phi) for tight electrons / photons have
55// marked excess or defect of entries due to a problem with the TRT (due to the high threshold
56// requirement). If this happens the loose and medium distributions will look fine. To distinguish
57// between this and pixel (b-layer) problem more details on the run and investigation will be needed.
58// If you have to use this defect you should document it in the Runs List page. Example of the result
59// of a few RODs disabled in TRT can be found in Click for image..
60//
61// in electron ID
62// ==============
63// SHAPES : Bad shape for defining variables of electrons or photons. Distributions do not match
64// the references. As the other defects they can be recoverable or not recoverable. In case, of
65// a hardware related issue, it will be likely not recoverable, problems related with alignment
66// or calibration will be likely recoverable. Example of this defect can be found in Click for image.
67// (decrease in the number of Si Hits due to BCID problem in SCT).
68//
70
71
72#include "photonMonTool.h"
73#include "GaudiKernel/MsgStream.h"
74#include "GaudiKernel/StatusCode.h"
78#include "xAODEgamma/Photon.h"
81#include "TH1F.h"
82#include "TH2F.h"
83
84photonMonTool::photonMonTool(const std::string & type, const std::string & name, const IInterface* parent)
85 : egammaMonToolBase(type,name,parent)
86{
87 m_CbTightPhotons = new photonHist(std::string("CbTight"));
88 m_CbLoosePhotons = new photonHist(std::string("CbLoose"));
89
90 m_currentLB = -1;
91}
92
99
101{
103 ATH_CHECK( m_PhotonContainer.initialize() );
104 return StatusCode::SUCCESS;
105}
106
108{
109
110 ATH_MSG_DEBUG("photonMonTool::bookHistogramsForOnePhoton()");
111
112 int start = 0;
113 int end = ENDCAP;
114
115 // MAIN PANEL
116 bookTH1F(myHist.m_hN, *m_photonGroup, "photonN", "Number of photons", 20, 0.0, 20.0, myHist.m_nameOfEgammaType);
117 bookTH1F(myHist.m_hEt, *m_photonGroup, "photonEt", "Photon transverse energy [MeV]", 100, -1000.0, 250000.0, myHist.m_nameOfEgammaType);
118 bookTH2F(myHist.m_hEtaPhi4GeV, *m_photonGroup, "photonEtaPhiPtgt4GeV", "Photon #eta,#phi map (candidates with Pt>4 GeV)", 64, -3.2, 3.2, 64, -3.2, 3.2, myHist.m_nameOfEgammaType);
119 bookTH1F(myHist.m_hEta, *m_photonGroup, "photonEta", "Photon #eta", 64, -3.2, 3.2, myHist.m_nameOfEgammaType);
120 bookTH1F(myHist.m_hPhi, *m_photonGroup, "photonPhi", "Photon #phi", 64, -3.2, 3.2, myHist.m_nameOfEgammaType);
121 bookTH1F(myHist.m_hTopoEtCone40, *m_photonGroup, "photonTopoEtCone40", "Photon Topocluster Isolation Energy", 64, -10000., 40000., myHist.m_nameOfEgammaType);
122 bookTH1F(myHist.m_hPtCone20, *m_photonGroup, "photonPtCone20", "Photon Track Isolation Energy", 64, -10000., 40000., myHist.m_nameOfEgammaType);
123 bookTH1F(myHist.m_hTime, *m_photonGroup, "photonTime", "Time associated with photon cluster [ns]", 90, -30., 60., myHist.m_nameOfEgammaType);
124
125 // EXPERT PANEL
126 bookTH2F(myHist.m_hEtaPhi, *m_photonGroup, "photonEtaPhiPt2.5GeV", "Photon #eta,#phi map (candidates with Pt>2.5 GeV)", 64, -3.2, 3.2, 64, -3.2, 3.2, myHist.m_nameOfEgammaType);
127 bookTH2F(myHist.m_hEtaPhi20GeV, *m_photonGroup, "photonEtaPhiPtgt20GeV", "Photon #eta,#phi map (candidates with Pt>20 GeV)", 64, -3.2, 3.2, 64, -3.2, 3.2, myHist.m_nameOfEgammaType);
128
129 // RConv
130 bookTH1F(myHist.m_hRConv, *m_photonGroup, "photonRconv", "RConv of photon [mm]", 100, 0., 800., myHist.m_nameOfEgammaType);
131
132 // REGION PANEL
133 bookTH1FperRegion(myHist.m_hvN, *m_photonRegionGroup, "photonN", "Photon number ; Nel ; Nevents",20, 0.0, 20.0,start,end, myHist.m_nameOfEgammaType);
134 bookTH1FperRegion(myHist.m_hvEta, *m_photonRegionGroup, "photonEta", "Photon #eta distribution ; #eta ; Nevents",64, -3.2, 3.2,start,end, myHist.m_nameOfEgammaType);
135 bookTH1FperRegion(myHist.m_hvPhi, *m_photonRegionGroup, "photonPhi", "Photon #phi distribution ; #phi ; Nevents", 64, -3.2, 3.2,start,end, myHist.m_nameOfEgammaType);
136 bookTH1FperRegion(myHist.m_hvEt, *m_photonRegionGroup, "photonEt", "Photon Et distribution ; Et [MeV] ; Nevents", 100, -1000.0, 250000.0,start,end, myHist.m_nameOfEgammaType);
137 bookTH1FperRegion(myHist.m_hvTopoEtCone40, *m_photonRegionGroup, "photonTopoEtCone40", "Photon Isolation Energy TopoEtCone40 [MeV] ; Eiso ; Nevents", 64, -10000., 40000.,start,end, myHist.m_nameOfEgammaType);
138 bookTH1FperRegion(myHist.m_hvPtCone20, *m_photonRegionGroup, "photonPtCone20", "Photon PtCone20 distribution ; PtCone20 ; Nevents", 64, -10000., 40000.,start,end, myHist.m_nameOfEgammaType);
139 bookTH1FperRegion(myHist.m_hvTime, *m_photonRegionGroup, "photonTime", "Photon time [ns] ; Time [ns] ; Nevents", 90, -30.0, 60.0,start,end, myHist.m_nameOfEgammaType);
140 bookTH1FperRegion(myHist.m_hvConvType, *m_photonRegionGroup, "photonConvType", "Photon conv type; Nevents", 4,0,4,start,end, myHist.m_nameOfEgammaType);
141 bookTH1FperRegion(myHist.m_hvConvTrkMatch1, *m_photonRegionGroup, "photonConvTrkMatch1", "Photon ConvTrkMatch1; Nevents", 4,0,4,start,end, myHist.m_nameOfEgammaType);
142 bookTH1FperRegion(myHist.m_hvConvTrkMatch2, *m_photonRegionGroup, "photonConvTrkMatch2", "Photon ConvTrkMatch2; Nevents", 4,0,4,start,end, myHist.m_nameOfEgammaType);
143
144 // UNCONV PANEL
145 bookTH1F(myHist.m_hNUnconv, *m_photonUnconvGroup, "photonNUnconv", "Number of Unconverted photons", 20, 0.0, 20.0, myHist.m_nameOfEgammaType);
146 bookTH1F(myHist.m_hEtUnconv, *m_photonUnconvGroup, "photonEtUnconv", "Unconverted photon transverse energy [MeV]", 100, -1000.0, 250000.0, myHist.m_nameOfEgammaType);
147 bookTH2F(myHist.m_hEtaPhiUnconv, *m_photonUnconvGroup, "photonEtaPhiUnconv", "Unconverted photon #eta,#phi map", 64, -3.2, 3.2, 64, -3.2, 3.2, myHist.m_nameOfEgammaType);
148 bookTH1F(myHist.m_hEtaUnconv, *m_photonUnconvGroup, "photonEtaUnconv", "Unconverted photon #eta", 64, -3.2, 3.2, myHist.m_nameOfEgammaType);
149 bookTH1F(myHist.m_hPhiUnconv, *m_photonUnconvGroup, "photonPhiUnconv", "Unconverted photon #phi", 64, -3.2, 3.2, myHist.m_nameOfEgammaType);
150 bookTH1F(myHist.m_hTopoEtCone40Unconv, *m_photonUnconvGroup, "photonTopoEtCone40Unconv", "Unconverted photon Topocluster Isolation Energy", 64, -10000., 40000., myHist.m_nameOfEgammaType);
151 bookTH1F(myHist.m_hPtCone20Unconv, *m_photonUnconvGroup, "photonPtCone20Unconv", "Unconverted photon Topocluster Isolation Energy", 64, -10000., 40000., myHist.m_nameOfEgammaType);
152
153 // CONV PANEL
154 bookTH1F(myHist.m_hNConv, *m_photonConvGroup, "photonNConv", "Number of Converted photons", 20, 0.0, 20.0, myHist.m_nameOfEgammaType);
155 bookTH1F(myHist.m_hEtConv, *m_photonConvGroup, "photonEtConv", "Converted photon transverse energy [MeV]", 100, -1000.0, 250000.0, myHist.m_nameOfEgammaType);
156 bookTH2F(myHist.m_hEtaPhiConv, *m_photonConvGroup, "photonEtaPhiConv", "Converted photon #eta,#phi map", 64, -3.2, 3.2, 64, -3.2, 3.2, myHist.m_nameOfEgammaType);
157 bookTH1F(myHist.m_hEtaConv, *m_photonConvGroup, "photonEtaConv", "Converted photon #eta", 64, -3.2, 3.2, myHist.m_nameOfEgammaType);
158 bookTH1F(myHist.m_hPhiConv, *m_photonConvGroup, "photonPhiConv", "Converted photon #phi", 64, -3.2, 3.2, myHist.m_nameOfEgammaType);
159 bookTH1F(myHist.m_hTopoEtCone40Conv, *m_photonConvGroup, "photonTopoEtCone40Conv", "Converted photon Topocluster Isolation Energy", 64, -10000., 40000., myHist.m_nameOfEgammaType);
160 bookTH1F(myHist.m_hPtCone20Conv, *m_photonConvGroup, "photonPtCone20Conv", "Converted photon Topocluster Isolation Energy", 64, -10000., 40000., myHist.m_nameOfEgammaType);
161
162 // ID PANEL
163 bookTH1FperRegion(myHist.m_hvEhad1, *m_photonIdGroup, "photonEhad1", "Photon energy leakage in 1st hadronic sampling ; Ehad 1; Nevents", 50, -1000., 10000.,start,end, myHist.m_nameOfEgammaType);
164 bookTH1FperRegion(myHist.m_hvCoreEM, *m_photonIdGroup, "photonCoreEM", "Photon core energy in EM calorimeter ;E [MeV]; Nevents", 50, -5000., 250000.,start,end, myHist.m_nameOfEgammaType);
165 bookTH1FperRegion(myHist.m_hvF0, *m_photonIdGroup, "photonF0", "Photon fractional energy in PreSampler ; F0 ; Nevents", 50, -0.2,1.0,start,end, myHist.m_nameOfEgammaType);
166 bookTH1FperRegion(myHist.m_hvF1, *m_photonIdGroup, "photonF1", "Photon fractional energy in 1st sampling ; F1 ; Nevents", 50, -0.2,1.0,start,end, myHist.m_nameOfEgammaType);
167 bookTH1FperRegion(myHist.m_hvF2, *m_photonIdGroup,"photonF2", "Photon fractional energy in 2nd sampling ; F2 ; Nevents", 50, -0.2,1.0,start,end, myHist.m_nameOfEgammaType);
168 bookTH1FperRegion(myHist.m_hvF3, *m_photonIdGroup, "photonF3", "Photon fractional energy in 3rd sampling ; F3 ; Nevents", 50, -0.2,1.0,start,end, myHist.m_nameOfEgammaType);
169 bookTH1FperRegion(myHist.m_hvRe233e237, *m_photonIdGroup, "photonRe233e237", "Photon uncor. energy fraction in 3x3/3x7 cells in em sampling 2 ;R 3x3/3x7; Nevents", 50, 0., 2.,start,end, myHist.m_nameOfEgammaType);
170 bookTH1FperRegion(myHist.m_hvRe237e277, *m_photonIdGroup, "photonRe237e277", "Photon uncor. energy fraction in 3x7/7x7 cells in em sampling 2 ;R 3x7/7x7; Nevents", 50, 0., 2.,start,end, myHist.m_nameOfEgammaType);
171
172 // LUMIBLOCK DEPENDANT PANEL
173 bookTH1F(myHist.m_hLB_N, *m_photonLBGroup, "LBEvoNPhotons", "Number of Photons vs LB", 2000, -0.5, 1999.5, myHist.m_nameOfEgammaType);
174 bookTH1F(myHist.m_hLB_NUnconv, *m_photonLBGroup, "LBEvoNPhotonsUnconv", "Number of Unconverted Photons vs LB", 2000, -0.5, 1999.5, myHist.m_nameOfEgammaType);
175 bookTH1F(myHist.m_hLB_NConv, *m_photonLBGroup, "LBEvoNPhotonsConv", "Number of Converted Photons vs LB", 2000, -0.5, 1999.5, myHist.m_nameOfEgammaType);
176 bookTH1F(myHist.m_hLB_fConv, *m_photonLBGroup, "LBEvoConvOverN", "Fraction of converted photons vs LB",2000, -0.5,1999.5, myHist.m_nameOfEgammaType);
177
178 return StatusCode::SUCCESS;
179}
180
182{
183 ATH_MSG_DEBUG("photonMonTool::bookHistograms()");
184 // Create groups
185 m_photonGroup = new MonGroup(this,"egamma/photons"+m_GroupExtension, run); // to be re-booked every new run
186 // Create sub groups
187 m_photonUnconvGroup = new MonGroup(this,"egamma/photons"+m_GroupExtension+"/Unconv", run); // to be re-booked every new run
188 m_photonConvGroup = new MonGroup(this,"egamma/photons"+m_GroupExtension+"/Conv", run); // to be re-booked every new run
189 m_photonIdGroup = new MonGroup(this,"egamma/photons"+m_GroupExtension+"/ID", run); // to be re-booked every new run
190 m_photonRegionGroup = new MonGroup(this,"egamma/photons"+m_GroupExtension+"/Region", run); // to be re-booked every new run
191 m_photonLBGroup = new MonGroup(this,"egamma/photons"+m_GroupExtension+"/LBMon",run, ATTRIB_X_VS_LB, "", "merge"); // to be re-booked every new run
192
195
196 return StatusCode::SUCCESS;
197}
198
200
201 ATH_MSG_DEBUG("photonMonTool::fillHistogramsforOnePhoton()");
202
203 float et=(*g_iter)->pt();
204 float eta = (*g_iter)->eta();
205 float phi = (*g_iter)->phi();
206 int ir = GetRegion(eta);
207
208 //ATH_MSG_DEBUG("photon et, eta and phi " << et << " " << eta << " " << phi << " region " << ir << " defined " << myHist.m_hvEt.size());
209
210 if (et<2500) return StatusCode::SUCCESS;
211
212 ++myHist.m_nPhotonsPerRegion[ir];
213 ++myHist.m_nPhotons;
214 ++myHist.m_nPhotonsInCurrentLB;
215
216 // Get conversion type
217 // Unconverted photons
218 // unconverted = 0 : unconverted photon
219 // single track conversion :
220 // singleSi = 1 : one track only, with Si hits
221 // singleTRT = 2 : one track only, no Si hits (TRT only)
222 // double track conversions
223 // doubleSi = 3 : two tracks, both with Si hits
224 // doubleTRT = 4 : two tracks, none with Si hits (TRT only)
225 // doubleSiTRT = 5 : two tracks, only one with Si hits
227 fillTH1FperRegion(myHist.m_hvConvType,ir,convType);
228 bool isUnconverted = (convType==xAOD::EgammaParameters::ConversionType::unconverted ? 1 : 0) ;
229
230 Float_t RadiusConv = 0.0;
231 RadiusConv = xAOD::EgammaHelpers::conversionRadius(*g_iter);
232
233 if(myHist.m_hRConv) myHist.m_hRConv->Fill(RadiusConv);
234
235 // Fill histograms for photons regardless convertions
236
237 if(myHist.m_hEt) myHist.m_hEt->Fill(et);
238 if(myHist.m_hEtaPhi) myHist.m_hEtaPhi->Fill(eta,phi);
239 if(myHist.m_hEtaPhi4GeV&&et>4000) myHist.m_hEtaPhi4GeV->Fill(eta,phi);
240 if(myHist.m_hEtaPhi20GeV&&et>20000) myHist.m_hEtaPhi20GeV->Fill(eta,phi);
241 if(myHist.m_hEta) myHist.m_hEta->Fill(eta);
242 if(myHist.m_hPhi) myHist.m_hPhi->Fill(phi);
243
247
248 // Shower shape variable details
249 float ehad1 = 0.0;
250 float ecore = 0.0;
251 float f1 = 0.0;
252 float f3 = 0.0;
253 float e233 = 0.0;
254 float e237 = 0.0;
255 float e277 = 0.0;
256 if( (*g_iter)->showerShapeValue(ehad1, xAOD::EgammaParameters::ehad1) ) fillTH1FperRegion(myHist.m_hvEhad1,ir,ehad1);
257 if( (*g_iter)->showerShapeValue(ecore, xAOD::EgammaParameters::ecore) ) fillTH1FperRegion(myHist.m_hvCoreEM,ir,ecore);
258 if( (*g_iter)->showerShapeValue(f1, xAOD::EgammaParameters::f1) ) fillTH1FperRegion(myHist.m_hvF1,ir,f1);
259 if( (*g_iter)->showerShapeValue(f3, xAOD::EgammaParameters::f3) ) fillTH1FperRegion(myHist.m_hvF3,ir,f3);
260 if( (*g_iter)->showerShapeValue(e237, xAOD::EgammaParameters::e237) ) {
261 float Re233e237 = 0.0;
262 if( e237!=0 && (*g_iter)->showerShapeValue(e233, xAOD::EgammaParameters::e233) ) Re233e237 = e233 / e237;
263 fillTH1FperRegion(myHist.m_hvRe233e237,ir,Re233e237);
264 float Re237e277 = 0.0;
265 if( e237!=0 && (*g_iter)->showerShapeValue(e277, xAOD::EgammaParameters::e277) ) {
266 if(e277!=0) Re237e277 = e237 / e277;
267 }
268 fillTH1FperRegion(myHist.m_hvRe237e277,ir,Re237e277);
269 }
270
271 // Associated cluster details
272 const xAOD::CaloCluster *aCluster = (*g_iter)->caloCluster();
273 if (aCluster) {
274 double ec = aCluster->et()*cosh(aCluster->eta());
275
276 float f0=0.0;
277 if (ec!=0) f0 = aCluster->energyBE(0)/ec;
278 fillTH1FperRegion(myHist.m_hvF0,ir,f0);
279 float f1=0.0;
280 if (ec!=0) f1 = aCluster->energyBE(1)/ec;
281 fillTH1FperRegion(myHist.m_hvF1,ir,f1);
282 float f2 = 0.0;
283 if(ec!=0) f2 = aCluster->energyBE(2)/ec;
284 fillTH1FperRegion(myHist.m_hvF2,ir,f2);
285 float f3=0.0;
286 if (ec!=0) f3 = aCluster->energyBE(3)/ec;
287 fillTH1FperRegion(myHist.m_hvF3,ir,f3);
288
289 float time= aCluster->time();
290 myHist.m_hTime->Fill(time);
291
292 } else ATH_MSG_WARNING( "Can't get CaloCluster" );
293
294 float deltaPhi1 = 0.0;
295 if( (*g_iter)->vertexCaloMatchValue(deltaPhi1, xAOD::EgammaParameters::convMatchDeltaPhi1) ) {
296 fillTH1FperRegion(myHist.m_hvConvTrkMatch1,ir,deltaPhi1);
297 }
298 float deltaPhi2 = 0.0;
299 if( (*g_iter)->vertexCaloMatchValue(deltaPhi2, xAOD::EgammaParameters::convMatchDeltaPhi2) ) {
300 fillTH1FperRegion(myHist.m_hvConvTrkMatch2,ir,deltaPhi2);
301 }
302
303 // Isolation Energy
304 float topoetcone40 = 0.0;
305 if ( (*g_iter)->isolationValue(topoetcone40,xAOD::Iso::topoetcone40) ) {
306 myHist.m_hTopoEtCone40->Fill(topoetcone40);
307 }
308
309 float ptcone20 = 0.0;
310 if ( (*g_iter)->isolationValue(ptcone20,xAOD::Iso::ptcone20) ) {
311 myHist.m_hPtCone20->Fill(ptcone20);
312 }
313
314 fillTH1FperRegion(myHist.m_hvTopoEtCone40,ir,topoetcone40);
315 fillTH1FperRegion(myHist.m_hvPtCone20,ir,ptcone20);
316
317 // Fill Unconverted or Converted specific histograms :
318
319 myHist.m_hLB_N->Fill(m_currentLB);
320
321 if (isUnconverted) {
322
323 myHist.m_hLB_NUnconv->Fill(m_currentLB);
324
325 ++myHist.m_nPhotonsPerRegionUnconv[ir];
326 ++myHist.m_nPhotonsUnconv;
328
329 if(myHist.m_hEtUnconv) myHist.m_hEtUnconv->Fill(et);
330 if(myHist.m_hEtaPhiUnconv) myHist.m_hEtaPhiUnconv->Fill(eta,phi);
331 if(myHist.m_hEtaUnconv) myHist.m_hEtaUnconv->Fill(eta);
332 if(myHist.m_hPhiUnconv) myHist.m_hPhiUnconv->Fill(phi);
333
334 // fillTH1FperRegion(myHist.m_hvEtUnconv,ir,et);
335 // fillTH1FperRegion(myHist.m_hvEtaUnconv,ir,eta);
336 // fillTH1FperRegion(myHist.m_hvPhiUnconv,ir,phi);
337
338 // // Shower shape variable details
339 // fillTH1FperRegion(myHist.m_hvEhad1Unconv,ir,ehad1);
340 // fillTH1FperRegion(myHist.m_hvCoreEMUnconv,ir,ecore);
341 // fillTH1FperRegion(myHist.m_hvF1Unconv,ir,f1);
342 // fillTH1FperRegion(myHist.m_hvF3Unconv,ir,f3);
343 // fillTH1FperRegion(myHist.m_hvRe233e237Unconv,ir,Re233e237);
344 // fillTH1FperRegion(myHist.m_hvRe237e277Unconv,ir,Re237e277);
345
346 // // Associated cluster details
347 // fillTH1FperRegion(myHist.m_hvF2Unconv,ir,f2);
348 // if (myHist.m_hTimeUnconv) myHist.m_hTimeUnconv->Fill(time);
349 // fillTH1FperRegion(myHist.m_hvTimeUnconv,ir,time);
350
351 // Isolation Energy
352 if (myHist.m_hTopoEtCone40Unconv) myHist.m_hTopoEtCone40Unconv->Fill(topoetcone40);
353 if (myHist.m_hPtCone20Unconv) myHist.m_hPtCone20Unconv->Fill(ptcone20);
354 fillTH1FperRegion(myHist.m_hvTopoEtCone40Unconv,ir,topoetcone40);
355 fillTH1FperRegion(myHist.m_hvPtCone20Unconv,ir,ptcone20);
356
357 } else {
358 // if Converted photon
359
360 myHist.m_hLB_NConv->Fill(m_currentLB);
361
362 ++myHist.m_nPhotonsPerRegionConv[ir];
363 ++myHist.m_nPhotonsConv;
365
366 if(myHist.m_hEtConv) myHist.m_hEtConv->Fill(et);
367 if(myHist.m_hEtaPhiConv) myHist.m_hEtaPhiConv->Fill(eta,phi);
368 if(myHist.m_hEtaConv) myHist.m_hEtaConv->Fill(eta);
369 if(myHist.m_hPhiConv) myHist.m_hPhiConv->Fill(phi);
370
371 // fillTH1FperRegion(myHist.m_hvEtConv,ir,et);
372 // fillTH1FperRegion(myHist.m_hvEtaConv,ir,eta);
373 // fillTH1FperRegion(myHist.m_hvPhiConv,ir,phi);
374
375 // // Shower shape variable details
376 // fillTH1FperRegion(myHist.m_hvEhad1Conv,ir,ehad1);
377 // fillTH1FperRegion(myHist.m_hvCoreEMConv,ir,ecore);
378 // fillTH1FperRegion(myHist.m_hvF1Conv,ir,f1);
379 // fillTH1FperRegion(myHist.m_hvF3Conv,ir,f3);
380 // fillTH1FperRegion(myHist.m_hvRe233e237Conv,ir,Re233e237);
381 // fillTH1FperRegion(myHist.m_hvRe237e277Conv,ir,Re237e277);
382
383 // // Associated cluster details
384 // fillTH1FperRegion(myHist.m_hvF2Conv,ir,f2);
385 // if (myHist.m_hTimeConv) myHist.m_hTimeConv->Fill(time);
386 // fillTH1FperRegion(myHist.m_hvTimeConv,ir,time);
387
388 // // Conversion Trk match
389 fillTH1FperRegion(myHist.m_hvConvTrkMatch1,ir,deltaPhi1);
390 fillTH1FperRegion(myHist.m_hvConvTrkMatch2,ir,deltaPhi2);
391
392 // Isolation Energy
393 if (myHist.m_hTopoEtCone40Conv) myHist.m_hTopoEtCone40Conv->Fill(topoetcone40);
394 if (myHist.m_hPtCone20Conv) myHist.m_hPtCone20Conv->Fill(ptcone20);
395 fillTH1FperRegion(myHist.m_hvTopoEtCone40Conv,ir,topoetcone40);
396 fillTH1FperRegion(myHist.m_hvPtCone20Conv,ir,ptcone20);
397 }
398
399 return StatusCode::SUCCESS;
400}
401
402
404 ATH_MSG_DEBUG("photonMonTool::fillHistograms()");
405
406 if (!hasGoodTrigger("single photon")) return StatusCode::SUCCESS;
407
408 const EventContext& ctx = Gaudi::Hive::currentContext();
409
410 //check whether Lar signalled event bad
411 if(hasBadLar(ctx)) {
412 ATH_MSG_DEBUG("photonMonTool::hasBadLar()");
413 return StatusCode::SUCCESS;
414 }
415
416 //--------------------
417 //figure out current LB
418 //--------------------
419 unsigned int previousLB = m_currentLB;
421
422 //deal with the change of LB
423 if (m_currentLB>previousLB) {
424 // update the by LB variables
425
426 m_CbLoosePhotons->m_nPhotonsPerLumiBlock.push_back(m_CbLoosePhotons->m_nPhotonsInCurrentLB);
427 m_CbLoosePhotons->m_nPhotonsPerLumiBlockUnconv.push_back(m_CbLoosePhotons->m_nPhotonsInCurrentLBUnconv);
428 m_CbLoosePhotons->m_nPhotonsPerLumiBlockConv.push_back(m_CbLoosePhotons->m_nPhotonsInCurrentLBConv);
429
430 m_CbTightPhotons->m_nPhotonsPerLumiBlock.push_back(m_CbTightPhotons->m_nPhotonsInCurrentLB);
431 m_CbTightPhotons->m_nPhotonsPerLumiBlockUnconv.push_back(m_CbTightPhotons->m_nPhotonsInCurrentLBUnconv);
432 m_CbTightPhotons->m_nPhotonsPerLumiBlockConv.push_back(m_CbTightPhotons->m_nPhotonsInCurrentLBConv);
433
434 // update content for the last lumi block
435
436 // update the by LB variables
437
438 double NConvPhotons = m_CbLoosePhotons->m_nPhotonsInCurrentLBConv;
439 double NPhotons = m_CbLoosePhotons->m_nPhotonsInCurrentLB;
440 double fractionConv = 0.;
441 if (NPhotons>0) fractionConv = NConvPhotons/NPhotons;
442
443 //ATH_MSG_WARNING( "CommentBL fractionConv= " << fractionConv );
444
445 m_CbLoosePhotons->m_hLB_fConv->Fill(m_currentLB, fractionConv);
446
447 NConvPhotons = m_CbTightPhotons->m_nPhotonsInCurrentLBConv;
448 NPhotons = m_CbTightPhotons->m_nPhotonsInCurrentLB;
449 fractionConv = 0.;
450 if (NPhotons>0) fractionConv = NConvPhotons/NPhotons;
451 m_CbTightPhotons->m_hLB_fConv->Fill(m_currentLB, fractionConv);
452
453 // Reset counters
454 m_CbLoosePhotons->m_nPhotonsInCurrentLB=0;
455 m_CbLoosePhotons->m_nPhotonsInCurrentLBUnconv=0;
456 m_CbLoosePhotons->m_nPhotonsInCurrentLBConv=0;
457
458 m_CbTightPhotons->m_nPhotonsInCurrentLB=0;
459 m_CbTightPhotons->m_nPhotonsInCurrentLBUnconv=0;
460 m_CbTightPhotons->m_nPhotonsInCurrentLBConv=0;
461 }
462
463 // Get photon container
465 ATH_CHECK(photon_container.isValid());
466
467 // Check that the auxiliary store association was made successfully:
468 if( ! photon_container->hasStore() ) {
469 ATH_MSG_DEBUG("No auxiliary store got associated to the photon container with key: " << m_PhotonContainer);
470 return StatusCode::FAILURE;
471 }
472
473 // Loop on photon container
474
475 xAOD::PhotonContainer::const_iterator ph_iter = photon_container->begin();
476 xAOD::PhotonContainer::const_iterator ph_end = photon_container->end();
477 ATH_MSG_DEBUG("Number of photons: " << photon_container->size());
478
479 m_CbLoosePhotons->m_nPhotons = 0;
480 m_CbLoosePhotons->m_nPhotonsUnconv = 0;
481 m_CbLoosePhotons->m_nPhotonsConv = 0;
482
483 m_CbTightPhotons->m_nPhotons = 0;
484 m_CbTightPhotons->m_nPhotonsUnconv = 0;
485 m_CbTightPhotons->m_nPhotonsConv = 0;
486
487 m_CbLoosePhotons->m_nPhotonsPerRegion.resize(NREGION,0);
488 m_CbLoosePhotons->m_nPhotonsPerRegionUnconv.resize(NREGION,0);
489 m_CbLoosePhotons->m_nPhotonsPerRegionConv.resize(NREGION,0);
490
491 m_CbTightPhotons->m_nPhotonsPerRegion.resize(NREGION,0);
492 m_CbTightPhotons->m_nPhotonsPerRegionUnconv.resize(NREGION,0);
493 m_CbTightPhotons->m_nPhotonsPerRegionConv.resize(NREGION,0);
494
495 for (; ph_iter!=ph_end; ++ph_iter){
496 if(!(*ph_iter)) continue;
497
498 // Necessary because some photons in the container have another author because reconstructed from topocluster
499 if (!((*ph_iter)->author(xAOD::EgammaParameters::AuthorPhoton)|| (*ph_iter)->author(xAOD::EgammaParameters::AuthorAmbiguous))) continue;
500
501 //reject photons outside the kinematic acceptance
502 if ((*ph_iter)->pt()<= 7000. && std::abs((*ph_iter)->eta()) >= 2.47 ) continue;
503
504 // Check what photon is being processed
505 bool isGood;
506 // CbLoose
507 if((*ph_iter)->passSelection(isGood,"Loose")) {
508 if(isGood) {
510 }
511 } else ATH_MSG_WARNING( "Photon selection menu LHMedium is not defined" );
512
513 // Cb Tight
514 if((*ph_iter)->passSelection(isGood,"Tight")) {
515 if(isGood) {
517 }
518 } else ATH_MSG_WARNING( "Photon selection menu LHTight is not defined" );
519
520 }
521
522 // Fill number of photons histograms
523 m_CbLoosePhotons->m_hN->Fill(m_CbLoosePhotons->m_nPhotons);
524 m_CbLoosePhotons->m_hNUnconv->Fill(m_CbLoosePhotons->m_nPhotonsUnconv);
525 m_CbLoosePhotons->m_hNConv->Fill(m_CbLoosePhotons->m_nPhotonsConv);
526
527 m_CbTightPhotons->m_hN->Fill(m_CbTightPhotons->m_nPhotons);
528 m_CbTightPhotons->m_hNUnconv->Fill(m_CbTightPhotons->m_nPhotonsUnconv);
529 m_CbTightPhotons->m_hNConv->Fill(m_CbTightPhotons->m_nPhotonsConv);
530
531 for(int i=0;i<NREGION;i++) {
534 }
535
536 return StatusCode::SUCCESS;
537}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
A container of information describing a monitoring object.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
virtual StatusCode initialize() override
std::string m_GroupExtension
void bookTH1FperRegion(std::vector< TH1 * > &vhist, MonGroup &mygroup, const std::string &hname, const std::string &htitle, int nbins, float low, float high, unsigned int min_region, unsigned int max_region)
unsigned int getCurrentLB(const EventContext &ctx)
bool hasBadLar(const EventContext &ctx)
bool hasGoodTrigger(const std::string &comment)
void bookTH2F(TH2 *&h, MonGroup &mygroup, const std::string &hname, const std::string &htitle, int nbinsx, float xlow, float xhigh, int nbinsy, float ylow, float yhigh)
egammaMonToolBase(const std::string &type, const std::string &name, const IInterface *parent)
static void fillTH1FperRegion(std::vector< TH1 * > &vhist, unsigned int ir, float x)
static int GetRegion(float eta)
void bookTH1F(TH1 *&h, MonGroup &mygroup, const std::string &hname, const std::string &htitle, int nbins, float low, float high)
MonGroup * m_photonRegionGroup
virtual StatusCode fillHistograms() override
An inheriting class should either override this function or fillHists().
SG::ReadHandleKey< xAOD::PhotonContainer > m_PhotonContainer
MonGroup * m_photonUnconvGroup
photonHist * m_CbTightPhotons
virtual StatusCode bookHistogramsForOnePhotonType(photonHist &myHist)
MonGroup * m_photonConvGroup
photonMonTool(const std::string &type, const std::string &name, const IInterface *parent)
virtual ~photonMonTool()
virtual StatusCode bookHistograms() override
An inheriting class should either override this function or bookHists().
MonGroup * m_photonLBGroup
MonGroup * m_photonGroup
MonGroup * m_photonIdGroup
virtual StatusCode initialize() override
virtual StatusCode fillHistogramsForOnePhoton(xAOD::PhotonContainer::const_iterator g_iter, photonHist &myHist)
photonHist * m_CbLoosePhotons
flt_t time() const
Access cluster time.
virtual double eta() const
The pseudorapidity ( ) of the particle.
float energyBE(const unsigned layer) const
Get the energy in one layer of the EM Calo.
int ir
counter of the current depth
Definition fastadd.cxx:49
Definition run.py:1
xAOD::EgammaParameters::ConversionType conversionType(const xAOD::Photon *ph)
return the photon conversion type (see EgammaEnums)
float conversionRadius(const xAOD::Vertex *vx)
return the conversion radius or 9999.
const uint16_t AuthorPhoton
Object Reconstructed by standard cluster-based algorithm.
Definition EgammaDefs.h:28
@ convMatchDeltaPhi1
difference between the cluster phi and the phi of the first track of the vertex extrapolated to the s...
@ convMatchDeltaPhi2
difference between the cluster phi and the phi of the second track of the vertex extrapolated to the ...
@ unconverted
unconverted photon
const uint16_t AuthorAmbiguous
Object Reconstructed by standard cluster-based algorithm.
Definition EgammaDefs.h:32
@ e277
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 7x7
Definition EgammaEnums.h:81
@ e237
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 3x7
Definition EgammaEnums.h:78
@ f3
fraction of energy reconstructed in 3rd sampling
Definition EgammaEnums.h:55
@ ecore
core energy in em calo E(core) = E0(3x3) + E1(15x2) + E2(5x5) + E3(3x5)
@ f1
E1/E = fraction of energy reconstructed in the first sampling, where E1 is energy in all strips belon...
Definition EgammaEnums.h:53
@ ehad1
E leakage into 1st sampling of had calo (CaloSampling::HEC0 + CaloSampling::TileBar0 + CaloSampling::...
Definition EgammaEnums.h:49
@ e233
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 3x3 (in cell units e...
Definition EgammaEnums.h:69
@ ptcone20
Track isolation.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
std::vector< TH1 * > m_hvTopoEtCone40
std::vector< TH1 * > m_hvF2
std::vector< TH1 * > m_hvEt
std::vector< TH1 * > m_hvCoreEM
std::vector< TH1 * > m_hvN
std::vector< TH1 * > m_hvRe233e237
std::string m_nameOfEgammaType
std::vector< TH1 * > m_hvF3
std::vector< TH1 * > m_hvEta
std::vector< TH1 * > m_hvRe237e277
std::vector< TH1 * > m_hvF1
std::vector< TH1 * > m_hvF0
std::vector< TH1 * > m_hvEhad1
std::vector< TH1 * > m_hvPtCone20
std::vector< TH1 * > m_hvTime
std::vector< TH1 * > m_hvPhi
Extra patterns decribing particle interation process.
unsigned int m_nPhotonsInCurrentLBUnconv
TH1 * m_hLB_fConv
TH1 * m_hEtConv
unsigned int m_nPhotonsInCurrentLB
unsigned int m_nPhotonsInCurrentLBConv
unsigned int m_nPhotonsConv
std::vector< int > m_nPhotonsPerRegion
TH1 * m_hEtUnconv
TH1 * m_hPhiConv
std::vector< TH1 * > m_hvTopoEtCone40Conv
TH1 * m_hTopoEtCone40Conv
std::vector< TH1 * > m_hvTopoEtCone40Unconv
TH1 * m_hPhiUnconv
TH1 * m_hEtaUnconv
TH1 * m_hPtCone20Conv
std::vector< int > m_nPhotonsPerRegionUnconv
TH1 * m_hTopoEtCone40Unconv
TH2 * m_hEtaPhiConv
TH1 * m_hNUnconv
TH1 * m_hLB_NConv
unsigned int m_nPhotons
TH2 * m_hEtaPhiUnconv
std::vector< int > m_nPhotonsPerRegionConv
TH1 * m_hLB_NUnconv
std::vector< TH1 * > m_hvConvTrkMatch2
std::vector< TH1 * > m_hvPtCone20Conv
std::vector< TH1 * > m_hvPtCone20Unconv
unsigned int m_nPhotonsUnconv
TH1 * m_hEtaConv
std::vector< TH1 * > m_hvConvTrkMatch1
TH1 * m_hPtCone20Unconv
std::vector< TH1 * > m_hvConvType