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 }
double charge(const LorentzVector &lv, const reco::TrackCollection &vec) const
Definition: JetCharge.cc:7
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
transient_vector_type::const_iterator const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
ret
prodAgent to be discontinued
JetTracksAssociation::Container JetTracksAssociationCollection
typedefs for backward compatibility
edm::Ref< JetBxCollection > JetRef
Definition: Jet.h:12
const_iterator end() const
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
const edm::EDGetTokenT< reco::JetTracksAssociationCollection > srcToken_
const JetCharge algo_
int iEvent
Definition: GenABIO.cc:224
std::vector< LinkConnSpec >::const_iterator IT
bool setValue(Container &, const reco::JetBaseRef &, float)
associate jet with value
JetChargeProducer(const edm::ParameterSet &cfg)
fixed size matrix
HLT enums.
KeyRefProd const & keyProduct() const
const_iterator begin() const
def move(src, dest)
Definition: eostools.py:511