CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

GenJetBCEnergyRatio Class Reference

Inheritance diagram for GenJetBCEnergyRatio:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Types

typedef
reco::JetFloatAssociation::Container 
JetBCEnergyRatioCollection

Public Member Functions

 GenJetBCEnergyRatio (const edm::ParameterSet &)
 ~GenJetBCEnergyRatio ()

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

Handle< View< Jet > > genjets
edm::InputTag m_genjetsSrc

Detailed Description

Definition at line 50 of file GenJetBCEnergyRatio.cc.


Member Typedef Documentation

Definition at line 56 of file GenJetBCEnergyRatio.cc.


Constructor & Destructor Documentation

GenJetBCEnergyRatio::GenJetBCEnergyRatio ( const edm::ParameterSet iConfig)

Definition at line 67 of file GenJetBCEnergyRatio.cc.

References edm::ParameterSet::getParameter().

{
    produces<JetBCEnergyRatioCollection>("bRatioCollection");
    produces<JetBCEnergyRatioCollection>("cRatioCollection");
    m_genjetsSrc = iConfig.getParameter<edm::InputTag>("genJets");
}
GenJetBCEnergyRatio::~GenJetBCEnergyRatio ( )

Definition at line 76 of file GenJetBCEnergyRatio.cc.

{
}

Member Function Documentation

void GenJetBCEnergyRatio::produce ( edm::Event iEvent,
const edm::EventSetup iEs 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 82 of file GenJetBCEnergyRatio.cc.

References JetMCTagUtils::EnergyRatioFromBHadrons(), JetMCTagUtils::EnergyRatioFromCHadrons(), edm::Event::getByLabel(), j, findQualityFiles::jj, edm::Event::put(), and reco::JetExtendedAssociation::setValue().

{
  iEvent.getByLabel(m_genjetsSrc, genjets);

  typedef edm::RefToBase<reco::Jet> JetRef;

  JetBCEnergyRatioCollection * jtc1;
  JetBCEnergyRatioCollection * jtc2;

  if (genjets.product()->size() > 0) {
    const JetRef jj = genjets->refAt(0);
    jtc1 = new JetBCEnergyRatioCollection(RefToBaseProd<Jet>(jj));
    jtc2 = new JetBCEnergyRatioCollection(RefToBaseProd<Jet>(jj));
  } else {
    jtc1 = new JetBCEnergyRatioCollection();
    jtc2 = new JetBCEnergyRatioCollection();
  }

  std::auto_ptr<JetBCEnergyRatioCollection> bRatioColl(jtc1);
  std::auto_ptr<JetBCEnergyRatioCollection> cRatioColl(jtc2);

  for( size_t j = 0; j != genjets->size(); ++j ) {

    float bRatio = EnergyRatioFromBHadrons( (*genjets)[j] );
    float cRatio = EnergyRatioFromCHadrons( (*genjets)[j] );

    const JetRef & aJet = genjets->refAt(j) ;

    JetFloatAssociation::setValue(*bRatioColl, aJet, bRatio);
    JetFloatAssociation::setValue(*cRatioColl, aJet, cRatio);

  }


  iEvent.put(bRatioColl, "bRatioCollection");
  iEvent.put(cRatioColl, "cRatioCollection");

}

Member Data Documentation

Definition at line 60 of file GenJetBCEnergyRatio.cc.

Definition at line 61 of file GenJetBCEnergyRatio.cc.