CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TemplatedVertexArbitrator.h
Go to the documentation of this file.
1 #ifndef TemplatedVertexArbitrator_h
2 #define TemplatedVertexArbitrator_h
3 #include <memory>
4 #include <set>
5 
6 
11 
12 
18 
25 
26 
32 
38 
39 
43 
45 
46 //#define VTXDEBUG
47 
48 template <class InputContainer, class VTX>
50  public:
51  typedef std::vector<VTX> Product;
53 
54 
55  virtual void produce(edm::Event &event, const edm::EventSetup &es) override ;
56 
57  private:
58  bool trackFilter(const reco::TrackRef &track) const;
59 
65 };
66 
67 
68 template <class InputContainer, class VTX>
70 {
71  token_primaryVertex = consumes<reco::VertexCollection>(params.getParameter<edm::InputTag>("primaryVertices"));
72  token_secondaryVertex = consumes<Product>(params.getParameter<edm::InputTag>("secondaryVertices"));
73  token_beamSpot = consumes<reco::BeamSpot>(params.getParameter<edm::InputTag>("beamSpot"));
74  token_tracks = consumes<InputContainer>(params.getParameter<edm::InputTag>("tracks"));
75  produces<Product>();
76  theArbitrator = new TrackVertexArbitration<VTX>(params);
77 }
78 
79 template <class InputContainer, class VTX>
81 {
82  using namespace reco;
83 
84  edm::Handle<Product> secondaryVertices;
85  event.getByToken(token_secondaryVertex, secondaryVertices);
86  Product theSecVertexColl = *(secondaryVertices.product());
87 
88  edm::Handle<VertexCollection> primaryVertices;
89  event.getByToken(token_primaryVertex, primaryVertices);
90 
91  std::auto_ptr<Product> recoVertices(new Product);
92  if(primaryVertices->size()!=0){
93  const reco::Vertex &pv = (*primaryVertices)[0];
94 
96  event.getByToken(token_tracks, tracks);
97 
99  es.get<TransientTrackRecord>().get("TransientTrackBuilder",
100  trackBuilder);
101 
103  event.getByToken(token_beamSpot,beamSpot);
104 
105  std::vector<TransientTrack> selectedTracks;
106  for(typename InputContainer::const_iterator track = tracks->begin();
107  track != tracks->end(); ++track) {
108  selectedTracks.push_back(tthelpers::buildTT(tracks,trackBuilder,track - tracks->begin()));
109  }
110 
111 
112  // const edm::RefVector< TrackCollection > tracksForArbitration= selectedTracks;
113  Product theRecoVertices = theArbitrator->trackVertexArbitrator(beamSpot, pv, selectedTracks,
114  theSecVertexColl);
115 
116  for(unsigned int ivtx=0; ivtx < theRecoVertices.size(); ivtx++){
117  recoVertices->push_back(theRecoVertices[ivtx]);
118  }
119 
120  }
121  event.put(recoVertices);
122 
123 
124 
125 }
126 
127 
128 
129 #endif
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
T getParameter(std::string const &) const
edm::EDGetTokenT< Product > token_secondaryVertex
virtual void produce(edm::Event &event, const edm::EventSetup &es) override
edm::EDGetTokenT< InputContainer > token_tracks
TemplatedVertexArbitrator(const edm::ParameterSet &params)
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< VTX > * theArbitrator
edm::EDGetTokenT< reco::VertexCollection > token_primaryVertex
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:55
bool trackFilter(const reco::TrackRef &track) const
reco::TransientTrack buildTT(edm::Handle< reco::TrackCollection > &tracks, edm::ESHandle< TransientTrackBuilder > &trackbuilder, unsigned int k)
Definition: TTHelpers.h:4