18 #include "TMinuitMinimizer.h" 23 thePtMin(ps.getParameter<double>(
"PtMin")),
24 thePeakFindThresh(ps.getParameter<unsigned
int>(
"PeakFindThreshold")),
25 thePeakFindMaxZ(ps.getParameter<double>(
"PeakFindMaxZ")),
26 thePeakFindBinning(ps.getParameter<
int>(
"PeakFindBinsPerCm")),
27 theFitThreshold(ps.getParameter<
int>(
"FitThreshold")),
28 theFitMaxZ(ps.getParameter<double>(
"FitMaxZ")),
29 theFitBinning(ps.getParameter<
int>(
"FitBinsPerCm")) {
30 produces<reco::VertexCollection>();
34 TMinuitMinimizer::UseStaticMinuit(
false);
45 std::vector<const reco::Track*>
tracks;
46 for (
unsigned int i = 0;
i < tracks_.size();
i++) {
47 if (tracks_[
i].
pt() <
thePtMin && std::fabs(tracks_[
i].vz()) < 100000.)
50 tracks.push_back(&(*recTrack));
53 LogTrace(
"MinBiasTracking") <<
" [VertexProducer] selected tracks: " <<
tracks.size() <<
" (out of " << tracks_.size()
57 auto vertices = std::make_unique<reco::VertexCollection>();
70 if (
tracks.size() % 2 == 0)
75 LogTrace(
"MinBiasTracking") <<
" [vertex position] median = " << med <<
" cm";
84 hmax.Fill((*track)->vz());
86 int maxBin = hmax.GetMaximumBin();
88 LogTrace(
"MinBiasTracking") <<
" [vertex position] most prob = " << hmax.GetBinCenter(
maxBin) <<
" cm";
92 for (
int i = -1;
i <= 1;
i++) {
99 err(2, 2) = 0.1 * 0.1;
111 LogTrace(
"MinBiasTracking") <<
" [vertex position] 3-bin weighted average = " << nBinAvg <<
" cm";
120 histo.Fill((*track)->vz() - med);
122 LogTrace(
"MinBiasTracking") <<
" [vertex position] most prob for fit = " 123 << med +
histo.GetBinCenter(
histo.GetMaximumBin()) <<
" cm";
128 <<
" entries in fit histogram. Returning median.";
131 err(2, 2) = 0.1 * 0.1;
139 TF1
f1(
"f1",
"[0]*exp(-0.5 * ((x-[1])/[2])^2) + [3]");
140 f1.SetParameters(10., 0., 0.02, 0.002 *
tracks.size());
141 f1.SetParLimits(1, -0.1, 0.1);
142 f1.SetParLimits(2, 0.001, 0.05);
143 f1.SetParLimits(3, 0.0, 0.005 *
tracks.size());
147 LogTrace(
"MinBiasTracking") <<
" [vertex position] fitted = " << med +
f1.GetParameter(1) <<
" +- " 148 <<
f1.GetParError(1) <<
" cm";
151 err(2, 2) =
f1.GetParError(1) *
f1.GetParError(1);
std::vector< Track > TrackCollection
collection of Tracks
math::Error< dimension >::type Error
covariance error matrix (3x3)
math::XYZPoint Point
point in the space