CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
29  // --- Setup input collection names --- //
30 
31  inputTagVertexCandidates_
32  = iConfig.getParameter<InputTag>("vertexCandidatesLabel");
33 
34  inputTagMainVertex_
35  = iConfig.getParameter<InputTag>("mainVertexLabel");
36 
37  inputTagBeamSpot_
38  = iConfig.getParameter<InputTag>("offlineBeamSpotLabel");
39 
40  verbose_ =
41  iConfig.getUntrackedParameter<bool>("verbose");
42 
43  bool debug =
44  iConfig.getUntrackedParameter<bool>("debug");
45 
46  // ------ Algo Parameters ------ //
47 
48  // Maximal transverse distance between two minimal
49  // approach points to be used together
50  double transvSize
51  = iConfig.getParameter< double >("transvSize");
52 
53  // Maximal longitudinal distance between two minimal
54  // approach points to be used together
55  double longSize
56  = iConfig.getParameter< double >("longSize");
57 
58  // Minimal radius below which we do not reconstruct interactions
59  // Typically the position of the first Pixel layer
60  double primaryVertexCut
61  = iConfig.getParameter< double >("primaryVertexCut");
62 
63  // Radius at which no secondary tracks are availables
64  // in the barrel.For the moment we exclude the TOB barrel
65  // since 5-th track step starts the latest at first TOB
66  // layer.
67  double tobCut
68  = iConfig.getParameter< double >("tobCut");
69 
70  // Radius at which no secondary tracks are availables
71  // in the endcaps.For the moment we exclude the TEC wheel.
72  double tecCut
73  = iConfig.getParameter< double >("tecCut");
74 
75  // The minimal accepted weight for the tracks calculated in the
76  // adaptive vertex fitter to be associated to the displaced vertex
77  double minAdaptWeight
78  = iConfig.getParameter< double >("minAdaptWeight");
79 
80  bool switchOff2TrackVertex
81  = iConfig.getUntrackedParameter< bool >("switchOff2TrackVertex");
82 
83  edm::ParameterSet ps_trk = iConfig.getParameter<edm::ParameterSet>("tracksSelectorParameters");
84  edm::ParameterSet ps_vtx = iConfig.getParameter<edm::ParameterSet>("vertexIdentifierParameters");
85  edm::ParameterSet ps_avf = iConfig.getParameter<edm::ParameterSet>("avfParameters");
86 
87  produces<reco::PFDisplacedVertexCollection>();
88 
89  // Vertex Finder parameters -----------------------------------
90  pfDisplacedVertexFinder_.setDebug(debug);
91  pfDisplacedVertexFinder_.setParameters(transvSize, longSize,
92  primaryVertexCut, tobCut,
93  tecCut, minAdaptWeight, switchOff2TrackVertex);
94  pfDisplacedVertexFinder_.setAVFParameters(ps_avf);
95  pfDisplacedVertexFinder_.setTracksSelector(ps_trk);
96  pfDisplacedVertexFinder_.setVertexIdentifier(ps_vtx);
97 
98 }
99 
100 
101 
103 
104 
105 
106 void
108 
109 void
111  const edm::EventSetup & es) { }
112 
113 
114 void
116  const EventSetup& iSetup) {
117 
118  LogDebug("PFDisplacedVertexProducer")<<"START event: "<<iEvent.id().event()
119  <<" in run "<<iEvent.id().run()<<endl;
120 
121  // Prepare useful information for the Finder
122 
123  ESHandle<MagneticField> magField;
124  iSetup.get<IdealMagneticFieldRecord>().get(magField);
125  const MagneticField* theMagField = magField.product();
126 
127  ESHandle<GlobalTrackingGeometry> globTkGeomHandle;
128  iSetup.get<GlobalTrackingGeometryRecord>().get(globTkGeomHandle);
129 
130  ESHandle<TrackerGeometry> tkerGeomHandle;
131  iSetup.get<TrackerDigiGeometryRecord>().get(tkerGeomHandle);
132 
134  iEvent.getByLabel(inputTagVertexCandidates_, vertexCandidates);
135 
136  Handle< reco::VertexCollection > mainVertexHandle;
137  iEvent.getByLabel(inputTagMainVertex_, mainVertexHandle);
138 
139  Handle< reco::BeamSpot > beamSpotHandle;
140  iEvent.getByLabel(inputTagBeamSpot_, beamSpotHandle);
141 
142  // Fill useful event information for the Finder
143  pfDisplacedVertexFinder_.setEdmParameters(theMagField, globTkGeomHandle, tkerGeomHandle);
144  pfDisplacedVertexFinder_.setPrimaryVertex(mainVertexHandle, beamSpotHandle);
145  pfDisplacedVertexFinder_.setInput(vertexCandidates);
146 
147  // Run the finder
148  pfDisplacedVertexFinder_.findDisplacedVertices();
149 
150 
151  if(verbose_) {
152  ostringstream str;
153  //str<<pfDisplacedVertexFinder_<<endl;
154  cout << pfDisplacedVertexFinder_<<endl;
155  LogInfo("PFDisplacedVertexProducer") << str.str()<<endl;
156  }
157 
158 
159  auto_ptr< reco::PFDisplacedVertexCollection >
160  pOutputDisplacedVertexCollection(
161  pfDisplacedVertexFinder_.transferDisplacedVertices() );
162 
163 
164 
165  iEvent.put(pOutputDisplacedVertexCollection);
166 
167  LogDebug("PFDisplacedVertexProducer")<<"STOP event: "<<iEvent.id().event()
168  <<" in run "<<iEvent.id().run()<<endl;
169 
170 }
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:42
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:44
T getUntrackedParameter(std::string const &, T const &) const
virtual void beginRun(edm::Run &r, const edm::EventSetup &c)
PFDisplacedVertexProducer(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
virtual void produce(edm::Event &, const edm::EventSetup &)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
edm::EventID id() const
Definition: EventBase.h:56
tuple cout
Definition: gather_cfg.py:121
#define debug
Definition: MEtoEDMFormat.h:34
Definition: Run.h:33