ATLAS Offline Software
egammaMonitorPhotonAlgorithm.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 egammaMonitorPhotonAlgorithm::egammaMonitorPhotonAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ):
9  egammaMonitorBaseAlgorithm( name, pSvcLocator )
10 {}
11 
13 {
14  ATH_CHECK(m_photonsKey.initialize());
15  ATH_CHECK(m_isoKey.initialize());
16  m_baseName = Form("%s.",m_photonsKey.key().c_str());
17 
19  if (!m_monTool.empty()) CHECK(m_monTool.retrieve());
20 
21  return StatusCode::SUCCESS;
22 }
23 
24 StatusCode egammaMonitorPhotonAlgorithm::execute(const EventContext& ctx) const
25 {
28  return StatusCode::SUCCESS;
29 }
30 
31 
32 void egammaMonitorPhotonAlgorithm::filltopoPhotonShowerShapes( const EventContext& ctx) const{
33 
35  ATH_MSG_DEBUG("Fill SS Reco Photon distributions: ");
36 
37  std::vector<float> ethad_vec, ethad1_vec, Rhad_vec, Rhad1_vec, Reta_vec, Rphi_vec,e237_vec,e277_vec, weta1_vec, weta2_vec, wtots1_vec,
38  f1_vec, f3_vec, eratio_vec, et_vec, highet_vec , eta_vec, phi_vec;
39 
40  auto ethad_col = Monitored::Collection("ethad" , ethad_vec );
41  auto ethad1_col = Monitored::Collection("ethad1" , ethad1_vec );
42  auto Rhad_col = Monitored::Collection("Rhad" , Rhad_vec );
43  auto Rhad1_col = Monitored::Collection("Rhad1" , Rhad1_vec );
44  auto Reta_col = Monitored::Collection("Reta" , Reta_vec );
45  auto Rphi_col = Monitored::Collection("Rphi" , Rphi_vec );
46  auto e237_col = Monitored::Collection("e237" , e237_vec );
47  auto e277_col = Monitored::Collection("e277" , e277_vec );
48  auto weta1_col = Monitored::Collection("weta1" , weta1_vec );
49  auto weta2_col = Monitored::Collection("weta2" , weta2_vec );
50  auto wtots1_col = Monitored::Collection("wtots1" , wtots1_vec );
51  auto f1_col = Monitored::Collection("f1" , f1_vec );
52  auto f3_col = Monitored::Collection("f3" , f3_vec );
53  auto eratio_col = Monitored::Collection("eratio" , eratio_vec );
54  auto et_col = Monitored::Collection("et" , et_vec );
55  auto highet_col = Monitored::Collection("highet" , highet_vec );
56  auto eta_col = Monitored::Collection("eta" , eta_vec );
57  auto phi_col = Monitored::Collection("phi" , phi_vec );
58 
59  for ( const auto *const photon : *photons ){
60 
61  if(!photon) continue;
62 
63  Reta_vec.push_back( getShowerShape_Reta(photon));
64  Rphi_vec.push_back( getShowerShape_Rphi(photon));
65  e237_vec.push_back( getShowerShape_e237(photon));
66  e277_vec.push_back( getShowerShape_e277(photon));
67  ethad_vec.push_back( getShowerShape_ethad(photon)/Gaudi::Units::GeV);
68  ethad1_vec.push_back( getShowerShape_ethad1(photon)/Gaudi::Units::GeV);
69  Rhad_vec.push_back( getShowerShape_Rhad(photon));
70  Rhad1_vec.push_back( getShowerShape_Rhad(photon));
71  weta1_vec.push_back( getShowerShape_weta1(photon));
72  weta2_vec.push_back( getShowerShape_weta2(photon));
73  wtots1_vec.push_back( getShowerShape_wtots1(photon));
74  f1_vec.push_back( getShowerShape_f1(photon));
75  f3_vec.push_back( getShowerShape_f3(photon));
76  eratio_vec.push_back( getShowerShape_Eratio(photon));
77  et_vec.push_back( photon->pt()/Gaudi::Units::GeV);
78  highet_vec.push_back( photon->pt()/Gaudi::Units::GeV);
79  eta_vec.push_back( photon->eta());
80  phi_vec.push_back( photon->phi());
81  }
82 
83  auto mon = Monitored::Group(m_monTool,ethad_col, ethad1_col, Rhad_col, Rhad1_col, Reta_col, Rphi_col,e237_col,e277_col, weta1_col, weta2_col, wtots1_col,
84  f1_col, f3_col, eratio_col, et_col, highet_col , eta_col, phi_col);
85 }
86 
87 
88 // All pt(var)coneXX would need ReadDecorHandle, but they are not computed anyway ! Remove for the time being
89 void egammaMonitorPhotonAlgorithm::filltopoPhotonIsolation(const EventContext& ctx) const{
90 
92  std::vector<float> topoetcone20_vec, topoetcone40_shift_vec;
93  auto topoetcone20_col = Monitored::Collection("topoetcone20", topoetcone20_vec);
94  auto topoetcone40_shift_col = Monitored::Collection("topoetcone40_shift", topoetcone40_shift_vec);
95 
96  for (const auto& hk : m_isoKey) {
97  TString n = hk.key();
98  n.ReplaceAll(m_baseName,"");
100  for (const xAOD::Photon* ph : *photons){
101  ATH_MSG_DEBUG("From " << m_photonsKey.key() << " pt = " << ph->pt()/Gaudi::Units::GeV
102  << " eta = " << ph->eta() << " phi = " << ph->phi() << " for handler whose name is " << n);
103  if (!handle.isValid()) {
104  ATH_MSG_WARNING(hk << " is not valid");
105  } else {
106  ATH_MSG_DEBUG(hk << " is valid");
107  if (n == "topoetcone20")
108  topoetcone20_vec.push_back(handle(*ph)/Gaudi::Units::GeV);
109  else if (n == "topoetcone40")
110  topoetcone40_shift_vec.push_back(handle(*ph)/Gaudi::Units::GeV-2.45);
111  }
112  }
113  }
114  auto mon = Monitored::Group(m_monTool, topoetcone20_col, topoetcone40_shift_col);
115 
116  ATH_MSG_DEBUG("Photon - Isolation Online Monitoring in Reconstruction ...");
117 }
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
egammaMonitorPhotonAlgorithm::m_baseName
TString m_baseName
Definition: egammaMonitorPhotonAlgorithm.h:28
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
egammaMonitorPhotonAlgorithm::m_photonsKey
SG::ReadHandleKey< xAOD::PhotonContainer > m_photonsKey
Definition: egammaMonitorPhotonAlgorithm.h:29
Monitored::Collection
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Definition: MonitoredCollection.h:38
egammaMonitorPhotonAlgorithm::filltopoPhotonShowerShapes
void filltopoPhotonShowerShapes(const EventContext &ctx) const
Definition: egammaMonitorPhotonAlgorithm.cxx:32
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:94
beamspotman.n
n
Definition: beamspotman.py:731
egammaMonitorPhotonAlgorithm::egammaMonitorPhotonAlgorithm
egammaMonitorPhotonAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Definition: egammaMonitorPhotonAlgorithm.cxx:8
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
egammaMonitorPhotonAlgorithm::m_isoKey
SG::ReadDecorHandleKeyArray< xAOD::PhotonContainer > m_isoKey
Definition: egammaMonitorPhotonAlgorithm.h:30
egammaMonitorPhotonAlgorithm.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
egammaMonitorBaseAlgorithm::initialize
virtual StatusCode initialize() override
Definition: egammaMonitorBaseAlgorithm.cxx:16
egammaMonitorPhotonAlgorithm::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: egammaMonitorPhotonAlgorithm.h:31
egammaMonitorPhotonAlgorithm::initialize
virtual StatusCode initialize() override
Definition: egammaMonitorPhotonAlgorithm.cxx:12
egammaMonitorBaseAlgorithm
Definition: egammaMonitorBaseAlgorithm.h:24
egammaMonitorPhotonAlgorithm::filltopoPhotonIsolation
void filltopoPhotonIsolation(const EventContext &ctx) const
Definition: egammaMonitorPhotonAlgorithm.cxx:89
xAOD::photon
@ photon
Definition: TrackingPrimitives.h:199
xAOD::Photon_v1
Definition: Photon_v1.h:37
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
plotBeamSpotMon.mon
mon
Definition: plotBeamSpotMon.py:67
egammaMonitorPhotonAlgorithm::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: egammaMonitorPhotonAlgorithm.cxx:24
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30