Go to the documentation of this file.00001 #include "RecoParticleFlow/PFTracking/plugins/PFDisplacedVertexCandidateProducer.h"
00002
00003 #include "FWCore/Framework/interface/ESHandle.h"
00004
00005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00006 #include "FWCore/Utilities/interface/Exception.h"
00007 #include "FWCore/Framework/interface/EventSetup.h"
00008
00009 #include "FWCore/ParameterSet/interface/FileInPath.h"
00010
00011 #include "MagneticField/Engine/interface/MagneticField.h"
00012 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00013
00014 #include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertexCandidateFwd.h"
00015 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00016
00017 #include <set>
00018
00019 using namespace std;
00020 using namespace edm;
00021
00022 PFDisplacedVertexCandidateProducer::PFDisplacedVertexCandidateProducer(const edm::ParameterSet& iConfig) {
00023
00024
00025 inputTagTracks_
00026 = iConfig.getParameter<InputTag>("trackCollection");
00027
00028 verbose_ =
00029 iConfig.getUntrackedParameter<bool>("verbose");
00030
00031 bool debug =
00032 iConfig.getUntrackedParameter<bool>("debug");
00033
00034
00035
00036
00037
00038 double dcaCut
00039 = iConfig.getParameter< double >("dcaCut");
00040
00041
00042
00043 double primaryVertexCut
00044 = iConfig.getParameter< double >("primaryVertexCut");
00045
00046
00047 double dcaPInnerHitCut
00048 = iConfig.getParameter< double >("dcaPInnerHitCut");
00049
00050 edm::ParameterSet ps_trk
00051 = iConfig.getParameter<edm::ParameterSet>("tracksSelectorParameters");
00052
00053
00054 produces<reco::PFDisplacedVertexCandidateCollection>();
00055
00056
00057 pfDisplacedVertexCandidateFinder_.setDebug(debug);
00058 pfDisplacedVertexCandidateFinder_.setParameters(dcaCut, primaryVertexCut, dcaPInnerHitCut, ps_trk);
00059
00060 }
00061
00062
00063 PFDisplacedVertexCandidateProducer::~PFDisplacedVertexCandidateProducer() { }
00064
00065
00066
00067 void
00068 PFDisplacedVertexCandidateProducer::beginJob() { }
00069
00070 void
00071 PFDisplacedVertexCandidateProducer::beginRun(edm::Run & run,
00072 const edm::EventSetup & es) { }
00073
00074
00075 void
00076 PFDisplacedVertexCandidateProducer::produce(Event& iEvent,
00077 const EventSetup& iSetup) {
00078
00079 LogDebug("PFDisplacedVertexCandidateProducer")<<"START event: "<<iEvent.id().event()
00080 <<" in run "<<iEvent.id().run()<<endl;
00081
00082
00083 edm::ESHandle<MagneticField> magField;
00084 iSetup.get<IdealMagneticFieldRecord>().get(magField);
00085 const MagneticField* theMagField = magField.product();
00086
00087 Handle <reco::TrackCollection> trackCollection;
00088 iEvent.getByLabel(inputTagTracks_, trackCollection);
00089
00090 pfDisplacedVertexCandidateFinder_.setInput( trackCollection, theMagField );
00091
00092
00093
00094 pfDisplacedVertexCandidateFinder_.findDisplacedVertexCandidates();
00095
00096
00097 if(verbose_) {
00098 ostringstream str;
00099 str<<pfDisplacedVertexCandidateFinder_<<endl;
00100 cout << pfDisplacedVertexCandidateFinder_<<endl;
00101 LogInfo("PFDisplacedVertexCandidateProducer") << str.str()<<endl;
00102 }
00103
00104
00105 auto_ptr< reco::PFDisplacedVertexCandidateCollection >
00106 pOutputDisplacedVertexCandidateCollection(
00107 pfDisplacedVertexCandidateFinder_.transferVertexCandidates() );
00108
00109
00110 iEvent.put(pOutputDisplacedVertexCandidateCollection);
00111
00112 LogDebug("PFDisplacedVertexCandidateProducer")<<"STOP event: "<<iEvent.id().event()
00113 <<" in run "<<iEvent.id().run()<<endl;
00114
00115 }