CMS 3D CMS Logo

EventHypothesisProducer.cc
Go to the documentation of this file.
1 #include "__subsys__/__plgname__/plugins/__class__Producer.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<__class__> >(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<__class__ 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 ( ...; ...; ... ) {
72  __class__ hyp;
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::unique_ptr<std::vector<__class__> > ap_hyps( hyps );
87  iEvent.put( std::move(ap_hyps), outputName_);
88 
89 }
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
__class__Producer(const edm::ParameterSet &iConfig)
Definition: HeavyIon.h:7
int iEvent
Definition: GenABIO.cc:224
vector< PseudoJet > jets
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
HLT enums.
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)
def move(src, dest)
Definition: eostools.py:511