Skip to content
Snippets Groups Projects

Add IP vs momentum to TrackVertexMonitor.

Merged Naomi Cooke requested to merge IPplots_naomiC into 2024-patches
@@ -45,6 +45,8 @@ public:
void operator()( LHCb::RecVertex::Range const& pvcontainer, LHCb::Track::Range const& alltracks,
DetectorElement const& lhcb ) const override;
StatusCode initialize() override;
private:
Gaudi::Property<double> m_ipmax{this, "MaxIP", 0.5 * Gaudi::Units::mm};
Gaudi::Property<double> m_ipmaxprof{this, "MaxIPProfile", 0.1 * Gaudi::Units::mm};
@@ -59,6 +61,7 @@ private:
Gaudi::Property<double> m_minLongTrackMomentum{this, "MinLongTrackMomentum", 5};
Gaudi::Property<unsigned int> m_nprbins{this, "NumProfileBins", 20};
Gaudi::Property<unsigned int> m_ntracksPV{this, "NumTracksPV", 2};
Gaudi::Property<bool> m_produceHistogram{this, "produceHistogram", false}; // producing IP 1/pt histograms
ToolHandle<ITrackVertexer> m_vertexer{this, "TrackVertexer", "TrackVertexer"};
@@ -170,10 +173,64 @@ private:
this, "track IP X vs phi", "track IP X vs phi (biased)", {m_nprbins, -Gaudi::Units::pi, Gaudi::Units::pi}};
mutable Gaudi::Accumulators::ProfileHistogram<1> m_trackIPXvsEta{
this, "track IP X vs eta", "track IP X vs eta (biased)", {m_nprbins, 2.0, 5.0}};
// pt plots
mutable Gaudi::Accumulators::ProfileHistogram<1> m_trackIPXvsPt{
this, "track IP X vs pt profile", "track IP X vs pt (GeV) (biased)", {30, 0.0, 15.0}};
mutable Gaudi::Accumulators::ProfileHistogram<1> m_trackIPXvsInversePt{
this, "track IP X vs inverse pt profile", "track IP X vs 1/pt (1/GeV) (biased)", {m_nprbins, 0.0, 3.0}};
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt0;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt1;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt2;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt3;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt4;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt5;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt6;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt7;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt8;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt9;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt10;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt11;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt12;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt13;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt14;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt15;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt16;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt17;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt18;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPXInvPt19;
mutable Gaudi::Accumulators::ProfileHistogram<1> m_trackIPYvsPhi{
this, "track IP Y vs phi", "track IP Y vs phi (biased)", {m_nprbins, -Gaudi::Units::pi, Gaudi::Units::pi}};
mutable Gaudi::Accumulators::ProfileHistogram<1> m_trackIPYvsEta{
this, "track IP Y vs eta", "track IP Y vs eta (biased)", {m_nprbins, 2.0, 5.0}};
// pt plots
mutable Gaudi::Accumulators::ProfileHistogram<1> m_trackIPYvsPt{
this, "track IP Y vs pt profile", "track IP Y vs pt (GeV) (biased)", {30, 0.0, 15.0}};
mutable Gaudi::Accumulators::ProfileHistogram<1> m_trackIPYvsInversePt{
this, "track IP Y vs inverse pt profile", "track IP Y vs in 1/pt range (1/GeV) (biased)", {m_nprbins, 0.0, 3.0}};
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt0;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt1;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt2;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt3;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt4;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt5;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt6;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt7;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt8;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt9;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt10;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt11;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt12;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt13;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt14;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt15;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt16;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt17;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt18;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_trackIPYInvPt19;
mutable Gaudi::Accumulators::ProfileHistogram<1> m_trackTransverseIPvsPhi{
this,
"fast track transverse IP vs phi",
@@ -478,6 +535,8 @@ void TrackVertexMonitor::operator()( LHCb::RecVertex::Range const& pvcontainer,
double dx = firststate.x() + dz * firststate.tx() - pv->position().x();
double dy = firststate.y() + dz * firststate.ty() - pv->position().y();
Gaudi::XYZVector p3 = firststate.momentum();
double pt = ( firststate.pt() / Gaudi::Units::GeV );
double invPt = 1.0 / pt;
++m_trackIPX[dx];
++m_trackIPY[dy];
// apply a cut for the profiles
@@ -489,6 +548,99 @@ void TrackVertexMonitor::operator()( LHCb::RecVertex::Range const& pvcontainer,
m_trackIPYvsEta[eta] += dy;
m_trackIPYvsPhi[phi] += dy;
}
// profiles with no IP cut
m_trackIPXvsPt[pt] += dx;
m_trackIPXvsInversePt[invPt] += dx;
m_trackIPYvsPt[pt] += dy;
m_trackIPYvsInversePt[invPt] += dy;
// single plots for 1/pt
double spacing = 0.15;
std::vector<double> binEdges( 21 );
std::generate( binEdges.begin(), binEdges.end(), [n = 0, &spacing]() mutable { return n++ * spacing; } );
if ( m_produceHistogram ) {
if ( invPt > binEdges[0] && invPt < binEdges[1] ) {
++( *m_trackIPXInvPt0 )[dx];
++( *m_trackIPYInvPt0 )[dy];
}
if ( invPt > binEdges[1] && invPt < binEdges[2] ) {
++( *m_trackIPXInvPt1 )[dx];
++( *m_trackIPYInvPt1 )[dy];
}
if ( invPt > binEdges[2] && invPt < binEdges[3] ) {
++( *m_trackIPXInvPt2 )[dx];
++( *m_trackIPYInvPt2 )[dy];
}
if ( invPt > binEdges[3] && invPt < binEdges[4] ) {
++( *m_trackIPXInvPt3 )[dx];
++( *m_trackIPYInvPt3 )[dy];
}
if ( invPt > binEdges[4] && invPt < binEdges[5] ) {
++( *m_trackIPXInvPt4 )[dx];
++( *m_trackIPYInvPt4 )[dy];
}
if ( invPt > binEdges[5] && invPt < binEdges[6] ) {
++( *m_trackIPXInvPt5 )[dx];
++( *m_trackIPYInvPt5 )[dy];
}
if ( invPt > binEdges[6] && invPt < binEdges[7] ) {
++( *m_trackIPXInvPt6 )[dx];
++( *m_trackIPYInvPt6 )[dy];
}
if ( invPt > binEdges[7] && invPt < binEdges[8] ) {
++( *m_trackIPXInvPt7 )[dx];
++( *m_trackIPYInvPt7 )[dy];
}
if ( invPt > binEdges[8] && invPt < binEdges[9] ) {
++( *m_trackIPXInvPt8 )[dx];
++( *m_trackIPYInvPt8 )[dy];
}
if ( invPt > binEdges[9] && invPt < binEdges[10] ) {
++( *m_trackIPXInvPt9 )[dx];
++( *m_trackIPYInvPt9 )[dy];
}
if ( invPt > binEdges[10] && invPt < binEdges[11] ) {
++( *m_trackIPXInvPt10 )[dx];
++( *m_trackIPYInvPt10 )[dy];
}
if ( invPt > binEdges[11] && invPt < binEdges[12] ) {
++( *m_trackIPXInvPt11 )[dx];
++( *m_trackIPYInvPt11 )[dy];
}
if ( invPt > binEdges[12] && invPt < binEdges[13] ) {
++( *m_trackIPXInvPt12 )[dx];
++( *m_trackIPYInvPt12 )[dy];
}
if ( invPt > binEdges[13] && invPt < binEdges[14] ) {
++( *m_trackIPXInvPt13 )[dx];
++( *m_trackIPYInvPt13 )[dy];
}
if ( invPt > binEdges[14] && invPt < binEdges[15] ) {
++( *m_trackIPXInvPt14 )[dx];
++( *m_trackIPYInvPt14 )[dy];
}
if ( invPt > binEdges[15] && invPt < binEdges[16] ) {
++( *m_trackIPXInvPt15 )[dx];
++( *m_trackIPYInvPt15 )[dy];
}
if ( invPt > binEdges[16] && invPt < binEdges[17] ) {
++( *m_trackIPXInvPt16 )[dx];
++( *m_trackIPYInvPt16 )[dy];
}
if ( invPt > binEdges[17] && invPt < binEdges[18] ) {
++( *m_trackIPXInvPt17 )[dx];
++( *m_trackIPYInvPt17 )[dy];
}
if ( invPt > binEdges[18] && invPt < binEdges[19] ) {
++( *m_trackIPXInvPt18 )[dx];
++( *m_trackIPYInvPt18 )[dy];
}
if ( invPt > binEdges[19] && invPt < binEdges[20] ) {
++( *m_trackIPXInvPt19 )[dx];
++( *m_trackIPYInvPt19 )[dy];
}
}
}
if ( goodlongtracks.size() >= 2 ) {
@@ -583,3 +735,135 @@ void TrackVertexMonitor::operator()( LHCb::RecVertex::Range const& pvcontainer,
}
}
}
StatusCode TrackVertexMonitor::initialize() {
return Consumer::initialize().andThen( [&] {
using Axis1D = Gaudi::Accumulators::Axis<double>;
// Book histograms
if ( m_produceHistogram ) {
m_trackIPXInvPt0.emplace( this, "track IP X in inverse pt range 0_00 to 0_15 (0)",
"track IP X in 1/pt range 0.00 to 0.15 1/GeV (0) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt1.emplace( this, "track IP X in inverse pt range 0_15 to 0_30 (1)",
"track IP X in 1/pt range 0.15 to 0.30 1/GeV (1) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt2.emplace( this, "track IP X in inverse pt range 0_30 to 0_45 (2)",
"track IP X in 1/pt range 0.30 to 0.45 1/GeV (2) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt3.emplace( this, "track IP X in inverse pt range 0_45 to 0_60 (3)",
"track IP X in 1/pt range 0.45 to 0.60 1/GeV (3) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt4.emplace( this, "track IP X in inverse pt range 0_60 to 0_75 (4)",
"track IP X in 1/pt range 0.60 to 0.75 1/GeV (4) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt5.emplace( this, "track IP X in inverse pt range 0_75 to 0_90 (5)",
"track IP X in 1/pt range 0.75 to 0.90 1/GeV (5) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt6.emplace( this, "track IP X in inverse pt range 0_90 to 1_05 (6)",
"track IP X in 1/pt range 0.90 to 1.05 1/GeV (6) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt7.emplace( this, "track IP X in inverse pt range 1_05 to 1_20 (7)",
"track IP X in 1/pt range 1.05 to 1.20 1/GeV (7) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt8.emplace( this, "track IP X in inverse pt range 1_20 to 1_35 (8)",
"track IP X in 1/pt range 1.20 to 1.35 1/GeV (8) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt9.emplace( this, "track IP X in inverse pt range 1_35 to 1_50 (9)",
"track IP X in 1/pt range 1.35 to 1.50 1/GeV (9) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt10.emplace( this, "track IP X in inverse pt range 1_50 to 1_65 (10)",
"track IP X in 1/pt range 1.50 to 1.65 1/GeV (10) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt11.emplace( this, "track IP X in inverse pt range 1_65 to 1_80 (11)",
"track IP X in 1/pt range 1.65 to 1.80 1/GeV (11) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt12.emplace( this, "track IP X in inverse pt range 1_80 to 1_95 (12)",
"track IP X in 1/pt range 1.80 to 1.95 1/GeV (12) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt13.emplace( this, "track IP X in inverse pt range 1_95 to 2_10 (13)",
"track IP X in 1/pt range 1.95 to 2.10 1/GeV (13) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt14.emplace( this, "track IP X in inverse pt range 2_10 to 2_25 (14)",
"track IP X in 1/pt range 2.10 to 2.25 1/GeV (14) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt15.emplace( this, "track IP X in inverse pt range 2_25 to 2_40 (15)",
"track IP X in 1/pt range 2.25 to 2.40 1/GeV (15) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt16.emplace( this, "track IP X in inverse pt range 2_40 to 2_55 (16)",
"track IP X in 1/pt range 2.40 to 2.55 1/GeV (16) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt17.emplace( this, "track IP X in inverse pt range 2_55 to 2_70 (17)",
"track IP X in 1/pt range 2.55 to 2.70 1/GeV (17) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt18.emplace( this, "track IP X in inverse pt range 2_70 to 2_85 (18)",
"track IP X in 1/pt range 2.70 to 2.85 1/GeV (18) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPXInvPt19.emplace( this, "track IP X in inverse pt range 2_85 to 3_00 (19)",
"track IP X in 1/pt range 2.85 to 3.00 1/GeV (19) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt0.emplace( this, "track IP Y in inverse pt range 0_00 to 0_15 (0)",
"track IP Y in 1/pt range 0.00 to 0.15 1/GeV (0) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt1.emplace( this, "track IP Y in inverse pt range 0_15 to 0_30 (1)",
"track IP Y in 1/pt range 0.15 to 0.30 1/GeV (1) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt2.emplace( this, "track IP Y in inverse pt range 0_30 to 0_45 (2)",
"track IP Y in 1/pt range 0.30 to 0.45 1/GeV (2) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt3.emplace( this, "track IP Y in inverse pt range 0_45 to 0_60 (3)",
"track IP Y in 1/pt range 0.45 to 0.60 1/GeV (3) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt4.emplace( this, "track IP Y in inverse pt range 0_60 to 0_75 (4)",
"track IP Y in 1/pt range 0.60 to 0.75 1/GeV (4) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt5.emplace( this, "track IP Y in inverse pt range 0_75 to 0_90 (5)",
"track IP Y in 1/pt range 0.75 to 0.90 1/GeV (5) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt6.emplace( this, "track IP Y in inverse pt range 0_90 to 1_05 (6)",
"track IP Y in 1/pt range 0.90 to 1.05 1/GeV (6) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt7.emplace( this, "track IP Y in inverse pt range 1_05 to 1_20 (7)",
"track IP Y in 1/pt range 1.05 to 1.20 1/GeV (7) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt8.emplace( this, "track IP Y in inverse pt range 1_20 to 1_35 (8)",
"track IP Y in 1/pt range 1.20 to 1.35 1/GeV (8) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt9.emplace( this, "track IP Y in inverse pt range 1_35 to 1_50 (9)",
"track IP Y in 1/pt range 1.35 to 1.50 1/GeV (9) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt10.emplace( this, "track IP Y in inverse pt range 1_50 to 1_65 (10)",
"track IP Y in 1/pt range 1.50 to 1.65 1/GeV (10) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt11.emplace( this, "track IP Y in inverse pt range 1_65 to 1_80 (11)",
"track IP Y in 1/pt range 1.65 to 1.80 1/GeV (11) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt12.emplace( this, "track IP Y in inverse pt range 1_80 to 1_95 (12)",
"track IP Y in 1/pt range 1.80 to 1.95 1/GeV (12) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt13.emplace( this, "track IP Y in inverse pt range 1_95 to 2_10 (13)",
"track IP Y in 1/pt range 1.95 to 2.10 1/GeV (13) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt14.emplace( this, "track IP Y in inverse pt range 2_10 to 2_25 (14)",
"track IP Y in 1/pt range 2.10 to 2.25 1/GeV (14) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt15.emplace( this, "track IP Y in inverse pt range 2_25 to 2_40 (15)",
"track IP Y in 1/pt range 2.25 to 2.40 1/GeV (15) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt16.emplace( this, "track IP Y in inverse pt range 2_40 to 2_55 (16)",
"track IP Y in 1/pt range 2.40 to 2.55 1/GeV (16) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt17.emplace( this, "track IP Y in inverse pt range 2_55 to 2_70 (17)",
"track IP Y in 1/pt range 2.55 to 2.70 1/GeV (17) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt18.emplace( this, "track IP Y in inverse pt range 2_70 to 2_85 (18)",
"track IP Y in 1/pt range 2.70 to 2.85 1/GeV (18) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
m_trackIPYInvPt19.emplace( this, "track IP Y in inverse pt range 2_85 to 3_00 (19)",
"track IP Y in 1/pt range 2.85 to 3.00 1/GeV (19) (biased)",
Axis1D{50, -m_ipmax, m_ipmax} );
}
} );
};
Loading