CMS 3D CMS Logo

JetChargeProducer.cc
Go to the documentation of this file.
2 
4 srcToken_(consumes<reco::JetTracksAssociationCollection>(cfg.getParameter<edm::InputTag>("src"))),
5 algo_(cfg) {
6  produces<JetChargeCollection>();
7 }
8 
11  iEvent.getByToken(srcToken_, hJTAs);
14 
15  if (hJTAs->keyProduct().isNull()) {
16  // need to work around this bug someway, altough it's not stricly my fault
17  iEvent.put(std::make_unique<JetChargeCollection>());
18  return;
19  }
20  auto ret = std::make_unique<JetChargeCollection>(hJTAs->keyProduct());
21  for (IT it = hJTAs->begin(), ed = hJTAs->end(); it != ed; ++it) {
22  const JetRef &jet = it->first;
23  const reco::TrackRefVector &tracks = it->second;
24  float val = static_cast<float>( algo_.charge(jet->p4(), tracks) );
26  }
27 
28  iEvent.put(std::move(ret));
29 }
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:136
transient_vector_type::const_iterator const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
JetTracksAssociation::Container JetTracksAssociationCollection
typedefs for backward compatibility
const_iterator end() const
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
const edm::EDGetTokenT< reco::JetTracksAssociationCollection > srcToken_
edm::Ref< JetBxCollection > JetRef
Definition: Jet.h:13
const JetCharge algo_
int iEvent
Definition: GenABIO.cc:230
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
bool isNull() const
Checks for null.
Definition: RefToBaseProd.h:68
const_iterator begin() const
def move(src, dest)
Definition: eostools.py:510