ATLAS Offline Software
muComb.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // ********************************************************************
6 //
7 // NAME: muComb.cxx
8 // PACKAGE: Trigger/TrigAlgorithms/TrigmuComb
9 // VERSION: V3 (MT Version)
10 //
11 // AUTHOR: S.Giagu <stefano.giagu@cern.ch>
12 //
13 // ********************************************************************
14 #include <sstream>
15 #include <math.h>
16 
17 #include "muComb.h"
18 #include "muCombUtil.h"
25 
26 #include "GaudiKernel/ThreadLocalContext.h"
27 
28 class ISvcLocator;
29 
30 muComb::muComb(const std::string& name, ISvcLocator* pSvcLocator):
31  AthReentrantAlgorithm(name, pSvcLocator)
32 {
33 }
34 
36 {
37  ATH_MSG_DEBUG("Initialization:");
38 
39  //Filed service
41 
42  if (!m_monTool.empty()) {
43  ATH_MSG_DEBUG("Retrieving monTool");
44  CHECK(m_monTool.retrieve());
45  } else {
46  ATH_MSG_INFO("No monTool configured => NO MONITORING");
47  }
48 
49  // BackExtrapolator services
50  if ( m_backExtrapolatorG4.retrieve().isFailure() ) {
51  ATH_MSG_ERROR("Unable to locate G4 BackExtrapolator tool ");
52  return StatusCode::FAILURE;
53  }
54 
55  ATH_CHECK( m_muonCollKey.initialize() );
56  //ATH_CHECK( m_muonROICollKey.initialize() );
58  ATH_CHECK( m_outputCBmuonCollKey.initialize() );
59 
60  return StatusCode::SUCCESS;
61 }
62 
63 // muon-trk match based on angular distance
64 // return 0 --> match, 1 --> no match
65 int muComb::drptMatch(const xAOD::L2StandAloneMuon* feature, double id_pt, double id_eta, double id_phi, int algo,
66  double& combPtInv, double& combPtRes, double& deta, double& dphi, double& dr) const
67 {
68  double pt = feature->pt() * Gaudi::Units::GeV;
69  double phi = feature->phiMS();
70  double eta = feature->etaMS();
71  return muComb::drptMatch(pt, eta, phi, id_pt, id_eta, id_phi, algo, combPtInv, combPtRes, deta, dphi, dr);
72 }
73 
74 int muComb::drptMatch(double pt, double eta, double phi, double id_pt, double id_eta, double id_phi, int algo,
75  double& combPtInv, double& combPtRes, double& deta, double& dphi, double& dr) const
76 {
77 
78  // algo: 1 --> R (+ pt), combined pt
79  // algo: 2 --> R match, Id pt
80  // algo: 3 --> R match, MS pt
81  // algo: 4 --> R match, infinite pt
82  if (algo < 1 || algo > 4) {
83  ATH_MSG_DEBUG(" muComb::drptMatch wrong algo parameter, it is: " << algo
84  << " while must be in the range [1,4], match failed!!!" );
85  return 1;
86  }
87 
88  double winDR = m_winDR;
89  double winPt = m_winPt;
90 
91  combPtRes = 0.0;
92  if (algo == 1) combPtInv = ((1. / pt) + (1. / id_pt)) * 0.5;
93  if (algo == 2) combPtInv = 1. / id_pt;
94  if (algo == 3) combPtInv = 1. / pt;
95  if (algo == 4) combPtInv = 1.e-33;
96 
97  double tmp_deta = std::max(eta, id_eta) - std::min(eta, id_eta);
98  double tmp_dphi = std::max(phi, id_phi) - std::min(phi, id_phi);
99  if (tmp_dphi >= M_PI) tmp_dphi = 2 * M_PI - tmp_dphi;
100  double tmp_dr = std::sqrt(tmp_deta * tmp_deta + tmp_dphi * tmp_dphi);
101 
102  dphi = tmp_dphi;
103  deta = tmp_deta;
104  dr = tmp_dr;
105 
106  bool passDR = true;
107  bool passPt = true;
108 
109  if (tmp_dr > winDR) passDR = false;
110 
111  ATH_MSG_DEBUG(" REGTEST Angular MU-ID match / dR / threshold / result:"
112  << " / " << tmp_dr
113  << " / " << winDR
114  << " / " << (passDR ? "true" : "false"));
115 
116  if (algo == 1 && winPt > 0) {
117  double tmp_dpt = std::fabs(std::fabs(pt) - std::fabs(id_pt)) / Gaudi::Units::GeV; //don't use charge info
118  if (tmp_dpt > winPt) passPt = false;
119  ATH_MSG_DEBUG( " REGTEST MU-ID match / dpt (GeV) / threshold (GeV) / result:"
120  << " / " << tmp_dpt
121  << " / " << winPt
122  << " / " << (passPt ? "true" : "false"));
123  }
124 
125  if (passDR && passPt) return 0;
126  else return 1;
127 }
128 
129 // get extrapolated muon properties
130 // status 0 --> OK, 1/2 --> no extrapolation (muon pt zero, muon angle zero)
132 {
133  ATH_MSG_DEBUG("in getExtrapolatedMuon");
135 
136  const EventContext& ctx = Gaudi::Hive::currentContext();
137 
138  //muFast parameters (in MeV!)
139  double phi = feature->phiMS();
140  //double eta = feature->etaMS();
141  double theta = 2.*std::atan(std::exp(-feature->etaMS()));
142  double p = 0.0;
143  if (std::sin(theta) != 0) {
144  p = (feature->pt() * Gaudi::Units::GeV) / std::sin(theta);
145  } else {
146  result.status = 2; //No match if muon angle is zero
147  return result;
148  }
149  result.charge = 1.0;
150  double q_over_p = 0.;
151  if (p != 0.) {
152  q_over_p = 1. / p;
153  result.charge = p / std::fabs(p);
154  } else {
155  result.status = 1; //No match if muon Pt is zero
156  return result;
157  }
158  double pt = feature->pt() * Gaudi::Units::GeV;
159  //double ptinv = 1/pt;
160  double eptinv = feature->deltaPt() * Gaudi::Units::GeV / pt / pt;
161 
162  result.isBarrel = ((feature->sAddress() != -1) ? true : false);
163  double etaShift = (result.isBarrel ? 0 : result.charge * 0.01);
164  bool doFix = kFALSE;
165 
166  //Superpoints
169  //int outer = (feature->sAddress() == -1) ? xAOD::L2MuonParameters::Chamber::EndcapOuter : xAOD::L2MuonParameters::Chamber::BarrelOuter;
170 
171  double sp1_z = feature->superPointZ(inner);
172  double sp1_R = feature->superPointR(inner);
173  double sp2_z = feature->superPointZ(middle);
174  double sp2_R = feature->superPointR(middle);
175 
176  if ((std::fabs(sp1_R) < 1000.)) {
177  sp1_z *= 10.;
178  sp1_R *= 10.;
179  }
180  if ((std::fabs(sp2_R) < 1300.)) {
181  sp2_z *= 10.;
182  }
183 
184  double R = sp1_R;
185  double z = sp1_z;
186 
187  if (R == 0. && z == 0.) { //treat patological endcap cases
188  doFix = kTRUE;
189  if (std::fabs(sp2_R) > 1300.) {
190  z = sp2_z;
191  if (z == 0.) z = 7600.;
192  R = z * std::tan(theta);
193  theta = 2.*std::atan(std::exp(-(feature->etaMS() - etaShift)));
194  }
195  }
196 
197  double x = R * std::cos(phi);
198  double y = R * std::sin(phi);
199 
200  Amg::Vector3D vertex(x, y, z);
201  Trk::PerigeeSurface beamSurface;
203  Trk::Perigee perigeeMS(0., 0., phi, theta, q_over_p, pgsf);
204 
205  std::unique_ptr<const Trk::TrackParameters> muonPerigee
206  (m_backExtrapolatorG4->extrapolate(ctx,perigeeMS, beamSurface, Trk::oppositeMomentum, true, Trk::muon));
207 
208  //Protection against failing extrapolation
209  if (!muonPerigee) { //G4 probably failed, getting LUT extrapolated values
210  result.eta = feature->eta();
211  result.phi = feature->phi();
212  } else {
213  double extr_theta = muonPerigee -> parameters()[Trk::theta];
214  result.phi = muonPerigee -> parameters()[Trk::phi0];
215  result.eta = -std::log(std::tan(extr_theta / 2.));
216  if (doFix) result.eta = -std::log(std::tan(theta / 2.));
217  }
218 
219  result.eeta = muCombUtil::getG4ExtEtaRes(feature->pt(), feature->etaMS());
220  result.ephi = muCombUtil::getG4ExtPhiRes(feature->pt(), feature->etaMS());
221  result.ptinv = 1.0e33;
222  if (pt != 0) result.ptinv = 1. / pt;
223  result.eptinv = eptinv;
224 
225  result.isRpcFailure = feature->isRpcFailure();
226  result.isTgcFailure = feature->isTgcFailure();
227 
228  result.status = 0; // can go ahead in matching logic
229 
230  return result;
231 }
232 
233 // muon-trk match based on Geant4 backextrapolated SA Muon matched with ID track
234 // return 0 --> match, 1/2/3/4/5/6 --> no match (muon pt zero, muon angle zero, ID pt zero, fail eta match, fail phi match, fail chi2 match)
236  double id_eta, double id_phi, double id_pt, double id_charge, double id_eeta, double id_ephi, double id_eipt,
237  double& combPtInv, double& combPtRes, double& deta, double& dphi, double& chi2, int& ndof) const
238 {
239  ATH_MSG_DEBUG("in g4Match");
240  if (extr.status != 0) return extr.status; // propagates the badness of the extrapolated muon, if appropriate
241 
242  chi2 = 1.0e30;
243  ndof = 0;
244 
245  //ID parameters
247  m_IDSCANRes_endcap3, m_IDSCANRes_endcap4, id_pt, id_eta);
248  double id_ptinv = 1.0e33;
249  if (id_pt != 0) {
250  id_ptinv = 1. / id_pt;
251  } else {
252  return 3; //no match if ID track Pt zero
253  }
254 
255  double id_eptinv = id_eipt; //now taken from Track itself ...
256 
257 
258  //Combined muon parameters
259  combPtInv = muCombUtil::getCombinedAverage(extr.ptinv, extr.eptinv, id_ptinv, id_eptinv);
260  combPtRes = muCombUtil::getCombinedAverageSigma(extr.eptinv, id_eptinv);
261  double q_tmp = extr.charge;
262  if (m_ChargeStrategy == 1) q_tmp = id_charge;
263  else if (m_ChargeStrategy == 2) {
264  if (1. / combPtInv > 50000.) q_tmp = extr.charge;
265  else q_tmp = id_charge;
266  }
267  combPtInv *= q_tmp;
268 
269  //Masaki/Kunihiro treatment of TGC/RPC readout problems
270  ATH_MSG_DEBUG( " Enlarge phi matching error in case TGC/RPC readout failed. : " << extr.isRpcFailure << " / " << extr.isTgcFailure);
271 
272  double ephi_to_use = extr.ephi;
273  if (extr.isTgcFailure || extr.isRpcFailure) ephi_to_use *= 2.0;
274 
275  //Match
276  deta = muCombUtil::getDeltaEta(extr.eta, id_eta);
277  dphi = muCombUtil::getDeltaPhi(extr.phi, id_phi);
278  int ndof_OLD = 0;
279  double chi2_OLD = muCombUtil::getChi2(ndof_OLD, combPtInv,
280  extr.eta, extr.eeta, extr.phi, ephi_to_use, extr.ptinv, extr.eptinv,
281  id_eta, 0.0, id_phi, 0.0, id_ptinv, id_eptinv, true);
282  chi2 = muCombUtil::getStdChi2(ndof, extr.eta, extr.eeta, extr.phi, ephi_to_use, extr.ptinv, extr.eptinv,
283  id_eta, id_eeta, id_phi, id_ephi, id_ptinv, id_eptinv, m_UseAbsPt);
284 
285 
286  ATH_MSG_DEBUG(" REGTEST Resolution / OLDIdRes / IdRes / muFastRes / combRes:"
287  << " / " << std::setw(11) << id_eptinv_OLD / Gaudi::Units::GeV
288  << " / " << std::setw(11) << id_eptinv / Gaudi::Units::GeV
289  << " / " << std::setw(11) << extr.eptinv / Gaudi::Units::GeV
290  << " / " << std::setw(11) << combPtRes / Gaudi::Units::GeV );
291 
292  ATH_MSG_DEBUG(" REGTEST Momentum / IdPt / muFastPt / CombPt :"
293  << " / " << std::setw(11) << 1. / id_ptinv / Gaudi::Units::GeV
294  << " / " << std::setw(11) << 1. / extr.ptinv / Gaudi::Units::GeV
295  << " / " << std::setw(11) << 1. / combPtInv / Gaudi::Units::GeV );
296 
297  ATH_MSG_DEBUG(" REGTEST Chi2 / ndof // Chi2OLD / ndofOLD :"
298  << " / " << std::setw(11) << chi2
299  << " / " << std::setw(11) << ndof
300  << " // " << std::setw(11) << chi2_OLD
301  << " / " << std::setw(11) << ndof_OLD );
302 
303  //Cuts
304  double winEtaSigma = m_WinEta_g4;
305  double winPhiSigma = m_WinPhi_g4;
306  double maxChi2 = m_Chi2Max_g4;
307  if (!extr.isBarrel) {//EC
308  winEtaSigma = m_WinEta_EC_g4;
309  winPhiSigma = m_WinPhi_EC_g4;
310  maxChi2 = m_Chi2Max_EC_g4;
311  }
312 
313  ATH_MSG_DEBUG(" REGTEST DeltaEta / DeltaPhi / WinEta / WinPhi:"
314  << " / " << std::setw(11) << std::fabs(deta)
315  << " / " << std::setw(11) << std::fabs(dphi)
316  << " / " << std::setw(11) << m_WeightEta_g4*winEtaSigma*std::sqrt(extr.eeta * extr.eeta)
317  << " / " << std::setw(11) << m_WeightPhi_g4*winPhiSigma*std::sqrt(ephi_to_use * ephi_to_use) );
318 
319  if (std::fabs(deta) > m_WeightEta_g4 * winEtaSigma * std::sqrt(extr.eeta * extr.eeta)) {
320  return 4;
321  }
322  if (std::fabs(dphi) > m_WeightPhi_g4 * winPhiSigma * std::sqrt(ephi_to_use * ephi_to_use)) {
323  return 5;
324  }
325  if (ndof >= m_NdofMin) {
326  if (chi2 > maxChi2) return 6;
327  }
328 
329  return 0; //match OK
330 }
331 
332 // muon-trk match based on LUT backextrapolated SA Muon matched with ID track
333 // return 0 --> match, 1/2/3/4/5/6 --> no match (muon pt zero, muon angle zero, ID pt zero, fail eta match, fail phi match, fail chi2 match)
335  double id_eta, double id_phi, double id_pt, double id_charge,
336  double& combPtInv, double& combPtRes, double& deta, double& dphi, double& chi2, int& ndof) const
337 {
338 
339  chi2 = 1.0e30;
340  ndof = 0;
341  //muFast parameters
342 
343  double pt = feature->pt() * Gaudi::Units::GeV;
344  if (pt == 0.) {
345  return 1; //No match if muFast Pt is zero
346  }
347 
348  bool isTS = ((feature->rMS() <= 10.) ? true : false);
349  bool isBarrel = ((feature->sAddress() != -1) ? true : false);
350 
351  double charge = pt / std::fabs(pt);
352  double ptinv = 1. / pt;
353  double eptinv = feature->deltaPt() * Gaudi::Units::GeV / pt / pt;
354 
355  //ID parameters
357  m_IDSCANRes_endcap3, m_IDSCANRes_endcap4, id_pt, id_eta);
358  double id_ptinv = 1.0e33;
359  //double id_ept = 1.0e33;
360  if (id_pt != 0) {
361  id_ptinv = 1. / id_pt;
362  //id_ept = id_eptinv * id_pt * id_pt;
363  } else {
364  return 3; //no match if ID track Pt zero
365  }
366 
367  //Combined muon parameters
368  combPtInv = muCombUtil::getCombinedAverage(ptinv, eptinv, id_ptinv, id_eptinv);
369  combPtRes = muCombUtil::getCombinedAverageSigma(eptinv, id_eptinv);
370  double q_tmp = charge;
371  if (m_ChargeStrategy == 1) q_tmp = id_charge;
372  else if (m_ChargeStrategy == 2) {
373  if (1. / combPtInv > 50000.) q_tmp = charge;
374  else q_tmp = id_charge;
375  }
376  combPtInv *= q_tmp;
377 
378  // Extrapolated (LUT) quantities (now stored in the xAOD::L2StandAloneMuon container)
379  double extr_eta = feature->eta();
380  double extr_eeta = feature->deltaEta();
381  double extr_phi = feature->phi();
382  double extr_ephi = feature->deltaPhi();
383  double extr_ptinv = ptinv;
384  double extr_eptinv = eptinv;
385 
386  //Masaki/Kunihiro treatment of TGC/RPC readout problems
387  ATH_MSG_DEBUG(" Enlarge phi matching error in case TGC/RPC readout failed. : " << feature->isRpcFailure() << " / " << feature->isTgcFailure() );
388 
389  if (feature->isTgcFailure() || feature->isRpcFailure()) extr_ephi *= 2.0;
390 
391  //Match
392  deta = muCombUtil::getDeltaEta(extr_eta, id_eta);
393  dphi = muCombUtil::getDeltaPhi(extr_phi, id_phi);
394  chi2 = muCombUtil::getChi2(ndof, combPtInv, extr_eta, extr_eeta, extr_phi, extr_ephi, extr_ptinv, extr_eptinv,
395  id_eta, 0.0, id_phi, 0.0, id_ptinv, id_eptinv, m_UseAbsPt);
396 
397 
398  ATH_MSG_DEBUG(" REGTEST Resolution / IdRes / muFastRes / combRes:"
399  << " / " << std::setw(11) << id_eptinv / Gaudi::Units::GeV
400  << " / " << std::setw(11) << extr_eptinv / Gaudi::Units::GeV
401  << " / " << std::setw(11) << combPtRes / Gaudi::Units::GeV );
402 
403  ATH_MSG_DEBUG(" REGTEST Momentum / IdPt / muFastPt / CombPt :"
404  << " / " << std::setw(11) << 1. / id_ptinv / Gaudi::Units::GeV
405  << " / " << std::setw(11) << 1. / ptinv / Gaudi::Units::GeV
406  << " / " << std::setw(11) << 1. / combPtInv / Gaudi::Units::GeV );
407 
408  ATH_MSG_DEBUG(" REGTEST Chi2 / ndof :"
409  << " / " << std::setw(11) << chi2
410  << " / " << std::setw(11) << ndof );
411 
412  //Cuts
413  double winEtaSigma = m_WinEta;
414  double winPhiSigma = m_WinPhi;
415  double maxChi2 = m_Chi2Max;
416  if (isTS) { //Trigger Station (barrel/EC)
417  winEtaSigma = m_WinEta_TS;
418  winPhiSigma = m_WinPhi_TS;
419  maxChi2 = m_Chi2Max_TS;
420  } else { //if endcaps and not TS
421  if (!isBarrel) {
422  winEtaSigma = m_WinEta_EC;
423  winPhiSigma = m_WinPhi_EC;
424  maxChi2 = m_Chi2Max_EC;
425  }
426  }
427  bool isFT = false;
428  if (isBarrel)
429  if ((id_phi >= -2.60 && id_phi <= -2.10) || (id_phi >= -1.10 && id_phi <= -0.50)) isFT = true;
430  if (isFT) { //if MS-feet region
431  winEtaSigma = m_WinEta_FE;
432  winPhiSigma = m_WinPhi_FE;
433  maxChi2 = m_Chi2Max_FE;
434  }
435 
436  ATH_MSG_DEBUG(" REGTEST DeltaEta / DeltaPhi / WinEta / WinPhi:"
437  << " / " << std::setw(11) << std::fabs(deta)
438  << " / " << std::setw(11) << std::fabs(dphi)
439  << " / " << std::setw(11) << m_WeightEta*winEtaSigma*std::sqrt(extr_eeta * extr_eeta)
440  << " / " << std::setw(11) << m_WeightPhi*winPhiSigma*std::sqrt(extr_ephi * extr_ephi) );
441 
442  if (std::fabs(deta) > m_WeightEta * winEtaSigma * std::sqrt(extr_eeta * extr_eeta)) {
443  return 4;
444  }
445  if (std::fabs(dphi) > m_WeightPhi * winPhiSigma * std::sqrt(extr_ephi * extr_ephi)) {
446  return 5;
447  }
448  if (ndof >= m_NdofMin) {
449  if (chi2 > maxChi2) return 6;
450  }
451 
452  return 0; //match OK
453 }
454 
455 
460 StatusCode muComb::execute(const EventContext& ctx) const
461 {
462  using namespace xAOD;
463 
464  // Monitoring variables
465  //Timer
466  auto timer = Monitored::Timer("TIME_execute");
467  //Input
468  auto ptMS = Monitored::Scalar("PtMS", -9999.);
469  auto etaMS = Monitored::Scalar("EtaMS", -9999.);
470  auto phiMS = Monitored::Scalar("PhiMS", -9999.);
471  auto zetaMS = Monitored::Scalar("ZetaMS", -9999.);
472  //ID
473  auto ptID = Monitored::Scalar("PtID", -9999.);
474  auto etaID = Monitored::Scalar("EtaID", -9999.);
475  auto phiID = Monitored::Scalar("PhiID", -9999.);
476  auto zetaID = Monitored::Scalar("ZetaID", -9999.);
477  //Combined
478  auto ptMC = Monitored::Scalar("PtMC", -9999.);
479  auto dEta = Monitored::Scalar("DEta", -9999.);
480  auto dPhi = Monitored::Scalar("DPhi", -9999.);
481  auto dZeta = Monitored::Scalar("DZeta", -9999.);
482  auto dR = Monitored::Scalar("DeltaR", -9999.);
483  //Failed
484  auto ptFL = Monitored::Scalar("PtFL", -9999.);
485  auto etaFL = Monitored::Scalar("EtaFL", -9999.);
486  auto phiFL = Monitored::Scalar("PhiFL", -9999.);
487  //Info
488  auto efficiency = Monitored::Scalar<int>("Efficiency", -1);
489  auto StrategyMC = Monitored::Scalar<int>("StrategyMC", -1);
490  auto ErrorFlagMC = Monitored::Scalar<int>("ErrorFlagMC", 0);
491  auto MatchFlagMC = Monitored::Scalar<int>("MatchFlagMC", 0);
492 
493 
494  auto mon = Monitored::Group(m_monTool, timer, ptMS, etaMS, phiMS, zetaMS,
495  ptID, etaID, phiID, zetaID,
496  ptMC, dEta, dPhi, dZeta, dR,
497  ptFL, etaFL, phiFL,
498  efficiency, StrategyMC, ErrorFlagMC, MatchFlagMC);
499 
500 
501  StrategyMC = m_AlgoStrategy;
502 
503  //Magnetic field status
504  bool toroidOn = !m_assumeToroidOff;
505  bool solenoidOn = !m_assumeSolenoidOff;
506 
508  const AtlasFieldCacheCondObj* fieldCondObj{*readHandle};
509  if (fieldCondObj == nullptr) {
510  ATH_MSG_ERROR("execute: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key());
511  return StatusCode::FAILURE;
512  }
513  MagField::AtlasFieldCache fieldCache;
514  fieldCondObj->getInitializedCache (fieldCache);
515 
516  toroidOn = fieldCache.toroidOn() && !m_assumeToroidOff;
517  solenoidOn = fieldCache.solenoidOn() && !m_assumeSolenoidOff;
518  ATH_MSG_DEBUG( "=========== Magnetic Field Status ========== " );
519  ATH_MSG_DEBUG( " Assuming Toroid OFF is: " << (m_assumeToroidOff ? "TRUE" : "FALSE") );
520  ATH_MSG_DEBUG( " Assuming Solenoid OFF is: " << (m_assumeSolenoidOff ? "TRUE" : "FALSE") );
521  ATH_MSG_DEBUG( " ---> Solenoid : " << ((solenoidOn) ? "ON" : "OFF") );
522  ATH_MSG_DEBUG( " ---> Toroid : " << ((toroidOn) ? "ON" : "OFF") );
523 
524  // Algorithm strategy
525  // select best matchinig strategy
526  int usealgo = 0; //extrapolated muon - ID match (default)
527  if (solenoidOn) {
528  if (toroidOn) {
529  if (m_AlgoStrategy == 0) usealgo = 0; //extrapolated muon - ID match
530  else usealgo = 1; //simple R-match w/o extrapolation (pt from combined MS-ID)
531  } else {
532  usealgo = 2; //simple R-match w/o extrapolation (pt from ID)
533  }
534  } else {
535  if (toroidOn) usealgo = 3; //simple R-match w/o extrapolation (pt from MS)
536  else usealgo = 4; //simple R-match w/o extrapolation (pt inf)
537  }
538 
539  ATH_MSG_DEBUG( "MuCombStrategy: " << usealgo );
540 
541  ATH_MSG_DEBUG( "=========== Matching windows g4 ========== " );
542  ATH_MSG_DEBUG( " WinEtaSigma g4: " << m_WinEta_g4 );
543  ATH_MSG_DEBUG( " WinPhiSigma g4: " << m_WinPhi_g4 );
544  ATH_MSG_DEBUG( " WinEtaSigma g4 EC: " << m_WinEta_EC_g4 );
545  ATH_MSG_DEBUG( " WinPhiSigma g4 EC: " << m_WinPhi_EC_g4 );
546  ATH_MSG_DEBUG( " WeightEta g4: " << m_WeightEta_g4 );
547  ATH_MSG_DEBUG( " WeightPhi g4: " << m_WeightPhi_g4 );
548  ATH_MSG_DEBUG( " Chi2Weight g4: " << m_Chi2Weight_g4 );
549  ATH_MSG_DEBUG( " " );
550 
551  // Create Combined muon collection and record it with WriteHandle
552  auto muonCBColl = SG::makeHandle (m_outputCBmuonCollKey, ctx);
553  ATH_CHECK( muonCBColl.record (std::make_unique<xAOD::L2CombinedMuonContainer>(),
554  std::make_unique<xAOD::L2CombinedMuonAuxContainer>()) );
555 
556  // Get input for seeding
557  auto muonColl = SG::makeHandle(m_muonCollKey, ctx); //SA muons
558 
559  // useL1 commented code to be removed once full muon chain with MT tested (SG)
560  //Bool_t useL1 = false;
561  if (muonColl->size() == 0) {
562  //ATH_MSG_DEBUG(" L2 SA Muon collection size = 0");
563  //if (usealgo == 2) {
564  // ATH_MSG_DEBUG(" L2StandAloneMuonContainer not found -> use L1 ROI " );
565  // useL1 = true;
566  //} else {
567  ATH_MSG_DEBUG(" L2StandAloneMuonContainer empty -> stop processing RoI, no match" );
568  return StatusCode::SUCCESS;
569  //}
570  }
571 
572  // useL1 commented code to be removed once full muon chain with MT tested (SG)
573  //xAOD::L2StandAloneMuonContainer* muonColl = const_cast<xAOD::L2StandAloneMuonContainer*>(const_muonColl);
574 
575  // retrieve L2StandAloneMuon (loop for L2 multi-track SA)
576  for(uint i_muonSA = 0; i_muonSA < muonColl->size(); i_muonSA++){
577 
578  const xAOD::L2StandAloneMuon* muonSA = muonColl->at(i_muonSA);
579 
581  muonCB->makePrivateStore();
582  muonCB->setPt(0.0);
583  muonCB->setStrategy(usealgo);
584 
585  // Save SA muon EL into CB muon
586  ElementLink<xAOD::L2StandAloneMuonContainer> muonSAEL(*muonColl, i_muonSA);
587  muonCB->setMuSATrackLink(muonSAEL);
588 
589  // check muonSA pt != 0
590  if (muonSA->pt() == 0.) {
591  ErrorFlagMC = 1;
592  if (usealgo == 2 || usealgo == 4) {
593  ATH_MSG_DEBUG(" L2StandAloneMuon pt = 0 --> using angular match" );
594  //if (usealgo == 2) useL1 = true;
595  } else {
596  ATH_MSG_DEBUG(" L2StandAloneMuon pt = 0 --> stop processing RoI, no match" );
597  muonCB->setErrorFlag(ErrorFlagMC);
598  muonCBColl->push_back(muonCB);
599  return StatusCode::SUCCESS;
600  }
601  }
602 
603  // useL1 commented code to be removed once full muon chain with MT tested (SG)
604  //double ptL1 = -999.;
605  //double etaL1 = -999.;
606  //double phiL1 = -999.;
607  double pt = -999.;
608  double eta = -999.;
609  double phi = -999.;
610  double eta_ms = -999.;
611  double phi_ms = -999.;
612  double zeta_ms = -999.;
613  // useL1 commented code to be removed once full muon chain with MT tested (SG)
614  //if (useL1) {
615  // auto muonROIColl = SG::makeHandle(m_muonROICollKey, ctx); // L1 muon ROI
616  // if (muonROIColl->size() == 0) {
617  // ATH_MSG_DEBUG(" L1 Muon RoI collection size = 0");
618  // ATH_MSG_DEBUG(" L2StandAloneMuon pt == 0. && no L1 && torid=OFF --> no match" );
619  // ErrorFlagMC = 1;
620  // muonCB->setErrorFlag(ErrorFlagMC);
621  // return StatusCode::SUCCESS;
622  // } else {
623  // const TrigRoiDescriptor* muonROI = *(muonROIColl->begin());
624  // ptL1 = (muonRoI)->getThresholdValue();
625  // etaL1 = (muonRoI)->eta();
626  // phiL1 = (muonRoI)->phi();
627  // ATH_MSG_DEBUG( " Input L1 muon pt (GeV) = " << (muonROI)->getThresholdValue()
628  // << " / eta = " << (muonROI)->eta()
629  // << " / phi = " << (muonROI)->phi()
630  // << " / roiID = " << (muonROI)->roiId() );
631  // }
632  //} else {
633 
634  pt = muonSA->pt();
635  eta = muonSA->eta();
636  phi = muonSA->phi();
637  eta_ms = muonSA->etaMS();
638  phi_ms = muonSA->phiMS();
639  zeta_ms = muonSA->zMS();
640 
641  ATH_MSG_DEBUG(" Input L2StandaloneMuon pt (GeV) = " << pt
642  << " / eta = " << eta
643  << " / phi = " << phi
644  << " / etaMS = " << eta_ms
645  << " / phiMS = " << phi_ms
646  << " / zMS = " << zeta_ms);
647  //}
648 
649  // ID tracks Decoding
650 
651  // how to retrieve a specific colection name?
653  if (!idTrackParticles.isValid()){
654  ATH_MSG_DEBUG(" Failed to get xAOD::TrackParticleContainer --> no match" );
655  ErrorFlagMC = 2;
656  muonCB->setErrorFlag(ErrorFlagMC);
657  muonCBColl->push_back(muonCB);
658  return StatusCode::SUCCESS;
659  }
660  if (idTrackParticles->size() < 1){
661  ATH_MSG_DEBUG(" xAOD::TrackParticleContainer has 0 tracks --> no match" );
662  ErrorFlagMC = 2;
663  muonCB->setErrorFlag(ErrorFlagMC);
664  muonCBColl->push_back(muonCB);
665  return StatusCode::SUCCESS;
666  }
667 
668  ATH_MSG_DEBUG( " Found xAOD::TrackParticleContainer with size: " << idTrackParticles->size() );
669 
670  // matching
671  double ptinv_comb = 0.;
672  double ptres_comb = 0.001;
673  double chi2_comb = 1.0e33;
674  int ndof_comb = -1;
675  double best_dr = 1.0e33;
676  double best_deta = 1.0e33;
677  double best_dphi = 1.0e33;
678  bool has_match = false;
679  int imatch = -1;
680  int matched_trk_idx = -1;
681  int matched_trk_idx_tmp = -1;
682 
683 
684  // retrieve extrapolated muon if G4 extrapolation was
685  // requested; in this way we don't compute it Ntrk times
686  // but only once per SA muon
687  ExtrapolationResult extr;
688  if (usealgo <= 0 && m_useBackExtrapolatorG4) {//Std match
689  extr = getExtrapolatedMuon(muonSA);
690  }
691 
692  for(const auto trkit:(*idTrackParticles)) {
693 
694  matched_trk_idx_tmp++;
695  double ptinv_tmp = 0.;
696  double ptres_tmp = 0.001;
697  double deta_tmp = 0.;
698  double dphi_tmp = 0.;
699  double dr_tmp = 0.;
700  double chi2_tmp = 0.;
701  int ndof_tmp = 0;
702  bool has_match_tmp = false;
703  int imatch_tmp = -1;
704 
705  //Select tracks
706  double phi_id = (trkit)->phi();
707  double eta_id = (trkit)->eta();
708  double qoverp_id = (trkit)->qOverP();
709  double q_id = ((trkit)->qOverP() > 0 ? 1.0 : -1.0);
710  double pt_id = (trkit)->pt() * q_id;
711 
712  double e_qoverp_id = std::sqrt((trkit)->definingParametersCovMatrix()(Trk::qOverP,Trk::qOverP));
713  double e_phi_id = std::sqrt((trkit)->definingParametersCovMatrix()(Trk::phi0,Trk::phi0));
714  double e_theta_id = std::sqrt((trkit)->definingParametersCovMatrix()(Trk::theta,Trk::theta));
715  double tanthetaov2 = std::fabs(std::exp(-eta));
716  double e_eta_id = std::fabs(0.5 * (1./tanthetaov2 + tanthetaov2) * e_theta_id);
717 
718  double e_qoverpt_id = e_qoverp_id;
719  double theta_id = (trkit)->theta();
720  if (std::sin(theta_id) != 0) e_qoverpt_id /= std::fabs(std::sin(theta_id)); //approximate
721 
722  ATH_MSG_DEBUG( " Found track: "
723  << " with pt (GeV) = " << pt_id / Gaudi::Units::GeV
724  << ", q = " << q_id
725  << ", eta = " << eta_id
726  << ", phi = " << phi_id
727  << ", th = " << theta_id
728  << ", ephi = " << e_phi_id
729  << ", eth = " << e_theta_id
730  << ", eeta = " << e_eta_id
731  << ", ip = " << qoverp_id
732  << ", eip = " << e_qoverp_id
733  << ", eipt = " << e_qoverpt_id );
734 
735  if (usealgo != 3) {
736  if ((std::fabs(pt_id) / Gaudi::Units::GeV) < m_PtMinTrk) continue;
737  }
738  if (std::fabs(eta_id) > m_EtaMaxTrk) continue;
739 
740  ATH_MSG_DEBUG(" Track selected " );
741 
742  if (usealgo > 0) {//DeltaR match
743  // commented code (useL1) to be removed once full muon chain with MT tested
744  //if (useL1) {
745  // imatch_tmp = drptMatch(ptL1, etaL1, phiL1, pt_id, eta_id, phi_id, usealgo, ptinv_tmp, ptres_tmp, deta_tmp, dphi_tmp, chi2_tmp);
746  //} else {
747  imatch_tmp = drptMatch(muonSA, pt_id, eta_id, phi_id, usealgo, ptinv_tmp, ptres_tmp, deta_tmp, dphi_tmp, chi2_tmp);
748  //}
749  if (imatch_tmp == 0) has_match_tmp = true;
750  } else { //Std match
752  imatch_tmp = mfMatch(muonSA, eta_id, phi_id, pt_id, q_id, ptinv_tmp, ptres_tmp, deta_tmp, dphi_tmp, chi2_tmp, ndof_tmp);
753  if (imatch_tmp == 0) has_match_tmp = true;
754  } else { //G4 match
755  imatch_tmp = g4Match(extr, eta_id, phi_id, pt_id, q_id, e_eta_id, e_phi_id, e_qoverpt_id, ptinv_tmp, ptres_tmp, deta_tmp, dphi_tmp, chi2_tmp, ndof_tmp);
756  if (imatch_tmp == 0) has_match_tmp = true;
757  }
758  }
759 
760  imatch = imatch_tmp;
761  if (!has_match_tmp) continue;
762 
763  // select nearest track
764  dr_tmp = std::sqrt(deta_tmp * deta_tmp + dphi_tmp * dphi_tmp);
765 
766  if (chi2_tmp <= chi2_comb) {//Select nearest track
767  has_match = true;
768  chi2_comb = chi2_tmp;
769  ndof_comb = ndof_tmp;
770  ptinv_comb = ptinv_tmp;
771  ptres_comb = ptres_tmp;
772  best_deta = deta_tmp;
773  best_dphi = dphi_tmp;
774  best_dr = dr_tmp;
775  imatch = imatch_tmp;
776  matched_trk_idx = matched_trk_idx_tmp;
777  }
778 
779  }//Tracks loop
780 
781  //Set monitored quantities (monitor only pt>6 GeV/c && standard matching)
782  if (usealgo == 0 && std::fabs(pt) >= 6.) {
783  ptMS = pt;
784  etaMS = eta;
785  phiMS = phi;
786  zetaMS = zeta_ms;
787  ptFL = pt;
788  etaFL = eta;
789  phiFL = phi;
790  if (ptMS > 100.) ptMS = 101.5;
791  if (ptMS < -100.) ptMS = -101.5;
792  if (ptFL > 100.) ptFL = 101.5;
793  if (ptFL < -100.) ptFL = -101.5;
794  }
795 
796  if (!has_match) {
797  ErrorFlagMC = 3;
798  MatchFlagMC = imatch;
799  if (usealgo == 0 && std::fabs(pt) >= 6.) efficiency = 0; //monitor only efficiency for mu6 && standard matching
800  ATH_MSG_DEBUG( " No matched ID tracks --> no match" );
801  muonCB->setErrorFlag(ErrorFlagMC);
802  muonCB->setMatchFlag(MatchFlagMC);
803  muonCBColl->push_back(muonCB);
804  return StatusCode::SUCCESS;
805  }
806 
807  //Save EL to ID trk into CB muon
808  ElementLink<xAOD::TrackParticleContainer> idtrkEL(*idTrackParticles, matched_trk_idx);
809  muonCB->setIdTrackLink(idtrkEL);
810 
811  double pt_id = muonCB->idTrack()->pt();
812  double q_id = ((muonCB->idTrack()->qOverP()) > 0 ? 1.0 : -1.0);
813  double phi_id = muonCB->idTrack()->phi();
814  double eta_id = muonCB->idTrack()->eta();
815  //const Trk::Perigee& idtrk_perigee = muonCB->idTrack()->perigeeParameters();
816  double zPos_id = muonCB->idTrack()->z0(); //idtrk_perigee.parameters()[Trk::z0];
817 
818  ATH_MSG_DEBUG(" SA muon macthed to ID track ..." );
819 
820  //Update monitored vars
821  MatchFlagMC = imatch;
822  ptFL = -9999.;
823  etaFL = -9999.;
824  phiFL = -9999.;
825  if (usealgo == 0 && std::fabs(pt) >= 6.) {
826  efficiency = 1;
827  ptID = pt_id / Gaudi::Units::GeV; //in GeV/c
828  etaID = eta_id;
829  phiID = phi_id;
830  zetaID = zPos_id;
831  ptMC = 1. / (ptinv_comb * Gaudi::Units::GeV); //in GeV/c
832  dZeta = zeta_ms - zPos_id;
833  dPhi = best_dphi;
834  dEta = best_deta;
835  dR = best_dr;
836 
837  if (ptMC > 100.) ptMC = 101.5;
838  if (ptMC < -100.) ptMC = -101.5;
839  if (ptID > 100.) ptID = 101.5;
840  if (ptID < -100.) ptID = -101.5;
841  }
842 
843  double prt_pt = pt;
844  // commented code (useL1) to be removed once full muon chain with MT tested
845  //if (useL1) prt_pt = ptL1;
846  ATH_MSG_DEBUG( " REGTEST Combination chosen: "
847  << " usealgo / IdPt (GeV) / muonPt (GeV) / CombPt (GeV) / chi2 / ndof: " << " / " << usealgo << " / " << pt_id*q_id / Gaudi::Units::GeV << " / " << prt_pt << " / " << 1. / ptinv_comb / Gaudi::Units::GeV << " / " << chi2_comb << " / " << ndof_comb );
848 
849  muonCB->setPt(std::fabs(1. / ptinv_comb));
850  muonCB->setEta(eta_id);
851  muonCB->setPhi(phi_id);
852 
853  float mcq = -1.0;
854  if (ptinv_comb > 0) mcq = 1.0;
855 
856  muonCB->setCharge(mcq);
857 
858  float mcresu = std::fabs(ptres_comb / (ptinv_comb * ptinv_comb));
859  ATH_MSG_DEBUG( " SigmaPt (GeV) is: " << mcresu / Gaudi::Units::GeV );
860  muonCB->setSigmaPt(mcresu);
861 
862  muonCB->setErrorFlag(ErrorFlagMC);
863  muonCB->setMatchFlag(MatchFlagMC);
864 
865  muonCBColl->push_back(muonCB);
866  }
867  return StatusCode::SUCCESS;
868 }
L2CombinedMuonAuxContainer.h
xAOD::TrackParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: TrackParticle_v1.cxx:73
ExtrapolationResult::status
int status
Definition: muComb.h:50
IDTPM::ndof
float ndof(const U &p)
Definition: TrackParametersHelper.h:142
muComb::m_WinEta_EC
Gaudi::Property< double > m_WinEta_EC
Number of sigmas for the Eta matching window LUT backextrapolator (EndCaps)
Definition: muComb.h:162
muComb::m_WeightEta
Gaudi::Property< double > m_WeightEta
Scale factor for the Eta matching window in LUT backextrapolator.
Definition: muComb.h:180
muComb::m_assumeToroidOff
Gaudi::Property< bool > m_assumeToroidOff
flag to assume B_Toroid=0 anyway
Definition: muComb.h:121
muComb::m_fieldCacheCondObjInputKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
Definition: muComb.h:92
muComb::muComb
muComb(const std::string &, ISvcLocator *)
Constructor.
Definition: muComb.cxx:30
xAOD::L2CombinedMuon_v1::setStrategy
void setStrategy(int value)
set algorithm strategy flag
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
get_generator_info.result
result
Definition: get_generator_info.py:21
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
muComb::m_WinPhi_EC_g4
Gaudi::Property< double > m_WinPhi_EC_g4
Number of sigmas for the Phi matching window LUT backextrapolator (EndCaps)
Definition: muComb.h:194
max
#define max(a, b)
Definition: cfImp.cxx:41
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
xAOD::L2StandAloneMuon_v2::etaMS
float etaMS() const
Get the eta at muon spectrometer.
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
muCombUtil::getDeltaEta
double getDeltaEta(double eta1, double eta2)
Get DeltaEta.
Definition: muCombUtil.cxx:352
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
IDTPM::R
float R(const U &p)
Definition: TrackParametersHelper.h:101
xAOD::etaMS
setSAddress etaMS
Definition: L2StandAloneMuon_v1.cxx:116
AtlasFieldCacheCondObj
Definition: AtlasFieldCacheCondObj.h:19
xAOD::L2StandAloneMuon_v2::isRpcFailure
int isRpcFailure() const
Get flag to see if RPC is properly read.
muComb::m_PtMinTrk
Gaudi::Property< double > m_PtMinTrk
Min Pt to select the ID track for matching.
Definition: muComb.h:143
xAOD::L2CombinedMuon_v1::setPhi
void setPhi(float phi)
Set the azimuthal angle ( ) of the muon.
Definition: L2CombinedMuon_v1.cxx:89
muComb::m_Chi2Max
Gaudi::Property< double > m_Chi2Max
Max Chi2 for the combined muon in LUT backextrapolator (Barrel)
Definition: muComb.h:160
Trk::PerigeeSurface
Definition: PerigeeSurface.h:43
xAOD::L2StandAloneMuon_v2
Class describing standalone muons reconstructed in the LVL2 trigger.
Definition: L2StandAloneMuon_v2.h:36
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
Trk::oppositeMomentum
@ oppositeMomentum
Definition: PropDirection.h:21
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
xAOD::L2StandAloneMuon_v2::deltaPt
float deltaPt() const
Get error of pT.
muComb::m_WeightPhi
Gaudi::Property< double > m_WeightPhi
Scale factor for the Phi matching window in LUT backextrapolator.
Definition: muComb.h:182
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
xAOD::TrackParticle_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: TrackParticle_v1.cxx:77
ExtrapolationResult::eptinv
double eptinv
Definition: muComb.h:43
muComb::m_Chi2Max_TS
Gaudi::Property< double > m_Chi2Max_TS
Max Chi2 for the combined muon in LUT backextrapolator (Trigger Stations)
Definition: muComb.h:172
ExtrapolationResult::isRpcFailure
int isRpcFailure
Definition: muComb.h:48
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:71
test_pyathena.pt
pt
Definition: test_pyathena.py:11
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::TrackParticle_v1::z0
float z0() const
Returns the parameter.
xAOD::L2MuonParameters::BarrelInner
@ BarrelInner
Inner station in the barrel spectrometer.
Definition: TrigMuonDefs.h:16
muComb::m_IDSCANRes_endcap4
Gaudi::Property< std::vector< double > > m_IDSCANRes_endcap4
Definition: muComb.h:215
L2StandAloneMuonContainer.h
ExtrapolationResult::eta
double eta
Definition: muComb.h:41
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
muComb::m_Chi2Max_g4
Gaudi::Property< double > m_Chi2Max_g4
Max Chi2 for the combined muon in LUT backextrapolator (Barrel)
Definition: muComb.h:190
xAOD::L2StandAloneMuon_v2::phiMS
float phiMS() const
Get the phi at muon spectrometer.
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
xAOD::L2CombinedMuon_v1::setCharge
void setCharge(float value)
set seeding muon charge
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
muComb::mfMatch
int mfMatch(const xAOD::L2StandAloneMuon *feature, double, double, double, double, double &, double &, double &, double &, double &, int &) const
Definition: muComb.cxx:334
muCombUtil::getG4ExtPhiRes
double getG4ExtPhiRes(double pt, double eta)
Get parametrized Geant4 Phi resolution (extrapolated)
Definition: muCombUtil.cxx:317
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
InDetAccessor::qOverP
@ qOverP
perigee
Definition: InDetAccessor.h:35
MagField::AtlasFieldCache::toroidOn
bool toroidOn() const
muComb::m_Chi2Weight_g4
Gaudi::Property< double > m_Chi2Weight_g4
Scale factor for the Chi2 1/pt resolutions (MS and ID) (Barrel)
Definition: muComb.h:202
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
muComb::getExtrapolatedMuon
ExtrapolationResult getExtrapolatedMuon(const xAOD::L2StandAloneMuon *feature) const
Definition: muComb.cxx:131
muComb::m_IDSCANRes_endcap2
Gaudi::Property< std::vector< double > > m_IDSCANRes_endcap2
Definition: muComb.h:213
x
#define x
muComb::m_ChargeStrategy
Gaudi::Property< int > m_ChargeStrategy
muComb charge assignment strategy: 0: useMuFast 1: use ID 2: use resolution model
Definition: muComb.h:137
ExtrapolationResult::charge
double charge
Definition: muComb.h:46
muComb::m_winPt
Gaudi::Property< double > m_winPt
max deltaPt for simpified matching
Definition: muComb.h:206
muComb::drptMatch
int drptMatch(double, double, double, double, double, double, int, double &, double &, double &, double &, double &) const
Definition: muComb.cxx:74
muComb::m_winDR
Gaudi::Property< double > m_winDR
max deltaR for simplified matching
Definition: muComb.h:208
muCombUtil.h
muCombUtil::getDeltaPhi
double getDeltaPhi(double phi1, double phi2)
Get DeltaPhi.
Definition: muCombUtil.cxx:345
xAOD::L2StandAloneMuon_v2::deltaEta
float deltaEta() const
Get error of eta.
xAOD::L2CombinedMuon_v1::setEta
void setEta(float eta)
Set the pseudorapidity ( ) of the muon.
Definition: L2CombinedMuon_v1.cxx:82
python.utils.AtlRunQueryTimer.timer
def timer(name, disabled=False)
Definition: AtlRunQueryTimer.py:86
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
xAOD::L2StandAloneMuon_v2::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
xAOD::L2CombinedMuon_v1
Class describing combined muon reconstructed in the LVL2 trigger.
Definition: L2CombinedMuon_v1.h:41
muCombUtil::getG4ExtEtaRes
double getG4ExtEtaRes(double pt, double eta)
Get parametrized Geant4 Eta resolution (extrapolated)
Definition: muCombUtil.cxx:288
muComb::m_Chi2Max_EC_g4
Gaudi::Property< double > m_Chi2Max_EC_g4
Max Chi2 for the combined muon in LUT backextrapolator (EndCaps)
Definition: muComb.h:196
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:269
xAOD::L2CombinedMuon_v1::setMatchFlag
void setMatchFlag(int value)
set algorithm match flag
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
xAOD::L2StandAloneMuon_v2::superPointR
float superPointR(int chamber) const
Get the measured radious of the muon in one particular super point.
Definition: L2StandAloneMuon_v2.cxx:179
ExtrapolationResult::ephi
double ephi
Definition: muComb.h:45
efficiency
void efficiency(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Definition: dependence.cxx:128
ExtrapolationResult
Definition: muComb.h:38
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
muComb::m_outputCBmuonCollKey
SG::WriteHandleKey< xAOD::L2CombinedMuonContainer > m_outputCBmuonCollKey
Definition: muComb.h:79
muComb::m_WinEta_EC_g4
Gaudi::Property< double > m_WinEta_EC_g4
Number of sigmas for the Eta matching window LUT backextrapolator (EndCaps)
Definition: muComb.h:192
muComb::execute
virtual StatusCode execute(const EventContext &ctx) const override
execute execute the combined muon FEX.
Definition: muComb.cxx:460
muCombUtil::getCombinedAverage
double getCombinedAverage(double p1, double sp1, double p2, double sp2)
Get weighted mean.
Definition: muCombUtil.cxx:362
xAOD::L2StandAloneMuon_v2::sAddress
int sAddress() const
Get the station address of the muon.
z
#define z
ExtrapolationResult::phi
double phi
Definition: muComb.h:42
Trk::theta
@ theta
Definition: ParamDefs.h:72
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
muComb::m_WinEta_FE
Gaudi::Property< double > m_WinEta_FE
Number of sigmas for the Eta matching window LUT backextrapolator (MS Feet region)
Definition: muComb.h:174
muComb::m_WinPhi_EC
Gaudi::Property< double > m_WinPhi_EC
Number of sigmas for the Phi matching window LUT backextrapolator (EndCaps)
Definition: muComb.h:164
muComb::m_WinPhi
Gaudi::Property< double > m_WinPhi
Number of sigmas for the Phi matching window LUT backextrapolator (Barrel)
Definition: muComb.h:158
xAOD::L2StandAloneMuon_v2::zMS
float zMS() const
Get the Z at muon spectrometer.
TauGNNUtils::Variables::Track::dPhi
bool dPhi(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:530
muCombUtil::getIDSCANRes
double getIDSCANRes(std::vector< double > barrelvec, std::vector< double > ec1vec, std::vector< double > ec2vec, std::vector< double > ec3vec, std::vector< double > ec4vec, double pt_id, double eta_id)
Get parametrized IDSCAN 1/pt resolution.
Definition: muCombUtil.cxx:190
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:522
ExtrapolationResult::isBarrel
bool isBarrel
Definition: muComb.h:47
ExtrapolationResult::isTgcFailure
int isTgcFailure
Definition: muComb.h:49
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
muComb::m_AlgoStrategy
Gaudi::Property< int > m_AlgoStrategy
muComb matching strategy: 0: auto select best option 1: simplified R,(Pt) matching
Definition: muComb.h:130
muComb::m_IDSCANRes_endcap3
Gaudi::Property< std::vector< double > > m_IDSCANRes_endcap3
Definition: muComb.h:214
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
Trk::muon
@ muon
Definition: ParticleHypothesis.h:28
muComb::m_WinPhi_g4
Gaudi::Property< double > m_WinPhi_g4
Number of sigmas for the Phi matching window LUT backextrapolator (Barrel)
Definition: muComb.h:188
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
MagField::AtlasFieldCache::solenoidOn
bool solenoidOn() const
status of the magnets
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
min
#define min(a, b)
Definition: cfImp.cxx:40
xAOD::L2CombinedMuon_v1::setSigmaPt
void setSigmaPt(float value)
set sigma combined Pt
muCombUtil::getStdChi2
double getStdChi2(int &ndof, double eta1, double seta1, double phi1, double sphi1, double qOvpt1, double sqOvpt1, double eta2, double seta2, double phi2, double sphi2, double qOvpt2, double sqOvpt2, bool useAbsPt)
Get Std Chi2.
Definition: muCombUtil.cxx:401
muComb::m_EtaMaxTrk
Gaudi::Property< double > m_EtaMaxTrk
Max abs(eta) to select the ID track for matching.
Definition: muComb.h:145
muComb::g4Match
int g4Match(const ExtrapolationResult &extr, double, double, double, double, double, double, double, double &, double &, double &, double &, double &, int &) const
Definition: muComb.cxx:235
xAOD::L2MuonParameters::EndcapMiddle
@ EndcapMiddle
Middle station in the endcap spectrometer.
Definition: TrigMuonDefs.h:20
xAOD::TrackParticle_v1::qOverP
float qOverP() const
Returns the parameter.
xAOD::L2CombinedMuon_v1::setIdTrackLink
void setIdTrackLink(const ElementLink< xAOD::TrackParticleContainer > &link)
set ID track used to make the CB muon
muComb::m_assumeSolenoidOff
Gaudi::Property< bool > m_assumeSolenoidOff
flag to assume B_Solenoid=0 anyway
Definition: muComb.h:123
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
charge
double charge(const T &p)
Definition: AtlasPID.h:494
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
SG::AuxElement::makePrivateStore
void makePrivateStore()
Create a new (empty) private store for this object.
Definition: AuxElement.cxx:172
xAOD::L2CombinedMuon
L2CombinedMuon_v1 L2CombinedMuon
Define the latest version of the muon CB class.
Definition: L2CombinedMuon.h:15
xAOD::L2StandAloneMuon_v2::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
xAOD::L2CombinedMuon_v1::setMuSATrackLink
void setMuSATrackLink(const ElementLink< xAOD::L2StandAloneMuonContainer > &link)
set SA muon used to make the CB muon
ExtrapolationResult::eeta
double eeta
Definition: muComb.h:44
xAOD::L2CombinedMuon_v1::setPt
void setPt(float pt)
Set the transverse momentum ( ) of the muon.
TrigMuonDefs.h
muComb.h
muComb::m_TrackParticleContainerKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_TrackParticleContainerKey
Definition: muComb.h:68
muComb::m_WinEta_g4
Gaudi::Property< double > m_WinEta_g4
Number of sigmas for the Eta matching window LUT backextrapolator (Barrel)
Definition: muComb.h:186
muComb::m_Chi2Max_EC
Gaudi::Property< double > m_Chi2Max_EC
Max Chi2 for the combined muon in LUT backextrapolator (EndCaps)
Definition: muComb.h:166
muComb::m_useBackExtrapolatorG4
Gaudi::Property< bool > m_useBackExtrapolatorG4
flag to switch between G4 and LUT based back-extrapolation
Definition: muComb.h:118
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
ExtrapolationResult::ptinv
double ptinv
Definition: muComb.h:40
muComb::m_WinPhi_FE
Gaudi::Property< double > m_WinPhi_FE
Number of sigmas for the Phi matching window LUT backextrapolator (MS Feet region)
Definition: muComb.h:176
muComb::m_UseAbsPt
Gaudi::Property< bool > m_UseAbsPt
Use Absolute value of the Pt in chi2 calculation (i.e.
Definition: muComb.h:152
y
#define y
muComb::m_Chi2Max_FE
Gaudi::Property< double > m_Chi2Max_FE
Max Chi2 for the combined muon in LUT backextrapolator (MS Feet region)
Definition: muComb.h:178
xAOD::L2MuonParameters::EndcapInner
@ EndcapInner
Inner station in the endcap spectrometer.
Definition: TrigMuonDefs.h:19
muComb::initialize
virtual StatusCode initialize() override
initialize.
Definition: muComb.cxx:35
muComb::m_IDSCANRes_endcap1
Gaudi::Property< std::vector< double > > m_IDSCANRes_endcap1
Definition: muComb.h:212
muComb::m_WinPhi_TS
Gaudi::Property< double > m_WinPhi_TS
Number of sigmas for the Phi matching window LUT backextrapolator (Trigger Stations)
Definition: muComb.h:170
plotBeamSpotMon.mon
mon
Definition: plotBeamSpotMon.py:67
muComb::m_WinEta_TS
Gaudi::Property< double > m_WinEta_TS
Number of sigmas for the Eta matching window LUT backextrapolator (Trigger Stations)
Definition: muComb.h:168
MagField::AtlasFieldCache
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
Definition: AtlasFieldCache.h:43
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:73
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
muComb::m_IDSCANRes_barrel
Gaudi::Property< std::vector< double > > m_IDSCANRes_barrel
Definition: muComb.h:211
python.LArCondContChannels.isBarrel
isBarrel
Definition: LArCondContChannels.py:659
muComb::m_NdofMin
Gaudi::Property< int > m_NdofMin
Min Number of DOF to apply the chi2 cut on macthing based on LUT and G4 backextrapolators.
Definition: muComb.h:150
xAOD::L2StandAloneMuon_v2::deltaPhi
float deltaPhi() const
Get error of phi.
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
xAOD::L2StandAloneMuon_v2::pt
virtual double pt() const
The transverse momentum ( ) of the particle.
xAOD::L2CombinedMuon_v1::idTrack
const xAOD::TrackParticle * idTrack() const
Get the ID track as a bare pointer.
Definition: L2CombinedMuon_v1.cxx:119
muComb::m_WeightPhi_g4
Gaudi::Property< double > m_WeightPhi_g4
Scale factor for the Phi matching window in LUT backextrapolator.
Definition: muComb.h:200
xAOD::L2StandAloneMuon_v2::rMS
float rMS() const
Get the R at muon spectrometer.
muComb::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: muComb.h:84
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
muCombUtil::getCombinedAverageSigma
double getCombinedAverageSigma(double sp1, double sp2)
Get sigma of weighted mean.
Definition: muCombUtil.cxx:369
TauGNNUtils::Variables::Track::dEta
bool dEta(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:525
muComb::m_backExtrapolatorG4
ToolHandle< Trk::IExtrapolator > m_backExtrapolatorG4
Handle to the G4 backExtrapolator tool.
Definition: muComb.h:87
xAOD::L2CombinedMuon_v1::setErrorFlag
void setErrorFlag(int value)
set algorithm error flag
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
muCombUtil::getChi2
double getChi2(int &ndof, double ipt, double eta1, double seta1, double phi1, double sphi1, double ipt1, double sipt1, double eta2, double seta2, double phi2, double sphi2, double ipt2, double sipt2, bool useAbsPt)
Get OLD style (i.e. muFast time) Chi2.
Definition: muCombUtil.cxx:374
xAOD::L2StandAloneMuon_v2::superPointZ
float superPointZ(int chamber) const
Get the measured Z position of the muon in one particular super point.
Definition: L2StandAloneMuon_v2.cxx:187
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
xAOD::L2MuonParameters::BarrelMiddle
@ BarrelMiddle
Middle station in the barrel spectrometer.
Definition: TrigMuonDefs.h:17
Monitored::Timer
A monitored timer.
Definition: MonitoredTimer.h:32
xAOD::L2StandAloneMuon_v2::isTgcFailure
int isTgcFailure() const
Get flag to see if TGC is properly read.
Trk::phi0
@ phi0
Definition: ParamDefs.h:71
TrackParticleContainer.h
muComb::m_WeightEta_g4
Gaudi::Property< double > m_WeightEta_g4
Scale factor for the Eta matching window in LUT backextrapolator.
Definition: muComb.h:198
xAOD::TrackParticle_v1::phi
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
L2StandAloneMuonAuxContainer.h
muComb::m_muonCollKey
SG::ReadHandleKey< xAOD::L2StandAloneMuonContainer > m_muonCollKey
Definition: muComb.h:73
muComb::m_WinEta
Gaudi::Property< double > m_WinEta
Number of sigmas for the Eta matching window LUT backextrapolator (Barrel)
Definition: muComb.h:156