ATLAS Offline Software
Loading...
Searching...
No Matches
Trig::TrigMuonMatching Class Reference

#include <TrigMuonMatching.h>

Inheritance diagram for Trig::TrigMuonMatching:
Collaboration diagram for Trig::TrigMuonMatching:

Classes

struct  EFmuon

Public Types

Definition of the StoreGate-like object's definition
typedef ServiceHandle< StoreGateSvcMetaStore_t
 Type of the metadata store object in Athena.
typedef const ServiceHandle< StoreGateSvc > & MetaStorePtr_t
 Type of the metadata store pointer in standalone mode.

Public Member Functions

 TrigMuonMatching (const std::string &name)
virtual ~TrigMuonMatching ()
virtual StatusCode initialize (void) override
 Dummy implementation of the initialisation function.
virtual Bool_t match (const xAOD::Muon *mu, const std::string &chain, const double mindelR=0.1) const override
virtual Bool_t matchL1 (const xAOD::Muon *mu, const std::string &l1item, const double DelR=0.2) const override
virtual Bool_t matchL2SA (const xAOD::Muon *mu, const std::string &l1item, const std::string &chain, const double DelR=0.2) const override
virtual Bool_t matchL2CB (const xAOD::Muon *mu, const std::string &chain, const double DelR=0.2) const override
virtual Double_t minDelR (const xAOD::Muon *mu, const std::string &chain, const double mindelR=0.1) const override
virtual Double_t minDelRL1 (const xAOD::Muon *mu, const std::string &l1item, const double DelR=0.2) const override
virtual Bool_t matchDimuon (const xAOD::Muon *mu1, const xAOD::Muon *mu2, const std::string &chain, std::pair< Bool_t, Bool_t > &result1, std::pair< Bool_t, Bool_t > &result2, const Double_t &mindelR=0.1) override
virtual Bool_t match (const double eta, const double phi, const std::string &chain, const double mindelR=0.1) const override
virtual Bool_t matchL1 (const double eta, const double phi, const std::string &l1item, const double DelR=0.2) const override
virtual Bool_t matchDimuon (const TLorentzVector &muon1, const TLorentzVector &muon2, const std::string &chain, std::pair< Bool_t, Bool_t > &result1, std::pair< Bool_t, Bool_t > &result2, const Double_t &mindelR=0.1) override
virtual Bool_t isPassedRerun (const std::string &trigger) const override
virtual StatusCode sysInitialize ()
 Function initialising the tool in the correct way in Athena.
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Functions providing access to the input/output metadata
MetaStorePtr_t inputMetaStore () const
 Accessor for the input metadata store.
MetaStorePtr_t outputMetaStore () const
 Accessor for the output metadata store.
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.
Callback functions helping in metadata reading/writing
void setUseIncidents (const bool flag)
virtual void handle (const Incident &inc)
 Function receiving incidents from IncidentSvc/TEvent.
virtual StatusCode beginInputFile ()
 Function called when a new input file is opened.
virtual StatusCode endInputFile ()
 Function called when the currently open input file got completely processed.
virtual StatusCode beginEvent ()
 Function called when a new events is loaded.
virtual StatusCode metaDataStop ()
 Function called when the tool should write out its metadata.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

std::pair< bool, bool > matchDimuon (const TLorentzVector &muon1, const TLorentzVector &muon2, const DimuonChainInfo &chainInfo, const double mindelR)
double dR (const double eta1, const double phi1, const double eta2, const double phi2) const
int getL1pt (const std::string &l1item) const
void tokenize (const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters) const
Double_t matchedTrackDetail (EFmuon &efMuonId, const EFmuon &usedEFMuonId, const double eta, const double phi, const double mindelR, const std::string &chainEventTrigger) const
bool decodeDimuonChain (DimuonChainInfo &chainInfo)
bool isEqual (const double x, const double y) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< Trig::TrigDecisionToolm_trigDecTool
std::map< std::string, DimuonChainInfom_DimuonChainMap
MetaStore_t m_inputMetaStore
 Object accessing the input metadata store.
MetaStore_t m_outputMetaStore
 Object accessing the output metadata store.
bool m_beginInputFileCalled
 Flag helping to discover when the tool misses the opening of the first input file.
bool m_useIncidents
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 20 of file TrigMuonMatching.h.

Member Typedef Documentation

