CMS 3D CMS Logo

JetChargeProducer.cc
Go to the documentation of this file.
2 
4  : srcToken_(consumes<reco::JetTracksAssociationCollection>(cfg.getParameter<edm::InputTag>("src"))), algo_(cfg) {
5  produces<JetChargeCollection>();
6 }
7 
10  iEvent.getByToken(srcToken_, hJTAs);
13 
14  if (hJTAs->keyProduct().isNull()) {
15  // need to work around this bug someway, altough it's not stricly my fault
16  iEvent.put(std::make_unique<JetChargeCollection>());
17  return;
18  }
19  auto ret = std::make_unique<JetChargeCollection>(hJTAs->keyProduct());
20  for (IT it = hJTAs->begin(), ed = hJTAs->end(); it != ed; ++it) {
21  const JetRef &jet = it->first;
22  const reco::TrackRefVector &tracks = it->second;
23  float val = static_cast<float>(algo_.charge(jet->p4(), tracks));
25  }
26 
27  iEvent.put(std::move(ret));
28 }
transient_vector_type::const_iterator const_iterator
ret
prodAgent to be discontinued
JetTracksAssociation::Container JetTracksAssociationCollection
typedefs for backward compatibility
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
edm::Ref< JetBxCollection > JetRef
Definition: Jet.h:12
const_iterator begin() const
const edm::EDGetTokenT< reco::JetTracksAssociationCollection > srcToken_
const JetCharge algo_
int iEvent
Definition: GenABIO.cc:224
std::vector< LinkConnSpec >::const_iterator IT
const_iterator end() const
bool setValue(Container &, const reco::JetBaseRef &, float)
associate jet with value
KeyRefProd const & keyProduct() const
JetChargeProducer(const edm::ParameterSet &cfg)
double charge(const LorentzVector &lv, const reco::TrackCollection &vec) const
Definition: JetCharge.cc:7
auto const & tracks
cannot be loose
fixed size matrix
HLT enums.
def move(src, dest)
Definition: eostools.py:511