Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-01-31 03:02:44

0001 // -*- C++ -*-
0002 //
0003 // Package:    PrimaryVertexProducer
0004 // Class:      PrimaryVertexProducer
0005 //
0006 /**\class PrimaryVertexProducer PrimaryVertexProducer.cc RecoVertex/PrimaryVertexProducer/src/PrimaryVertexProducer.cc
0007 
0008  Description: steers tracker primary vertex reconstruction and storage
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Pascal Vanlaer
0015 //         Created:  Tue Feb 28 11:06:34 CET 2006
0016 //
0017 //
0018 
0019 // system include files
0020 #include <memory>
0021 
0022 // user include files
0023 #include "FWCore/Framework/interface/Frameworkfwd.h"
0024 #include "FWCore/Framework/interface/stream/EDProducer.h"
0025 
0026 #include "FWCore/Framework/interface/Event.h"
0027 #include "FWCore/Framework/interface/EventSetup.h"
0028 
0029 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0030 
0031 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
0032 #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
0033 #include "TrackingTools/Records/interface/TransientTrackRecord.h"
0034 #include "RecoVertex/PrimaryVertexProducer/interface/TrackFilterForPVFindingBase.h"
0035 #include "RecoVertex/PrimaryVertexProducer/interface/TrackClusterizerInZ.h"
0036 #include "RecoVertex/PrimaryVertexProducer/interface/DAClusterizerInZ_vect.h"
0037 #include "RecoVertex/PrimaryVertexProducer/interface/DAClusterizerInZT_vect.h"
0038 
0039 #include "RecoVertex/PrimaryVertexProducer/interface/TrackFilterForPVFinding.h"
0040 #include "RecoVertex/PrimaryVertexProducer/interface/HITrackFilterForPVFinding.h"
0041 #include "RecoVertex/PrimaryVertexProducer/interface/GapClusterizerInZ.h"
0042 #include "RecoVertex/KalmanVertexFit/interface/KalmanVertexFitter.h"
0043 #include "RecoVertex/AdaptiveVertexFit/interface/AdaptiveVertexFitter.h"
0044 #include "RecoVertex/PrimaryVertexProducer/interface/PrimaryVertexFitterBase.h"
0045 #include "RecoVertex/PrimaryVertexProducer/interface/SequentialPrimaryVertexFitterAdapter.h"
0046 #include "RecoVertex/PrimaryVertexProducer/interface/AdaptiveChisquarePrimaryVertexFitter.h"
0047 #include "RecoVertex/PrimaryVertexProducer/interface/WeightedMeanFitter.h"
0048 
0049 #include "RecoVertex/VertexPrimitives/interface/VertexException.h"
0050 #include <algorithm>
0051 #include "RecoVertex/PrimaryVertexProducer/interface/VertexHigherPtSquared.h"
0052 #include "RecoVertex/VertexTools/interface/VertexCompatibleWithBeam.h"
0053 #include "DataFormats/Common/interface/ValueMap.h"
0054 // vertex timing
0055 #include "RecoVertex/PrimaryVertexProducer/interface/VertexTimeAlgorithmBase.h"
0056 #include "RecoVertex/PrimaryVertexProducer/interface/VertexTimeAlgorithmFromTracksPID.h"
0057 #include "RecoVertex/PrimaryVertexProducer/interface/VertexTimeAlgorithmLegacy4D.h"
0058 
0059 //
0060 // class declaration
0061 //
0062 
0063 class PrimaryVertexProducer : public edm::stream::EDProducer<> {
0064 public:
0065   PrimaryVertexProducer(const edm::ParameterSet&);
0066   ~PrimaryVertexProducer() override;
0067 
0068   void produce(edm::Event&, const edm::EventSetup&) override;
0069 
0070   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0071 
0072   // access to config
0073   edm::ParameterSet config() const { return theConfig; }
0074 
0075 private:
0076   // ----------member data ---------------------------
0077   const edm::ESGetToken<TransientTrackBuilder, TransientTrackRecord> theTTBToken;
0078 
0079   TrackFilterForPVFindingBase* theTrackFilter;
0080   TrackClusterizerInZ* theTrackClusterizer;
0081 
0082   // vtx fitting algorithms
0083   struct algo {
0084     PrimaryVertexFitterBase* pv_fitter;
0085     VertexCompatibleWithBeam* vertexSelector;
0086     std::string label;
0087     bool useBeamConstraint;
0088     double minNdof;
0089     VertexTimeAlgorithmBase* pv_time_estimator;
0090   };
0091 
0092   std::vector<algo> algorithms;
0093 
0094   edm::ParameterSet theConfig;
0095   bool fVerbose;
0096 
0097   bool fRecoveryIteration;
0098   edm::EDGetTokenT<reco::VertexCollection> recoveryVtxToken;
0099 
0100   edm::EDGetTokenT<reco::BeamSpot> bsToken;
0101   edm::EDGetTokenT<reco::TrackCollection> trkToken;
0102   edm::EDGetTokenT<edm::ValueMap<float> > trkTimesToken;
0103   edm::EDGetTokenT<edm::ValueMap<float> > trkTimeResosToken;
0104   edm::EDGetTokenT<edm::ValueMap<float> > trackMTDTimeQualityToken;
0105 
0106   bool useTransientTrackTime_;
0107   bool useMVASelection_;
0108   edm::ValueMap<float> trackMTDTimeQualities_;
0109   edm::ValueMap<float> trackTimes_;
0110   double minTrackTimeQuality_;
0111 };