ATLAS Offline Software
Loading...
Searching...
No Matches
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
8egammaMonitorPhotonAlgorithm::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
24StatusCode egammaMonitorPhotonAlgorithm::execute(const EventContext& ctx) const
25{
28 return StatusCode::SUCCESS;
29}
30
31
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
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
Group of local monitoring quantities and retain correlation when filling histograms
Handle class for reading a decoration on an object.
egammaMonitorBaseAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize() override
void filltopoPhotonIsolation(const EventContext &ctx) const
ToolHandle< GenericMonitoringTool > m_monTool
egammaMonitorPhotonAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadHandleKey< xAOD::PhotonContainer > m_photonsKey
virtual StatusCode execute(const EventContext &ctx) const override
void filltopoPhotonShowerShapes(const EventContext &ctx) const
virtual StatusCode initialize() override
SG::ReadDecorHandleKeyArray< xAOD::PhotonContainer > m_isoKey
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Photon_v1 Photon
Definition of the current "egamma version".