CMS 3D CMS Logo

PFDisplacedVertexProducer.cc
Go to the documentation of this file.
1 
27 
29 public:
31 
32  ~PFDisplacedVertexProducer() override;
33 
34  void produce(edm::Event&, const edm::EventSetup&) override;
35 
36 private:
40 
42 
45 
50 
52  bool verbose_;
53 
56 };
57 
60 
61 using namespace std;
62 using namespace edm;
63 
65  : inputTagVertexCandidates_(consumes<reco::PFDisplacedVertexCandidateCollection>(
66  iConfig.getParameter<InputTag>("vertexCandidatesLabel"))),
67  inputTagMainVertex_(consumes<reco::VertexCollection>(iConfig.getParameter<InputTag>("mainVertexLabel"))),
68  inputTagBeamSpot_(consumes<reco::BeamSpot>(iConfig.getParameter<InputTag>("offlineBeamSpotLabel"))),
69  magFieldToken_(esConsumes()),
70  globTkGeomToken_(esConsumes()),
71  tkerTopoToken_(esConsumes()),
72  tkerGeomToken_(esConsumes()) {
73  // --- Setup input collection names --- //
74 
75  verbose_ = iConfig.getUntrackedParameter<bool>("verbose");
76 
77  bool debug = iConfig.getUntrackedParameter<bool>("debug");
78 
79  // ------ Algo Parameters ------ //
80 
81  // Maximal transverse distance between two minimal
82  // approach points to be used together
83  double transvSize = iConfig.getParameter<double>("transvSize");
84 
85  // Maximal longitudinal distance between two minimal
86  // approach points to be used together
87  double longSize = iConfig.getParameter<double>("longSize");
88 
89  // Minimal radius below which we do not reconstruct interactions
90  // Typically the position of the first Pixel layer
91  double primaryVertexCut = iConfig.getParameter<double>("primaryVertexCut");
92 
93  // Radius at which no secondary tracks are availables
94  // in the barrel.For the moment we exclude the TOB barrel
95  // since 5-th track step starts the latest at first TOB
96  // layer.
97  double tobCut = iConfig.getParameter<double>("tobCut");
98 
99  // Radius at which no secondary tracks are availables
100  // in the endcaps.For the moment we exclude the TEC wheel.
101  double tecCut = iConfig.getParameter<double>("tecCut");
102 
103  // The minimal accepted weight for the tracks calculated in the
104  // adaptive vertex fitter to be associated to the displaced vertex
105  double minAdaptWeight = iConfig.getParameter<double>("minAdaptWeight");
106 
107  bool switchOff2TrackVertex = iConfig.getUntrackedParameter<bool>("switchOff2TrackVertex");
108 
109  edm::ParameterSet ps_trk = iConfig.getParameter<edm::ParameterSet>("tracksSelectorParameters");
110  edm::ParameterSet ps_vtx = iConfig.getParameter<edm::ParameterSet>("vertexIdentifierParameters");
111  edm::ParameterSet ps_avf = iConfig.getParameter<edm::ParameterSet>("avfParameters");
112 
113  produces<reco::PFDisplacedVertexCollection>();
114 
115  // Vertex Finder parameters -----------------------------------
122 }
123 
125 
127  LogDebug("PFDisplacedVertexProducer") << "START event: " << iEvent.id().event() << " in run " << iEvent.id().run();
128 
129  // Prepare useful information for the Finder
130 
131  auto const& theMagField = &iSetup.getData(magFieldToken_);
132  auto const& globTkGeom = &iSetup.getData(globTkGeomToken_);
133  auto const& tkerTopo = &iSetup.getData(tkerTopoToken_);
134  auto const& tkerGeom = &iSetup.getData(tkerGeomToken_);
135 
136  auto const& vertexCandidates = iEvent.getHandle(inputTagVertexCandidates_);
137  auto const& mainVertexHandle = iEvent.getHandle(inputTagMainVertex_);
138  auto const& beamSpotHandle = iEvent.getHandle(inputTagBeamSpot_);
139 
140  // Fill useful event information for the Finder
141  pfDisplacedVertexFinder_.setEdmParameters(theMagField, globTkGeom, tkerTopo, tkerGeom);
142  pfDisplacedVertexFinder_.setPrimaryVertex(mainVertexHandle, beamSpotHandle);
143  pfDisplacedVertexFinder_.setInput(vertexCandidates);
144 
145  // Run the finder
147 
148  if (verbose_) {
149  ostringstream str;
151  edm::LogInfo("PFDisplacedVertexProducer") << str.str();
152  }
153 
154  std::unique_ptr<reco::PFDisplacedVertexCollection> pOutputDisplacedVertexCollection(
156 
157  iEvent.put(std::move(pOutputDisplacedVertexCollection));
158 
159  LogDebug("PFDisplacedVertexProducer") << "STOP event: " << iEvent.id().event() << " in run " << iEvent.id().run();
160 }
const edm::EDGetTokenT< reco::BeamSpot > inputTagBeamSpot_
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > globTkGeomToken_
void setEdmParameters(const MagneticField *magField, edm::ESHandle< GlobalTrackingGeometry > globTkGeomHandle, const TrackerTopology *tkerTopo, const TrackerGeometry *tkerGeom)
Sets parameters for track extrapolation and hits study.
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
PFDisplacedVertexFinder pfDisplacedVertexFinder_
Displaced Vertices finder.
std::vector< PFDisplacedVertexCandidate > PFDisplacedVertexCandidateCollection
collection of PFDisplacedVertexCandidate objects
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const edm::EDGetTokenT< reco::PFDisplacedVertexCandidateCollection > inputTagVertexCandidates_
std::unique_ptr< reco::PFDisplacedVertexCollection > transferDisplacedVertices()
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkerGeomToken_
void findDisplacedVertices()
-----— Main function which find vertices -----— ///
std::vector< Vertex > VertexCollection
Definition: Vertex.h:31
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tkerTopoToken_
PFDisplacedVertexProducer(const edm::ParameterSet &)
T getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< reco::VertexCollection > inputTagMainVertex_
Input tag for main vertex to cut of dxy of secondary tracks.
int iEvent
Definition: GenABIO.cc:224
void setTracksSelector(const edm::ParameterSet &ps)
void setDebug(bool debug)
Sets debug printout flag.
bool getData(T &iHolder) const
Definition: EventSetup.h:122
Producer for DisplacedVertices.
void setAVFParameters(const edm::ParameterSet &ps)
void setInput(const edm::Handle< reco::PFDisplacedVertexCandidateCollection > &)
Set input collections of tracks.
Log< level::Info, false > LogInfo
#define debug
Definition: HDRShower.cc:19
void setPrimaryVertex(edm::Handle< reco::VertexCollection > mainVertexHandle, edm::Handle< reco::BeamSpot > beamSpotHandle)
void setParameters(double transvSize, double longSize, double primaryVertexCut, double tobCut, double tecCut, double minAdaptWeight, bool switchOff2TrackVertex)
--—— Set different algo parameters --—— ///
void produce(edm::Event &, const edm::EventSetup &) override
fixed size matrix
HLT enums.
void setVertexIdentifier(const edm::ParameterSet &ps)
#define str(s)
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)