CMS 3D CMS Logo

Public Member Functions | Private Attributes

pat::xxxEventHypothesisProducer Class Reference

#include <xxxEventHypothesisProducer.h>

Inheritance diagram for pat::xxxEventHypothesisProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 xxxEventHypothesisProducer (const edm::ParameterSet &iConfig)
 ~xxxEventHypothesisProducer ()

Private Attributes

edm::InputTag electronSrc_
edm::InputTag jetSrc_
edm::InputTag metSrc_
edm::InputTag muonSrc_
edm::OutputTag outputName_
edm::InputTag photonSrc_
edm::InputTag tauSrc_

Detailed Description

Definition at line 44 of file xxxEventHypothesisProducer.h.


Constructor & Destructor Documentation

xxxEventHypothesisProducer::xxxEventHypothesisProducer ( const edm::ParameterSet iConfig) [explicit]

Definition at line 8 of file xxxEventHypothesisProducer.cc.

References electronSrc_, edm::ParameterSet::getParameter(), jetSrc_, metSrc_, muonSrc_, outputName_, photonSrc_, and tauSrc_.

                                                                                      : 
  public edm::EDProducer(iConfig)
{

  // Here we get the list of common includes
  muonSrc_      = iConfig.getParameter<edm::InputTag>( "muonSource"     );
  electronSrc_  = iConfig.getParameter<edm::InputTag>( "electronSource" );
  tauSrc_       = iConfig.getParameter<edm::InputTag>( "tauSource"      );
  photonSrc_    = iConfig.getParameter<edm::InputTag>( "photonSource"   );
  jetSrc_       = iConfig.getParameter<edm::InputTag>( "jetSource"      );
  metSrc_       = iConfig.getParameter<edm::InputTag>( "metSource"      );

  // Here we get the output tag name
  outputName_   = iConfig.getParameter<edm::OutputTag>("outputName");
  
  // This declares the output to the event stream
  string alias;
  produces<std::vector<xxxEventHypothesis> >(alias = outputName_).setBranchAddress(alias);
}
xxxEventHypothesisProducer::~xxxEventHypothesisProducer ( )

Definition at line 28 of file xxxEventHypothesisProducer.cc.

{
}

Member Function Documentation

xxxEventHypothesisProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 32 of file xxxEventHypothesisProducer.cc.

References electronSrc_, edm::Event::getByLabel(), analyzePatCleaning_cfg::jets, jetSrc_, metSrc_, patZpeak::muons, muonSrc_, outputName_, interactiveExample::photons, photonSrc_, edm::Event::put(), and tauSrc_.

{

  // Here is the vector where you should put your hypotheses
  std::vector<xxxEventHypothesis hyps;
  

  // ------------------------------------------------------------------------
  // Here is where you get the objects you need. The perl script will
  // uncomment any that you need by reading the event hypothesis text file
  // ------------------------------------------------------------------------

  edm::Handle<std::vector<pat::Muon> >     muons;
  iEvent.getByLabel(muonSrc_,              muons);

  edm::Handle<std::vector<pat::Electron> > electrons;
  iEvent.getByLabel(electronSrc_,          electrons);

  edm::Handle<std::vector<pat::Tau> >      taus;
  iEvent.getByLabel(tauSrc_,               taus);

  edm::Handle<std::vector<pat::Photon> >   photons;
  iEvent.getByLabel(photonSrc_,            photons);

  edm::Handle<std::vector<pat::Jet> >      jets;
  iEvent.getByLabel(jetSrc_,               jets);

  edm::Handle<std::vector<pat::Met> >      mets;
  iEvent.getByLabel(metSrc_,               mets);

  
  // ------------------------------------------------------------------------
  // ****** Here is where you put your event hypothesis code ******
  // ------------------------------------------------------------------------
  // A: Define a combinatorics loop.
  // Replace for ( ...;...;...) with your appropriate loop over objects, such as
  // for ( vector<Muon>::iterator imuon = muons->begin(); imuon != muons->end(); imuon++ ) 
  //    for ( vector<Muon>::iterator jmuon = imuon + 1; jmuon != muons->end(); jmuon++ )
  //   
  for ( ...; ...; ... ) {
    xxxEventHypothesis hyp;

    // B: Fill "hyp" with your hypothesis information and push it back to the
    // vector containing them.
    // For instance, 
    // hyp.muon1() = *imuon;
    // hyp.muon2() = *jmuon;
    // hyp.jets() = *jets;

    hyps.push_back( hyp );
  }  


  // Here is where we write the hypotheses to the event stream
  std::auto_ptr<std::vector<xxxEventHypothesis> > ap_hyps( hyps );
  iEvent.put( ap_hyps, outputName_);

}

Member Data Documentation

Definition at line 57 of file xxxEventHypothesisProducer.h.

Referenced by produce(), and xxxEventHypothesisProducer().

Definition at line 60 of file xxxEventHypothesisProducer.h.

Referenced by produce(), and xxxEventHypothesisProducer().

Definition at line 61 of file xxxEventHypothesisProducer.h.

Referenced by produce(), and xxxEventHypothesisProducer().

Definition at line 56 of file xxxEventHypothesisProducer.h.

Referenced by produce(), and xxxEventHypothesisProducer().

Definition at line 63 of file xxxEventHypothesisProducer.h.

Referenced by produce(), and xxxEventHypothesisProducer().

Definition at line 59 of file xxxEventHypothesisProducer.h.

Referenced by produce(), and xxxEventHypothesisProducer().

Definition at line 58 of file xxxEventHypothesisProducer.h.

Referenced by produce(), and xxxEventHypothesisProducer().