CMS 3D CMS Logo

PFDisplacedVertexCandidateProducer.cc
Go to the documentation of this file.
1 
23 
25 public:
27 
29 
30  void produce(edm::Event&, const edm::EventSetup&) override;
31 
32 private:
35 
39 
41 
43  bool verbose_;
44 
47 };
48 
51 
52 using namespace std;
53 using namespace edm;
54 
56  : magneticFieldToken_(esConsumes()) {
57  // --- Setup input collection names --- //
58  inputTagTracks_ = consumes<reco::TrackCollection>(iConfig.getParameter<InputTag>("trackCollection"));
59 
60  inputTagMainVertex_ = consumes<reco::VertexCollection>(iConfig.getParameter<InputTag>("mainVertexLabel"));
61 
62  inputTagBeamSpot_ = consumes<reco::BeamSpot>(iConfig.getParameter<InputTag>("offlineBeamSpotLabel"));
63 
64  verbose_ = iConfig.getUntrackedParameter<bool>("verbose");
65 
66  bool debug = iConfig.getUntrackedParameter<bool>("debug");
67 
68  // ------ Algo Parameters ------ //
69 
70  // Distance of minimal approach below which
71  // two tracks are considered as linked together
72  double dcaCut = iConfig.getParameter<double>("dcaCut");
73 
74  // Do not reconstruct vertices wich are
75  // too close to the beam pipe
76  double primaryVertexCut = iConfig.getParameter<double>("primaryVertexCut");
77 
78  //maximum distance between the DCA Point and the inner hit of the track
79  double dcaPInnerHitCut = iConfig.getParameter<double>("dcaPInnerHitCut");
80 
81  edm::ParameterSet ps_trk = iConfig.getParameter<edm::ParameterSet>("tracksSelectorParameters");
82 
83  // Collection to be produced
84  produces<reco::PFDisplacedVertexCandidateCollection>();
85 
86  // Vertex Finder parameters -----------------------------------
89 }
90 
92 
94  LogDebug("PFDisplacedVertexCandidateProducer")
95  << "START event: " << iEvent.id().event() << " in run " << iEvent.id().run() << endl;
96 
97  // Prepare and fill useful event information for the Finder
98  auto const& theMagField = &iSetup.getData(magneticFieldToken_);
99 
102 
103  Handle<reco::VertexCollection> mainVertexHandle;
104  iEvent.getByToken(inputTagMainVertex_, mainVertexHandle);
105 
106  Handle<reco::BeamSpot> beamSpotHandle;
107  iEvent.getByToken(inputTagBeamSpot_, beamSpotHandle);
108 
109  pfDisplacedVertexCandidateFinder_.setPrimaryVertex(mainVertexHandle, beamSpotHandle);
111 
112  // Run the finder
114 
115  if (verbose_) {
116  ostringstream str;
119  LogInfo("PFDisplacedVertexCandidateProducer") << str.str() << endl;
120  }
121 
122  std::unique_ptr<reco::PFDisplacedVertexCandidateCollection> pOutputDisplacedVertexCandidateCollection(
124 
125  iEvent.put(std::move(pOutputDisplacedVertexCandidateCollection));
126 
127  LogDebug("PFDisplacedVertexCandidateProducer")
128  << "STOP event: " << iEvent.id().event() << " in run " << iEvent.id().run() << endl;
129 }
MessageLogger.h
PFDisplacedVertexCandidateProducer
Producer for DisplacedVertices.
Definition: PFDisplacedVertexCandidateProducer.cc:24
PFDisplacedVertexCandidateFinder::setPrimaryVertex
void setPrimaryVertex(edm::Handle< reco::VertexCollection > mainVertexHandle, edm::Handle< reco::BeamSpot > beamSpotHandle)
Definition: PFDisplacedVertexCandidateFinder.cc:32
ESHandle.h
PFDisplacedVertexCandidateFinder::setInput
void setInput(const edm::Handle< reco::TrackCollection > &trackh, const MagneticField *magField)
Definition: PFDisplacedVertexCandidateFinder.cc:49
edm::EDGetTokenT< reco::TrackCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
PFDisplacedVertexCandidateProducer::inputTagTracks_
edm::EDGetTokenT< reco::TrackCollection > inputTagTracks_
Reco Tracks used to spot the nuclear interactions.
Definition: PFDisplacedVertexCandidateProducer.cc:34
EDProducer.h
PFDisplacedVertexCandidateProducer::verbose_
bool verbose_
verbose ?
Definition: PFDisplacedVertexCandidateProducer.cc:43
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
PFDisplacedVertexCandidateProducer::pfDisplacedVertexCandidateFinder_
PFDisplacedVertexCandidateFinder pfDisplacedVertexCandidateFinder_
Displaced Vertex Candidates finder.
Definition: PFDisplacedVertexCandidateProducer.cc:46
edm::Handle< reco::TrackCollection >
MakerMacros.h
PFDisplacedVertexCandidateProducer::inputTagMainVertex_
edm::EDGetTokenT< reco::VertexCollection > inputTagMainVertex_
Input tag for main vertex to cut of dxy of secondary tracks.
Definition: PFDisplacedVertexCandidateProducer.cc:37
debug
#define debug
Definition: HDRShower.cc:19
particleFlowDisplacedVertexCandidate_cfi.dcaPInnerHitCut
dcaPInnerHitCut
Definition: particleFlowDisplacedVertexCandidate_cfi.py:24
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
IdealMagneticFieldRecord.h
str
#define str(s)
Definition: TestProcessor.cc:53
particleFlowDisplacedVertexCandidate_cfi.dcaCut
dcaCut
Definition: particleFlowDisplacedVertexCandidate_cfi.py:17
FileInPath.h
PFDisplacedVertexCandidateProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: PFDisplacedVertexCandidateProducer.cc:93
PFDisplacedVertexCandidateFinder::setDebug
void setDebug(bool debug)
sets debug printout flag
Definition: PFDisplacedVertexCandidateFinder.h:53
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
PFDisplacedVertexCandidateFinder::setParameters
void setParameters(double dcaCut, double primaryVertexCut, double dcaPInnerHitCut, const edm::ParameterSet &ps_trk)
------— Set different algo parameters ---— ///
Definition: PFDisplacedVertexCandidateFinder.h:42
edm::ParameterSet
Definition: ParameterSet.h:47
PFDisplacedVertexCandidateProducer::inputTagBeamSpot_
edm::EDGetTokenT< reco::BeamSpot > inputTagBeamSpot_
Definition: PFDisplacedVertexCandidateProducer.cc:38
duplicaterechits_cfi.trackCollection
trackCollection
Definition: duplicaterechits_cfi.py:4
Event.h
PFDisplacedVertexCandidateFinder.h
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::stream::EDProducer
Definition: EDProducer.h:36
PFDisplacedVertexCandidateFinder
Definition: PFDisplacedVertexCandidateFinder.h:26
MagneticField.h
edm::EventSetup
Definition: EventSetup.h:58
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord >
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
particleFlowDisplacedVertex_cfi.primaryVertexCut
primaryVertexCut
Definition: particleFlowDisplacedVertex_cfi.py:21
PFDisplacedVertexCandidateProducer::magneticFieldToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
Definition: PFDisplacedVertexCandidateProducer.cc:40
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
PFDisplacedVertexCandidateFinder::transferVertexCandidates
std::unique_ptr< reco::PFDisplacedVertexCandidateCollection > transferVertexCandidates()
Definition: PFDisplacedVertexCandidateFinder.h:60
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Exception.h
PFDisplacedVertexCandidateFinder::findDisplacedVertexCandidates
void findDisplacedVertexCandidates()
-----— Main function which find vertices -----— ///
Definition: PFDisplacedVertexCandidateFinder.cc:81
PFDisplacedVertexCandidateProducer::PFDisplacedVertexCandidateProducer
PFDisplacedVertexCandidateProducer(const edm::ParameterSet &)
Definition: PFDisplacedVertexCandidateProducer.cc:55
PFDisplacedVertexCandidateProducer::~PFDisplacedVertexCandidateProducer
~PFDisplacedVertexCandidateProducer() override
Definition: PFDisplacedVertexCandidateProducer.cc:91
ParameterSet.h
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15