10TrigMuonEfficiencyMon :: TrigMuonEfficiencyMon(
const std::string& name, ISvcLocator* pSvcLocator )
15StatusCode TrigMuonEfficiencyMon :: initialize(){
21 ATH_MSG_ERROR(
"Configuration seems to be wrong. The size of \"L1Seeds\" and \"Thresholds\" should be same as \"MonitoredChainds\".");
22 return StatusCode::FAILURE;
24 for(
unsigned int ichain=0; ichain<nchains; ++ichain){
33bool TrigMuonEfficiencyMon :: selectEvents()
const {
42 if(
m_eff_method.value().find(
"TagAndProbe")!=std::string::npos){
46 if(
static_cast<int>(mu->muonType())<=
m_muontype &&
47 mu->author()==xAOD::Muon::Author::MuidCo &&
48 mu->quality()==xAOD::Muon::Quality::Medium ){
53 return StatusCode::SUCCESS;
57StatusCode TrigMuonEfficiencyMon :: fillVariablesPerOfflineMuonPerChain(
const EventContext& ctx,
const xAOD::Muon* mu,
const std::string &chain)
const {
60 auto passBits=
m_trigDec->isPassedBits(chain);
62 ATH_MSG_DEBUG(
"Prescaled trigger: " << chain <<
" Skipping to normalize efficiencies");
63 return StatusCode::SUCCESS;
86 bool activestate =
false;
87 m_matchTool->matchL1(ctx, muEta, muPhi, 0.25, chain, activestate);
96 bool activestate =
false;
97 const bool isPh2FastReco = chain.find(
"newFast") != std::string::npos;
99 m_matchTool->matchFastRecoSA(ctx, mu, chain, activestate);
101 m_matchTool->matchL2SA(ctx, mu, chain, activestate);
103 L2SApass = activestate;
112 bool activestate =
false;
114 L2CBpass = activestate;
123 bool activestate =
false;
125 EFSApass = activestate;
134 bool activestate =
false;
136 EFCBpass = activestate;
145 bool activestate =
false;
147 EFIsopass = activestate;
155 bool activestate =
false;
157 EFSAFSpass = activestate;
165 bool activestate =
false;
167 EFCBFSpass = activestate;
175 " doEFSA:" <<
m_doEFSA <<
" EFSApass:" << EFSApass <<
" doEFCB:" <<
m_doEFCB <<
" EFCBpass:" << EFCBpass <<
" doEFIso:" <<
m_doEFIso <<
" EFIsopass:" << EFIsopass <<
176 " doEFSAFS:" <<
m_doEFSAFS <<
" EFSAFSpass:" << EFSAFSpass <<
" doEFCBFS:" <<
m_doEFCBFS <<
" EFCBFSpass:" << EFCBFSpass);
180 fill(
m_group, muPt, L1pass, L2SApass, L2CBpass, EFSApass, EFCBpass, EFIsopass, EFSAFSpass, EFCBFSpass);
184 fill(
m_group, muEta, muPhi, averageMu, L1pass, L2SApass, L2CBpass, EFSApass, EFCBpass, EFIsopass, EFSAFSpass, EFCBFSpass);
187 return StatusCode::SUCCESS;
194 std::vector<float> vec_invmass;
197 std::vector<std::pair<const xAOD::Muon*, const xAOD::Muon*> > dimuons;
200 for(; mu1_it!=mu1_end; ++mu1_it){
205 for(++mu2_it; mu2_it!=mu2_end; ++mu2_it){
210 TLorentzVector lvmu1 = mu1->
p4();
211 TLorentzVector lvmu2 = mu2->
p4();
212 double dimu_mass = (lvmu1+lvmu2).M()/1.e3;
213 vec_invmass.push_back(dimu_mass);
215 bool bit_dR = lvmu1.DeltaR(lvmu2)>0.5;
218 std::unique_ptr<Trk::TrackParameters> extTrack1 =
m_matchTool->extTrackToPivot(ctx, track1);
220 std::unique_ptr<Trk::TrackParameters> extTrack2 =
m_matchTool->extTrackToPivot(ctx, track2);
221 if(extTrack1 && extTrack2){
222 TLorentzVector lvext1 = lvmu1;
223 TLorentzVector lvext2 = lvmu2;
224 double mupt1 = mu1->
pt();
225 double mupt2 = mu2->
pt();
226 lvext1.SetPtEtaPhiM( mupt1, extTrack1->position().eta(), extTrack1->position().phi(), mu1->
m());
227 lvext2.SetPtEtaPhiM( mupt2, extTrack2->position().eta(), extTrack2->position().phi(), mu2->
m());
233 if(
m_eff_method ==
"TTbarTagAndProbe" && !bit_dR )
continue;
235 if(
m_eff_method ==
"ZTagAndProbe" && !(bit_mass && bit_dR) )
continue;
237 dimuons.emplace_back(mu1,mu2);
245 for (std::pair<const xAOD::Muon*,const xAOD::Muon*> dimu : dimuons){
253 if(std::find(probes.begin(), probes.end(), dimu.second)==probes.end()){
255 if( std::abs( dimu.second->eta() ) > 0. && std::abs( dimu.second->eta() ) < 1.05 ) probes.push_back(dimu.second);
256 }
else probes.push_back(dimu.second);
260 if(std::find(probes.begin(), probes.end(), dimu.first)==probes.end()){
262 if( std::abs( dimu.first->eta() ) > 0. && std::abs( dimu.first->eta() ) < 1.05 ) probes.push_back(dimu.first);
264 else probes.push_back(dimu.first);
269 return StatusCode::SUCCESS;;
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
const ToolHandle< Trig::TrigDecisionTool > & getTrigDecisionTool() const
Get the trigger decision tool member.
DataModel_detail::const_iterator< DataVector > const_iterator
Declare a monitored scalar variable.
std::map< std::string, double > m_thresholds
Gaudi::Property< bool > m_doEFIso
PublicToolHandle< Trig::TrigDecisionTool > m_trigDec
std::map< std::string, std::string > m_l1seeds
Gaudi::Property< std::vector< std::string > > m_monitored_chains_L1
Gaudi::Property< std::vector< double > > m_monitored_chains_threshold
Gaudi::Property< std::string > m_tag_trig
Gaudi::Property< bool > m_doEFCBFS
Gaudi::Property< bool > m_doL1
StatusCode selectMuonsTagAndProbe(const EventContext &ctx, SG::ReadHandle< xAOD::MuonContainer > &muons, std::vector< const xAOD::Muon * > &probes) const
Gaudi::Property< bool > m_doEFSAFS
Gaudi::Property< bool > m_doEFCB
Gaudi::Property< bool > m_doEFSA
Gaudi::Property< double > m_mass_lowlim
Gaudi::Property< bool > m_BarrelOnly
Gaudi::Property< double > m_mass_highlim
Gaudi::Property< std::string > m_eff_method
Gaudi::Property< bool > m_doL2SA
Gaudi::Property< std::string > m_event_trigger
Gaudi::Property< bool > m_use_extrapolator
Gaudi::Property< bool > m_doL2CB
Gaudi::Property< std::string > m_group
Name of monitored group.
TrigMuonMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Gaudi::Property< std::vector< std::string > > m_monitored_chains
List of trigger chains that are monitored in fillVariablesPerChain and fillVariablesPerOfflineMuonPer...
Gaudi::Property< int > m_muontype
Requirement for the offline muon type considered in analyses.
virtual StatusCode initialize() override
initialize
ToolHandle< CP::IMuonSelectionTool > m_muonSelectionTool
ToolHandle< MuonMatchingTool > m_matchTool
virtual double m() const override
The invariant mass of the particle..
virtual double pt() const override
The transverse momentum ( ) of the particle.
const TrackParticle * trackParticle(TrackParticleType type) const
Returns a pointer (which can be a nullptr) to the TrackParticle used in identification of this muon.
virtual FourMom_t p4() const override
The full 4-momentum of the particle.
virtual float lbAverageInteractionsPerCrossing(const EventContext &ctx) const
Calculate the average mu, i.e.
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
static const unsigned int requireDecision
static const unsigned int EF_prescaled
static const unsigned int L1_isPassedAfterVeto
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Muon_v1 Muon
Reference the current persistent version:
void fill(H5::Group &out_file, size_t iterations)