◆ MetaStore_t

Type of the metadata store object in Athena.

Definition at line 66 of file AsgMetadataTool.h.

◆ MetaStorePtr_t

Type of the metadata store pointer in standalone mode.

Definition at line 68 of file AsgMetadataTool.h.

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TrigMuonMatching()

Trig::TrigMuonMatching::TrigMuonMatching ( const std::string & name)

Definition at line 23 of file TrigMuonMatching.cxx.

24 : asg::AsgMetadataTool( name ),
25 m_trigDecTool("Trig::TrigDecisionTool/TrigDecisionTool")
26 {
27 declareProperty( "TriggerTool", m_trigDecTool);
28 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ToolHandle< Trig::TrigDecisionTool > m_trigDecTool

◆ ~TrigMuonMatching()

Trig::TrigMuonMatching::~TrigMuonMatching ( )
virtual

Definition at line 30 of file TrigMuonMatching.cxx.

30 {
31 }

Member Function Documentation

◆ beginEvent()

StatusCode asg::AsgMetadataTool::beginEvent ( )
protectedvirtualinherited

◆ beginInputFile()

StatusCode asg::AsgMetadataTool::beginInputFile ( )
protectedvirtualinherited

Function called when a new input file is opened.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in AsgElectronEfficiencyCorrectionTool, BookkeeperDumperTool, BookkeeperTool, PMGTools::PMGTruthWeightTool, TauAnalysisTools::TauEfficiencyCorrectionsTool, TauAnalysisTools::TauSmearingTool, Trig::TrigDecisionTool, Trig::xAODBunchCrossingTool, TrigConf::xAODConfigTool, xAODMaker::TriggerMenuMetaDataTool, and xAODMaker::TruthMetaDataTool.

Definition at line 185 of file AsgMetadataTool.cxx.

185 {
186
187 // Return gracefully:
188 return StatusCode::SUCCESS;
189 }

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ decodeDimuonChain()

bool Trig::TrigMuonMatching::decodeDimuonChain ( DimuonChainInfo & chainInfo)
private

Definition at line 408 of file TrigMuonMatching.cxx.

409 {
410 chainInfo.isValid = false;
411 std::map<std::string, DimuonChainInfo >::const_iterator p = m_DimuonChainMap.find(chainInfo.chain);
412 if (p != m_DimuonChainMap.end()) {
413 chainInfo = p->second;
414 return chainInfo.isValid;
415 }
416 std::vector<std::string> tokens;
417 tokenize(chainInfo.chain, tokens, "_");
418 if (tokens.size() < 2) return false;
419 if (tokens[0] != "HLT") return false;
420 chainInfo.isSymmetric = (tokens[1].substr(0, 3) == "2mu");
421
422 if(chainInfo.isSymmetric) {
423 std::string threshold = std::string("HLT_" + tokens[1].substr(1));
424 chainInfo.thresholds.first = threshold;
425 chainInfo.thresholds.second = threshold;
426 chainInfo.isValid = true;
427 //if (tokens.size() == 3) chainInfo.tightness = tokens[2];
428 }
429 else {
430 if(tokens.size() != 3) return false;
431
432 std::string high = std::string("HLT_" + tokens[1]);
433 chainInfo.thresholds.first = high;
434 chainInfo.thresholds.second = chainInfo.chain;
435 chainInfo.isValid = true;
436 return chainInfo.isValid;
437
438 }
439 m_DimuonChainMap[chainInfo.chain] = chainInfo;
440 return chainInfo.isValid;
441 }
void tokenize(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters) const
std::map< std::string, DimuonChainInfo > m_DimuonChainMap
std::pair< std::string, std::string > thresholds

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ dR()

double Trig::TrigMuonMatching::dR ( const double eta1,
const double phi1,
const double eta2,
const double phi2 ) const
private

Definition at line 282 of file TrigMuonMatching.cxx.

286 {
287 double deta = fabs(eta1 - eta2);
288 double dphi = fabs(phi1 - phi2) < TMath::Pi() ? fabs(phi1 - phi2) : 2*TMath:: \
289 Pi() - fabs(phi1 - phi2);
290 return sqrt(deta*deta + dphi*dphi);
291 }
static const double Pi

◆ endInputFile()

StatusCode asg::AsgMetadataTool::endInputFile ( )
protectedvirtualinherited

Function called when the currently open input file got completely processed.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in BookkeeperDumperTool, BookkeeperTool, xAODMaker::TriggerMenuMetaDataTool, and xAODMaker::TruthMetaDataTool.

Definition at line 193 of file AsgMetadataTool.cxx.

193 {
194
195 // Return gracefully:
196 return StatusCode::SUCCESS;
197 }

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getL1pt()

int Trig::TrigMuonMatching::getL1pt ( const std::string & l1item) const
private

Definition at line 294 of file TrigMuonMatching.cxx.

295 {
296 int rc = -1;
297
298 std::vector<std::string> tokens;
299 tokenize(l1item, tokens, "_");
300 std::string pt;
301 if (tokens.size() == 1) {
302 pt = tokens.at(0);
303
304 } else if ((tokens.size() == 2 ) and (tokens.at(0) == "L1")) {
305 pt = tokens.at(1);
306
307 } else {
308 ATH_MSG_ERROR("TrigMuonMatching::getL1pt : cannot parse " << l1item);
309 return rc;
310 }
311
312 const size_t index = pt.find("MU");
313 if (index != std::string::npos) {
314 std::istringstream iss(pt.substr(index + 2));
315 iss >> rc;
316 } else {
317 ATH_MSG_ERROR("TrigMuonMatching::getL1pt : cannot parse " << l1item);
318 }
319
320 return rc;
321 }
#define ATH_MSG_ERROR(x)
static Double_t rc
str index
Definition DeMoScan.py:362

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ handle()

void asg::AsgMetadataTool::handle ( const Incident & inc)
protectedvirtualinherited

Function receiving incidents from IncidentSvc/TEvent.

Reimplemented in Trig::TrigDecisionTool.

Definition at line 135 of file AsgMetadataTool.cxx.

135 {
136
137 // Tell the user what's happening:
138 ATH_MSG_VERBOSE( "Callback received with incident: " << inc.type() );
139
140 // Call the appropriate member function:
141 if( inc.type() == IncidentType::BeginInputFile ) {
143 if( beginInputFile().isFailure() ) {
144 ATH_MSG_FATAL( "Failed to call beginInputFile()" );
145 throw std::runtime_error( "Couldn't call beginInputFile()" );
146 }
147 } else if( inc.type() == IncidentType::EndInputFile ) {
148 if( endInputFile().isFailure() ) {
149 ATH_MSG_FATAL( "Failed to call endInputFile()" );
150 throw std::runtime_error( "Couldn't call endInputFile()" );
151 }
152 } else if( inc.type() == IncidentType::BeginEvent ) {
153 // If the tool didn't catch the begin input file incident for the
154 // first input file of the job, then call the appropriate function
155 // now.
156 if( ! m_beginInputFileCalled ) {
158 if( beginInputFile().isFailure() ) {
159 ATH_MSG_FATAL( "Failed to call beginInputFile()" );
160 throw std::runtime_error( "Couldn't call beginInputFile()" );
161 }
162 }
163 if( beginEvent().isFailure() ) {
164 ATH_MSG_FATAL( "Failed to call beginEvent()" );
165 throw std::runtime_error( "Couldn't call beginEvent()" );
166 }
167
168 #ifdef XAOD_STANDALONE
169 } else if( inc.type() == IncidentType::MetaDataStop ) {
170 if( metaDataStop().isFailure() ) {
171 ATH_MSG_FATAL( "Failed to call metaDataStop()" );
172 throw std::runtime_error( "Couldn't call metaDataStop()" );
173 }
174
175 #endif // XAOD_STANDALONE
176 } else {
177 ATH_MSG_WARNING( "Unknown incident type received in AsgMetaDataTool: " << inc.type() );
178 }
179
180 return;
181 }
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
virtual StatusCode beginInputFile()
Function called when a new input file is opened.
virtual StatusCode beginEvent()
Function called when a new events is loaded.
bool m_beginInputFileCalled
Flag helping to discover when the tool misses the opening of the first input file.
virtual StatusCode endInputFile()
Function called when the currently open input file got completely processed.
virtual StatusCode metaDataStop()
Function called when the tool should write out its metadata.

◆ initialize()

StatusCode Trig::TrigMuonMatching::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Definition at line 33 of file TrigMuonMatching.cxx.

33 {
34 // Greet the user:
35 ATH_MSG_INFO( "Initialising... " );
36
37 ATH_CHECK(m_trigDecTool.retrieve());
38
39 return StatusCode::SUCCESS;
40 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ inputMetaStore()

AsgMetadataTool::MetaStorePtr_t asg::AsgMetadataTool::inputMetaStore ( ) const
inherited

Accessor for the input metadata store.

Definition at line 93 of file AsgMetadataTool.cxx.

93 {
94
95#ifdef XAOD_STANDALONE
96 return &m_inputMetaStore;
97#else // XAOD_STANDALONE
98 return m_inputMetaStore;
99#endif // XAOD_STANDALONE
100 }
MetaStore_t m_inputMetaStore
Object accessing the input metadata store.

◆ isEqual()

bool Trig::TrigMuonMatching::isEqual ( const double x,
const double y ) const
private

Definition at line 443 of file TrigMuonMatching.cxx.

445 {
446 if (fabs(x - y) < std::numeric_limits<float>::epsilon()) return true;
447 return false;
448 }
#define y
#define x

◆ isPassedRerun()

Bool_t Trig::TrigMuonMatching::isPassedRerun ( const std::string & trigger) const
overridevirtual

Implements Trig::ITrigMuonMatching.

Definition at line 243 of file TrigMuonMatching.cxx.

244 {
245 const unsigned int bits = m_trigDecTool->isPassedBits(trigger);
246 if( (bits & TrigDefs::EF_passedRaw) && ! ( bits & TrigDefs::EF_passThrough) && ( bits & TrigDefs::EF_resurrected)){
247 return true;
248 }
249 return false;
250 }

◆ match() [1/2]

Bool_t Trig::TrigMuonMatching::match ( const double eta,
const double phi,
const std::string & chain,
const double mindelR = 0.1 ) const
overridevirtual

Implements Trig::ITrigMuonMatching.

Definition at line 104 of file TrigMuonMatching.cxx.

108 {
109 if(!m_trigDecTool->isPassed(chain)){
110 return false;
111 }
112 Double_t delmin = mindelR;
113 EFmuon efmuon,dummy;
114
115 matchedTrackDetail(efmuon, dummy, eta, phi, delmin, chain);
116 return efmuon.valid;
117 }
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
Double_t matchedTrackDetail(EFmuon &efMuonId, const EFmuon &usedEFMuonId, const double eta, const double phi, const double mindelR, const std::string &chainEventTrigger) const

◆ match() [2/2]

Bool_t Trig::TrigMuonMatching::match ( const xAOD::Muon * mu,
const std::string & chain,
const double mindelR = 0.1 ) const
overridevirtual

Implements Trig::ITrigMuonMatching.

Definition at line 42 of file TrigMuonMatching.cxx.

45 {
46 return match(mu->eta(),mu->phi(),chain,mindelR);
47 }
virtual Bool_t match(const xAOD::Muon *mu, const std::string &chain, const double mindelR=0.1) const override

◆ matchDimuon() [1/3]

std::pair< Bool_t, Bool_t > Trig::TrigMuonMatching::matchDimuon ( const TLorentzVector & muon1,
const TLorentzVector & muon2,
const DimuonChainInfo & chainInfo,
const double mindelR )
private

Definition at line 252 of file TrigMuonMatching.cxx.

256 {
257
258 EFmuon trkId1, trkId2, dummy;
259 const Double_t dr1 = matchedTrackDetail(trkId1, dummy, muon1.Eta(), muon1.Phi(), mindelR, chainInfo.thresholds.first);
260
261 // for full scan trigger.
262
263 const Double_t dr2 = matchedTrackDetail(trkId2, dummy, muon2.Eta(), muon2.Phi(), mindelR, chainInfo.thresholds.second);
264
265 if(trkId1.valid && trkId2.valid &&
266 isEqual(trkId1.pt, trkId2.pt) &&
267 isEqual(trkId1.eta, trkId2.eta) &&
268 isEqual(trkId1.phi, trkId2.phi)){
269 if(dr1 > dr2){
270 matchedTrackDetail(trkId1, trkId2, muon1.Eta(), muon1.Phi(), mindelR, chainInfo.thresholds.first);
271 }
272 else{
273 matchedTrackDetail(trkId2, trkId1, muon2.Eta(), muon2.Phi(), mindelR, chainInfo.thresholds.second);
274 }
275 }
276
277 return std::pair<Bool_t, Bool_t> (trkId1.valid, trkId2.valid);
278 }
bool isEqual(const double x, const double y) const

◆ matchDimuon() [2/3]

Bool_t Trig::TrigMuonMatching::matchDimuon ( const TLorentzVector & muon1,
const TLorentzVector & muon2,
const std::string & chain,
std::pair< Bool_t, Bool_t > & result1,
std::pair< Bool_t, Bool_t > & result2,
const Double_t & mindelR = 0.1 )
overridevirtual

Implements Trig::ITrigMuonMatching.

Definition at line 214 of file TrigMuonMatching.cxx.

220 {
221 Double_t delmin = mindelR;
222 DimuonChainInfo chainInfo(chain);
223 if (not decodeDimuonChain(chainInfo)) {
224 ATH_MSG_ERROR("TrigMuonMatching : Failed to decode chain " << chain << " matchDimuon can accept only chains named HLT_2muXX and HLT_muXX_mu8noL1.");
225 return false;
226 }
227
228 std::pair<Bool_t, Bool_t> rc12, rc21;
229 rc12 = matchDimuon(muon1, muon2, chainInfo, delmin);
230 if(chainInfo.isSymmetric){
231 rc21.first = rc12.second; rc21.second = rc12.first;
232 }
233
234 else{
235 rc21 = matchDimuon(muon2, muon1, chainInfo, delmin);
236 }
237
238 result1.first = rc12.first; result1.second = rc21.second;
239 result2.first = rc21.first; result2.second = rc12.second;
240 return true;
241 }
bool decodeDimuonChain(DimuonChainInfo &chainInfo)
virtual Bool_t matchDimuon(const xAOD::Muon *mu1, const xAOD::Muon *mu2, const std::string &chain, std::pair< Bool_t, Bool_t > &result1, std::pair< Bool_t, Bool_t > &result2, const Double_t &mindelR=0.1) override

◆ matchDimuon() [3/3]

Bool_t Trig::TrigMuonMatching::matchDimuon ( const xAOD::Muon * mu1,
const xAOD::Muon * mu2,
const std::string & chain,
std::pair< Bool_t, Bool_t > & result1,
std::pair< Bool_t, Bool_t > & result2,
const Double_t & mindelR = 0.1 )
overridevirtual

Implements Trig::ITrigMuonMatching.

Definition at line 90 of file TrigMuonMatching.cxx.

96 {
97 TLorentzVector mu_1, mu_2;
98 mu_1.SetPtEtaPhiM(mu1->pt(),mu1->eta(),mu1->phi(),MUONMASS);
99 mu_2.SetPtEtaPhiM(mu2->pt(),mu2->eta(),mu2->phi(),MUONMASS);
100 Bool_t valid = matchDimuon(mu_1,mu_2,chain,result1,result2,mindelR);
101 return valid;
102 }
#define MUONMASS
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
virtual double pt() const
The transverse momentum ( ) of the particle.
list valid
Definition calibdata.py:44

◆ matchedTrackDetail()

Double_t Trig::TrigMuonMatching::matchedTrackDetail ( EFmuon & efMuonId,
const EFmuon & usedEFMuonId,
const double eta,
const double phi,
const double mindelR,
const std::string & chainEventTrigger ) const
private

Definition at line 340 of file TrigMuonMatching.cxx.

346 {
347 efMuonId.valid = false;
348 Double_t drmin = mindelR;
349
350 const std::string eventTrigger = chainForEventTrigger;
351
352 auto cg = m_trigDecTool->getChainGroup(eventTrigger);
353 auto fc = cg->features();
354
355#if defined(XAOD_STANDALONE) || defined(XAOD_ANALYSIS)
356 auto MuFeatureContainers = fc.containerFeature<xAOD::MuonContainer>();
357#else
358 const std::vector< Trig::Feature<xAOD::MuonContainer> > MuFeatureContainers = fc.get<xAOD::MuonContainer>();
359#endif
360
361 for(auto mucont : MuFeatureContainers){
362 for(auto mu : *mucont.cptr()){
363
364 // l1 matching
365
366 if(isEqual(usedEFMuonId.pt, mu->pt()) &&
367 isEqual(usedEFMuonId.eta, mu->eta()) &&
368 isEqual(usedEFMuonId.phi, mu->phi())) continue;
369
370 Double_t dr = dR(eta,phi,mu->eta(),mu->phi());
371 if(drmin > dr){
372 drmin = dr;
373 efMuonId.pt = mu->pt();
374 efMuonId.eta = mu->eta();
375 efMuonId.phi = mu->phi();
376 efMuonId.valid = true;
377 }
378 }
379 }
380 return drmin;
381 }
const T * get(size_type n) const
Access an element, as an rvalue.
double dR(const double eta1, const double phi1, const double eta2, const double phi2) const
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".

◆ matchL1() [1/2]

Bool_t Trig::TrigMuonMatching::matchL1 ( const double eta,
const double phi,
const std::string & l1item,
const double DelR = 0.2 ) const
overridevirtual

Implements Trig::ITrigMuonMatching.

Definition at line 119 of file TrigMuonMatching.cxx.

123 {
124 if(!m_trigDecTool->isPassed("L1_MU.*")){
125 return false;
126 }
127 Double_t l1dr = DelR;
128 const xAOD::MuonRoIContainer* muonrois = 0;
129 StatusCode sc = evtStore()->retrieve(muonrois,"LVL1MuonRoIs");
130 if(!sc){
131 ATH_MSG_ERROR("TrigMuonMatching::matchL1 : could not retrieve LVL1MuonRoIs");
132 return false;
133 }
134 Int_t threshold = getL1pt(l1item);
135 xAOD::MuonRoIContainer::const_iterator muroi_itr = muonrois->begin();
136 xAOD::MuonRoIContainer::const_iterator muroi_end = muonrois->end();
137 for( ; muroi_itr != muroi_end; ++muroi_itr ) {
138 if((*muroi_itr)->thrValue() >= threshold*1000){
139 Double_t dR = TrigMuonMatching::dR(eta, phi, (*muroi_itr)->eta(), (*muroi_itr)->phi());
140 if(dR < l1dr){
141 return true;
142 }
143 }
144 }
145 return false;
146 }
static Double_t sc
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
int getL1pt(const std::string &l1item) const
::StatusCode StatusCode
StatusCode definition for legacy code.
MuonRoIContainer_v1 MuonRoIContainer

◆ matchL1() [2/2]

Bool_t Trig::TrigMuonMatching::matchL1 ( const xAOD::Muon * mu,
const std::string & l1item,
const double DelR = 0.2 ) const
overridevirtual

Implements Trig::ITrigMuonMatching.

Definition at line 49 of file TrigMuonMatching.cxx.

52 {
53 return matchL1(mu->eta(),mu->phi(),l1item,DelR);
54 }
virtual Bool_t matchL1(const xAOD::Muon *mu, const std::string &l1item, const double DelR=0.2) const override

◆ matchL2CB()

Bool_t Trig::TrigMuonMatching::matchL2CB ( const xAOD::Muon * mu,
const std::string & chain,
const double DelR = 0.2 ) const
overridevirtual

Implements Trig::ITrigMuonMatching.

Definition at line 191 of file TrigMuonMatching.cxx.

194 {
195 const std::string eventTrigger = chain;
196
197 auto cg = m_trigDecTool->getChainGroup(eventTrigger);
198 auto fc = cg->features(TrigDefs::alsoDeactivateTEs);
199#if defined(XAOD_STANDALONE) || defined(XAOD_ANALYSIS)
200 auto MuFeatureContainers = fc.containerFeature<xAOD::L2CombinedMuonContainer>("",TrigDefs::alsoDeactivateTEs);
201#else
202 const std::vector< Trig::Feature<xAOD::L2CombinedMuonContainer> > MuFeatureContainers = fc.get<xAOD::L2CombinedMuonContainer>("", TrigDefs::alsoDeactivateTEs);
203#endif
204
205 for(auto mucont : MuFeatureContainers){
206 for(auto muon : *mucont.cptr()){
207 Double_t dR = TrigMuonMatching::dR(mu->eta(), mu->phi(), muon->eta(), muon->phi());
208 if(dR < DelR) return true;
209 }
210 }
211 return false;
212 }
L2CombinedMuonContainer_v1 L2CombinedMuonContainer
Define the latest version of the muon CB container.

◆ matchL2SA()

Bool_t Trig::TrigMuonMatching::matchL2SA ( const xAOD::Muon * mu,
const std::string & l1item,
const std::string & chain,
const double DelR = 0.2 ) const
overridevirtual

Implements Trig::ITrigMuonMatching.

Definition at line 148 of file TrigMuonMatching.cxx.

152 {
153 if(!m_trigDecTool->isPassed("L1_MU.*")){
154 return false;
155 }
156 const xAOD::MuonRoIContainer* muonrois = 0;
157 StatusCode sc = evtStore()->retrieve(muonrois,"LVL1MuonRoIs");
158 if(!sc){
159 ATH_MSG_ERROR("TrigMuonMatching::matchL1 : could not retrieve LVL1MuonRoIs");
160 return false;
161 }
162 xAOD::MuonRoIContainer::const_iterator muroi_itr = muonrois->begin();
163 xAOD::MuonRoIContainer::const_iterator muroi_end = muonrois->end();
164 Int_t threshold = getL1pt(l1item);
165 unsigned int ROI = 0;
166 for( ; muroi_itr != muroi_end; ++muroi_itr ) {
167 if(!((*muroi_itr)->thrValue() >= threshold*1000)) continue;
168 ROI = (*muroi_itr)->getRoI();
169 const std::string eventTrigger = chain;
170
171 auto cg = m_trigDecTool->getChainGroup(eventTrigger);
172 auto fc = cg->features(TrigDefs::alsoDeactivateTEs);
173#if defined(XAOD_STANDALONE) || defined(XAOD_ANALYSIS)
174 auto MuFeatureContainers = fc.containerFeature<xAOD::L2StandAloneMuonContainer>("",TrigDefs::alsoDeactivateTEs);
175#else
176 const std::vector< Trig::Feature<xAOD::L2StandAloneMuonContainer> > MuFeatureContainers = fc.get<xAOD::L2StandAloneMuonContainer>("", TrigDefs::alsoDeactivateTEs);
177#endif
178 for(auto mucont : MuFeatureContainers){
179 for(auto muon : *mucont.cptr()){
180 if(muon->roiNumber() == ROI){
181 Double_t dR = TrigMuonMatching::dR(mu->eta(), mu->phi(), muon->eta(), muon->phi());
182 if(dR < DelR) return true;
183 }
184 }
185 }
186 }
187
188 return false;
189 }
L2StandAloneMuonContainer_v2 L2StandAloneMuonContainer
Define the latest version of the muon SA container.

◆ metaDataStop()

StatusCode asg::AsgMetadataTool::metaDataStop ( )
protectedvirtualinherited

Function called when the tool should write out its metadata.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in BookkeeperDumperTool, BookkeeperTool, xAODMaker::TriggerMenuMetaDataTool, and xAODMaker::TruthMetaDataTool.

Definition at line 209 of file AsgMetadataTool.cxx.

209 {
210
211 // Return gracefully:
212 return StatusCode::SUCCESS;
213 }

◆ minDelR()

Double_t Trig::TrigMuonMatching::minDelR ( const xAOD::Muon * mu,
const std::string & chain,
const double mindelR = 0.1 ) const
overridevirtual

Implements Trig::ITrigMuonMatching.

Definition at line 56 of file TrigMuonMatching.cxx.

59 {
60 Double_t delmin = mindelR;
61 EFmuon efmuon,dummy;
62 return matchedTrackDetail(efmuon, dummy, mu->eta(), mu->phi(), delmin, chain);
63 }

◆ minDelRL1()

Double_t Trig::TrigMuonMatching::minDelRL1 ( const xAOD::Muon * mu,
const std::string & l1item,
const double DelR = 0.2 ) const
overridevirtual

Implements Trig::ITrigMuonMatching.

Definition at line 65 of file TrigMuonMatching.cxx.

68 {
69 Double_t l1dr = DelR;
70 const xAOD::MuonRoIContainer* muonrois = 0;
71 StatusCode sc = evtStore()->retrieve(muonrois,"LVL1MuonRoIs");
72 if(!sc){
73 ATH_MSG_ERROR("TrigMuonMatching::matchL1 : could not retrieve LVL1MuonRoIs");
74 return false;
75 }
76 Int_t threshold = getL1pt(l1item);
77 xAOD::MuonRoIContainer::const_iterator muroi_itr = muonrois->begin();
78 xAOD::MuonRoIContainer::const_iterator muroi_end = muonrois->end();
79 for( ; muroi_itr != muroi_end; ++muroi_itr ) {
80 if((*muroi_itr)->thrValue() >= threshold*1000){
81 Double_t dR = TrigMuonMatching::dR(mu->eta(), mu->phi(), (*muroi_itr)->eta(), (*muroi_itr)->phi());
82 if(dR < l1dr){
83 l1dr = dR;
84 }
85 }
86 }
87 return l1dr;
88 }

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ outputMetaStore()

AsgMetadataTool::MetaStorePtr_t asg::AsgMetadataTool::outputMetaStore ( ) const
inherited

Accessor for the output metadata store.

Definition at line 102 of file AsgMetadataTool.cxx.

102 {
103
104#ifdef XAOD_STANDALONE
105 return &m_outputMetaStore;
106#else // XAOD_STANDALONE
107 return m_outputMetaStore;
108#endif // XAOD_STANDALONE
109 }
MetaStore_t m_outputMetaStore
Object accessing the output metadata store.

◆ print()

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setUseIncidents()

void asg::AsgMetadataTool::setUseIncidents ( const bool flag)
inlineprotectedinherited

Definition at line 132 of file AsgMetadataTool.h.

133 {
135 }
bool flag
Definition master.py:29

◆ sysInitialize()

StatusCode asg::AsgMetadataTool::sysInitialize ( )
virtualinherited

Function initialising the tool in the correct way in Athena.

This function is used to set up the callbacks from IncidentSvc in Athena at the right time during initialisation, without the user having to do anything special in his/her code.

Reimplemented from AthCommonDataStore< AthCommonMsg< AlgTool > >.

Definition at line 115 of file AsgMetadataTool.cxx.

115 {
116
117#ifndef XAOD_STANDALONE
118 if (m_useIncidents) {
119 // Connect to the IncidentSvc:
120 ServiceHandle< IIncidentSvc > incSvc( "IncidentSvc", name() );
121 ATH_CHECK( incSvc.retrieve() );
122
123 // Set up the right callbacks: don't rethrow exceptions, any failure and we should end
124 incSvc->addListener( this, IncidentType::BeginEvent, 0, false );
125 }
126 // Let the base class do its thing:
127 ATH_CHECK( AlgTool::sysInitialize() );
128
129#endif // not XAOD_STANDALONE
130
131 // Return gracefully:
132 return StatusCode::SUCCESS;
133 }

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ tokenize()

void Trig::TrigMuonMatching::tokenize ( const std::string & str,
std::vector< std::string > & tokens,
const std::string & delimiters ) const
private

Definition at line 324 of file TrigMuonMatching.cxx.

327 {
328 tokens.clear();
329 std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
330 std::string::size_type pos = str.find_first_of(delimiters, lastPos);
331
332 while ((std::string::npos != pos) or (std::string::npos != lastPos)) {
333 tokens.push_back(str.substr(lastPos, pos - lastPos));
334 lastPos = str.find_first_not_of(delimiters, pos);
335 pos = str.find_first_of(delimiters, lastPos);
336 }
337 }

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_beginInputFileCalled

bool asg::AsgMetadataTool::m_beginInputFileCalled
privateinherited

Flag helping to discover when the tool misses the opening of the first input file.

Definition at line 126 of file AsgMetadataTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_DimuonChainMap

std::map<std::string, DimuonChainInfo> Trig::TrigMuonMatching::m_DimuonChainMap
private

Definition at line 99 of file TrigMuonMatching.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_inputMetaStore

MetaStore_t asg::AsgMetadataTool::m_inputMetaStore
privateinherited

Object accessing the input metadata store.

Definition at line 119 of file AsgMetadataTool.h.

◆ m_outputMetaStore

MetaStore_t asg::AsgMetadataTool::m_outputMetaStore
privateinherited

Object accessing the output metadata store.

Definition at line 121 of file AsgMetadataTool.h.

◆ m_trigDecTool

ToolHandle<Trig::TrigDecisionTool> Trig::TrigMuonMatching::m_trigDecTool
private

Definition at line 97 of file TrigMuonMatching.h.

◆ m_useIncidents

bool asg::AsgMetadataTool::m_useIncidents
privateinherited

Definition at line 128 of file AsgMetadataTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: