CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
JetSignalVertexCompatibility.cc
Go to the documentation of this file.
1 #include <memory>
2 
8 
15 
18 
20 
22 
23 using namespace reco;
24 
26  : algo(params.getParameter<double>("cut"), params.getParameter<double>("temperature")) {
27  jetTracksAssocToken = consumes<JetTracksAssociationCollection>(params.getParameter<edm::InputTag>("jetTracksAssoc"));
28  primaryVerticesToken = consumes<VertexCollection>(params.getParameter<edm::InputTag>("primaryVertices"));
29  produces<JetFloatAssociation::Container>();
30 }
31 
33 
36  es.get<TransientTrackRecord>().get("TransientTrackBuilder", trackBuilder);
37 
38  algo.resetEvent(trackBuilder.product());
39 
41  event.getByToken(jetTracksAssocToken, jetTracksAssoc);
42 
44  event.getByToken(primaryVerticesToken, primaryVertices);
45 
46  auto result = std::make_unique<JetFloatAssociation::Container>(jetTracksAssoc->keyProduct());
47 
48  for (JetTracksAssociationCollection::const_iterator iter = jetTracksAssoc->begin(); iter != jetTracksAssoc->end();
49  ++iter) {
50  if (primaryVertices->empty())
51  (*result)[iter->first] = -1.;
52 
53  const TrackRefVector &tracks = iter->second;
54  std::vector<float> compatibility = algo.compatibility(*primaryVertices, tracks);
55 
56  // the first vertex is the presumed signal vertex
57  (*result)[iter->first] = compatibility[0];
58  }
59 
60  algo.resetEvent(nullptr);
61 
62  event.put(std::move(result));
63 }
std::vector< float > compatibility(const reco::VertexCollection &vertices, const reco::TrackRefVector &tracks) const
transient_vector_type::const_iterator const_iterator
tuple primaryVertices
reco::JetSignalVertexCompatibilityAlgo algo
auto const & tracks
cannot be loose
edm::EDGetTokenT< reco::JetTracksAssociationCollection > jetTracksAssocToken
edm::EDGetTokenT< reco::VertexCollection > primaryVerticesToken
tuple result
Definition: mps_fire.py:311
void resetEvent(const TransientTrackBuilder *trackBuilder)
def move
Definition: eostools.py:511
void produce(edm::Event &event, const edm::EventSetup &es) override
T const * product() const
Definition: ESHandle.h:86
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
JetSignalVertexCompatibility(const edm::ParameterSet &params)
T get() const
Definition: EventSetup.h:88