14#include "CLHEP/Units/SystemOfUnits.h"
24 const IInterface* p) :
31 declareProperty(
"RequireGRL",
m_reqGRL =
true);
38 declareProperty(
"IncludeSingleMuonPreselection",
m_incSingleMuon =
true);
39 declareProperty(
"IncludeDoubleMuonPreselection",
m_incDoubleMuon =
false);
43 declareProperty(
"IncludeDoublePhotonPreselection",
m_incTwoPhotons =
true);
52 declareProperty(
"DefaultTrigger",
m_defaultTrigger =
"EF_g35_loose_g25_loose");
53 declareProperty(
"Triggers",
m_triggers = std::vector<std::string>());
54 declareProperty(
"MergedElectronTriggers",
m_mergedtriggers = std::vector<std::string>() );
56 declareProperty(
"MinimumPhotonPt",
m_minPhotonPt = 20*CLHEP::GeV);
60 declareProperty(
"MinimumMuonPt",
m_minMuonPt = 20*CLHEP::GeV);
63 declareProperty(
"MaxEta",
m_maxEta = 2.47);
89 return StatusCode::FAILURE;
98 ATH_MSG_FATAL(
"Failed to retrieve tool: ElectronPhotonSelectorTools");
99 return StatusCode::FAILURE;
112 return StatusCode::SUCCESS;
153 return StatusCode::SUCCESS;
162 bool writeEvent(
false);
190 bool passTwoPhotonCuts(
true);
196 if (passTwoPhotonCuts) writeEvent =
true;
201 if (!writeEvent)
return false;
232 for (
unsigned int i = 0; i <
m_triggers.size(); i++) {
244std::optional<DerivationFramework::SkimmingToolHIGG1::LeadingPhotons_t>
252 int ph_pos_lead = -1;
253 int ph_pos_subl = -1;
257 for(
int i = 0; ph_itr != ph_end; ++ph_itr, ++i) {
261 if ((*ph_itr)->pt() > ph_pt_lead) {
263 ph_pos_subl = ph_pos_lead; ph_pos_lead = i;
264 ph_pt_subl = ph_pt_lead;
265 ph_pt_lead = (*ph_itr)->pt();
267 }
else if ((*ph_itr)->pt() > ph_pt_subl) {
269 ph_pt_subl = (*ph_itr)->pt();
281 if (ph_pos_subl != -1) {
282 const xAOD::Photon* ph_lead = *(photons->begin() + ph_pos_lead);
283 const xAOD::Photon* ph_subl = *(photons->begin() + ph_pos_subl);
295 if (!ph)
return false;
297 if (!ph->
isGoodOQ(34214))
return false;
305 val =
static_cast<bool>(DFCommonPhotonsIsEMLooseAcc(*ph));
311 if(!defined || !val)
return false;
321 double eta = std::abs(caloCluster->
etaBE(2));
325 1.37 <=
eta &&
eta <= 1.52)
return false;
344 return passKinematic;
351 bool passQuality =
false;
352 leadingPhotons[0]->passSelection(val,
"Tight");
353 const int ph_tight_lead = val;
355 leadingPhotons[1]->passSelection(val,
"Tight");
356 const int ph_tight_subl = val;
358 passQuality = (ph_tight_lead && ph_tight_subl);
382 return passInvariantMass;
393 const double ph_eta_lead =
CorrectedEta(leadingPhotons[0]);
394 const double ph_eta_subl =
CorrectedEta(leadingPhotons[1]);
396 const double ph_phi_lead = leadingPhotons[0]->phi();
397 const double ph_phi_subl = leadingPhotons[1]->phi();
399 const double ph_pt_lead = ph_e_lead / cosh(ph_eta_lead);
400 const double ph_pt_subl = ph_e_subl / cosh(ph_eta_subl);
402 TLorentzVector leadPhotonLV;
403 TLorentzVector sublPhotonLV;
404 leadPhotonLV.SetPtEtaPhiM(ph_pt_lead, ph_eta_lead, ph_phi_lead, 0.);
405 sublPhotonLV.SetPtEtaPhiM(ph_pt_subl, ph_eta_subl, ph_phi_subl, 0.);
407 return (leadPhotonLV + sublPhotonLV).M();
433 double R_photom_n_front, Z_photom_n_front;
434 if (std::abs(eta1) < 1.5) {
436 Z_photom_n_front = R_photom_n_front*sinh(eta1);
439 R_photom_n_front = Z_photom_n_front/sinh(eta1);
449 float abs_eta1 = std::abs(eta1);
451 double radius = -99999;
452 if (abs_eta1 < 0.8) {
453 radius = 1558.859292 - 4.990838 * abs_eta1 - 21.144279 * abs_eta1 * abs_eta1;
454 }
else if (abs_eta1 < 1.5) {
455 radius = 1522.775373 + 27.970192 * abs_eta1 - 21.104108 * abs_eta1 * abs_eta1;
457 radius = 3790.671754;
458 if (eta1 < 0.) radius = -radius;
477 bool passSingleElectronPreselect =
false;
479 for( ; ph_itr != ph_end; ++ph_itr){
481 for( ; el_itr != el_end; ++el_itr){
483 passSingleElectronPreselect =
true;
491 return passSingleElectronPreselect;
500 for(
const auto *
const el: *electrons){
506 for(
unsigned int trk_i(0); trk_i < el->nTrackParticles(); ++trk_i){
507 const auto *ele_tp = el->trackParticle(trk_i);
511 uint8_t nPixHits(0), nPixDead(0), nSCTHits(0), nSCTDead(0);
512 bool allFound =
true;
519 int nSiHitsPlusDeadSensors = nPixHits + nPixDead + nSCTHits + nSCTDead;
520 if(nSiHitsPlusDeadSensors >= 7)
525 else if( std::abs(z0_1 - ele_tp->z0()) > 10 )
549 bool passDoubleElectronPreselect =
false;
551 for( ; el_itr != el_end; ++el_itr){
556 if(nEle >=2) passDoubleElectronPreselect =
true;
559 return passDoubleElectronPreselect;
575 bool passSingleMuonPreselect =
false;
577 for( ; ph_itr != ph_end; ++ph_itr){
579 for( ; mu_itr != mu_end; ++mu_itr){
581 passSingleMuonPreselect =
true;
589 return passSingleMuonPreselect;
607 for( ; ph_itr != ph_end; ++ph_itr){
613 for( ; mu_itr != mu_end; ++mu_itr){
620 if(nPhoton >= 1 && nMuon >= 2){
621 ATH_MSG_DEBUG(
"Event selected with " << nPhoton <<
" photons and " << nMuon <<
" muons");
645 for( ; ph_itr != ph_end; ++ph_itr){
651 for( ; el_itr != el_end; ++el_itr){
657 if(nPhoton >= 1 && nElectron >= 2){
658 ATH_MSG_DEBUG(
"Event selected with " << nPhoton <<
" photons and " << nElectron <<
" electrons");
671 bool passTrigger=
false;
680 ATH_MSG_WARNING(
"Selecting Merged electrons but no Merged Triggers Selected ! -- was that intentional?");
691 bool passSelection =
false;
693 for(
const auto *el : *electrons){
695 for(
const auto *ph: *photons){
697 passSelection =
true;
698 auto eph = ph->p4() + el->p4();
699 if(eph.M() > 90 * CLHEP::GeV)
713 ATH_MSG_DEBUG(
"Event selected with a photons and a merged electron");
740 for( ; ph_itr != ph_end; ++ph_itr){
746 for( ; el_itr != el_end; ++el_itr){
752 if(nPhoton >= 1 && nElectron >= 1 ){
753 ATH_MSG_DEBUG(
"Event selected with " << nPhoton <<
" high pt photons and " << nElectron <<
" merged electron");
766 if (!el)
return false;
774 val = val ||
static_cast<bool>(DFCommonElectronsLooseAcc(*el));
776 defined = el->passSelection(val,
"Loose");
782 val = val ||
static_cast<bool>(DFCommonElectronsLHLooseAcc(*el));
785 if(!defined || !val)
return false;
787 double eta = std::abs(el->eta());
788 double pt = el->pt();
800 if (!el)
return false;
802 double eta = std::abs(el->eta());
803 double pt = el->pt();
815 if (!mu)
return false;
819 if( !
static_cast<bool>(DFCommonGoodMuonAcc(*mu)) )
824 if( !
static_cast<bool>(DFCommonMuonsPreselectionAcc(*mu)) )
827 double eta = std::abs(mu->eta());
828 double pt = mu->pt();
Scalar eta() const
pseudorapidity method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
Helper class to provide constant type-safe access to aux data.
DataModel_detail::const_iterator< DataVector > const_iterator
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.
virtual double e() const
The total energy of the particle.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
bool isGoodOQ(uint32_t mask) const
Check object quality. Return True is it is Good Object Quality.
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...
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
bool eventType(EventType type) const
Check for one particular bitmask value.
@ LAr
The LAr calorimeter.
@ Error
The sub-detector issued an error.
@ IS_SIMULATION
true: simulation, false: data
EventFlagErrorState errorState(EventFlagSubDet subDet) const
Get the error state for a particular sub-detector.
virtual double e() const override final
The total energy of the particle.
EventInfo_v1 EventInfo
Definition of the latest event info version.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Muon_v1 Muon
Reference the current persistent version:
Photon_v1 Photon
Definition of the current "egamma version".
@ numberOfSCTDeadSensors
number of dead SCT sensors crossed [unit8_t].
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
@ numberOfPixelDeadSensors
number of dead pixel sensors crossed [unit8_t].
Electron_v1 Electron
Definition of the current "egamma version".