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 
73 void
75 
76 void
78  const edm::EventSetup & es) { }
79 
80 
81 void
83  const EventSetup& iSetup) {
84 
85  LogDebug("PFDisplacedVertexCandidateProducer")<<"START event: "<<iEvent.id().event()
86  <<" in run "<<iEvent.id().run()<<endl;
87 
88  // Prepare and fill useful event information for the Finder
90  iSetup.get<IdealMagneticFieldRecord>().get(magField);
91  const MagneticField* theMagField = magField.product();
92 
93  Handle <reco::TrackCollection> trackCollection;
94  iEvent.getByLabel(inputTagTracks_, trackCollection);
95 
96  Handle< reco::VertexCollection > mainVertexHandle;
97  iEvent.getByLabel(inputTagMainVertex_, mainVertexHandle);
98 
99  Handle< reco::BeamSpot > beamSpotHandle;
100  iEvent.getByLabel(inputTagBeamSpot_, beamSpotHandle);
101 
102  pfDisplacedVertexCandidateFinder_.setPrimaryVertex(mainVertexHandle, beamSpotHandle);
103  pfDisplacedVertexCandidateFinder_.setInput( trackCollection, theMagField );
104 
105 
106  // Run the finder
107  pfDisplacedVertexCandidateFinder_.findDisplacedVertexCandidates();
108 
109 
110  if(verbose_) {
111  ostringstream str;
112  str<<pfDisplacedVertexCandidateFinder_<<endl;
113  cout << pfDisplacedVertexCandidateFinder_<<endl;
114  LogInfo("PFDisplacedVertexCandidateProducer") << str.str()<<endl;
115  }
116 
117 
118  auto_ptr< reco::PFDisplacedVertexCandidateCollection >
119  pOutputDisplacedVertexCandidateCollection(
120  pfDisplacedVertexCandidateFinder_.transferVertexCandidates() );
121 
122 
123  iEvent.put(pOutputDisplacedVertexCandidateCollection);
124 
125  LogDebug("PFDisplacedVertexCandidateProducer")<<"STOP event: "<<iEvent.id().event()
126  <<" in run "<<iEvent.id().run()<<endl;
127 
128 }
#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:85
virtual void beginRun(edm::Run &r, const edm::EventSetup &c)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
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
virtual void produce(edm::Event &, const edm::EventSetup &)
Definition: Run.h:33