20#define MUONMASS ParticleConstants::muonMassInMeV
42 return StatusCode::SUCCESS;
46 std::string_view chain,
47 const double mindelR)
const
49 return match(mu->eta(),mu->phi(),chain,mindelR);
53 std::string_view l1item,
54 const double DelR)
const
56 return matchL1(mu->eta(),mu->phi(),l1item,DelR);
60 std::string_view chain,
61 const double mindelR)
const
63 Double_t delmin = mindelR;
69 std::string_view l1item,
70 const double DelR)
const
74 StatusCode
sc =
evtStore()->retrieve(muonrois,
"LVL1MuonRoIs");
76 ATH_MSG_ERROR(
"TrigMuonMatching::matchL1 : could not retrieve LVL1MuonRoIs");
82 for( ; muroi_itr != muroi_end; ++muroi_itr ) {
83 if((*muroi_itr)->thrValue() >=
threshold*1000){
95 const std::string& chain,
96 std::pair<Bool_t, Bool_t>& result1,
97 std::pair<Bool_t, Bool_t>& result2,
98 const Double_t& mindelR)
100 TLorentzVector mu_1, mu_2;
103 Bool_t valid =
matchDimuon(mu_1,mu_2,chain,result1,result2,mindelR);
109 std::string_view chain,
110 const double mindelR)
const
115 Double_t delmin = mindelR;
124 std::string_view l1item,
125 const double DelR)
const
130 Double_t l1dr = DelR;
132 StatusCode
sc =
evtStore()->retrieve(muonrois,
"LVL1MuonRoIs");
134 ATH_MSG_ERROR(
"TrigMuonMatching::matchL1 : could not retrieve LVL1MuonRoIs");
140 for( ; muroi_itr != muroi_end; ++muroi_itr ) {
141 if((*muroi_itr)->thrValue() >=
threshold*1000){
152 std::string_view l1item,
153 std::string_view chain,
154 const double DelR)
const
160 StatusCode
sc =
evtStore()->retrieve(muonrois,
"LVL1MuonRoIs");
162 ATH_MSG_ERROR(
"TrigMuonMatching::matchL1 : could not retrieve LVL1MuonRoIs");
168 unsigned int ROI = 0;
169 const std::string emptyStr;
170 for( ; muroi_itr != muroi_end; ++muroi_itr ) {
171 if(!((*muroi_itr)->thrValue() >=
threshold*1000))
continue;
172 ROI = (*muroi_itr)->getRoI();
175#if defined(XAOD_STANDALONE) || defined(XAOD_ANALYSIS)
180 for(
const auto & mucont : MuFeatureContainers){
181 for(
auto muon : *mucont.cptr()){
182 if(muon->roiNumber() == ROI){
184 if(
dR < DelR)
return true;
194 std::string_view chain,
195 const double DelR)
const
199#if defined(XAOD_STANDALONE) || defined(XAOD_ANALYSIS)
205 for(
const auto & mucont : MuFeatureContainers){
206 for(
auto muon : *mucont.cptr()){
208 if(
dR < DelR)
return true;
215 const TLorentzVector& muon2,
216 const std::string& chain,
217 std::pair<Bool_t, Bool_t>& result1,
218 std::pair<Bool_t, Bool_t>& result2,
219 const Double_t& mindelR)
221 Double_t delmin = mindelR;
224 ATH_MSG_ERROR(
"TrigMuonMatching : Failed to decode chain " << chain <<
" matchDimuon can accept only chains named HLT_2muXX and HLT_muXX_mu8noL1.");
228 std::pair<Bool_t, Bool_t> rc12, rc21;
229 rc12 =
matchDimuon(muon1, muon2, chainInfo, delmin);
231 rc21.first = rc12.second; rc21.second = rc12.first;
235 rc21 =
matchDimuon(muon2, muon1, chainInfo, delmin);
238 result1.first = rc12.first; result1.second = rc21.second;
239 result2.first = rc21.first; result2.second = rc12.second;
245 const unsigned int bits =
m_trigDecTool->isPassedBits(trigger);
253 const TLorentzVector& muon2,
255 const double mindelR)
258 EFmuon trkId1, trkId2, dummy;
277 return std::pair<Bool_t, Bool_t> (trkId1.
valid, trkId2.
valid);
285 const double phi2)
const
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);
298 std::vector<std::string> tokens =
tokenize(l1item,
'_');
300 if (tokens.size() == 1) {
303 }
else if ((tokens.size() == 2 ) and (tokens.front() ==
"L1")) {
307 ATH_MSG_ERROR(
"TrigMuonMatching::getL1pt : cannot parse " << l1item);
311 const size_t index = pt.find(
"MU");
312 if (
index != std::string::npos) {
313 std::istringstream iss(pt.substr(
index + 2));
316 ATH_MSG_ERROR(
"TrigMuonMatching::getL1pt : cannot parse " << l1item);
327 const EFmuon& usedEFMuonId,
330 const double mindelR,
331 std::string_view chainForEventTrigger)
const
333 efMuonId.
valid =
false;
334 Double_t drmin = mindelR;
336 auto cg =
m_trigDecTool->getChainGroup(chainForEventTrigger);
337 auto fc = cg->features();
339#if defined(XAOD_STANDALONE) || defined(XAOD_ANALYSIS)
342 const std::vector< Trig::Feature<xAOD::MuonContainer> > MuFeatureContainers = fc.get<
xAOD::MuonContainer>();
345 for(
const auto & mucont : MuFeatureContainers){
346 for(
auto mu : *mucont.cptr()){
352 isEqual(usedEFMuonId.
phi, mu->phi()))
continue;
354 Double_t dr =
dR(
eta,
phi,mu->eta(),mu->phi());
357 efMuonId.
pt = mu->pt();
358 efMuonId.
eta = mu->eta();
359 efMuonId.
phi = mu->phi();
360 efMuonId.
valid =
true;
397 chainInfo = p->second;
400 std::vector<std::string> tokens =
tokenize(chainInfo.
chain,
'_');
401 if (tokens.size() < 2)
return false;
402 if (tokens[0] !=
"HLT")
return false;
403 chainInfo.
isSymmetric = (tokens[1].substr(0, 3) ==
"2mu");
406 std::string
threshold = std::string(
"HLT_" + tokens[1].substr(1));
412 if(tokens.size() != 3)
return false;
414 std::string high = std::string(
"HLT_" + tokens[1]);
427 if (std::fabs(
x -
y) < std::numeric_limits<float>::epsilon())
return true;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_INFO(x,...)
A number of constexpr particle constants to avoid hardcoding them directly in various places.
std::vector< std::string > tokenize(std::string_view the_str, std::string_view delimiters)
Splits the string into smaller substrings.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
DataModel_detail::const_iterator< DataVector > const_iterator
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(std::string_view l1item) const
TrigMuonMatching(const std::string &name)
std::map< std::string, DimuonChainInfo > m_DimuonChainMap
virtual Double_t minDelR(const xAOD::Muon *mu, std::string_view chain, const double mindelR=0.1) const override
bool isEqual(const double x, const double y) const
virtual Bool_t matchL1(const xAOD::Muon *mu, std::string_view l1item, const double DelR=0.2) const override
virtual Bool_t matchL2CB(const xAOD::Muon *mu, std::string_view chain, const double DelR=0.2) const override
ToolHandle< Trig::TrigDecisionTool > m_trigDecTool
virtual Double_t minDelRL1(const xAOD::Muon *mu, std::string_view l1item, const double DelR=0.2) const override
bool decodeDimuonChain(DimuonChainInfo &chainInfo)
virtual StatusCode initialize(void) override
Dummy implementation of the initialisation function.
Double_t matchedTrackDetail(EFmuon &efMuonId, const EFmuon &usedEFMuonId, const double eta, const double phi, const double mindelR, std::string_view chainEventTrigger) const
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
double dR(const double eta1, const double phi1, const double eta2, const double phi2) const
virtual Bool_t matchL2SA(const xAOD::Muon *mu, std::string_view l1item, std::string_view chain, const double DelR=0.2) const override
virtual ~TrigMuonMatching()
virtual Bool_t match(const xAOD::Muon *mu, std::string_view chain, const double mindelR=0.1) const override
virtual Bool_t isPassedRerun(const std::string &trigger) const override
virtual double pt() const override
The transverse momentum ( ) of the particle.
virtual double eta() const override
The pseudorapidity ( ) of the particle.
virtual double phi() const override
The azimuthal angle ( ) of the particle.
std::vector< std::string > tokenize(std::string_view the_str, std::string_view delimiters)
Splits the string into smaller substrings.
static const unsigned int EF_passedRaw
static const unsigned int EF_resurrected
static const unsigned int alsoDeactivateTEs
static const unsigned int EF_passThrough
The common trigger namespace for trigger analysis tools.
MuonRoIContainer_v1 MuonRoIContainer
L2CombinedMuonContainer_v1 L2CombinedMuonContainer
Define the latest version of the muon CB container.
L2StandAloneMuonContainer_v2 L2StandAloneMuonContainer
Define the latest version of the muon SA container.
Muon_v1 Muon
Reference the current persistent version:
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
std::pair< std::string, std::string > thresholds