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( mu->muonType()<=
m_muontype && (mu->author()==xAOD::Muon::Author::MuidCo || mu->author()==xAOD::Muon::Author::STACO) && mu->quality()==xAOD::Muon::Quality::Medium ){
51 return StatusCode::SUCCESS;
55StatusCode TrigMuonEfficiencyMon :: fillVariablesPerOfflineMuonPerChain(
const EventContext& ctx,
const xAOD::Muon* mu,
const std::string &chain)
const {
79 bool activestate =
false;
80 m_matchTool->matchL1(muEta, muPhi, 0.25, chain, activestate);
89 bool activestate =
false;
91 L2SApass = activestate;
100 bool activestate =
false;
102 L2CBpass = activestate;
111 bool activestate =
false;
113 EFSApass = activestate;
122 bool activestate =
false;
124 EFCBpass = activestate;
133 bool activestate =
false;
135 EFIsopass = activestate;
143 bool activestate =
false;
145 EFSAFSpass = activestate;
153 bool activestate =
false;
155 EFCBFSpass = activestate;
163 " doEFSA:" <<
m_doEFSA <<
" EFSApass:" << EFSApass <<
" doEFCB:" <<
m_doEFCB <<
" EFCBpass:" << EFCBpass <<
" doEFIso:" <<
m_doEFIso <<
" EFIsopass:" << EFIsopass <<
164 " doEFSAFS:" <<
m_doEFSAFS <<
" EFSAFSpass:" << EFSAFSpass <<
" doEFCBFS:" <<
m_doEFCBFS <<
" EFCBFSpass:" << EFCBFSpass);
168 fill(
m_group, muPt, L1pass, L2SApass, L2CBpass, EFSApass, EFCBpass, EFIsopass, EFSAFSpass, EFCBFSpass);
172 fill(
m_group, muEta, muPhi, averageMu, L1pass, L2SApass, L2CBpass, EFSApass, EFCBpass, EFIsopass, EFSAFSpass, EFCBFSpass);
175 return StatusCode::SUCCESS;
182 std::vector<float> vec_invmass;
185 std::vector<std::pair<const xAOD::Muon*, const xAOD::Muon*> > dimuons;
188 for(; mu1_it!=mu1_end; ++mu1_it){
191 if( mu1->
author()==xAOD::Muon::Author::unknown || mu1->
author()>xAOD::Muon::Author::STACO )
continue;
195 for(++mu2_it; mu2_it!=mu2_end; ++mu2_it){
198 if( mu2->
author()==xAOD::Muon::Author::unknown || mu2->
author()>xAOD::Muon::Author::STACO )
continue;
202 TLorentzVector lvmu1 = mu1->
p4();
203 TLorentzVector lvmu2 = mu2->
p4();
204 double dimu_mass = (lvmu1+lvmu2).M()/1.e3;
205 vec_invmass.push_back(dimu_mass);
207 bool bit_dR = lvmu1.DeltaR(lvmu2)>0.5;
213 if(extTrack1 && extTrack2){
214 TLorentzVector lvext1 = lvmu1;
215 TLorentzVector lvext2 = lvmu2;
216 double mupt1 = mu1->
pt();
217 double mupt2 = mu2->
pt();
218 lvext1.SetPtEtaPhiM( mupt1, extTrack1->
position().eta(), extTrack1->
position().phi(), mu1->
m());
219 lvext2.SetPtEtaPhiM( mupt2, extTrack2->
position().eta(), extTrack2->
position().phi(), mu2->
m());
225 if(
m_eff_method ==
"TTbarTagAndProbe" && !bit_dR )
continue;
227 if(
m_eff_method ==
"ZTagAndProbe" && !(bit_mass && bit_dR) )
continue;
229 dimuons.emplace_back(mu1,mu2);
237 for (std::pair<const xAOD::Muon*,const xAOD::Muon*> dimu : dimuons){
245 if(std::find(probes.begin(), probes.end(), dimu.second)==probes.end()){
247 if( std::abs( dimu.second->eta() ) > 0. && std::abs( dimu.second->eta() ) < 1.05 ) probes.push_back(dimu.second);
249 else probes.push_back(dimu.second);
253 if(std::find(probes.begin(), probes.end(), dimu.first)==probes.end()){
255 if( std::abs( dimu.first->eta() ) > 0. && std::abs( dimu.first->eta() ) < 1.05 ) probes.push_back(dimu.first);
257 else probes.push_back(dimu.first);
262 return StatusCode::SUCCESS;;
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
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
StatusCode selectMuonsTagAndProbe(SG::ReadHandle< xAOD::MuonContainer > &muons, std::vector< const xAOD::Muon * > &probes) const
Gaudi::Property< std::string > m_tag_trig
Gaudi::Property< bool > m_doEFCBFS
Gaudi::Property< bool > m_doL1
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
const Amg::Vector3D & position() const
Access method for the position.
const TrackParticle * primaryTrackParticle() const
Returns a pointer (which should not usually be NULL, but might be if the muon has been stripped of in...
virtual FourMom_t p4() const
The full 4-momentum of the particle.
virtual double m() const
The invariant mass of the particle..
virtual double pt() const
The transverse momentum ( ) of the particle.
MuonType muonType() const
virtual float lbAverageInteractionsPerCrossing(const EventContext &ctx=Gaudi::Hive::currentContext()) 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
ParametersBase< TrackParametersDim, Charged > TrackParameters
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)