CMS 3D CMS Logo

JetSignalVertexCompatibility.cc
Go to the documentation of this file.
1 #include <memory>
2 
8 
15 
18 
20 
22 
23 using namespace reco;
24 
26  const edm::ParameterSet &params) :
27  algo(params.getParameter<double>("cut"),
28  params.getParameter<double>("temperature"))
29 {
30  jetTracksAssocToken = consumes<JetTracksAssociationCollection>(params.getParameter<edm::InputTag>("jetTracksAssoc"));
31  primaryVerticesToken = consumes<VertexCollection>(params.getParameter<edm::InputTag>("primaryVertices"));
32  produces<JetFloatAssociation::Container>();
33 }
34 
36 {
37 }
38 
40  const edm::EventSetup &es)
41 {
43  es.get<TransientTrackRecord>().get("TransientTrackBuilder",
44  trackBuilder);
45 
46  algo.resetEvent(trackBuilder.product());
47 
49  event.getByToken(jetTracksAssocToken, jetTracksAssoc);
50 
52  event.getByToken(primaryVerticesToken, primaryVertices);
53 
54  auto result = std::make_unique<JetFloatAssociation::Container>(jetTracksAssoc->keyProduct());
55 
57  jetTracksAssoc->begin();
58  iter != jetTracksAssoc->end(); ++iter) {
59  if (primaryVertices->empty())
60  (*result)[iter->first] = -1.;
61 
62  const TrackRefVector &tracks = iter->second;
63  std::vector<float> compatibility =
64  algo.compatibility(*primaryVertices, tracks);
65 
66  // the first vertex is the presumed signal vertex
67  (*result)[iter->first] = compatibility[0];
68  }
69 
70  algo.resetEvent(nullptr);
71 
72  event.put(std::move(result));
73 }
std::vector< float > compatibility(const reco::VertexCollection &vertices, const reco::TrackRefVector &tracks) const
T getParameter(std::string const &) const
transient_vector_type::const_iterator const_iterator
reco::JetSignalVertexCompatibilityAlgo algo
const_iterator end() const
edm::EDGetTokenT< reco::JetTracksAssociationCollection > jetTracksAssocToken
edm::EDGetTokenT< reco::VertexCollection > primaryVerticesToken
void resetEvent(const TransientTrackBuilder *trackBuilder)
void produce(edm::Event &event, const edm::EventSetup &es) override
primaryVertices
Definition: jets_cff.py:34
JetSignalVertexCompatibility(const edm::ParameterSet &params)
fixed size matrix
T get() const
Definition: EventSetup.h:71
KeyRefProd const & keyProduct() const
const_iterator begin() const
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1