1 #ifndef InclusiveVertexFinder_h
2 #define InclusiveVertexFinder_h
38 #include <type_traits>
41 template <
class InputContainer,
class VTX>
54 pdesc.
add<
unsigned int>(
"minHits", 8);
57 pdesc.
add<
unsigned int>(
"minHits", 0);
62 pdesc.
add<
double>(
"maximumLongitudinalImpactParameter", 0.3);
63 pdesc.
add<
double>(
"maximumTimeSignificance", 3.0);
64 pdesc.
add<
double>(
"minPt", 0.8);
65 pdesc.
add<
unsigned int>(
"maxNTracks", 30);
68 clusterizer.add<
double>(
"seedMax3DIPSignificance", 9999.0);
69 clusterizer.add<
double>(
"seedMax3DIPValue", 9999.0);
70 clusterizer.add<
double>(
"seedMin3DIPSignificance", 1.2);
71 clusterizer.add<
double>(
"seedMin3DIPValue", 0.005);
72 clusterizer.add<
double>(
"clusterMaxDistance", 0.05);
73 clusterizer.add<
double>(
"clusterMaxSignificance", 4.5);
74 clusterizer.add<
double>(
"distanceRatio", 20.0);
75 clusterizer.add<
double>(
"clusterMinAngleCosine", 0.5);
76 clusterizer.add<
double>(
"maxTimeSignificance", 3.5);
79 pdesc.
add<
double>(
"vertexMinAngleCosine", 0.95);
80 pdesc.
add<
double>(
"vertexMinDLen2DSig", 2.5);
81 pdesc.
add<
double>(
"vertexMinDLenSig", 0.5);
82 pdesc.
add<
double>(
"fitterSigmacut", 3.0);
83 pdesc.
add<
double>(
"fitterTini", 256.0);
84 pdesc.
add<
double>(
"fitterRatio", 0.25);
85 pdesc.
add<
bool>(
"useDirectVertexFitter",
true);
86 pdesc.
add<
bool>(
"useVertexReco",
true);
90 vertexReco.add<
double>(
"primcut", 1.0);
91 vertexReco.add<
double>(
"seccut", 3.0);
92 vertexReco.add<
bool>(
"smoothing",
true);
95 cdesc.
add(
"inclusiveVertexFinderDefault", pdesc);
97 cdesc.
add(
"inclusiveCandidateVertexFinderDefault", pdesc);
108 const std::vector<reco::TransientTrack> &
tracks,
131 template <
class InputContainer,
class VTX>
133 :
minHits(params.getParameter<unsigned int>(
"minHits")),
134 maxNTracks(params.getParameter<unsigned int>(
"maxNTracks")),
135 maxLIP(params.getParameter<double>(
"maximumLongitudinalImpactParameter")),
136 maxTimeSig(params.getParameter<double>(
"maximumTimeSignificance")),
137 minPt(params.getParameter<double>(
"minPt")),
142 fitterTini(params.getParameter<double>(
"fitterTini")),
143 fitterRatio(params.getParameter<double>(
"fitterRatio")),
144 useVertexFitter(params.getParameter<bool>(
"useDirectVertexFitter")),
154 esConsumes<TransientTrackBuilder, TransientTrackRecord>(
edm::ESInputTag(
"",
"TransientTrackBuilder"));
158 template <
class InputContainer,
class VTX>
168 template <
class InputContainer,
class VTX>
170 using namespace reco;
182 event.getByToken(token_beamSpot,
beamSpot);
188 event.getByToken(token_tracks,
tracks);
192 auto recoVertices = std::make_unique<Product>();
197 std::vector<TransientTrack> tts;
212 if (dtSig > maxTimeSig)
218 std::vector<TracksClusteringFromDisplacedSeed::Cluster>
clusters =
clusterizer->clusters(pv, tts);
222 for (
unsigned int i = 0;
i < 7;
i++) {
223 for (
unsigned int j = 0;
j < 7;
j++) {
235 std::cout <<
"CLUSTERS " << clusters.size() << std::endl;
238 for (std::vector<TracksClusteringFromDisplacedSeed::Cluster>::iterator cluster = clusters.begin();
239 cluster != clusters.end();
241 if (cluster->tracks.size() < 2 || cluster->tracks.size() >
maxNTracks)
243 std::vector<TransientVertex>
vertices;
245 vertices = vtxReco->vertices(cluster->tracks,
bs);
248 if (useVertexFitter) {
249 singleFitVertex = theAdaptiveFitter.
vertex(cluster->tracks, cluster->seedPoint);
251 vertices.push_back(singleFitVertex);
256 for (
auto &vtx : vertices) {
261 for (std::vector<TransientVertex>::const_iterator
v = vertices.begin();
v != vertices.end(); ++
v) {
266 std::cout <<
"V chi2/n: " <<
v->normalisedChiSquared() <<
" ndof: " <<
v->degreesOfFreedom();
270 std::cout <<
" pos: " << vv.position() <<
" error: " << vv.xError() <<
" " << vv.yError() <<
" " << vv.zError()
272 std::cout <<
" time: " << vv.time() <<
" error: " << vv.tError() << std::endl;
275 std::vector<reco::TransientTrack> ts =
v->originalTracks();
276 for (std::vector<reco::TransientTrack>::const_iterator i = ts.begin(); i != ts.end(); ++
i) {
277 float w =
v->trackWeight(*i);
279 dir += i->impactPointState().globalDirection();
281 std::cout <<
"\t[" << (*i).track().pt() <<
": " << (*i).track().eta() <<
", " << (*i).track().phi() <<
"], "
285 GlobalPoint sv((*v).position().x(), (*v).position().y(), (*v).position().z());
290 recoVertices->push_back(*
v);
300 std::cout <<
"Final put " << recoVertices->size() << std::endl;
math::Error< dimension >::type CovarianceMatrix
tuple vertexMinAngleCosine
std::vector< VTX > Product
void setBeamSpot(const reco::BeamSpot &beamSpot)
bool isValid() const
Make the ReferenceCountingProxy method to check validity public.
std::pair< std::vector< reco::TransientTrack >, GlobalPoint > nearTracks(const reco::TransientTrack &seed, const std::vector< reco::TransientTrack > &tracks, const reco::Vertex &primaryVertex) const
int numberOfValidHits() const
auto const & tracks
cannot be loose
std::unique_ptr< VertexReconstructor > vtxReco
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &) const override
InputContainer::value_type TRK
constexpr bool isFinite(T x)
const Point & position() const
position
std::unique_ptr< TracksClusteringFromDisplacedSeed > clusterizer
Container::value_type value_type
void addDefault(ParameterSetDescription const &psetDescription)
edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > token_trackBuilder
double pt() const
track transverse momentum
Abs< T >::type abs(const T &t)
double vertexMinAngleCosine
edm::EDGetTokenT< InputContainer > token_tracks
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool trackFilter(const reco::Track &track) const
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Vector3DBase unit() const
double significance() const
void produce(edm::Event &event, const edm::EventSetup &es) override
const Track & track() const
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
double vertexMinDLen2DSig
double dtErrorExt() const
T getParameter(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void updateVertexTime(TransientVertex &vtx)
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
TemplatedInclusiveVertexFinder(const edm::ParameterSet ¶ms)
edm::EDGetTokenT< reco::VertexCollection > token_primaryVertex
reco::TransientTrack buildTT(edm::Handle< reco::TrackCollection > &tracks, edm::ESHandle< TransientTrackBuilder > &trackbuilder, unsigned int k)
static void fillDescriptions(edm::ConfigurationDescriptions &cdesc)
Power< A, B >::type pow(const A &a, const B &b)
double t() const
t coordinate
Basic3DVector unit() const