17#include "GaudiKernel/IToolSvc.h"
49 const std::string& name,
50 const IInterface* parent ):
82 return StatusCode::SUCCESS;
91 for (
auto &hist : hists){
92 ATH_MSG_DEBUG (
"Initializing " << hist.first <<
" " << hist.first->GetName() <<
" " << hist.second <<
"...");
98 for (
auto &hist : hists){
99 ATH_MSG_DEBUG (
"Initializing " << hist.first <<
" " << hist.first->GetName() <<
" " << hist.second <<
"...");
105 for (
auto &hist : hists){
106 ATH_MSG_DEBUG (
"Initializing " << hist.first <<
" " << hist.first->GetName() <<
" " << hist.second <<
"...");
110 return StatusCode::SUCCESS;
121 float weight = eventInfo->beamSpotWeight();
133 for (
const auto*
const truthParticle : *truthParticles) {
136 if (std::abs(truthParticle->pdgId()) == 11 &&
143 if (std::abs(truthParticle->pdgId()) == 22 &&
150 bool isTrueConv =
false;
152 float truthEta = -999;
153 if (tmp && tmp->hasDecayVtx()) {
154 float x = tmp->decayVtx()->x();
155 float y = tmp->decayVtx()->y();
156 trueR = std::sqrt(
x *
x +
y *
y);
159 if (tmp !=
nullptr) {
160 truthEta = tmp->eta();
178 trueR, truthEta, weight);
189 bool val_loose =
false;
196 *truthParticle, *eventInfo);
199 *truthParticle, *eventInfo);
202 bool val_tight =
false;
209 *truthParticle, *eventInfo);
212 *truthParticle, *eventInfo);
221 ATH_MSG_ERROR(
"Filling reco elecectron hists failed " << name()
223 return StatusCode::FAILURE;
229 ATH_MSG_ERROR(
"Filling lrt elecectron hists failed " << name() <<
"...");
230 return StatusCode::FAILURE;
236 ATH_MSG_ERROR(
"Filling reco frwd elecectron hists failed " << name()
238 return StatusCode::FAILURE;
242 ATH_MSG_ERROR(
"Filling reco photon hists failed " << name() <<
"...");
243 return StatusCode::FAILURE;
248 ATH_MSG_ERROR(
"Filling reco elecectron hists failed " << name()
250 return StatusCode::FAILURE;
254 ATH_MSG_ERROR(
"Filling reco frwd elecectron hists failed " << name()
256 return StatusCode::FAILURE;
260 ATH_MSG_ERROR(
"Filling reco photon hists failed " << name() <<
"...");
261 return StatusCode::FAILURE;
268 return StatusCode::SUCCESS;
273 ATH_MSG_DEBUG (
"Filling reco electron hists " << name() <<
"...");
275 const EventContext& ctx = Gaudi::Hive::currentContext();
283 for(
const auto *
const electron : *Electrons){
284 bool isElecPrompt=
false;
301 float EtLin = (electron->pt()-thePart->
pt())/thePart->
pt();
304 if (thePart->
pt()/
GeV>20.) {
312 ATH_MSG_INFO (
"Truth particle associated not in egamma truth collection");
316 }
else if(
m_isMC){
if(
Match(electron,11, truthParticles)!=
nullptr ) isElecPrompt=
true;}
324 return StatusCode::SUCCESS;
329 ATH_MSG_DEBUG (
"Filling lrt electron hists " << name() <<
"...");
331 const EventContext& ctx = Gaudi::Hive::currentContext();
339 for(
const auto *
const electron : *LRTElectrons){
340 bool isElecPrompt=
false;
345 bool pass_LHVeryLooseNoPix =
false;
349 bool pass_LHLooseNoPix =
false;
353 bool pass_LHMediumNoPix =
false;
357 bool pass_LHTightNoPix =
false;
369 float EtLin = (electron->pt()-thePart->
pt())/thePart->
pt();
372 if (thePart->
pt()/
GeV>20.) {
380 ATH_MSG_INFO (
"Truth particle associated not in egamma truth collection");
383 }
else if(
m_isMC){
if(
Match(electron,11, truthParticles)!=
nullptr ) isElecPrompt=
true;}
386 m_oLRTElectronValidationPlots.fill(*electron,*eventInfo, isElecPrompt, pass_LHVeryLooseNoPix, pass_LHLooseNoPix, pass_LHMediumNoPix, pass_LHTightNoPix);
395 return StatusCode::SUCCESS;
400 ATH_MSG_DEBUG (
"Filling reco frwd electron hists " << name() <<
"...");
402 const EventContext& ctx = Gaudi::Hive::currentContext();
409 for(
const auto *
const frwdelectron : *ElectronsFrwd){
411 bool isElecPrompt=
false;
413 if((
Match(frwdelectron,11, truthParticles)!=
nullptr )) isElecPrompt=
true;
423 return StatusCode::SUCCESS;
428 ATH_MSG_DEBUG (
"Filling reco photon hists " << name() <<
"...");
430 const EventContext& ctx = Gaudi::Hive::currentContext();
440 for(
const auto *photon : *Photons){
441 bool isPhotPrompt=
false;
448 if(photon->author()) numofPhot++;
461 if(thePart&&thePart->
pt()/
GeV>20.) {
462 float EtLin = (photon->pt()-thePart->
pt())/thePart->
pt();
465 if (std::abs(EtLin)<0.2){
470 ATH_MSG_INFO(
"Truth particle associated not in egamma truth collection");
474 }
else if(
m_isMC){
if(
Match(photon,22, truthParticles)!=
nullptr ) isPhotPrompt=
true;}
480 numPhotAll = numofPhot+numofAmb;
492 return StatusCode::SUCCESS;
500 return StatusCode::SUCCESS;
506 float currentdr = 0.05;
509 for (
const auto *truthParticle: *truthParticles){
510 if (std::abs(truthParticle->pdgId()) != pdg || !
MC::isStable(truthParticle))
continue;
511 float dr = particle->p4().DeltaR(truthParticle->p4());
514 matchedTruthParticle = truthParticle;
518 return matchedTruthParticle;
#define ATH_CHECK
Evaluate an expression and check for errors.
Helper class to provide constant type-safe access to aux data.
ATLAS-specific HepMC functions.
Handle class for reading from StoreGate.
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
const_pointer_type ptr()
Dereference the pointer.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
bool passSelection(bool &value, const std::string &menu) const
Check if the egamma object pass a selection menu (using the name) If the menu decision is stored in t...
float beamSpotWeight() const
Weight for beam spot size reweighting.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
int generations(const T &p)
Method to return how many interactions a particle has undergone during simulation (TODO migrate to be...
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
bool passOQquality(const xAOD::Photon &ph)
Helper to ease the implemmantation of the pass Quality requirements.
bool isConvertedPhoton(const xAOD::Egamma *eg, bool excludeTRT=false)
is the object a converted photon
bool isTrueConvertedPhoton(const xAOD::Photon *ph, float maxRadius=800.)
is the object matched to a true converted photon with R < maxRadius
const xAOD::Photon * getRecoPhoton(const xAOD::TruthParticle *particle)
return the reco photon associated to the given TruthParticle (if any)
const uint32_t BADCLUSELECTRON
const uint16_t AuthorCaloTopo35
Photon reconstructed by SW CaloTopo35 seeded clusters.
const uint16_t AuthorElectron
Object Reconstructed by standard cluster-based algorithm.
const uint32_t BADCLUSPHOTON
const uint16_t AuthorAmbiguous
Object Reconstructed by standard cluster-based algorithm.
const xAOD::TruthParticle * getTruthParticle(const xAOD::IParticle &p)
Return the truthParticle associated to the given IParticle (if any).
EventInfo_v1 EventInfo
Definition of the latest event info version.
Egamma_v1 Egamma
Definition of the current "egamma version".
TruthParticle_v1 TruthParticle
Typedef to implementation.
Photon_v1 Photon
Definition of the current "egamma version".
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.