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);
191 bool val_loose =
false;
198 *truthParticle, *eventInfo);
201 *truthParticle, *eventInfo);
204 bool val_tight =
false;
211 *truthParticle, *eventInfo);
214 *truthParticle, *eventInfo);
223 ATH_MSG_ERROR(
"Filling reco elecectron hists failed " << name()
225 return StatusCode::FAILURE;
231 ATH_MSG_ERROR(
"Filling lrt elecectron hists failed " << name() <<
"...");
232 return StatusCode::FAILURE;
238 ATH_MSG_ERROR(
"Filling reco frwd elecectron hists failed " << name()
240 return StatusCode::FAILURE;
244 ATH_MSG_ERROR(
"Filling reco photon hists failed " << name() <<
"...");
245 return StatusCode::FAILURE;
250 ATH_MSG_ERROR(
"Filling reco elecectron hists failed " << name()
252 return StatusCode::FAILURE;
256 ATH_MSG_ERROR(
"Filling reco frwd elecectron hists failed " << name()
258 return StatusCode::FAILURE;
262 ATH_MSG_ERROR(
"Filling reco photon hists failed " << name() <<
"...");
263 return StatusCode::FAILURE;
270 return StatusCode::SUCCESS;
275 ATH_MSG_DEBUG (
"Filling reco electron hists " << name() <<
"...");
277 const EventContext& ctx = Gaudi::Hive::currentContext();
285 for(
const auto *
const electron : *Electrons){
286 bool isElecPrompt=
false;
303 float EtLin = (electron->pt()-thePart->
pt())/thePart->
pt();
306 if (thePart->
pt()/
GeV>20.) {
314 ATH_MSG_INFO (
"Truth particle associated not in egamma truth collection");
318 }
else if(
m_isMC){
if(
Match(electron,11, truthParticles)!=
nullptr ) isElecPrompt=
true;}
326 return StatusCode::SUCCESS;
331 ATH_MSG_DEBUG (
"Filling lrt electron hists " << name() <<
"...");
333 const EventContext& ctx = Gaudi::Hive::currentContext();
341 for(
const auto *
const electron : *LRTElectrons){
342 bool isElecPrompt=
false;
347 bool pass_LHVeryLooseNoPix =
false;
351 bool pass_LHLooseNoPix =
false;
355 bool pass_LHMediumNoPix =
false;
359 bool pass_LHTightNoPix =
false;
371 float EtLin = (electron->pt()-thePart->
pt())/thePart->
pt();
374 if (thePart->
pt()/
GeV>20.) {
382 ATH_MSG_INFO (
"Truth particle associated not in egamma truth collection");
385 }
else if(
m_isMC){
if(
Match(electron,11, truthParticles)!=
nullptr ) isElecPrompt=
true;}
388 m_oLRTElectronValidationPlots.fill(*electron,*eventInfo, isElecPrompt, pass_LHVeryLooseNoPix, pass_LHLooseNoPix, pass_LHMediumNoPix, pass_LHTightNoPix);
397 return StatusCode::SUCCESS;
402 ATH_MSG_DEBUG (
"Filling reco frwd electron hists " << name() <<
"...");
404 const EventContext& ctx = Gaudi::Hive::currentContext();
411 for(
const auto *
const frwdelectron : *ElectronsFrwd){
413 bool isElecPrompt=
false;
415 if((
Match(frwdelectron,11, truthParticles)!=
nullptr )) isElecPrompt=
true;
425 return StatusCode::SUCCESS;
430 ATH_MSG_DEBUG (
"Filling reco photon hists " << name() <<
"...");
432 const EventContext& ctx = Gaudi::Hive::currentContext();
442 for(
const auto *photon : *Photons){
443 bool isPhotPrompt=
false;
450 if(photon->author()) numofPhot++;
463 if(thePart&&thePart->
pt()/
GeV>20.) {
464 float EtLin = (photon->pt()-thePart->
pt())/thePart->
pt();
467 if (std::abs(EtLin)<0.2){
472 ATH_MSG_INFO(
"Truth particle associated not in egamma truth collection");
476 }
else if(
m_isMC){
if(
Match(photon,22, truthParticles)!=
nullptr ) isPhotPrompt=
true;}
482 numPhotAll = numofPhot+numofAmb;
494 return StatusCode::SUCCESS;
502 return StatusCode::SUCCESS;
508 float currentdr = 0.05;
511 for (
const auto *truthParticle: *truthParticles){
512 if (std::abs(truthParticle->pdgId()) != pdg || !
MC::isStable(truthParticle))
continue;
513 float dr = particle->p4().DeltaR(truthParticle->p4());
516 matchedTruthParticle = truthParticle;
520 return matchedTruthParticle;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_INFO(x,...)
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)
float conversionRadius(const xAOD::Vertex *vx)
return the conversion radius or 9999.
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.