ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/CmsHi/JetAnalysis/modifiedFiles/PFBlockProducer.cc
Revision: 1.1
Committed: Thu Sep 15 22:04:26 2011 UTC (13 years, 7 months ago) by yilmaz
Content type: text/plain
Branch: MAIN
CVS Tags: HiForest_V02_85, HiForest_V02_84, HiForest_V02_83, HiForest_V02_82, HiForest_V02_81, HiForest_V02_80, HiForest_V02_79, HiForest_V02_78, HiForest_V02_77, HiForest_V02_76, HiForest_V02_75, HiForest_V02_74, HiForest_V02_73, HiForest_V02_72, HiForest_V02_71, HiForest_V02_70, HiForest_V02_69, HiForest_V02_68, HiForest_V02_67, HiForest_V02_66, HiForest_V02_65, HiForest_V02_64, HiForest_V02_63, HiForest_V02_62, HiForest_V02_61, HiForest_V02_60, HiForest_V02_59, HiForest_V02_58, HiForest_V02_57, HiForest_V02_56, HiForest_V02_55, HiForest_V02_54, HiForest_V02_53, HiForest_V02_52, HiForest_V02_51, HiForest_V02_50, HiForest_V02_49, HiForest_V02_48, HiForest_V02_47, HiForest_V02_46, HiForest_V02_45, HiForest_V02_44, HiForest_V02_43, HiForest_V02_42, HiForest_V02_41, HiForest_V02_40, HiForest_V02_39, HiForest_V02_38, HiForest_V02_37, HiForest_V02_36, HiForest_V02_35, HiForest_V02_34, HiForest_V02_33, HiForest_V02_32, HiForest_V02_31, HiForest_V02_30, HiForest_V02_27, HiForest_V02_26, QM_2012, HiForest_V02_25, HiForest_V02_24, HiForest_V02_23, HiForest_V02_22, HiForest_V02_21, HiForest_V02_20, HiForest_V02_19, HiForest_V02_18, HiForest_V02_17, HiForest_V02_16, HiForest_V02_15, HiForest_V02_14, HiForest_V02_13, HiForest_V02_12, HiForest_V02_11, HiForest_V02_10, HiForest_V02_09, HiForest_V02_08, HiForest_V02_07, HiForest_V02_06, HiForest_V02_05, HiForest_V02_04, HiForest_V02_03, HiForest_V02_02, HiForest_V02_01, HiForest_V02_00, hi44X_02, hi413_03, hi441_1, hi441_0, hi413_11, hi413_10, hi413_09, hi413_08, hi413_07, hi413_06, hi413_05, hi413_04, hi413_02, hi39X_01, HEAD
Branch point for: branch_44x
Log Message:
muons

File Contents

