test
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) override;
51 
52  private:
53  bool trackFilter(const reco::TrackRef &track) const;
54 
60 };
61 
63 {
64  token_primaryVertex = consumes<reco::VertexCollection>(params.getParameter<edm::InputTag>("primaryVertices"));
65  token_secondaryVertex = consumes<reco::VertexCollection>(params.getParameter<edm::InputTag>("secondaryVertices"));
66  token_beamSpot = consumes<reco::BeamSpot>(params.getParameter<edm::InputTag>("beamSpot"));
67  token_tracks = consumes<reco::TrackCollection>(params.getParameter<edm::InputTag>("tracks"));
68  produces<reco::VertexCollection>();
70 }
71 
72 
74 {
75  using namespace reco;
76 
77  edm::Handle<VertexCollection> secondaryVertices;
78  event.getByToken(token_secondaryVertex, secondaryVertices);
79  VertexCollection theSecVertexColl = *(secondaryVertices.product());
80 
81  edm::Handle<VertexCollection> primaryVertices;
82  event.getByToken(token_primaryVertex, 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.getByToken(token_tracks, tracks);
90 
92  es.get<TransientTrackRecord>().get("TransientTrackBuilder",
93  trackBuilder);
94 
96  event.getByToken(token_beamSpot,beamSpot);
97 
98 
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 
T getParameter(std::string const &) const
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) override
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
edm::EDGetTokenT< reco::VertexCollection > token_primaryVertex
edm::EDGetTokenT< reco::VertexCollection > token_secondaryVertex
edm::EDGetTokenT< reco::TrackCollection > token_tracks
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
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