CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
pat::xxxEventHypothesisProducer Class Reference

#include <xxxEventHypothesisProducer.h>

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

Public Member Functions

virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 xxxEventHypothesisProducer (const edm::ParameterSet &iConfig)
 
 ~xxxEventHypothesisProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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_.

8  :
9  public edm::EDProducer(iConfig)
10 {
11 
12  // Here we get the list of common includes
13  muonSrc_ = iConfig.getParameter<edm::InputTag>( "muonSource" );
14  electronSrc_ = iConfig.getParameter<edm::InputTag>( "electronSource" );
15  tauSrc_ = iConfig.getParameter<edm::InputTag>( "tauSource" );
16  photonSrc_ = iConfig.getParameter<edm::InputTag>( "photonSource" );
17  jetSrc_ = iConfig.getParameter<edm::InputTag>( "jetSource" );
18  metSrc_ = iConfig.getParameter<edm::InputTag>( "metSource" );
19 
20  // Here we get the output tag name
21  outputName_ = iConfig.getParameter<edm::OutputTag>("outputName");
22 
23  // This declares the output to the event stream
24  string alias;
25  produces<std::vector<xxxEventHypothesis> >(alias = outputName_).setBranchAddress(alias);
26 }
T getParameter(std::string const &) const
xxxEventHypothesisProducer::~xxxEventHypothesisProducer ( )

Definition at line 28 of file xxxEventHypothesisProducer.cc.

29 {
30 }

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 HI_PhotonSkim_cff::electrons, electronSrc_, edm::Event::getByLabel(), fwrapper::jets, jetSrc_, metSrc_, patZpeak::muons, muonSrc_, outputName_, interactiveExample::photons, photonSrc_, edm::Event::put(), and tauSrc_.

33 {
34 
35  // Here is the vector where you should put your hypotheses
36  std::vector<xxxEventHypothesis hyps;
37 
38 
39  // ------------------------------------------------------------------------
40  // Here is where you get the objects you need. The perl script will
41  // uncomment any that you need by reading the event hypothesis text file
42  // ------------------------------------------------------------------------
43 
45  iEvent.getByLabel(muonSrc_, muons);
46 
48  iEvent.getByLabel(electronSrc_, electrons);
49 
51  iEvent.getByLabel(tauSrc_, taus);
52 
54  iEvent.getByLabel(photonSrc_, photons);
55 
57  iEvent.getByLabel(jetSrc_, jets);
58 
60  iEvent.getByLabel(metSrc_, mets);
61 
62 
63  // ------------------------------------------------------------------------
64  // ****** Here is where you put your event hypothesis code ******
65  // ------------------------------------------------------------------------
66  // A: Define a combinatorics loop.
67  // Replace for ( ...;...;...) with your appropriate loop over objects, such as
68  // for ( vector<Muon>::iterator imuon = muons->begin(); imuon != muons->end(); imuon++ )
69  // for ( vector<Muon>::iterator jmuon = imuon + 1; jmuon != muons->end(); jmuon++ )
70  //
71  for ( ...; ...; ... ) {
73 
74  // B: Fill "hyp" with your hypothesis information and push it back to the
75  // vector containing them.
76  // For instance,
77  // hyp.muon1() = *imuon;
78  // hyp.muon2() = *jmuon;
79  // hyp.jets() = *jets;
80 
81  hyps.push_back( hyp );
82  }
83 
84 
85  // Here is where we write the hypotheses to the event stream
86  std::auto_ptr<std::vector<xxxEventHypothesis> > ap_hyps( hyps );
87  iEvent.put( ap_hyps, outputName_);
88 
89 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
vector< PseudoJet > jets
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
tuple muons
Definition: patZpeak.py:38

Member Data Documentation

edm::InputTag pat::xxxEventHypothesisProducer::electronSrc_
private

Definition at line 57 of file xxxEventHypothesisProducer.h.

Referenced by produce(), and xxxEventHypothesisProducer().

edm::InputTag pat::xxxEventHypothesisProducer::jetSrc_
private

Definition at line 60 of file xxxEventHypothesisProducer.h.

Referenced by produce(), and xxxEventHypothesisProducer().

edm::InputTag pat::xxxEventHypothesisProducer::metSrc_
private

Definition at line 61 of file xxxEventHypothesisProducer.h.

Referenced by produce(), and xxxEventHypothesisProducer().

edm::InputTag pat::xxxEventHypothesisProducer::muonSrc_
private

Definition at line 56 of file xxxEventHypothesisProducer.h.

Referenced by produce(), and xxxEventHypothesisProducer().

edm::OutputTag pat::xxxEventHypothesisProducer::outputName_
private

Definition at line 63 of file xxxEventHypothesisProducer.h.

Referenced by produce(), and xxxEventHypothesisProducer().

edm::InputTag pat::xxxEventHypothesisProducer::photonSrc_
private

Definition at line 59 of file xxxEventHypothesisProducer.h.

Referenced by produce(), and xxxEventHypothesisProducer().

edm::InputTag pat::xxxEventHypothesisProducer::tauSrc_
private

Definition at line 58 of file xxxEventHypothesisProducer.h.

Referenced by produce(), and xxxEventHypothesisProducer().