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);
163 const EventContext& ctx = Gaudi::Hive::currentContext();
191 bool passTwoPhotonCuts(
true);
197 if (passTwoPhotonCuts) writeEvent =
true;
202 if (!writeEvent)
return false;
233 for (
unsigned int i = 0; i <
m_triggers.size(); i++) {
245std::optional<DerivationFramework::SkimmingToolHIGG1::LeadingPhotons_t>
253 int ph_pos_lead = -1;
254 int ph_pos_subl = -1;
258 for(
int i = 0; ph_itr != ph_end; ++ph_itr, ++i) {
262 if ((*ph_itr)->pt() > ph_pt_lead) {
264 ph_pos_subl = ph_pos_lead; ph_pos_lead = i;
265 ph_pt_subl = ph_pt_lead;
266 ph_pt_lead = (*ph_itr)->pt();
268 }
else if ((*ph_itr)->pt() > ph_pt_subl) {
270 ph_pt_subl = (*ph_itr)->pt();
282 if (ph_pos_subl != -1) {
283 const xAOD::Photon* ph_lead = *(photons->begin() + ph_pos_lead);
284 const xAOD::Photon* ph_subl = *(photons->begin() + ph_pos_subl);
296 if (!ph)
return false;
298 if (!ph->
isGoodOQ(34214))
return false;
306 val =
static_cast<bool>(DFCommonPhotonsIsEMLooseAcc(*ph));
312 if(!defined || !val)
return false;
322 double eta = std::abs(caloCluster->
etaBE(2));
326 1.37 <=
eta &&
eta <= 1.52)
return false;
345 return passKinematic;
352 bool passQuality =
false;
353 leadingPhotons[0]->passSelection(val,
"Tight");
354 const int ph_tight_lead = val;
356 leadingPhotons[1]->passSelection(val,
"Tight");
357 const int ph_tight_subl = val;
359 passQuality = (ph_tight_lead && ph_tight_subl);
383 return passInvariantMass;
394 const double ph_eta_lead =
CorrectedEta(leadingPhotons[0]);
395 const double ph_eta_subl =
CorrectedEta(leadingPhotons[1]);
397 const double ph_phi_lead = leadingPhotons[0]->phi();
398 const double ph_phi_subl = leadingPhotons[1]->phi();
400 const double ph_pt_lead = ph_e_lead / cosh(ph_eta_lead);
401 const double ph_pt_subl = ph_e_subl / cosh(ph_eta_subl);
403 TLorentzVector leadPhotonLV;
404 TLorentzVector sublPhotonLV;
405 leadPhotonLV.SetPtEtaPhiM(ph_pt_lead, ph_eta_lead, ph_phi_lead, 0.);
406 sublPhotonLV.SetPtEtaPhiM(ph_pt_subl, ph_eta_subl, ph_phi_subl, 0.);
408 return (leadPhotonLV + sublPhotonLV).M();
434 double R_photom_n_front, Z_photom_n_front;
435 if (std::abs(eta1) < 1.5) {
437 Z_photom_n_front = R_photom_n_front*sinh(eta1);
440 R_photom_n_front = Z_photom_n_front/sinh(eta1);
450 float abs_eta1 = std::abs(eta1);
452 double radius = -99999;
453 if (abs_eta1 < 0.8) {
454 radius = 1558.859292 - 4.990838 * abs_eta1 - 21.144279 * abs_eta1 * abs_eta1;
455 }
else if (abs_eta1 < 1.5) {
456 radius = 1522.775373 + 27.970192 * abs_eta1 - 21.104108 * abs_eta1 * abs_eta1;
458 radius = 3790.671754;
459 if (eta1 < 0.) radius = -radius;
478 bool passSingleElectronPreselect =
false;
480 for( ; ph_itr != ph_end; ++ph_itr){
482 for( ; el_itr != el_end; ++el_itr){
484 passSingleElectronPreselect =
true;
492 return passSingleElectronPreselect;
501 for(
const auto *
const el: *electrons){
507 for(
unsigned int trk_i(0); trk_i < el->nTrackParticles(); ++trk_i){
508 const auto *ele_tp = el->trackParticle(trk_i);
512 uint8_t nPixHits(0), nPixDead(0), nSCTHits(0), nSCTDead(0);
513 bool allFound =
true;
520 int nSiHitsPlusDeadSensors = nPixHits + nPixDead + nSCTHits + nSCTDead;
521 if(nSiHitsPlusDeadSensors >= 7)
526 else if( std::abs(z0_1 - ele_tp->z0()) > 10 )
550 bool passDoubleElectronPreselect =
false;
552 for( ; el_itr != el_end; ++el_itr){
557 if(nEle >=2) passDoubleElectronPreselect =
true;
560 return passDoubleElectronPreselect;
576 bool passSingleMuonPreselect =
false;
578 for( ; ph_itr != ph_end; ++ph_itr){
580 for( ; mu_itr != mu_end; ++mu_itr){
582 passSingleMuonPreselect =
true;
590 return passSingleMuonPreselect;
608 for( ; ph_itr != ph_end; ++ph_itr){
614 for( ; mu_itr != mu_end; ++mu_itr){
621 if(nPhoton >= 1 && nMuon >= 2){
622 ATH_MSG_DEBUG(
"Event selected with " << nPhoton <<
" photons and " << nMuon <<
" muons");
646 for( ; ph_itr != ph_end; ++ph_itr){
652 for( ; el_itr != el_end; ++el_itr){
658 if(nPhoton >= 1 && nElectron >= 2){
659 ATH_MSG_DEBUG(
"Event selected with " << nPhoton <<
" photons and " << nElectron <<
" electrons");
672 bool passTrigger=
false;
681 ATH_MSG_WARNING(
"Selecting Merged electrons but no Merged Triggers Selected ! -- was that intentional?");
692 bool passSelection =
false;
694 for(
const auto *el : *electrons){
696 for(
const auto *ph: *photons){
698 passSelection =
true;
699 auto eph = ph->p4() + el->p4();
700 if(eph.M() > 90 * CLHEP::GeV)
714 ATH_MSG_DEBUG(
"Event selected with a photons and a merged electron");
741 for( ; ph_itr != ph_end; ++ph_itr){
747 for( ; el_itr != el_end; ++el_itr){
753 if(nPhoton >= 1 && nElectron >= 1 ){
754 ATH_MSG_DEBUG(
"Event selected with " << nPhoton <<
" high pt photons and " << nElectron <<
" merged electron");
767 if (!el)
return false;
775 val = val ||
static_cast<bool>(DFCommonElectronsLooseAcc(*el));
777 defined = el->passSelection(val,
"Loose");
783 val = val ||
static_cast<bool>(DFCommonElectronsLHLooseAcc(*el));
786 if(!defined || !val)
return false;
788 double eta = std::abs(el->eta());
789 double pt = el->pt();
801 if (!el)
return false;
803 double eta = std::abs(el->eta());
804 double pt = el->pt();
816 if (!mu)
return false;
820 if( !
static_cast<bool>(DFCommonGoodMuonAcc(*mu)) )
825 if( !
static_cast<bool>(DFCommonMuonsPreselectionAcc(*mu)) )
828 double eta = std::abs(mu->eta());
829 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".