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;
81 const xAOD::Muon *mu = *(muonLinks.at(0).link);
82 if( ! mu->primaryTrackParticle() )
continue;
84 bool is_idperf_muon =
false;
85 ATH_MSG_VERBOSE(
"... selected: muonType="<<mu->muonType()<<
", pT="<<mu->pt()/Gaudi::Units::GeV<<
", eta="<<mu->eta()<<
", phi="<<mu->phi()<<
", author="<<mu->author());
86 if(mu->author()==xAOD::Muon::Author::MuidCo && mu->muonType()==xAOD::Muon::MuonType::Combined) {
87 muons_cb.push_back(mu);
89 else if(mu->author()==xAOD::Muon::Author::MuidSA && mu->muonType()==xAOD::Muon::MuonType::MuonStandAlone) {
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 ) {
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);
106 float pt = track->pt();
107 float eta = track->eta();
108 float phi = track->phi();
109 ATH_MSG_VERBOSE(
"... pt / eta / phi = "<<pt/Gaudi::Units::GeV <<
" / " <<
eta <<
" / " <<
phi<<
", fitter="<<track->trackFitter());
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);
116 float pt = track->pt();
117 float eta = track->eta();
118 float phi = track->phi();
119 ATH_MSG_VERBOSE(
"... pt / eta / phi = "<<pt/Gaudi::Units::GeV <<
" / " <<
eta <<
" / " <<
phi<<
", fitter="<<track->trackFitter());
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;
140 float diMuMass = (tr_cb->
p4()+tr_sa->
p4()).M()/Gaudi::Units::GeV;
141 mnt_invMass.push_back(diMuMass);
142 ATH_MSG_VERBOSE(
"pt CB / pt SA = " << (*tr_cb).pt()/Gaudi::Units::GeV <<
" / " << (*tr_sa).pt()/Gaudi::Units::GeV <<
", mass =" << diMuMass);
147 StatusCode
sc =
doTPIdperf(tr_sa, tracks_pt, tracks_ftf);
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);
187 mnt_probe_pt = metrack->
pt()/Gaudi::Units::GeV;
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;
196 uint8_t pt_expectInnermost=0;
197 uint8_t pt_numberInnermost=0;
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();
242 float me_pt_gev = metrack->
pt()/Gaudi::Units::GeV;
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;
293 const xAOD::TrackParticle* idtrack = muon->trackParticle( xAOD::Muon::InnerDetectorTrackParticle );
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();
303 if(std::abs(reducedChi2) < CHI2_CUT && !
m_muonSelTool->isBadMuon(*muon) && qOverPsignif<QOVP_CUT && muon->author()==xAOD::Muon::MuidCo) passCut =
true;
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;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
Header file to be included by clients of the Monitored infrastructure.
Group of local monitoring quantities and retain correlation when filling histograms
Declare a monitored scalar variable.
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
const std::string & featureString()
int32_t getIndexFromLeg(const HLT::Identifier &legIdentifier)
Extract the numeric index of a leg identifier.
void findLinks(const Decision *start, const std::string &linkName, std::vector< LinkInfo< T > > &links, unsigned int behaviour=TrigDefs::allFeaturesOfType, std::set< const xAOD::TrigComposite * > *fullyExploredFrom=nullptr)
search back the TC links for the object of type T linked to the one of TC (recursively) Populates pro...
static const unsigned int lastFeatureOfType
Run 3 "enum". Only return the final feature along each route through the navigation.
float qOverPMatching(const xAOD::TrackParticle *metrack, const xAOD::TrackParticle *idtrack)
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Muon_v1 Muon
Reference the current persistent version:
@ expectInnermostPixelLayerHit
Do we expect a 0th-layer barrel hit for this track?
@ numberOfNextToInnermostPixelLayerHits
these are the hits in the 1st pixel barrel layer
@ expectNextToInnermostPixelLayerHit
Do we expect a 1st-layer barrel hit for this track?
@ numberOfInnermostPixelLayerHits
these are the hits in the 0th pixel barrel layer