31 if (trackSelectionAlgorithm ==
"filter") {
33 }
else if (trackSelectionAlgorithm ==
"filterWithThreshold") {
36 throw VertexException(
"PrimaryVertexProducer: unknown track selection algorithm: " + trackSelectionAlgorithm);
42 if (clusteringAlgorithm ==
"gap") {
45 }
else if (clusteringAlgorithm ==
"DA_vect") {
48 }
else if (clusteringAlgorithm ==
"DA2D_vect") {
53 throw VertexException(
"PrimaryVertexProducer: unknown clustering algorithm: " + clusteringAlgorithm);
66 conf.
getParameter<std::vector<edm::ParameterSet> >(
"vertexCollections");
68 for (std::vector<edm::ParameterSet>::const_iterator algoconf =
vertexCollections.begin();
77 if (fitterAlgorithm ==
"KalmanVertexFitter") {
79 }
else if (fitterAlgorithm ==
"AdaptiveVertexFitter") {
82 }
else if (fitterAlgorithm.empty()) {
84 }
else if (fitterAlgorithm ==
"AdaptiveChisquareVertexFitter") {
86 algoconf->getParameter<
double>(
"zcutoff"),
87 algoconf->getParameter<
double>(
"mintrkweight"),
89 }
else if (fitterAlgorithm ==
"MultiPrimaryVertexFitter") {
91 algoconf->getParameter<
double>(
"zcutoff"),
92 algoconf->getParameter<
double>(
"mintrkweight"),
94 }
else if (fitterAlgorithm ==
"WeightedMeanFitter") {
97 throw VertexException(
"PrimaryVertexProducer: unknown algorithm: " + fitterAlgorithm);
99 algorithm.minNdof = algoconf->getParameter<
double>(
"minNdof");
100 algorithm.useBeamConstraint = algoconf->getParameter<
bool>(
"useBeamConstraint");
107 const auto& pv_time_conf = algoconf->getParameter<
edm::ParameterSet>(
"vertexTimeParameters");
111 if (vertexTimeAlgorithm.empty()) {
113 }
else if (vertexTimeAlgorithm ==
"legacy4D") {
117 }
else if (vertexTimeAlgorithm ==
"fromTracksPID") {
121 edm::LogWarning(
"MisConfiguration") <<
"unknown vertexTimeParameters.algorithm" << vertexTimeAlgorithm;
125 produces<reco::VertexCollection>(
algorithm.label);
132 throw VertexException(
"PrimaryVertexProducer: No algorithm specified. ");
135 "PrimaryVertexProducer: Running in Recovery mode and more than one algorithm specified. Please " 136 "only one algorithm.");
162 if (recoBeamSpotHandle.
isValid()) {
165 edm::LogError(
"UnusableBeamSpot") <<
"No beam spot available from EventSetup";
170 if ((beamVertexState.
error().
cxx() <= 0.) || (beamVertexState.
error().
cyy() <= 0.) ||
171 (beamVertexState.
error().
czz() <= 0.)) {
180 for (
auto const& old : oldVertices) {
181 if (!(old.isFake())) {
184 auto result = std::make_unique<reco::VertexCollection>();
200 auto result = std::make_unique<reco::VertexCollection>();
204 if ((bse.cxx() <= 0.) || (bse.cyy() <= 0.) || (bse.czz() <= 0.)) {
211 std::cout <<
"RecoVertex/PrimaryVertexProducer: " 212 <<
"Beamspot with invalid errors " << bse.matrix() << std::endl;
213 std::cout <<
"Will put Vertex derived from dummy-fake BeamSpot into Event.\n";
218 std::cout <<
"RecoVertex/PrimaryVertexProducer: " 219 <<
" will put Vertex derived from BeamSpot into Event.\n";
236 std::vector<reco::TransientTrack> t_tks;
245 for (
unsigned int i = 0;
i < (*tks).size();
i++) {
257 t_tks = (*theB).build(tks,
beamSpot);
268 <<
"Clustering returned " <<
clusters.size() <<
" clusters from " << seltks.size() <<
" selected tracks";
273 auto result = std::make_unique<reco::VertexCollection>();
275 std::vector<TransientVertex>
pvs;
283 if (
algorithm->pv_time_estimator !=
nullptr) {
288 if (
pvs.size() > 1) {
293 for (std::vector<TransientVertex>::const_iterator
iv =
pvs.begin();
iv !=
pvs.end();
iv++) {
294 if (
iv->isValid() && (
iv->degreesOfFreedom() >=
algorithm->minNdof)) {
296 if (!validBS || ((*(
algorithm->vertexSelector))(
v, beamVertexState))) {
303 edm::LogPrint(
"PrimaryVertexProducer") <<
"PrimaryVertexProducer \"" <<
algorithm->label <<
"\" contains " 304 <<
pvs.size() <<
" reco::Vertex candidates";
309 <<
"More than 50% of candidate vertices lost (" <<
pvs.size() <<
" out of " <<
clusters.size() <<
")";
312 if (
pvs.empty() && seltks.size() > 5) {
314 <<
"No vertex found with " << seltks.size() <<
" tracks and " <<
clusters.size() <<
" vertex candidates";
319 if ((bse.cxx() <= 0.) || (bse.cyy() <= 0.) || (bse.czz() <= 0.)) {
325 edm::LogWarning(
"PrimaryVertexProducer") <<
"Zero recostructed vertices, will put reco::Vertex derived from " 326 "dummy/fake BeamSpot into Event, BeamSpot has invalid errors: " 332 <<
"Zero recostructed vertices, will put reco::Vertex derived from BeamSpot into Event.";
339 for (reco::VertexCollection::const_iterator
v = vColl.begin();
v != vColl.end(); ++
v) {
341 <<
"recvtx " << std::setw(3) <<
std::fixed << ivtx++ <<
" #trk " << std::setw(3) <<
v->tracksSize()
342 <<
" chi2 " << std::setw(5) << std::setprecision(1) <<
v->chi2() <<
" ndof " << std::setw(5)
343 << std::setprecision(1) <<
v->ndof() <<
" x " << std::setw(7) << std::setprecision(4) <<
v->position().x()
344 <<
" dx " << std::setw(6) << std::setprecision(4) <<
v->xError() <<
" y " << std::setw(7)
345 << std::setprecision(4) <<
v->position().y() <<
" dy " << std::setw(6) << std::setprecision(4)
346 <<
v->yError() <<
" z " << std::setw(8) << std::setprecision(4) <<
v->position().z() <<
" dz " 347 << std::setw(6) << std::setprecision(4) <<
v->zError();
348 if (
v->tError() > 0) {
349 edm::LogPrint(
"PrimaryVertexProducer") <<
" t " << std::setw(6) << std::setprecision(3) <<
v->t() <<
" dt " 350 << std::setw(6) << std::setprecision(3) <<
v->tError();
376 vpsd1.
add<
double>(
"maxDistanceToBeam", 1.0);
378 vpsd1.
add<
bool>(
"useBeamConstraint",
false);
380 vpsd1.
add<
double>(
"chi2cutoff", 2.5);
381 vpsd1.
add<
double>(
"zcutoff", 1.0);
382 vpsd1.
add<
double>(
"mintrkweight", 0.0);
383 vpsd1.
add<
double>(
"minNdof", 0.0);
387 std::vector<edm::ParameterSet> temp1;
402 temp1.push_back(temp2);
417 temp1.push_back(temp2);
419 desc.addVPSet(
"vertexCollections", vpsd1, temp1);
421 desc.addUntracked<
bool>(
"verbose",
false);
455 desc.add<
bool>(
"isRecoveryIteration",
false);
457 desc.add<
bool>(
"useMVACut",
false);
458 desc.add<
double>(
"minTrackTimeQuality", 0.8);
edm::EDGetTokenT< edm::ValueMap< float > > trackMTDTimeQualityToken
ParameterDescriptionNode * ifValue(ParameterDescription< T > const &switchParameter, std::unique_ptr< ParameterDescriptionCases< T >> cases)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
T getParameter(std::string const &) const
virtual void setEvent(edm::Event &iEvent, edm::EventSetup const &iSetup)=0
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void reserve(SetDescriptionEntries::size_type n)
edm::EDGetTokenT< reco::BeamSpot > bsToken
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > theTTBToken
static void fillPSetDescription(edm::ParameterSetDescription &desc)
std::vector< algo > algorithms
~PrimaryVertexProducer() override
edm::EDGetTokenT< reco::VertexCollection > recoveryVtxToken
static void fillPSetDescription(edm::ParameterSetDescription &desc)
edm::EDGetTokenT< reco::TrackCollection > trkToken
VertexTimeAlgorithmBase * pv_time_estimator
TrackClusterizerInZ * theTrackClusterizer
std::vector< Vertex > VertexCollection
collection of Vertex objects
edm::ValueMap< float > trackTimes_
Log< level::Error, false > LogError
edm::EDGetTokenT< edm::ValueMap< float > > trkTimesToken
T getUntrackedParameter(std::string const &, T const &) const
edm::ValueMap< float > trackMTDTimeQualities_
edm::EDGetTokenT< edm::ValueMap< float > > trkTimeResosToken
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
void addParameter(std::string const &name, T const &value)
GlobalError error() const
TrackFilterForPVFindingBase * theTrackFilter
#define DEFINE_FWK_MODULE(type)
const AlgebraicSymMatrix33 matrix() const
virtual std::vector< reco::TransientTrack > select(const std::vector< reco::TransientTrack > &tracks) const =0
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
bool useTransientTrackTime_
Log< level::Warning, true > LogPrint
static void fillPSetDescription(edm::ParameterSetDescription &desc)
virtual std::vector< TransientVertex > vertices(const std::vector< reco::TransientTrack > &tracks) const =0
void produce(edm::Event &, const edm::EventSetup &) override
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
PrimaryVertexProducer(const edm::ParameterSet &)
static void fillPSetDescription(edm::ParameterSetDescription &desc)
double minTrackTimeQuality_
Log< level::Warning, false > LogWarning