CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  std::auto_ptr<JetChargeCollection> ret(new JetChargeCollection());
18  iEvent.put(ret);
19  return;
20  }
21  std::auto_ptr<JetChargeCollection> ret(new JetChargeCollection(hJTAs->keyProduct()));
22  for (IT it = hJTAs->begin(), ed = hJTAs->end(); it != ed; ++it) {
23  const JetRef &jet = it->first;
24  const reco::TrackRefVector &tracks = it->second;
25  float val = static_cast<float>( algo_.charge(jet->p4(), tracks) );
27  }
28 
29  iEvent.put(ret);
30 }
double charge(const LorentzVector &lv, const reco::TrackCollection &vec) const
Definition: JetCharge.cc:7
algo_(conf.existsAs< bool >("Correct")?conf.getParameter< bool >("Correct"):true, conf.getParameter< double >("e9e25Cut"), conf.getParameter< double >("intercept2DCut"), conf.existsAs< bool >("intercept2DSlope")?conf.getParameter< double >("intercept2DSlope"):defaultSlope2D_, conf.getParameter< std::vector< double > >("e1e9Cut"), conf.getParameter< std::vector< double > >("eCOREe9Cut"), conf.getParameter< std::vector< double > >("eSeLCut"), hfvars_)
tuple cfg
Definition: looper.py:259
transient_vector_type::const_iterator const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
JetTracksAssociation::Container JetTracksAssociationCollection
typedefs for backward compatibility
virtual void produce(edm::Event &, const edm::EventSetup &)
edm::Ref< JetCollection > JetRef
Definition: Jet.h:54
edm::EDGetTokenT< reco::JetTracksAssociationCollection > srcToken_
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
std::vector< LinkConnSpec >::const_iterator IT
reco::JetFloatAssociation::Container JetChargeCollection
bool setValue(Container &, const reco::JetBaseRef &, float)
associate jet with value
JetChargeProducer(const edm::ParameterSet &cfg)
tuple tracks
Definition: testEve_cfg.py:39