ATLAS Offline Software
TruthTrackSmearer.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "TruthTrackSmearer.h"
6 #include "CLHEP/Random/RandFlat.h"
7 #include "CLHEP/Random/RandGauss.h"
8 
9 namespace L0Muon {
10 
12 : m_rngWrapper(rngWrapper) {
13  m_efficiencyMap[0] = 0.0; // pT < 3 GeV
14  m_efficiencyMap[1] = 0.95; // pT > 3 GeV
15 }
16 
17 double TruthTrackSmearer::effFunc(double pt) const {
18  // TODO: Efficiency is changed at only 3 GeV...
19  return (pt < 3000.) ? m_efficiencyMap[0] : m_efficiencyMap[1];
20 }
21 
22 bool TruthTrackSmearer::emulateL0MuonTrack(double curv, float eta, float phi, L0MuonTrack& otrack) const {
23  // input curv(q/pT) is in MeV
24  CLHEP::HepRandomEngine* engine = m_rngWrapper->getEngine(Gaudi::Hive::currentContext());
25 
26  // efficiency emulation
27  double abspt = std::abs(1.0 / curv);
28  if (CLHEP::RandFlat::shoot(engine) > effFunc(abspt)) return false;
29 
30  // TODO: extrapolate to the pivot plane
31 
32  // position efficiency map
33  if (std::abs(eta) > 2.41) return false; // for the time being...
34 
35  // TODO: The position is NOT smeared here - since the binning of RoIs could be larger. To be checked.
36 
37  // pt smearing
38  double sigma = curv * 0.05; // TODO: 5% uniform for the time being...
39 
40  double gencurv = CLHEP::RandGauss::shoot(engine, curv, sigma);
41 
42  otrack.setTrack(gencurv, eta, phi);
43 
44  return true;
45 }
46 
47 } // end of namespace
L0Muon::L0MuonTrack
Definition: L0MuonTrack.h:11
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
L0Muon::TruthTrackSmearer::TruthTrackSmearer
TruthTrackSmearer(ATHRNG::RNGWrapper *rndWrapper)
Definition: TruthTrackSmearer.cxx:11
test_pyathena.pt
pt
Definition: test_pyathena.py:11
L0Muon::L0MuonTrack::setTrack
void setTrack(const double invpt, const float eta, const float phi)
Definition: L0MuonTrack.h:28
L0Muon
Definition: L0MuonSmearingAlg.cxx:13
L0Muon::TruthTrackSmearer::emulateL0MuonTrack
bool emulateL0MuonTrack(double curv, float eta, float phi, L0MuonTrack &otrack) const
Definition: TruthTrackSmearer.cxx:22
ATHRNG::RNGWrapper
A wrapper class for event-slot-local random engines.
Definition: RNGWrapper.h:56
ATHRNG::RNGWrapper::getEngine
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition: RNGWrapper.h:134
L0Muon::TruthTrackSmearer::effFunc
double effFunc(double pt) const
Definition: TruthTrackSmearer.cxx:17
L0Muon::TruthTrackSmearer::m_efficiencyMap
std::array< float, 2 > m_efficiencyMap
Definition: TruthTrackSmearer.h:31
L0Muon::TruthTrackSmearer::m_rngWrapper
ATHRNG::RNGWrapper * m_rngWrapper
Definition: TruthTrackSmearer.h:30
TruthTrackSmearer.h