# Content
1 #include "RecoParticleFlow/PFProducer/plugins/PFBlockProducer.h"
2
3 #include "RecoParticleFlow/PFClusterTools/interface/PFEnergyCalibration.h"
4 #include "RecoParticleFlow/PFClusterTools/interface/PFEnergyResolution.h"
5
6 #include "DataFormats/ParticleFlowReco/interface/PFLayer.h"
7 #include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
8 #include "DataFormats/ParticleFlowReco/interface/PFRecTrack.h"
9 #include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertexFwd.h"
10 #include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertex.h"
11 #include "DataFormats/ParticleFlowReco/interface/PFConversionFwd.h"
12 #include "DataFormats/ParticleFlowReco/interface/PFConversion.h"
13 #include "DataFormats/ParticleFlowReco/interface/PFV0Fwd.h"
14 #include "DataFormats/ParticleFlowReco/interface/PFV0.h"
15
16 #include "DataFormats/ParticleFlowReco/interface/PFBlock.h"
17 #include "DataFormats/ParticleFlowReco/interface/PFBlockFwd.h"
18
19 #include "FWCore/Framework/interface/ESHandle.h"
20
21 #include "FWCore/MessageLogger/interface/MessageLogger.h"
22 #include "FWCore/Utilities/interface/Exception.h"
23 #include "FWCore/Framework/interface/EventSetup.h"
24
25 #include "DataFormats/MuonReco/interface/MuonFwd.h"
26
27 #include "FWCore/ParameterSet/interface/FileInPath.h"
28
29 #include <set>
30
31 using namespace std;
32 using namespace edm;
33
34 PFBlockProducer::PFBlockProducer(const edm::ParameterSet& iConfig) {
35
36
37 // use configuration file to setup input/output collection names
38 inputTagRecTracks_
39 = iConfig.getParameter<InputTag>("RecTracks");
40
41 inputTagGsfRecTracks_
42 = iConfig.getParameter<InputTag>("GsfRecTracks");
43
44 inputTagConvBremGsfRecTracks_
45 = iConfig.getParameter<InputTag>("ConvBremGsfRecTracks");
46
47 inputTagRecMuons_
48 = iConfig.getParameter<InputTag>("RecMuons");
49
50 inputTagPFNuclear_
51 = iConfig.getParameter<InputTag>("PFNuclear");
52
53 inputTagPFConversions_
54 = iConfig.getParameter<InputTag>("PFConversions");
55
56 inputTagPFV0_
57 = iConfig.getParameter<InputTag>("PFV0");
58
59 inputTagPFClustersECAL_
60 = iConfig.getParameter<InputTag>("PFClustersECAL");
61
62 inputTagPFClustersHCAL_
63 = iConfig.getParameter<InputTag>("PFClustersHCAL");
64
65 inputTagPFClustersHFEM_
66 = iConfig.getParameter<InputTag>("PFClustersHFEM");
67
68 inputTagPFClustersHFHAD_
69 = iConfig.getParameter<InputTag>("PFClustersHFHAD");
70
71 inputTagPFClustersPS_
72 = iConfig.getParameter<InputTag>("PFClustersPS");
73
74
75
76 verbose_ =
77 iConfig.getUntrackedParameter<bool>("verbose",false);
78
79 bool debug_ =
80 iConfig.getUntrackedParameter<bool>("debug",false);
81
82 usePFatHLT_ = iConfig.getParameter<bool>("usePFatHLT");
83
84 useNuclear_ = iConfig.getParameter<bool>("useNuclear");
85
86 useConversions_ = iConfig.getParameter<bool>("useConversions");
87
88 useConvBremGsfTracks_ = iConfig.getParameter<bool>("useConvBremGsfTracks");
89
90 bool useConvBremPFRecTracks = iConfig.getParameter<bool>("useConvBremPFRecTracks");
91
92 useV0_ = iConfig.getParameter<bool>("useV0");
93
94 produces<reco::PFBlockCollection>();
95
96
97
98 // particle flow parameters -----------------------------------
99
100 std::vector<double> DPtovPtCut
101 = iConfig.getParameter<std::vector<double> >("pf_DPtoverPt_Cut");
102
103 std::vector<unsigned> NHitCut
104 = iConfig.getParameter<std::vector<unsigned> >("pf_NHit_Cut");
105
106 bool useIterTracking
107 = iConfig.getParameter<bool>("useIterTracking");
108
109 int nuclearInteractionsPurity
110 = iConfig.getParameter<unsigned>("nuclearInteractionsPurity");
111
112 pfBlockAlgo_.setParameters( DPtovPtCut,
113 NHitCut,
114 useConvBremPFRecTracks,
115 useIterTracking,
116 nuclearInteractionsPurity);
117
118 pfBlockAlgo_.setDebug(debug_);
119
120 }
121
122
123
124 PFBlockProducer::~PFBlockProducer() { }
125
126
127
128 void
129 PFBlockProducer::beginJob() { }
130
131 void
132 PFBlockProducer::beginRun(edm::Run & run,
133 const edm::EventSetup & es) { }
134
135
136 void
137 PFBlockProducer::produce(Event& iEvent,
138 const EventSetup& iSetup) {
139
140 LogDebug("PFBlockProducer")<<"START event: "<<iEvent.id().event()
141 <<" in run "<<iEvent.id().run()<<endl;
142
143
144 // get rectracks
145
146 Handle< reco::PFRecTrackCollection > recTracks;
147
148 // LogDebug("PFBlockProducer")<<"get reco tracks"<<endl;
149 bool found = iEvent.getByLabel(inputTagRecTracks_, recTracks);
150
151 if(!found )
152 LogError("PFBlockProducer")<<" cannot get rectracks: "
153 <<inputTagRecTracks_<<endl;
154
155
156
157 // get GsfTracks
158 Handle< reco::GsfPFRecTrackCollection > GsfrecTracks;
159
160 if(!usePFatHLT_) {
161 found = iEvent.getByLabel(inputTagGsfRecTracks_,GsfrecTracks);
162
163 if(!found )
164 LogError("PFBlockProducer")<<" cannot get Gsfrectracks: "
165 << inputTagGsfRecTracks_ <<endl;
166 }
167
168 // get ConvBremGsfTracks
169 Handle< reco::GsfPFRecTrackCollection > convBremGsfrecTracks;
170
171 if(useConvBremGsfTracks_) {
172 found = iEvent.getByLabel(inputTagConvBremGsfRecTracks_,convBremGsfrecTracks);
173
174 if(!found )
175 LogError("PFBlockProducer")<<" cannot get ConvBremGsfrectracks: "
176 << inputTagConvBremGsfRecTracks_ <<endl;
177 }
178
179 // get recmuons
180 Handle< reco::MuonCollection > recMuons;
181
182 // LogDebug("PFBlockProducer")<<"get reco muons"<<endl;
183 //if(!usePFatHLT_) {
184 found = iEvent.getByLabel(inputTagRecMuons_, recMuons);
185
186 //if(!found )
187 // LogError("PFBlockProducer")<<" cannot get recmuons: "
188 // <<inputTagRecMuons_<<endl;
189
190 // get PFNuclearInteractions
191 //}
192 //---------- Gouzevitch
193 // Handle< reco::PFNuclearInteractionCollection > pfNuclears;
194 Handle< reco::PFDisplacedTrackerVertexCollection > pfNuclears;
195
196 if( useNuclear_ ) {
197 found = iEvent.getByLabel(inputTagPFNuclear_, pfNuclears);
198
199
200 if(!found )
201 LogError("PFBlockProducer")<<" cannot get PFNuclearInteractions : "
202 <<inputTagPFNuclear_<<endl;
203 }
204
205
206
207
208 // get conversions
209 Handle< reco::PFConversionCollection > pfConversions;
210 if( useConversions_ ) {
211 found = iEvent.getByLabel(inputTagPFConversions_, pfConversions);
212
213 if(!found )
214 LogError("PFBlockProducer")<<" cannot get PFConversions : "
215 <<inputTagPFConversions_<<endl;
216 }
217
218
219 // get V0s
220 Handle< reco::PFV0Collection > pfV0;
221 if( useV0_ ) {
222 found = iEvent.getByLabel(inputTagPFV0_, pfV0);
223
224 if(!found )
225 LogError("PFBlockProducer")<<" cannot get PFV0 : "
226 <<inputTagPFV0_<<endl;
227 }
228
229
230
231 // get ECAL, HCAL and PS clusters
232
233
234 Handle< reco::PFClusterCollection > clustersECAL;
235 found = iEvent.getByLabel(inputTagPFClustersECAL_,
236 clustersECAL);
237 if(!found )
238 LogError("PFBlockProducer")<<" cannot get ECAL clusters: "
239 <<inputTagPFClustersECAL_<<endl;
240
241
242 Handle< reco::PFClusterCollection > clustersHCAL;
243 found = iEvent.getByLabel(inputTagPFClustersHCAL_,
244 clustersHCAL);
245 if(!found )
246 LogError("PFBlockProducer")<<" cannot get HCAL clusters: "
247 <<inputTagPFClustersHCAL_<<endl;
248
249 Handle< reco::PFClusterCollection > clustersHFEM;
250 found = iEvent.getByLabel(inputTagPFClustersHFEM_,
251 clustersHFEM);
252 if(!found )
253 LogError("PFBlockProducer")<<" cannot get HFEM clusters: "
254 <<inputTagPFClustersHFEM_<<endl;
255
256 Handle< reco::PFClusterCollection > clustersHFHAD;
257 found = iEvent.getByLabel(inputTagPFClustersHFHAD_,
258 clustersHFHAD);
259 if(!found )
260 LogError("PFBlockProducer")<<" cannot get HFHAD clusters: "
261 <<inputTagPFClustersHFHAD_<<endl;
262
263
264 Handle< reco::PFClusterCollection > clustersPS;
265 found = iEvent.getByLabel(inputTagPFClustersPS_,
266 clustersPS);
267 if(!found )
268 LogError("PFBlockProducer")<<" cannot get PS clusters: "
269 <<inputTagPFClustersPS_<<endl;
270
271 if( usePFatHLT_ ) {
272 pfBlockAlgo_.setInput( recTracks,
273 recMuons,
274 clustersECAL,
275 clustersHCAL,
276 clustersHFEM,
277 clustersHFHAD,
278 clustersPS );
279 } else {
280 pfBlockAlgo_.setInput( recTracks,
281 GsfrecTracks,
282 convBremGsfrecTracks,
283 recMuons,
284 pfNuclears,
285 pfConversions,
286 pfV0,
287 clustersECAL,
288 clustersHCAL,
289 clustersHFEM,
290 clustersHFHAD,
291 clustersPS );
292 }
293 pfBlockAlgo_.findBlocks();
294
295 if(verbose_) {
296 ostringstream str;
297 str<<pfBlockAlgo_<<endl;
298 LogInfo("PFBlockProducer") << str.str()<<endl;
299 }
300
301 auto_ptr< reco::PFBlockCollection >
302 pOutputBlockCollection( pfBlockAlgo_.transferBlocks() );
303
304
305 iEvent.put(pOutputBlockCollection);
306
307 LogDebug("PFBlockProducer")<<"STOP event: "<<iEvent.id().event()
308 <<" in run "<<iEvent.id().run()<<endl;
309 }