|
ATLAS Offline Software
|
#include <TrigMuonEFIdtpInvMassHypoTool.h>
◆ TrigMuonEFIdtpInvMassHypoTool()
TrigMuonEFIdtpInvMassHypoTool::TrigMuonEFIdtpInvMassHypoTool |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
◆ ~TrigMuonEFIdtpInvMassHypoTool()
TrigMuonEFIdtpInvMassHypoTool::~TrigMuonEFIdtpInvMassHypoTool |
( |
| ) |
|
|
default |
◆ decide()
retrieves the decisions associated to this decId, make their combinations and apply the algorithm
- Parameters
-
[in] | LegDecisionsMap | that lists all the passing decisions, to be updated by the tool depending on the outcome of executeAlg |
[in] | Event | Context, currently unused |
Reimplemented in DisplacedJetRankComboHypoTool.
Definition at line 48 of file ComboHypoToolBase.cxx.
50 ATH_MSG_ERROR(
"ComboHypoTool for " <<
m_decisionId <<
" has not been properly configured. setLegMultiplicity should be called by the parent alg in initalize");
51 return StatusCode::FAILURE;
55 if (passingLegs.size() == 0) {
56 return StatusCode::SUCCESS;
59 ATH_MSG_DEBUG(
"Looking for legs from " <<
decisionId() <<
" in the map. Map contains features for " << passingLegs.size() <<
" legs, which may be data for many chains.");
62 std::vector<std::vector<Combo::LegDecision>> legDecisions;
67 if (legDecisions.at(legIndex).size() <
static_cast<size_t>(
m_legMultiplicities.at(legIndex))) {
69 ATH_MSG_DEBUG(
"This ComboHypoTool cannot run in this event, this chain **REJECTS** this event.");
72 return StatusCode::SUCCESS;
80 const size_t out_of = legDecisions.at(legIndex).size();
81 nucg.
add({out_of, choose_any});
82 ATH_MSG_DEBUG(
"For leg " << legIndex <<
" we will be choosing any " << choose_any <<
" Decision Objects out of " << out_of);
85 std::vector<std::vector<Combo::LegDecision>> passingCombinations;
87 size_t warnings = 0, iterations = 0;
90 const std::vector<size_t> combination = nucg();
92 std::vector<Combo::LegDecision> combinationToCheck;
94 size_t location_in_combination = 0;
99 const size_t objectIndex = combination.at(location_in_combination++);
100 combinationToCheck.push_back( legDecisions.at(legIndex).at(objectIndex) );
108 ATH_MSG_DEBUG(
"Combination " << (iterations - 1) <<
" decided to be passing");
109 passingCombinations.push_back(combinationToCheck);
120 return StatusCode::FAILURE;
124 ATH_MSG_WARNING(
"Have so far processed " << iterations <<
" combinations for " <<
m_decisionId <<
" in this event, " << passingCombinations.size() <<
" passing.");
127 ATH_MSG_WARNING(
"Too many combinations! Breaking the loop at this point.");
137 ATH_MSG_DEBUG(
"Passing " << passingCombinations.size() <<
" combinations out of " << iterations <<
", "
138 <<
m_decisionId << (passingCombinations.size() ?
" **ACCEPTS**" :
" **REJECTS**") <<
" this event based on OR logic.");
141 ATH_MSG_DEBUG(
"Note: stopped after the first successful combination due to the EnableOverride flag.");
146 const bool passAll = (passingCombinations.size() == iterations);
148 ATH_MSG_DEBUG(
"Passing " << passingCombinations.size() <<
" combinations out of " << iterations <<
", "
149 <<
m_decisionId << (passAll ?
" **ACCEPTS**" :
" **REJECTS**") <<
" this event based on AND logic.");
152 ATH_MSG_DEBUG(
"Note: stopped after the first failed combination due to the EnableOverride flag.");
156 passingCombinations.clear();
161 if (not passingCombinations.empty()) {
168 return StatusCode::SUCCESS;
◆ decideOnSingleObject()
Alternate method called by BPhysics ComboHypoAlgs instead of the base method decide(...).
This function should be considered a specialist use-case only. It must be over-ridden to do anything useful.
Reimplemented in TrigMultiTrkComboHypoTool, and TrigBmumuxComboHypoTool.
Definition at line 284 of file ComboHypoToolBase.cxx.
285 ATH_MSG_ERROR(
"Do not use ComboHypoToolBase on its own, inherit this class and override decideOnSingleObject.");
286 ATH_MSG_ERROR(
"NOTE: Only if you are also supplying your own decide(...) implimentation, or similar.");
287 ATH_MSG_ERROR(
"NOTE: Most uses cases should only need to override executeAlg(...).");
288 return StatusCode::FAILURE;
◆ decisionId()
◆ doTPIdperf()
Definition at line 163 of file TrigMuonEFIdtpInvMassHypoTool.cxx.
168 std::vector<float> mnt_PT_dr, mnt_PT_qovp;
169 std::vector<float> mnt_FTF_dr, mnt_FTF_qovp;
181 auto monitorIt =
Monitored::Group(
m_monTool, mon_PT_dr, mon_PT_qovp, mon_FTF_dr, mon_FTF_qovp, mon_phi_effi, mon_eta_effi, mon_pt_found, mon_ftf_found, mon_pt_phi, mon_pt_pix, mon_pt_pixnext);
188 mnt_probe_eta = metrack->
eta();
191 const float PT_DR_CUT = 0.1;
192 const float PT_QOVP_CUT = 2.0;
194 int n_pt_matched = 0;
195 float min_dr_pt_matched = 999;
198 uint8_t pt_expectNextToInnermost=0;
199 uint8_t pt_numberNextToInnermost=0;
200 for(
auto idtrack : tracks_pt) {
203 mnt_PT_dr.push_back(dr_pt);
204 mnt_PT_qovp.push_back(qovp_pt);
207 if( dr_pt > PT_DR_CUT )
continue;
208 if( qovp_pt > PT_QOVP_CUT )
continue;
210 if( dr_pt < min_dr_pt_matched ) {
211 min_dr_pt_matched = dr_pt;
212 mon_pt_phi = idtrack->phi();
219 if( n_pt_matched > 1 ) n_pt_matched=1;
222 const float FTF_DR_CUT = 0.2;
223 const float FTF_QOVP_CUT = 3.0;
225 int n_ftf_matched = 0;
226 for(
auto idtrack : tracks_ftf) {
229 mnt_FTF_dr.push_back(dr_pt);
230 mnt_FTF_qovp.push_back(qovp_pt);
233 if( dr_pt > FTF_DR_CUT )
continue;
234 if( qovp_pt > FTF_QOVP_CUT )
continue;
237 if( n_ftf_matched > 1 ) n_ftf_matched=1;
240 float me_eta = metrack->
eta();
241 float me_phi = metrack->
phi();
245 if( std::abs(me_eta) > 2.0 ) { eta_nr = 2; }
246 else if( std::abs(me_eta) > 1.0 ) { eta_nr = 1; }
248 if( me_pt_gev > 20.0 ) { pt_nr = 1; }
250 std::stringstream
ss;
251 ss <<
"PT_effi_pt" << pt_nr <<
"_eta" << eta_nr;
254 ss <<
"PT_effi_pt" << pt_nr <<
"_eta" << eta_nr;
257 mnt_PT_effi = n_pt_matched;
258 mnt_FTF_effi = n_ftf_matched;
261 mon_phi_effi = me_phi;
262 mon_eta_effi = me_eta;
263 mon_pt_found = n_pt_matched;
264 mon_ftf_found = n_ftf_matched;
265 if( n_pt_matched != 0 ) {
266 if( pt_expectInnermost == 1 ) {
267 if( pt_numberInnermost>0 ) {
273 if( pt_expectNextToInnermost == 1 ) {
274 if( pt_numberNextToInnermost>0 ) {
283 return StatusCode::SUCCESS;
◆ eraseFromLegDecisionsMap()
For when the tool rejects all combinations.
Remove all Decision Objects from all the legs of this HypoTool's chain.
Definition at line 253 of file ComboHypoToolBase.cxx.
254 for (
auto&
it : passingLegs) {
257 const size_t nDecisionObjects =
it.second.size();
◆ executeAlg()
Only a dummy implementation exists in ComboHypoToolBase.
This should be over-ridden by a derived class. The derived class should return a boolean pass/fail for each possible combination in the event. param[in] combination A single combination of objects to be discriminated against. Vector contains the required number of objects over all legs. Use the pair.first to tell which leg a given pair.second decision object belongs to in the current combination.
Reimplemented from ComboHypoToolBase.
Definition at line 53 of file TrigMuonEFIdtpInvMassHypoTool.cxx.
59 ATH_MSG_DEBUG(
"Accept property is set: taking all the events");
64 std::vector<float> mnt_invMass;
69 std::vector<const xAOD::TrackParticle*> tracks_pt;
70 std::vector<const xAOD::TrackParticle*> tracks_ftf;
71 std::vector<const xAOD::Muon*> muons_cb;
72 std::vector<const xAOD::Muon*> muons_sa;
73 int i_leg_idperf = -1;
74 for(
auto leg: combination) {
75 auto decision= (*(
leg.second));
79 if( muonLinks.size() != 1 )
continue;
80 if( ! muonLinks.at(0).isValid() )
continue;
82 if( !
mu->primaryTrackParticle() )
continue;
84 bool is_idperf_muon =
false;
87 muons_cb.push_back(
mu);
90 muons_sa.push_back(
mu);
91 is_idperf_muon =
true;
92 if( i_leg_idperf == -1 ) { i_leg_idperf = i_leg; }
93 else if( i_leg_idperf != (
int)i_leg ) {
94 ATH_MSG_ERROR(
"i_leg for idperf looks inconsistent: i_leg_idperf / i_leg="<<i_leg_idperf<<
" / "<<i_leg);
100 if( is_idperf_muon ) {
101 const std::vector< TrigCompositeUtils::LinkInfo<xAOD::TrackParticleContainer> > ptLinks = TrigCompositeUtils::findLinks< xAOD::TrackParticleContainer >( decision,
"HLT_IDTrack_Muon_IDTrig", TrigDefs::lastFeatureOfType);
102 ATH_MSG_VERBOSE(
"PT TrackParticleContainer Links size = "<<ptLinks.size());
103 if( ptLinks.size() == 1 && ptLinks.at(0).isValid() ) {
105 tracks_pt.push_back(
track);
111 const std::vector< TrigCompositeUtils::LinkInfo<xAOD::TrackParticleContainer> > ftfLinks = TrigCompositeUtils::findLinks< xAOD::TrackParticleContainer >( decision,
"HLT_IDTrack_Muon_FTF", TrigDefs::lastFeatureOfType);
112 ATH_MSG_VERBOSE(
"FTF TrackParticleContainer Links size = "<< ftfLinks.size());
113 if( ftfLinks.size() == 1 && ftfLinks.at(0).isValid() ) {
115 tracks_ftf.push_back(
track);
125 for(
auto muon_cb : muons_cb) {
128 for(
auto muon_sa : muons_sa) {
131 const xAOD::TrackParticle* tr_cb = muon_cb->trackParticle(xAOD::Muon::TrackParticleType::CombinedTrackParticle);
132 const xAOD::TrackParticle* tr_sa = muon_sa->trackParticle(xAOD::Muon::TrackParticleType::ExtrapolatedMuonSpectrometerTrackParticle);
133 if (!tr_cb || !tr_sa) {
138 if(
m_selOS && (muon_cb->charge()*muon_sa->charge() > 0) )
continue;
141 mnt_invMass.push_back(diMuMass);
148 if(
sc != StatusCode::SUCCESS ) {
◆ initialize()
StatusCode TrigMuonEFIdtpInvMassHypoTool::initialize |
( |
| ) |
|
|
overridevirtual |
Definition at line 23 of file TrigMuonEFIdtpInvMassHypoTool.cxx.
28 return StatusCode::FAILURE;
36 ATH_MSG_ERROR(
"Both mass cuts are <0. This is probably a configuration mistake.");
37 return StatusCode::FAILURE;
47 return StatusCode::SUCCESS;
◆ legDecisionId()
Retrieves this ComboHypoTool's chain's decision ID for a given leg.
Only populated for chains with more than one leg. For chains with one leg, use decisionId()
Definition at line 60 of file ComboHypoToolBase.h.
◆ legDecisionIds()
Retrieves this ComboHypoTool's chain's decision IDs for all legs.
Only populated for chains with more than one leg. For chains with one leg, use decisionId()
Definition at line 66 of file ComboHypoToolBase.h.
◆ legMultiplicity()
const std::vector<int>& ComboHypoToolBase::legMultiplicity |
( |
| ) |
const |
|
inlineinherited |
Gets the number of legs and the multiplicity required on each leg.
Definition at line 54 of file ComboHypoToolBase.h.
◆ passedCBQualityCuts()
bool TrigMuonEFIdtpInvMassHypoTool::passedCBQualityCuts |
( |
const xAOD::Muon * |
muon | ) |
const |
|
private |
Definition at line 289 of file TrigMuonEFIdtpInvMassHypoTool.cxx.
291 bool passCut =
false;
294 const xAOD::TrackParticle* metrack =
muon->trackParticle( xAOD::Muon::ExtrapolatedMuonSpectrometerTrackParticle );
296 const float CHI2_CUT = 8.0;
297 const float QOVP_CUT = 7.0;
299 if( idtrack && metrack ) {
301 float reducedChi2 =
muon->primaryTrackParticle()->chiSquared()/
muon->primaryTrackParticle()->numberDoF();
◆ passedSAQualityCuts()
bool TrigMuonEFIdtpInvMassHypoTool::passedSAQualityCuts |
( |
const xAOD::Muon * |
muon | ) |
const |
|
private |
Definition at line 310 of file TrigMuonEFIdtpInvMassHypoTool.cxx.
312 bool passCut =
false;
314 const xAOD::TrackParticle* metrack =
muon->trackParticle( xAOD::Muon::ExtrapolatedMuonSpectrometerTrackParticle );
316 const float CHI2_CUT = 8.0;
319 float reducedChi2 =
muon->primaryTrackParticle()->chiSquared()/
muon->primaryTrackParticle()->numberDoF();
320 if( std::abs(reducedChi2) < CHI2_CUT && !
m_muonSelTool->isBadMuon(*
muon) ) passCut =
true;
◆ printDebugInformation()
Print the output of the tool, after having removed failed Decision Objects.
Restricted to the ComboHypoTool's chain's legs.
Definition at line 264 of file ComboHypoToolBase.cxx.
266 for (
const auto& [
id, ELV] : passingLegs) {
270 for (
const auto&
EL : ELV) {
275 return StatusCode::SUCCESS;
◆ qOverPMatching()
◆ selectLegs()
Creates the per-leg vectors of Decision objects starting from the initial LegDecision map, storing only those concerning this HypoTool's chain Pack the Decision objects in std::pair<DecisionID, ElementLink<Decision>> so the derived class' executeAlg function knows which leg each object is on.
Definition at line 172 of file ComboHypoToolBase.cxx.
189 std::vector<Combo::LegDecision> decisionObjectsOnLeg;
192 const Combo::LegDecisionsMap::const_iterator
it = IDCombMap.find(legIdentifier.
numeric());
194 if (
it != IDCombMap.end()) {
196 decisionObjectsOnLeg.emplace_back(legIdentifier,
el);
200 legDecisions.push_back(std::move(decisionObjectsOnLeg));
206 for (
const auto&
leg : legDecisions) {
208 for (
const auto& dEL :
leg) {
213 return StatusCode::SUCCESS;
◆ setLegMultiplicity()
Sets the number of legs and the multiplicity required on each leg.
This should be called when the Tool is retrieved by its parent ComboHypo alg. This also sets the leg Decision IDs at the same time param[in] multiplicityRequiredMap: Mapping of chains to required multiplicity per leg.
Definition at line 16 of file ComboHypoToolBase.cxx.
18 const Combo::MultiplicityReqMap::const_iterator
it = multiplicityRequiredMap.find(nameOfToolsChain);
20 if (
it == multiplicityRequiredMap.end()) {
21 ATH_MSG_ERROR(
"ComboHypoTool for " <<
m_decisionId <<
" could not find its required multiplcity data in the map supplied by its parent alg.");
22 return StatusCode::FAILURE;
27 ATH_MSG_ERROR(
"ComboHypoTool for " <<
m_decisionId <<
" was listed in the supplied multiplicityRequiredMap, but data was not supplied for any legs.");
28 return StatusCode::FAILURE;
35 return StatusCode::FAILURE;
45 return StatusCode::SUCCESS;
◆ updateLegDecisionsMap()
For when the tool accepts some/all combinations.
Remove Decision Objects from legs of this HypoTool's chain which participated in NONE of combinations which were flagged as accepting the event.
Definition at line 216 of file ComboHypoToolBase.cxx.
219 for (
const std::vector<Combo::LegDecision>& comb : passingComb) {
221 for (
const auto& [
id,
EL] : comb) {
228 for (
auto&
it : passingLegs) {
233 std::vector<ElementLink<DecisionContainer>> updatedDecisionObjectsOnLeg;
236 for (
const std::vector<Combo::LegDecision>& comb : passingComb) {
237 for (
const auto& [
id,
EL] : comb) {
239 if (
id == legId and
std::find(updatedDecisionObjectsOnLeg.begin(), updatedDecisionObjectsOnLeg.end(),
EL) == updatedDecisionObjectsOnLeg.end()) {
241 updatedDecisionObjectsOnLeg.push_back(
EL);
248 it.second = updatedDecisionObjectsOnLeg;
◆ m_acceptAll
Gaudi::Property< bool > TrigMuonEFIdtpInvMassHypoTool::m_acceptAll |
|
private |
◆ m_combinationsThresholdBreak
Gaudi::Property<size_t> ComboHypoToolBase::m_combinationsThresholdBreak |
|
protectedinherited |
Initial value:{this, "CombinationsThresholdBreak", 10000,
"Events processing this many combinations will generate a second WARNING message, and the loop over combinations will be terminated at this point."}
Definition at line 109 of file ComboHypoToolBase.h.
◆ m_combinationsThresholdWarn
Gaudi::Property<size_t> ComboHypoToolBase::m_combinationsThresholdWarn |
|
protectedinherited |
Initial value:{this, "CombinationsThresholdWarn", 1000,
"Events processing this many combinations will generate a WARNING message."}
Definition at line 106 of file ComboHypoToolBase.h.
◆ m_decisionId
◆ m_enableOverride
Gaudi::Property<bool> ComboHypoToolBase::m_enableOverride |
|
protectedinherited |
Initial value:{this, "EnableOverride", false,
"Stops processing combinations as soon as a valid combination is found in OR mode, or as soon as an invalid combination is found in AND mode. This is to save CPU."}
Definition at line 115 of file ComboHypoToolBase.h.
◆ m_invMassHigh
Gaudi::Property< double> TrigMuonEFIdtpInvMassHypoTool::m_invMassHigh |
|
private |
◆ m_invMassLow
Gaudi::Property< double> TrigMuonEFIdtpInvMassHypoTool::m_invMassLow |
|
private |
◆ m_legDecisionIds
The DecisionIDs of the individual legs, derived from both m_decisionId and m_legMultiplicities.
Definition at line 123 of file ComboHypoToolBase.h.
◆ m_legMultiplicities
std::vector<int> ComboHypoToolBase::m_legMultiplicities |
|
privateinherited |
The number of legs, and the required multiplicity on each leg.
Definition at line 124 of file ComboHypoToolBase.h.
◆ m_modeOR
Gaudi::Property<bool> ComboHypoToolBase::m_modeOR |
|
protectedinherited |
Initial value:{this, "ModeOR", true,
"Accepts based on the logical OR over all calls to executeAlg. If this flag is set to false then the logical AND is required instead."}
Definition at line 112 of file ComboHypoToolBase.h.
◆ m_monTool
◆ m_muonqualityCut
Gaudi::Property< bool > TrigMuonEFIdtpInvMassHypoTool::m_muonqualityCut |
|
private |
◆ m_muonSelTool
◆ m_selOS
Gaudi::Property< bool > TrigMuonEFIdtpInvMassHypoTool::m_selOS |
|
private |
The documentation for this class was generated from the following files:
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Group
Properties of a chain group.
Scalar phi() const
phi method
std::string find(const std::string &s)
return a remapped string
TrigCompositeUtils::DecisionID numeric() const
numeric ID
Scalar eta() const
pseudorapidity method
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
An ensemble of UniqueCombinationGenerator API description.
@ expectInnermostPixelLayerHit
Do we expect a 0th-layer barrel hit for this track?
#define ATH_MSG_VERBOSE(x)
float qOverPMatching(const xAOD::TrackParticle *metrack, const xAOD::TrackParticle *idtrack)
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
@ expectNextToInnermostPixelLayerHit
Do we expect a 1st-layer barrel hit for this track?
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
::StatusCode StatusCode
StatusCode definition for legacy code.
void add(const UniqueCombinationGenerator &gen)
This module defines the arguments passed from the BATCH driver to the BATCH worker.
ElementLink implementation for ROOT usage.
const std::string & featureString()
@ numberOfNextToInnermostPixelLayerHits
these are the hits in the 1st pixel barrel layer
HLT::Identifier createLegName(const HLT::Identifier &chainIdentifier, size_t counter)
Generate the HLT::Identifier which corresponds to a specific leg of a given chain.
int32_t getIndexFromLeg(const HLT::Identifier &legIdentifier)
Extract the numeric index of a leg identifier.
#define ATH_MSG_WARNING(x)
std::string name() const
reports human redable name if it is enabled or, empty string
HLT::Identifier getIDFromLeg(const HLT::Identifier &legIdentifier)
Generate the HLT::Identifier which corresponds to the chain name from the leg name.
Class describing a TrackParticle.
Declare a monitored scalar variable.
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
@ numberOfInnermostPixelLayerHits
these are the hits in the 0th pixel barrel layer