16#include "GaudiKernel/IToolSvc.h"
48 const std::string& name,
49 const IInterface* parent ):
81 return StatusCode::SUCCESS;
90 for (
auto &hist : hists){
91 ATH_MSG_DEBUG (
"Initializing " << hist.first <<
" " << hist.first->GetName() <<
" " << hist.second <<
"...");
97 for (
auto &hist : hists){
98 ATH_MSG_DEBUG (
"Initializing " << hist.first <<
" " << hist.first->GetName() <<
" " << hist.second <<
"...");
104 for (
auto &hist : hists){
105 ATH_MSG_DEBUG (
"Initializing " << hist.first <<
" " << hist.first->GetName() <<
" " << hist.second <<
"...");
109 return StatusCode::SUCCESS;
120 float weight = eventInfo->beamSpotWeight();
132 for (
const auto*
const truthParticle : *truthParticles) {
135 if (std::abs(truthParticle->pdgId()) == 11 &&
142 if (std::abs(truthParticle->pdgId()) == 22 &&
149 bool isTrueConv =
false;
151 float truthEta = -999;
152 if (tmp && tmp->hasDecayVtx()) {
153 float x = tmp->decayVtx()->x();
154 float y = tmp->decayVtx()->y();
155 trueR = std::sqrt(
x *
x +
y *
y);
158 if (tmp !=
nullptr) {
159 truthEta = tmp->eta();
177 trueR, truthEta, weight);
188 bool val_loose =
false;
195 *truthParticle, *eventInfo);
198 *truthParticle, *eventInfo);
201 bool val_tight =
false;
208 *truthParticle, *eventInfo);
211 *truthParticle, *eventInfo);
220 ATH_MSG_ERROR(
"Filling reco elecectron hists failed " << name()
222 return StatusCode::FAILURE;
228 ATH_MSG_ERROR(
"Filling lrt elecectron hists failed " << name() <<
"...");
229 return StatusCode::FAILURE;
235 ATH_MSG_ERROR(
"Filling reco frwd elecectron hists failed " << name()
237 return StatusCode::FAILURE;
241 ATH_MSG_ERROR(
"Filling reco photon hists failed " << name() <<
"...");
242 return StatusCode::FAILURE;
247 ATH_MSG_ERROR(
"Filling reco elecectron hists failed " << name()
249 return StatusCode::FAILURE;
253 ATH_MSG_ERROR(
"Filling reco frwd elecectron hists failed " << name()
255 return StatusCode::FAILURE;
259 ATH_MSG_ERROR(
"Filling reco photon hists failed " << name() <<
"...");
260 return StatusCode::FAILURE;
267 return StatusCode::SUCCESS;
272 ATH_MSG_DEBUG (
"Filling reco electron hists " << name() <<
"...");
274 const EventContext& ctx = Gaudi::Hive::currentContext();
282 for(
const auto *
const electron : *Electrons){
283 bool isElecPrompt=
false;
300 float EtLin = (electron->pt()-thePart->
pt())/thePart->
pt();
303 if (thePart->
pt()/
GeV>20.) {
311 ATH_MSG_INFO (
"Truth particle associated not in egamma truth collection");
315 }
else if(
m_isMC){
if(
Match(electron,11, truthParticles)!=
nullptr ) isElecPrompt=
true;}
323 return StatusCode::SUCCESS;
328 ATH_MSG_DEBUG (
"Filling lrt electron hists " << name() <<
"...");
330 const EventContext& ctx = Gaudi::Hive::currentContext();
338 for(
const auto *
const electron : *LRTElectrons){
339 bool isElecPrompt=
false;
344 bool pass_LHVeryLooseNoPix =
false;
348 bool pass_LHLooseNoPix =
false;
352 bool pass_LHMediumNoPix =
false;
356 bool pass_LHTightNoPix =
false;
368 float EtLin = (electron->pt()-thePart->
pt())/thePart->
pt();
371 if (thePart->
pt()/
GeV>20.) {
379 ATH_MSG_INFO (
"Truth particle associated not in egamma truth collection");
382 }
else if(
m_isMC){
if(
Match(electron,11, truthParticles)!=
nullptr ) isElecPrompt=
true;}
385 m_oLRTElectronValidationPlots.fill(*electron,*eventInfo, isElecPrompt, pass_LHVeryLooseNoPix, pass_LHLooseNoPix, pass_LHMediumNoPix, pass_LHTightNoPix);
394 return StatusCode::SUCCESS;
399 ATH_MSG_DEBUG (
"Filling reco frwd electron hists " << name() <<
"...");
401 const EventContext& ctx = Gaudi::Hive::currentContext();
408 for(
const auto *
const frwdelectron : *ElectronsFrwd){
410 bool isElecPrompt=
false;
412 if((
Match(frwdelectron,11, truthParticles)!=
nullptr )) isElecPrompt=
true;
422 return StatusCode::SUCCESS;
427 ATH_MSG_DEBUG (
"Filling reco photon hists " << name() <<
"...");
429 const EventContext& ctx = Gaudi::Hive::currentContext();
439 for(
const auto *photon : *Photons){
440 bool isPhotPrompt=
false;
447 if(photon->author()) numofPhot++;
460 if(thePart&&thePart->
pt()/
GeV>20.) {
461 float EtLin = (photon->pt()-thePart->
pt())/thePart->
pt();
464 if (std::abs(EtLin)<0.2){
469 ATH_MSG_INFO(
"Truth particle associated not in egamma truth collection");
473 }
else if(
m_isMC){
if(
Match(photon,22, truthParticles)!=
nullptr ) isPhotPrompt=
true;}
479 numPhotAll = numofPhot+numofAmb;
491 return StatusCode::SUCCESS;
499 return StatusCode::SUCCESS;
505 float currentdr = 0.05;
508 for (
const auto *truthParticle: *truthParticles){
509 if (std::abs(truthParticle->pdgId()) != pdg || !
MC::isStable(truthParticle))
continue;
510 float dr = particle->p4().DeltaR(truthParticle->p4());
513 matchedTruthParticle = truthParticle;
517 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.