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;
118 const EventContext& ctx = Gaudi::Hive::currentContext();
122 float weight = eventInfo->beamSpotWeight();
134 for (
const auto*
const truthParticle : *truthParticles) {
137 if (std::abs(truthParticle->pdgId()) == 11 &&
144 if (std::abs(truthParticle->pdgId()) == 22 &&
151 bool isTrueConv =
false;
153 float truthEta = -999;
154 if (tmp && tmp->hasDecayVtx()) {
155 float x = tmp->decayVtx()->x();
156 float y = tmp->decayVtx()->y();
157 trueR = std::sqrt(
x *
x +
y *
y);
160 if (tmp !=
nullptr) {
161 truthEta = tmp->eta();
179 trueR, truthEta, weight);
190 bool val_loose =
false;
197 *truthParticle, *eventInfo);
200 *truthParticle, *eventInfo);
203 bool val_tight =
false;
210 *truthParticle, *eventInfo);
213 *truthParticle, *eventInfo);
222 ATH_MSG_ERROR(
"Filling reco elecectron hists failed " << name()
224 return StatusCode::FAILURE;
230 ATH_MSG_ERROR(
"Filling lrt elecectron hists failed " << name() <<
"...");
231 return StatusCode::FAILURE;
237 ATH_MSG_ERROR(
"Filling reco frwd elecectron hists failed " << name()
239 return StatusCode::FAILURE;
243 ATH_MSG_ERROR(
"Filling reco photon hists failed " << name() <<
"...");
244 return StatusCode::FAILURE;
249 ATH_MSG_ERROR(
"Filling reco elecectron hists failed " << name()
251 return StatusCode::FAILURE;
255 ATH_MSG_ERROR(
"Filling reco frwd elecectron hists failed " << name()
257 return StatusCode::FAILURE;
261 ATH_MSG_ERROR(
"Filling reco photon hists failed " << name() <<
"...");
262 return StatusCode::FAILURE;
269 return StatusCode::SUCCESS;
274 ATH_MSG_DEBUG (
"Filling reco electron hists " << name() <<
"...");
276 const EventContext& ctx = Gaudi::Hive::currentContext();
284 for(
const auto *
const electron : *Electrons){
285 bool isElecPrompt=
false;
302 float EtLin = (electron->pt()-thePart->
pt())/thePart->
pt();
305 if (thePart->
pt()/
GeV>20.) {
313 ATH_MSG_INFO (
"Truth particle associated not in egamma truth collection");
317 }
else if(
m_isMC){
if(
Match(electron,11, truthParticles)!=
nullptr ) isElecPrompt=
true;}
325 return StatusCode::SUCCESS;
330 ATH_MSG_DEBUG (
"Filling lrt electron hists " << name() <<
"...");
332 const EventContext& ctx = Gaudi::Hive::currentContext();
340 for(
const auto *
const electron : *LRTElectrons){
341 bool isElecPrompt=
false;
346 bool pass_LHVeryLooseNoPix =
false;
350 bool pass_LHLooseNoPix =
false;
354 bool pass_LHMediumNoPix =
false;
358 bool pass_LHTightNoPix =
false;
370 float EtLin = (electron->pt()-thePart->
pt())/thePart->
pt();
373 if (thePart->
pt()/
GeV>20.) {
381 ATH_MSG_INFO (
"Truth particle associated not in egamma truth collection");
384 }
else if(
m_isMC){
if(
Match(electron,11, truthParticles)!=
nullptr ) isElecPrompt=
true;}
387 m_oLRTElectronValidationPlots.fill(*electron,*eventInfo, isElecPrompt, pass_LHVeryLooseNoPix, pass_LHLooseNoPix, pass_LHMediumNoPix, pass_LHTightNoPix);
396 return StatusCode::SUCCESS;
401 ATH_MSG_DEBUG (
"Filling reco frwd electron hists " << name() <<
"...");
403 const EventContext& ctx = Gaudi::Hive::currentContext();
410 for(
const auto *
const frwdelectron : *ElectronsFrwd){
412 bool isElecPrompt=
false;
414 if((
Match(frwdelectron,11, truthParticles)!=
nullptr )) isElecPrompt=
true;
424 return StatusCode::SUCCESS;
429 ATH_MSG_DEBUG (
"Filling reco photon hists " << name() <<
"...");
431 const EventContext& ctx = Gaudi::Hive::currentContext();
441 for(
const auto *photon : *Photons){
442 bool isPhotPrompt=
false;
449 if(photon->author()) numofPhot++;
462 if(thePart&&thePart->
pt()/
GeV>20.) {
463 float EtLin = (photon->pt()-thePart->
pt())/thePart->
pt();
466 if (std::abs(EtLin)<0.2){
471 ATH_MSG_INFO(
"Truth particle associated not in egamma truth collection");
475 }
else if(
m_isMC){
if(
Match(photon,22, truthParticles)!=
nullptr ) isPhotPrompt=
true;}
481 numPhotAll = numofPhot+numofAmb;
493 return StatusCode::SUCCESS;
501 return StatusCode::SUCCESS;
507 float currentdr = 0.05;
510 for (
const auto *truthParticle: *truthParticles){
511 if (std::abs(truthParticle->pdgId()) != pdg || !
MC::isStable(truthParticle))
continue;
512 float dr = particle->p4().DeltaR(truthParticle->p4());
515 matchedTruthParticle = truthParticle;
519 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.