CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 }
tuple ret
prodAgent to be discontinued
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:133
tuple cfg
Definition: looper.py:296
transient_vector_type::const_iterator const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
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
auto const & tracks
cannot be loose
const edm::EDGetTokenT< reco::JetTracksAssociationCollection > srcToken_
const JetCharge algo_
int iEvent
Definition: GenABIO.cc:224
def move
Definition: eostools.py:511
std::vector< LinkConnSpec >::const_iterator IT
bool setValue(Container &, const reco::JetBaseRef &, float)
associate jet with value
JetChargeProducer(const edm::ParameterSet &cfg)