60 return StatusCode::FAILURE;
64 ATH_CHECK(outputRoI_handle.
record(std::make_unique<xAOD::MuonRoIContainer>(), std::make_unique<xAOD::MuonRoIAuxContainer>()));
65 auto outputRoIs = outputRoI_handle.
ptr();
68 int n_output_tracks=0;
71 for (
const auto* part : *inputTruth) {
73 if (part->pdgId() != 13 && part->pdgId() != -13)
continue;
75 if (part->pt() < 2000.)
continue;
77 if (part->status() != 1)
continue;
79 if (std::abs(part->eta()) > 3.0)
continue;
82 <<
" eta=" << part->eta()
83 <<
" pT=" << part->pt() / 1000.
84 <<
"(GeV) q/pT=" << part->charge() * 1000. / part->pt()
85 <<
"(1/GeV) PDGID=" << part->pdgId()
86 <<
" status=" << part->status());
97 float qoverPt = part->charge() / part->pt();
99 if (
m_mySmearer->emulateL0MuonTrack(qoverPt, part->eta(), part->phi(), otrack) ==
false) {
100 ATH_MSG_DEBUG(
"Killed by the efficiency: q/pt=" << qoverPt * 1000. <<
" (1/GeV)");
107 <<
" eta=" << otrack.
eta()
108 <<
" pT=" << 1. / std::abs(otrack.
invpt() * 1000.)
109 <<
"(GeV) q/pT=" << 1000. * otrack.
invpt() <<
"(1/GeV)");
120 outputRoIs->push_back(std::make_unique<xAOD::MuonRoI>());
127 uint32_t phiword = uint32_t((otrack.
phi()+TMath::Pi()) / PHI_ROISIZE);
128 uint32_t etaword = uint32_t((otrack.
eta() + 2.7) / ETA_ROISIZE);
129 uint32_t ptword =
static_cast<uint32_t
>(1. / std::abs(otrack.
invpt() * 1000.) / PT_ROISIZE);
130 if (ptword > 0xff) ptword = 0xff;
133 float roi_eta = etaword * ETA_ROISIZE - 2.7;
134 float roi_phi = phiword * PHI_ROISIZE - TMath::Pi();
137 uint32_t roiword = (ptword<<24) | ((otrack.
invpt() > 0)<<23) | (phiword<<14) | etaword;
139 uint32_t extraword = (
static_cast<uint32_t
>(0x1)<<31) | (((ptword>>1) + 0x2) & 0xf);
141 std::string emu_thr_name =
"L0_MUx";
142 float thrvalue =
static_cast<float>(((ptword>>1) + 0x2) & 0xf);
143 outputRoIs->back()->initialize(roiword, roi_eta, roi_phi, emu_thr_name, thrvalue, extraword);
144 if (outputRoIs->back()->pt() == 0.){
148 ATH_MSG_DEBUG(
"L0MuonRoI: phi = " << roi_phi <<
" (0x" << std::hex << phiword << std::dec <<
"), "
149 <<
"eta = " << roi_eta <<
" (0x" << std::hex << etaword << std::dec <<
"), "
150 <<
"pT = " << outputRoIs->back()->pt() <<
" (GeV) (0x" << std::hex << ptword << std::dec <<
"), "
151 <<
"q/pT= " << ((otrack.
invpt() > 0) ? 1. : -1.) / outputRoIs->back()->pt());
157 auto roi_output_curv =
Monitored::Scalar<float>(
"roi_output_curv", (outputRoIs->back()->getCharge() > 0 ? 1. : -1.)/outputRoIs->back()->pt());
160 auto delta_phi =
Monitored::Scalar<float>(
"delta_phi", TVector2::Phi_mpi_pi(outputRoIs->back()->phi() - (part->phi())));
161 auto pt0 = part->pt();
162 if (pt0 == 0.) pt0 = 1e-9;
166 auto delta_curv =
Monitored::Scalar<float>(
"delta_curv", ((outputRoIs->back()->getCharge() == 1 ? 1. : -1.)/outputRoIs->back()->pt() - (part->charge()*1000./pt0)) / (part->charge()*1000./pt0));
169 delta_eta, delta_phi, delta_pt, delta_curv);
173 ATH_MSG_DEBUG (
"Result: Number of input truth muons= " << n_input_tracks <<
" , smeared tracks= "<< n_output_tracks);
175 return StatusCode::SUCCESS;