ATLAS Offline Software
Loading...
Searching...
No Matches
TrigBmumuxComboHypoTool.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
7
11
12TrigBmumuxComboHypoTool::TrigBmumuxComboHypoTool(const std::string& type, const std::string& name, const IInterface* parent)
13 : ComboHypoToolBase(type, name, parent) {}
14
15
17{
18 if (!m_monTool.empty()) {
19 ATH_CHECK( m_monTool.retrieve() );
20 ATH_MSG_DEBUG( "GenericMonitoringTool name:" << m_monTool );
21 }
22 else {
23 ATH_MSG_DEBUG( "No GenericMonitoringTool configured: no monitoring histograms will be available" );
24 }
25
26 ATH_MSG_DEBUG( "Initialization completed successfully" );
27
28 return StatusCode::SUCCESS;
29}
30
31
33
34 using namespace Monitored;
35
36 auto mon_chi2 = Monitored::Scalar<float>("Chi2", -1.);
37 auto mon_fitmass = Monitored::Scalar<float>("Fitmass", -1.);
38 auto mon_mass = Monitored::Scalar<float>("Mass", -1.);
39 auto mon_pt = Monitored::Scalar<float>("Pt", -1.);
40 auto mon_eta = Monitored::Scalar<float>("Eta", -100.);
41 auto group = Monitored::Group(m_monTool, mon_chi2, mon_fitmass, mon_mass, mon_pt, mon_eta);
42
43 ATH_MSG_DEBUG( "in TrigBmumuxComboHypoTool::decideOnSingleObject(), looking at TrigBphys object");
44
45 bool result = false;
46
47 if (static_cast<int>(trigBphys->particleType()) == m_decay) {
48 result = true;
49 ATH_MSG_DEBUG("accepting event");
50 }
51
52 if (result) {
53 mon_chi2 = trigBphys->fitchi2();
54 mon_fitmass = trigBphys->fitmass();
55 mon_mass = trigBphys->mass();
56 mon_pt = trigBphys->pt();
57 mon_eta = trigBphys->eta();
58 }
59
60 return result;
61}
62
63
64StatusCode TrigBmumuxComboHypoTool::decideOnSingleObject(Decision* decision, const std::vector<const DecisionIDContainer*>& previousDecisionIDs) const {
65
67
69 ATH_CHECK( trigBphysEL.isValid() );
70
71 const std::vector<HLT::Identifier>& legDecisionIDs = legDecisionIds();
72 if (m_isBmux) { // bBmux chain: only one previousDecision is available, in case of assymmetric chain it should match to one arbitrary leg
73 ATH_CHECK( previousDecisionIDs.size() == 1 );
74 bool passed = false;
75 for (size_t i = 0; i < legDecisionIDs.size(); ++i) {
76 const DecisionID id = legDecisionIDs[i].numeric();
77 if (TrigCompositeUtils::passed(id, *previousDecisionIDs[0])) {
78 passed = true;
79 break;
80 }
81 }
82 if (!passed) {
83 ATH_MSG_DEBUG( "bBmux chain did not match to the previous decisions" );
84 return StatusCode::SUCCESS;
85 }
86 }
87 else if (legDecisionIDs.size() == 1) { // bBmumux chain with symmetric legs
88 auto n = static_cast<size_t>(legMultiplicity().at(0));
89 ATH_CHECK( previousDecisionIDs.size() == n );
90 const DecisionID id = legDecisionIDs[0].numeric();
91 for (size_t i = 0; i < n; ++i) {
92 if (!TrigCompositeUtils::passed(id, *previousDecisionIDs[i])) {
93 ATH_MSG_DEBUG( "bBmumux chain with symmetric legs did not match to the previous decisions" );
94 return StatusCode::SUCCESS;
95 }
96 }
97 }
98 else if (legDecisionIDs.size() == 2) { // bBmumux chain with asymmetric legs
99 ATH_CHECK( previousDecisionIDs.size() == 2 );
100 bool direct = true;
101 bool inverse = true;
102 for (size_t i = 0; i < 2; ++i) {
103 if (direct && !TrigCompositeUtils::passed(legDecisionIDs.at(i).numeric(), *previousDecisionIDs.at(i))) direct = false;
104 if (inverse && !TrigCompositeUtils::passed(legDecisionIDs.at(i).numeric(), *previousDecisionIDs.at(1-i))) inverse = false;
105 }
106 if (!direct && !inverse) {
107 ATH_MSG_DEBUG( "bBmumux chain with asymmetric legs matched to the previous decisions neither direct nor inverse way" );
108 return StatusCode::SUCCESS;
109 }
110 }
111 else {
112 ATH_MSG_ERROR( "TrigBmumuxComboHypoTool can not check previous decisions for " << name() );
113 return StatusCode::FAILURE;
114 }
115
116 if (passed(*trigBphysEL)) {
118 }
119
120 return StatusCode::SUCCESS;
121}
122
123
124bool TrigBmumuxComboHypoTool::executeAlg(const std::vector<Combo::LegDecision>&, const EventContext&) const {
125 ATH_MSG_ERROR("executeAlg not supported for TrigBmumuxComboHypoTool.");
126 return true;
127}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
const std::vector< int > & legMultiplicity() const
Gets the number of legs and the multiplicity required on each leg.
ComboHypoToolBase(const std::string &type, const std::string &name, const IInterface *parent)
virtual HLT::Identifier decisionId() const
retrieves this ComboHypoTool's chain's decision ID
const std::vector< HLT::Identifier > & legDecisionIds() const
Retrieves this ComboHypoTool's chain's decision IDs for all legs.
Group of local monitoring quantities and retain correlation when filling histograms
Declare a monitored scalar variable.
virtual bool executeAlg(const std::vector< Combo::LegDecision > &, const EventContext &ctx) const override
Only a dummy implementation exists in ComboHypoToolBase.
virtual StatusCode decideOnSingleObject(TrigCompositeUtils::Decision *, const std::vector< const TrigCompositeUtils::DecisionIDContainer * > &) const override
Alternate method called by BPhysics ComboHypoAlgs instead of the base method decide(....
bool passed(const xAOD::TrigBphys *) const
ToolHandle< GenericMonitoringTool > m_monTool
virtual StatusCode initialize() override
Gaudi::Property< bool > m_isBmux
Gaudi::Property< int > m_decay
TrigBmumuxComboHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
float pt() const
accessor method: pt
float eta() const
accessor method: eta
pType particleType() const
accessor method: particle Type
float fitchi2() const
accessor method: chi2 from vertex fit
float fitmass() const
accessor method: mass from vertex fit
float mass() const
accessor method: mass
bool hasObjectLink(const std::string &name, const CLID clid=CLID_NULL) const
Check if a link to an object with a given name and type exists. CLID_NULL to not check type.
ElementLink< CONTAINER > objectLink(const std::string &name) const
Get the link with the requested name.
Generic monitoring tool for athena components.
unsigned int DecisionID
const std::string & featureString()
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
std::set< DecisionID > DecisionIDContainer
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
TrigBphys_v1 TrigBphys
Definition TrigBphys.h:18
TrigBphysContainer_v1 TrigBphysContainer