ATLAS Offline Software
Loading...
Searching...
No Matches
egammaMonitorElectronAlgorithm.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
7egammaMonitorElectronAlgorithm::egammaMonitorElectronAlgorithm(const std::string& name, ISvcLocator* pSvcLocator):
8 egammaMonitorBaseAlgorithm( name, pSvcLocator )
9{}
10
12{
13 ATH_CHECK(m_electronsKey.initialize());
14 ATH_CHECK(m_isoKey.initialize());
15 m_baseName = Form("%s.",m_electronsKey.key().c_str());
16
18 if (!m_monTool.empty()) CHECK(m_monTool.retrieve());
19
20 return StatusCode::SUCCESS;
21}
22
23StatusCode egammaMonitorElectronAlgorithm::execute(const EventContext& ctx) const
24{
28 return StatusCode::SUCCESS;
29}
30
32
34
35 std::vector<float> deltaEta0_vec, deltaEta1_vec, deltaEta2_vec, deltaEta3_vec, deltaPhi0_vec, deltaPhi1_vec, deltaPhi2_vec, deltaPhi3_vec, deltaPhiRescaled0_vec, deltaPhiRescaled1_vec, deltaPhiRescaled2_vec, deltaPhiRescaled3_vec, deltaPhiLast_vec, d0_vec;
36
37 auto deltaEta0_col = Monitored::Collection("deltaEta0",deltaEta0_vec);
38 auto deltaEta1_col = Monitored::Collection("deltaEta1",deltaEta1_vec);
39 auto deltaEta2_col = Monitored::Collection("deltaEta2",deltaEta2_vec);
40 auto deltaEta3_col = Monitored::Collection("deltaEta3",deltaEta3_vec);
41 auto deltaPhi0_col = Monitored::Collection("deltaPhi0",deltaPhi0_vec);
42 auto deltaPhi1_col = Monitored::Collection("deltaPhi1",deltaPhi1_vec);
43 auto deltaPhi2_col = Monitored::Collection("deltaPhi2",deltaPhi2_vec);
44 auto deltaPhi3_col = Monitored::Collection("deltaPhi3",deltaPhi3_vec);
45 auto deltaPhiRescaled0_col = Monitored::Collection("deltaPhiRescaled0",deltaPhiRescaled0_vec);
46 auto deltaPhiRescaled1_col = Monitored::Collection("deltaPhiRescaled1",deltaPhiRescaled1_vec);
47 auto deltaPhiRescaled2_col = Monitored::Collection("deltaPhiRescaled2",deltaPhiRescaled2_vec);
48 auto deltaPhiRescaled3_col = Monitored::Collection("deltaPhiRescaled3",deltaPhiRescaled3_vec);
49 auto deltaPhiLast_col = Monitored::Collection("deltaPhiLast",deltaPhiLast_vec );
50 auto d0_col = Monitored::Collection("d0",d0_vec);
51
52 for (const auto *const electron : *electrons){
53
54 deltaEta0_vec.push_back(getCaloTrackMatch_deltaEta0(electron));
55 deltaEta1_vec.push_back(getCaloTrackMatch_deltaEta1(electron));
56 deltaEta2_vec.push_back(getCaloTrackMatch_deltaEta2(electron));
57 deltaEta3_vec.push_back(getCaloTrackMatch_deltaEta3(electron));
58 deltaPhi0_vec.push_back(getCaloTrackMatch_deltaPhi0(electron));
59 deltaPhi1_vec.push_back(getCaloTrackMatch_deltaPhi1(electron));
60 deltaPhi2_vec.push_back(getCaloTrackMatch_deltaPhi2(electron));
61 deltaPhi3_vec.push_back(getCaloTrackMatch_deltaPhi3(electron));
62 deltaPhiRescaled0_vec.push_back(getCaloTrackMatch_deltaPhiRescaled0(electron));
63 deltaPhiRescaled1_vec.push_back(getCaloTrackMatch_deltaPhiRescaled1(electron));
64 deltaPhiRescaled2_vec.push_back(getCaloTrackMatch_deltaPhiRescaled2(electron));
65 deltaPhiRescaled3_vec.push_back(getCaloTrackMatch_deltaPhiRescaled3(electron));
66 deltaPhiLast_vec.push_back(getCaloTrackMatch_deltaPhiFromLastMeasurement(electron));
67 d0_vec.push_back(getTrack_d0(electron));
68
69 }
70
71 auto mon = Monitored::Group(m_monTool, deltaEta0_col,deltaEta1_col,deltaEta2_col,deltaEta3_col,
72 deltaPhi0_col,deltaPhi1_col,deltaPhi2_col,deltaPhi3_col,deltaPhiRescaled0_col,
73 deltaPhiRescaled1_col,deltaPhiRescaled2_col,deltaPhiRescaled3_col,deltaPhiLast_col,d0_col);
74
75 ATH_MSG_DEBUG("Electron - Track Online Monitoring in Reconstruction ...");
76 }
77
79
81 ATH_MSG_DEBUG("Fill SS Reco Electron distributions: ");
82
83 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,
84 f1_vec, f3_vec, eratio_vec, et_vec, highet_vec , eta_vec, phi_vec;
85
86 auto ethad_col = Monitored::Collection("ethad" , ethad_vec );
87 auto ethad1_col = Monitored::Collection("ethad1" , ethad1_vec );
88 auto Rhad_col = Monitored::Collection("Rhad" , Rhad_vec );
89 auto Rhad1_col = Monitored::Collection("Rhad1" , Rhad1_vec );
90 auto Reta_col = Monitored::Collection("Reta" , Reta_vec );
91 auto Rphi_col = Monitored::Collection("Rphi" , Rphi_vec );
92 auto e237_col = Monitored::Collection("e237" , e237_vec );
93 auto e277_col = Monitored::Collection("e277" , e277_vec );
94 auto weta1_col = Monitored::Collection("weta1" , weta1_vec );
95 auto weta2_col = Monitored::Collection("weta2" , weta2_vec );
96 auto wtots1_col = Monitored::Collection("wtots1" , wtots1_vec );
97 auto f1_col = Monitored::Collection("f1" , f1_vec );
98 auto f3_col = Monitored::Collection("f3" , f3_vec );
99 auto eratio_col = Monitored::Collection("eratio" , eratio_vec );
100 auto et_col = Monitored::Collection("et" , et_vec );
101 auto highet_col = Monitored::Collection("highet" , highet_vec );
102 auto eta_col = Monitored::Collection("eta" , eta_vec );
103 auto phi_col = Monitored::Collection("phi" , phi_vec );
104
105 for ( const auto *const electron : *electrons ){
106
107 if(!electron) continue;
108
109 Reta_vec.push_back( getShowerShape_Reta(electron));
110 Rphi_vec.push_back( getShowerShape_Rphi(electron));
111 e237_vec.push_back( getShowerShape_e237(electron));
112 e277_vec.push_back( getShowerShape_e277(electron));
113 ethad_vec.push_back( getShowerShape_ethad(electron)/Gaudi::Units::GeV);
114 ethad1_vec.push_back( getShowerShape_ethad1(electron)/Gaudi::Units::GeV);
115 Rhad_vec.push_back( getShowerShape_Rhad(electron));
116 Rhad1_vec.push_back( getShowerShape_Rhad(electron));
117 weta1_vec.push_back( getShowerShape_weta1(electron));
118 weta2_vec.push_back( getShowerShape_weta2(electron));
119 wtots1_vec.push_back( getShowerShape_wtots1(electron));
120 f1_vec.push_back( getShowerShape_f1(electron));
121 f3_vec.push_back( getShowerShape_f3(electron));
122 eratio_vec.push_back( getShowerShape_Eratio(electron));
123 et_vec.push_back( electron->pt()/Gaudi::Units::GeV);
124 highet_vec.push_back( electron->pt()/Gaudi::Units::GeV);
125 eta_vec.push_back( electron->eta());
126 phi_vec.push_back( electron->phi());
127 }
128
129 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,
130 f1_col, f3_col, eratio_col, et_col, highet_col , eta_col, phi_col);
131
132}
133
135
137
138 // This is ok but defeats a bit the purpose...
139 std::map<TString,std::vector<float>> iso_vec;
140 for (const auto& hk : m_isoKey) {
141 TString n = hk.key();
142 n.ReplaceAll(m_baseName,"");
143 iso_vec.emplace(n,std::vector<float>());
144 }
145 // this is the hard-coded piece that defeats the purpose...
146 auto col0 = Monitored::Collection("ptcone20",iso_vec["ptcone20"]);
147 auto col1 = Monitored::Collection("ptvarcone20",iso_vec["ptvarcone20"]);
148
149 std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> allMonIsoVars;
150 allMonIsoVars.insert(allMonIsoVars.end(),{col0,col1});
151 for (const auto& hk : m_isoKey) {
152 TString n = hk.key();
153 n.ReplaceAll(m_baseName,"");
155 for (const xAOD::Electron* electron : *electrons){
156 ATH_MSG_DEBUG("From " << m_electronsKey.key() << " ele, pt = " << electron->pt()/Gaudi::Units::GeV
157 << " track pT = " << electron->trackParticle()->pt()/Gaudi::Units::GeV
158 << " eta = " << electron->eta() << " phi = " << electron->phi() << " for handler whose name is " << n);
159 if (!handle.isValid()) {
160 ATH_MSG_WARNING(hk << " is not valid");
161 } else {
162 ATH_MSG_DEBUG(hk << " is valid");
163 iso_vec[n].push_back(handle(*electron)/Gaudi::Units::GeV);
164 }
165 }
166 }
167 auto mon = Monitored::Group(m_monTool, std::move(allMonIsoVars));
168
169 ATH_MSG_DEBUG("Electron - Isolation Online Monitoring in Reconstruction ...");
170}
#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
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronsKey
ToolHandle< GenericMonitoringTool > m_monTool
virtual StatusCode execute(const EventContext &ctx) const override
egammaMonitorElectronAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
void filltopoElectronTrackCaloMatch(const EventContext &ctx) const
void filltopoElectronIsolation(const EventContext &ctx) const
void filltopoElectronShowerShapes(const EventContext &ctx) const
SG::ReadDecorHandleKeyArray< xAOD::ElectronContainer > m_isoKey
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Electron_v1 Electron
Definition of the current "egamma version".