CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
xxxEventHypothesisProducer.cc
Go to the documentation of this file.
1 #include "skelsubsys/xxxEventHypothesis/interface/xxxEventHypothesisProducer.h"
2 
3 #include <iostream>
4 
5 using namespace pat;
6 using namespace std;
7 
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 }
27 
29 {
30 }
31 
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 }
T getParameter(std::string const &) const
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)
int iEvent
Definition: GenABIO.cc:243
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
xxxEventHypothesisProducer(const edm::ParameterSet &iConfig)