ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/CmsHi/HiGenTools/plugins/HiEventTruncator.cc
Revision: 1.3
Committed: Fri Apr 2 21:14:02 2010 UTC (15 years, 1 month ago) by bazterra
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
State: FILE REMOVED
Error occurred while calculating annotation data.
Log Message:
Seeding the HiEventTuner.

File Contents

# Content
1 // -*- C++ -*-
2 //
3 // Package: HiEventTruncator
4 // Class: HiEventTruncator
5 //
6 /**\class HiEventTruncator HiEventTruncator.cc GeneratorInterface/HiEventTruncator/src/HiEventTruncator.cc
7
8 Description: [one line class summary]
9
10 Implementation:
11 [Notes on implementation]
12 */
13 //
14 // Original Author: Yetkin Yilmaz,32 4-A08,+41227673039,
15 // Created: Sat Mar 27 18:18:33 CET 2010
16 // $Id: HiEventTruncator.cc,v 1.2 2010/03/27 17:56:13 yilmaz 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 "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
34 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
35 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
36 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
37 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
38
39 using namespace edm;
40
41 //
42 // class declaration
43 //
44
45 class HiEventTruncator : public edm::EDProducer {
46 public:
47 explicit HiEventTruncator(const edm::ParameterSet&);
48 ~HiEventTruncator();
49
50 private:
51 virtual void beginJob() ;
52 virtual void produce(edm::Event&, const edm::EventSetup&);
53 virtual void endJob() ;
54
55 // ----------member data ---------------------------
56 };
57
58 //
59 // constants, enums and typedefs
60 //
61
62
63 //
64 // static data member definitions
65 //
66
67 //
68 // constructors and destructor
69 //
70 HiEventTruncator::HiEventTruncator(const edm::ParameterSet& iConfig)
71 {
72
73
74 produces<HepMCProduct>();
75
76 produces<SimTrackContainer>();
77 produces<SimVertexContainer>();
78
79 produces<PSimHitContainer>("TrackerHitsTOBHighTof");
80 //... preferably not hardcoded
81 produces<PCaloHitContainer>("EcalHitsES");
82 //... preferably not hardcoded
83
84
85 //now do what ever other initialization is needed
86
87 }
88
89
90 HiEventTruncator::~HiEventTruncator()
91 {
92
93 // do anything here that needs to be done at desctruction time
94 // (e.g. close files, deallocate resources etc.)
95
96 }
97
98
99 //
100 // member functions
101 //
102
103 // ------------ method called to produce the data ------------
104 void
105 HiEventTruncator::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
106 {
107 using namespace edm;
108
109 Handle<HepMCProduct> hepmcHandle;
110 iEvent.getByLabel("generator",hepmcHandle);
111
112 Handle<SimTrackContainer> simtrackHandle;
113 iEvent.getByLabel("g4SimHits",simtrackHandle);
114
115 Handle<SimVertexContainer> simvertexHandle;
116 iEvent.getByLabel("g4SimHits",simvertexHandle);
117
118 Handle<PSimHitContainer> simhitHandle;
119 iEvent.getByLabel(InputTag("g4SimHits","TrackerHitsTOBHighTof"),simhitHandle);
120
121 Handle<PCaloHitContainer> calohitHandle;
122 iEvent.getByLabel(InputTag("g4SimHits","EcalHitsES"),calohitHandle);
123
124 std::auto_ptr<HepMCProduct> hepmcOut(new HepMCProduct);
125 std::auto_ptr<SimTrackContainer> simtrackOut(new SimTrackContainer);
126 std::auto_ptr<SimVertexContainer> simvertexOut(new SimVertexContainer);
127 std::auto_ptr<PSimHitContainer> simhitOut(new PSimHitContainer);
128 std::auto_ptr<PCaloHitContainer> calohitOut(new PCaloHitContainer);
129
130 // DO THE STUFF!
131 // ...
132 // ...
133
134 // Loop over particles to decide which ones survive
135
136 // Loop over simtrackHandle, fill simtrackOut for surviving tracks
137 // corresponding to the particles above
138
139 // Loop over simvertexHandle, fill simvertexOut for surviving vertices
140 // corresponding to the simtracks above
141
142 // Loop over simhitHandle, fill simhitOut for surviving hits
143 // corresponding to the simtracks above
144
145 // Loop over calohitHandle, fill calohitOut for surviving hits
146 // corresponding to the simtracks above
147
148 iEvent.put(hepmcOut);
149 iEvent.put(simtrackOut);
150 iEvent.put(simvertexOut);
151 iEvent.put(simhitOut);
152 iEvent.put(calohitOut);
153
154 }
155
156 // ------------ method called once each job just before starting event loop ------------
157 void
158 HiEventTruncator::beginJob()
159 {
160 }
161
162 // ------------ method called once each job just after ending the event loop ------------
163 void
164 HiEventTruncator::endJob() {
165 }
166
167 //define this as a plug-in
168 DEFINE_FWK_MODULE(HiEventTruncator);