2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
6 template <class T, class FUNCT>
7 StatusCode TrigMuonMonitorAlgorithm::fillVariablesRatioPlots(const EventContext &ctx, const xAOD::Muon* mu,
8 std::string &&trigstep,
9 xAOD::Muon::TrackParticleType type,
10 FUNCT matchFunc) const
13 const xAOD::TrackParticle* OfflineTrack = mu->trackParticle(type);
15 auto AboveCut = Monitored::Scalar<bool>(trigstep+"AboveCut",false);
16 float OffPt = OfflineTrack->pt()/1e3;
17 if ( OffPt > m_ratio_measurement_threshold ){
18 const T *trigMu = matchFunc(ctx, mu);
20 if ( std::abs( trigMu->pt() ) > m_ratio_measurement_threshold ) AboveCut = true;
24 auto lb = Monitored::Scalar<int>("LB",-1.0);
25 lb = GetEventInfo(ctx)->lumiBlock();
26 fill(m_group, lb, AboveCut);
29 return StatusCode::SUCCESS;
34 StatusCode TrigMuonMonitorAlgorithm::fillVariableEtaPhi(const EventContext &ctx,
35 SG::ReadHandleKey<DataVector<T> > ReadHandleKey,
36 std::string &&trigstep,
37 std::tuple<bool,double,double> (*PosFunc)(const T*)) const
40 using CONTAINER = DataVector<T>;
41 SG::ReadHandle<CONTAINER> trigmuons(ReadHandleKey, ctx);
42 if (! trigmuons.isValid() ) {
43 ATH_MSG_ERROR("evtStore() does not contain collection with name "<< ReadHandleKey);
44 return StatusCode::FAILURE;
47 for (const auto& trigmu : *trigmuons) {
49 auto Eta = Monitored::Scalar<float>(trigstep+"Eta",-999.);
50 auto Phi = Monitored::Scalar<float>(trigstep+"Phi",-999.);
52 const auto [status, trigEta, trigPhi] = PosFunc(trigmu);
56 fill(m_group, Eta, Phi);
60 return StatusCode::SUCCESS;
65 std::tuple<bool, double, double> TrigMuonMonitorAlgorithm::defaultPosFunc(const T* trig){
66 return std::abs(trig->pt()) > 0.00001 ? std::forward_as_tuple(true, trig->eta(), trig->phi()) : std::forward_as_tuple(false,0.,0.) ;