CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackVertexArbitrator.cc
Go to the documentation of this file.
1 #include <memory>
2 #include <set>
3 
4 
9 
10 
16 
23 
24 
30 
36 
37 
40 
41 
42 
43 //#define VTXDEBUG
44 
46  public:
48 
49 
50  virtual void produce(edm::Event &event, const edm::EventSetup &es);
51 
52  private:
53  bool trackFilter(const reco::TrackRef &track) const;
54 
60 };
61 
63  primaryVertexCollection (params.getParameter<edm::InputTag>("primaryVertices")),
64  secondaryVertexCollection (params.getParameter<edm::InputTag>("secondaryVertices")),
65  trackCollection (params.getParameter<edm::InputTag>("tracks")),
66  beamSpotCollection (params.getParameter<edm::InputTag>("beamSpot"))
67 {
68  produces<reco::VertexCollection>();
70 }
71 
72 
74 {
75  using namespace reco;
76 
77  edm::Handle<VertexCollection> secondaryVertices;
78  event.getByLabel(secondaryVertexCollection, secondaryVertices);
79  VertexCollection theSecVertexColl = *(secondaryVertices.product());
80 
81  edm::Handle<VertexCollection> primaryVertices;
82  event.getByLabel(primaryVertexCollection, primaryVertices);
83 
84  std::auto_ptr<VertexCollection> recoVertices(new VertexCollection);
85  if(primaryVertices->size()!=0){
86  const reco::Vertex &pv = (*primaryVertices)[0];
87 
89  event.getByLabel(trackCollection, tracks);
90 
92  es.get<TransientTrackRecord>().get("TransientTrackBuilder",
93  trackBuilder);
94 
96  event.getByLabel(beamSpotCollection, beamSpot);
97 
98 
99  edm::RefVector< TrackCollection > selectedTracks;
100  for(TrackCollection::const_iterator track = tracks->begin();
101  track != tracks->end(); ++track) {
102  TrackRef ref(tracks, track - tracks->begin());
103  selectedTracks.push_back(ref);
104 
105  }
106 
107 
108  const edm::RefVector< TrackCollection > tracksForArbitration= selectedTracks;
109  reco::VertexCollection theRecoVertices = theArbitrator->trackVertexArbitrator(beamSpot, pv, trackBuilder, tracksForArbitration,
110  theSecVertexColl);
111 
112  for(unsigned int ivtx=0; ivtx < theRecoVertices.size(); ivtx++){
113  recoVertices->push_back(theRecoVertices[ivtx]);
114  }
115 
116  }
117  event.put(recoVertices);
118 
119 
120 
121 }
122 
TrackVertexArbitrator(const edm::ParameterSet &params)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
reco::VertexCollection trackVertexArbitrator(edm::Handle< reco::BeamSpot > &beamSpot, const reco::Vertex &pv, edm::ESHandle< TransientTrackBuilder > &trackBuilder, const edm::RefVector< reco::TrackCollection > &selectedTracks, reco::VertexCollection &secondaryVertices)
virtual void produce(edm::Event &event, const edm::EventSetup &es)
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::InputTag primaryVertexCollection
bool trackFilter(const reco::TrackRef &track) const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
edm::InputTag secondaryVertexCollection
TrackVertexArbitration * theArbitrator
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:55
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:64