CMS 3D CMS Logo

PFDisplacedVertexCandidateProducer.cc
Go to the documentation of this file.
2 
4 
8 
10 
13 
14 #include <set>
15 
16 using namespace std;
17 using namespace edm;
18 
20  // --- Setup input collection names --- //
21  inputTagTracks_ = consumes<reco::TrackCollection>(iConfig.getParameter<InputTag>("trackCollection"));
22 
23  inputTagMainVertex_ = consumes<reco::VertexCollection>(iConfig.getParameter<InputTag>("mainVertexLabel"));
24 
25  inputTagBeamSpot_ = consumes<reco::BeamSpot>(iConfig.getParameter<InputTag>("offlineBeamSpotLabel"));
26 
27  verbose_ = iConfig.getUntrackedParameter<bool>("verbose");
28 
29  bool debug = iConfig.getUntrackedParameter<bool>("debug");
30 
31  // ------ Algo Parameters ------ //
32 
33  // Distance of minimal approach below which
34  // two tracks are considered as linked together
35  double dcaCut = iConfig.getParameter<double>("dcaCut");
36 
37  // Do not reconstruct vertices wich are
38  // too close to the beam pipe
39  double primaryVertexCut = iConfig.getParameter<double>("primaryVertexCut");
40 
41  //maximum distance between the DCA Point and the inner hit of the track
42  double dcaPInnerHitCut = iConfig.getParameter<double>("dcaPInnerHitCut");
43 
44  edm::ParameterSet ps_trk = iConfig.getParameter<edm::ParameterSet>("tracksSelectorParameters");
45 
46  // Collection to be produced
47  produces<reco::PFDisplacedVertexCandidateCollection>();
48 
49  // Vertex Finder parameters -----------------------------------
50  pfDisplacedVertexCandidateFinder_.setDebug(debug);
51  pfDisplacedVertexCandidateFinder_.setParameters(dcaCut, primaryVertexCut, dcaPInnerHitCut, ps_trk);
52 }
53 
55 
57  LogDebug("PFDisplacedVertexCandidateProducer")
58  << "START event: " << iEvent.id().event() << " in run " << iEvent.id().run() << endl;
59 
60  // Prepare and fill useful event information for the Finder
62  iSetup.get<IdealMagneticFieldRecord>().get(magField);
63  const MagneticField* theMagField = magField.product();
64 
66  iEvent.getByToken(inputTagTracks_, trackCollection);
67 
68  Handle<reco::VertexCollection> mainVertexHandle;
69  iEvent.getByToken(inputTagMainVertex_, mainVertexHandle);
70 
71  Handle<reco::BeamSpot> beamSpotHandle;
72  iEvent.getByToken(inputTagBeamSpot_, beamSpotHandle);
73 
74  pfDisplacedVertexCandidateFinder_.setPrimaryVertex(mainVertexHandle, beamSpotHandle);
75  pfDisplacedVertexCandidateFinder_.setInput(trackCollection, theMagField);
76 
77  // Run the finder
78  pfDisplacedVertexCandidateFinder_.findDisplacedVertexCandidates();
79 
80  if (verbose_) {
81  ostringstream str;
82  str << pfDisplacedVertexCandidateFinder_ << endl;
83  cout << pfDisplacedVertexCandidateFinder_ << endl;
84  LogInfo("PFDisplacedVertexCandidateProducer") << str.str() << endl;
85  }
86 
87  std::unique_ptr<reco::PFDisplacedVertexCandidateCollection> pOutputDisplacedVertexCandidateCollection(
88  pfDisplacedVertexCandidateFinder_.transferVertexCandidates());
89 
90  iEvent.put(std::move(pOutputDisplacedVertexCandidateCollection));
91 
92  LogDebug("PFDisplacedVertexCandidateProducer")
93  << "STOP event: " << iEvent.id().event() << " in run " << iEvent.id().run() << endl;
94 }
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
MessageLogger.h
ESHandle.h
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle< reco::TrackCollection >
FileInPath.h
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
debug
#define debug
Definition: HDRShower.cc:19
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
particleFlowDisplacedVertexCandidate_cfi.dcaPInnerHitCut
dcaPInnerHitCut
Definition: particleFlowDisplacedVertexCandidate_cfi.py:24
PFDisplacedVertexCandidateProducer.h
IdealMagneticFieldRecord.h
str
#define str(s)
Definition: TestProcessor.cc:51
edm::ESHandle< MagneticField >
particleFlowDisplacedVertexCandidate_cfi.dcaCut
dcaCut
Definition: particleFlowDisplacedVertexCandidate_cfi.py:17
PFDisplacedVertexCandidateProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: PFDisplacedVertexCandidateProducer.cc:56
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
duplicaterechits_cfi.trackCollection
trackCollection
Definition: duplicaterechits_cfi.py:4
iEvent
int iEvent
Definition: GenABIO.cc:224
MagneticField.h
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
particleFlowDisplacedVertex_cfi.primaryVertexCut
primaryVertexCut
Definition: particleFlowDisplacedVertex_cfi.py:21
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Exception.h
PFDisplacedVertexCandidateProducer::PFDisplacedVertexCandidateProducer
PFDisplacedVertexCandidateProducer(const edm::ParameterSet &)
Definition: PFDisplacedVertexCandidateProducer.cc:19
PFDisplacedVertexCandidateProducer::~PFDisplacedVertexCandidateProducer
~PFDisplacedVertexCandidateProducer() override
Definition: PFDisplacedVertexCandidateProducer.cc:54
edm::Event
Definition: Event.h:73
MagneticField
Definition: MagneticField.h:19
edm::InputTag
Definition: InputTag.h:15