ATLAS Offline Software
Loading...
Searching...
No Matches
TrigMuonEFInvMassHypoTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "GaudiKernel/SystemOfUnits.h"
9
10TrigMuonEFInvMassHypoTool::TrigMuonEFInvMassHypoTool(const std::string & type, const std::string & name, const IInterface* parent):
11 ComboHypoToolBase(type, name, parent)
12{ }
13
16
18if(m_acceptAll) {
19 ATH_MSG_DEBUG("Accepting all the events!");
20 } else {
21 if(m_invMassLow<0 && m_invMassHigh<0){
22 ATH_MSG_ERROR("Both mass cuts are <0. This is probably a configuration mistake.");
23 return StatusCode::FAILURE;
24 }
25 }
26 if ( not m_monTool.name().empty() ) {
27 ATH_CHECK( m_monTool.retrieve() );
28 ATH_MSG_DEBUG("MonTool name: " << m_monTool);
29 }
30 ATH_MSG_DEBUG("Initialization completed successfully");
31 return StatusCode::SUCCESS;
32}
33
34bool TrigMuonEFInvMassHypoTool::executeAlg(const std::vector<Combo::LegDecision>& combination, const EventContext& /*ctx*/) const{
35
36 //Monitored Variables
37 std::vector<float> fexInvMass, fexInvMassSel;
38 auto muonMassMon = Monitored::Collection("Mass", fexInvMass);
39 auto muonMassSelMon = Monitored::Collection("Mass_sel", fexInvMassSel);
40 auto monitorIt = Monitored::Group(m_monTool, muonMassMon, muonMassSelMon);
41
42 bool result = false;
43
44 //for pass through mode
45 if(m_acceptAll) {
46 result = true;
47 ATH_MSG_DEBUG("Accept property is set: taking all the events");
48 return result;
49 }
50
51 std::vector<const xAOD::Muon*> selected_muons;
52 for(auto el: combination){
53 auto EL= el.second;
54 auto dec= (*EL);
56 for(size_t i=0; i<muonLinks.size(); i++){
57 if(muonLinks.at(i).isValid()){
58 const xAOD::Muon *mu = *(muonLinks.at(i).link);
59 if(mu->primaryTrackParticle()) selected_muons.push_back(mu);
60 }
61 }
62 }
63
64
65 // decision making
66 // Loop over muons passing previous hypo
67 for(size_t i=0; i<selected_muons.size(); i++){
68 const xAOD::Muon* muon1 = selected_muons[i];
69
70 for(size_t j=i+1; j<selected_muons.size(); j++){
71 const xAOD::Muon* muon2 = selected_muons[j];
72
73 //We always get muons from previous decision that have combined track particles
74 const xAOD::TrackParticle* tr1 = muon1->trackParticle(xAOD::Muon::TrackParticleType::CombinedTrackParticle);
75 const xAOD::TrackParticle* tr2 = muon2->trackParticle(xAOD::Muon::TrackParticleType::CombinedTrackParticle);
76 if (!tr1 || !tr2) {
77 ATH_MSG_DEBUG("No CombinedTrackParticle found.");
78 } else {
79 ATH_MSG_DEBUG("Retrieved CombinedTrack tracks with abs pt "<< (*tr1).pt()/Gaudi::Units::GeV << " GeV and "<< (*tr2).pt()/Gaudi::Units::GeV << " GeV ");
80
81 float diMuMass = (tr1->p4()+tr2->p4()).M()/Gaudi::Units::GeV;
82
83 //fill monitored variables
84 fexInvMass.push_back(diMuMass);
85
86 ATH_MSG_DEBUG(" REGTEST diMuon mass is " << diMuMass << " GeV "
87 << " and lowMassCut cut is " << m_invMassLow << " GeV"
88 << " and highMassCut cut is " << m_invMassHigh << " GeV");
89
90 //Apply hypo cuts. If any mass combination is true, then the overall result should be true.
91 if(m_invMassLow>0 && diMuMass>m_invMassLow && m_invMassHigh>0 && diMuMass<m_invMassHigh){
92 if(m_selOS){
93 if(muon1->charge()*muon2->charge()<0){
94 result=true;
95 }
96 } else {
97 result = true;
98 }
99 //fill monitored variables
100 fexInvMassSel.push_back(diMuMass);
101 }
102 }
103 }
104 }
105
106 ATH_MSG_DEBUG("Overall result is: "<<(result?"true":"false"));
107 return result;
108}
109
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
Header file to be included by clients of the Monitored infrastructure.
ComboHypoToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Group of local monitoring quantities and retain correlation when filling histograms
Gaudi::Property< double > m_invMassLow
Gaudi::Property< bool > m_acceptAll
bool executeAlg(const std::vector< Combo::LegDecision > &combination, const EventContext &ctx) const override
Only a dummy implementation exists in ComboHypoToolBase.
TrigMuonEFInvMassHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
ToolHandle< GenericMonitoringTool > m_monTool
virtual StatusCode initialize() override
Gaudi::Property< double > m_invMassHigh
float charge() const
const TrackParticle * trackParticle(TrackParticleType type) const
Returns a pointer (which can be NULL) to the TrackParticle used in identification of this muon.
Definition Muon_v1.cxx:482
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
This module defines the arguments passed from the BATCH driver to the BATCH worker.
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
const std::string & featureString()
void findLinks(const Decision *start, const std::string &linkName, std::vector< LinkInfo< T > > &links, unsigned int behaviour=TrigDefs::allFeaturesOfType, std::set< const xAOD::TrigComposite * > *fullyExploredFrom=nullptr)
search back the TC links for the object of type T linked to the one of TC (recursively) Populates pro...
static const unsigned int lastFeatureOfType
Run 3 "enum". Only return the final feature along each route through the navigation.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Muon_v1 Muon
Reference the current persistent version: