CMS 3D CMS Logo

PFDisplacedVertexProducer.cc
Go to the documentation of this file.
2 
4 
8 
10 
13 
18 
21 
22 #include <set>
23 
24 using namespace std;
25 using namespace edm;
26 
28  // --- Setup input collection names --- //
29 
30  inputTagVertexCandidates_ =
31  consumes<reco::PFDisplacedVertexCandidateCollection>(iConfig.getParameter<InputTag>("vertexCandidatesLabel"));
32 
33  inputTagMainVertex_ = consumes<reco::VertexCollection>(iConfig.getParameter<InputTag>("mainVertexLabel"));
34 
35  inputTagBeamSpot_ = consumes<reco::BeamSpot>(iConfig.getParameter<InputTag>("offlineBeamSpotLabel"));
36 
37  verbose_ = iConfig.getUntrackedParameter<bool>("verbose");
38 
39  bool debug = iConfig.getUntrackedParameter<bool>("debug");
40 
41  // ------ Algo Parameters ------ //
42 
43  // Maximal transverse distance between two minimal
44  // approach points to be used together
45  double transvSize = iConfig.getParameter<double>("transvSize");
46 
47  // Maximal longitudinal distance between two minimal
48  // approach points to be used together
49  double longSize = iConfig.getParameter<double>("longSize");
50 
51  // Minimal radius below which we do not reconstruct interactions
52  // Typically the position of the first Pixel layer
53  double primaryVertexCut = iConfig.getParameter<double>("primaryVertexCut");
54 
55  // Radius at which no secondary tracks are availables
56  // in the barrel.For the moment we exclude the TOB barrel
57  // since 5-th track step starts the latest at first TOB
58  // layer.
59  double tobCut = iConfig.getParameter<double>("tobCut");
60 
61  // Radius at which no secondary tracks are availables
62  // in the endcaps.For the moment we exclude the TEC wheel.
63  double tecCut = iConfig.getParameter<double>("tecCut");
64 
65  // The minimal accepted weight for the tracks calculated in the
66  // adaptive vertex fitter to be associated to the displaced vertex
67  double minAdaptWeight = iConfig.getParameter<double>("minAdaptWeight");
68 
69  bool switchOff2TrackVertex = iConfig.getUntrackedParameter<bool>("switchOff2TrackVertex");
70 
71  edm::ParameterSet ps_trk = iConfig.getParameter<edm::ParameterSet>("tracksSelectorParameters");
72  edm::ParameterSet ps_vtx = iConfig.getParameter<edm::ParameterSet>("vertexIdentifierParameters");
73  edm::ParameterSet ps_avf = iConfig.getParameter<edm::ParameterSet>("avfParameters");
74 
75  produces<reco::PFDisplacedVertexCollection>();
76 
77  // Vertex Finder parameters -----------------------------------
78  pfDisplacedVertexFinder_.setDebug(debug);
79  pfDisplacedVertexFinder_.setParameters(
81  pfDisplacedVertexFinder_.setAVFParameters(ps_avf);
82  pfDisplacedVertexFinder_.setTracksSelector(ps_trk);
83  pfDisplacedVertexFinder_.setVertexIdentifier(ps_vtx);
84 }
85 
87 
89  LogDebug("PFDisplacedVertexProducer") << "START event: " << iEvent.id().event() << " in run " << iEvent.id().run()
90  << endl;
91 
92  // Prepare useful information for the Finder
93 
94  ESHandle<MagneticField> magField;
95  iSetup.get<IdealMagneticFieldRecord>().get(magField);
96  const MagneticField* theMagField = magField.product();
97 
98  ESHandle<GlobalTrackingGeometry> globTkGeomHandle;
99  iSetup.get<GlobalTrackingGeometryRecord>().get(globTkGeomHandle);
100 
101  ESHandle<TrackerTopology> tkerTopoHandle;
102  iSetup.get<TrackerTopologyRcd>().get(tkerTopoHandle);
103 
104  ESHandle<TrackerGeometry> tkerGeomHandle;
105  iSetup.get<TrackerDigiGeometryRecord>().get(tkerGeomHandle);
106 
108  iEvent.getByToken(inputTagVertexCandidates_, vertexCandidates);
109 
110  Handle<reco::VertexCollection> mainVertexHandle;
111  iEvent.getByToken(inputTagMainVertex_, mainVertexHandle);
112 
113  Handle<reco::BeamSpot> beamSpotHandle;
114  iEvent.getByToken(inputTagBeamSpot_, beamSpotHandle);
115 
116  // Fill useful event information for the Finder
117  pfDisplacedVertexFinder_.setEdmParameters(
118  theMagField, globTkGeomHandle, tkerTopoHandle.product(), tkerGeomHandle.product());
119  pfDisplacedVertexFinder_.setPrimaryVertex(mainVertexHandle, beamSpotHandle);
120  pfDisplacedVertexFinder_.setInput(vertexCandidates);
121 
122  // Run the finder
123  pfDisplacedVertexFinder_.findDisplacedVertices();
124 
125  if (verbose_) {
126  ostringstream str;
127  //str<<pfDisplacedVertexFinder_<<endl;
128  cout << pfDisplacedVertexFinder_ << endl;
129  LogInfo("PFDisplacedVertexProducer") << str.str() << endl;
130  }
131 
132  std::unique_ptr<reco::PFDisplacedVertexCollection> pOutputDisplacedVertexCollection(
133  pfDisplacedVertexFinder_.transferDisplacedVertices());
134 
135  iEvent.put(std::move(pOutputDisplacedVertexCollection));
136 
137  LogDebug("PFDisplacedVertexProducer") << "STOP event: " << iEvent.id().event() << " in run " << iEvent.id().run()
138  << endl;
139 }
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
PFDisplacedVertexFwd.h
PFDisplacedVertexProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: PFDisplacedVertexProducer.cc:88
PFDisplacedVertexCandidateFwd.h
MessageLogger.h
TrackerGeometry.h
particleFlowDisplacedVertex_cfi.minAdaptWeight
minAdaptWeight
Definition: particleFlowDisplacedVertex_cfi.py:34
ESHandle.h
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
particleFlowDisplacedVertex_cfi.transvSize
transvSize
Definition: particleFlowDisplacedVertex_cfi.py:14
particleFlowDisplacedVertex_cfi.tecCut
tecCut
Definition: particleFlowDisplacedVertex_cfi.py:29
TrackingGeometry.h
GlobalTrackingGeometryRecord
Definition: GlobalTrackingGeometryRecord.h:17
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
FileInPath.h
particleFlowDisplacedVertex_cfi.tobCut
tobCut
Definition: particleFlowDisplacedVertex_cfi.py:25
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
debug
#define debug
Definition: HDRShower.cc:19
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
IdealMagneticFieldRecord.h
str
#define str(s)
Definition: TestProcessor.cc:51
edm::ESHandle< MagneticField >
GlobalTrackingGeometryRecord.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
iEvent
int iEvent
Definition: GenABIO.cc:224
PFDisplacedVertexProducer::~PFDisplacedVertexProducer
~PFDisplacedVertexProducer() override
Definition: PFDisplacedVertexProducer.cc:86
particleFlowDisplacedVertex_cfi.longSize
longSize
Definition: particleFlowDisplacedVertex_cfi.py:17
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
PFDisplacedVertexProducer::PFDisplacedVertexProducer
PFDisplacedVertexProducer(const edm::ParameterSet &)
Definition: PFDisplacedVertexProducer.cc:27
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Exception.h
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
GlobalTrackingGeometry.h
edm::Event
Definition: Event.h:73
MagneticField
Definition: MagneticField.h:19
edm::InputTag
Definition: InputTag.h:15
particleFlowDisplacedVertex_cfi.switchOff2TrackVertex
switchOff2TrackVertex
Definition: particleFlowDisplacedVertex_cfi.py:38
PFDisplacedVertexProducer.h