Revision: | 1.1 |
Committed: | Wed Jun 8 17:25:32 2011 UTC (13 years, 11 months ago) by tboccali |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | EDMV42_Step2_V6, EDMV42_Step2_V5a, EDMV42_Step2_V5, tauCandV42, hbbsubstructDev_11, hbbsubstructDev_10, hbbsubstructDev_9, hbbsubstructDev_8, hbbsubstructDev_7, hbbsubstructDev_6, hbbsubstructDev_5, hbbsubstructDev_4, hbbsubstructDev_3, hbbsubstructDev_2, hbbsubstructDev_1, hbbsubstructDev, V21TauCand_0, TauCandidates_0, EDMV42_Step2_V4a, EDMV42_Step2_V4, EDMV42_Step2_V3, EDMV42_Step2_V2, EDMV42_Step2_V1, EdmV42, EdmV41alpha1, EdmV40alpha1, EdmV40alpha, V21emuCand, EdmV33Jun12v2_consistent, Step2ForV33_v2, Step2ForV33_v1, EdmV33Jun12v2, EdmV33Jun12v1, EdmV33Jun12v0, Step2ForV32_v2, Step2ForV32_v0, Step2ForV31_v0, EdmV32May24v0, EdmV31May21v1, EdmV31May17v0, May14thStep2, EdmV30Apr10, EdmV21Apr10v2, EdmV22May9, EdmV21Apr06, EdmV21Apr10, EdmV21Apr04, EdmV21Apr03, EdmV21Apr2, EdmV21Mar30, EdmV20Mar12, EdmV11Oct2011_fixMET, EdmV11Oct2011, EdmV10Oct2011, EdmV9Sept2011, Sept19th2011_2, Sept19th2011, Sept19th, VHNtupleV9_AR1, VHSept15_AR1, Sept14th2011_2, Sept14th2011, Sept13th2011, AR_Sep8_LightNtuple, VHBB_EDMNtupleV3, AndreaAug10th, HBB_EDMNtupleV1_ProcV2, Jul28th2011, Jul26th2011, Jul25th2011, Jul22nd2011, Jul21st2011, Jul20th2011, Jul18th2011, Jul17th2011, Jul8th2011, Jun30th2011, Jun28th2011, Jun21th2011, Jun16th2011, Jun15th2011, Jun14th2011, Jun9th2011v2, Jun9th2011, HEAD |
Branch point for: | V42TauCandidate, hbbsubstructDevPostHCP, V21TauCand, TauCandidatesV21, V21emuCandidate |
Log Message: | first addition |
# | User | Rev | Content |
---|---|---|---|
1 | tboccali | 1.1 | // -*- C++ -*- |
2 | // | ||
3 | // Package: SubProducer | ||
4 | // Class: SubProducer | ||
5 | // | ||
6 | /**\class SubProducer SubProducer.cc Prod/SubProducer/src/SubProducer.cc | ||
7 | |||
8 | Description: <one line class summary> | ||
9 | |||
10 | Implementation: | ||
11 | <Notes on implementation> | ||
12 | */ | ||
13 | // | ||
14 | // Original Author: David Lopes Pegna,Address unknown,NONE, | ||
15 | // Created: Wed Jul 22 19:17:38 EDT 2009 | ||
16 | // $Id: SubProducer.cc,v 1.1 2011/02/22 21:52:54 dlopes Exp $ | ||
17 | // | ||
18 | // | ||
19 | |||
20 | |||
21 | // system include files | ||
22 | #include <memory> | ||
23 | |||
24 | // user include files | ||
25 | #include "FWCore/Framework/interface/Frameworkfwd.h" | ||
26 | #include "FWCore/Framework/interface/EDProducer.h" | ||
27 | |||
28 | #include "FWCore/Framework/interface/Event.h" | ||
29 | #include "FWCore/Framework/interface/MakerMacros.h" | ||
30 | |||
31 | #include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
32 | |||
33 | #include "DataFormats/JetReco/interface/BasicJet.h" | ||
34 | #include "DataFormats/JetReco/interface/BasicJetCollection.h" | ||
35 | |||
36 | // | ||
37 | // class decleration | ||
38 | // | ||
39 | |||
40 | class SubProducer : public edm::EDProducer { | ||
41 | public: | ||
42 | explicit SubProducer(const edm::ParameterSet&); | ||
43 | ~SubProducer(); | ||
44 | |||
45 | private: | ||
46 | virtual void beginJob() ; | ||
47 | virtual void produce(edm::Event&, const edm::EventSetup&); | ||
48 | virtual void endJob() ; | ||
49 | |||
50 | // ----------member data --------------------------- | ||
51 | |||
52 | edm::InputTag jetLabel_; | ||
53 | |||
54 | }; | ||
55 | |||
56 | // | ||
57 | // constants, enums and typedefs | ||
58 | // | ||
59 | |||
60 | |||
61 | // | ||
62 | // static data member definitions | ||
63 | // | ||
64 | |||
65 | // | ||
66 | // constructors and destructor | ||
67 | // | ||
68 | SubProducer::SubProducer(const edm::ParameterSet& iConfig): | ||
69 | jetLabel_(iConfig.getUntrackedParameter<edm::InputTag>("jetTag")) | ||
70 | { | ||
71 | //register your products | ||
72 | /* Examples | ||
73 | produces<ExampleData2>(); | ||
74 | |||
75 | //if do put with a label | ||
76 | produces<ExampleData2>("label"); | ||
77 | */ | ||
78 | //now do what ever other initialization is needed | ||
79 | produces<reco::BasicJetCollection>(); | ||
80 | |||
81 | } | ||
82 | |||
83 | |||
84 | SubProducer::~SubProducer() | ||
85 | { | ||
86 | |||
87 | // do anything here that needs to be done at desctruction time | ||
88 | // (e.g. close files, deallocate resources etc.) | ||
89 | |||
90 | } | ||
91 | |||
92 | |||
93 | // | ||
94 | // member functions | ||
95 | // | ||
96 | |||
97 | // ------------ method called to produce the data ------------ | ||
98 | void | ||
99 | SubProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) | ||
100 | { | ||
101 | using namespace edm; | ||
102 | using namespace reco; | ||
103 | |||
104 | std::auto_ptr<BasicJetCollection> SubJetList( new BasicJetCollection() ); | ||
105 | |||
106 | edm::Handle<BasicJetCollection> jetHandle; | ||
107 | iEvent.getByLabel(jetLabel_,jetHandle); | ||
108 | |||
109 | for(BasicJetCollection::const_iterator it(jetHandle->begin()), itEnd(jetHandle->end()); it!=itEnd;++it) | ||
110 | { | ||
111 | reco::Jet::Constituents constituents = it->getJetConstituents(); | ||
112 | |||
113 | for (unsigned int iJC(0); iJC<constituents.size(); ++iJC ){ | ||
114 | Jet::Constituent icandJet = constituents[iJC]; | ||
115 | |||
116 | // std::cout << "and here : " << icandJet->pt() << "\n"; | ||
117 | const BasicJet * subjet = static_cast<const BasicJet * >(&*icandJet); | ||
118 | |||
119 | // if(subjet!=0) std::cout << "here I am: " << subjet->pt() << "\n"; | ||
120 | if(subjet!=0) SubJetList->push_back(*subjet); | ||
121 | |||
122 | } | ||
123 | |||
124 | } | ||
125 | |||
126 | iEvent.put(SubJetList); | ||
127 | |||
128 | } | ||
129 | |||
130 | // ------------ method called once each job just before starting event loop ------------ | ||
131 | void | ||
132 | SubProducer::beginJob() | ||
133 | { | ||
134 | } | ||
135 | |||
136 | // ------------ method called once each job just after ending the event loop ------------ | ||
137 | void | ||
138 | SubProducer::endJob() { | ||
139 | } | ||
140 | |||
141 | //define this as a plug-in | ||
142 | DEFINE_FWK_MODULE(SubProducer); |