Skip to content
Snippets Groups Projects

Clean up Run2 stuff in TrackMonitor

Merged Peilian Li requested to merge peilian_trackmoniter into master
@@ -81,7 +81,7 @@ StatusCode TrackMonitor::execute() {
std::map<std::string, unsigned int> multiplicityMap;
// # number of tracks
plot( tracks.size(), 1, "# tracks", 0., 500., 50 );
plot( tracks.size(), "nTracks", "# tracks", 0., 500., 50 );
plot( tracks.size(), "TrackMultiplicityFine", "# tracks", 0.0, 2000., 200 );
// histograms per track
@@ -89,7 +89,7 @@ StatusCode TrackMonitor::execute() {
std::string type = histoDirName( *track );
multiplicityMap[type] += 1;
fillHistograms( *track, type );
plot( track->type(), 2, "track type", -0.5, 10.5, 11 );
plot( track->type(), "trackType", "track type", -0.5, 10.5, 11 );
plot( track->history(), "history", "track history", -0.5, 23.5, 24 );
}
@@ -117,53 +117,54 @@ void TrackMonitor::findRefStates( const LHCb::Track& track, const LHCb::State*&
}
namespace {
enum HitType { VeloR = 0, VeloPhi, VPX, VPY, TT, IT, OT, Muon, HitTypeUnknown };
const std::string HitTypeName[] = {"VeloR", "VeloPhi", "VPX", "VPY", "TT", "IT", "OT", "Muon"};
double HitTypeMaxRes[] = {0.1, 0.1, 0.1, 0.1, 0.5, 0.5, 2.0, 10};
enum HitType { VPX = 0, VPY, UT, FT, Muon, HitTypeUnknown };
const std::string HitTypeName[] = {"VPX", "VPY", "UT", "FT", "Muon"};
// TODO: not sure if these values still make sense for Run3?
double HitTypeMaxRes[] = {0.1, 0.1, 0.5, 2.0, 10};
inline HitType hittypemap( const LHCb::Measurement& meas ) {
return meas.visit(
[]( const LHCb::Measurement::VP& vp ) {
return vp.projection() == LHCb::Measurement::VP::Projection::X ? VPX : VPY;
},
[]( const LHCb::Measurement::UT& ) { return HitType::TT; },
[]( const LHCb::Measurement::FT& ) { return HitType::IT; },
[]( const LHCb::Measurement::UT& ) { return HitType::UT; },
[]( const LHCb::Measurement::FT& ) { return HitType::FT; },
[]( const LHCb::Measurement::Muon& ) { return HitType::Muon; }, []( ... ) { return HitType::HitTypeUnknown; } );
}
} // namespace
void TrackMonitor::fillHistograms( const LHCb::Track& track, const std::string& type ) const {
// plots we should always make...
plot( track.probChi2(), type + "/2", "probChi2", 0, 1, 50 );
plot( track.chi2PerDoF(), type + "/3", "chi2/ndof", 0, m_maxChi2Dof );
plot( track.probChi2(), type + "/probChi2", "probChi2", 0, 1, 50 );
plot( track.chi2PerDoF(), type + "/ndof", "chi2/ndof", 0, m_maxChi2Dof );
plot( track.ghostProbability(), type + "/ghostProb", "ghostProb", 0, 1.0 );
plot( track.nLHCbIDs(), type + "/4", "#nLHCbIDs", -0.5, 60.5, 61 );
plot( track.pseudoRapidity(), type + "/7", "eta", 0.95, 6.05, 50 );
plot( track.phi(), type + "/8", "phi", -M_PI, M_PI, 50 );
plot( track.nLHCbIDs(), type + "/nLHCbIDs", "#nLHCbIDs", -0.5, 60.5, 61 );
plot( track.pseudoRapidity(), type + "/eta", "eta", 0.95, 6.05, 50 );
plot( track.phi(), type + "/phi", "phi", -M_PI, M_PI, 50 );
plot( track.nDoF(), type + "/ndof", "ndof", -0.5, 50.5, 51 );
plot( track.flag(), type + "/flag", "flag", -0.5, 255.5, 256 );
plot( track.history(), type + "/history", "history", -0.5, 23.5, 24 );
plot( track.fitStatus(), type + "/fitstatus", "fit status", -0.5, 5.5, 6 );
plot( nMeasurements( track ), type + "/100", "#nMeas", -0.5, 60., 61 );
plot( nMeasurements( track ), type + "/nMeasurements", "#nMeas", -0.5, 60., 61 );
const LHCb::State& firststate = track.firstState();
plot( firststate.x(), type + "/120", "x of first state", -100, 100 );
plot( firststate.y(), type + "/121", "y of first state", -100, 100 );
plot( firststate.z(), type + "/122", "z of first state", -500, 500 );
plot( firststate.tx(), type + "/123", "tx of first state", -1.0, 1.0 );
plot( firststate.ty(), type + "/124", "ty of first state", -1.0, 1.0 );
plot( firststate.qOverP(), type + "/125", "q/p of first state", -0.001, 0.001 );
plot( firststate.x(), type + "/x_firststate", "x of first state", -100, 100 );
plot( firststate.y(), type + "/y_firststate", "y of first state", -100, 100 );
plot( firststate.z(), type + "/z_firststate", "z of first state", -500, 500 );
plot( firststate.tx(), type + "/tx_firststate", "tx of first state", -1.0, 1.0 );
plot( firststate.ty(), type + "/ty_firststate", "ty of first state", -1.0, 1.0 );
plot( firststate.qOverP(), type + "/qop_firststate", "q/p of first state", -0.001, 0.001 );
if ( firststate.tx() != 0 || firststate.ty() != 0 ) {
const TrackVector& vec = firststate.stateVector();
double z = firststate.z();
z -= ( vec[0] * vec[2] + vec[1] * vec[3] ) / ( vec[2] * vec[2] + vec[3] * vec[3] );
plot( z, type + "/126", "z closest to z-axis", -2000, 2000 );
plot( z, type + "/z_closet_tozaxis", "z closest to z-axis", -2000, 2000 );
}
if ( firststate.qOverP() != 0 ) {
plot( track.p() / Gaudi::Units::GeV, type + "/5", "momentum", 0., m_maxMomentum, 100 );
plot( track.pt() / Gaudi::Units::GeV, type + "/6", "pt", 0, 10, 100 );
plot( track.p() / Gaudi::Units::GeV, type + "/p", "momentum", 0., m_maxMomentum, 100 );
plot( track.pt() / Gaudi::Units::GeV, type + "/pt", "pt", 0, 10, 100 );
}
const LHCb::TrackFitResult* fit = fitResult( track );
@@ -175,13 +176,17 @@ void TrackMonitor::fillHistograms( const LHCb::Track& track, const std::string&
// found hits of each type
const std::vector<LHCb::LHCbID>& ids = track.lhcbIDs();
const auto nUTHits = std::count_if( ids.begin(), ids.end(), []( const LHCb::LHCbID& id ) { return id.isUT(); } );
const auto nVPHits = std::count_if( ids.begin(), ids.end(), []( const LHCb::LHCbID& id ) { return id.isVP(); } );
const auto nFTHits = std::count_if( ids.begin(), ids.end(), []( const LHCb::LHCbID& id ) { return id.isFT(); } );
const auto nMuonHits = std::count_if( ids.begin(), ids.end(), []( const LHCb::LHCbID& id ) { return id.isMuon(); } );
plot( nMuonHits, type + "/116", "# Muon hits", -0.5, 20.5, 21 );
plot( nUTHits, type + "/117", "# UT hits", -0.5, 10.5, 11 );
plot( nMuonHits, type + "/nMuonHits", "# Muon hits", -0.5, 20.5, 21 );
plot( nUTHits, type + "/nUTHits", "# UT hits", -0.5, 10.5, 11 );
plot( nVPHits, type + "/nVPHits", "# UT hits", -0.5, 26.5, 27 );
plot( nFTHits, type + "/nFTHits", "# UT hits", -0.5, 15.5, 16 );
size_t numoutliers( 0 );
HitType mtype = VeloR; // initialize to avoid compiler warning
HitType mtype = VPX; // initialize to avoid compiler warning
for ( const auto& node : nodes( track ) ) {
if ( node->type() == LHCb::FitNode::Type::HitOnTrack
// discard extremely small fraction of hits with zero error
@@ -200,7 +205,7 @@ void TrackMonitor::fillHistograms( const LHCb::Track& track, const std::string&
plot( node->residual() / node->errResidual(), type + "/" + name + "residualPull", name + " residual pull", -5, 5,
50 );
// these should be expert plots because 2D
if ( ( mtype == VeloR || mtype == VeloPhi ) && fullDetail() ) {
+3
if ( ( mtype == VPX || mtype == VPY ) && fullDetail() ) {
// calculate R in the local frame
Gaudi::XYZPoint globalPoint = node->state().position();
Gaudi::XYZPoint localPoint = node->measurement().toLocal( globalPoint );
@@ -219,7 +224,7 @@ void TrackMonitor::fillHistograms( const LHCb::Track& track, const std::string&
++numoutliers;
}
}
plot( numoutliers, type + "/101", "#outliers", -0.5, 10.5, 11 );
plot( numoutliers, type + "/noutliers", "#outliers", -0.5, 10.5, 11 );
if ( fit != nullptr ) {
LHCb::ChiSquare tmp;
Loading