CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFDisplacedVertexCandidateProducer.cc
Go to the documentation of this file.
2 
4 
8 
10 
13 
16 
17 #include <set>
18 
19 using namespace std;
20 using namespace edm;
21 
23 
24  // --- Setup input collection names --- //
25  inputTagTracks_
26  = iConfig.getParameter<InputTag>("trackCollection");
27 
28  inputTagMainVertex_
29  = iConfig.getParameter<InputTag>("mainVertexLabel");
30 
31  inputTagBeamSpot_
32  = iConfig.getParameter<InputTag>("offlineBeamSpotLabel");
33 
34  verbose_ =
35  iConfig.getUntrackedParameter<bool>("verbose");
36 
37  bool debug =
38  iConfig.getUntrackedParameter<bool>("debug");
39 
40  // ------ Algo Parameters ------ //
41 
42  // Distance of minimal approach below which
43  // two tracks are considered as linked together
44  double dcaCut
45  = iConfig.getParameter< double >("dcaCut");
46 
47  // Do not reconstruct vertices wich are
48  // too close to the beam pipe
49  double primaryVertexCut
50  = iConfig.getParameter< double >("primaryVertexCut");
51 
52  //maximum distance between the DCA Point and the inner hit of the track
53  double dcaPInnerHitCut
54  = iConfig.getParameter< double >("dcaPInnerHitCut");
55 
56  edm::ParameterSet ps_trk
57  = iConfig.getParameter<edm::ParameterSet>("tracksSelectorParameters");
58 
59  // Collection to be produced
60  produces<reco::PFDisplacedVertexCandidateCollection>();
61 
62  // Vertex Finder parameters -----------------------------------
63  pfDisplacedVertexCandidateFinder_.setDebug(debug);
64  pfDisplacedVertexCandidateFinder_.setParameters(dcaCut, primaryVertexCut, dcaPInnerHitCut, ps_trk);
65 
66 }
67 
68 
70 
71 
72 void
74  const EventSetup& iSetup) {
75 
76  LogDebug("PFDisplacedVertexCandidateProducer")<<"START event: "<<iEvent.id().event()
77  <<" in run "<<iEvent.id().run()<<endl;
78 
79  // Prepare and fill useful event information for the Finder
81  iSetup.get<IdealMagneticFieldRecord>().get(magField);
82  const MagneticField* theMagField = magField.product();
83 
84  Handle <reco::TrackCollection> trackCollection;
85  iEvent.getByLabel(inputTagTracks_, trackCollection);
86 
87  Handle< reco::VertexCollection > mainVertexHandle;
88  iEvent.getByLabel(inputTagMainVertex_, mainVertexHandle);
89 
90  Handle< reco::BeamSpot > beamSpotHandle;
91  iEvent.getByLabel(inputTagBeamSpot_, beamSpotHandle);
92 
93  pfDisplacedVertexCandidateFinder_.setPrimaryVertex(mainVertexHandle, beamSpotHandle);
94  pfDisplacedVertexCandidateFinder_.setInput( trackCollection, theMagField );
95 
96 
97  // Run the finder
98  pfDisplacedVertexCandidateFinder_.findDisplacedVertexCandidates();
99 
100 
101  if(verbose_) {
102  ostringstream str;
103  str<<pfDisplacedVertexCandidateFinder_<<endl;
104  cout << pfDisplacedVertexCandidateFinder_<<endl;
105  LogInfo("PFDisplacedVertexCandidateProducer") << str.str()<<endl;
106  }
107 
108 
109  auto_ptr< reco::PFDisplacedVertexCandidateCollection >
110  pOutputDisplacedVertexCandidateCollection(
111  pfDisplacedVertexCandidateFinder_.transferVertexCandidates() );
112 
113 
114  iEvent.put(pOutputDisplacedVertexCandidateCollection);
115 
116  LogDebug("PFDisplacedVertexCandidateProducer")<<"STOP event: "<<iEvent.id().event()
117  <<" in run "<<iEvent.id().run()<<endl;
118 
119 }
#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
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
virtual void produce(edm::Event &, const edm::EventSetup &) override
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
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