31 produces<reco::VertexCollection>();
42 ev.
getByLabel(trackCollectionName, trackCollection);
46 std::vector<const reco::Track*>
tracks;
47 for (
unsigned int i = 0;
i < tracks_.size();
i++) {
50 tracks.push_back(&(*recTrack));
54 LogTrace(
"MinBiasTracking") <<
" [VertexProducer] selected tracks: " << tracks.size() <<
" (out of " << tracks_.size()
57 auto vertices = std::make_unique<reco::VertexCollection>();
59 if (!tracks.empty()) {
65 if (tracks.size() % 2 == 0)
66 med = (tracks[tracks.size() / 2 - 1]->vz() + tracks[tracks.size() / 2]->vz()) / 2;
68 med = tracks[tracks.size() / 2]->vz();
70 LogTrace(
"MinBiasTracking") <<
" [vertex position] median = " << med <<
" cm";
72 if (tracks.size() > 10) {
75 float halfWidth = 0.1;
78 TH1F
histo(
"histo",
"histo", nBin, -halfWidth, halfWidth);
80 for (std::vector<const reco::Track*>::const_iterator
track = tracks.begin();
track != tracks.end();
track++)
81 if (fabs((*track)->vz() - med) < halfWidth)
82 histo.Fill((*track)->vz() - med);
84 LogTrace(
"MinBiasTracking") <<
" [vertex position] most prob = "
85 << med + histo.GetBinCenter(histo.GetMaximumBin()) <<
" cm";
90 TF1
f1(
"f1",
"[0]*exp(-0.5 * ((x-[1])/[2])^2) + [3]");
91 f1.SetParameters(10., 0., 0.01, 1.);
95 LogTrace(
"MinBiasTracking") <<
" [vertex position] fitted = " << med + f1.GetParameter(1) <<
" +- "
96 << f1.GetParError(1) <<
" cm";
100 err(2, 2) = f1.GetParError(1) * f1.GetParError(1);
106 err(2, 2) = 0.1 * 0.1;
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::vector< Track > TrackCollection
collection of Tracks
math::Error< dimension >::type Error
covariance error matrix (3x3)
auto const & tracks
cannot be loose
math::XYZPoint Point
point in the space
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double vz() const
z coordinate of the reference point on track
T const * product() const
T getParameter(std::string const &) const
bool operator()(const reco::Track *t1, const reco::Track *t2)