15#include "CLHEP/Units/SystemOfUnits.h"
26 const IInterface* p) :
38 declareProperty(
"MuonContainerKey",
m_muonSGKey=
"Muons");
39 declareProperty(
"JetContainerKey",
m_jetSGKey=
"AntiKt4EMTopoJets");
40 declareProperty(
"MergedJetContainerKey0",
m_mergedJetSGKey[0]=
"AntiKt4EMTopoJets");
41 declareProperty(
"MergedJetContainerKey1",
m_mergedJetSGKey[1]=
"AntiKt10LCTopoJets");
42 declareProperty(
"MergedJetContainerKey2",
m_mergedJetSGKey[2]=
"CamKt12LCTopoJets");
43 declareProperty(
"PhotonContainerKey",
m_photonSGKey=
"Photons");
44 declareProperty(
"TrackContainerKey",
m_trackSGKey=
"InDetTrackParticles");
46 declareProperty(
"NumberOfLeptons",
m_nLeptons=2);
48 declareProperty(
"NumberOfMuons",
m_nMuons=0);
49 declareProperty(
"NumberOfJets",
m_nJets=0);
53 declareProperty(
"NumberOfPhotons",
m_nPhotons=0);
54 declareProperty(
"NumberOfTracks",
m_nTracks=0);
57 declareProperty(
"MuonQuality",
m_muonQual=
"inMS");
58 declareProperty(
"TightElectronQuality",
m_tightElectronQual=
"DFCommonElectronsLHVeryLoose");
59 declareProperty(
"TightMuonQuality",
m_tightMuonQual=
"DFCommonGoodMuon");
60 declareProperty(
"JetQuality",
m_jetQual=
"any");
68 declareProperty(
"Trigger2L",
m_trigger2L=std::vector<std::string>());
69 declareProperty(
"TriggerTP",
m_triggerTP=std::vector<std::string>());
70 declareProperty(
"Trigger2L2Q",
m_trigger2L2Q=std::vector<std::string>());
71 declareProperty(
"TriggerJPSI",
m_triggerJPSI=std::vector<std::string>());
72 declareProperty(
"TriggerPHI",
m_triggerPHI=std::vector<std::string>());
75 declareProperty(
"MuonPtCut",
m_muonPtCut=10.*CLHEP::GeV);
78 declareProperty(
"JetPtCut",
m_jetPtCut=15.*CLHEP::GeV);
83 declareProperty(
"TrackPtCut",
m_trackPtCut=20.*CLHEP::GeV);
132 return StatusCode::FAILURE;
136 return StatusCode::SUCCESS;
143 return StatusCode::SUCCESS;
150 bool acceptEvent(
false);
151 StatusCode
sc(StatusCode::SUCCESS);
155 ATH_CHECK(evtStore()->retrieve(eventInfo),
false);
169 for(
const auto *el: *electrons) {
178 for(
const auto *mu: *muons) {
187 for(
const auto *
jet: *jets) {
195 for(
const auto *
jet: *jets) {
205 for(
const auto *ph: *photons) {
214 for(
const auto *trk: *tracks) {
221 if(this->
check2L(evt)) acceptEvent =
true;
223 if(this->
check4L(evt)) acceptEvent =
true;
225 if(this->
checkTP(evt)) acceptEvent =
true;
227 if(this->
check2L2Q(evt)) acceptEvent =
true;
238 if(!el)
return false;
243 if(electronQual!=
"any") {
246 if(electronQual==
"DFCommonElectronsLHVeryLoose" or
247 electronQual==
"DFCommonElectronsLHLoose" or
248 electronQual==
"DFCommonElectronsLHMedium" or
249 electronQual==
"DFCommonElectronsLHTight" or
250 electronQual==
"DFCommonElectronsML") {
257 value =
static_cast<bool>(qualAcc(*el));
261 defined = el->passSelection(value, electronQual);
263 if(not(value and defined))
return false;
271 uint8_t numberOfPixelHits(0);
273 ATH_MSG_WARNING(
"xAOD::TrackParticle does not give summaryValue correctly for xAOD::numberOfPixelHits");
276 uint8_t numberOfSCTHits(0);
278 ATH_MSG_WARNING(
"xAOD::TrackParticle does not give summaryValue correctly for xAOD::numberOfSCTHits");
281 if(numberOfPixelHits+numberOfSCTHits==0)
return false;
289 double eta(trackParticle->
eta());
290 if(fabs(
eta)>10.)
return false;
291 double et(caloCluster->
e()/cosh(
eta));
293 if(
et<electronEtCut)
return false;
301 if(!mu)
return false;
306 if(muonQual==
"any") {
308 }
else if(muonQual==
"combined") {
309 if(mu->muonType()!=xAOD::Muon::Combined)
return false;
310 }
else if(muonQual==
"standalone") {
311 if(mu->muonType()!=xAOD::Muon::MuonStandAlone)
return false;
312 }
else if(muonQual==
"lowpt") {
313 if(mu->muonType()!=xAOD::Muon::SegmentTagged)
return false;
314 }
else if(muonQual==
"combined+lowpt") {
315 if(mu->muonType()!=xAOD::Muon::Combined and mu->muonType()!=xAOD::Muon::SegmentTagged)
return false;
316 }
else if(muonQual==
"inMS") {
317 if(mu->muonType()==xAOD::Muon::MuonStandAlone and fabs(fabs(mu->eta())-2.6)>0.12)
return false;
318 }
else if(muonQual==
"DFCommonGoodMuon") {
320 if(!DFCommonGoodMuonAcc.
withDefault(*mu,
false))
return false;
321 }
else if(muonQual==
"DFCommonMuonsLoose") {
323 if(!DFCommonMuonsLooseAcc.
withDefault(*mu,
false))
return false;
324 }
else if(muonQual==
"DFCommonMuonsMedium") {
326 if(!DFCommonMuonsMediumAcc.
withDefault(*mu,
false))
return false;
327 }
else if(muonQual==
"DFCommonMuonsTight") {
329 if(!DFCommonMuonsTightAcc.
withDefault(*mu,
false))
return false;
335 if(mu->pt()<muonPtCut)
return false;
337 if(muonQual!=
"DFCommonGoodMuon" and
338 (mu->muonType()==xAOD::Muon::CaloTagged and fabs(mu->eta())>
m_caloMuonEtaCut))
return false;
345 if(!
jet)
return false;
360 if(!
jet)
return false;
374 if(!ph)
return false;
382 if(!value)
return false;
393 if(!trk)
return false;
403 if(!(evt.goodJets.size()>=
m_nJets and evt.goodPhotons.size()>=
m_nPhotons))
return false;
406 for(
unsigned int i(0); i<
m_trigger2L.size(); i++) {
408 isTriggerFired =
true;
412 if(!isTriggerFired)
return false;
414 unsigned int nGoodLeptons(evt.goodElectrons.size()+evt.goodMuons.size());
415 std::vector<TLorentzVector> v_tlv(nGoodLeptons);
416 std::vector<bool> v_isElectron(nGoodLeptons);
417 std::vector<bool> v_isTight(nGoodLeptons);
419 for(
unsigned int el_i(0); el_i<evt.goodElectrons.size(); el_i++) {
422 v_tlv.at(el_i) = tlv;
423 v_isElectron.at(el_i) =
true;
427 for(
unsigned int mu_i(0); mu_i<evt.goodMuons.size(); mu_i++) {
430 unsigned int mu_j(evt.goodElectrons.size()+mu_i);
431 v_tlv.at(mu_j) = tlv;
432 v_isElectron.at(mu_j) =
false;
436 for(
unsigned int i0(0); i0<nGoodLeptons; i0++) {
437 for(
unsigned int i1(i0+1); i1<nGoodLeptons; i1++) {
440 TLorentzVector tlv_2lep(v_tlv.at(i0) + v_tlv.at(i1));
452 if(!(evt.goodJets.size()>=
m_nJets and evt.goodPhotons.size()>=
m_nPhotons))
return false;
454 unsigned int nGoodLeptons(evt.goodElectrons.size()+evt.goodMuons.size());
455 std::vector<TLorentzVector> v_tlv(nGoodLeptons);
456 std::vector<bool> v_pid(nGoodLeptons);
458 for(
unsigned int el_i(0); el_i<evt.goodElectrons.size(); el_i++) {
461 v_tlv.at(el_i) = tlv;
480 value =
static_cast<bool>(primEleAcc(*el));
487 v_pid.at(el_i) = (value and defined);
490 for(
unsigned int mu_i(0); mu_i<evt.goodMuons.size(); mu_i++) {
493 unsigned int mu_j(evt.goodElectrons.size()+mu_i);
494 v_tlv.at(mu_j) = tlv;
495 v_pid.at(mu_j) =
true;
498 for(
unsigned int i0(0); i0<nGoodLeptons; i0++) {
499 for(
unsigned int i1(i0+1); i1<nGoodLeptons; i1++) {
500 for(
unsigned int i2(i1+1); i2<nGoodLeptons; i2++) {
501 for(
unsigned int i3(i2+1); i3<nGoodLeptons; i3++) {
502 TLorentzVector tlv_4lep(v_tlv.at(i0) + v_tlv.at(i1) + v_tlv.at(i2) + v_tlv.at(i3));
507 if(fabs((v_tlv.at(i0)+v_tlv.at(i1)).M()-
s_MZ)<fabs((v_tlv.at(i2)+v_tlv.at(i3)).M()-
s_MZ)) {
508 if(v_pid.at(i0) and v_pid.at(i1))
return true;
510 if(v_pid.at(i2) and v_pid.at(i3))
return true;
512 if(fabs((v_tlv.at(i0)+v_tlv.at(i2)).M()-
s_MZ)<fabs((v_tlv.at(i1)+v_tlv.at(i3)).M()-
s_MZ)) {
513 if(v_pid.at(i0) and v_pid.at(i2))
return true;
515 if(v_pid.at(i1) and v_pid.at(i3))
return true;
517 if(fabs((v_tlv.at(i0)+v_tlv.at(i3)).M()-
s_MZ)<fabs((v_tlv.at(i1)+v_tlv.at(i2)).M()-
s_MZ)) {
518 if(v_pid.at(i0) and v_pid.at(i3))
return true;
520 if(v_pid.at(i1) and v_pid.at(i2))
return true;
535 for(
unsigned int i(0); i<
m_triggerTP.size(); i++) {
537 isTriggerFired =
true;
541 if(!isTriggerFired)
return false;
543 unsigned int nGoodLeptons(evt.goodElectrons.size()+evt.goodMuons.size());
544 std::vector<TLorentzVector> v_tlv(nGoodLeptons);
545 std::vector<bool> v_isElectron(nGoodLeptons);
547 for(
unsigned int el_i(0); el_i<evt.goodElectrons.size(); el_i++) {
550 v_tlv.at(el_i) = tlv;
551 v_isElectron.at(el_i) =
true;
554 for(
unsigned int mu_i(0); mu_i<evt.goodMuons.size(); mu_i++) {
557 unsigned int mu_j(evt.goodElectrons.size()+mu_i);
558 v_tlv.at(mu_j) = tlv;
559 v_isElectron.at(mu_j) =
false;
562 for(
unsigned int i0(0); i0<nGoodLeptons; i0++) {
563 for(
unsigned int i1(i0+1); i1<nGoodLeptons; i1++) {
564 if(v_isElectron.at(i0)!=v_isElectron.at(i1))
continue;
566 TLorentzVector tlv_2lep(v_tlv.at(i0) + v_tlv.at(i1));
585 isTriggerFired =
true;
589 if(!isTriggerFired)
return false;
597 if(!checkGoodJets)
return false;
599 unsigned int nGoodLeptons(evt.goodElectrons.size()+evt.goodMuons.size());
600 std::vector<TLorentzVector> v_tlv(nGoodLeptons);
601 std::vector<bool> v_isElectron(nGoodLeptons);
602 std::vector<bool> v_isTight(nGoodLeptons);
604 for(
unsigned int el_i(0); el_i<evt.goodElectrons.size(); el_i++) {
607 v_tlv.at(el_i) = tlv;
608 v_isElectron.at(el_i) =
true;
612 for(
unsigned int mu_i(0); mu_i<evt.goodMuons.size(); mu_i++) {
615 unsigned int mu_j(evt.goodElectrons.size()+mu_i);
616 v_tlv.at(mu_j) = tlv;
617 v_isElectron.at(mu_j) =
false;
621 for(
unsigned int i0(0); i0<nGoodLeptons; i0++) {
622 for(
unsigned int i1(i0+1); i1<nGoodLeptons; i1++) {
626 TLorentzVector tlv_2lep(v_tlv.at(i0) + v_tlv.at(i1));
631 if(v_isElectron.at(i0)) {
632 unsigned int nGoodJetsWithDRCut(0);
633 unsigned int nGoodJets(evt.goodJets.size());
634 for(
unsigned int j(0); j<nGoodJets; j++) {
644 nGoodJetsWithDRCut++;
647 bool checkGoodJetsWithDRCut(nGoodJetsWithDRCut>=
m_nJets and
m_nJets>0);
651 unsigned int nGoodMergedJetsWithDRCut(0);
652 unsigned int nGoodMergedJets(evt.goodMergedJets[
type].size());
653 for(
unsigned int j(0); j<nGoodMergedJets; j++) {
662 nGoodMergedJetsWithDRCut++;
665 checkGoodJetsWithDRCut = (checkGoodJetsWithDRCut or (nGoodMergedJetsWithDRCut>=
m_nMergedJets[
type]));
668 if(!checkGoodJetsWithDRCut)
return false;
682 if(!(evt.goodPhotons.size()>=
m_nPhotons))
return false;
687 isTriggerFired =
true;
691 if(!isTriggerFired)
return false;
693 std::vector<TLorentzVector> v_tlv(evt.goodMuons.size());
695 for(
unsigned int mu_i(0); mu_i<evt.goodMuons.size(); mu_i++) {
698 v_tlv.at(mu_i) = tlv;
701 unsigned int nGoodLeptons(v_tlv.size());
702 for(
unsigned int i0(0); i0<nGoodLeptons; i0++) {
703 for(
unsigned int i1(i0+1); i1<nGoodLeptons; i1++) {
704 TLorentzVector tlv_2lep(v_tlv.at(i0) + v_tlv.at(i1));
711 if((v_tlv.at(i0).Pt()>v_tlv.at(i1).Pt() ? v_tlv.at(i0).Pt() : v_tlv.at(i1).Pt())>
m_leadingMuonPtCut)
return true;
722 if(!(evt.goodPhotons.size()>=
m_nPhotons))
return false;
728 isTriggerFired =
true;
732 if(!isTriggerFired)
return false;
735 std::vector<TLorentzVector> v_tlv[2];
736 for(
unsigned int trk_i(0); trk_i<evt.goodTracks.size(); trk_i++) {
740 v_tlv[trk->
charge()>0. ? 0 : 1].push_back(tlv);
744 unsigned int nGoodTracks[2];
745 nGoodTracks[0] = v_tlv[0].size();
746 nGoodTracks[1] = v_tlv[1].size();
747 for(
unsigned int i0(0); i0<nGoodTracks[0]; i0++) {
748 for(
unsigned int i1(0); i1<nGoodTracks[1]; i1++) {
749 TLorentzVector tlv_2trk(v_tlv[0].at(i0) + v_tlv[1].at(i1));
761 tlv.SetPtEtaPhiE(el->pt(), el->eta(), el->phi(), el->e());
775 double eta(trackParticle->
eta());
776 double phi(trackParticle->
phi());
781 double e(caloCluster->
e());
782 double et(e/cosh(
eta));
791 tlv.SetPtEtaPhiM(mu->pt(), mu->eta(), mu->phi(), mu->m());
804 const float& pt =DFCommonJets_Calib_ptAcc(*
jet);
805 const float&
eta=DFCommonJets_Calib_etaAcc(*
jet);
806 const float&
phi=DFCommonJets_Calib_phiAcc(*
jet);
807 const float& m =DFCommonJets_Calib_mAcc(*
jet);
808 tlv.SetPtEtaPhiM(pt,
eta,
phi, m);
811 tlv.SetPtEtaPhiM(
jet->pt(),
jet->eta(),
jet->phi(),
jet->m());
818 double dEta(eta1 - eta2);
819 double dPhi(phi1 - phi2);
822 double dR(sqrt(dEta*dEta + dPhi*dPhi));
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi 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.
float et(const xAOD::jFexSRJetRoI *j)
A number of constexpr particle constants to avoid hardcoding them directly in various places.
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_reference_type withDefault(const ELT &e, const T &deflt) const
Fetch the variable for one element, as a const reference, with a default.
virtual double e() const
The total energy of the particle.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
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...
@ LAr
The LAr calorimeter.
@ Error
The sub-detector issued an error.
EventFlagErrorState errorState(EventFlagSubDet subDet) const
Get the error state for a particular sub-detector.
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
bool summaryValue(uint8_t &value, const SummaryType &information) const
Accessor for TrackSummary values.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
float charge() const
Returns the charge.
constexpr double chargedKaonMassInMeV
the mass of the charged kaon (in MeV)
constexpr double ZMassInMeV
the mass of the Z0 boson (in MeV)
Jet_v1 Jet
Definition of the current "jet version".
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
EventInfo_v1 EventInfo
Definition of the latest event info version.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
Muon_v1 Muon
Reference the current persistent version:
Photon_v1 Photon
Definition of the current "egamma version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
Electron_v1 Electron
Definition of the current "egamma version".
Extra patterns decribing particle interation process.