19 #include "TMinuitMinimizer.h"
24 thePtMin(ps.getParameter<double>(
"PtMin")),
25 thePeakFindThresh(ps.getParameter<unsigned
int>(
"PeakFindThreshold")),
26 thePeakFindMaxZ(ps.getParameter<double>(
"PeakFindMaxZ")),
27 thePeakFindBinning(ps.getParameter<
int>(
"PeakFindBinsPerCm")),
28 theFitThreshold(ps.getParameter<
int>(
"FitThreshold")),
29 theFitMaxZ(ps.getParameter<double>(
"FitMaxZ")),
30 theFitBinning(ps.getParameter<
int>(
"FitBinsPerCm")) {
31 produces<reco::VertexCollection>();
35 TMinuitMinimizer::UseStaticMinuit(
false);
46 std::vector<const reco::Track*>
tracks;
47 for (
unsigned int i = 0;
i < tracks_.size();
i++) {
48 if (tracks_[
i].
pt() <
thePtMin && std::fabs(tracks_[
i].vz()) < 100000.)
51 tracks.push_back(&(*recTrack));
54 LogTrace(
"MinBiasTracking") <<
" [VertexProducer] selected tracks: " <<
tracks.size() <<
" (out of " << tracks_.size()
58 auto vertices = std::make_unique<reco::VertexCollection>();
71 if (
tracks.size() % 2 == 0)
76 LogTrace(
"MinBiasTracking") <<
" [vertex position] median = " << med <<
" cm";
85 hmax.Fill((*track)->vz());
87 int maxBin = hmax.GetMaximumBin();
89 LogTrace(
"MinBiasTracking") <<
" [vertex position] most prob = " << hmax.GetBinCenter(
maxBin) <<
" cm";
93 for (
int i = -1;
i <= 1;
i++) {
100 err(2, 2) = 0.1 * 0.1;
112 LogTrace(
"MinBiasTracking") <<
" [vertex position] 3-bin weighted average = " << nBinAvg <<
" cm";
121 histo.Fill((*track)->vz() - med);
123 LogTrace(
"MinBiasTracking") <<
" [vertex position] most prob for fit = "
124 << med +
histo.GetBinCenter(
histo.GetMaximumBin()) <<
" cm";
129 <<
" entries in fit histogram. Returning median.";
132 err(2, 2) = 0.1 * 0.1;
140 TF1
f1(
"f1",
"[0]*exp(-0.5 * ((x-[1])/[2])^2) + [3]");
141 f1.SetParameters(10., 0., 0.02, 0.002 *
tracks.size());
142 f1.SetParLimits(1, -0.1, 0.1);
143 f1.SetParLimits(2, 0.001, 0.05);
144 f1.SetParLimits(3, 0.0, 0.005 *
tracks.size());
148 LogTrace(
"MinBiasTracking") <<
" [vertex position] fitted = " << med +
f1.GetParameter(1) <<
" +- "
149 <<
f1.GetParError(1) <<
" cm";
152 err(2, 2) =
f1.GetParError(1) *
f1.GetParError(1);