29 return (t1->
vz() < t2->
vz());
37 produces<reco::VertexCollection>();
53 theConfig.getParameter<
std::string>(
"TrackCollection");
54 ev.
getByLabel(trackCollectionName, trackCollection);
57 thePtMin = theConfig.getParameter<
double>(
"PtMin");
60 std::vector<const reco::Track *>
tracks;
61 for (
unsigned int i=0;
i<tracks_.size();
i++)
63 if (tracks_[
i].
pt() > thePtMin)
66 tracks.push_back( &(*recTrack));
71 <<
" [VertexProducer] selected tracks: "
72 << tracks.size() <<
" (out of " << tracks_.size()
84 if(tracks.size() % 2 == 0)
85 med = (tracks[tracks.size()/2-1]->vz() + tracks[tracks.size()/2]->vz())/2;
87 med = tracks[tracks.size()/2 ]->vz();
90 <<
" [vertex position] median = " << med <<
" cm";
92 if(tracks.size() > 10)
96 float halfWidth = 0.1;
99 TH1F
histo(
"histo",
"histo", nBin, -halfWidth,halfWidth);
101 for(std::vector<const reco::Track *>::const_iterator
102 track = tracks.begin(); track!= tracks.end(); track++)
103 if(fabs((*track)->vz() - med) < halfWidth)
104 histo.Fill((*track)->vz() - med);
107 <<
" [vertex position] most prob = "
108 << med + histo.GetBinCenter(histo.GetMaximumBin())
114 TF1
f1(
"f1",
"[0]*exp(-0.5 * ((x-[1])/[2])^2) + [3]");
115 f1.SetParameters(10.,0.,0.01, 1.);
117 histo.Fit(
"f1",
"QN");
120 <<
" [vertex position] fitted = "
121 << med + f1.GetParameter(1) <<
" +- " << f1.GetParError(1)
126 err(2,2) = f1.GetParError(1) * f1.GetParError(1);
129 vertices->push_back(ver);
135 err(2,2) = 0.1 * 0.1;
138 vertices->push_back(ver);
const std::vector< reco::PFCandidatePtr > & tracks_
std::vector< Track > TrackCollection
collection of Tracks
math::Error< dimension >::type Error
covariance error matrix (3x3)
std::vector< Vertex > VertexCollection
collection of Vertex objects
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
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
bool operator()(const reco::Track *t1, const reco::Track *t2)