11 m_trigdec(
"Trig::TrigDecisionTool/TrigDecisionTool"),
12 m_matchTool(
"Trig::TrigEgammaMatchingToolMT/TrigEgammaMatchingToolMT")
34 std::vector<std::string> steps = {
"L1Calo",
"L2Calo",
"L2",
"EFCalo",
"EFTrack",
"HLT"};
35 for(
const auto& step:steps)
40 return StatusCode::SUCCESS;
51 const auto& ctx = Gaudi::Hive::currentContext() ;
52 if (pidname ==
"tight"){
55 else if (pidname ==
"medium"){
58 else if (pidname ==
"loose"){
61 else if (pidname ==
"lhtight"){
65 else if (pidname ==
"lhmedium"){
69 else if (pidname ==
"lhloose"){
73 else if (pidname ==
"lhvloose"){
76 else if (pidname ==
"dnntight"){
80 else if (pidname ==
"dnnmedium"){
84 else if (pidname ==
"dnnloose"){
99 const auto& ctx = Gaudi::Hive::currentContext() ;
100 if (pidname ==
"tight"){
103 else if (pidname ==
"medium"){
106 else if (pidname ==
"loose"){
123 ATH_MSG_DEBUG(
"Electron doesn't provide isolation for ptcone20");
126 if (!(fabs(eg->pt()) > 0)) {
127 ATH_MSG_DEBUG(
"Electron pt is zero, can't calculate relative isolation");
131 float ptcone20_rel = ptcone20/eg->pt();
133 if (isolation ==
"loose"){
134 if (ptcone20_rel > 0.1) {
143 ATH_MSG_DEBUG(
"No valid working point defined for " << isolation <<
" continue without isolation");
152 bool efprescale=
false;
153 bool l1prescale=
false;
156 std::string l1item=
"";
158 if(trigger.starts_with(
"L1" ))
160 if(trigger.starts_with(
"HLT")){
162 const unsigned int bit=
tdt()->isPassedBits(trigger);
163 efprescale=bit & TrigDefs::EF_prescaled;
164 rerun=bit&TrigDefs::EF_resurrected;
168 ATH_MSG_DEBUG(
"Checking prescale for " << trigger <<
" " << l1item);
169 const unsigned int l1bit=
tdt()->isPassedBits(l1item);
170 bool l1_afterpre=l1bit&TrigDefs::L1_isPassedAfterPrescale;
171 bool l1_beforepre=l1bit&TrigDefs::L1_isPassedBeforePrescale;
172 l1prescale=l1_beforepre && !l1_afterpre;
173 prescale=efprescale || l1prescale;
174 ATH_MSG_DEBUG(
"L1 prescale " << l1item <<
" " << l1prescale <<
" before " << l1_beforepre <<
" after " << l1_afterpre);
175 ATH_MSG_DEBUG(
"EF prescale " << trigger <<
" " << efprescale <<
" Prescale " << prescale);
176 if(rerun)
return false;
177 if(prescale)
return true;
187 unsigned int condition=TrigDefs::includeFailedDecisions;
191 bool passedL1Calo=
false;
192 bool passedL2Calo=
false;
193 bool passedEFCalo=
false;
195 bool passedEFTrk=
false;
199 auto trigger = info.trigger;
211 if(info.signature ==
"Electron"){
212 std::string key =
match()->key(
"FastElectrons");
213 if(info.lrt) key =
match()->key(
"FastElectrons_LRT");
215 }
else if(info.signature ==
"Photon"){
222 std::string key =
match()->key(
"PrecisionCalo_Electron");
223 if(info.signature ==
"Photon") key =
match()->key(
"PrecisionCalo_Photon");
224 if(info.lrt) key =
match()->key(
"PrecisionCalo_LRT");
225 if(info.ion) key =
match()->key(
"PrecisionCalo_HI");
235 if(info.signature ==
"Electron"){
236 if( info.etcut || info.idperf){
239 std::string key =
match()->key(
"Electrons_GSF");
240 if(info.lrt) key =
match()->key(
"Electrons_LRT");
241 if(info.nogsf) key =
match()->key(
"Electrons");
245 }
else if(info.signature ==
"Photon"){
259 if(info.signature ==
"Electron"){
260 if( info.etcut || info.idperf){
263 std::string key =
match()->key(
"Electrons_GSF");
264 if(info.lrt) key =
match()->key(
"Electrons_LRT");
265 if(info.nogsf) key =
match()->key(
"Electrons");
269 }
else if(info.signature ==
"Photon"){
299 float deta = fabs(eta1 - eta2);
300 float dphi = fabs(phi1 - phi2) < TMath::Pi() ? fabs(phi1 - phi2) : 2*TMath:: \
301 Pi() - fabs(phi1 - phi2);
302 return sqrt(deta*deta + dphi*dphi);
309 if(eg && (eg->caloCluster())){
311 return fabs(cluster->
etaBE(2));
318 if(eg && (eg->caloCluster()) && (eg->trackParticle())){
321 float eta = fabs(trk->
eta());
322 return clus->
e()/cosh(
eta);
329 if(eg && (eg->caloCluster())){
331 float eta2 = fabs(cluster->
etaBE(2));
332 return cluster->
e()/cosh(eta2);
344 float den = emax+emax2;
346 if (fabs(den) < 1e-6)
return -99.;
348 float val = (emax-emax2)/(den);
356 if(eg && eg->trackParticle()){
359 uint8_t trtHTHits = 0;
361 if (fabs(trtHits) < 1e-6) {
365 return ( (
double)trtHTHits / (
double)trtHits );
377 float vard0 = t->definingParametersCovMatrix()(0,0);
379 d0sigma=sqrtf(vard0);
393 float vard0 = t->definingParametersCovMatrix()(0,0);
395 d0sigma=sqrtf(vard0);
399 if (fabs(d0sigma) < 1e-6)
return -99.;
400 return t->d0()/d0sigma;
407 if(eg && (eg->caloCluster())){
416 if(eg && (eg->caloCluster())){
425 if(eg && (eg->caloCluster())){
434 if(eg && (eg->caloCluster())){
443 if(eg && (eg->caloCluster())){
448 return (ebe1+ebe2+ebe3);
455 if(eg && (eg->caloCluster())){
461 float eacc = ebe1+ebe2+ebe3;
462 if(eacc==0.)
return 0.;
470#define GETTER(_name_) float TrigEgammaMonitorBaseAlgorithm::getShowerShape_##_name_(const xAOD::Egamma* eg) const \
472 eg->showerShapeValue(val,xAOD::EgammaParameters::_name_); \
500#define GETTER(_name_) float TrigEgammaMonitorBaseAlgorithm::getIsolation_##_name_(const xAOD::Electron* eg) const\
502 eg->isolationValue(val,xAOD::Iso::_name_); \
513#define GETTER(_name_) float TrigEgammaMonitorBaseAlgorithm::getIsolation_##_name_(const xAOD::Egamma* eg) const\
515 eg->isolationValue(val,xAOD::Iso::_name_); \
528#define GETTER(_name_) float TrigEgammaMonitorBaseAlgorithm::getCluster_##_name_(const xAOD::Egamma* eg) const\
529{ if(eg && eg->caloCluster()) \
530 return eg->caloCluster()->_name_(); \
539#define GETTER(_name_) float TrigEgammaMonitorBaseAlgorithm::getTrack_##_name_(const xAOD::Electron* eg) const\
540{ if(eg && eg->trackParticle()) \
541 return eg->trackParticle()->_name_(); \
552#define GETTER(_name_) float TrigEgammaMonitorBaseAlgorithm::getTrackSummary_##_name_(const xAOD::Electron* eg) const \
553{ uint8_t val_uint8{0}; \
555 eg->trackParticleSummaryValue(val_uint8,xAOD::_name_); \
556 return val_uint8; } \
558 GETTER(numberOfInnermostPixelLayerHits)
559 GETTER(numberOfInnermostPixelLayerOutliers)
561 GETTER(numberOfPixelOutliers)
563 GETTER(numberOfSCTOutliers)
565 GETTER(numberOfTRTHighThresholdHits)
566 GETTER(numberOfTRTHighThresholdOutliers)
567 GETTER(numberOfTRTOutliers)
568 GETTER(expectInnermostPixelLayerHit)
569 GETTER(numberOfPixelDeadSensors)
570 GETTER(numberOfSCTDeadSensors)
571 GETTER(numberOfTRTXenonHits)
575#define GETTER(_name_) float TrigEgammaMonitorBaseAlgorithm::getTrackSummaryFloat_##_name_(const xAOD::Electron* eg) const\
576{ float val_float{0}; \
578 eg->trackParticleSummaryValue(val_float,xAOD::_name_); \
579 return val_float; } \
588#define GETTER(_name_) float TrigEgammaMonitorBaseAlgorithm::getCaloTrackMatch_##_name_(const xAOD::Electron* eg) const\
591 eg->trackCaloMatchValue(val,xAOD::EgammaParameters::_name_);} \
643 std::map<std::string, std::string> pidMap = { {
"vloose" ,
"loose" },
644 {
"loose" ,
"loose" },
645 {
"medium" ,
"medium" },
646 {
"tight" ,
"tight" },
647 {
"loose1" ,
"loose" },
648 {
"medium1" ,
"medium" },
649 {
"tight1" ,
"tight" },
650 {
"lhvloose" ,
"lhvloose" },
651 {
"lhloose" ,
"lhloose" },
652 {
"lhmedium" ,
"lhmedium" },
653 {
"lhtight" ,
"lhtight" },
654 {
"dnnloose" ,
"dnnloose" },
655 {
"dnnmedium",
"dnnmedium"},
656 {
"dnntight" ,
"dnntight" },
657 {
"nopid" ,
"nopid" } };
659 std::vector<std::string> isoNames = {
"ivarloose",
"ivarmedium",
"ivartight",
"icaloloose",
"icalomedium",
"icalotight"};
666 bool isolated =
false;
668 std::string isolation=
"";
671 std::string hltinfo=trigger;
672 std::string signature =
"";
675 if(boost::contains(hltinfo,
"HLT")) hltinfo.erase(0,4);
678 std::vector<std::string> parts;
679 boost::split(parts,hltinfo,boost::is_any_of(
"_"));
683 if(boost::contains(parts.at(0),
"e")) {
684 signature =
"Electron";
686 }
else if(boost::contains(parts.at(0),
"g")) {
687 signature =
"Photon";
694 if(parts.at(1) ==
"idperf"){
698 else if( parts.at(1)==
"etcut"){
704 if (pidMap.count(parts.at(1)) != 1) {
705 ATH_MSG_ERROR(
"Unknown trigger type: " << parts.at(1) <<
" (" << trigger <<
")");
707 pidname = pidMap.at(parts.at(1));
712 nogsf = boost::contains(trigger,
"nogsf");
713 lrt = boost::contains(trigger,
"lrt");
714 ion = boost::contains(trigger,
"ion");
716 for(
auto& iso : isoNames){
717 if(boost::contains(trigger, iso)){
718 isolation=iso; isolated=
true;
break;
723 std::string str_thr = parts.at(0);
724 str_thr.erase( 0, 1);
729 l1legacy = !boost::contains(l1seed,
"eEM");
732 ATH_MSG_DEBUG(
"=================== Chain Parser =======================");
744 ATH_MSG_DEBUG(
"L1Seed : " << l1seed <<
" (Is Legacy? " << (l1legacy?
"Yes":
"No") <<
")");
745 ATH_MSG_DEBUG(
"========================================================");
747 TrigInfo info{l1legacy,l1seed,trigger,signature,
threshold,pidname,idperf,etcut,nogsf,lrt,ion,isolation,isolated};
755 std::vector<std::string> parts;
756 boost::split(parts,trigger,boost::is_any_of(
"_"));
758 std::string l1seed = parts.back();
764 return m_trigdec->ExperimentalAndExpertMethods().isHLTTruncated();
773#include "Gaudi/Parsers/Factory.h"
786#include "GaudiKernel/ToStream.h"
793 for (
const auto& dict : vecDict ) {
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define GETTER(_name_)
Macros for plotting.
struct _triginfo TrigInfo
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
virtual StatusCode initialize() override
initialize
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Gaudi::Property< bool > m_doEffwithDNN
float getEnergyBE2(const xAOD::Egamma *eg) const
bool ApplyPhotonPid(const xAOD::Photon *eg, const std::string &) const
Get offline electron decision.
ToolHandleArray< IAsgElectronLikelihoodTool > m_electronLHTool
Offline LH Selectors.
float getEnergyBE3(const xAOD::Egamma *eg) const
float getSigmaD0(const xAOD::Electron *eg) const
std::map< std::string, TrigInfo > m_trigInfo
creates map of trigger name and TrigInfo struct
float getEtCluster37(const xAOD::Egamma *eg) const
TrigEgammaMonitorBaseAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
const ToolHandle< TrigEgammaMatchingToolMT > & match() const
Get the e/g match tool.
Gaudi::Property< std::string > m_defaultProbePidPhoton
default probe pid for photon trigitems that don't have pid in their name
float dR(const float, const float, const float, const float) const
Get delta R.
float getEnergyBE1(const xAOD::Egamma *eg) const
float getDEmaxs1(const xAOD::Egamma *eg) const
float rTRT(const xAOD::Electron *eg) const
ToolHandle< TrigEgammaMatchingToolMT > m_matchTool
bool isHLTTruncated() const
Gaudi::Property< bool > m_doEffwithLH
const ToolHandle< Trig::TrigDecisionTool > & tdt() const
Get the TDT.
float getE0Eaccordion(const xAOD::Egamma *eg) const
Gaudi::Property< std::string > m_defaultProbePidElectron
default probe pid for electron trigitems that don't have pid in their name
ToolHandleArray< IAsgPhotonIsEMSelector > m_photonIsEMTool
Offline isEM Photon Selectors.
ToolHandle< Trig::TrigDecisionTool > m_trigdec
Trigger decision tool.
float getEt(const xAOD::Electron *eg) const
ToolHandleArray< IAsgElectronIsEMSelector > m_electronIsEMTool
Offline isEM Selectors.
bool ApplyElectronPid(const xAOD::Electron *eg, const std::string &) const
Get offline electron decision.
asg::AcceptData setAccept(const TrigCompositeUtils::Decision *, const TrigInfo &, const bool) const
Set the accept object for all trigger levels.
virtual ~TrigEgammaMonitorBaseAlgorithm()
bool isPrescaled(const std::string &) const
Check if the event is prescaled.
virtual StatusCode initialize() override
initialize
TrigInfo getTrigInfo(const std::string &) const
Get the trigger info parsed from the chain name (only single lepton triggers)
bool isIsolated(const xAOD::Electron *, const std::string &) const
Check if electron fulfils isolation criteria.
void setTrigInfo(const std::string &)
Set the trigger info parsed from the chain name.
float getD0sig(const xAOD::Electron *eg) const
float getEta2(const xAOD::Egamma *eg) const
Features helper.
float getEaccordion(const xAOD::Egamma *eg) const
std::string getL1Item(const std::string &trigger) const
Creates static map to return L1 item from trigger name.
ToolHandle< Trig::TrigEgammaEmulationToolMT > m_emulatorTool
float getEnergyBE0(const xAOD::Egamma *eg) const
ToolHandleArray< IAsgElectronLikelihoodTool > m_electronDNNTool
Offline DNN Selectors.
void setCutResult(const std::string &cutName, bool cutResult)
Set the result of a cut, based on the cut name (safer)
virtual double e() const
The total energy of the particle.
float energyBE(const unsigned layer) const
Get the energy in one layer of the EM Calo.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
std::vector< Dict_t > VecDict_t
StatusCode parse(std::tuple< Tup... > &tup, const Gaudi::Parsers::InputData &input)
std::ostream & toStream(const SG::VarHandleKeyArray &v, std::ostream &o)
Gaudi function used to convert a property to a string.
=============================================================================
xAOD::TrigComposite Decision
ostream & operator<<(ostream &s, const SG::VarHandleKey &m)
@ emaxs1
energy of strip with maximal energy deposit
@ e2tsts1
energy of the cell corresponding to second energy maximum in the first sampling
@ ptcone20
Track isolation.
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
TrigElectronContainer_v1 TrigElectronContainer
Declare the latest version of the container.
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
TrigEMClusterContainer_v1 TrigEMClusterContainer
Define the latest version of the trigger EM cluster container.
TrigPhotonContainer_v1 TrigPhotonContainer
Declare the latest version of the container.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Egamma_v1 Egamma
Definition of the current "egamma version".
Photon_v1 Photon
Definition of the current "egamma version".
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
@ numberOfTRTHits
number of TRT hits [unit8_t].
@ numberOfTRTHighThresholdHits
number of TRT hits which pass the high threshold (only xenon counted) [unit8_t].
Electron_v1 Electron
Definition of the current "egamma version".
Extra patterns decribing particle interation process.