ATLAS Offline Software
TrigBmumuxComboHypoTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
11 
12 TrigBmumuxComboHypoTool::TrigBmumuxComboHypoTool(const std::string& type, const std::string& name, const IInterface* 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 
32 bool TrigBmumuxComboHypoTool::passed(const xAOD::TrigBphys* trigBphys) const {
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 
64 StatusCode TrigBmumuxComboHypoTool::decideOnSingleObject(Decision* decision, const std::vector<const DecisionIDContainer*>& previousDecisionIDs) const {
65 
66  ATH_CHECK( decision->hasObjectLink(TrigCompositeUtils::featureString()) );
67 
68  auto trigBphysEL = decision->objectLink<xAOD::TrigBphysContainer>(TrigCompositeUtils::featureString());
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 
124 bool TrigBmumuxComboHypoTool::executeAlg(const std::vector<Combo::LegDecision>&) const {
125  ATH_MSG_ERROR("executeAlg not supported for TrigBmumuxComboHypoTool.");
126  return true;
127 }
DeMoSetup.direct
string direct
Definition: DeMoSetup.py:115
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
get_generator_info.result
result
Definition: get_generator_info.py:21
TrigCompositeUtils::DecisionID
unsigned int DecisionID
Definition: TrigComposite_v1.h:27
TrigCompositeUtils::passed
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
Definition: TrigCompositeUtilsRoot.cxx:117
TrigBmumuxComboHypoTool::m_decay
Gaudi::Property< int > m_decay
Definition: TrigBmumuxComboHypoTool.h:37
TrigBmumuxComboHypoTool::passed
bool passed(const xAOD::TrigBphys *) const
Definition: TrigBmumuxComboHypoTool.cxx:32
TrigCompositeUtils::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition: TrigCompositeUtilsRoot.cxx:61
xAOD::TrigBphys_v1::particleType
pType particleType() const
accessor method: particle Type
xAOD::TrigBphys_v1::mass
float mass() const
accessor method: mass
ComboHypoToolBase
Base class for tools which cut on properties of multi-object or multi-leg chains. User should derive ...
Definition: ComboHypoToolBase.h:26
TrigBmumuxComboHypoTool::decideOnSingleObject
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(....
Definition: TrigBmumuxComboHypoTool.cxx:64
xAOD::TrigBphys_v1::pt
float pt() const
accessor method: pt
Definition: TrigBphys_v1.cxx:362
ComboHypoToolBase::decisionId
virtual HLT::Identifier decisionId() const
retrieves this ComboHypoTool's chain's decision ID
Definition: ComboHypoToolBase.h:41
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
ComboHypoToolBase::legMultiplicity
const std::vector< int > & legMultiplicity() const
Gets the number of legs and the multiplicity required on each leg.
Definition: ComboHypoToolBase.h:54
Monitored
Generic monitoring tool for athena components.
Definition: GenericMonitoringTool.h:30
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonR4::inverse
CalibratedSpacePoint::Covariance_t inverse(const CalibratedSpacePoint::Covariance_t &mat)
Inverts the parsed matrix.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/UtilFunctions.cxx:65
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TrigBmumuxComboHypoTool::executeAlg
virtual bool executeAlg(const std::vector< Combo::LegDecision > &) const override
Only a dummy implementation exists in ComboHypoToolBase.
Definition: TrigBmumuxComboHypoTool.cxx:124
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::TrigBphys_v1::fitchi2
float fitchi2() const
accessor method: chi2 from vertex fit
xAOD::TrigBphys_v1::fitmass
float fitmass() const
accessor method: mass from vertex fit
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
TrigBmumuxComboHypoTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: TrigBmumuxComboHypoTool.h:40
TrigCompositeUtils::featureString
const std::string & featureString()
Definition: TrigCompositeUtilsRoot.cxx:884
TrigBmumuxComboHypoTool::TrigBmumuxComboHypoTool
TrigBmumuxComboHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TrigBmumuxComboHypoTool.cxx:12
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TrigCompositeUtils::Decision
xAOD::TrigComposite Decision
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:20
TrigBmumuxComboHypoTool.h
TrigCompositeUtils::DecisionIDContainer
std::set< DecisionID > DecisionIDContainer
Definition: TrigComposite_v1.h:28
CaloLCW_tf.group
group
Definition: CaloLCW_tf.py:28
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TrigBmumuxComboHypoTool::m_isBmux
Gaudi::Property< bool > m_isBmux
Definition: TrigBmumuxComboHypoTool.h:38
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
xAOD::TrigBphys_v1::eta
float eta() const
accessor method: eta
xAOD::TrigBphys_v1
Class describing a Bphysics online composite object.
Definition: TrigBphys_v1.h:44
TrigBmumuxComboHypoTool::initialize
virtual StatusCode initialize() override
Definition: TrigBmumuxComboHypoTool.cxx:16
ComboHypoToolBase::legDecisionIds
const std::vector< HLT::Identifier > & legDecisionIds() const
Retrieves this ComboHypoTool's chain's decision IDs for all legs.
Definition: ComboHypoToolBase.h:66