7 #include "GaudiKernel/SystemOfUnits.h"
28 return StatusCode::FAILURE;
36 ATH_MSG_ERROR(
"Both mass cuts are <0. This is probably a configuration mistake.");
37 return StatusCode::FAILURE;
47 return StatusCode::SUCCESS;
59 ATH_MSG_DEBUG(
"Accept property is set: taking all the events");
64 std::vector<float> mnt_invMass;
69 std::vector<const xAOD::TrackParticle*> tracks_pt;
70 std::vector<const xAOD::TrackParticle*> tracks_ftf;
71 std::vector<const xAOD::Muon*> muons_cb;
72 std::vector<const xAOD::Muon*> muons_sa;
73 int i_leg_idperf = -1;
74 for(
auto leg: combination) {
75 auto decision= (*(
leg.second));
79 if( muonLinks.size() != 1 )
continue;
80 if( ! muonLinks.at(0).isValid() )
continue;
82 if( !
mu->primaryTrackParticle() )
continue;
84 bool is_idperf_muon =
false;
87 muons_cb.push_back(
mu);
90 muons_sa.push_back(
mu);
91 is_idperf_muon =
true;
92 if( i_leg_idperf == -1 ) { i_leg_idperf = i_leg; }
93 else if( i_leg_idperf != (
int)i_leg ) {
94 ATH_MSG_ERROR(
"i_leg for idperf looks inconsistent: i_leg_idperf / i_leg="<<i_leg_idperf<<
" / "<<i_leg);
100 if( is_idperf_muon ) {
101 const std::vector< TrigCompositeUtils::LinkInfo<xAOD::TrackParticleContainer> > ptLinks = TrigCompositeUtils::findLinks< xAOD::TrackParticleContainer >( decision,
"HLT_IDTrack_Muon_IDTrig", TrigDefs::lastFeatureOfType);
102 ATH_MSG_VERBOSE(
"PT TrackParticleContainer Links size = "<<ptLinks.size());
103 if( ptLinks.size() == 1 && ptLinks.at(0).isValid() ) {
105 tracks_pt.push_back(
track);
111 const std::vector< TrigCompositeUtils::LinkInfo<xAOD::TrackParticleContainer> > ftfLinks = TrigCompositeUtils::findLinks< xAOD::TrackParticleContainer >( decision,
"HLT_IDTrack_Muon_FTF", TrigDefs::lastFeatureOfType);
112 ATH_MSG_VERBOSE(
"FTF TrackParticleContainer Links size = "<< ftfLinks.size());
113 if( ftfLinks.size() == 1 && ftfLinks.at(0).isValid() ) {
115 tracks_ftf.push_back(
track);
125 for(
auto muon_cb : muons_cb) {
128 for(
auto muon_sa : muons_sa) {
131 const xAOD::TrackParticle* tr_cb = muon_cb->trackParticle(xAOD::Muon::TrackParticleType::CombinedTrackParticle);
132 const xAOD::TrackParticle* tr_sa = muon_sa->trackParticle(xAOD::Muon::TrackParticleType::ExtrapolatedMuonSpectrometerTrackParticle);
133 if (!tr_cb || !tr_sa) {
138 if(
m_selOS && (muon_cb->charge()*muon_sa->charge() > 0) )
continue;
141 mnt_invMass.push_back(diMuMass);
148 if(
sc != StatusCode::SUCCESS ) {
168 std::vector<float> mnt_PT_dr, mnt_PT_qovp;
169 std::vector<float> mnt_FTF_dr, mnt_FTF_qovp;
181 auto monitorIt =
Monitored::Group(
m_monTool, mon_PT_dr, mon_PT_qovp, mon_FTF_dr, mon_FTF_qovp, mon_phi_effi, mon_eta_effi, mon_pt_found, mon_ftf_found, mon_pt_phi, mon_pt_pix, mon_pt_pixnext);
188 mnt_probe_eta = metrack->
eta();
191 const float PT_DR_CUT = 0.1;
192 const float PT_QOVP_CUT = 2.0;
194 int n_pt_matched = 0;
195 float min_dr_pt_matched = 999;
198 uint8_t pt_expectNextToInnermost=0;
199 uint8_t pt_numberNextToInnermost=0;
200 for(
auto idtrack : tracks_pt) {
203 mnt_PT_dr.push_back(dr_pt);
204 mnt_PT_qovp.push_back(qovp_pt);
207 if( dr_pt > PT_DR_CUT )
continue;
208 if( qovp_pt > PT_QOVP_CUT )
continue;
210 if( dr_pt < min_dr_pt_matched ) {
211 min_dr_pt_matched = dr_pt;
212 mon_pt_phi = idtrack->phi();
219 if( n_pt_matched > 1 ) n_pt_matched=1;
222 const float FTF_DR_CUT = 0.2;
223 const float FTF_QOVP_CUT = 3.0;
225 int n_ftf_matched = 0;
226 for(
auto idtrack : tracks_ftf) {
229 mnt_FTF_dr.push_back(dr_pt);
230 mnt_FTF_qovp.push_back(qovp_pt);
233 if( dr_pt > FTF_DR_CUT )
continue;
234 if( qovp_pt > FTF_QOVP_CUT )
continue;
237 if( n_ftf_matched > 1 ) n_ftf_matched=1;
240 float me_eta = metrack->
eta();
241 float me_phi = metrack->
phi();
245 if( std::abs(me_eta) > 2.0 ) { eta_nr = 2; }
246 else if( std::abs(me_eta) > 1.0 ) { eta_nr = 1; }
248 if( me_pt_gev > 20.0 ) { pt_nr = 1; }
250 std::stringstream
ss;
251 ss <<
"PT_effi_pt" << pt_nr <<
"_eta" << eta_nr;
254 ss <<
"PT_effi_pt" << pt_nr <<
"_eta" << eta_nr;
257 mnt_PT_effi = n_pt_matched;
258 mnt_FTF_effi = n_ftf_matched;
261 mon_phi_effi = me_phi;
262 mon_eta_effi = me_eta;
263 mon_pt_found = n_pt_matched;
264 mon_ftf_found = n_ftf_matched;
265 if( n_pt_matched != 0 ) {
266 if( pt_expectInnermost == 1 ) {
267 if( pt_numberInnermost>0 ) {
273 if( pt_expectNextToInnermost == 1 ) {
274 if( pt_numberNextToInnermost>0 ) {
283 return StatusCode::SUCCESS;
291 bool passCut =
false;
294 const xAOD::TrackParticle* metrack =
muon->trackParticle( xAOD::Muon::ExtrapolatedMuonSpectrometerTrackParticle );
296 const float CHI2_CUT = 8.0;
297 const float QOVP_CUT = 7.0;
299 if( idtrack && metrack ) {
301 float reducedChi2 =
muon->primaryTrackParticle()->chiSquared()/
muon->primaryTrackParticle()->numberDoF();
312 bool passCut =
false;
314 const xAOD::TrackParticle* metrack =
muon->trackParticle( xAOD::Muon::ExtrapolatedMuonSpectrometerTrackParticle );
316 const float CHI2_CUT = 8.0;
319 float reducedChi2 =
muon->primaryTrackParticle()->chiSquared()/
muon->primaryTrackParticle()->numberDoF();
320 if( std::abs(reducedChi2) < CHI2_CUT && !
m_muonSelTool->isBadMuon(*
muon) ) passCut =
true;