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  : magFieldToken_(esConsumes()),
66  globTkGeomToken_(esConsumes()),
67  tkerTopoToken_(esConsumes()),
68  tkerGeomToken_(esConsumes()) {
69  // --- Setup input collection names --- //
70 
72  consumes<reco::PFDisplacedVertexCandidateCollection>(iConfig.getParameter<InputTag>("vertexCandidatesLabel"));
73 
74  inputTagMainVertex_ = consumes<reco::VertexCollection>(iConfig.getParameter<InputTag>("mainVertexLabel"));
75 
76  inputTagBeamSpot_ = consumes<reco::BeamSpot>(iConfig.getParameter<InputTag>("offlineBeamSpotLabel"));
77 
78  verbose_ = iConfig.getUntrackedParameter<bool>("verbose");
79 
80  bool debug = iConfig.getUntrackedParameter<bool>("debug");
81 
82  // ------ Algo Parameters ------ //
83 
84  // Maximal transverse distance between two minimal
85  // approach points to be used together
86  double transvSize = iConfig.getParameter<double>("transvSize");
87 
88  // Maximal longitudinal distance between two minimal
89  // approach points to be used together
90  double longSize = iConfig.getParameter<double>("longSize");
91 
92  // Minimal radius below which we do not reconstruct interactions
93  // Typically the position of the first Pixel layer
94  double primaryVertexCut = iConfig.getParameter<double>("primaryVertexCut");
95 
96  // Radius at which no secondary tracks are availables
97  // in the barrel.For the moment we exclude the TOB barrel
98  // since 5-th track step starts the latest at first TOB
99  // layer.
100  double tobCut = iConfig.getParameter<double>("tobCut");
101 
102  // Radius at which no secondary tracks are availables
103  // in the endcaps.For the moment we exclude the TEC wheel.
104  double tecCut = iConfig.getParameter<double>("tecCut");
105 
106  // The minimal accepted weight for the tracks calculated in the
107  // adaptive vertex fitter to be associated to the displaced vertex
108  double minAdaptWeight = iConfig.getParameter<double>("minAdaptWeight");
109 
110  bool switchOff2TrackVertex = iConfig.getUntrackedParameter<bool>("switchOff2TrackVertex");
111 
112  edm::ParameterSet ps_trk = iConfig.getParameter<edm::ParameterSet>("tracksSelectorParameters");
113  edm::ParameterSet ps_vtx = iConfig.getParameter<edm::ParameterSet>("vertexIdentifierParameters");
114  edm::ParameterSet ps_avf = iConfig.getParameter<edm::ParameterSet>("avfParameters");
115 
116  produces<reco::PFDisplacedVertexCollection>();
117 
118  // Vertex Finder parameters -----------------------------------
125 }
126 
128 
130  LogDebug("PFDisplacedVertexProducer") << "START event: " << iEvent.id().event() << " in run " << iEvent.id().run()
131  << endl;
132 
133  // Prepare useful information for the Finder
134 
135  auto const& theMagField = &iSetup.getData(magFieldToken_);
136  auto const& globTkGeom = &iSetup.getData(globTkGeomToken_);
137  auto const& tkerTopo = &iSetup.getData(tkerTopoToken_);
138  auto const& tkerGeom = &iSetup.getData(tkerGeomToken_);
139 
141  iEvent.getByToken(inputTagVertexCandidates_, vertexCandidates);
142 
143  Handle<reco::VertexCollection> mainVertexHandle;
144  iEvent.getByToken(inputTagMainVertex_, mainVertexHandle);
145 
146  Handle<reco::BeamSpot> beamSpotHandle;
147  iEvent.getByToken(inputTagBeamSpot_, beamSpotHandle);
148 
149  // Fill useful event information for the Finder
150  pfDisplacedVertexFinder_.setEdmParameters(theMagField, globTkGeom, tkerTopo, tkerGeom);
151  pfDisplacedVertexFinder_.setPrimaryVertex(mainVertexHandle, beamSpotHandle);
152  pfDisplacedVertexFinder_.setInput(vertexCandidates);
153 
154  // Run the finder
156 
157  if (verbose_) {
158  ostringstream str;
159  //str<<pfDisplacedVertexFinder_<<endl;
160  cout << pfDisplacedVertexFinder_ << endl;
161  LogInfo("PFDisplacedVertexProducer") << str.str() << endl;
162  }
163 
164  std::unique_ptr<reco::PFDisplacedVertexCollection> pOutputDisplacedVertexCollection(
166 
167  iEvent.put(std::move(pOutputDisplacedVertexCollection));
168 
169  LogDebug("PFDisplacedVertexProducer") << "STOP event: " << iEvent.id().event() << " in run " << iEvent.id().run()
170  << endl;
171 }
PFDisplacedVertexProducer::tkerGeomToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkerGeomToken_
Definition: PFDisplacedVertexProducer.cc:49
PFDisplacedVertexProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: PFDisplacedVertexProducer.cc:129
PFDisplacedVertexProducer
Producer for DisplacedVertices.
Definition: PFDisplacedVertexProducer.cc:28
MessageLogger.h
TrackerGeometry.h
particleFlowDisplacedVertex_cfi.minAdaptWeight
minAdaptWeight
Definition: particleFlowDisplacedVertex_cfi.py:34
PFDisplacedVertexFinder::setEdmParameters
void setEdmParameters(const MagneticField *magField, edm::ESHandle< GlobalTrackingGeometry > globTkGeomHandle, const TrackerTopology *tkerTopo, const TrackerGeometry *tkerGeom)
Sets parameters for track extrapolation and hits study.
Definition: PFDisplacedVertexFinder.h:71
ESHandle.h
edm::EDGetTokenT< reco::PFDisplacedVertexCandidateCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
PFDisplacedVertexFinder::transferDisplacedVertices
std::unique_ptr< reco::PFDisplacedVertexCollection > transferDisplacedVertices()
Definition: PFDisplacedVertexFinder.h:100
gather_cfg.cout
cout
Definition: gather_cfg.py:144
PFDisplacedVertexProducer::inputTagMainVertex_
edm::EDGetTokenT< reco::VertexCollection > inputTagMainVertex_
Input tag for main vertex to cut of dxy of secondary tracks.
Definition: PFDisplacedVertexProducer.cc:43
particleFlowDisplacedVertex_cfi.transvSize
transvSize
Definition: particleFlowDisplacedVertex_cfi.py:14
particleFlowDisplacedVertex_cfi.tecCut
tecCut
Definition: particleFlowDisplacedVertex_cfi.py:29
EDProducer.h
TrackingGeometry.h
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
PFDisplacedVertexFinder::findDisplacedVertices
void findDisplacedVertices()
-----— Main function which find vertices -----— ///
Definition: PFDisplacedVertexFinder.cc:54
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
PFDisplacedVertexProducer::inputTagBeamSpot_
edm::EDGetTokenT< reco::BeamSpot > inputTagBeamSpot_
Definition: PFDisplacedVertexProducer.cc:44
PFDisplacedVertexProducer::inputTagVertexCandidates_
edm::EDGetTokenT< reco::PFDisplacedVertexCandidateCollection > inputTagVertexCandidates_
Definition: PFDisplacedVertexProducer.cc:39
PFDisplacedVertexProducer::magFieldToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
Definition: PFDisplacedVertexProducer.cc:46
particleFlowDisplacedVertex_cfi.tobCut
tobCut
Definition: particleFlowDisplacedVertex_cfi.py:25
MakerMacros.h
debug
#define debug
Definition: HDRShower.cc:19
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
IdealMagneticFieldRecord.h
str
#define str(s)
Definition: TestProcessor.cc:53
GlobalTrackingGeometryRecord.h
FileInPath.h
PFDisplacedVertexFinder::setDebug
void setDebug(bool debug)
Sets debug printout flag.
Definition: PFDisplacedVertexFinder.h:68
PFDisplacedVertexFinder
Definition: PFDisplacedVertexFinder.h:31
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
PFDisplacedVertexFinder::setTracksSelector
void setTracksSelector(const edm::ParameterSet &ps)
Definition: PFDisplacedVertexFinder.h:81
iEvent
int iEvent
Definition: GenABIO.cc:224
PFDisplacedVertexProducer::~PFDisplacedVertexProducer
~PFDisplacedVertexProducer() override
Definition: PFDisplacedVertexProducer.cc:127
PFDisplacedVertexFinder::setAVFParameters
void setAVFParameters(const edm::ParameterSet &ps)
Definition: PFDisplacedVertexFinder.h:90
particleFlowDisplacedVertex_cfi.longSize
longSize
Definition: particleFlowDisplacedVertex_cfi.py:17
edm::stream::EDProducer
Definition: EDProducer.h:36
PFDisplacedVertexProducer::pfDisplacedVertexFinder_
PFDisplacedVertexFinder pfDisplacedVertexFinder_
Displaced Vertices finder.
Definition: PFDisplacedVertexProducer.cc:55
MagneticField.h
PFDisplacedVertexProducer::tkerTopoToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tkerTopoToken_
Definition: PFDisplacedVertexProducer.cc:48
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
PFDisplacedVertexFinder::setPrimaryVertex
void setPrimaryVertex(edm::Handle< reco::VertexCollection > mainVertexHandle, edm::Handle< reco::BeamSpot > beamSpotHandle)
Definition: PFDisplacedVertexFinder.h:85
PFDisplacedVertexFinder::setInput
void setInput(const edm::Handle< reco::PFDisplacedVertexCandidateCollection > &)
Set input collections of tracks.
Definition: PFDisplacedVertexFinder.cc:43
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
PFDisplacedVertexProducer::PFDisplacedVertexProducer
PFDisplacedVertexProducer(const edm::ParameterSet &)
Definition: PFDisplacedVertexProducer.cc:64
EventSetup.h
PFDisplacedVertexProducer::verbose_
bool verbose_
verbose ?
Definition: PFDisplacedVertexProducer.cc:52
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PFDisplacedVertexFinder::setVertexIdentifier
void setVertexIdentifier(const edm::ParameterSet &ps)
Definition: PFDisplacedVertexFinder.h:83
Exception.h
PFDisplacedVertexFinder::setParameters
void setParameters(double transvSize, double longSize, double primaryVertexCut, double tobCut, double tecCut, double minAdaptWeight, bool switchOff2TrackVertex)
-----— Set different algo parameters -----— ///
Definition: PFDisplacedVertexFinder.h:51
ParameterSet.h
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
GlobalTrackingGeometry.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
particleFlowDisplacedVertex_cfi.switchOff2TrackVertex
switchOff2TrackVertex
Definition: particleFlowDisplacedVertex_cfi.py:38
PFDisplacedVertexProducer::globTkGeomToken_
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > globTkGeomToken_
Definition: PFDisplacedVertexProducer.cc:47
PFDisplacedVertexFinder.h